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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define erep(i, n) for (int i = 0; i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define clr(a, x) memset(a, x, sizeof(a))
#define sz(a) ((int)(a).size())
#define mp(a, b) make_pair(a, b)
#define ten(n) ((long long)(1e##n))

const int INF = 1e9+7;

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    rep(i, n) { cin >> a[i]; b[i] = a[i]; }

    sort(b.begin(), b.end());
    b.erase(unique(b.begin(), b.end()), b.end());
    reverse(b.begin(), b.end());

    ll ans = 0;
    ll ma = 1;

    rep(i, n) {
        if (ma < a[i]) {
            int t = a[i]-1;
            if (t && ma <= t) {
                ans += (t/ma);
                ma = (ma > 2 ? ma : 2);
            }
            else {
                ma = a[i]+1;
            }
        }
        else if (ma == a[i]) ma++;

        // if (ma < a[i]) {
        //     if (!(a[i]%ma)) {
        //         int t = a[i]-1;
        //         if (ma < t) {
        //             ans += (t/ma);
        //         }
        //         else {
        //             t = ma-a[i];
        //
        //         }
        //     }
        //     else {
        //         ans += (a[i]/ma);
        //         int t = ma;
        //         while (a[i]-(t*(a[i]/t)) >= ma) ma++;
        //     }
        //
        // }
        // else if (ma == a[i]) ma++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 1152
#include <iostream>

using namespace std;

int main(){
    long long N;
    cin >> N;


    long long A, B;
    for (long long i = 1; i * i <= N; i++){
        if (N % i == 0){
            A = i;
            B = N / i;
        }
    }
    
    int ans = 0;
    while (B > 0){
        ans ++;
        B = B / 10;
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int n,m,i,a[101],c=0,sum=0;
  scanf("%d %d", &n, &m);
  
  for(i=1; i<=n; i++){
    scanf("%d", &a[i]);
    sum+=a[i];
  }
  
  for(i=1; i<=n; i++){
    if(4*m*a[i] >= sum) c++;
  }
  
  if(c>=m) {
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  
  return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <memory>
#include <string>
#include <cstdlib>
#include <set>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <cmath>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>
#include <cassert>
#include <chrono>
#include <memory>

using namespace std;

#define int long long
//region TEMPLATE
////@formatter:off
#define double long double
typedef long long ll;
typedef unsigned long long ull;
template<typename T>void __read(T &a) { cin >> a; }
template<typename T, typename ... Args> void __read(T &a, Args &... args) { cin >> a;__read(args...);}
#define make(t, ...) t __VA_ARGS__; __read(__VA_ARGS__)
#define makev(a, n) VI a(n); FOR(n) cin >> a[i];
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define FORE(i, l, r) for(int i = (l); i < (r); i++)
#define NFOR(i, n) for(int i = (((int) n)-1); i >= 0; i--)
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PPII;
constexpr ll M7 = 1000000007ll;
constexpr ll M9 = 1000000009ll;
constexpr ll MFFT = 998244353ll;
template<class T> void outv(T &a) { for (auto &x : a) cout << x << ' '; }
static mt19937 rnd(static_cast<unsigned>(chrono::steady_clock::now().time_since_epoch().count())); // NOLINT(cert-err58-cpp)
auto __fast_io__ = (ios_base::sync_with_stdio(false), cin.tie(nullptr)); // NOLINT(cert-err58-cpp,cppcoreguidelines-interfaces-global-init)
////@formatter:on
//endregion



int32_t main() {
    make(int, n);
    make(string, s);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int cnt[] = {0, 0, 0};
        for (int j = i + 1; j < n; ++j) {
            if (s[j] == 'R') cnt[0]++;
            if (s[j] == 'G') cnt[1]++;
            if (s[j] == 'B') cnt[2]++;
        }
        for (int j = i + 1; j < n; ++j) {
            if (s[j] == 'R') cnt[0]--;
            if (s[j] == 'G') cnt[1]--;
            if (s[j] == 'B') cnt[2]--;
            if (s[j] == s[i]) continue;
            char c;
            if (s[i] != 'R' && s[j] != 'R') c = 'R';
            if (s[i] != 'G' && s[j] != 'G') c = 'G';
            if (s[i] != 'B' && s[j] != 'B') c = 'B';
            if (c == 'R') ans += cnt[0];
            if (c == 'G') ans += cnt[1];
            if (c == 'B') ans += cnt[2];
            int k = j + (j - i);
            if (k < n && s[k] == c) ans--;
        }
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 3656
import sys
input = sys.stdin.readline

N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(N)]

count = 0
for j in range(N):
    t = 0
    for i in range(M):
        t += A[j][i]*B[i]
    t += C
    if(t > 0):
        count += 1

print(count)

Measured memory_bytes: 3064
def examA():
    S = SI()
    if S in alphabet:
        ans = "a"
    else:
        ans = "A"
    print(ans)
    return

def examB():
    N, K = LI()
    P = LI()
    P.sort()
    ans = sum(P[:K])
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examB()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 78228
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

int main()
{
    ciosup;
    int n, d, ans;
    cin >> n >> d;
    ans = (n % (2 * d + 1) == 0 ? n / (2 * d + 1) : n / (2 * d + 1) + 1);
    cout << ans << endl;
}

Measured memory_bytes: 256
import bisect

n = int(input())
s = list(input())
q = int(input())

pos = [[] for i in range(26)]
alp = "abcdefghijklmnopqrstuvwxyz"
atoi = {}
for i in range(26):
    atoi[alp[i]] = i
for i in range(n):
    pos[atoi[s[i]]].append(i)

for i in range(q):
    a, b, c = input().split()
    if a == "1":
        b = int(b)-1
        if c == s[b]:
            continue
        index = bisect.bisect_left(pos[atoi[s[b]]], b)
        del pos[atoi[s[b]]][index]
        bisect.insort_left(pos[atoi[c]], b)
        s[b] = c
    else:
        l, r = int(b)-1, int(c)
        ans = 0
        for i in range(26):
            cnt = bisect.bisect_left(pos[i], r) - bisect.bisect_left(pos[i], l)
            if cnt > 0:
                ans += 1
        print(ans)

Measured memory_bytes: 30344
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
  static FastReader fr = new FastReader();

  public static void main(String [] args) {
    int N = fr.nextInt();
    int M = fr.nextInt();
    int L = fr.nextInt();

    final long INF = 1L << 60;
    long [][] G = new long[N][N];
    int [][] dist = new int[N][N];
    for (int i = 0; i < N; i++) {
      Arrays.fill(G[i], INF);
      Arrays.fill(dist[i], 9999);
      G[i][i] = 0;
      dist[i][i] = 0;
    }

    for (int i = 0; i < M; i++) {
      int A = fr.nextInt() - 1;
      int B = fr.nextInt() - 1;
      int C = fr.nextInt();

      G[A][B] = G[B][A] = C;
    }

    for (int k = 0; k < N; k++) {
      for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
          if (G[i][k] + G[k][j] < G[i][j])
            G[i][j] = G[i][k] + G[k][j];
        }
      }
    }

    for (int i = 0; i < N; i++) {
      for (int j = i + 1; j < N; j++) {
        if (G[i][j] <= L) {
          dist[i][j] = dist[j][i] = 1;
        }
      }
    }

    for (int k = 0; k < N; k++) {
      for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
          if (dist[i][k] + dist[k][j] < dist[i][j])
            dist[i][j] = dist[i][k] + dist[k][j];
        }
      }
    }

    int Q = fr.nextInt();
    PrintWriter writer = new PrintWriter(System.out);
    for (int i = 0; i < Q; i++) {
      int S = fr.nextInt() - 1;
      int T = fr.nextInt() - 1;
      writer.println(dist[S][T] > 999 ? -1 : dist[S][T] - 1);
    }
    writer.flush();
  }
}

class FastReader {
  BufferedReader br;
  StringTokenizer st;

  public FastReader() {
    br = new BufferedReader(new
        InputStreamReader(System.in));
  }

  String next() {
    while (st == null || !st.hasMoreElements())
    {
      try
      {
        st = new StringTokenizer(br.readLine());
      }
      catch (IOException e)
      {
        e.printStackTrace();
      }
    }
    return st.nextToken();
  }

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

  long nextLong() {
    return Long.parseLong(next());
  }

  double nextDouble() {
    return Double.parseDouble(next());
  }

  String nextLine() {
    String str = "";
    try {
      str = br.readLine();
    }
    catch (IOException e) {
      e.printStackTrace();
    }
    return str;
  }
}

Measured memory_bytes: 48252
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,count = 0,f = 0;
	cin>>a;
	int moto[a+1];
	for(int i = 0;i<a;i++){
		cin>>moto[i];
	}
	cin>>b;
	int aru[b];
	for(int i = 0;i<b;i++){
		cin>>aru[i];
	}
	for(int i = 0;i<b;i++){
		moto[a] = aru[i];
		int j = 0;
		while(moto[j] != aru[i]){
			j++;
			if(j>=a){
				f = 1;
			}
		}
		if(f == 0){
			count++;
		}
		f = 0;
	}
	cout<<count<<endl;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  int b;
  string c;
  cin >> a >> b;
  string shapeText = "";
  
  for (int i = 0; i < b + 2 ; i++) {
    shapeText.push_back('#');
  }
  cout << shapeText << endl;
  for (int i = 0; i < a; i++) {
      cin >> c;
      cout << '#' + c + '#' << endl;
  }
  cout << shapeText << endl;
}

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

int main()
{
    int n, ans = 3000;
    cin>>n;
    string s1, s2;
    cin>>s1>>s2;

    for(int i=0; i<n; i++)
    {
       int test = 0;
       for(int ii = i, j=0; ii<n; j++, ii++)
       {
           if(s1[ii] != s2[j])
           {
             test = 0;
             break;
           }
           test++;
       }
       if(test != 0)
       {

           ans = n + (n - test);
           break;
       }
    }
    if(ans == 3000)
        ans = 2*n;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
taro = 0
hanako = 0
for _ in range(n):
    cards = input().split()
    if cards[0] == cards[1]:
        taro += 1
        hanako += 1
    elif cards == sorted(cards):
        taro += 3
    else:
        hanako += 3
print(hanako, taro)


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

meals = list(map(int, input().split()))
likes = list(map(int, input().split()))
addLikes = list(map(int, input().split()))

total_like = 0

for i in range(n):
  meal = meals[i]
  like = likes[meal-1]
  if i < n-1 and meal == meals[i+1]-1:
    like += addLikes[meal-1]
  total_like += like
    
print(total_like)

Measured memory_bytes: 38384
<?php

$str = strtolower(trim(fgets(STDIN))); //1行目の文字列str

$q = intval(trim(fgets(STDIN))); //2行目の命令の数q


//qの回数だけ処理をくりかえす
for ($i = 0; $i < $q; $i++) {

    //命令文を読み込んで配列にする
    $orders = explode(' ', trim(fgets(STDIN)));

    //1つ目を命令ワードに格納する
    $order = strval($orders[0]);

    //2つ目を$a（文字目）に格納する
    $a = intval($orders[1]);

    //3つ目を$b（文字目）に格納する
    $b = intval($orders[2]);

    //切り出す部分の長さ
    $length = intval($b - $a + 1);

    //3つの命令分岐

    if ($order == "print") {
        echo substr($str, $a, $length) . "\n";
    } elseif ($order == "reverse") {
        $replace_str = substr($str, $a, $length);
        $replace_rev = strrev($replace_str);
        $result = substr_replace($str, $replace_rev, $a, $length);
        $str = $result;
    } elseif ($order == "replace") {
        $result = substr_replace($str, $orders[3], $a, $length);
        $str = $result;
    }
}


Measured memory_bytes: 9316
import java.util.Scanner;

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

    int N = scanner.nextInt();
    long x = scanner.nextInt();
    long[] a = new long[N];
    for (int i = 0; i < N; i++) a[i] = scanner.nextInt();

    long count = 0;
    for (int i = 0; i < N; i++) {
      count += Math.max(0, a[i] - x);
      a[i] = Math.min(a[i], x);
    }
    for (int i = 0; i < N - 1; i++) {
      if (a[i] + a[i + 1] > x) {
        long delta = a[i] + a[i + 1] - x;
        count += delta;
        a[i + 1] -= delta;
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 63156
#include "bits/stdc++.h"
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair <ll, ll > pll;
//bool comp(
//
//	st pll &a, const pll &b) {
//	return a.first < b.first;
//}
//std::vector<int> enum_div(int n)//nの約数を列挙
//{
//	std::vector<int> ret;
//	for (int i = 1; i*i <= n; ++i)
//	{
//		if (n%i == 0)
//		{
//			ret.push_back(i);
//			if (i != 1 && i*i != n)
//			{
//				ret.push_back(n / i);
//			}
//		}
//	}
//	return ret;
//}

template<int N>
int factorial() {
	return factorial<N - 1>() * N;
}

template<>  /// 特殊化：factorial<N=”1”>だったら，値を返す
int factorial<1>() {
	return 1;
}

int main()
{
	priority_queue<int> q;
	ll h, w, a, b, ans = 0;
	string s = {};
	cin >> a;
	cin >> b;

	if (a == 3)
	{
		ans += 100000;
	}if (a == 2)
	{
		ans += 200000;
	}
	if (a == 1)
	{
		ans += 300000;
	}
	if (b == 3)
	{
		ans += 100000;
	}if (b == 2)
	{
		ans += 200000;
	}
	if (b == 1)
	{
		ans += 300000;
	}
	if (a==1&&b==1)
	{
		ans += 400000;
	}

	//cout<<factorial<10><<endl;

	cout << ans << endl;
	//cin >> a >> b;
	//for (int i = 0; i < a; i++)
	//{
	//	cin >> s[i];
	//	if (s[i] >= b)
	//	{
	//		ans++;
	//	}
	//}

	//cout << ans << endl;
	return 0;
}
//2つの組の数をソートしたりするやつ
//vector<pair<ll, ll> > hoges(a);
//for (int i = 1; i <= a; i++)
//{
//	cin >> h;
//	hoges[i - 1] = make_pair(h, i);
//}
//sort(hoges.begin(), hoges.end(), comp);
//for (int i = 0; i < a; i++)
//{
//	cout << hoges[i].second << endl;
//}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <functional>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
using namespace std;
// #define int long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = (((1<<30)-1)<<1)+1;
const int nINF = 1<<31;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<char, int> pci;

/////////////////////////////////////////////////////////////////////
const ll M = 1e9+7;

signed main() {
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(7);
    int n;
    cin >> n;
    ll ans = 1;
    map<char, int> m;
    REP(i, n) {
    	char c;
    	cin >> c;
    	++m[c];
    }
    for(auto& p : m) ans = (ans * (p.second+1)) % M;
    cout << ans-1 << endl;

    return 0;
}

// Easy things to check:
// - LONG LONGS (WA)
// - const int N is correct (WA, RTE)
// - .size()-k underflow (WA, RTE, TLE)
// - small n edge cases (WA)

// Rare mistakes made in the past:
// - division by 0 (WA)
// - integer division (WA)
// - setprecision (WA)
// - INF not big enough using ll (WA)
// - setting max to 0 instead of -INF/min to 0 instead of INF (WA)
// - outputting debug (WA)
// - allocating too much memory (locRTE, MLE)
// - stack size (locRTE)
// - round announcements (WA)
// - multiset::erase (WA)



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

class dice {
  int dice[6];
  string state;
public:
  void input(void) {
    for (int i=0; i<6; i++) {
      cin >> dice[i];
    }
  }
  void move(void) {
    cin >> state;
    for (int i=0; i<state.length(); i++) {
      switch (state[i]) {
      case 'N':
        swap(dice[0],dice[1]);
        swap(dice[1],dice[5]);
        swap(dice[5],dice[4]);
        break;
      case 'S':
        swap(dice[0], dice[4]);
        swap(dice[4], dice[5]);
        swap(dice[5], dice[1]);
        break;
      case 'E':
        swap(dice[0], dice[3]);
        swap(dice[3], dice[5]);
        swap(dice[5], dice[2]);
        break;
      case 'W':
        swap(dice[0], dice[2]);
        swap(dice[2], dice[5]);
        swap(dice[5], dice[3]);
        break;
      default:
        break;
      }
    }
  }
  void output(void) {
    cout << dice[0] << endl;
  }
};

int main(void) {
  dice d;
  d.input();
  d.move();
  d.output();
}

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

int main(){
	int a,b,k;
	set<int> st;
	cin>>a>>b>>k;
	for(int i=0;i<k;i++){
		if(a+i>b||b-i<a) continue;
		st.insert(a+i);
		st.insert(b-i);
	}
	for(set<int>::iterator it=st.begin();it!=st.end();it++)
		cout<<*it<<endl;
	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <climits>
#include <cstdint>
using namespace std;

int main() {
    int l, r; cin >> l >> r;

    if (l <= r / 2019 * 2019) {
        cout << 0 << endl;
        return 0;
    }

    int64_t ans = INT_MAX;
    for (int64_t i = l; i < r; ++i) {
        for (int64_t j = i + 1; j <= r; ++j) {
            ans = min(ans, i * j % 2019);
        }
    }

    cout << ans << endl;

    // 45 * 46 % 2019 = 51
    // 8 * 9 % 2019 = 72
    // のため、2019を倍数に含まない数列に対してでも左から2個取ったものが最適解とは限らない
    //cout << ((l % 2019) * ((l + 1) % 2019) % 2019) << endl;
}



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

using namespace std;

typedef long long int ll;
typedef long long unsigned int llu;
#define tc long long int t; cin>>t; while(t--)
#define  sync ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define mpi unordered_map<ll, ll>
#define mpc unordered_map<char, ll>
#define map_loop(it,m) for(auto it = m.begin(); it!=m.end(); it++)
#define rep(i,n) for(ll i=0;i<n;i++)



template<typename... T>
void read(T&... args){
  ((cin>>args), ...);
}

template<typename... T>
void write(T... args){
  ((cout<<args<<" "), ...);
}


int main(){
  
  sync;
  ll n;
  read(n);
  
  int a[n],b[n]={0};
  
  for(int i=1;i<n;i++){
    cin>>a[i];
    b[a[i]-1]++;
  }
  
  rep(i,n){
      cout<<b[i]<<endl;
  }
    
  
  
  
}


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

#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long ll;
typedef long double ld;

const int max_n = 1, inf = 1000111222;

int main()
{
    //freopen("input.txt", "r", stdin);
    ll l, r;
    cin >> l >> r;
    if (r - l < 2200) {
        ll ans = inf;
        for (ll i = l; i < r; ++i) {
            for (ll j = i + 1; j <= r; ++j) {
                ans = min(ans, (i * j) % 2019);
            }
        }
        cout << ans << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}




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

int main()
{
    long long a[10000];
    long long n,m,c=0;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>a[i];
    }
    for(int i=0;i<m;i++){
        c=c+a[i];
    }
    if(n>=c) cout<<n-c<<endl;
    else cout<<"-1"<<endl;
    return 0;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
using namespace std;

int main() {
	int a,b,c;
	cin>>a>>b>>c;
	if(b-a==c-b) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using tsii = tuple<string, int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    int n;
    cin>>n;
    vector<tsii> v(n);
    for (int i = 0; i < n; i++)
    {
        string s;
        int p;
        cin>>s>>p;
        v[i] = make_tuple(s,-p,i+1);
    }
    sort(all(v));
    for (int i = 0; i < n; i++)
    {
        cout<<get<2>(v[i])<<endl;
    }
        
    
    return 0;
}

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

#define ll long long
#define MOD 1000000007

void In_Out() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
}
int m, n, p;
ll dp[1005][1005] = {0};

void display_grid(std::vector<vector<ll>> v) {
	for (auto ele : v) {
		for (auto item : ele) {
			cout << item << " ";
		}
		cout << endl;
	}
}

ll total_ways(int m, int n) {
	// if the starting block is blocked then no ways exist to reach dest.
	if (dp[0][0] == -1)
		return 0;
	// if the destination cell is blocked, there exists no way to reach it
	if (dp[m - 1][n - 1] == -1)
		return 0;
	// marking all the unblocked cells in the 0th row as 1 until we reach a cell which is blocked,
	// since after that blocked cell there would be no ways to reach any cells further in the 0th row
	for (int j = 0; j < n; j++) {
		if (dp[0][j] == -1)
			break;
		dp[0][j] = 1;
	}
	// similarly, for the 0th column
	for (int i = 0; i < m; i++) {
		if (dp[i][0] == -1)
			break;
		dp[i][0] = 1;
	}
	for (int i = 1; i < m; i++) {
		for (int j = 1; j < n; j++) {
			if (dp[i][j] == -1)
				continue;
			if (dp[i][j - 1] != -1) {
				dp[i][j] = dp[i][j - 1] % MOD;
			}
			if (dp[i - 1][j] != -1) {
				dp[i][j] = (dp[i][j] + dp[i - 1][j]) % MOD;
			}

		}
	}
	return dp[m - 1][n - 1];
}

int main() {
	// In_Out();
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> m >> n;
	for (int i = 0; i < m; i++) {
        for (int j = 0 ; j < n; j++){
            char ch;
            cin>>ch;
            if (ch == '#') dp[i][j] = -1;
        }
	}
	cout << total_ways(m, n) << endl;
}

// input -
// 4 3 2
// 3 3
// 3 1
// output -
// 2



Measured memory_bytes: 11464
#!/usr/bin/env python3
import sys
import numpy as np

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(A: int, B: int, C: int, D: int):
    while(True):
        C -= B
        if C<=0:
            print(YES)
            return
        A -= D
        if A<=0:
            print(NO)
            return

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    solve(A, B, C, D)

if __name__ == '__main__':
    main()


Measured memory_bytes: 27136
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int n;
vector<vector<int> > a;

int solve()
{
    for(int i=0; i<n; ++i){
        for(int j=0; j<n; ++j){
            bool ok = true;
            for(int k=0; k<n; ++k){
                if(a[i][k] < a[i][j])
                    ok = false;
                if(a[k][j] > a[i][j])
                    ok = false;
            }
            if(ok)
                return a[i][j];
        }
    }

    return 0;
}

int main()
{
    for(;;){
        cin >> n;
        if(n == 0)
            return 0;

        a.assign(n, vector<int>(n));
        for(int i=0; i<n; ++i){
            for(int j=0; j<n; ++j){
                cin >> a[i][j];
            }
        }

        cout << solve() << endl;
    }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
	// freopen("inf.txt", "r", stdin); 
	// freopen("out.txt", "w", stdout);
	
	int n;
	cin>>n;
	vector<int> v(n);
	for(auto &x: v) cin>>x;
	int cnt=0,res=0;
	for(int i=1;i<n;i++)
	{
		if(v[i]<=v[i-1])
			cnt++;
		else
			cnt=0;
		res = max(res,cnt);
	}
	cout<<res;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int m = 0;
  int check = a[1];
  vector<int> b(n + 1, 0);
  for (int i = n; i >= 1; i--) {
    b[i] ^= a[i] ^ b[i];
    for (int j = 1; j * j <= i; j++) {
      if (i == 1) continue;
      if (i % j == 0) {
        a[j] ^= b[i];
        if (j * j != i) {
          a[i / j] ^= b[i];
        }
      }
    }
    m += b[i];
  }
  if (m % 2 != check) {
    cout << -1 << endl;
    return 0;
  }
  cout << m << endl;
  bool ok = false;
  for (int i = 1; i <= n; i++) {
    if (b[i]) {
      if (ok) cout << ' ';
      cout << i;
      ok = true;
    }
  }
  if (ok) cout << endl;
}


Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007


ll n, root[114514], d[114514], ans[2], sc;
vector<vector<ll>> s(114514);

void rs(ll a, ll b) {
	d[a] = b;
	REP(i, s[a].size()) {
		if (s[a][i] != root[a]) {
			root[s[a][i]] = a;
			rs(s[a][i], b + 1);
		}
	}
}

void ns(ll a) {
	if (d[a] == d[n] / 2 + 1) {
		REP(i, s[root[a]].size()) {
			if (s[root[a]][i] == a)s[root[a]][i] = root[root[a]];
		}
		sc = a;
	}
	else ns(root[a]);
}

void dfs(ll a, ll b) {
	REP(i, s[a].size()) {
		if (s[a][i] != root[a]) {
			ans[b]++;
			dfs(s[a][i], b);
		}
	}
}

int main() {
	cin >> n;
	REP(i, n - 1) {
		ll a, b;
		cin >> a >> b;
		s[a].push_back(b);
		s[b].push_back(a);
	}
	root[1] = 1;
	rs(1, 0);
	ns(n);
	dfs(1, 0);
	dfs(sc, 1);
	cout << (ans[0] > ans[1] ? "Fennec" : "Snuke") << endl;

}




Measured memory_bytes: 12288
#include <iostream>
#include <cmath>


using namespace std;

int main () {
	int n,i;
	cin>>n;
	int a [n], b [n], c [n], ma [n], mb [n], mc [n];
	for (i = 0; i < n; i++) cin >> a [i] >> b [i] >> c [i];
	ma [0] = a [0];
	mb [0] = b [0];
	mc [0] = c [0];
	for (i = 1; i < n; i++) {
		ma [i] = max (mb [i-1], mc [i-1]) + a [i]; 
		mb [i] = max (ma [i-1], mc [i-1]) + b [i];
		mc [i] = max (mb [i-1], ma [i-1]) + c [i];
	}
	cout<<max (max (ma [n-1], mb [n-1]), mc [n-1]);
	return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N;
    cin >> N;
    
    string s;
    cin >> s;
  
    if(s.length() > N){
      for(int i = 0; i < N; i++){
        cout << s[i];
      }
      cout << "...";
    }else{
      cout << s;
    }
  
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define rep(i, a, b) for(int i = a; i < b; ++i)

int debug = 0;

const int N = 5e5;
int n, a[N], ans, cur;

main() {
    cin >> n;
    rep(i, 0, n) {
        cin >> a[i];
    }
    sort(a, a + n);
    reverse(a, a + n);
    ans += a[0];
    cur = n - 2;
    rep(i, 1, n) {
        if (cur >= 2) {
            cur -= 2;
            ans += a[i] * 2;
        } else {
            if (cur == 1) {
                cur -= 1;
                ans += a[i];
            }
            break;
        }
    }
    cout << ans << '\n';
}

Measured memory_bytes: 5188
/* --- author: dxm --- */
#include<bits/stdc++.h>
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define fst first
#define snd second
typedef long long ll;
inline void Fail(){printf("0");exit(0);}

const int maxn=300005;
int n,m,pos=1;
pii itv[maxn];

class BIT{
public:
	int t[maxn];
	void add(int v,int val){for(;v<=m;v+=(v&-v))t[v]+=val;}
	int qry(int v){
		int res=0;
		for(;v;v-=(v&-v))res+=t[v];
		return res;
	}
}T;

bool cmp(pii a,pii b){return a.snd-a.fst<b.snd-b.fst;}
 
int main(){
	scanf("%d%d",&n,&m);
	REP(i,n)scanf("%d%d",&itv[i].fst,&itv[i].snd);
	sort(itv+1,itv+1+n,cmp);
	REP(i,m){
		while(pos<=n&&itv[pos].snd-itv[pos].fst+1<i){
			T.add(itv[pos].fst,1);
			T.add(itv[pos].snd+1,-1);
			pos++;
		}
		int ans=n-pos+1;
//		cout<<ans<<endl;
		for(int j=i;j<=m;j+=i)ans+=T.qry(j);//,cout<<j<<" "<<T.qry(j)<<endl;
		printf("%d\n",ans);
	}
	return 0;
}

/*
Input:
-----------------
Output:
*/

Measured memory_bytes: 3712
#include <stdio.h>
#include <stdlib.h>

int main (int ac, char **av) {

  int secs = 0;
  fscanf(stdin, "%d\n", &secs);                                                                                                                              
  int sec = secs % 60;
  int mins = secs / 60;
  int hours = mins / 60;
  int minutes = mins - hours * 60 ;
  fprintf(stdout, "%d:%d:%d\n", hours, minutes, sec);
  return 0;
}

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

int main() {
  string str;
  cin >> str;

  set<int> s;
  string ans = "yes";
  for (int c:str) {
    if (s.count(c) != 0) ans = "no";
    else s.insert(c);
  }

  cout << ans << endl;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> A(N);
  
  for (int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  
  int cnt = 0;
  int now = 0;
  int success = 0;
  for (int i = 0; i < N+1; i++){
    now = A.at(now)-1;
    cnt++;
    if (now == 1) {
      cout << cnt << endl;
      success = 1;
      break;
    }
  }
  if (success == 0)
    cout << -1 << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cout << #x << ": " << x << endl
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define endl '\n'

ll dp[100005];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n, w;
	cin >> n >> w;
	memset(dp, 0, sizeof(dp));
	rep(i, n){
		int a;
		ll b;
		cin >> a >> b;
		for(int j = w - a; j >= 0; j--){
			dp[j + a] = max(dp[j + a], dp[j] + b);
		}
	}
	cout << dp[w] << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 1024
#include <stdio.h>
char *p,s[999];main(i){for(;fgets(s,999,stdin),memcmp(p=s,"END OF I",8);puts(""))for(s[strlen(s)-1]=' ';*p;printf("%d",i))for(i=0;*p++!=' ';i++);exit(0);}

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

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

			//出力の都度更新をやめる
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);


			Ans();

			//更新する
			Console.Out.Flush();
			
		}
public static void Ans() {

			var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];
			var S = retreiveStringArray()[0].Select(x => x).ToArray();

			var currentPoint = 0;
			var minusPoint = 0;

			for (int i = 0; i < N; i++) {
				var c = S[i];
				if (c=='(') {
					currentPoint++;
					continue;
				}
				
				if (currentPoint>0) {
					currentPoint--;

				}
				else {
					minusPoint++;
				}
				
			}

			var ans = new List<char>();

			for (int i = 0; i < minusPoint; i++) {
				ans.Add('(');
			}

			for (int i = 0; i < N; i++) {
				ans.Add(S[i]);
			}

			for (int i = 0; i < currentPoint; i++) {
				ans.Add(')');
			}

			//答えの出力
			var answer = string.Join("",ans);
			Console.WriteLine(answer);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}


		/// <summary>
		/// 2組みずつの入力データ(数値)からTuppleListを作成する
		/// </summary>
		/// <param name="N"></param>
		/// <returns></returns>
		private static List<Tuple<long, long>> createLongTuppleList(long N) {
			var inpList = new List<Tuple<long, long>>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveLongArray();
				var item1 = inp[0];
				var item2 = inp[1];
				inpList.Add(new Tuple<long, long>(item1, item2));
			}
			return inpList;
		}
	}
}



Measured memory_bytes: 28404
#include "bits/stdc++.h"
using namespace std;
int main() {
	int N;
	cin >> N;
	string S;
	cin >> S;
	vector<bool>include_X(26, false), include_Y(26, false);
	int ans = -1;
	for (int i = 0; i < N; i++) {
		string X = S.substr(0, i), Y = S.substr(i, N - i);
		fill(include_X.begin(), include_X.end(), false);
		fill(include_Y.begin(), include_Y.end(), false);
		for (int j = 0; j < X.size(); j++) {
			include_X.at(X.at(j) - 97) = true;
		}
		for (int j = 0; j < Y.size(); j++) {
			include_Y.at(Y.at(j) - 97) = true;
		}
		int cap = 0;
		for (int j = 0; j < 26; j++) {
			if (include_X.at(j) && include_Y.at(j)) cap++;
		}
		if (ans < cap) ans = cap;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#![allow(unused_mut, unused_macros, unused_variables, unused_assignments, non_snake_case, unused_imports, dead_code, non_camel_case_types)]

// [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita]
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 から拝借
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    // ABC128-C-Switches用に拡張
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, $t);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// お約束
use std::collections::{HashMap, BinaryHeap, BTreeMap};
const MOD : usize = 1_000_000_007;
macro_rules! Print {($t:expr) => {println!("{}", $t);};}
macro_rules! debug {($t:expr) => {println!("{:?}", $t);};}

// エントリーポイント
fn main() {
    input! {
        N : isize,
        A : [f64; N]
    }
    // let mut ans = 0.0;
    // for a in A {
    //     ans += 1.0 / a;
    // }
    Print!(1.0 / A.iter().fold(0.0, |sum, a| sum + 1.0 / a));
}


Measured memory_bytes: 4352
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

ll n;
vll x, y;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    x.resize(n), y.resize(n);
    for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
    V<int> order(n); iota(ALL(order), 0);

    double ans = 0;
    do {
        for (int i = 1; i < n; i++) {
            ll diffx = x[order[i]] - x[order[i - 1]], diffy = y[order[i]] - y[order[i - 1]];
            ans += sqrt((double)(diffx * diffx + diffy * diffy));
        }
    } while(next_permutation(ALL(order)));

    ll div = 1;
    for (ll i = 1; i <= n; i++) div *= i;
    cout << fixed << setprecision(12) << ans / div << '\n';
    return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
dp = [10 ** 18 for _ in range(n)]

dp[0] = 0
for i in range(1, n):
    dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))
print(dp[-1])


Measured memory_bytes: 13924
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    divisors.remove(1)
    return divisors
N=int(input())
l=make_divisors(N)
count=0

for i in l:
  if 1==len(factorization(i)) and N%i==0:
    count+=1
    N/=i

print(count)

Measured memory_bytes: 9508
#include <stdio.h>

int main(void){
	char c;
	int cnt =0;
	int max = 0;
  	int i = 0;
	for(i = 0; i < 3; i++){
		scanf("%c",&c);
		if(c == 'R'){
          	cnt += 1;
        	if (max < cnt){
				max = cnt;
			}
		}else{
          cnt = 0;
		}
	}
	printf("%d",max);
	return 0;
}

Measured memory_bytes: 1668
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [input() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N = I()
    edge = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = MI_()
        edge[a].append(b)
        edge[b].append(a)

    set_A = set()
    set_B = set()
    a_stack = [0]
    b_stack = [N - 1]
    for _ in range(N - 1):
        tmp_a = []
        tmp_b = []
        while a_stack:
            from_ = a_stack.pop()
            for to in edge[from_]:
                if to not in set_A and to not in set_B:
                    tmp_a.append(to)
                    set_A.add(to)
        while b_stack:
            from_ = b_stack.pop()
            for to in edge[from_]:
                if to not in set_A and to not in set_B:
                    tmp_b.append(to)
                    set_B.add(to)
        a_stack = tmp_a
        b_stack = tmp_b
    if len(set_A) > len(set_B):
        print("Fennec")
    else:
        print("Snuke")


if __name__ == '__main__':
    main()

Measured memory_bytes: 60208
#include<stdio.h>
#include<math.h>
int main(){
int n,i;
double jijou,s[1000],goukei,heikin,goukei2,hensa;
while(1){
goukei=0,heikin=0,goukei2=0,hensa=0,jijou=0;
scanf("%d",&n);
if(n==0) break;
for(i=0;i<n;i++){
scanf("%lf",&s[i]);
goukei+=s[i];
}
heikin=goukei/i;
for(i=0;i<n;i++){
jijou=pow(s[i]-heikin,2);
goukei2+=jijou;
}
hensa=sqrt(goukei2/i);
printf("%lf\n",hensa);
}
return 0; }




Measured memory_bytes: 2112
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
## libs ##
from itertools import accumulate as acc, combinations as combi, product, combinations_with_replacement as combi_dup
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left
#======================================================#

def main():
    n, k = MII()
    aa = MII()
    cnt = 0
    for i in range(n):
        a = aa[i]
        for j in range(i,n):
            if a > aa[j]:
                cnt += 1
    cnt_s = 0
    aa.sort(reverse=True)
    for i in range(n):
        a = aa[i]
        for j in range(i,n):
            if a > aa[j]:
                cnt_s += 1
    print((cnt*k+cnt_s*(k*(k-1))//2)%MOD)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3572
import Control.Monad

shuffle :: [Char] -> [Int] -> [Char]
shuffle s [] = s
shuffle s (h:hs) =
  shuffle (first ++ lst) hs where
    (lst, first) = splitAt h s

main = do
  s <- getLine
  if s == "-" then return ()
  else do
    m <- readLn
    hs <- replicateM m $ fmap read getLine
    putStrLn $ shuffle s hs
    main

Measured memory_bytes: 3980
#include <stdio.h>
int main(){

  int i=0,j=0,x=0;
  char ch,p[101]={},s[101]={};

  //input p
  while(1){

    scanf("%c",&ch);

    if(ch != '\n'){

      p[i]=ch;

      i++;

    } else {

      break;

    }

  }

  i=0;

  //input s
  while(1){

    scanf("%c",&ch);
    
    if(ch != '\n'){

      s[i]=ch;

      i++;

    } else {

      break;

    }

  }

  i=0;
  
  //search
  while(1){

    if(s[j] != '\0'){
      
      if(p[i] != '\0'){
	
	if(p[i] == s[j]){
	  
	  i++;
	  j++;
	  
	} else {

	  if(i == 0 && j != 0){

	    printf("No\n");

	    break;

	  } else {

	  x++;
	  i=x;
	  j=0;

	  }
	  
	}	
	
      } else {

	if(j != 0){

	  i=0;

	} else {

	  printf("No\n");

	  break;

	}

      }
      
    } else {

      printf("Yes\n");

      break;

    }

  }

  return 0;
  
}
      

      

Measured memory_bytes: 524
package main

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

var stdin []string

func main() {
    scanner := bufio.NewScanner(os.Stdin)

    var tmp string

    for scanner.Scan() {
        tmp = scanner.Text()

        if tmp == "" {
            break
        } else {
            stdin = append(stdin, scanner.Text())
        }
    }

    nums := strings.Split(stdin[1], " ")
    var N int
    var num string
    arr1 := strings.Split(stdin[0], " ")
    N, _ = strconv.Atoi(arr1[0])
    var cnt int
    var length int

    for i := N; i <= 99999; i++ {
        cnt = 0
        length = len(strconv.Itoa(i))

        for j := 0; j < length; j++ {
            num = string([]rune(strconv.Itoa(i)[j:j+1]))

            if contains(nums, num) == true {
                break
            }

            cnt++

            if cnt == length && i >= N {
                fmt.Println(i)
                return
            }
        }
    }
}

func contains(strs []string, val string) bool {
    for _, v := range strs {
        if val == v {
            return true
        }
    }
    return false
}

Measured memory_bytes: 2048