akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-

class Array
    def sum
        inject(0){|sum,i| sum+i}
    end

    def last
        return nil if self[0].nil?
        self[size-1]
    end
end

# 紙の枚数の制約
def check(state,value)
    if state.sum+value > $n
        return false
    else
        return true
    end
end

def backtrack(n,result)
    if result.sum == $n
        puts result.join(" ")
        return
    end
    n.times.map{|i| i+1}.reverse.each do |i|
        if !result[0].nil? && result.last<i 
            next
        end
        if check(result,i)
            result << i
            backtrack(n-1,result)
            result.pop
        end
    end
end

while(true)
    $n = gets().to_i
    break if $n==0
    backtrack($n,[])
end

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

using namespace std;

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

    if (s.size() == 2) {
      cout << s << endl;
      return 0;
    }

    for (auto i = s.rbegin(), e = s.rend(); i != e; ++i) {
      cout << *i;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
x1,y1,x2,y2=map(int,input().split())
dx=x2-x1
dy=y2-y1
x3=x2-dy
y3=y2+dx
x4=x3-dx
y4=y3-dy
ans=[x3,y3,x4,y4]
print(' '.join(map(str, ans)))

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

using namespace std;

const int MAXN = 200005;

int n, a[MAXN];
vector<int> dim;

int main() {
    scanf("%d", &n);
    for(int i = 0; i < n; ++i)
        scanf("%d", &a[i]);
    sort(a, a+n);

    for(int i = 0; i < n-1; ++i) {
        if (a[i] == a[i+1]) {
            dim.push_back(a[i]);
            ++i;
        }
    }

    if (dim.size() < 2)
        puts("0");
    else {
        reverse(dim.begin(), dim.end());
        int len = dim[0], width = dim[1];
        printf("%lld", 1LL*len*width);
    }

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
const int N = 1e6 + 10, OO = 0x3f3f3f3f, mod = 1e9 + 7;

#define PI acos(-1)
#define clr(arr, val) memset(arr, val, sizeof(arr))
#define loop(i, n) for (int i = 0; i < int(n); i++)
#define rloop(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define xloop(i, a, b) for (int i = int(a); i <= int(b); i++)
#define ALL(v) ((v).begin()), ((v).end())
#define SZ(v) ((int)((v).size()))
int dx[] = {1, 0, -1, 0}; // {down , right , up , left}
int dy[] = {0, 1, 0, -1}; //4 Direction
//int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
//int dy[] = {0, 1, 1, 1, 0, -1, -1, -1}; //8 direction
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2};
//int dy[] = {1, 2, 2, 1, -1, -2, -2, -1}; //Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

//-- "كلٌّ من يسعى لابد يصل .. كلٌّ من يسعى مضمون له الوصول" --//

int n, total;

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

  scanf("%d %d", &n, &total);
  for (int x = 0; x <= 2000; ++x)
  {
    for (int y = 0; y <= 2000; ++y)
    {
      int rem = total - ((x * 10000) + (y * 5000));
      if (rem >= 0 && rem % 1000 == 0)
      {
        int z = rem / 1000;
        if (x + y + z == n)
          return printf("%d %d %d\n", x, y, z), 0;
      }
    }
  }
  puts("-1 -1 -1");

  return 0;
}


Measured memory_bytes: 3796
#include <atcoder/maxflow>
#include <iostream>

using namespace std;
using namespace atcoder;

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

    vector<string> grid(n);
    for (int i = 0; i < n; i++) {
        cin >> grid[i];
    }

    /**
     * generate (s -> even grid -> odd grid -> t) graph
     * grid(i, j) correspond to vertex (i * m + j)
     **/
    mf_graph<int> g(n * m + 2);
    int s = n * m, t = n * m + 1;

    // s -> even / odd -> t
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (grid[i][j] == '#') continue;
            int v = i * m + j;
            if ((i + j) % 2 == 0) {
                g.add_edge(s, v, 1);
            } else {
                g.add_edge(v, t, 1);
            }
        }
    }

    // even -> odd
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if ((i + j) % 2 || grid[i][j] == '#') continue;
            int v0 = i * m + j;
            if (i && grid[i - 1][j] == '.') {
                int v1 = (i - 1) * m + j;
                g.add_edge(v0, v1, 1);
            }
            if (j && grid[i][j - 1] == '.') {
                int v1 = i * m + (j - 1);
                g.add_edge(v0, v1, 1);
            }
            if (i + 1 < n && grid[i + 1][j] == '.') {
                int v1 = (i + 1) * m + j;
                g.add_edge(v0, v1, 1);
            }
            if (j + 1 < m && grid[i][j + 1] == '.') {
                int v1 = i * m + (j + 1);
                g.add_edge(v0, v1, 1);
            }
        }
    }

    cout << g.flow(s, t) << endl;

    auto edges = g.edges();
    for (auto e : edges) {
        if (e.from == s || e.to == t || e.flow == 0) continue;
        int i0 = e.from / m, j0 = e.from % m;
        int i1 = e.to / m, j1 = e.to % m;

        if (i0 == i1 + 1) {
            grid[i1][j1] = 'v';
            grid[i0][j0] = '^';
        } else if (j0 == j1 + 1) {
            grid[i1][j1] = '>'; grid[i0][j0] = '<';
        } else if (i0 == i1 - 1) {
            grid[i0][j0] = 'v';
            grid[i1][j1] = '^';
        } else {
            grid[i0][j0] = '>'; grid[i1][j1] = '<';
        }
    }

    for (int i = 0; i < n; i++) {
        cout << grid[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 5636
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
using namespace std;

/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;


int main() {
    int n,m;
    cin>>n>>m;
    vector<vector<int>>s;
    for(int i=0;i<m;i++){
        int k;
        cin>>k;
        vector<int>a(k);
        for(int j=0;j<k;j++){
            cin>>a.at(j);
        }
        s.push_back(a);
    }
    vector<int>p(m);
    for(int i=0;i<m;i++){
        cin>>p.at(i);
    }

    int ans=0;
    for(int bit=0;bit<(1<<n);bit++){ // どのスイッチがonなのかで全探索
        vector<int>vec; // どのスイッチがonなのかを持っているvector。
        bool flag=true;
        for(int i=0;i<n;i++){
            if(bit&(1<<i)){
                vec.push_back(i+1);
            }
        }
        for(int i=0;i<m;i++){
            int cnt=0;
            for(int j=0;j<s[i].size();j++){
                for(int k=0;k<vec.size();k++){
                    if(s[i][j]==vec[k])cnt++;
                }
            }
            if(cnt%2!=p[i]){
                flag=false;
                break;
            }
        }
        if(flag)ans++;
    }

    cout<<ans<<endl;





    return 0;
}


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

int main(void) {
  int cnt=0,N;
  cin>>N;
  vector<int> p(N);

  for(int i=0;i<N;i++){
    cin>>p.at(i);
  }

  for(int i=0;i<N;i++){
    if(p.at(i)!=(i+1)){
      cnt++;
    }
  }
  if(cnt<3){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
 
 
int main() {
    
    string S;
    cin >> S;
    
    int ans = 0;
    int n = S.size();
    for (int i = 0; i < n; i++) {
        int tmp;
        if (S[i] == '1') tmp = 9;
        else             tmp = 1;
        ans += tmp*pow(10,n-1-i);
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int A,B;
int X[5000];
int Y[5000];
int ans=0;
int C;
int D;
int main()
{
	scanf("%d%d",&A,&B);
	for(int i=0;i<A;i++)scanf("%d",&X[i]);
	for(int i=0;i<B;i++)scanf("%d",&Y[i]);
	for(int i=0;i<B;i++){
		C=0;
		D=i;
		for(int j=0;j<A;j++){
			if(X[j]==Y[D]){
				C++;
				D++;
				if(D==B)goto a;
			}
		}
		a:;
		ans=max(ans,C);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1224
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif

#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <vector>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> II;
typedef pair<LL, II> III;
typedef priority_queue<III, vector<III>, greater<>> Queue;
static const LL INF = 1LL << 60;

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

#if 0
	auto possible = [&](LL t) {

		return false;
	};
	LL left = 1, right = 1000000000;
	while (right - left > 1) {
		LL mid = (left + right) / 2;
		if (possible(mid)) {
			left = mid;
		} else {
			right = mid;
		}
	}
#endif

void solve(std::string S) {
	string ans = S;
	if (S.back() == 's') {
		ans += "es";
	} else {
		ans += "s";
	}
	cout << ans << endl;
}

int main() {
    std::string S;
	std::cin >> S;
	solve(S);
	return 0;
}


Measured memory_bytes: 3628
import fractions
N,M = list(map(int,input().split()))
a = list(map(int,input().split()))

def func(a):
	if a%2 == 0:
		return func(a//2)+1
	else:
		return 0



n = 0
for i in range(1,N):
	if func(a[i]) != func(a[i-1]):
		print(0)
		exit()

for i in range(N):
	a[i] = a[i]//2

semi_lcm = a[0]
for i in range(1,N):
	semi_lcm = semi_lcm*a[i]//fractions.gcd(semi_lcm,a[i])

m = M//semi_lcm
if m == 0:
	print(0)
else:
	if m%2 == 1:
		print((m+1)//2)
	else:
		print(m//2)


Measured memory_bytes: 16320
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(usize);
    let mut v = get!([usize]);
    v.sort();

    let mut res = v[0] as f64;
    for i in 1..n {
        res += v[i] as f64;
        res /= 2.0
    }
    println!("{}", res);
}


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

#define rep(i,k,n) for(int (i)=(k);(i)<(n);(i)++)
#define max(a,b) (a)>(b)?(a):(b)
#define min(a,b) (a)<(b)?(a):(b)
#define abs(a,b) (a)< 0 ?(a):-(a)
#define llong long long

int main(){
	llong X; scanf("%lld",&X);
	llong money=100;
	int year=0;
	while( money<X ){
		money = money + money/100;
		year++;
	}
	printf("%d",year);
	return 0;
}


Measured memory_bytes: 1732
#include<iostream>
#include<cstdlib>
#include<math.h>
using namespace std;

int main(){
	int n, z, w, a[2010];
	cin >> n >> z >> w;
	for(int i=1;i<=n;i++) cin >> a[i];
	if(n==1) {
		cout << llabs(a[n]-w);
	}
	else{
		cout << max(llabs(a[n]- a[n-1]), llabs(a[n] - w));
	}
	return 0; 
}

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

using namespace std;
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.12lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define mod 1000 * 1000 * 1000 + 7
#define pi 3.1415926536
#define ex 1e18
#define dbl 2e09
#define qu(q) queue<int> q
#define pqu(q) priority_queue<int> q
#define len(s) s.length()
#define sz(x) int(x.size())
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

int main()
{
    string s;
    cin >> s;
    string yr = s.substr(0, 4), mnth = s.substr(5, 2), day = s.substr(8, 2);
    int y = 0, m = 0, d = 0;

    for (int i = 0; i < sz(yr); ++i)
        y = y * 10 + (yr[i] - '0');

    for (int i = 0; i < sz(mnth); ++i)
        m = m * 10 + (mnth[i] - '0');

    for (int i = 0; i < sz(day); ++i)
        d = d * 10 + (day[i] - '0');
    if (y < 2019)
        return cout << "Heisei" << endl, 0;
    if (y == 2019)
    {
        if (m < 4)
            return cout << "Heisei" << endl, 0;
        else if (m == 4 and d <= 30)
            return cout << "Heisei" << endl, 0;
    }

    return cout << "TBD" << endl, 0;

    return 0;
}

Measured memory_bytes: 256
N, A, B, C = map(int, input().split())
lst = [int(input()) for _ in range(N)]
#lst.sort(reverse =True) #大きいものが先に来ている

INF = 10 ** 9

def dfs(count, a, b, c): #count: 今回考える棒の番号, a, (b, c): A, (B,C) の棒を作るのに使う棒の長さの合計
    if count == N: #最後まで各竹をa, b, cに割り振り終わったら…
        if min(a,b,c) <= 0: #A, B, C用の竹が少なくともそれぞれ1本以上必要、それが満たされていないとき
            return INF #とりあえず大きな数を返しとく
        else:
            return abs(a-A)+abs(b-B)+abs(c-C)-30 
        #使う棒の合計の長さ(a, b, c)と目標とする長さ(A, B, C)の差の絶対値-各棒1本目のつなぐのに必要なMP(10 * 3)を除く
    ret0 = dfs(count+1, a, b, c) #count番目の竹を使わない-->countのみ1つ進める
    ret1 = dfs(count+1, a+lst[count], b, c) + 10 #count番目の竹をAに使う。つなぐ文、必要なMPを+10する
    ret2 = dfs(count+1, a, b+lst[count], c) + 10 #count番目の竹をBに使う。つなぐ文、必要なMPを+10する
    ret3 = dfs(count+1, a, b, c+lst[count]) + 10 #count番目の竹をCに使う。つなぐ文、必要なMPを+10する
    return min(ret0, ret1, ret2, ret3)

print (dfs(0,0,0,0))

Measured memory_bytes: 3064
n = int(input())
A = [int(i) for i in input().split()]

def f(A, op, acc = 0, cnt = 0):
    for i in range(n):
        acc += A[i]
        
        if i % 2 == 0 and op * acc <= 0:
            cnt += - op * acc + 1
            acc = op
                
        if i % 2 == 1and op * acc >= 0:
            cnt += op * acc + 1
            acc = -op
                
    if acc == 0:
        cnt += 1
        
    return cnt

print(min(f(A, 1), f(A, -1)))

Measured memory_bytes: 14464
#define _CRT_SECURE_NO_WARNINGS

/* include ***********************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

/* define *************************/
//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)
#define RFOR(i,s,n) for(int i=(int)(n)-1,i##_len=(int)(s);i>=i##_len;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;

int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};
//今回の変数

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int  a, int  b) {
	return (a) > (b) ? (a) : (b);
}
ll Minl(ll a, ll b) {
	return (a)<(b) ? (a) : (b);
}
ll Maxl(ll a, ll b) {
	return (a)>(b) ? (a) : (b);
}

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

	int k[10];
	int s[10][10];
	REP(i, m) {
		scanf("%d", &k[i]);
		REP(j, k[i]) {
			scanf("%d", &s[i][j]);
		}
	}
	
	int p[10];
	REP(i, m)scanf("%d", &p[i]);
	int lp=1;
	REP(i, n)lp *= 2;
	int ans = 0;
	REP(i, lp) {
		int cnt[10] = { 0 };
		REP(j, m) {
			REP(l, k[j]) {
				//PRINTD((i >> (s[j][l] - 1)));
				if ((i >> (s[j][l]-1))%2 == 1)cnt[j]++;
			}
		}
		REP(j, m) {
			//printf("i:%d,j:%d cnt[%d]=%d,p[%d]=%d\n", i, j, j, cnt[j], j, p[j]);
			if (cnt[j] % 2 != p[j])break;
			if (j == m - 1)ans++;
		}
	}
	PRINTD(ans);
}


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint n;cin >> n;
    lint ans=0;
    REP(i,50001){
        if(floor(i*1.08)==n){
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256
A, B, M = map(int, input().split())

Ae = list(map(int, input().split()))
Be = list(map(int, input().split()))

Queries = [list(map(int, input().split())) for _ in range(M)]

# Most cheap pair in normal
ans = min(Ae) + min(Be)

# Check each discount
for q in Queries:
    Ai = q[0] - 1
    Bi = q[1] - 1
    Disc = q[2]
    total = Ae[Ai] + Be[Bi] - Disc
    if total < ans:
        ans = total

print(ans)



Measured memory_bytes: 82028
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
// const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1},
//           dx[] = {0, -1, -1, -1, 0, 1, 1, 1};

struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(10);
  }
} iosetup;
/*-------------------------------------------------*/
int main() {
  int n; cin >> n;
  vector<int> a(n); REP(i, n) cin >> a[i];
  int ans = INF;
  FOR(ebi, -100, 101) {
    int tmp = 0;
    REP(i, n) tmp += abs(a[i] - ebi) * abs(a[i] - ebi);
    ans = min(ans, tmp);
  }
  cout << ans << '\n';
  return 0;
}


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

int max(int a, int b)
{
	return (a > b) ? a : b;
}


int main()
{
	int a, b;
	
	cin >> a >> b;
	
	cout << max(a + b, max(a-b, a * b)) << endl;
	
	return 0;
}


Measured memory_bytes: 256
import Control.Monad
import Control.Applicative

includeI :: Int -> (Int, Int) -> Int
includeI n (x,y) = if x == n || y == n then 1 else 0

main = do
  [n, m] <- map read . words <$> getLine
  numPares <- replicateM m $ do
              [p, q] <- map read . words <$> getLine
              return (p, q)
  forM_ [1..n] $ \i -> putStrLn $ show $ sum $ map (includeI i) numPares



Measured memory_bytes: 892
li1 = list(map(int,input().split()))
cnt=0
n=0
b = list(map(int,input().split()))
for i in range(li1[0]):
    test = list(map(int,input().split()))
    n=0
    for j in range(li1[1]):
        n+=test[j]*b[j]
    if n+li1[2]>0:
        cnt+=1
print(cnt)

Measured memory_bytes: 3064
#include<iostream>
#include<list>
#include<vector>
#include<string>
#include<cmath>

using namespace std;

int main(){
  	char c;
    cin >> c;
  	string ans = "";
    if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
      ans = "vowel";
    }
  	else {
      ans = "consonant";
    }
  
    cout << ans << endl;
}


Measured memory_bytes: 256
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
 
 
a,b,c,d = map(int,input().split())
l = lcm(c,d)
 
def xika(x,v1,v2,vl):
  c1 = x//v1
  c2=x//v2
  c3 = x//vl
  return c1+c2-c3

print((b-a+1)-(xika(b,c,d,l)-xika(a-1,c,d,l)))

Measured memory_bytes: 5372
<?php
fscanf(STDIN, "%d", $n);
$inputs = array_map("intval", explode(" ", trim(fgets(STDIN))));
#$unique = array_unique($inputs, SORT_NUMERIC);
#$diff   = array_diff($inputs, $unique);
#var_dump([$n, $inputs]);
sort($inputs, SORT_NUMERIC);
$ok = 1;
$max = $n - 1;
for ($i = 0; $max > $i; $i++) {
    $x = $inputs[$i];
    $y = $inputs[$i + 1];
    if ($x == $y) {
        $ok = 0;
        break;
    }
}
echo $ok ? "YES" : "NO";

Measured memory_bytes: 31220
#include <bits/stdc++.h>
using namespace std;
int read();

int n, root;
int a[200005], up[200005];
vector<int> e[200005];
void add(int f, int t) { e[f].push_back(t), e[t].push_back(f); }
void dfs(int u, int fa) {
    if (e[u].size() == 1) return up[u] = a[u], void();
    int mx = 0, sum = 0;
    for (int i = 0, v; i < e[u].size(); ++i)
        if ((v = e[u][i]) != fa) dfs(v, u), sum += up[v], mx = max(mx, up[v]);
    up[u] = 2 * a[u] - sum;
    if (up[u] < 0 || up[u] > a[u] || a[u] < mx) puts("NO"), exit(0);
}

int main() {
    n = read();
    for (int i = 1; i <= n; ++i) a[i] = read();
    if (n == 2) return puts(a[1] == a[2] ? "YES" : "NO"), 0;
    for (int i = 1, u, v; i < n; ++i) u = read(), v = read(), add(u, v);
    for (int i = 1; i <= n; ++i)
        if (e[i].size() > 1) root = i;
    dfs(root, 0), puts(up[root] ? "NO" : "YES");
    return 0;
}

int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') f = (c == '-') ? -1 : f, c = getchar();
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}


Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.141592653589793238
#define dcout cout<<fixed<<setprecision(20)

const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long
#define double long double

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

int N, K;
INTV C, R;
vector<INTV> G1;
vector<vector<edge2> > G2;
bool can[5000][5000];

void bfs(int s){
  INTV d(N, BIG); d[s] = 0;
  queue<int> que; que.push(s);
  while(!que.empty()){
    int pos = que.front(); que.pop();
    can[s][pos] = 1;
    if(d[pos] == R[s]) continue;
    for(auto nx : G1[pos]){
      if(d[nx] == BIG){
        d[nx] = d[pos]+1;
        que.push(nx);
      }
    }
  }
}

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

  cin >> N >> K;
  C.resize(N); R.resize(N); G1.resize(N); G2.resize(N);
  REP(i, N) cin >> C[i] >> R[i];
  REP(i, K){
    int a, b; cin >> a >> b; a--; b--;
    G1[a].eb(b); G1[b].eb(a);
  }
  REP(i, N) bfs(i);
  INTV dist;
  REP(i, N) REP(j, N){
    if(can[i][j]) G2[i].pb({j, C[i]});
  }
  // dijkstra(G2, 0, dist);
  {
    dist.assign(N, BIG); dist[0] = 0;
    priority_queue<INTP, vector<INTP>, greater<INTP> > que;
    que.push({0, 0}); // {dist, index}
    while(!que.empty()){
      INTP p = que.top(); que.pop();
      int v = p.second;
      if(dist[v] < p.first) continue;
      REP(i, G2[v].size()){
        edge2 e = G2[v][i];
        if(dist[e.to] > dist[v]+e.cost){
          dist[e.to] = dist[v]+e.cost;
          que.push({dist[e.to], e.to});
        }
      }
    }
  }
  cout << dist[N-1] << endl;
}


Measured memory_bytes: 261908
using System;

namespace ABC122
{
    class Program
    {
        static int Main(string[] args)
        {
            Program.ProblemB();
                return 0;

        }

        static void ProblemB()
        {
            int max = 0;
            int rtn = 0;

            string input = Console.ReadLine();

            for(int i = 0; i<input.Length; i++)
            {
                if(input[i].ToString()=="A"|| input[i].ToString() == "T" || input[i].ToString() == "C" || input[i].ToString() == "G")
                {
                    max += 1;
                    if(max > rtn)
                    {
                        rtn = max;
                    }
                    
                }
                else
                {
                    max = 0;
                }
            }

            Console.WriteLine(rtn);
        }
    }
}

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

main(){
  int n, m;
  string had[1000];
  string atari[100];
  int kane[100];

  while(1){
    cin >> n >> m;
    if(n==0 && m==0) break;

    for(int i=0;i<n;i++){
      cin >> atari[i];
      cin >> kane[i];
    }

    for(int i=0;i<m;i++){
      cin >> had[i];
    }

    int keta[100];
    for(int i=0;i<n;i++){
      int count=0;
      for(int j=0;j<8;j++){
	if(atari[i][j]=='*'){
	  count++;
	}
      }
      keta[i]=8-count;
    }

    int ans=0;

    for(int i=0;i<m;i++){
      for(int j=0;j<n;j++){
	bool hit=true;
	for(int k=0;k<keta[j];k++){
	  if(had[i][7-k]!=atari[j][7-k]){
	    hit=false;
	    break;
	  }
	}
	if(hit){
	  ans+=kane[j];
	  break;
	}
      }
    }

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

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

map<int,int> prime(ll n){
    map<int,int> mp;
    for(ll i=2;i*i<=n;i++){
        while(n%i==0){
            mp[i]++;
            n/=i;
        }
    }
    if(n!=1)mp[n]++;
    return mp;
}

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1)res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}

int main(){
    int n;
    cin>>n;
    ll a[n];
    map<int,int> m;
    for(int i=0;i<n;i++){
        cin>>a[i];
        auto mp=prime(a[i]);
        for(auto e:mp){
            m[e.first]=max(e.second,m[e.first]);
        }
    }
    ll lcm=1;
    for(auto e:m){
        lcm=(lcm*modpow(e.first,e.second))%MOD;
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        ans=(ans+modpow(a[i],MOD-2))%MOD;
    }
    ans=(ans*lcm)%MOD;
    cout<<ans<<endl;
}


Measured memory_bytes: 768
#include<cstdio>
#include<algorithm>
using namespace std;
long long b[400100];
int num;
struct node{
	int d;
	long long x;
}a[100100];
int p[100100];
bool vis[100100];
int main(){
//	freopen("C.in","r",stdin);
	int n,L,T;
	scanf("%d%d%d",&n,&L,&T);
	for(int i=1;i<=n;i++)
		scanf("%lld%d",&a[i].x,&a[i].d);
	for(int i=1;i<=n;i++)
		if(a[i].d==2)
			b[++num]=a[i].x;

	for(int i=1;i<=num*3;i++)
		b[i+num]=b[i]+L;

	int l=0,ps,pp;
	long long v;
//	for(int i=1;i<=num*4;i++)
//		printf("%lld ",b[i]);
	for(int i=1;i<=n;i++){
		if(a[i].d==2) l++;
		else{
			pp=(T*2)/(L*2)*(long long)num*2%n;
			v=(T*2)%(L*2);
			v=a[i].x+v;
			ps=upper_bound(b+1,b+num*4+1,v)-b-1;
//			printf("v=%d %d\n",ps,l);
			ps=ps-l;
			ps=ps+pp+i;
			while(ps>n) ps-=n;
//			printf("pp=%d\n",ps);
			p[ps]=(T+a[i].x)%L;
			vis[ps]=1;
		}
	}

	num=0;
	for(int i=n;i>=1;i--)
		if(a[i].d==1)
			b[++num]=a[i].x;

	for(int i=1;i<=num*3;i++)
		b[i+num]=b[i]-L;

	reverse(b+1,b+num*4+1);
	l=num*4+1;
	for(int i=n;i>=1;i--){
		if(a[i].d==1) l--;
		else{
			pp=(T*2)/(L*2)*(long long)num*2%n;
			v=(T*2)%(L*2);
			v=a[i].x-v;
			ps=lower_bound(b+1,b+num*4+1,v)-b;
			ps=l-ps;
			ps=i-ps-pp;
			while(ps<=0) ps+=n;
			p[ps]=(a[i].x-T%L+L)%L;
			vis[ps]=1;
		}
	}
	for(int i=1;i<=n;i++)
		printf("%d\n",p[i]);
	return 0;
}


Measured memory_bytes: 5632
R, G, B, N = map(int, input().split())
d = {i:0 for i in range(N+1)}

for i in range((N//G)+1):
    for j in range((N//B)+1):
        if i*G+j*B<=N:
            d[i*G+j*B] += 1

ans = 0
for i in range((N//R)+1):
    ans += d[N-(R*i)]
print(ans)

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

#define ff first
#define ss second
#define pii pair<int,int>

int maks,n,m;
char arr[1005][1005];
bool visit[1005][1005];
vector<pii> v;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++){
			cin >> arr[i][j];
			if(arr[i][j] == '#') v.push_back({i,j});
		}
	queue<pair<int,pii> > q;
	for(pii i : v){
		q.push({0,i});
		visit[i.ff][i.ss] = 1;
	}
	while(!q.empty()){
		int dist = q.front().ff;
		pii now = q.front().ss;
		q.pop();
		maks = dist;
		if(now.ff > 0){
			if(!visit[now.ff-1][now.ss]){
				visit[now.ff-1][now.ss] = 1;
				q.push({dist+1,{now.ff-1,now.ss}});
			}
		}
		if(now.ff < n-1){
			if(!visit[now.ff+1][now.ss]){
				visit[now.ff+1][now.ss] = 1;
				q.push({dist+1,{now.ff+1,now.ss}});
			}
		}
		if(now.ss > 0){
			if(!visit[now.ff][now.ss-1]){
				visit[now.ff][now.ss-1] = 1;
				q.push({dist+1,{now.ff,now.ss-1}});
			}
		}
		if(now.ss < m-1){
			if(!visit[now.ff][now.ss+1]){
				visit[now.ff][now.ss+1] = 1;
				q.push({dist+1,{now.ff,now.ss+1}});
			}
		}
	}
	cout << maks << '\n';
	return 0;
}

Measured memory_bytes: 22120
#include <cmath>
#include <iostream>
#include <limits>
#include <utility>
#include <vector>

template <class T> void chmin(T &a, const T &b) {
  if (b < a)
    a = b;
}

int main() {
  using i64 = long long;
  int n, k;
  std::cin >> n >> k;
  std::vector<i64> h(n);
  for (auto &e : h) {
    std::cin >> e;
  }
  h.insert(h.begin(), 0);
  h.insert(h.end(), 0);
  n += 2;
  k = n - k - 1;
  static constexpr i64 Inf = std::numeric_limits<i64>::max() / 2;
  std::vector<i64> dp(n, Inf);
  dp[0] = 0;
  for (int l = 0; l != k; l += 1) {
    std::vector<i64> nx(n, Inf);
    for (int i = 0; i != n; i += 1) {
      for (int j = 0; j != i; j += 1) {
        chmin(nx[i], dp[j] + std::abs(h[i] - h[j]));
      }
    }
    dp = std::move(nx);
  }
  std::cout << dp.back() / 2 << std::endl;
}

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

double n,k,ans=0.00;

double log_2(double i,double k)//2 10
{
	double j=0.00,pos=i;//1 2
	while (1)
	{
		if (pos>=k)  break;
		else
		{
			j+=1.00;
			pos*=2.00;
		}
	}
	return j;
}

double power(double a,double b)
{
	double kk=1;
	for (double j=1;j<=b;j++)  kk=kk*a*1.00;
	return kk;
}

signed main()
{
	cin>>n>>k;//3 10
	for (double i=1.00;i<=n;i+=1.00)
	{
		ans+=(1.00/n)*power(0.50,log_2(i,k));//1/3*pow(0.5,4)
	}
	cout<<fixed<<setprecision(12)<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
  "fmt"
)

func main() {
  var n int 
  fmt.Scan(&n)
  p := make([]int, n)
  for i := 0; i < n; i++ {fmt.Scan(&p[i])}
  cnt := 0
  for i := 1; i < n - 1; i++ {
    if (p[i-1] < p[i] && p[i] < p[i+1]) ||
       (p[i-1] > p[i] && p[i] > p[i+1]) {
         cnt++
       }
  }
  fmt.Println(cnt)
}

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_qring(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

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

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

int h,w;
int calc=0;


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

int bfs(vector<string>g,int st){
    int maxdist=0;
    vector<vector<bool>> vis(25,vector<bool>(25,false));
    queue<pii> q;

    q.push({st,0});
    vis[st/w][st%w]=true;

    while (!q.empty()){
        int cur=q.front().fi;
        int x=cur%w;
        int y=cur/w;
        int dist=q.front().se;
        chmax(maxdist,dist);
        q.pop();

        //db2(x,y);ln;
        //db3(y,x,dist);ln;
        rep(i,4){
            calc++;

            int nx=x+dx[i];
            int ny=y+dy[i];
            if((0<=nx&&nx<w)&&(0<=ny&&ny<h)){
                if(vis[ny][nx]==false && g[ny][nx]=='.'){
                    q.push({ny*w+nx,dist+1});
                    //chmax(maxdist,dist+1);
                    vis[ny][nx]=true;
                }
            }
        }
    }
    return maxdist;
}

int main(){
    bool flag=false;
    ll ans=0,sum=0;

    cin >>h>>w;
    vector<string> g(h);
    //vector<vector<int>> d(w*h,vector<int>(w*h,INF));
    rep(i,h)cin>>g[i];

    
    rep(i,h){
        rep(j,w){
            if(g[i][j]=='.')chmax(ans,bfs(g,i*w+j));
            //ln;db2(i,j);ln;
        }
    }
    //*/
    //cout <<fixed<<setprecision(16)<< << endl;
    cout<<ans<<endl;
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define dl cout<<"LINE"<<__LINE__<<endl;
#define dbg(x) cout<<#x<<" = "<<x<<endl; 
using namespace std;
int main(){
	int a,b;
	double c1,c2;
	cin>>a>>b;
	c1=a/0.08;
	c2=b/0.1;
	for(register int i=1;i<=9999999;i++){
		if(floor((double)i*0.08)==a&&floor((double)i*0.1)==b){
			cout<<i<<endl;return 0;
		}
	}
	cout<<"-1"<<endl;
	return 0;
}

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

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

int32_t main() {
    //ios::sync_with_stdio(false); cin.tie(nullptr);

	int a, b;
	cin >> a >> b;

	if ((a + b) % 2 == 0) {
		cout << (a + b) / 2 << "\n";
	} else {
		cout << "IMPOSSIBLE\n";
	}

    return 0;
}


Measured memory_bytes: 256
/*
           Nothing is absolute.
     This is the only absolute truth.
*/

#include<bits/stdc++.h>

using namespace std;

using ull = unsigned long long;
using ll = long long;

#define READ freopen("in.txt", "r", stdin)
#define ROUT freopen("out.txt", "w", stdout)
#define pb push_back
#define endl '\n'

#define REP(i,a,b) for(int i=a; i<=b; i++)
#define arrL(i,a,b) for(int i=a; i<b; i++)

void fasterIO()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

void fileIO()
{
    READ;
    ROUT;
}

void solve()
{
    int n, k, c, i, j, flag;

    vector<int>v;

    cin>>n>>k;

    while(k--){
        cin>>c;
        v.pb(c);
    }

    for(i=n; ; i++){
        c=i;
        flag=1;
        while(c!=0){
            for(j=0; j<v.size(); j++){
                if(v[j]==c%10){
                    flag=0;
                    break;
                }
            }
            if(flag==0)
                break;
            else
                c/=10;
        }
        if(flag){
            cout<<i<<endl;
            break;
        }
    }
}

int main()

{
    ///fileIO();
    fasterIO();

    solve();

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
signed main(){
    char ch;
    char b_ch=' ';
    int cnt=0;
    int n;scanf("%d\n", &n);
    for(int i =0;i<n;i++){
            scanf("%c", &ch);
            if(b_ch != ch)cnt++;
            b_ch = ch;
    }
    cout<<cnt;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

int[][] J;

static this()
{
    foreach(i;0..3) J~=[i*3,i*3+1,i*3+2];
    foreach(i;0..3) J~=[i,i+3,i+6];
    foreach(i;0..2) J~=[i*2,4,8-i*2];
}

char solve(char[] s)
{
    foreach(c;"ox")
        foreach(a;J)
            if(a.map!(i=>s[i]==c).all!"a"())
                return c;
    return 'd';
}

void main()
{
    foreach(s;stdin.byLine())
        writeln(solve(s));
}

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

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

int main()
{
	FASTIO;
	ll n,t;
	cin>>n;
	t=n%10;

	if(t==2 || t==4|| t==5 || t==7 || t==9)
        cout<<"hon"<<"\n";

    if(t==0 || t==1|| t==6 || t==8)
        cout<<"pon"<<"\n";

    if(t==3)
        cout<<"bon"<<"\n";


}


Measured memory_bytes: 3624
//I love Nanami Chiaki
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define fst first
#define snd second
const int inf=1e9+7;
const int mod=1e9+7;
const int maxn=2e5+7;
int a[maxn];
int num[maxn];
int visited[maxn];
int main(){
	int n;ll k;scanf("%d%lld",&n,&k);
	for (int i=0;i<n;i++) scanf("%d",a+i),a[i]--;
	memset(visited,-1,sizeof(visited));int nw=0,cnt=0;
	while (visited[nw]==-1){
		num[cnt]=nw;visited[nw]=cnt++;nw=a[nw];
	}
	int xh=cnt-visited[nw];
	if (k<cnt){printf("%d\n",num[k]+1);return 0;}
	k-=visited[nw];k%=xh;k+=visited[nw];printf("%d\n",num[k]+1); 
	return 0;
}


Measured memory_bytes: 6096
#include <stdio.h>
#include <math.h>
#include <iostream>
using namespace std;

int main(){
	
	float a, b, c;
	cin>>a>>b>>c;
	c = c*3.14159265358979323846/180;
	float d = sqrt(a*a+b*b-2*a*b*cos(c));
	printf("%.8lf\n%.8lf\n%.8lf",0.5*a*b*sin(c), (a+b+d), b*sin(c));
	
	return 0;
}


Measured memory_bytes: 3480
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  for (int i = 0; i < max(a, b); i++) {
    printf("%d", min(a, b));
  }
  printf("\n");
}

Measured memory_bytes: 128
from sys import stdin, stdout
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * (n - 1 + m)))
    la = [None] * (n + 1)
    xt = [None] * len(dat)
    j = 0
    for i in xrange(n - 1 + m):
        x, y = dat[j], dat[j+1]
        xt[j+1] = la[x]
        la[x] = j + 1
        j += 2
    st = []
    pu = st.append
    po = st.pop
    col = [None] * (n + 1)
    top = []
    tpu = top.append
    for i in xrange(1, n + 1):
        if col[i] is not None:
            continue
        pu((i, la[i]))
        while st:
            x, y = po()
            if col[x] is None:
                col[x] = 1
            while y is not None and col[dat[y]]:
                y = xt[y]
            if y is None:
                tpu(x)
            else:
                pu((x, xt[y]))
                pu((dat[y], la[dat[y]]))
    rto = [0] * (n + 1)
    for i, x in enumerate(top):
        rto[x] = i
    par = [0] * (n + 1)
    rto[0] = n + 1
    for i in xrange(1, n + 1):
        y = la[i]
        while y is not None:
            z = dat[y]
            if rto[par[z]] > rto[i]:
                par[z] = i
            y = xt[y]
    stdout.write(''.join('%d\n' % x for x in par[1:]))
main()


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

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

	int a_sum = 0;
	for(int i = 1; i <= N; ++i) {
		int sum = 0;
		for(int j = 1; j <= i; ++j) {
			if(i % j == 0) sum ++;
		}
		if(sum == 8 && i % 2 == 1) {
			a_sum ++;
		}
	}

	cout << a_sum << endl;
	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
p = 10**9 + 7

n, m = map(int, input().split())
A = list(int(input()) for i in range(m))
isHole = [False]*(n+1)


dp = [1]*(n+1)

for a in A:
    isHole[a] = True
    dp[a] = 0


for i in range(2,n+1):
    if isHole[i] == False:
        dp[i] = dp[i-2]%p + dp[i-1]%p

print(dp[-1]%p)

Measured memory_bytes: 45148
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let k: usize = iterator.next().unwrap().parse().unwrap();
    let s: Vec<char> = iterator.next().unwrap().chars().collect();

    let mut score: usize = 0;
    for i in 1..n {
        if s[i - 1] == s[i] {
            score += 1;
        }
    }
    for _ in 0..k {
        if score + 2 <= n - 1 {
            score += 2;
        } else if score + 1 <= n - 1 {
            score += 1;
        } else {
            break;
        }
    }
    score.to_string()
}


Measured memory_bytes: 2460
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define debugP int debug_point; cin>>debug_point;
const ll MOD= 1e9 + 7;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
template <class T>
vector<T> getv(ll n){
	vector<T> Vector_temp;
	rep(i,n){
		T input;
		cin >> input;
		Vector_temp.emplace_back(input);
	}
	return Vector_temp;
}
ll gcd(ll c,ll b){
    while(1){
        if(c%b!=0){
        ll tmp=b;
        b=c%b;
        c=tmp;
        }else{
            return b;
        }
    }
}
/* <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3*/
vec(fac,100001);

void init(){
    fac[0]=1;
    repf(i,1,100001){
        fac[i]=(fac[i-1]*(i))%MOD;
    }
}

int main(){
    ll n,m;
    cin>>n>>m;
    ll ans=0;
    if(n>m){
        swap(n,m);
    }
    init();
    if(n==m){
       ans= (2*(fac[n]%MOD)*(fac[n]%MOD))%MOD;
    }else if((m-n)==1){
        ans=((fac[n]%MOD)*(fac[m]%MOD))%MOD;
    }
    op(ans);
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
vector<char>a;
char s[100010];
int main()
{
    while(~scanf("%s",s))
    {
        int len=strlen(s);
        int flag=0;
        for(int i=0;i<len;i++)
        {
            if(i+1<len&&s[i]==s[i+1])
            {
                printf("%d %d\n",i+1,i+2);
                flag=1;
                break;
            }
            else if(i+2<len&&s[i]==s[i+2])
            {
                printf("%d %d\n",i+1,i+3);
                flag=1;
                break;
            }
        }
        if(!flag)
            printf("-1 -1\n");
    }
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;
typedef long long ll;

int main(){
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  vector<ll> aa(4);
  aa[0]=a*c;
  aa[1] = b*d;
  aa[2] = a*d;
  aa[3] = b*c;
  sort(aa.begin(),aa.end());
  cout << aa[3] << endl;
}


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

int h, w, n, a[10100], ans[110][111], k=1;

int main(){
cin >> h >> w >> n;
for(int i =1; i<=n; i++){
    cin >> a[i] ;
}
for(int i =1; i<=h; i++){
    if(i%2==1){
    for(int j=1; j<=w; j++){
        if(a[k]>0)ans[i][j]=k, a[k]--;
        else {
            k++;
            ans[i][j]=k;
            a[k]--;
        }
    }
}
    else {
    for(int j=w; j>=1; j--){
        if(a[k]>0)ans[i][j]=k, a[k]--;
        else {
            k++;
            ans[i][j]=k;
            a[k]--;
        }
    }
    }
}
for(int i =1; i<=h;i++){
    for(int j =1; j<=w; j++){
        cout << ans[i][j] << " ";
    }
    cout << endl;
}
return 0;}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=200010;
const ll mod=1e9+7;

int main(){
  string s;
  cin >> s;
  s[5]=' ';
  s[13]=' ';

  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  zero
//
//  Created by 叶金炜 on 2019/4/2.
//  Copyright © 2019 okstal. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string.h>
#define pi acos(-1)
using namespace std;
int main() {
    int n,x[7][7][15],a,b,c,d;
    cin>>n;
    memset(x, 0, sizeof(x));
    while (n--) {
        cin>>a>>b>>c>>d;
        x[a][b][c]+=d;
    }
    for(int i=1;i<=4;i++)
    {
        for(int j=1;j<=3;j++)
        {for(int k=1;k<=10;k++)
            cout<<" "<<x[i][j][k];
            cout<<endl;}
        if(i!=4)cout<<"####################"<<endl;
    }
    return 0;
}



Measured memory_bytes: 3088
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var S = Console.ReadLine();
            int ans = 0;
            for(int i = 0; i < 4; i++)
            {
                if (S[i] == '+')
                {
                    ans++;
                }
                else
                {
                    ans--;
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13140