akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		double N = stdIn.nextInt();
		int X = (int)Math.floor(N/1.08);
		
		if((int)((X-1)*1.08) == (int)N) System.out.println(X-1);
		else if((int)(X*1.08) == (int)N) System.out.println(X);
		else if((int)((X+1)*1.08) == (int)N) System.out.println(X+1);
		else System.out.println(":(");

	}

}

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

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;}


int main(){
  int n;
  cin >> n;
  int p1 = 0;
  int p2 = 0;
  rep(i,n){
    string taro, hana;
    cin >> taro >> hana;
    if(taro == hana){
      p1++;
      p2++;
    }
    else if(taro > hana) p1 += 3;
    else if(hana > taro) p2 += 3;
  }
  cout << p1 << " " << p2 << endl;
}






Measured memory_bytes: 3188
#include<iostream>
#include<vector>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<int> d(N);
    int i;
    for(i=0;i<N;i++)cin >> d[i];
    int m = 0;
    bool f = true;
    for(i=0;i<N;i++)if(m >= i*10)m = max(m,i*10+d[i]);
    if(m < 10*(N-1))f = false;
    m = 0;
    for(i=0;i<N;i++)if(m >= i*10)m = max(m,i*10+d[N-i-1]);
    if(m < 10*(N-1))f = false;
    cout << (f?"yes":"no") << endl;
}


Measured memory_bytes: 3888
#include <stdio.h>
void swap(int*t,int*s)
{
    int temp=*t;
        *t=*s;
        *s=temp;
}
void sort3(int*a,int*b,int*c)
{
    if(*a>*b) swap(a,b);
    if(*b>*c) swap(b,c);
    if(*a>*b) swap(a,b);
}
int main(void){
    int x, y, z;
    scanf("%d",&x);
    scanf("%d",&y);
    scanf("%d",&z);
    
    sort3(&x,&y,&z);
    
    printf("%d %d %d\n",x,y,z);

	return 0;
}


Measured memory_bytes: 2108
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let N: usize = read();
    println!("{}", solve(N));
}

fn solve(n: usize) -> String {
    let max = 55555;
    let mut vec: Vec<usize> = (0..max).collect();
    let mut ans_primes: Vec<usize> = vec![];
    for i in 0..max {
        if i < 2 {
            vec[i] = 0;
            continue;
        }
        let val = vec[i];
        if val == 0 {
            continue;
        }
        if val % 5 == 1 {
            ans_primes.push(val);
            if ans_primes.len() == n {
                break;
            }
        }
        let mut j = 1;
        while val * j < max {
            vec[val * j] = 0;
            j += 1;
        }
    }
    ans_primes
        .iter()
        .map(|x| x.to_string())
        .collect::<Vec<String>>()
        .join(" ")
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test1() {
        assert_eq!("11 31 41 61 71", solve(5));
    }
}


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

int main(void) {
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;

    if (N < 3) {
        printf("0\n");
        return 0;
    }
    int ans = 0;
    int i = 1;
    while (i < N) {
        if (K == 0) {
            break;
        }
        bool flag = false;
        while (i < N && S[i] != S[i - 1]) {
            S[i] = S[i - 1];
            flag = true;
            ++i;
        }
        if (flag) {
            --K;
        }
        ++i;
    }
    // cout << S << endl;
    for (int i = 0; i < N; ++i) {
        if (S[i] == 'L') {
            if (i > 0 && S[i - 1] == 'L') {
                ++ans;
            }
        } else {
            if (i < N - 1 && S[i + 1] == 'R') {
                ++ans;
            }
        }
    }

    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

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

int main(){
    ll n, sum=0;
    cin >> n;
    rep2(i, 1, n+1){
        sum += i * (n / i) * (n / i + 1) / 2;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	string input;
	vector<bool> alphabet(26, true);
	cin >> input;

	for (int i = 0; i < input.size(); i++)
	{
		int num = input[i] - 'a';
		alphabet[num] = !alphabet[num];
	}

	for (int i = 0; i < alphabet.size(); i++)
	{
		if (!alphabet[i])
		{
			cout << "No" << endl;
			return;
		}
	}
	cout << "Yes" << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
using namespace std;
typedef long long int64;
typedef pair<int64, int64> pll;


int main(){
	string S,T;
	cin >> S >> T;
	T = T.substr(0,T.length()-1);
	if( S == T)	puts("Yes");
	else		puts("No");

}



Measured memory_bytes: 3036
#define _USE_MATH_DEFINES


#include <iostream>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <numeric>

#include <cmath>

using namespace std;

typedef long long LL;

int main() {
	int n;
	vector< pair<string, int> > vec;

	string suits[] = { "S", "H", "C", "D" };
	vector< pair<string, int> > all_cards;

	cin >> n;
	int rank;
	string suit;
	for (int i = 0; i < n; ++i) {
		cin >> suit >> rank;
		auto p = make_pair(suit, rank);
		vec.emplace_back(p);
	}

	for (auto&& s : suits) {
		for (int i = 1; i <= 13; ++i) {
			auto p = make_pair(s, i);
			all_cards.emplace_back(p);
		}
	}

	sort(vec.begin(), vec.end());

	for (auto&& ac : all_cards) {
		auto iter = find(vec.begin(), vec.end(), ac);

		if (iter == vec.end()) {
			cout << ac.first << " " << ac.second << "\n";
		}
	}

	return 0;
}



Measured memory_bytes: 3152
steps = gets.chomp
odd_actions = ['R', 'U', 'D']
even_actions = ['L', 'U', 'D']

sl = steps.length
is_fumiyasui = true

sl.times do |i|
  step_num = i + 1
  if(step_num.odd?)
    is_fumiyasui = false unless odd_actions.include?(steps[i])
  else
    is_fumiyasui = false unless even_actions.include?(steps[i])
  end

  break unless is_fumiyasui
end

puts is_fumiyasui ? "Yes" : "No"


Measured memory_bytes: 1916
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include <assert.h>
typedef int64_t ll;
typedef uint64_t ull;
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)

#define MAXN (200001)
#define MOD (1000000007)

int main(void)
{
    int n;
    scanf("%d",&n);

    
    printf("%lf\n", (double)((n+1)/2)/(double)n);
    return 0;
}


Measured memory_bytes: 128
sp = list(input())
t = list(input())
flag = False
cnt = -1
l = len(t)
for i in range(len(sp) - l+1):
    for j in range(l):
        if sp[i+j]  == t[j] or sp[i+j]  == "?":
            pass
        else:
            break
    else:
        cnt = i
if cnt == -1:
    print("UNRESTORABLE")
else:
    for i in range(len(sp)):
        if sp[i] == "?" :
            if not cnt<= i <cnt+l:
                sp[i] ="a"
            else :
                sp[i] = t[i-cnt]
    print("".join(sp))


Measured memory_bytes: 3064
#include <stdio.h>
 
void printNumbers(int A[], int N){
    int i;
    for( i=0; i<N; i++){
        if(i>0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}
 
void swap(int *a, int *b){
    int temp;
    temp = *a;
     
    *a =*b;
    *b = temp;
}
 
 
int selectionSort(int A[],int N){
    int i;
    int j;
    int minj;
    int count=0;
     
    for(i=0; i<N; i++){
        minj=i;
        for(j=i; j<N; j++){
            if(A[j]<A[minj]){
                minj=j;
            }
        }
        if(minj != i){
            swap(&(A[i]),&(A[minj]));
            count++;
        }
    }
    return count;
}
 
 
int main() {
    int N;
    int i;
    int count;
    int A[100];
    scanf("%d",&N);
     
    for(i=0; i<N; i++){
        scanf("%d",&A[i]);
    }
     
    count = selectionSort(A, N);
    printNumbers(A,N);
    printf("%d\n",count);
     
    return 0;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a[200005];
int main() {
	ll n;
	scanf("%d", &n);
	for (ll i=1; i<=n; i++) {
		scanf("%lld", &a[i]);
	}
	ll ans=0,j=2,k=a[1];
	for (ll i=1; i<=n; i++) {
		while ((j<=n) && (k&a[j])==0) k^=a[j++];
		k^=a[i];
		ans+=j-i;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1792
s = list(input())
li = [0 for i in range(len(s))]

r = 0
l = 0
memo = -1

for i in range(len(s)):
    if s[i]=='R':
        r += 1
        if i<len(s)-1 and s[i+1] == 'L':
            memo = i
        if i == len(s)-1:
            li[len(s)-1] = r
    else:
        l += 1
        if i==len(s)-1 or s[i+1] == 'R':
            if memo != -1:
                li[memo] = (r+1)//2 + l//2
                li[memo+1] = r + l - li[memo]
                r = 0
                l = 0
            else:
                li[0] = l

li2 = map(str, li)

print(' '.join(li2))

Measured memory_bytes: 11300
using System;
using System.IO.Pipes;

class Battle
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');

        int[] Takahashi = new int[2] { int.Parse(input[0]), int.Parse(input[1]) };

        int[] Aoki = new int[2] { int.Parse(input[2]), int.Parse(input[3]) };

        var ans = "";

        while (Aoki[0] > 0)
        {
            Aoki[0] = Aoki[0] - Takahashi[1];
            if (Aoki[0] <= 0)
            {
                ans = "Yes";
                break;
            }
            Takahashi[0] = Takahashi[0] - Aoki[1];
            if (Takahashi[0] <= 0)
            {
                ans = "No";
                break;
            }

         
        }
        Console.WriteLine(ans);

    }
}

Measured memory_bytes: 17824
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] v = new int[N];
    PriorityQueue<Integer> queue = new PriorityQueue<>();
    for (int i = 0; i < N; i++) {
      queue.add(sc.nextInt());
    }
    float ans = queue.poll();
    while (!queue.isEmpty()) {
      ans = (ans + queue.poll()) / 2;
    }
    System.out.println(ans);
  }
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ASC(x) sort(ALL((x)))
#define DESC(x) sort(ALL((x)),greater<ll>())
#define pb push_back

int main()
{
    string S;
    ll Q;
    cin >> S;
    cin >> Q;
    ll t, f, rev = 0;
    char c;
    string L, R;
    REP(i,0,Q) {
        cin >> t;
        if(t == 1) rev = 1 - rev;
        else if(t == 2) {
            cin >> f >> c;
            if(f == 1) {
                if(rev == 0) L += c;
                else R += c;
            }
            else {
                if(rev == 0) R += c;
                else L += c;
            }
        }
    }

    reverse(ALL(L));
    string T = L + S + R;
    if(rev == 1) reverse(ALL(T));
    PR(T);

    return 0;
}

/*



*/

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

int main(void)
{
    std::string S, T;
    std::cin >> S;
    std::cin >> T;

    int cnt = 0;
    for(int i = 0; i < S.length(); ++i)
    {
        if(S[i] != T[i])
        {
            ++cnt;
        }
    }
    std::cout << cnt;
    return 0;
}

Measured memory_bytes: 3916
#include<stdio.h>

#define MAX 250

int main()
{
  int h,i,A[250];

  scanf("%d",&h);

  for(i = 1 ; i <= h ; i++)
    {
      scanf("%d",&A[i]);
    }

  for(i = 1 ; i <= h ; i++)
    {
      printf("node %d: key = %d, ",i,A[i]);
      
      if(i != 1) printf("parent key = %d, ",A[i/2]);
      
      if(2*i <= h)printf("left key = %d, ",A[2*i]);
      
      if(2*i+1 <= h)printf("right key = %d, ",A[2*i+1]);

      printf("\n");
    }
  
  return 0;
}



Measured memory_bytes: 2052
/*
    Author : manu_sy
*/
#include "bits/stdc++.h"
using namespace std;
 
/** Template Begins **/
 
typedef long long        ll;
typedef pair<int,int>    PII;
 
#define IOS         ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl        '\n'
#define pb          push_back
#define F           first
#define S           second
#define mp          make_pair
#define all(a)      (a).begin(), (a).end()
#define FOR(i,a,b)  for(int i=a;i<=b;i++)
#define LP(i,n)     for(int i=0;i< n;i++)
 
/* Debug */
 
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.F << "," << P.S << ")";
} 
 
template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
 
template<class TH> void _dbg(const char *sdbg, TH h){ cerr << sdbg << '=' << h << endl; }
 
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',') cerr << *sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}
 
#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif
 
/* Debug Ends */
 
const int N = 3e6+7;
 
/** Template Ends **/
int p[N], a[N], cnt[N], n;

 
signed main() {
 
    IOS;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i], p[a[i]]++;

    int ans = 0;
    for (int i = 1; i < N; i++) {
    	if (p[i]) {
    		for (int j = i; j < N; j += i) cnt[j]++;
    		if (cnt[i] == 1 && p[i] == 1) ans++;
    	}
    }	
    cout << ans << endl;


 
    return 0;
}























Measured memory_bytes: 19936
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template<long long mod>
struct mint {
private:
    long long x;
public:
    mint(long long x = 0) :x((mod + x) % mod) {}
    mint(std::string &s) {
        long long z = 0;
        for (int i = 0; i < s.size(); i++) {
            z *= 10;
            z += s[i] - '0';
            z %= mod;
        }
        this->x = z;
    }
    mint& operator+=(const mint &a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint &a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint &a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint& operator/=(const mint &a) {
        long long n = mod - 2;
        mint<mod> u = 1, b = a;
        while (n > 0) {
            if (n & 1) {
                u *= b;
            }
            b *= b;
            n >>= 1;
        }
        return *this *= u;
    }
    mint operator+(const mint &a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint &a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint &a) const {
        mint res(*this);
        return res *= a;
    }
    mint operator/(const mint &a) const {
        mint res(*this);
        return res /= a;
    }
    friend std::ostream& operator<<(std::ostream &os, const mint &n) {
        return os << n.x;
    }
    bool operator==(const mint &a) const {
        return this->x == a.x;
    }
};

int main() {
    constexpr int MOD = 1e9 + 7;
    string s; cin >> s;
    // dp
    vector<vector<mint<MOD>>> dp(s.size() + 1, vector<mint<MOD>>(2));
    dp[0][0] = 1;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '1') {
            dp[i + 1][0] = dp[i][0] * 2;
            dp[i + 1][1] = dp[i][0] + dp[i][1] * 3;
        }
        else {
            dp[i + 1][1] = dp[i][1] * 3;
            dp[i + 1][0] = dp[i][0];
        }
    }
    cout << dp[s.size()][0] + dp[s.size()][1] << endl;
    return 0;
}

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

int main(){
    int N,M;
    int X[100000] = {};
    int L[100000] = {};
    int sum = 0;
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        cin >> X[i];
    }
    //cout << 'a'<< endl;
    sort(X,X+M);
    for(int i = 0; i < M-1; i++){
        L[i] = X[i+1] - X[i];
    }
    sort(L,L+M-1);
    for(int i = 0; i < M-N; i++){
        //cout << L[i] << endl;
        sum += L[i];
    }
    cout << sum << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <map>

using namespace std;
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)

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

    map<int, long long> m;
    repp(i, 0, N) {
        int a, b;
        cin >> a >> b;
        m[a] += b;
    }

    for (auto x : m) {
        K -= x.second;
        if (K <= 0) {
            cout << x.first << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 4224
N,Y = map(int,input().split())

list = [-1,-1,-1]

for x in range(N+1):
  for y in range(N+1-x):
    z = N - x - y
    if (x*10000) + (y*5000) + (z*1000) == Y and z <= Y:
      list[0] = x
      list[1] = y
      list[2] = z

ans = ""
for i in list:
  ans += str(i) + " "
print(ans.rstrip())

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int n,i,j,k;string s[102];
int main()
{
	cin>>n;
	for(i=0;i<n;i++)
	cin>>s[i];
	for(i=1;i<n;i++)
	{
		if(s[i][0]!=s[i-1][s[i-1].size()-1])
		{cout<<"No";return 0;}	
		for(j=0;j<i;j++)
		{
			if(s[i].size()!=s[j].size())continue;
			for(k=0;k<s[i].size();k++)
			{
				if(s[i][k]!=s[j][k])break;
			}
			if(k==s[i].size())break;
		}
		if(j<i)break;
	}
	if(i<n)cout<<"No";
	else cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


mint comb(ll x, ll k) {
    if (k<0 || k>x) return mint(0);
    if (k==0 || k==x) return mint(1);
    mint res = 1;
    rep(i, k) {
        res *= (x-i);
        res /= (i+1);
    }
    return res;
}



int main(){
    int T;
    cin >> T;
    rep(ti, T) {
        ll n;
        cin >> n;
        mint ans = 0;
        rep(i, 12) {
            ll total = n  - 5 - i;
            if (total<0) continue;
            if (total%2!=0) continue;
            total /= 2;
            mint res = comb(total+15, 15);
            res *= comb(11, i);
            ans += res;
            //debug(ans);
        }
        cout << ans << endl;
    }
    
    return 0;
}


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

int main() {

    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    a.push_back(a[0]+k); // 円環は数直線に展開する（2kに伸ばしてやる）0をまたぐ部分を追加
    
    int l = 0;
    rep(i,n) {
        l = max(l, a[i+1]-a[i]);
    }
    int ans = k-l;
    cout << ans << endl;
    return 0;
}


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

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

  vector<int64_t> lucas(N);
  lucas[0] = 2;
  lucas[1] = 1;

  if (N == 0)
  {
    cout << 2 << endl;
    return 0;
  }
  if (N == 1)
  {
    cout << 1 << endl;
    return 0;
  }

  for (int i = 2; i < N + 1; i++)
  {
    lucas[2] = lucas[0] + lucas[1];
    lucas[0] = lucas[1];
    lucas[1] = lucas[2];
  }
  cout << lucas[2] << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;


int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,a[10][10];
    memset(a,0,sizeof(a));
    cin>>n;
    int x,y;
    for(int i=1;i<=n;i++){
        x=i%10;
        y=i;
        while(y>=10)y/=10;
        a[y][x]++;
    }
    int ans=0;
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            ans+=a[i][j]*a[j][i];
        }
    }
    cout << ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include <set>
#include<map>
using namespace std;
typedef long long ll;




int main()
{
    int n,c=0;
    cin>>n;
    ll a[n];
    for(int i = 0; i<n; i++){
        cin>>a[i];
        //if(a[i]%2==0)c++;
    }
    int mx = 0;
    ll two = 2;
    for(int i = 0; i<n; i++){
        for(int j = 0; j<n; j++){
            if(a[j]%2!=0){
                return cout<<c,0;
            }
            else if(a[j]%2==0){
                a[j]/=2;
                if(j>=n-1){
                    c++;
                }
            }
        }
        if(i>=n-1){
            i = 0;
        }
    }
    cout<<c;
    return 0;
}

Measured memory_bytes: 256
input = readlines()
n = input.shift.chomp.to_i

r_hash = {}
(1..n).each do |x|
  break if x * x > n
  (1..n).each do |y|
    break if y > x
    (1..n).each do |z|
      break if z > y
      r = x*x + y*y + z*z + x*y + y*z + z*x
      break if r > n
      r_hash[r] = 0 if r_hash[r].nil?
      r_hash[r] += 1 if [x,y,z].uniq.length == 1
      r_hash[r] += 3 if [x,y,z].uniq.length == 2
      r_hash[r] += 6 if [x,y,z].uniq.length == 3
    end
  end
end

(1..n).each do |num|
  puts r_hash[num].to_i
end


Measured memory_bytes: 14876
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <numeric>


int main() {
	int n;

	std::cin >> n;

	std::vector<int> v(n);

	for (size_t i = 0; i < n; i++)
	{
		std::cin >> v[i];
	}

	int count = 1;
	int max = v[0];

	for (size_t i = 1; i < n; i++)
	{
		if (max <= v[i]) {
			count++;
			max = v[i];
		}
	}

	std::cout << count << std::endl;
}

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

int main() {
    int n,k;
    cin >> n >> k;
    
    vector<int> a(n);
    rep(i,n) {
    cin >> a.at(i);
    }
    
    sort(a.begin(),a.end());
    
    
    if(k >= n) {
    cout << 0;
    }
    else {
        rep(i,k) {
        a.pop_back();
        }
        
        long long sum = 0;
        rep(i, n-k) {
        sum += a.at(i);
        }
        cout << sum;
     }
    
}

Measured memory_bytes: 4028
#include<stdio.h>
int main(void)
{
  int n;
  long h[200000];
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%ld",&h[i]);
  }

  int start=0;
  int count_max=0;
  while(start<n){
    int count=0;
    while(h[start]>=h[start+1]&&start<n-1){
      count++;
      start++;
    }
    if(count>count_max){
      count_max=count;
    }
    start++;
  }



  printf("%d\n",count_max);
  return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
/*
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds; 
//order_of_key(k)= # of items strictly smaller than 'k'  //find_by_order(x)= iterator to x'th largest element (counting from ZERO) //erase("iterator") [log(n)] //end(<name>)
//os.find_by_order(os.order_of_key(x)=iterator to 'x' in the rb tree
template<class T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target ("avx2")
//#pragma GCC optimize ("O3")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);

typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef priority_queue<ll> pq;                                        //min-heap-> multiply the values by '-1'
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define forr(i,a,b) for (ll i = a; i < b; i++)
#define test ll t;cin>>t;while(t--)
#define summ(a,n) accumulate(a,a+n,0)
#define bsrch(v,n) lower_bound(v.begin(), v.end(), n)
#define minindex(v) distance(v.begin(),min_element(v.begin(),v.end()))         //returns index of minimum(/max) element in the vector
#define bp(x) _builtin_popcount(x)
#define inf 1000000000000
#define PI = 3.1415926535897932384626
#define mod 1000000007

ll n;
double dp[301][301][301];
double solve(ll a, ll b, ll c)
{
    if(a<0 || b<0 || c<0) return 0;
    if(a==0 && b==0 && c==0) return 0;
    
    if(dp[a][b][c]) return dp[a][b][c];
    
    dp[a][b][c]=(n + a*solve(a-1,b,c) + b*solve(a+1,b-1,c) + c*solve(a,b+1,c-1))/(a+b+c);
    //dp = (1 + p(0)*ev + p(1)*ev + p(2)*ev + p(3)*ev); link="https://discuss.codechef.com/t/how-to-solve-this-problem/50519/5"
    return dp[a][b][c];
}

int main()
{
    cin>>n;
    ll cnt[4]={0};
    forr(i,0,n)
    {
        ll x; cin>>x;
        cnt[x]++;
    }
    cout<<setprecision(10)<<solve(cnt[1],cnt[2],cnt[3]);
}

Measured memory_bytes: 111176
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
vector<ll> pw2(51,1);vector<ll> pw10(19,1);


int main(){
    {rep1(i,50) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll A,B,C,K; cin>>A>>B>>C>>K;
    ll ans=0;
    ans+=min(K,A);
    ans-=max(K-A-B,0ll);
    cout<<ans<<endl;
}



Measured memory_bytes: 3604
#include<stdlib.h>
#include<stdio.h>
#define TRUE 1
#define MAX 22

int map[MAX][MAX];
int w,h;
int count;

void move();

int main(void) {
	int x,y;
	char buff;
	int i,j;
	
	while(TRUE) {
		scanf("%d %d", &w, &h);
		if(w==0 && h==0) break;
		for(i=0;i<MAX;i++) {
			for(j=0;j<MAX;j++) {
				map[i][j] = 0;
			}
		}
		
		for(i=1;i<=h;i++) {
			for(j=1;j<=w;j++) {
				scanf("%c", &buff);
				if(buff=='.') map[j][i] = 1;
				else if(buff=='#') map[j][i] = 0;
				else if(buff=='@') {//
					map[j][i] = 1;
					x=j;
					y=i;
				}//
				else j--;
			}
		}
		
		for(i=0;i<MAX;i++) {
			for(j=0;j<MAX;j++) {
				//printf("%d", map[i][j]);
			}
			//printf("\n");
		}
		count = 0;
		move(x,y);
		
		printf("%d\n", count);
	}
	
	exit(0);
}

void move(int x,int y) {
	if(map[x][y] == 1) {
		map[x][y] = 2;
		count++;
	}
	else return;
	//???
	move(x,y+1);
	//???
	move(x,y-1);
	//???
	move(x-1,y);
	//???
	move(x+1,y);
}

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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
    //a^tを求める
    //例：d[i] = mint(k/i).pow(n);
    //mint(2).pow(n); 2^n
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
mint dp[3005][3005];
int main(){
  ll n;
  cin>>n;
  string s;
  cin>>s;
  
  for(ll i=0;i<n+1;i++){
    dp[1][i]=1;
  }

  for(int i=1;i<=n;i++){
    mint sum[n];
    sum[0]=0;
    //cout<<"sum"<<endl;

    rep(j,n){
      sum[j+1]=sum[j]+dp[i][j];
    //  cout<<sum[j+1]<<"j"<<(j+1)<<endl;
    }
  //  cout<<s[i-1]<<endl;
    rep(j,n-i+1){
      if (s[i-1]=='>'){
        dp[i+1][j]+=sum[j+1];
      }
      else{
        dp[i+1][j]+=(sum[n-i+1]-sum[j+1]);
      }
    //  cout<<"first"<<sum[n-i+1]<<"second"<<sum[j+1]<<endl;
    //  cout<<dp[i+1][j]<<"i"<<(i+1)<<"j"<<j<<endl;
    }

  }
  cout<<dp[n][0].x;
return 0;
}


Measured memory_bytes: 74208
n = gets.to_i
#b,c=gets.chomp.split(" ").map(&:to_i);
#s = gets.chomp
#print("#{a+b+c} #{s}\n")

arr = []
n.times do
  arr << (gets.to_i - 1)
end


now = 0
count = 0
while (now != 1 && arr[now] != 0) do
  count += 1
  tmp = now
  now = arr[now]
  arr[tmp] = 0
end

if now == 1
  puts count
else
  puts "-1"
end


Measured memory_bytes: 2996
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int maxn = 2e5 + 5;
#define next asfopj

int n , dp[maxn] , next[maxn][26];
string s;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    cin >> s;
    n = s.size();
    fill_n(&next[0][0],maxn*26,n+1);
    for(int i = n - 1 ; i >= 0 ; --i){
        for(int j = 0 ; j < 26 ; ++j){
            if(s[i] == j + 'a')next[i][j] = i;
            else next[i][j] = next[i + 1][j];
        }
    }
    dp[n] = 1;
    for(int i = n - 1 ; i >= 0 ; --i){
        dp[i] = 1e9;
        for(int j = 0 ; j < 26 ; ++j){
            dp[i] = min(dp[i] , dp[next[i][j] + 1] + 1);
        }
    }
    string res = "";
    for(int now = 0 ; now < n + 1 ; ){
        for(int j = 0 ; j < 26 ; ++j){
            if(dp[now] == dp[next[now][j] + 1] + 1){
                res += char(j + 'a');
                now = next[now][j] + 1;
                break;
            }
        }
    }
    cout << res;
}


Measured memory_bytes: 21652
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
using Graph = vector<vector<int>>;
static const long double GRATIO=(long double)(1+sqrt(5))/2;
ll GCD(ll a, ll b){
    return b ? GCD(b, a%b) : a;
}
ll LCM(ll a, ll b){
    return a/GCD(a,b)*b;
}
//main()内でCOMBinit();してからCOMB(n,k)で求まる　O(N);
const int MAX=2000000;
const int MOD=1e9+7;
long long fac[MAX],finv[MAX],inv[MAX];
void COMBinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2; i<MAX; i++){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

long long COMB(int n, int k){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) %MOD;
}

int main(){
    COMBinit();
    int X,Y;
    cin>>X>>Y;
    int x = X*2;
    int b = (x-Y)/3;
    int a = X-2*b;
    if(a<0 || b<0 || (X+Y)%3){
        cout<<"0"<<endl;
        return 0;
    }
    ll c = a+b;
    ll ans = COMB(c,max(a,b));
    cout<<ans<<endl;
}

Measured memory_bytes: 47104
#include <stdio.h>
#include <math.h>

int main(void)
{
  double x[3];
  double y[3];
  double ox, oy;
  double r;
  double a,b,c;
  int n;
  int i, j;
  double A1,A2,B1,B2,C1,C2;

  scanf("%d", &n);
  for (i = 0; i < n; i++){
    scanf("%lf %lf %lf %lf %lf %lf", &x[0],&y[0],&x[1],&y[1],&x[2],&y[2]);

    A1 = 2.0 * (x[1]-x[0]);
    B1 = 2.0 * (y[1]-y[0]);
    C1 = pow(x[0],2.0)-pow(x[1],2.0)+pow(y[0],2.0)-pow(y[1],2.0);
    A2 = 2.0 * (x[2]-x[0]);
    B2 = 2.0 * (y[2]-y[0]);
    C2 = pow(x[0],2.0)-pow(x[2],2.0)+pow(y[0],2.0)-pow(y[2],2.0);
    ox = (B1*C2-B2*C1)/(A1*B2-A2*B1);
    oy = (C1*A2-C2*A1)/(A1*B2-A2*B1);

    a = sqrt( pow((x[1]-x[0]),2.0) + pow((y[1]-y[0]),2.0));
    b = sqrt( pow((x[2]-x[1]),2.0) + pow((y[2]-y[1]),2.0));
    c = sqrt( pow((x[0]-x[2]),2.0) + pow((y[0]-y[2]),2.0));
    r = (a*b*c)/ sqrt((a+b+c)*(b+c-a)*(a+c-b)*(a+b-c));
    printf("%.3f %.3f %.3f\n", ox, oy, r);
  }
  return 0;
}

Measured memory_bytes: 656
function Main(s) {
  // 入力処理
  const input = s.split('\n').slice(1, -1);
  
  // ソート
  input.sort()
  
  // 出力
  const result = input.join('');
  console.log(result);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 11596
s = input()
m = len(s)

if (s[0] == '0'):
   x = '01' * int(m/2)
   if (m % 2 == 1):
      x += '0'
else:
   x = '10' * int(m/2)
   if (m % 2 == 1):
      x += '1'

ans = [0 if s[i] == x[i] else 1 for i in range(m)]
print(sum(ans))


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

int main() {
	int a, b, c; cin >> a >> b >> c;
	int cnt = 0;
	for (int i = 1; i*i <= c; i++) {
		if (c%i == 0) {
			if (a <= i&&i <= b)cnt++;
			if (i != c / i&&a <= c / i&&c / i <= b)cnt++;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3084
#include <stdio.h>

int main(void)
{
  int n,a,b;
  scanf("%d%d%d",&n,&a,&b);
  if (n==1)
  {
    printf("Hello World");
  }
  if (n==2)
  {
    printf("%d\n",a+b);
  }
  return 0;
}

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

//#define int long long
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define dbg(x) cout<<#x" = "<<(x)<<ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int m;

signed main() {
	cin >> m;
	cout << 48 - m << ln;
}

Measured memory_bytes: 256
let n = read_int()
let a = read_int()
let b = read_int()
let c = read_int()
let d = read_int()
let e = read_int()
let l = [a; b; c; d; e]

let f lst n =
  let l_min = List.fold_right min lst max_int in
  if n mod l_min = 0 then (n / l_min) + 4
  else (n / l_min) + 5
  
let () = print_int (f l n)

Measured memory_bytes: 2432
n,k=map(int,input().split())
h=map(int,input().split())
s=0
if n <= k:
    print("0")
else:
    if k==0:
        s=sum(h)
        print(s)
    else: 
        x=sorted(h)
        for i in range (0, k):
            x.pop()
        s=sum(x)
        print(s)        


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

using namespace std;

typedef long long LL;

int main() {
    int n;
    cin >> n;
    bool front;
    front = n % 2 == 0 ? false : true;

    deque<int> q;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (front) {
            q.push_front(a);
        } else {
            q.push_back(a);
        }
        front = !front;
    }

    for (auto itr = q.begin(); itr != q.end(); itr++) {
        cout << *itr << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 2944
var n,i,m:longint;
    a:array[0..200000]of longint;
begin
  readln(n);
  for i:=2 to n do
  begin
    read(m);
    inc(a[m]);
  end;
  for i:=1 to n do
    write(a[i],' ');
end.

Measured memory_bytes: 1380
#include "bits/stdc++.h"
#include <set>

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int n;
	cin >> n;
	vector<int>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	int sum = a[0];
	rep1(i, n) {
		sum = (sum^a[i]);
	}
	rep(i, n) {
		print(sum^a[i]);
	}
}

Measured memory_bytes: 4684
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main(){
  int a[3];
  for(int i=0;i<3;i++)cin>>a[i];
  sort(a,a+3);
  for(int i=0;i<3;i++){
    cout<<a[i];
    if(i!=2)cout<<' ';
  }
  cout<<'\n';
  return 0;
}



Measured memory_bytes: 3112
while line = gets do
  break if (n = line.to_i) == 0
  array = []
  n.times do
    array.push gets.to_i
  end
  answer = -1000000000
  0.step(n - 1, 1) do |i|
    sum = 0
    i.step(n - 1, 1) do |j|
      sum += array[j]
      answer = sum if sum > answer
    end
  end
  puts answer
end

Measured memory_bytes: 8760
import sys
N = int(input())
A = list(map(int, input().split()))
total = sum(A)
num = [0] * (10 ** 5 + 1)
for a in A:
    num[a] += 1

Q = int(input())
for _ in range(Q):
    b, c = map(int, sys.stdin.readline().split())
    total -= b * num[b]
    total += c * num[b]
    num[c] += num[b]
    num[b] = 0
    print(total)


Measured memory_bytes: 20832
#include <bits/stdc++.h>
#include <algorithm>
#include<string>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int X, t;
    cin >> X >> t;
    if ((X - t) <= 0) {
        cout << 0 << endl;
    } else {
        cout << X - t << endl;
    }

    return 0;
}

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

typedef long long ll;
typedef pair<ll, double> P;
int k;
ll digitsum(ll x){
	ll res = 0;
	while(x > 0){
		res += x % 10;
		x /= 10;
	}
	return res;
}
vector<P> v;
vector<ll> w;
set<ll> st;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> k;
	for(int i=0; i<16; ++i){
		for(int j=0; j<1000; ++j){
			if(i == 0 && j == 0) continue;
			ll t = j;
			for(int k=0; k<i; ++k)
				t = t * 10 + 9;
			if(st.find(t) != st.end()) continue;
			st.insert(t);
			v.push_back(P(t, (double)t/digitsum(t)));
		}
	}
//	for(int i=0; i<100; ++i) cout << v[i].first << "\n";
//	cout << "hoge\n";
	double m = v[v.size()-1].second;
	for(int i=v.size()-2; i>=0; --i){
		if(v[i].second < m + 1e-14){
			m = v[i].second;
			w.push_back(v[i].first);
		}
	}
	reverse(w.begin(), w.end());
	for(int i=0; i<k; ++i) cout << w[i] << "\n";
}

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

int main(){
    int n,m,c;
    
    while(cin >> n >> m){
        vector<int> A,B,C;
        for(int i = n-1 ; i >= 0 ; i--){
            A.push_back(i);
        }
        
        bool flg = false;
        while(m--){
            if(flg){
                A.clear();
                for(int i = 0 ; i < C.size() ; i++){
                    A.push_back(C[i]);
                }
                reverse(A.begin(),A.end());
                B.clear();
                C.clear();
            }
            
            int s = A.size()-1;
            for(int i = s ; i >= s-n/2+1 ; i--){
                B.push_back(A[i]);
                A.pop_back();
            }
            reverse(B.begin(),B.end());
            
            int cnt = 0;
            cin >> c;
            while(C.size() != n){
                if(cnt%2==0){
                    int s = A.size()-1;
                    for(int i = s ; i >= s-c+1 ; i--){
                        if(i < 0) break;
                        C.push_back(A[i]);
                        A.pop_back();
                    }
                }
                else{
                    int s = B.size()-1;
                    for(int i = s ; i >= s-c+1 ; i--){
                        if(i < 0) break;
                        C.push_back(B[i]);
                        B.pop_back();
                    }
                }
                cnt++;
            }
            
            flg = true;
        }
        reverse(C.begin(),C.end());
        cout << C[0] << endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
string s; 
int n;
int main()
{
	cin>>s;
	n=s.size();
	if(s.back()=='1')
	{
		puts("-1");
		return 0;
	}
	s.pop_back();
	for(int i=0;i<s.size();i++)
	{
		if(s[i]!=s[s.size()-i-1])
		{
			puts("-1");
			return 0;
		}
	}
	if(s[0]=='0' || s.back()=='0')
	{
		puts("-1");
		return 0;
	}
	vector <int> v;
	vector <pair<int,int> > ans;
	int node=1;
	int last=0;
	for(int i=0;i<s.size();i++)
	{
	//	if(i>s.size()-i-1)continue;
		
		if(s[i]=='1')
		{
			int size_c=i+1-last;
			last=i+1;
			v.push_back(node);
			for(int j=1;j<size_c;j++)
			{
				ans.push_back(make_pair(node,node+j));
			}
			node+=size_c;
			if(node>n)
			{
				puts("-1");
				return 0;
			}
		}
	}
	while(node<=n)
	{
		v.push_back(node);
		node++;
	}
	for(int i=1;i<v.size();i++)
	{
		ans.push_back(make_pair(v[i-1],v[i]));
	}
	for(int i=0;i<n-1;i++)
	{
		cout<<ans[i].first<<" "<<ans[i].second<<endl;
	}
	return 0;
}

Measured memory_bytes: 2868
#include<iostream>
#include<vector>
#include<algorithm>
#define maju 1919114514
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (a >= 13)cout << b << endl;
	else if(a >= 6)cout << b / 2 << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

const int MAX_V = 1000;
vector<int> es[MAX_V];
int X[MAX_V];

bool ans = true;

pii dfs(int now){
    vector<bool> dp(X[now]+1, false), memo(X[now]+1, false);
    dp[0] = true;
    int s = 0, p, q;
    for(auto &e: es[now]){
        tie(p, q) = dfs(e);
        rep(i, X[now]-p+1) if(dp[i]) memo[i+p] = true;
        rep(i, X[now]-q+1) if(dp[i]) memo[i+q] = true;
        swap(dp, memo);
        fill(all(memo), false);
        s += p+q;
    }
    int j = -1;
    rep(i, X[now]+1) if(dp[i]) j = i;
    if(j == -1) ans = false;
    return pii(X[now], s-j);
}

int main(){
    int N;
    cin >> N;
    rep(i, N-1){
        int p; cin >> p; p--;
        es[p].pb(i+1);
    }
    rep(i, N) cin >> X[i];
    dfs(0);
    if(ans) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 3980
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
  	cin>>n;
  	int a[n] , dp[n];
  	for(int i = 0; i < n; i++){
    	cin>>a[i];
      	dp[i] = 0;
    }
    dp[0] = 0;
    if(n == 1){
    	cout<<dp[0];
      	return 0;
    }
  	dp[1] = abs(a[1] - a[0]);
  	for(int i = 2; i < n; i++){
    	dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]) , dp[i - 2] + abs(a[i] - a[i - 2]));
    }
    cout<<dp[n - 1];

}

Measured memory_bytes: 4384
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String r = sc.next();
        String g = sc.next();
        String b = sc.next();
        int integer = Integer.parseInt(r+g+b);

        String result = "NO";
        if (integer % 4 == 0) result = "YES";
        System.out.println(result);
    }
}


Measured memory_bytes: 21716