akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

#define OFF (100000)
#define YES "YES"
#define NO "NO"

int N, M;
vector<int> es[200000];
bool ved[200000];

int cnt;

void visit(int v) {
	if (ved[v]) return;
	ved[v] = true;
	if (v >= OFF) ++cnt;
	REP(i, es[v].size()) visit(es[v][i]);
}

int main(int argc, char **argv) {
	cin >> N >> M;
	REP(i, N) {
		int K, L;
		cin >> K;
		REP(j, K) {
			cin >> L;
			--L;
			int a = L, b = OFF + i;
			es[a].push_back(b);
			es[b].push_back(a);
		}
	}
	CLEAR(ved);
	cnt = 0;
	visit(OFF);
	cout << (cnt == N ? YES : NO) << endl;
	return 0;
}


Measured memory_bytes: 8960
package main
 
import (
  "fmt"
  "strconv"
)

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

func main() {
  
  //入力値を分割
  var str string
  fmt.Scan(&str)
  var m [4]int
  for i := 0; i < 4; i++ {
    m[i],_ = strconv.Atoi(string(str[i]))
  }
  
  //+,-を格納
  var s [3]string
  
  //全パターン試して正解を見つけたら終了
  for i := 0; i < pow(2,3); i++ {
    ans := m[0]
    for j := 0; j < 3; j++ {
    //p := i & (1<<(uint(j))) 
      p :=  (i>>(uint(j))) & 1 
      if p == 0 {
        s[j] = "-"
        ans -= m[j+1]
      } else {
        s[j] = "+"
        ans += m[j+1]
      }
    }
    if ans == 7 { 
      fmt.Printf("%d%s%d%s%d%s%d=7", m[0], s[0], m[1], s[1], m[2], s[2], m[3])
      break
    }
  }
}

Measured memory_bytes: 512
n = int(input())
a = [input() for i in range(n)]
m = int(input())
b = [input() for i in range(m)]
aa = list(set(a))
cnt = [0]
for i in aa:
  if b.count(i) >= 1:
    cnt.append(a.count(i)-b.count(i))
  else:
    cnt.append(a.count(i))
print(max(cnt))

Measured memory_bytes: 3064
s = input()
s_reverse = ''.join(list(reversed(s)))
t = ''

while True:
    n = len(t)
    if s_reverse == t:
        print('YES')
        break
    if len(s) <= n:
        print('NO')
        break
    if s_reverse[n] == 'm':
        t += ''.join(list(reversed('dream')))
    elif s_reverse[n] == 'e':
        t += ''.join(list(reversed('erase')))
    elif s_reverse[n:n+3] == 'rem':
        t += ''.join(list(reversed('dreamer')))
    elif s_reverse[n:n+3] == 'res':
        t += ''.join(list(reversed('eraser')))
    else:
        print('NO')
        break

Measured memory_bytes: 9844
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define fi first
#define se second
using namespace std;
typedef pair <int, int> ii;
 
const ll siz = 1e5 + 10;
const ll SIZ = 1e6 + 10;
const ll mod = 1e9 + 7;
const ll maxx = 2e9;
const ll MAXX = 1e18;
const double pi = 2 * acos(0);
 
double n;
 
int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    freopen ("IN_4.INP", "r", stdin);
//    freopen ("OUT_4.OUT", "w", stdout);
    cin >> n;
    cout << setprecision(20) << fixed << 2 * n * pi;
    return 0;
}

Measured memory_bytes: 3788
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9+7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;

typedef long long ll;
typedef pair<ll, ll> Pa;

int main() {
    cin >> A >> B >> C >> D;
    if(A+1 == C) cout << 1;
    else cout << 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int l = S.length();
        String a = "Yes";
        for(int i = 0; i < l; i++){
            if(S.charAt(i) != S.charAt(l - i - 1)) a = "No";
        }
        for(int i = 0; i < (l-1)/2; i++){
            if(S.charAt(i) != S.charAt((l-1)/2 - i - 1)) a = "No";
        }
        for(int i = (l+3)/2; i < l; i++){
            if(S.charAt(i) != S.charAt(l - i - 1)) a = "No";
        }
        System.out.println(a);
    }
}

Measured memory_bytes: 23764
H, W = map(int, input().split())
S = [input() for _ in range(H)]


def f(i, j):
    t = [[-1] * W for _ in range(H)]
    t[i][j] = 0
    q = [(i, j)]
    while q:
        y, x = q.pop(0)
        if y - 1 >= 0 and S[y - 1][x] != '#' and t[y - 1][x] == -1:
            t[y - 1][x] = t[y][x] + 1
            q.append((y - 1, x))
        if y + 1 < H and S[y + 1][x] != '#' and t[y + 1][x] == -1:
            t[y + 1][x] = t[y][x] + 1
            q.append((y + 1, x))
        if x - 1 >= 0 and S[y][x - 1] != '#' and t[y][x - 1] == -1:
            t[y][x - 1] = t[y][x] + 1
            q.append((y, x - 1))
        if x + 1 < W and S[y][x + 1] != '#' and t[y][x + 1] == -1:
            t[y][x + 1] = t[y][x] + 1
            q.append((y, x + 1))
    return max(max(tt) for tt in t)


result = 0
for i in range(H):
    for j in range(W):
        if S[i][j] != '#':
            result = max(result, f(i, j))
print(result)

Measured memory_bytes: 3188
n,m=map(int,input().split())
xyz=[list(map(int,input().split())) for _ in range(n)]
maxi=0
for i in range(2**3):
    idx=[]
    for j in range(3):
        if (i>>j)&1:
            idx.append(j)
    arr=[]
    for j in range(n):
        s=0
        for k in range(3):
            if k in idx:
                s-=xyz[j][k]
            else:
                s+=xyz[j][k]
        arr.append((s,j))
    arr.sort(reverse=True)
    x,y,z=0,0,0
    for j in range(m):
        x+=xyz[arr[j][1]][0]
        y+=xyz[arr[j][1]][1]
        z+=xyz[arr[j][1]][2]
    maxi=max(maxi,abs(x)+abs(y)+abs(z))
print(maxi)

Measured memory_bytes: 3440
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1LL<<60;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int N;
vector<ll> a;

ll get_center(vector<ll> a) {
    int n = a.size();
    if (n % 2 == 1) {
        return a[(n - 1) / 2];
    } else {
        return (a[n/2] + a[n/2 - 1]) / 2;
    }
}

int main() {
    int N; cin >> N;
    a.resize(N);
    rep(i, N) cin >> a[i];
    rep(i, N) {
        a[i] -= i + 1;
    }
    sort(a.begin(), a.end());
    ll c = get_center(a);
    ll ans = 0;
    rep(i, N) {
        ans += abs(a[i] - c);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
LL n,m,a,b,c,t;
vector<vector<LL> > matprod(vector<vector<LL> > mata,vector<vector<LL> > matb)
{
  vector<vector<LL> > ans;
  ans.resize(n);
  REP(i,n) ans[i].assign(n,0);
  REP(i,n) REP(j,n) REP(k,n)
    ans[i][k]=(ans[i][k]+(mata[i][j]*matb[j][k])%m)%m;
  return ans;
}
vector<vector<LL> > power(vector<vector<LL> > mat, int x)
{
  if(x==1)return mat;
  else if(x%2==1) return matprod(power(matprod(mat,mat),x/2),mat);
  else return power(matprod(mat,mat),x/2);
}
int main(void)
{
  for(;;){
    cin >> n >> m >> a >> b >> c >> t;
    if(!n&&!m) return 0;
    vector<LL> s;
    s.resize(n);
    REP(i,n) cin >> s[i];
    vector<vector<LL> > mat;
    mat.resize(n);
    REP(i,n) mat[i].resize(n);
    REP(i,n) REP(j,n){
      if(i==j-1) mat[i][j]=a;
      else if(i==j) mat[i][j]=b;
      else if(i==j+1) mat[i][j]=c;
      else mat[i][j]=0;
    }
    vector<LL> ans;
    if(t==0) ans=vector<LL>(s);
    else{
      ans.assign(n,0);
      vector<vector<LL> > mat1=power(mat,t);
      REP(i,n) REP(j,n) ans[j]=(ans[j]+(mat1[i][j]*s[i])%m)%m;
    }
    REP(i,n){
      cout << ans[i];
      if(i==n-1) cout << endl;
      else cout << ' ';
    }
  }
}

Measured memory_bytes: 5256
n, m = map(int, input().split())
cnt = 0
LR = [list(map(int, input().split())) for _ in range(m)]
l = []
r = []
for i in range(m):
    l.append(LR[i][0])
    r.append(LR[i][1])

l_max = max(l)
r_min = min(r)

for k in range(n+1):
    if l_max <= k <= r_min:
        cnt += 1
print(cnt)

Measured memory_bytes: 29060
n, k = map(int, input().split())
p_list = list(map(int, input().split()))

scope_index = 0
max_sum = 0
for i in range(k):
    max_sum += p_list[i]

now_sum = max_sum
for p_i in range(k, len(p_list)):
    now_sum -= p_list[p_i - k]
    now_sum += p_list[p_i]

    if max_sum < now_sum:
        scope_index = p_i
        max_sum = now_sum

ex = (max_sum+k)/2
print(ex)


Measured memory_bytes: 25604
package main

import (
	"fmt"
	"math"
	"strconv"
)

func main(){
	var r float64
	pie := math.Pi
	fmt.Scan(&r)
	fmt.Print(strconv.FormatFloat(float64(r * r * pie), 'f', -1 , 64))
    // strconv.FormatFloat(a / b, 'f', -1, 64)
	fmt.Print(" ")
	fmt.Println(float64(2.0 * r * pie))
}



Measured memory_bytes: 1156
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		Integer a[]=new Integer[N];
		int i;
		int sum=0;
		for(i=0;i<N;++i) {
			a[i]=sc.nextInt();
		}
		Arrays.sort(a,Comparator.reverseOrder());
		if(N%2==0) {
			for(i=0;i<N/2;++i) {
				sum+=(a[2*i]-a[2*i+1]);
			}}
		if(N%2==1) {
			for(i=0;i<N/2;++i) {
			sum+=(a[2*i]-a[2*i+1]);}
			sum+=a[N-1];
		}
			
			System.out.println(sum);
			
		
	}

}


Measured memory_bytes: 36032
import numpy as np

N = int(input())

k = []
for i in range(N):
    a = input().split(" ")
    k.append([int(a[0]),int(a[1])])

k = sorted(k, key=lambda x: x[1])
sum_A = 0
sum_B = 0
flag = 0
for i in range(N):
    sum_A += k[i][0]
    sum_B = k[i][1]
    if sum_A > sum_B:
        print("No")
        flag = 1
        break
if flag == 0:
    print("Yes")

Measured memory_bytes: 48580
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;
typedef long long int ll;

int dp[80][80][80*80*2*2+1000];
int p=160*80;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int h,w; cin >> h >> w;
	int a[h][w],b[h][w];
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> a[i][j];
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> b[i][j];
		}
	}
	dp[0][0][a[0][0]-b[0][0]+p]=1;
	dp[0][0][-a[0][0]+b[0][0]+p]=1;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			for(int k=0;k<80*80*2*2+1000;k++){
				if(dp[i][j][k]==0)continue;
				if(i<h-1){
					dp[i+1][j][k+a[i+1][j]-b[i+1][j]]=1;
					dp[i+1][j][k-a[i+1][j]+b[i+1][j]]=1;
				}
				if(j<w-1){
					dp[i][j+1][k+a[i][j+1]-b[i][j+1]]=1;
					dp[i][j+1][k-a[i][j+1]+b[i][j+1]]=1;
				}
			}
		}
	}
	int ans=1e9;
	for(int k=0;k<80*80*2*2+1000;k++){
		if(dp[h-1][w-1][k]){
			ans=min(ans,abs(k-p));
		}
	}
	cout << ans << endl;
}

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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#else
#define TEST(n) ((void)0)
#endif

using namespace std;

int D[100001];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt", "r", stdin));
	TEST(freopen("output.txt", "w", stdout));
	TEST(freopen("debug.txt", "w", stderr));
	int N;
	priority_queue<pair<int, int>> Q;
	cin >> N;
	memset(D, 0x7f, sizeof(D));
	D[1] = 1;
	Q.push({ 1,1 });
	while (!Q.empty()) {
		int c = Q.top().second;
		Q.pop();
		if (D[(10 * c) % N] > D[c]) {
			D[(10 * c) % N] = D[c];
			Q.push({ -D[(10 * c) % N],(10 * c) % N });
		}
		if (D[(c + 1) % N] > D[c] + 1) {
			D[(c + 1) % N] = D[c] + 1;
			Q.push({ -D[(c + 1) % N],(c + 1) % N });
		}
	}
	cout << D[0] << '\n';
	return 0;
}

Measured memory_bytes: 1276
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int ac,wa,tle,re;
    ac=0;
    wa=0;
    tle=0;
    re=0;
    string s;
    for(int i=0;i<n;i++){
        cin>>s;
        if(s=="AC")ac++;
        else if(s=="WA")wa++;
        else if(s=="TLE")tle++;
        else if(s=="RE")re++;
    }
    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
 
#ifdef _WIN32
    #define gx getchar
    #define px putchar
    #define ps putchar(' ')
    #define pn putchar('\n')
    #define DEBUG 1
#else
    #define gx getchar_unlocked
    #define px putchar_unlocked
    #define ps putchar_unlocked(' ')
    #define pn putchar_unlocked('\n')
    #define DEBUG 0
#endif
 
#define rep(i,j,k) for(ll i=0;i<j;i+=k)
//input
void scan(int &n)
{
    int sign = 1;
    n = 0;
    char c = gx();
    while( c < '0' || c > '9' )
    {
        if( c == '-' ) sign = -1;
        c = gx();
    }
    while( c >= '0' && c <= '9' ) n = (n<<3) + (n<<1) + c - '0', c = gx();  n = n * sign;
}
void lscan(ll &n)
{
    int sign = 1;
    n = 0;
    char c = gx();
    while( c < '0' || c > '9' )
    {
        if( c == '-' )
        sign = -1;
        c = gx();
    }
    while( c >= '0' && c <= '9' ) n = (n<<3) + (n<<1) + c - '0', c = gx();  n = n * (ll)(sign);
}
int sscan(char a[])
{
    char c = gx();
    while(c==' ' || c=='\n') c=gx();
    int i=0;
    while(c!='\n')a[i++] = c,c=gx();
    a[i]=0;
    return i;
}
int wscan(char a[])
{
    char c = gx();
    while(c==' ' || c=='\n') c=gx();
    int i=0;
    while(c!='\n' && c!=' ')a[i++] = c,c=gx();
    a[i]=0;
    return i;
}
 
//output
void print(int n)
{
    if(n<0)
    {
        n=-n;
        px('-');
    }
    int i=10;
    char o[10];
    do{o[--i] = (n%10) + '0'; n/=10;}while(n);
    do{px(o[i]);}while(++i<10);
}
void lprint(ll n)
{
    if(n<0LL)
    {
        n=-n;
        px('-');
    }
    int i=21;
    char o[21];
    do{o[--i] = (n%10LL) + '0'; n/=10LL;}while(n);
    do{px(o[i]);}while(++i<21);
}
void sprint(const char a[])
{
    const char *p=a;
    while(*p)px(*p++);
}
 
 
ll po(ll a, ll b, ll m)
{
	ll x=1,y=a;
	while(b > 0)
	{
		if(b%2 == 1)
		{
			x=(x*y);
			if(x>m) x%=m;
		}
		y = (y*y);
		if(y>m) y%=m;
		b /= 2;
	}
	return x;
}
 
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int main()
{
	ll a;
	cin>>a;
	cout<<a+a*a+a*a*a<<endl;
	return 0;
}

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

const int MAXN = 505;
char mp[MAXN][MAXN];
int n, m;

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			cin >> mp[i][j];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (j == m - 1) {
				cout << '.';
				continue;
			}
			if (j == 0) {
				cout << '#';
				continue;
			}
			if (mp[i][j] == '#' || i % 2 == 0)
				cout << '#';
			else
				cout << '.';
		}
		cout << endl;
	}
	cout << endl;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (j == m - 1) {
				cout << '#';
				continue;
			}
			if (j == 0) {
				cout << '.';
				continue;
			}
			if (mp[i][j] == '#' || i % 2 == 1)
				cout << '#';
			else
				cout << '.';
		}
		cout << endl;
	}
}

Measured memory_bytes: 1024
import java.math.*;

object MainKt {
  @JvmStatic fun main(args:Array<String>) {
   val (N,K) = readLine()!!.split(" ").map(String::toLong)
    val action= (1..N).map {
      val (a,b)=readLine()!!.split(" ").map(String::toInt)
      Pair(a,b)
    }
    val sorted_list=action.toMutableList()
    sorted_list.sortBy {it.first}
      // println(sorted_list.get(K-1))
    var index=K
    for(pair in sorted_list)
    {
      index-=pair.second
      if(index<=0)
      {
        println(pair.first)
        break
      }
    }

  }

}


Measured memory_bytes: 79156
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)
#define K 3
int pow(int n)
{
    if (n == 0) return 1;
    if (n%2 == 0) {
        int tmp = pow(n/2);
        return tmp * tmp;
    } else {
        return K * pow(n-1);
    }
}

int main(int argc, const char * argv[]) {
    int L;
    cin >> L;
    int N = 0;
    while (1) {
        if (L < pow(N++)) break;
    }
    cout << N << endl;
    int M = K * (N-2);
    for (int n = 1; n < N; ++n) {
        M += (L/pow(n-1) - L/pow(n)*K);
    }
    cout << M << endl;
    for (int i = 0; i < L%K; ++i) {
        cout << "1 " << N << " " << i << endl;
    }
    for (int n = 2; n < N; ++n) {
        for (int k = 0; k < K; ++k) {
            cout << n-1 << " " << n << " " << L/pow(n-2)*pow(n-2) - L/pow(n-1)*pow(n-1) + pow(n-2)*k << endl;
        }
        for (int i = 0; i < L/pow(n-1)-L/pow(n)*K; ++ i) {
            cout << n << " " << N << " " << i*pow(n-1) << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
n,p=map(int,input().split())
s=input().rstrip()
ans=0
l=[0]*p
a=[0,1,2,3,4,5,6,7,8,9]
c=0

if p==2 or p==5:
    for i in range(n):
        if int(s[i])%p==0:
            ans+=i+1
else:
    for i in range(n):
        # mod=int(s[-(i+1):])%p
        mod=(c+a[int(s[-(i+1)])])%p
        ans+=l[mod]
        l[mod]+=1
        if mod==0:
            ans+=1
        c=mod
        
        for j in range(10):
            a[j]=a[j]*10%p
 
print(ans)

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

int main()
{
    int n;
    cin >> n;
    vint a(n), ans(n);
    rep(i, n) cin >> a[i];

    for (int i = n - 1; i >= 0; i--)
    {
        int now = 0;
        for (int j = i + i + 1; j < n; j += (i + 1))
        {
            now += ans[j];
        }
        ans[i] = now % 2 != a[i];
    }

    int total = 0;
    rep(i, n) total += ans[i];

    cout << total << endl;
    rep(i, n)
    {
        if (ans[i])
        {
            cout << i + 1 << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int P  = 1e9+7;
const int N =2010;

int n,K;
int f[N][N],g[N][N];
inline void add(int &x,int y){x=(x+y)%P;}
int c[N][N];

int main(){
	for(int i = 0;i<N;i++){
		c[i][0] =1;
		for(int j =1;j<=i;j++) c[i][j] =(c[i-1][j-1]+c[i-1][j])%P;
	}
	
	scanf("%d%d",&n,&K);
	for(int i = 0;i<N;i++) f[i][0] = 1;
	for(int i = 1;i<N;i++){
		for(int j =1;j<=i;j++) f[i][j] = (f[i][j-1]+f[i-1][j])%P;
	}
	//cout<<f[2][2]<<endl;
	int ans = 0, tmp  = 0;
	if(n-K==0) tmp = 1;
	else {
		for(int i=1;i<=n-K;i++) add(tmp,c[n-K-1][i-1]);
	}
	if(n-K>0)
	for(int i = n-K;i<=n-1;i++){
		add(ans,1ll*c[i-1][n-K-1]*f[K-1][n-1-i]%P*tmp%P);
	
	} else ans = f[n-1][n-1];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 28032
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int x = sc.nextInt();
    int left = 0;
    int right = 0;

    for (int i = 0; i < m; i++) {
      int a = sc.nextInt();
      if (a < x) {
        left++;
      } else {
        right++;
      }
    }

    System.out.println(Math.min(left, right));

  }
}

Measured memory_bytes: 35836
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

vector<bool> used;
vector<int> ord;
vector<int> component;
vector<vector<int>> edge;
vector<vector<int>> invEdge;

void dfs1(int node){
    for(int nextNode: edge[node]){
        if(!used[nextNode]){
            used[nextNode] = true;
            dfs1(nextNode);
        }
    }

    ord.push_back(node);
}

void dfs2(int node, int num){
    
    for(int nextNode: invEdge[node]){
        if(component[nextNode] == -1){
            component[nextNode] = num;
            dfs2(nextNode, num);
        }
    }
}

int main(){

    int V, E;
    cin >> V >> E;
    edge.resize(V);
    invEdge.resize(V);
    
    int s, t;
    for(int i = 0; i < E; i++){
        cin >> s >> t;
        edge[s].push_back(t);
        invEdge[t].push_back(s);
    }

    used.assign(V, false);
    ord.reserve(V);
    component.assign(V, -1);

    for(int i = 0; i < V; i++){
        if(!used[i]){
            used[i] = true;
            dfs1(i);
        }
    }

    int num = 0;
    for(int i = V - 1; i >= 0; i--){
        int node = ord[i];
        if(component[node] == -1){
            component[node] = num;
            dfs2(node, num);
            num++;
        }
    }

    int Q;
    cin >> Q;
    int u, v;
    for(int i = 0; i < Q; i++){
        cin >> u >> v;
        if(component[u] == component[v]){
            cout << 1 << endl;
        }
        else{
            cout << 0 << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 4432
using System;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(ReadLine());

        if (N / 100 % 10 == 7 || N / 10 % 10 == 7 || N % 10 == 7)
            WriteLine("Yes");
        else
            WriteLine("No");
    }
}


Measured memory_bytes: 27388
#include <bits/stdc++.h>
using namespace std;
 
#define FASTIO  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vl(p) vector<p>
#define W while
#define For(i,s,x) for(i=s;i<x;i++)
#define Fore(i,s,x) for(i=s;i<=x;i++)
#define FOR(i,x) for(i=0;i<x;i++)
#define Rof(i,s,x) for(i=s;i>=x;i--)
#define all(v) v.begin(),v.end()
#define it(r,v) for(auto r=v.begin();r!=v.end();r++)
#define pb push_back
#define in insert
#define sz size()
#define F first
#define S second
#define nl cout<<"\n"
#define pr(a) cout<<a<<" "
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define pr3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n"
#define mod 1000000007

  int main()
  {
    ll n;
    cin>>n;
    cout<<fixed<<setprecision(2)<<2*3.14*n;
  }


Measured memory_bytes: 3756
#![allow(unused_imports)]
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]

use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::{self, BufWriter, Read, Write};
use std::ops::{Add, Div, Mul, Sub};
use std::str::{self, FromStr};
use std::{cmp, fmt};

fn main() {
    let n: u32 = {
        let mut sc = InputScanOnce::new(io::stdin(), 1024);
        sc.next()
    };
    if n >= 1000 {
        println!("ABD");
    } else {
        println!("ABC");
    }
}

struct InputScanOnce {
    buf: Vec<u8>,
    pos: usize,
}

#[allow(dead_code)]
impl InputScanOnce {
    fn new<R: Read>(mut reader: R, estimated: usize) -> Self {
        let mut buf = Vec::with_capacity(estimated);
        let _ = io::copy(&mut reader, &mut buf).unwrap();
        InputScanOnce { buf: buf, pos: 0 }
    }

    #[inline]
    fn next<T: FromStr>(&mut self) -> T
    where
        T::Err: fmt::Debug,
    {
        let mut start = None;
        loop {
            match (self.buf[self.pos], start.is_some()) {
                (b' ', true) | (b'\n', true) => break,
                (_, true) | (b' ', false) | (b'\n', false) => self.pos += 1,
                (_, false) => start = Some(self.pos),
            }
        }
        let target = &self.buf[start.unwrap()..self.pos];
        unsafe { str::from_utf8_unchecked(target) }.parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        T::Err: fmt::Debug,
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<T1: FromStr, T2: FromStr>(&mut self, n: usize) -> Vec<(T1, T2)>
    where
        T1::Err: fmt::Debug,
        T2::Err: fmt::Debug,
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<T1: FromStr, T2: FromStr, T3: FromStr>(&mut self, n: usize) -> Vec<(T1, T2, T3)>
    where
        T1::Err: fmt::Debug,
        T2::Err: fmt::Debug,
        T3::Err: fmt::Debug,
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
    where
        T::Err: fmt::Debug,
    {
        (0..m).map(|_| self.vec(n)).collect()
    }

    fn strings_as_mat<T, F: FnMut(u8) -> T>(&mut self, h: usize, mut f: F) -> Vec<Vec<T>> {
        (0..h)
            .map(|_| {
                let l = self.next::<String>();
                l.as_bytes().iter().cloned().map(&mut f).collect()
            })
            .collect()
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
//* check if a single integer n is a prime O(sqrt(N))
bool is_prime(ll n){
    for(ll i=2; i*i<=n; i++){
        if(n % i == 0)
            return false;
    }
    return n!= 1; //* n should not be 1.
}

void solve(long long X){
    for(ll i=X; ; i++){
        if(is_prime(i)){
            cout << i << endl;
            break;
        }
    }
    
}

int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define debug(a, n) rep(hoge, n) printf("%d%c", a[hoge], hoge == n - 1? '\n' : ' ');
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ln(a) cout << (a) << endl
#define INF 1000000000
#define MOD 1000000007

using namespace std;
using ll = long long;
using P = pair<int, int>;
using DP = pair<double, double>;
using ILP = pair<int, ll>;

struct bit {
    int n;
    int* dat;

    bit(int _n) {
        n = 1;
        while(n < _n) n *= 2;
        dat = new int[n + 1];
        fill(dat + 1, dat + n + 1, 0);
    }

    void update(int i, int x) {
        while(i <= n) {
            dat[i] += x;
            i += i & -i;
        }
    }

    int query(int i) {
        int res = 0;
        while(i > 0) {
            res += dat[i];
            i -= i & -i;
        }
        return res;
    }
};

signed main() {
    int n;
    scanf("%d", &n);
    scanf("\n");
    int* a = new int[n];
    rep(i, n) scanf("%d", &a[i]);

    vector<int> v;
    rep(i, n) v.pb(a[i]);
    sort(all(v));
    rep(i, n) a[i] = lower_bound(all(v), a[i]) - v.begin() + 1;


    bit bt(n);
    ll ans = 0;
    rep(i, n) {
        ans += i - bt.query(a[i]);
        bt.update(a[i], 1);
    }

    ln(ans);
}



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

using namespace std;
typedef long long ll;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)

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

/*
 * 計算クラス
 */
class Calc
{
    // 宣言
    ll a;

    public:
        // 素因数分解
        map<int, int> decompositPrime(ll a);
};

/*
 * 素因数分解
 */
map<int, int> Calc::decompositPrime(ll n)
{
    map<int, int> decPri;

    // 割る数の初期値
    a = 2;
    // √n ≧ a ( n ≧ a * a ) の間ループ処理
    while (n >= a * a) {
        // a で割り切れたら、a は素因数
        // そして、割られる数を a で割る
        // a で割り切れなかったら、 a を 1 増加させる
        if (n % a == 0) {
            decPri[a]++;
            n /= a;
        } else {
            a++;
        }
    }
    // 最後に残った n は素因数
    decPri[n]++;

    return decPri;
}

int main(){
// ここに処理を記述

    ll A, B;
    cin >> A >> B;

    ll L = gcd(A,B);

        // 計算クラスインスタンス化
        Calc objCalc;

            // 自然数入力
            // cout << "自然数 ( 0 : 終了 )：";
            // cin  >> iNum;

            ll iNum = L;

            // 素因数分解
            map<int,int> decPri;
            decPri = objCalc.decompositPrime(iNum);

    // for(const auto& [Pri, pow] : decPri){
        // cout << Pri << "**" << pow << "\n";
    // }

    auto iter = decPri.find(1);

    if(decPri.size() == 1 && iter != end(decPri)){
            cout << decPri.size() << "\n";
    }
    else{
        cout << decPri.size() + 1 << "\n";
    }
    
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,t;
int cc[1010];
int tt[1010];
int tot;
int ans[1010];
int main()
{
	cin>>n>>t;
	for(int i=1;i<=n;i++)
	{
		int a,b;
		cin>>a>>b;
		if(b<=t)
			ans[++tot]=a;
	}
	if(!tot)
	{
		cout<<"TLE"<<endl;
	}
	else
	{
		sort(ans+1,ans+1+tot);
		cout<<ans[1];
	}
	return 0;
}

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

using namespace std;

int main()
{
    int k;
    string s;
    cin >> k;
    cin >> s;

    if (s.size() > k)
    {
        s = s.substr(0, k) + "...";
    }

    cout << s << '\n';
    return 0;
}


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

typedef long long ll;
typedef pair<int,int> P;
typedef map<int,int> M;
typedef vector<int> V;
typedef queue<int> Q;
typedef pair<long,long> PLL;
typedef map<long,long> MLL;
typedef vector<long long> VLL;
typedef vector<pair<int,int>> VP;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define MOD (1e9+7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
/*--------------------------------------------*/

int main(){
    string s,t;cin>>s>>t;
    V a(26),b(26);
    int n=(int)s.size();
    rep(i,26){
        char tmp=i+'a';
        rep(j,n){
            if(tmp==s[j]){
                a[i]++;
            }
            if(tmp==t[j]){
                b[i]++;
            }
        }
    }
    sort(ALL(a));sort(ALL(b));
    bool flag=true;
    rep(i,26){
        if(a[i]!=b[i])flag=false;
    }
    cout<<(flag?"Yes":"No")<<endl;
}


Measured memory_bytes: 776
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        final Scanner lineScanner = new Scanner(System.in);
        final int cost = lineScanner.nextInt();
        final int sum = lineScanner.nextInt();
        final int satisfiedCount = lineScanner.nextInt();

        int needCost = cost * satisfiedCount;

        if (needCost <= sum){
            System.out.println(satisfiedCount);
        } else {
            System.out.println(sum / cost);
        }
    }
}

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

int main(void) {
    while (true) {
        int H,W;cin>>H>>W;
        if (H == 0 && W == 0) break;
        for (int i = 1; i <= H; i++) {
            for (int j = 1; j <= W; j++) {
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


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

int main(){
    string s; cin >>s;
    long long ans=0,finalans=0;
    for (long long bit = 0; bit < (1 << s.size()-1); bit++)
    {
        ans = 0;
        for(long long i=0; i < s.size()-1; i++){
            ans = ans*10 + (int)(s[i]-'0');
            if (bit&(1<<i))
            {
                finalans = finalans + ans;
                ans = 0;

            }
        }
        ans = ans*10 + (int)(s[s.size()-1]-'0');
        finalans = finalans + ans;
    }
    cout << finalans << endl;
    
}

Measured memory_bytes: 3628
#include<iostream>
#include <string> 
#include <vector>  
#include<math.h>
#include <algorithm>
#define INF 1000000000
#define LM 55555
using namespace::std;


long long bc, now, C, H, W, X, Y, N,M, ans, r,l;
string S,s;


int main() {
	cin >>S;
	cin >> W;

	for (int i = 0; i < S.size(); i+=W) {
		s = s+S[i];
	}



	cout << s<< endl;
	return 0;

}




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

using namespace std;

int main() {
    int N;
    int ans;

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

    sort(d.begin(), d.end());
    if (N % 2 != 0) {
        ans = 0;
    } else {
        int med0 = d[N/2-1];
        int med1 = d[N/2];
        ans = med1 - med0;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <functional>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <map>
#include <cmath>

using namespace std;

namespace _{struct _{_(){ // initialize
  cin.tie(0); ios::sync_with_stdio(false);
}}_;}
template <typename T, size_t size>
inline size_t len(const T (&)[size]) { return size; }
#define println(s) cout << s << '\n';
#define str to_string
#define rep(i, n) for (int i=0; i<int(n); i++)
#define all(c) (c).begin(), (c).end()

#define MAX_N 100001
#define WHITE 0
#define BLACK 1
int n;
int table[MAX_N];

// DEBUG
/*
void dump() {
  rep(i, n) {
    cout << (table[i]==WHITE?'.':table[i]==BLACK?'#':' ');
  }
  cout << '\n';
}
*/

int main() {
  while (true) {
    cin >> n;
    if (n == 0) break;
    rep(i, n) table[i] = -1;
    //
    rep(i, n) {
      // 0 -> ???, 1 -> ???
      int x; cin >> x;
      // ?\???°
      // if ((i+1) % 2 == 1)
      if (i % 2 == 0) table[i] = x;
      // ??¶??°
      else {
        // ????????¨????????????????????????
        if (table[i-1] == x) table[i] = x;
        else {
          int t = table[i-1]; // ????????????
          int j = i-1;
          // ??????????????¨??????(??£?¶?)??§???????????????????????????
          while (table[j] == t && j >= 0) {
            table[j] = x;
            j--;
          }
          table[i] = x;
        }
      }
      //dump();
    }
    int count = 0;
    rep(i, n) {
      if (table[i] == WHITE) count++;
    }
    cout << count << '\n';
  }
  return 0;
}

Measured memory_bytes: 1584
#include <iostream>
#include <utility>
#include <vector>

using namespace std;

class Card
{
public:
    char suit;
    int number;

    Card() {}
    Card(const Card& card) {
        this->suit = card.suit;
        this->number = card.number;
    }
};

void quick_sort(vector<Card*>& cards, int start, int end);
void merge_sort(vector<Card*>& cards, int start, int end);
void merge(vector<Card*>& cards, int start, int end, int mid);

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

    vector<Card*> cards(n);
    for (int i = 0; i < n; ++i) {
        cards[i] = new Card();
        cin >> cards[i]->suit >> cards[i]->number;
    }

    vector<Card*> cards2(n);
    for (int i = 0; i < n; ++i)
        cards2[i] = new Card(*cards[i]);

    quick_sort(cards, 0, cards.size() - 1);
    merge_sort(cards2, 0, cards2.size() - 1);

    bool stable = true;
    for (int i = 0; i < n; ++i) {
        if ((cards[i]->suit != cards2[i]->suit) || (cards[i]->number != cards2[i]->number)) {
            stable = false;
            break;
        }
    }

    if (stable)
        cout << "Stable\n";
    else
        cout << "Not stable\n";

    for (int i = 0; i < n; ++i)
        cout << cards[i]->suit << ' ' << cards[i]->number << '\n';
}

int partition(vector<Card*>& cards, int start, int end)
{
    int pivot = cards[end]->number;
    int div = start - 1;

    for (int i = start; i < end; ++i) {
        if (cards[i]->number <= pivot) {
            ++div;
            swap(cards[i], cards[div]);
        }
    }

    ++div;
    swap(cards[div], cards[end]);

    return div;
}

void quick_sort(vector<Card*>& cards, int start, int end)
{
    if (start < end) {
        int pivot = partition(cards, start, end);
        quick_sort(cards, start, pivot - 1);
        quick_sort(cards, pivot + 1, end);
    }
}

void merge_sort(vector<Card*>& cards, int start, int end)
{
    if (start < end) {
        int mid = (start + end) / 2;
        merge_sort(cards, start, mid);
        merge_sort(cards, mid + 1, end);
        merge(cards, start, end, mid);
    }
}

void merge(vector<Card*>& cards, int start, int end, int mid)
{
    vector<Card*> v1(mid - start + 1);
    vector<Card*> v2(end - (mid + 1) + 1);
    int size1 = v1.size();
    int size2 = v2.size();

    for (int i = 0; i < size1; ++i)
        v1[i] = cards[start + i];

    for (int i = 0; i < size2; ++i)
        v2[i] = cards[mid + 1 + i];

    int idx1 = 0;
    int idx2 = 0;
    int i = start;

    while ((idx1 < size1) && (idx2 < size2)) {
        if (v1[idx1]->number <= v2[idx2]->number) {
            cards[i] = v1[idx1];
            ++idx1;
            ++i;
        } else {
            cards[i] = v2[idx2];
            ++idx2;
            ++i;
        }
    }

    while (idx1 < size1) {
        cards[i] = v1[idx1];
        ++idx1;
        ++i;
    }

    while (idx2 < size2) {
        cards[i] = v2[idx2];
        ++idx2;
        ++i;
    }
}



Measured memory_bytes: 11332
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld long double
int main(){
	/*
	#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
	#endif
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	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];
	for(int i=0;i<3;i++) dp[0][i]=a[0][i];
	for(int i=1;i<n;i++){
		for(int j=0;j<3;j++){
			int l=-1;
			for(int k=0;k<3;k++){
				if(j==k) continue;
				l=max(l,dp[i-1][k]);
			}
			dp[i][j]=a[i][j]+l;
		}
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const long long MOD = 998244353;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())
constexpr auto PI = 3.14159265358979323846264338327950L;
std::vector<bool> IsPrime;
int max = 1000000;
void sieve(size_t max) {
    if (max + 1 > IsPrime.size()) {     // resizeで要素数が減らないように
        IsPrime.resize(max + 1, true); // IsPrimeに必要な要素数を確保
    }
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない

    for (size_t i = 2; i*i <= max; ++i) // 0からsqrt(max)まで調べる
        if (IsPrime[i]) // iが素数ならば
            for (size_t j = 2; i*j <= max; ++j) // (max以下の)iの倍数は
                IsPrime[i*j] = false;      // 素数ではない
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> a(N,0);
    for (int i = 0; i < N-1; ++i) {
        int x;
        cin >> x;
        --x;
        a[x]++;
    }

    for (int i = 0; i < N; ++i) {
        cout << a[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3988
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define V vector<int>
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 50;

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, b; cin >> a >> b;
	if (a <= 8 && b <= 8)cout << "Yay!" << endl;
	else cout << ":(" << endl;
	return 0;
}

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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

template <class T1, class T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T1, class T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr ll mod = 1000000007;

int main() {
    string S;
    cin >> S;
    if (S[2] == S[3] && S[4] == S[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

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

long long a, b, v, w, t;

int main () {
	scanf("%lld%lld%lld%lld%lld", &a, &v, &b, &w, &t);
	long long dist = max(a - b, b - a);
	if ((v - w) * t >= dist) printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 3760
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>

int W_Length(char *str){
	int length = 0;
	while(*str++ != '\0')
		length++;
	return length;
}

void swap(int *a, int *b){
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}
//swap(&a, &b)

double deg(double theta){//deg to theta
return theta*(2*3.14159265359)/360;
}

int cmp( const void *p, const void *q ) {
    return *(int*)p - *(int*)q;
}//ちいさい順
//qsort(a,n,sizeof(int),cmp);

int cmp_s(const void * left, const void * right)
{
	char *left_char = (char *)left;
  char *right_char = (char *)right;
  return strcmp(left_char, right_char);
}
//qsort(s,n,sizeof(s[0]),cmp_s);
//char s[n][11]


int main (void)
{
	int n,i,a[210000]={0},max=1,k=0,temp;
  a[1]=0;
	
	scanf("%d", &n);
	for(i=2; i<=n;i++){
		scanf("%d", &temp);
      a[temp]++;
}
  
  for(i=1; i<=n;i++){
		printf("%d\n",a[i]);
}

return 0;
}


Measured memory_bytes: 2552
import sys
import itertools
import math
from collections import deque
from collections import defaultdict
from itertools import permutations
import heapq
import bisect
from scipy.sparse.csgraph import floyd_warshall as wf
INF = 10**20

A,B,Q = map(int,input().split())
s = [-INF]+list(map(int, (sys.stdin.readline() for _ in [0]*A)))+[INF]
t = [-INF]+list(map(int, (sys.stdin.readline() for _ in [0]*B)))+[INF]
queries=list(map(int,sys.stdin))
for q in queries:
    b,d = bisect.bisect_right(s,q),bisect.bisect_right(t,q)
    ans = INF
    for S in [s[b-1],s[b]]:
        for T in [t[d-1],t[d]]:
            d1,d2 = abs(S-q)+abs(T-S),abs(T-q)+abs(S-T)
            ans = min(ans,d1,d2)
    print(ans)

Measured memory_bytes: 27452
#include <bits/stdc++.h>
//#define local
#ifdef local
#include "dbg-macro/dbg.h"
#endif
#define ll long long
#define pi (acos(-1))
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);

int main()
{
	char c;
  int ans=0;
 int prev=0;
  bool f=true;
  rep(i,3){
    cin>>c;
    if(c=='R'){
      f=true;
    ++prev;
    }else{
      prev=0;
      f=false;}ans=max(ans,prev);}cout<<ans<<endl;


    return 0;
}

/*author  https://qiita.com/drken/items/0c88a37eec520f82b788*/
ll extgcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0)
    {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}


std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) { is_prime[i] = true; }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++)
    {
        if (is_prime[i])
        {
            for (unsigned ll j = 2 * i; j <= N; j += i) { is_prime[j] = false; }
            P.emplace_back(i);
        }
    }
    return P;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
#define PI acos(-1.0)
#define eps 1e-9
#define ll long long
#define ull unsigned long long
#define nl printf("\n")
#define sf scanf
#define pf printf
#define INF (ll)1e15
#define mod 1000000007

///#define isValid(n,m,nx,ny)nx>=0&&nx<n&&ny>=0&&ny<m
///int kx[]={1, 1, -1, -1, 2, 2, -2, -2}; //knight moves
///int ky[]={2,-2,  2, -2, 1,-1,  1, -1}; //knight moves
///int dx[]={1,-1,0,0,1,-1,1,-1};//eight direction
///int dy[]={0,0,1,-1,1,-1,-1,1};//eight direction
 
///using namespace __gnu_pbds;
using namespace std;
 
///inline double toRad(double deg){return deg*PI/180;}
///inline double toDeg(double rad){return rad*180/PI;}
///typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
 
const int S=12;
bool graph[S+5][S+5];
bool visit[S+5];
int n,m;

int Dfs(int u)
{
    visit[u]=true;
    bool f=true;
    int sum=0;
    for(int i=0;i<n;i++)
    {
        if(graph[u][i] && !visit[i])
        {
            visit[i]=true;
            f=false;
            sum+=Dfs(i);
            visit[i]=false;
        }
    }
    if(f)
    {
        int cnt=0;
        for(int i=0;i<n;i++)
        {
            if(visit[i])cnt++;
        }
        if(cnt==n)return 1;
        return 0;
    }
    return sum;
}

int main()
{
    #ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    #endif    
    while(sf("%d %d",&n,&m)==2)
    {
        memset(graph,false,sizeof graph);
        for(int i=0;i<m;i++)
        {
            int u,v;
            sf("%d %d",&u,&v);
            u--,v--;
            graph[u][v]=graph[v][u]=true;
        }

        memset(visit,false,sizeof visit);
        pf("%d\n",Dfs(0));
    }
    return 0;
}
 









 




























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

int main() {
  int n;
  cin >> n;
  vector<int> x(n), y(n), z(n), z2(n), z3(n);
  for (int i = 0; i < n; i++) cin >> x.at(i);
  for (int i = 0; i < n; i++) cin >> y.at(i);
  double Manhattan = 0;
  double Euclidean = 0;
  double sum3 = 0;
  double Chebyshev = 0;
  for (int i = 0; i < n; i++) {
    z.at(i) = abs(x.at(i) - y.at(i));
    z2.at(i) = pow(z.at(i), 2);
    z3.at(i) = z2.at(i) * z.at(i);
    Manhattan += z.at(i);
    Euclidean += z2.at(i);
    sum3 += z3.at(i);
    if (Chebyshev < z.at(i)) Chebyshev = z.at(i);
  }

  Euclidean = sqrt(Euclidean);
  sum3 = pow(sum3, (double)1/3);
  cout << fixed << setprecision(6);
  cout << Manhattan << endl;
  cout << Euclidean << endl;
  cout << sum3 << endl;
  cout << Chebyshev << endl;
}



Measured memory_bytes: 3432