akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

string s;
int b[26];

int main() {
	cin >> s;
	inc(i, s.size()) { b[s[i] - 'a']++; }
	
	bool flag = true;
	inc(i, 26) { if(b[i] > 1) { flag = false; } }
	
	cout << (flag ? "yes" : "no") << endl;
	
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define Phuong_ ios_base::sync_with_stdio(0); cin.tie(0);

/// easy access -------------
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<int,int> pi;
typedef tuple<int, int, int, int> tp;
///-------------------------
const int mod = 2019;
int main()
{
    Phuong_; /// <3333
    string s;
    cin >> s;
    int n= s.length();
    vector<int> cnt(mod,0);
    cnt[0]=1;
    int p = 1;
    int sum=0;
    ll ans=0;
    for(int i= n-1; i>=0; --i){
        int num = s[i]-'0';
        sum = (sum + num*p) % mod;
        ans+=cnt[sum];
        p= (10*p)% mod;
        cnt[sum]++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3776
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 998244353;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
   return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
   os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}

ll dp[3010][3030]={};

signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n,s;cin>>n>>s;
  V<ll> v(n);
  rep(i,0,n)cin>>v[i];

  dp[0][0]=1;
  rep(i,0,n){
    rep(j,0,3001){
      if(j+v[i]<3001)(dp[i+1][j+v[i]]+=dp[i][j])%=mod;
      (dp[i+1][j]+=dp[i][j]*2)%=mod;
    }
  }

  cout<<dp[n][s]<<ENDL;
}


//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 74704
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"

#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define all(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define LINF ((ll)1 << 60)
#define INF (1 << 28)
template<typename T>
void chmax(T& a, T b) {
        if (a < b) a = b;
}
template<typename T>
void chmin(T& a,T b) {
        if (a > b) a = b;
}
int T = 1;
//.....................
ull mod = (int)1e9 + 7;
const int MAX = (int)2e5 + 5;

int A, B;
string op;

void solve() {
        cin >> A >> op >> B;
        if (op == "+") {
                cout << A + B << endl;
        }
        else {
                cout << A - B << endl;
        }
}

signed main() {
        cout << fixed << setprecision(20);
        rep(i, T) {
                solve();
        }
        return 0;
}

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

using namespace std;

typedef pair<int,int> ii;

#define X first
#define Y second


const long long inf=1e18;
const int N=55;
const int maxv=50;
int n;
ii a[N];

long long h[N];


bool test(long long mask){
        for(int i=0;i<=maxv;i++){
                h[i]=1LL<<i;
                for(int j=0;j<maxv;j++) if (mask&(1LL<<j))
                        h[i]|=h[i%(j+1)];
        }
        for(int i=1;i<=n;i++) if (!(h[a[i].X]&(1LL<<a[i].Y))) return 0;
        return 1;
}
long long solve(){
        long long ans=0;
        for(int i=maxv-1;i>=0;i--)
                if (!test(ans+(1LL<<i)-1)) ans+=1LL<<i; 
        if (ans==(1LL<<maxv)-1) return -1;
        return ans*2;
}
int main(){
        cin>>n;
        for(int i=1;i<=n;i++) cin>>a[i].X;
        for(int i=1;i<=n;i++) cin>>a[i].Y;
        cout<<solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int A,B,sum;
    cin>>A>>B;
    if(B % A == 0){
        sum=A+B;
    }
    else{
        sum=B-A;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main()
{
  long long N;
  scanf("%lld", &N);
  long long R;
  scanf("%lld", &R);
  if (N >= 10)
    cout << R << endl;
  else
    cout << R + 100 * (10 - N) << endl;

  return 0;
}


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

int main()
{
  int n,k;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  
  int dp[n];
  dp[0]=0;
  
  for(int i=1;i<n;i++)
  {
  	int j=1,mn=INT_MAX;
  	while(j<=k  && i-j>=0)
  	{
  		mn=min( mn, dp[i-j]+abs(a[i]-a[i-j]));
  		j++;
	}
    dp[i]=mn;
  }
  
  cout<<dp[n-1]<<endl;
  
  return 0;
}
  

Measured memory_bytes: 1024
R,G,B,N=map(int,input().split())
way=[R,G,B]
box=0
way.sort(reverse=True)
MAX=way[0]
SECOND=way[1]
MIN=way[2]
ways=int((N-N%MAX)/MAX)
for i in range(0,ways+1):
    sum=N-MAX*i
    way_2=int((sum-sum%SECOND)/SECOND)
    for j in range(0,way_2+1):
        sum_2=sum-SECOND*j
        if sum_2%MIN==0:
            box+=1
print(box)


Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <map>
using namespace std;
typedef long long LL;
int a,b;
int main(){
	scanf("%d%d",&a,&b);
	if(a+b==15) printf("+\n");
	else if(a*b==15) printf("*\n");
	else printf("x\n");
}

Measured memory_bytes: 256
import math

N=[]
for _ in range(30):
  n=int(input())
  if n==0: break
  N.append(n)

for n in N:
  dp=[0]*31
  dp[0]=1
  dp[1]=1
  dp[2]=2
  for i in range(3,n+1):
    dp[i]=dp[i-1]+dp[i-2]+dp[i-3]
  print(math.ceil(dp[n]/10/365))



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

int main(void){
    string str;
    cin >> str;
    int q;
    cin >> q;
    for(int i = 0; i < q; i++){
        string op, p = "";
        int a, b;
        cin >> op;
        if(op == "print"){
            cin >> a >> b;
            cout << str.substr(a, b - a + 1) << endl;
        } else if (op == "reverse"){
            cin >> a >> b;
            for(int i = b; i >= a; i--) p += str[i];
            str.replace(a, b - a + 1, p);
        } else {
            cin >> a >> b >> p;
            str.replace(a, b - a + 1, p);
        }
    }

    return 0;
}



Measured memory_bytes: 3220
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>
#include <numeric>

using namespace std;
typedef long long int ll;
typedef long double ld;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define MOD 1e9 + 7
#define pb push_back
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repn(i, n) for (ll i = 1; i <= n; i++)
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265359

void Main()
{
    int k, x;
    cin >> k >> x;
    cout << ((500 * k >= x) ? "Yes" : "No");
    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
int n, m;
ll A[5100], B[210][5100];
ll psum[5100][5100];

struct RMQ {
    pll tree[17000];
    int key = 8192;
    void init() {
        int i;
        for (i=0;i<key*2;i++) tree[i] = pll(0,0);
    }
    void upd(int idx, pll val) {
        idx+=key;
        while(idx>0) {
            tree[idx] = max(tree[idx],val);
            idx>>=1;
        }
    }
    pll getv(int s, int e) {
        pll res = pll(0,0);
        s+=key;e+=key;
        while(s<=e) {
            if (s&1) res = max(res,tree[s++]);
            if (~e&1) res = max(res,tree[e--]);
            s>>=1;e>>=1;
        }
        return res;
    }
} it;

void dnc(int s, int e, int idx) {
    if (s>e) return;
    int m = it.getv(s,e).second;
    psum[s][m]+=B[idx][m];
    psum[s][e+1]-=B[idx][m];
    psum[m+1][m]-=B[idx][m];
    psum[m+1][e+1]+=B[idx][m];
    dnc(s,m-1,idx); dnc(m+1,e,idx);
}

void calc(int idx) {
    int i;
    it.init();
    for (i=0;i<n;i++) it.upd(i,pll(B[idx][i],i));
    dnc(0,n-1,idx);
}

int main() {
    int i, j;

    scanf("%d%d",&n,&m);
    for (i=1;i<n;i++) scanf("%lld",&A[i]);
    for (i=1;i<n;i++) A[i] += A[i-1];
    for (i=0;i<n;i++) for (j=0;j<m;j++) scanf("%lld",&B[j][i]);
    for (i=0;i<m;i++) calc(i);
    for (i=0;i<=n;i++) for (j=0;j<=n;j++) {
        psum[i][j] += (i?psum[i-1][j]:0)+(j?psum[i][j-1]:0)-(i&&j?psum[i-1][j-1]:0);
    }
    ll maxi = 0;
    for (i=0;i<n;i++) for (j=i;j<n;j++) {
        maxi = max(maxi,psum[i][j]-A[j]+A[i]);
    }
    printf("%lld\n",maxi);

    return 0;
}


Measured memory_bytes: 208640
import java.util.*;
class Main
{
    static int[][] c;
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[4];
        a[0] = sc.nextInt();
        a[1] = sc.nextInt();
        a[2] = sc.nextInt();
        a[3] = sc.nextInt();
        Arrays.sort(a);
        String ans = (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9)? "YES" : "NO";
        System.out.println(ans);
    }
}

Measured memory_bytes: 23124
s = list(input())
s1 = int("".join(s[0:2]))
s2 = int("".join(s[2:4]))
result = ""

if (1<=s1<=12) and (1<=s2<=12):
    result = "AMBIGUOUS"
elif (0<=s1<=99) and (1<=s2<=12):
    result = "YYMM"
elif (1<=s1<=12) and (0<=s2<=99):
    result = "MMYY"
else:
    result = "NA"
print(result)

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

int a;
void solve() {
    for(int i = 9; i > 0; i--) {
        if(a % i == 0 && (a / i) <= 9) {
            cout << "Yes" << endl;
            return;
        }
    }
    cout << "No" << endl;
}


int main() {
    cin >> a;
    solve();
    return 0;
}

Measured memory_bytes: 256
/*ABC176A*/

#include <stdio.h>

int main(){

    int d,t,s,kekka;
    scanf("%d %d %d",&d,&t,&s);

    kekka = t*s;

    if(d <= kekka){
        puts("Yes");
    }
    else{
        puts("No");
    }
    return 0;

}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int a,b,c,d;cin>>a>>b>>c>>d;
  cout<<max(a*b,c*d)<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
#define F first
#define S second
main(){
	double n,m,p,x,ans=0;
	cin>>n>>m;
	p=1.0;
	for(int i=0;i<(int)m;i++)p*=2.0;
	x=m*1900+(n-m)*100;
    x*=p;
	/*r(i,100000){
		ans+=(double(i+1)*x*p);
		p/=2.0;
	}*/
	cout<<(int)x<<endl;
}

Measured memory_bytes: 256
import sys
retsu = list(input())
n = len(retsu)
if n%2== 1:
    a = n // 2 + 1
    for i in range(a):
        sys.stdout.write(retsu[i*2])
else:
    a = n // 2
    for i in range(a):
        sys.stdout.write(retsu[i*2])
        

    


Measured memory_bytes: 4516
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int a1, a2, a3;
    cin >> a1 >> a2 >> a3;
    cout << (a1 + a2 + a3 >= 22 ? "bust" : "win") << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c,i=0,count=0,flag=0;
	scanf("%d%d%d",&a,&b,&c);
	int d[3]={a,b,c};
	for(i=0;i<3;i++)
	{
		if(d[i]==5)
		{count++;}
		if(d[i]==7)
		{flag=1;}
	}
	if(count==2&&flag==1)
	{
		printf("YES");
	}
	else
	{printf("NO");}
	return 0;
 } 

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cassert>
using namespace std;
typedef pair<double, double> PDD;
PDD calc(double mat[2][2], double vec[2]){
  double a = mat[0][0], b = mat[0][1], d = mat[1][0], e = mat[1][1];
  double c = vec[0], f = vec[1];
  double det = a * e - d * b;
  return make_pair((e * c - b * f) / det, (-c * d + a * f) / det);
}
int main(){
  int Tc;
  cin >> Tc;
  for(int tc = 0; tc < Tc; ++tc){
    double x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    if(y1 - y3 == 0){
      swap(y2, y3);
      swap(x2, x3);
    }
    else if(y2 - y3 == 0){
      swap(y1, y3);
      swap(x1, x3);
    }
    double A, B, C, D, E, F;
    A = (y1 + y3) / 2.;
    B = (x1 - x3) / (y1 - y3);    
    C = (x1 + x3) / 2.;
    D = (y2 + y3) / 2.;
    E = (x2 - x3) / (y2 - y3);
    F = (x2 + x3) / 2.;
    double mat[2][2];
    mat[0][0] = B; mat[0][1] = 1;
    mat[1][0] = E; mat[1][1] = 1;
    double vec[2];
    vec[0] = A + B * C;
    vec[1] = D + E * F;
    PDD res = calc(mat, vec);
    double x = res.first, y = res.second;
    assert(x==x); assert(y==y);
    double r = pow((x-x1)*(x-x1)+(y-y1)*(y-y1), 0.5);
    x = (double)(round(x*1000))/1000.0;
    y = (double)(round(y*1000))/1000.0;
    r = (double)(round(r*1000))/1000.0;    
    x = (x == -0.0) ? 0.0 : x;
    y = (y == -0.0) ? 0.0 : y;
    printf("%.3f %.3f %.3f\n", x, y, r);
  }
  return 0;
}

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

int main()
{
    ll N;
    cin >> N;
    ll ans = N * (N - 1) / 2;
    cout << ans << endl;
}

Measured memory_bytes: 256
package main

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

var sc *bufio.Scanner

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	a, p := nextInt(), nextInt()

	p += a * 3

	fmt.Println(p / 2)
}


Measured memory_bytes: 640
//bcw0x1bd2 {{{
#include<bits/stdc++.h>
#include<unistd.h>
using namespace std;
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define SZ(x) ((int)((x).size()))
#define ALL(x) begin(x),end(x)
#define REP(i,x) for (int i=0; i<(x); i++)
#define REP1(i,a,b) for (int i=(a); i<=(b); i++)

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

#ifdef DARKHH
#define FILEIO(name)
#else
#define FILEIO(name) \
  freopen(name".in", "r", stdin); \
  freopen(name".out", "w", stdout);
#endif

#ifdef DARKHH
template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
  int c=0;
  while ( *s!=',' || c!=0 ) {
    if ( *s=='(' || *s=='[' || *s=='{' ) c++;
    if ( *s==')' || *s==']' || *s=='}' ) c--;
    cerr<<*s++;
  }
  cerr<<"="<<head<<", ";
  _dump(s+1,tail...);
}

#define dump(...) do { \
  fprintf(stderr, "%s:%d - ", __PRETTY_FUNCTION__, __LINE__); \
  _dump(#__VA_ARGS__, __VA_ARGS__); \
} while (0)

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
  s<<"[";
  for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
  s<<"]";
  return s;
}

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T, size_t N>
ostream& operator <<( ostream &s, const array<T,N> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }
#else
#define dump(...)
#endif
// }}}
// Let's Fight! ~OAO~~

const int MXN = 100005;

int N,K,to[MXN];
int ans,dep[MXN],fa[MXN],vst[MXN];
vector<int> child[MXN];

void DFS(int u, int f, int d) {
  vst[u] = 1;
  dep[u] = d;
  fa[u] = f;
  for (auto v:child[u]) 
    if (!vst[v]) DFS(v,u,d+1);
}
int main() {
  IOS;

  ans = 0;
  cin >> N >> K;
  REP(i,N) {
    cin >> to[i];
    to[i]--;
  }
  if (to[0] != 0) {
    to[0] = 0;
    ans++;
  }
  REP(i,N) {
    if (i) {
      child[to[i]].PB(i);
    }
  }
  REP(i,N) vst[i] = 0;
  DFS(0,0,0);
  REP(i,N) vst[i] = 0;
  priority_queue<pii> pq;
  REP(i,N) {
    pq.push({dep[i],i});
  }
  while (!pq.empty()) {
    int d = pq.top().F;
    int i = pq.top().S;
    pq.pop();
    if (dep[i] != d) continue;
    if (dep[i] <= K) continue;
    int u = i;
    REP(_,K-1) {
      if (fa[u] == 0) break;
      u = fa[u];
    }
    fa[u] = 0;
    ans++;
    DFS(u,0,1);
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 13176
#include<iostream>
#include<numeric>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<climits>
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define mkp make_pair
#define pll pair<ll,ll>
#define rep(i,from,to) for(int i=from;i<to;i++)
#define repd(i,from,till) for(int i=from;i>=till;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define mod 1e9+7
#define inf1 1e18+1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;
/*
ll bin(ll i,ll j){
	ll mid=(i+j)/2;
	if(a[mid]==x)reutrn mid;
	else if(ans>x)return bin(i,mid-1);
	else return bin(mid+1,j);
}/*
ll power(ll base,ll power){
    ll res=1;
    base=base%mod;
    while(power>0){
    	if(power&1){
    		res=(res*base)%mod;
		}
		power=power>>1;
		base=(base*base)%mod;
	}
	return res;
}
*/
/*
int nCr(int x, int y){
	if(y>x)return 0;
	int num=fact[x];
	num*=invfact[y];
	num%=mod;
	num*=invfact[x-y];
	num%=mod;
	return num;
}
*/
/*bool prime[n+1];
void SieveOfEratosthenes(int n){
	rep(i,0,n+1)prime[i]=true
    for (int p=2;p*p<=n;p++)
        if (prime[p])
            for (int i=p*p;i<=n;i+=p)prime[i]=false;
}*/
/*
int gcd(int a,int b){
	if(b==0)return a;
	else return gcd(b,a%b);
}
*/
int solve(){
    ll n;
    cin>>n;
	vector<string> a(10);
	a[2]=a[4]=a[5]=a[7]=a[9]="hon";
	a[0]=a[1]=a[6]=a[8]="pon";
	a[3]="bon";
	cout<<a[n%10]<<endl;
	return 0;
}
int main(){
    waste;
    int t;
    //cin>>t;
    t=1;
    while(t--){
       	solve();
    }
}


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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

constexpr int INF = 1e9;


int main() {
    string A;
    cin >> A;
    int const n = A.size();
    vector<vector<int>> pos(n + 1, vector<int>(26, INF));
    for(int i = n; i >= 0; --i) {
        if(i - 1 >= 0) {
            pos[i - 1] = pos[i];
            pos[i - 1][A[i - 1] - 'a'] = i;
        }
    }
    vector<bool> visited(n + 1);
    queue<pair<int, string>> que;
    que.push(make_pair(0, ""));
    string res;
    visited[0] = true;
    while(!que.empty()) {
        auto p = que.front();
        int v = p.first;
        que.pop();
        for(int i = 0; i < 26; ++i) {
            if(pos[v][i] == INF) {
                res = p.second + char('a' + i);
                cout << res << endl;
                return 0;
            }
        }
        for(int i = 0; i < 26; ++i) {
            int next_p = pos[v][i];
            if(visited[next_p]) {
                continue;
            }
            que.push(make_pair(next_p, p.second + char('a' + i)));
            visited[next_p] = true;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 27888
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
	int N;
	cin>>N;
	int tab[N];
	int enlevable[N];
	int tot = 0;
	int total[N];
	for (int i = 0 ; i < N ; i++)
	{
		cin>>tab[i];
		tot += tab[i];
		if (i == 0)
		{
			enlevable[i] = tab[i] - 1;
			total[i] = tab[i];
		}
		else
		{
			enlevable[i] = enlevable[i -1] + tab[i] -1;
			total[i] = total[i - 1] + tab[i];
		}
	}
	int leMin = 1e18;
	for (int iC = 1 ; iC < N  ; iC++)
	{
		int totGauche = total[iC-1];
		int totDroite = total[N - 1] - total[iC - 1];
		leMin = min(leMin , abs(totDroite - totGauche));
	}
	cout<<leMin<<endl;

}

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

int main() {
	char x[1000] = {0};
	int num;
	int sum = 0;
	int i;

	while (1) {
		scanf("%s", x);

		if (x[0] == '0') {
			break;
		}

		sum = 0;
		for (i = 0; x[i] != '\0' ;i++) {
			num = x[i] - '0';
			sum += num;
		}

		printf("%d\n", sum);
	}

	return 0;
}


Measured memory_bytes: 2048
N=int(input())
A = list( map(int,input().split()))
C0 = [ [0,i] for i in range(100005) ]
C1 = [ [0,i] for i in range(100005) ]
for i in range(0,N,2):
    C0[A[i]][0] += 1
    C1[A[i+1]][0] += 1
C0.sort(reverse=True)
C1.sort(reverse=True)
if C0[0][1] == C1[0][1]:
    ans = N - max(C0[0][0]+C1[1][0], C0[1][0]+C1[0][0])
else:
    ans = N - C0[0][0] - C1[0][0]
print(ans)


Measured memory_bytes: 34232
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>

#define _USE_MATH_DEFINENS
#include <cmath>

#define ip "%d"
#define op "%d\n"

using namespace std;

#define p(x) cout << x << endl;
#define el cout << endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

    int a , b, c;
    cin >> a >> b >> c;
    
    int ans = max(10 * a + b + c, a + 10 * b + c);
    int ans2 = max(ans, a + b + 10 * c);

    cout << ans2 << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		
		Map<Character, Integer> ansMap = new HashMap<>(30,1);
		for (int i = 'a'; i <= 'z'; i++) {
			ansMap.put((char)i, Integer.MAX_VALUE);
		}
		
		
		for (int i = 0; i < N; i++) {
			Map<Character, Integer> map = new HashMap<>(30,1);
			String s = sc.next();
			for (char c: s.toCharArray()) {
				if (!map.containsKey(c)) {
					map.put(c, 1);
				} else {
					map.put(c, map.get(c) + 1);
				}
			}
			
			for (int j = 'a'; j <= 'z'; j++) {
				Integer count = map.get((char)j);
				int intCount = 0;
				if (count != null && count != Integer.MAX_VALUE) {
					intCount = count;
				}
				int min = ansMap.get((char)j);
				min = Math.min(min, intCount);
				ansMap.put((char)j, min);
			}
		}
		
		String ans = "";
		
		for (int i = 'a'; i <= 'z'; i++) {
			int count = ansMap.get((char)i);
			for (int j = 0; j < count; j++) {
				ans += (char)i;
			}
		}
		
		System.out.println(ans);
		
	}
}


Measured memory_bytes: 23252
# coding: utf-8

N = int(input())
keys = [_ + 1 for _ in range(N)]
values = list(map(int,input().split()))
dct = dict(zip(keys, values))
prt = []
for k, v in sorted(dct.items(), key=lambda x: x[1]):
    prt.append(str(k))

for i in range(len(prt)):
    if i != len(prt) - 1:
        print(int(prt[i]), end = " ")
    else:
        print(int(prt[i]))

Measured memory_bytes: 32512
#include<iostream>
#include<queue>
using namespace std;
static const int INF=(1<<21);
int n,M[101][101];
int d[101];
void bfs(int s){
  queue<int>q;
  q.push(s);
  for(int i=0;i<n;++i) d[i]=INF;
  d[s]=0;
  while(!q.empty()){
    int u=q.front();
    q.pop();
    for(int v=0;v<n;++v){
      if(M[u][v]==0) continue;
      if(d[v]!=INF) continue;
      d[v]=d[u]+1;
      q.push(v);
    }
  }
  for(int i=0;i<n;++i){
    cout<<i+1<<" "<<( (d[i]==INF)?(-1):d[i] )<<endl;
  }
}
int main(){
  int u,v,k;
  cin>>n;
   for(int i=0;i<n;++i){
    cin>>u>>k;
    u--; //頂点番号をあわせてる
    for(int j=0;j<k;++j){
      cin>>v;
      v--;
      M[u][v]=1;
    }
   }
   bfs(0);
   return 0;
}



Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
int a, b;
int main(){
  cin >> a >> b;
  int count = 0;
  for(int i = a; i <= b; ++i){
    int s = i % 10;
    int t = (i / 10000) % 10;
    int u = (i / 10) % 10;
    int v = (i / 1000) % 10;
    if(s == t && u == v) count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

    int N;
    cin >> N;
    vector<int> X(N);
    int maxX = 0;
    for (auto &x : X) {
        cin >> x;
        maxX = max(maxX, x);
    }
    int ans = INT_MAX;
    for (int p = 1; p <= maxX; ++p) {
        int res = 0;
        for (auto &x : X) {
            res += (p - x) * (p - x);
        }
        ans = min(ans, res);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
def turn_check(inlist,p,q,x):
    s = q*x
    t = p-q
    return sum([ (max(i-s,0)+t-1)//t for i in inlist ]) <= x

n, a, b = [ int(v) for v in input().split() ]
h_list = [ int(input()) for i in range(n) ]
ok, ng = 10**9, 0
while ok-ng > 1:
    mid = (ok+ng)//2
    if turn_check(h_list,a,b,mid):
        ok = mid
    else:
        ng = mid
print(ok)


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

#define ft first
#define sd second

using namespace std;








int n;
map<int, int> mp;
int ans;

int main() {
	cin >> n;
	{
		int a;
		for (int i = 0; i < n; i++) {
			cin >> a;
			mp[a]++;
		}
	}
	for (auto i : mp) {
		if (i.sd < i.ft)
			ans += i.sd;
		else
			ans += i.sd - i.ft;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s,t; cin >> s >> t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    reverse(t.begin(),t.end());
    int ans = t.compare(s);
    if(ans>0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize("inline")
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#define mp make_pair
#define pb push_back
using namespace std;

typedef long long li;
template<class T>inline void read(T &x) {
  x = 0;
  T tmp = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') tmp = -1, c = getchar();
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + c - '0', c = getchar();
  x *= tmp;
}
template<class T>inline void Max(T &x, T y) {
  if (y > x) x = y;
}
template<class T>inline void Min(T &x, T y) {
  if (y < x) x = y;
}

const int N = 600;
int n, d1, d2, a[N][N], b[N][N];

const int dx[] = {1, 1, -1, -1};
const int dy[] = {1, -1, 1, -1};
inline bool out(int x, int y) {
  return x < 0 || y < 0 || x >= (n << 1) || y >= (n << 1);
}

vector<pair<int, int> > g, h;

struct node {
  int x, y, ty;
  node() {}
  node(int _x, int _y, int _ty) : x(_x), y(_y), ty(_ty) {}
};
queue<node> q;
void Fill_a(int Ax, int Ay) {
  q.push(node(Ax, Ay, 0));
  while (!q.empty()) {
    int x = q.front().x, y = q.front().y;
    int cur = q.front().ty;
    q.pop();
    if (a[x][y] != -1) continue;
    a[x][y] = cur;
    for (int i = 0; i < (int)g.size(); ++i) {
      int nowx = x + g[i].first, nowy = y + g[i].second;
      if (out(nowx, nowy) || a[nowx][nowy] != -1) continue;
      q.push(node(nowx, nowy, cur ^ 1));
    }
  }
}
void Fill_b(int Ax, int Ay) {
  q.push(node(Ax, Ay, 0));
  while (!q.empty()) {
    int x = q.front().x, y = q.front().y;
    int cur = q.front().ty;
    q.pop();
    if (b[x][y] != -1) continue;
    b[x][y] = cur;
    for (int i = 0; i < (int)h.size(); ++i) {
      int nowx = x + h[i].first, nowy = y + h[i].second;
      if (out(nowx, nowy) || b[nowx][nowy] != -1) continue;
      q.push(node(nowx, nowy, cur ^ 1));
    }
  }
}

int main(void) {
  read(n), read(d1), read(d2);
  for (int i = 0; i < 450; ++i)
    for (int j = 0; j < 450; ++j) {
      int now = i * i + j * j;
      if (now == d1) {
	for (int t = 0; t < 4; ++t)
	  g.pb(mp(i * dx[t], j * dy[t]));
      }
      if (now == d2) {
	for (int t = 0; t < 4; ++t)
	  h.pb(mp(i * dx[t], j * dy[t]));
      }
    }
  for (int i = 0; i < (n << 1); ++i)
    for (int j = 0; j < (n << 1); ++j)
      a[i][j] = b[i][j] = -1;
  for (int i = 0; i < (n << 1); ++i)
    for (int j = 0; j < (n << 1); ++j)
      if (a[i][j] == -1) Fill_a(i, j);
  for (int i = 0; i < (n << 1); ++i)
    for (int j = 0; j < (n << 1); ++j)
      if (b[i][j] == -1) Fill_b(i, j);
  
  for (int x = 0; x < 2; ++x)
    for (int y = 0; y < 2; ++y) {
      int cnt = 0;
      for (int i = 0; i < (n << 1); ++i)
	for (int j = 0; j < (n << 1); ++j)
	  cnt += (a[i][j] == x && b[i][j] == y);
      if (cnt >= n * n) {
	int m = n * n;
	for (int i = 0; i < (n << 1) && m; ++i)
	  for (int j = 0; j < (n << 1) && m; ++j)
	    if (a[i][j] == x && b[i][j] == y)
	      printf("%d %d\n", i, j), --m;
	return 0;
      }
    }
}


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

int main(){
    int k,n;
    cin >> k >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    a.push_back(a[0]+k);
    int mx = 0;
    rep(i,n){
        mx = max(mx,a[i+1]-a[i]);
    }
    int ans = k - mx;
    cout << ans << endl;
    return 0;
}

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

string s;

int main() 
{
    cin>>s; bool b = false; 
    for( int i = 0; i < s.length()-1; i ++ ) 
        if( s[i] == 'A' && s[i+1] == 'C' ) b = true;

    puts( b ? "Yes" : "No" ); 

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  while(true){
    cin>>a>>b;
    if(a+b==0) return 0;
    if(a<b)cout<<a<<" "<<b<<endl;
    else cout<<b<<" "<<a<<endl;
  }
}


Measured memory_bytes: 3068
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,t;
    cin>>n>>x>>t;
    if(n%x==0)
    {
        cout<<t*(n/x);
    }
    else
    {
        cout<<t*((n/x)+1);
    }
    
}

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

bool isStable(char b[], char f[], int n)
{
		for ( int i = 0; i < n; i++)
	{
		if ( b[i] != f[i] )
			{
				return false;
			}
	}
	return true;
}
int main()
{	
	int n;
	int a[36] = {0};
	char b[36] = {0};
	int e[36] = {0};
	char f[36] = {0};
	cin >> n;
	for ( int i = 0; i < n; i++)
	{ 
		cin >> b[i] >> a[i];
	}
	
	for ( int i = 0; i < n; i++)
	{ 
		e[i] = a[i];
		f[i] = b[i];
	}

	int temp = 0;
	int sum = 0;

	for (int i= 0; i < n-1; i++ )
	{
		for ( int j = 0; j < n-1-i; j++ )
		{
			if ( a[j] > a[j+1] )
			{
				temp = a[j];
				a[j] = a[j+1];
				a[j+1] = temp;
				temp = b[j];
				b[j] = b[j+1];
				b[j+1] = temp;
				sum++;
			}
		}
	}
	for ( int i= 0; i < n; i++ )
	{
	cout << b[i] << a[i];
	if ( i < n-1 )
	{
		cout << " ";
	}
	}
	cout << "\n";

    cout << "Stable" << "\n";

	int su = 0;
	int tem = 0;

	for (int i= 0; i < n-1; i++ )
	{
		int mini = i;
		for ( int j = i+1; j < n; j++ )
		{
			if ( e[j] < e[mini] )
			{
				mini = j;
			}
		}
		if ( mini != i)
		{
				tem = e[i];
				e[i] = e[mini];
				e[mini] = tem;
				tem = f[i];
				f[i] = f[mini];
				f[mini] = tem;
				su++;
		}
		}

	for ( int i= 0; i < n; i++ )
	{
	cout << f[i] << e[i];
	if ( i < n-1 )
	{
		cout << " ";
	}
	}
	cout << "\n";

	if ( isStable(b, f, n) )
		{
		     cout << "Stable" << "\n";
	    }
	else
		{
			cout << "Not" << " " << "stable" << "\n";
		}

	return 0;
}


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

using namespace std;

int main(){
    int n,m;
    int left=0,right=100000;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        if(a>=left){
            left=a;
        }else{
         
        }
        if(b<=right){
            right=b;
        }else{
        }
    }
    if(right>=left){
        cout<<(right-left+1)<<"\n";
    }else{
         cout<<0<<"\n";
    }
    return 0;
}



Measured memory_bytes: 256
N,K=map(int, input().split())
S=list(input())


if S[K-1]=="A":
  S[K-1]="a"
elif S[K-1]=="B":
  S[K-1]="b"
elif S[K-1]=="C":
  S[K-1]="c"
  
  
moji="".join(S)
print(moji)
  

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <functional>
#include <set>
#define DB cerr<<"D"<<endl
#define pb push_back
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";}
using P=pair<double,int>;
const ll M = 1e9+7;
void add(ll& x, ll y) {x+=y; x%=M;}
void chmax(ll& x, ll y) {if (x<y) x=y;}

int main() {
  int n; cin>>n;
  string s; cin>>s;
  int r=0,b=0;
  for(int i=0;i<n;i++) {
    if (s[i]=='R') r++; else b++;
  }
  if (r>b) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

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

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }


int main() {

    int N, cnt = 1;
    string S;
    cin >> N >> S;
    forn(i, N-1) {
        if (S[i] != S[i+1]) {
            cnt++;
        }
    }
    cout << cnt << endl;
}

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

const ll INF = 1001001001001;
const int MX = 100005;

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i,n) cin >> h[i];
  vector<ll> dp(MX,INF);
  dp[0] = 0;
  rep(i,n) {
    for(int j=1; j<=k; ++j) {
      dp[i+j] = min(dp[i+j], dp[i] + abs(h[i]-h[i+j]));
    }
  }
  cout << dp[n-1] << endl;
  return 0;
}

Measured memory_bytes: 4556
//#define _GLIBCXX_DEBUG

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n;
    string s;
    cin >> s;
    rep(i,3)if(s[i] == s[i+1]){
        cout << "Bad" << endl;
        return 0;
    }
    cout << "Good" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int A[1000000], n;

int binarySearch(int key){
    int left = 0;
    int right = n;
    int mid;
    while ( left < right ) {
        mid = (left + right ) / 2;
        if ( key == A[mid] ) return 1;
        if ( key > A[mid] ) left = mid + 1;
        else if ( key < A[mid] ) right = mid;
    }
    return 0;
}

int main() {
    int i, q, k, sum = 0;
    
    scanf("%d", &n);
    for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
    
    scanf("%d", &q);
    for ( i = 0; i < q; i++) {
        scanf("%d", &k);
        if ( binarySearch( k ) ) sum++;
    }
    printf("%d\n", sum);
    
    return 0;
}


Measured memory_bytes: 2968
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>

using ll = long long;
using namespace std;

void dfs(int cur, vector<vector<int>> &to, vector<bool> &check, vector<bool> &checking, bool &flag) {
    if (flag) {
        return;
    }
    if (checking.at(cur)) {
        flag = true;
        return;
    }
    if (check.at(cur)) {
        return;
    }
    checking.at(cur) = true;
    check.at(cur) = true;
    for (int a : to.at(cur)) {
        dfs(a, to, check, checking, flag);
    }
    checking.at(cur) = false;
    return;
}

int main () {
    int n = 0;
    cin >> n;
    vector<vector<int>> to(n*n), from(n*n);
    vector<int> froming(n*n);
    int pre = 0, now = 0;
    int sma1 = 0, lar1 = 0, sma2 = 0, lar2 = 0;;
    for (int i=0; i<n; i++) {
        for (int j=0; j<n-1; j++) {
            cin >> now;
            now--;
            if (j > 0) {
                sma1 = min(i, pre), sma2 = min(i, now), lar1 = max(i, pre), lar2 = max(i, now);
                to.at(sma1*n+lar1).push_back(sma2*n+lar2);
                from.at(sma2*n+lar2).push_back(sma1*n+lar1);
            }
            pre = now;
        }
    }
    vector<bool> check(n*n, false);
    vector<bool> checking(n*n, false);
    bool flag = false;
    for (int i=0; i<n*n; i++) {
        if (from.at(i).empty() && to.at(i).empty()) {
            continue;
        }
        if (check.at(i)) {
            continue;
        }
        dfs(i, to, check, checking, flag);
        if (flag) {
            cout << -1 << endl;
            return 0;
        }
    }
    vector<int> cnt(n*n);
    queue<int> que;
    for (int i=0; i<n*n; i++) {
        if (from.at(i).empty()) {
            cnt.at(i) = 1;
            que.push(i);
        }
    }
    while (!que.empty()) {
        int cur = que.front();
        que.pop();
        for (int a : to.at(cur)) {
            froming.at(a)++;
            if (from.at(a).size() == froming.at(a))  {
                cnt.at(a) = cnt.at(cur) + 1;
                que.push(a);
            }
        }
    }
    int ans = 0;
    for (int a : cnt) {
        ans = max(ans, a);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 88576
//
//  main.cpp
//  ITP1_11-A
//
//  Created by ?????¶??? on 15/8/15.
//  Copyright (c) 2015??´ ?????¶???. All rights reserved.
//

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

using namespace std;

struct Dice{
    
    //  {?????????????????????????????????}
    vector<int> positions;
    
    enum MOVE{
      
        E = 0,
        S,
        W,
        N
    };
    
    void Move_E(){ //???
        
        int temp1 = positions[0];
        int temp2 = positions[5];
        
        positions[0] = positions[3];
        positions[5] = positions[2];

        positions[3] = temp2;
        positions[2] = temp1;

    }
    
    void Move_N(){ //???
        
        int temp1 = positions[0];
        int temp2 = positions[5];
        
        positions[0] = positions[1];
        positions[5] = positions[4];
        
        positions[4] = temp1;
        positions[1] = temp2;

    }
    
    void Move_S(){ //???
        
        int temp1 = positions[0];
        int temp2 = positions[5];
        
        positions[0] = positions[4];
        positions[5] = positions[1];
        
        positions[4] = temp2;
        positions[1] = temp1;


    }
    
    void Move_W(){ //???
        
        int temp1 = positions[0];
        int temp2 = positions[5];
        
        positions[0] = positions[2];
        positions[5] = positions[3];
        
        positions[3] = temp1;
        positions[2] = temp2;

    }
};

int main() {

    Dice dice;
    int temp;
    
    for (int i = 0; i < 6; i ++) {
        
        cin >> temp;
        
        dice.positions.push_back(temp);
        
    }
    
//    printf("Debug Origin %d %d %d %d %d %d\n", dice.positions[0], dice.positions[1], dice.positions[2], dice.positions[3], dice.positions[4], dice.positions[5]);

    
    string moveStr;
    cin >> moveStr;
    
    for (int i = 0; i < moveStr.length(); i++) {
        
        if (moveStr[i] == 'E') {
        
            dice.Move_E();
        }else if (moveStr[i] == 'N'){
            
            dice.Move_N();
        }else if (moveStr[i] == 'S'){
            
            dice.Move_S();
        }else if (moveStr[i] == 'W'){
            
            dice.Move_W();
        }
        
//        printf("Debug %d %d %d %d %d %d\n", dice.positions[0], dice.positions[1], dice.positions[2], dice.positions[3], dice.positions[4], dice.positions[5]);
        
    }
    
    cout << dice.positions[0] << endl;
    
    return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
#define meow(args...) fprintf(stderr, args)
typedef unsigned u32;
typedef long long s64;
typedef unsigned long long u64;
template<class T1, class T2> inline bool cmin(T1 &a, const T2 &b) {return b<a?(a=b, true):false;}
template<class T1, class T2> inline bool cmax(T1 &a, const T2 &b) {return a<b?(a=b, true):false;}
template<class Type> Type read() {
	Type a;
	bool b;
	unsigned char c;
	while(c=getchar()-48, (c>9)&(c!=253));
	for(a=(b=c==253)?0:c; (c=getchar()-48)<=9; a=a*10+c);
	return b?-a:a;
}
int (*rd)()=read<int>;
const u32 P=1e9+7;
u32 &inc(u32 &a, u32 b) {return (a+=b)<P?a:(a-=P);}
u32 &dec(u32 &a, u32 b) {return (a-=b)&0x80000000?(a+=P):a;}
u32 sum(u32 a, u32 b) {return inc(a, b);}
u32 dif(u32 a, u32 b) {return dec(a, b);}
u64 power(u64 a, int b) {
	u64 ans=1;
	for(; b; a=a*a%P, b/=2) if(b&1) ans=ans*a%P;
	return ans;
}

const int N=5005;
int n, size[N];
u32 tot[N], f[N][N];
std::vector<int> e[N];
void dfs(int u, int pa) {
	static u32 g[N];
	auto F=f[u];
	F[1]=1;
	size[u]=1;
	for(int v: e[u]) if(v!=pa) {
		dfs(v, u);
		auto G=f[v];
		for(int i=1; i<=size[u]; ++i)
			for(int j=0; j<=size[v]; ++j)
				g[i+j]=(g[i+j]+(u64)F[i]*G[j])%P;
		size[u]+=size[v];
		memcpy(F+1, g+1, size[u]*sizeof(u32));
		memset(g+1, 0, size[u]*sizeof(u32));
	}
	for(int i=2; i<=size[u]; i+=2) F[0]=(F[0]+(u64)(P-F[i])*tot[i])%P;
}
int main() {
	n=rd();
	tot[2]=1;
	for(int i=4; i<=n; i+=2) tot[i]=tot[i-2]*(i-1llu)%P;
	for(int i=1; i<n; ++i) {
		int u=rd(), v=rd();
		e[u].push_back(v);
		e[v].push_back(u);
	}
	dfs(1, 0);
	printf("%u\n", dif(0, f[1][0]));
	return 0;
}


Measured memory_bytes: 97536
#include "bits/stdc++.h"
using namespace std;
int main() {
  cin.tie(0); ios_base::sync_with_stdio(false);
  int N, L; cin >> N >> L;
  vector<string> S(N); for (auto& s : S) cin >> s;
  sort(S.begin(), S.end());
  for (auto& s : S) cout << s;
  cout << '\n';
  return 0;
}


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

int main() {
    double n;
    cin >> n;
    int c;
    c = n;
    int x;
    x = (n * 100)/ 108;
    bool exist;
    exist = false;
    x = x - 10;
    for (;x * 1.08 <= c + 1;x++) {
        int y;
        y = x * 1.08;
        if (y == c) {
            exist = true;
            cout << x << endl;
            break;
        }
    }
    if (!exist) {
        cout << ":("<< endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if(a == b) {
    cout << c;
  } else if(b == c) {
    cout << a;
  } else {
    cout << b;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
"use strict";
function I(s,f){this._s=s.split("\n");this._c=0;this._l=0;this._f=f||Number}I.prototype.a=function(){var l=this._s[this._l];if(!l)return;var t=l.trim().split(" ");var a=t[this._c];this._c++;if(t.length===this._c){this._c=0;this._l++}return this._f(a)};I.prototype.l=function(){var l=this._s[this._l];if(!l)return;this._c=0;this._l++;return l.split(" ").map(this._f)};
function buildArray(r,t){let l=t||0;for(let t=r.length;t>0;t--){const n=r[t-1];l=Array(n).fill().map(()=>JSON.parse(JSON.stringify(l)))}return l}

const mod = 1e9 + 7;
function abmod(){for(var a=arguments,r=a[0],i=1;i<a.length;)r=((r>>16)*a[i]%mod*65536+(r&65535)*a[i++])%mod;return r;}

function main(input) {
  const o = new I(input);

  const n = o.a();
  const x = o.a();
  
  const s = o.l();

  s.sort((a,b) => b - a);

  var dp = Array(x+1).fill(0);
  dp[x] = 1;
  for (var i = 0; i < n; i++){
    var dp2 = Array(x+1).fill(0);
    for(var j = 0; j <= x; j++){
      dp2[j] += dp[j] * (n-i-1);
      dp2[j] %= mod;
      var m = j % s[i];
      dp2[m] += dp[j];
      dp2[m] %= mod;
    }
    dp = dp2;
  }
  var ans = 0;
  for(i = 0; i < s[n-1]; i++){
    ans += abmod(i,dp[i]);
  }

  console.log(ans % mod);
}


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


Measured memory_bytes: 42004