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

using namespace std;

#define MAX 100001
#define INF 2140000000
#define MOD 1000000007

long long bfs(vector<vector<int> > &adj, int s, int k) {
	int flag[MAX] = {0};
	queue<int> q;
	flag[s] = 1;
	q.push(s);
	long long ans = k;

	while(!q.empty()) {
		int u = q.front();
		q.pop();

		long long start;

		if (u == s) {
			start = k - 1;
		}
		else {
			start = k - 2;
		}

		for (int i = 0; i < adj[u].size(); ++i) {
			int v = adj[u][i];

			if(!flag[v]) {
				flag[v] = 1;
				q.push(v);
				ans = (ans * start) % MOD;
				start--;
			}
		}
	}

	return ans;
}

int main() {
	int ver, k, u, v;
	cin >> ver >> k;
	vector<vector<int> > adj(ver);

	for (int i = 0; i < ver - 1; ++i) {
		cin >> u >> v;
		adj[u - 1].push_back(v - 1);
		adj[v - 1].push_back(u - 1);
	}

	cout << bfs(adj, 0, k) << endl;
	return 0;
}

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

ll gcd(ll a, ll b){
    int r,temp;
    if (a < b){
        temp = a;
        a = b;
        b = temp;
    }
    while ( (r = a % b) != 0){
        a = b;
        b = r;
    }
    return b;
}

int main(){
    ll N;
    cin >> N;
    ll M;
    cin >> M;
    vector<ll> vec(N);
    rep(i,N){
        cin >> vec[i];
    }
    vector<ll> div_count_2(N,0);
    rep(i,N){
        ll A = vec[i];
        while(true){
            if (A % 2 == 1){
                break;
            }
            else{
                div_count_2[i]++;
                A /= 2;
            }
        }
    }
    bool possible = true;
    rep(i,N - 1){
        if (div_count_2[0] != div_count_2[i + 1]){
            possible = false;
        }
    }
    if (!possible) cout << 0 << endl;
    else{
        ll lcm = 1;
        rep(i,N){
            lcm = lcm * (vec[i] / 2) / gcd(lcm, (vec[i] / 2));
        }
        ll ans = M / lcm;
        if (ans % 2 == 1) cout << ans / 2 + 1 << endl;
        else cout << ans / 2 << endl;
    }
}



Measured memory_bytes: 4772
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int,int>;
using vi = std::vector<int>;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    while(1){
        int h,w; cin >> h >> w;
        if(h == 0 and w == 0) break;

        map<char,pii> mp;
        rep(i,h){
            string s; cin >> s;
            rep(j,w){
                mp[s[j]] = pii(i,j);
            }
        }

        string s; cin >> s;
        int n = s.size();

        int x,y;
        x = 0;
        y = 0;
        int ans = 0;
        rep(i,n){
            int nx = mp[s[i]].first;
            int ny = mp[s[i]].second;
            ans += abs(nx-x);
            ans += abs(ny-y);
            x = nx;
            y = ny;
        }
        ans += s.size();
        cout << ans << endl;
    }
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  int a[400000];
  long long int dp[n];
  for(int i=0;i<n;i++){
  	cin>>a[i];
  	dp[i]=1000000000000000;
  }

  dp[0]=0;
  dp[1]=abs(a[1]-a[0]);

  for(int i=2;i<k;i++)
  {
      for(int j=0;j<i;j++)
      {
          dp[i]=min(dp[j]+abs(a[i]-a[j]),dp[i]);
      }
  }
  for(int i=k;i<n;i++){
    for(int j=i-k;j<i;j++)
    {
        dp[i]=min(dp[j]+abs(a[i]-a[j]),dp[i]);
    }
  }
  cout<<dp[n-1];

}


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

int main(void){
    int n,m;
    scanf("%d%d",&n,&m);
    long long x[n],y[m],sum=0,prev=0,ans=0,mod=1000000007;
    for (int i=0; i<n; i++){
        scanf("%lld",&x[i]);
        if (i>0){
            prev=(prev+i*llabs(x[i]-x[i-1]))%mod;
            sum=(sum+prev)%mod;
        }
    }
    prev=0;
    for (int i=0; i<m; i++){
        scanf("%lld",&y[i]);
        if (i>0){
            prev=(prev+i*llabs(y[i]-y[i-1]))%mod;
            ans=(ans+(sum*prev)%mod)%mod;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 1664
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 1987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 998244353;
ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };

int tree[100005];
int n,m;
void upd(int i, int k)
{
	while (i <= m)
	{
		tree[i] += k;
		i += (i&-i);
	}
}
int sum(int i)
{
	int c = 0;
	while (i > 0)
	{
		c += tree[i];
		i -= (i&-i);
	}
	return c;
}
Pi p[300000];
int main() {
	scanf("%d%d",&n,&m);
	fup(i,0,n-1,1)scanf("%d%d",&p[i].X,&p[i].Y);
	sort(p,p+n,[&](Pi p1,Pi p2){
		return p1.Y-p1.X<p2.Y-p2.X;
	});
	int j=0;
	fup(d,1,m,1)
	{
		while(j<n&&p[j].Y-p[j].X<d)
		{
			upd(p[j].X,1);
			upd(p[j].Y+1,-1);
			j++;
		}
		int ans=n-j;
		fup(i,d,m,d)ans+=sum(i);
		printf("%d\n",ans);
	}
}

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

#define mod 1000000007

#define rep(i, n) for(int i=0; i<n; ++i)

using namespace std;
typedef long long ll;
const long long INF = 1LL << 60;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
int main(void){
	
	int N, K, h[100100];
	ll dp[100010];
	
	cin >> N >> K;
	rep(i, N)
		cin >> h[i];

	rep(i, 100010)
		dp[i] = INF;

	dp[0] = 0;

	for(int i=1; i < N; i++) {
		for(int j = 1; i - j >= 0 && j <= K; j++)
			chmin(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
	}

	cout << dp[N-1] << endl;
}

Measured memory_bytes: 1408
#include <stdio.h>
#include <math.h>
 
int main(void) {
    long long int n,m;
    long long int i;
    long long int nresult = 1;
    long long int mresult = 1;
    long long int result;
 
    scanf("%lld %lld",&n,&m);
 
    if(n-m == 1 || m-n ==1) {
        for(i = 1;i <= n;i++) {
	    nresult = (nresult * i) % 1000000007;
	}
	for(i = 1;i <= m;i++) {
	    mresult = (mresult * i) % 1000000007;
	}
	result = (nresult * mresult) % 1000000007;
    } else if(n == m){
	for(i = 1;i <= n;i++) {
	    nresult = nresult * i % 1000000007;
	}
	result = (nresult * nresult * 2) % 1000000007;
    } else {
	result = 0;
    }
    printf("%lld\n",result);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define FILE
#define ll long long
#define cn continue
#define pb push_back
using namespace std;
const ll M = 1e3;
ll n  ,mx , m , a , cnt , ans;
string s , s1;
int main(){
    cin >> n;
    vector< vector<ll> >d(n + 1 , vector<ll>(m + 1 , 0));
    if( !(n % 1000) )
        cout << 0;
    else
    cout << 1000 - n % 1000;
}


Measured memory_bytes: 3896
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

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

    long count = 1;
    while (h > 1)
    {
        count++;
        h /= 2;
    }

    long ans = 1;
    long a = 1;
    for (long i = 1; i < count; i++)
    {
        a *= 2;
        ans += a;
    }
    
    cout << ans << endl;

    return 0;
}

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


int main(){
  int N;
  long long int k=0;
  cin>>N;
  vector<long long int> a(N);
  for(int i=0;i<N;i++)
    cin>>a.at(i);
  
  for(int i=0;i<N;i++){
    while(a.at(i)%2==0){
      k++;
      a.at(i)/=2;
    }
  }
  cout<<k<<endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	string a;
	int b=0;
	cin>>a;
	for (int i=0;i<a.length();i++)
	{
		if (a[i]!=a[i+1])
		{
			b++;	
		}
	}
	cout<<b-1<<endl;
	return 0;
}

Measured memory_bytes: 512
from collections import Counter
s = input()
n=len(s)
res = [0] * (len(s)+1)
i = 1
res10p = 1
for c in reversed(s):
    res[i] = (res[i-1] + res10p*int(c))%2019
    i = i+1
    res10p = res10p*10%2019

dic = Counter(res)
cnt = 0
for v in dic.values():
    if v >= 2:
#        print(v)
        cnt += v * (v-1) // 2
print(cnt)

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

int main(void)
{
    int N;
    cin >> N;
    bool approvation = true;
    while (N--) {
        int A;
        cin >> A;
        if (A % 2 == 0) {
            if (A % 3 == 0 || A % 5 == 0) {
                continue;
            }
            else {
                approvation = false;
                break;
            }
        }
    }
    if (approvation) {
        cout << "APPROVED" << endl;
    }
    else {
        cout << "DENIED" << endl;
    }
}


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

int main(void) {
	int n;
	cin >> n;
	int sum = 0;
	int max = 0;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if (a > max) max = a;
		sum += a;
	}
	if (sum - max > max) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 384
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	boolean[] prime;

	void run() {
		Scanner sc = new Scanner(System.in);

		era(1000000);

		while (sc.hasNext()) {
			int n = sc.nextInt();
			int count = 0;
			for (int i = 2; i <= n; i++) {
				if (prime[i]) {
					count++;
				}
			}
			System.out.println(count);
		}

		sc.close();
	}

	public void era(int n) {
		prime = new boolean[n + 1];
		Arrays.fill(prime, true);
		prime[0] = prime[1] = false;

		for (int i = 2; i * i <= n; i++) {
			if (prime[i]) {
				for (int j = i + i; j <= n; j += i) {
					prime[j] = false;
				}
			}
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 22104
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0: break

    for i in range(0,H) :
        for j in range(0,W):
            if(i+j)%2 == 0:
                print('#', end="")
            else:
                print('.', end="")
        print()
    print()


Measured memory_bytes: 7000
#include<bits/stdc++.h>
#define lld long long int
#define vec vector<lld>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //code :-
char c;
cin>>c;
if((int)c>=65&&(int)c<=90)cout<<"A"<<endl;
else{
    cout<<"a"<<endl;
}
return 0;
}



Measured memory_bytes: 3612
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
)

func main() {
	log.SetFlags(log.Lshortfile)
	sc := newScanner()
	N := sc.nextInt()
	a := make([]int, 3*N)
	for i := 0; i < N*3; i++ {
		a[i] = sc.nextInt()
	}
	h1 := &IntHeap{}
	h2 := &IntHeap{}
	firstSum := make([]int, 3*N)
	firstSum[N-1] += sum(a[:N])
	secondSum := make([]int, 3*N)
	secondSum[2*N] += sum(a[2*N:]) * -1
	// log.Println(firstSum, secondSum)
	for k := 0; k < N; k++ {
		heap.Push(h1, a[k])
		heap.Push(h2, a[3*N-k-1]*-1)
	}
	// log.Println(h1, h2)
	for k := N; k < 2*N; k++ {
		firstSum[k] = firstSum[k-1] + a[k]
		heap.Push(h1, a[k])
		firstSum[k] -= heap.Pop(h1).(int)
		j := 3*N - k - 1
		secondSum[j] = secondSum[j+1] + (a[j] * -1)
		heap.Push(h2, a[j]*-1)
		secondSum[j] -= heap.Pop(h2).(int)

		// log.Println(k, j)
		// log.Println(firstSum)
		// log.Println(secondSum)
		// log.Println(h1, h2)
	}
	ans := math.MinInt64
	for k := N - 1; k < 2*N; k++ {
		ans = max(ans, firstSum[k]+secondSum[k+1])
		// log.Println(ans)
	}
	fmt.Println(ans)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

type IntHeap []int

func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] < h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return
}

type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) nextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) nextInt() int {
	v, _ := strconv.Atoi(s.next())
	return v
}

func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 21504
// Best practice

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <functional> // for less 

#define int         long long
#define pb          emplace_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> pbds; 

#define fbo find_by_order
#define ook order_of_key

signed main() {
   tezz
   
    int a,b;
    cin >> a >> b;
    for(int i=max(-1000000ll,b-a+1); i<=(min(1000000ll,a+b-1)); i++){
        cout << i << " ";
    }
    
   return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long 
using namespace std;
const int maxn = 2e5 + 7;

set<string> st;

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen("test.inp", "r")) freopen("test.inp", "r", stdin);
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        string s;
        cin >> s;
        st.insert(s);
    }
    cout << st.size();
}

Measured memory_bytes: 19136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll n, m;
string s;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	cin >> s;
	int flag[4];
	memset(flag, 0, sizeof(flag));
	rep(i, 0, s.size()){
		if(s[i] == 'N'){flag[0] = 1;}
		if(s[i] == 'W'){flag[1] = 1;}
		if(s[i] == 'S'){flag[2] = 1;}
		if(s[i] == 'E'){flag[3] = 1;}
	}
	if(flag[0] == flag[2] && flag[1] == flag[3]){
		print("Yes")
	}
	else{
		print("No")
	}
	return 0;
}

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();
		int d = sc.nextInt() * 2 + 1;
		sc.close();
		
		System.out.println((n + d - 1)/d);
	}
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define INF 120000000

using namespace std;

typedef pair<int, int> P;
typedef long long int LL;

int main() {
    LL x, y;
    cin >> x >> y;
    int cnt = 0;
    LL n = x;
    while (n <= y) {
        n *= 2;
        cnt++;
    }

    cout << cnt << endl;

    return 0;
}


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

int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(abs(c-a)<=d)
	{
		puts("Yes");
		return 0;
	}
	else
	{
	    if(abs(b-a)<=d&&(c-b)<=d)
	    {
	    	puts("Yes");
		}
		else
		{
			puts("No");
		} 
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll fac(ll n){
  ll ans=(n*(n-1))/2;
  return ans;
}
int main(){
  ll n,m;cin>>n>>m;
  ll par=fac(n);
  ll im=fac(m);
  ll ans=par+im;
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
S=raw_input()

diff = abs(753 - int(S[0:3]))

for i in range(len(S)-2):
#    print S[i:i+3]
    part_str = int(S[i:i+3])
    if diff > abs(753 - part_str):
        diff = abs(753 - part_str)

print diff


Measured memory_bytes: 2568
def f_enclose_all():
    # 参考: https://maspypy.com/atcoder-参加感想-2019-01-10abc-151
    from itertools import combinations
    N = int(input())
    Pos = [[int(i) for i in input().split()] for j in range(N)]
    Pos_complex = [x + y * 1j for x, y in Pos]  # 座標を複素数で持つ

    def find_circumcenter(z0, z1, z2):
        """複素数で表現される3点に対し、それらの外心を求める"""
        z1 -= z0
        z2 -= z0  # z0を基準に考える

        if abs((z1 * z2.conjugate()).imag) < 0.5:
            # 3点 A(α), B(β), C(γ) が同一線上にある ⇔ (β-α)/(γ-α) が実数。
            # 3点 (0), (z1), (z2) が同一線上にある ⇔ z1/z2 が実数。
            # ここで、z2 = r (cosθ + isinθ) と極形式で書くと
            # 1/z2 = 1/r * (cosθ - isinθ), z2* = r * (cosθ - isinθ) である。
            # よって、z1/z2 が実数か判定するとき、z1 に z2 の共役複素数を掛けた
            # 値で判定してもよい (r は実数なので影響しない)。
            return None  # 3点が同一線上にあるので、外心を定義できない

        numerator = z1 * z2 * (z1 - z2).conjugate()
        denominator = z1.conjugate() * z2 - z1 * z2.conjugate()
        return (numerator / denominator) + z0

    candidate = []
    # 3点選んで外心の座標を求めると、それが中心の候補
    for comb in combinations(Pos_complex, 3):
        o = find_circumcenter(*comb)
        if o is not None:
            candidate.append(o)

    # 2点選んで中点の座標を求めると、それが中心の候補
    for z1, z2 in combinations(Pos_complex, 2):
        candidate.append((z1 + z2) / 2)

    # 中心の候補と各点への距離の最大値が包含円の半径。それを最小にする中心を探す
    ans = float('inf')
    for c in candidate:
        radius = 0
        for z in Pos_complex:
            radius = max(radius, abs(z - c))
        ans = min(ans, radius)
    return round(ans, 10)

print(f_enclose_all())

Measured memory_bytes: 3820
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(int (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(int (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define INF 1000000007
#define LINF 1000000000000000007
typedef long long ll;
using namespace std;

ll GCD(ll x,ll y){
  if(x == y)return x;
  if(x < y)swap(x,y);
  ll r = x%y;
  if(r)return GCD(y,r);
  else return y;
}

ll LCM(ll x,ll y){
  return x/GCD(x,y)*y;
}

int main(){
  ll N,ans,T;
  cin >> N >> ans;
  FOR(i,0,N-1){
    cin >> T;
    ans = LCM(ans,T);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }
  

vi v[N];

 void solve() {
     int n;
     cin>>n;
     rep(i,1,n) {
		    int x;
		    cin>>x;
		    --x;
		    v[x].pb(i);		    
		 }
		 
		 rep(i,0,n)
		  cout<<max(sz(v[i]),0LL)<<endl;
             
 }

    
int32_t main() {
	cool;
	int t=1;
	//cin>>t;
	while(t--)
	solve();


return 0;	   
}


Measured memory_bytes: 14560
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"
#include "set"
#include "stack"
#include "tuple"

#define rep(n) for (int i = 0; i < n; ++i)
#define REP(n,i) for (int i = 0; i < n; ++i)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define intinf 1000000000
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define mkt make_tuple
#define P pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;


int main() {
	ll ai, ao, gomi, aj, al, ans;
	cin >> ai >> ao >> gomi >> aj >> al;
	ans = ao;
	if (ai % 2 + aj % 2 + al % 2 >= 2 && ai != 0 && aj != 0 && al != 0) {
		--ai;
		--aj;
		--al;
		ans += 3;
	}
	ans += ai + aj + al - (ai % 2 + aj % 2 + al % 2);
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	string s;
	cin >> s;
	s[5] = s[13] = ' ';
	cout << s << "\n";
	return 0;
}


Measured memory_bytes: 256
#include <array>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;


typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define PB push


#define MOD 1000000007LL
#define EPS 1e-10

int main()
{
    LL X;
    cin >> X;
    LL l = 0;
    LL r = X;
    while (l < r)
    {
        LL x = (l + r) / 2;
        if ((x * (x + 1)) / 2 < X)
        {
            l = x + 1;
        }
        else
        {
            r = x - 1;
        }
    }
    LL x = (l + r) / 2;
    if (x * (x + 1) / 2 < X) ++x;
    cout << x << endl;
    return 0;
}

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

const int N = 100005;

int n, k;
int a[N], h[N];
vector <int> edge[N];

int dfs(int u) {
    h[u] = 0;
    for (int v: edge[u]) h[u] = max(h[u], (1 + dfs(v)) % k);
    return h[u];
}

int main() {
    scanf ("%d %d", &n, &k);
    
    scanf ("%d", a);
    int ans = *a != 1;        
    
    for (int i=1; i<n; i++) {
        scanf ("%d", a + i);
        edge[--a[i]].push_back(i);
    }
    
    dfs(0);
    
    for (int i=1; i<n; i++) 
        ans += a[i] && h[i] == k - 1;
    
    printf ("%d\n", ans);
    
    return 0;
}

Measured memory_bytes: 9600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//String s = sc.next();
		int a = sc.nextInt();
		String S = sc.next();
		int flagL=0;
		//char buff=S.charAt(0);
		//int[] array=new int[S];

		if(a<3200) {
			System.out.println("red");
		}else {
			System.out.println(S);
		}
		/*for(int i:array) {
			System.out.print(i+" ");
		}*/
	}


	public static int sample() {
		return 1;
	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define all(v) v.begin(),v.end()
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define db long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define MOD 1000000007
    

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

  bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
  {

    if(a.s==b.s)
    {
      return a.f<b.f;
    }
    return a.s<b.s;
  }
  int32_t main()
  {         
    

      IOS

      
      string s;
      cin>>s; 
      int n=s.length();

      int a=0;
      for(int i=0;i<s.length();i++)
      {
        if(s[i]=='1')
        {
          a++;
        }
      }

      cout<<s.length()-abs(n-2*a);

      return 0;
  }           

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    ll a;
    set<ll> s;
    
    rep(i, 3){
        cin >> a;
        s.insert(a);
    }
    
    cout << s.size() << endl;
}

Measured memory_bytes: 256
a,b,c,d=map(int,input().split())
x=0
if b<=c:
  x=0
elif d<=a:
  x=0
elif a<=c and c<=b and b<=d:
  x=b-c
elif c<=a and b<=d:
  x=b-a
elif c<=a and a<=d and d<=b:
  x=d-a
elif a<=c and d<=b:
  x=d-c
print(x)

Measured memory_bytes: 3060
import java.util.*;
public class Main
{
	public static void main(String[] args)
	{
	   Scanner s=new Scanner(System.in);
	   int n=s.nextInt();
	   Integer a[]=new Integer[n];
	   for(int i=0;i<n;i++){a[i]=s.nextInt();}
	   Arrays.sort(a,Collections.reverseOrder());
	   long ans=0;
	   int count=1;
	   	
	   //for(int i=0;i<n;i++){System.out.print(a[i]+" ");}
	   if(n%2==0)
	   {
		for(int i=0;i<(n/2)-1;i++)
		{
		  ans+=a[i];
		}
		ans+=a[(n/2)-1];
		for(int i=n/2-1;i>0;i--)
		{
		  ans+=a[i];
		}
	   }
	   else
	   {
		for(int i=0;i<n/2;i++)
		{
		  ans+=a[i];
		}
		for(int i=n/2;i>0;i--)	
		{
		  ans+=a[i];
		}
	   }
	   System.out.println(ans);
	
	}
}

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

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

  int64_t ans = 0;

  rep(i, N){
    if (i % 3 != 0 && i % 5 != 0) ans += i;
  }

  cout << ans << endl;

}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int main(){
  ull N, K;
  cin >> N >> K;
  ull b = N % K;

  if (b > K / 2) cout << K - b << endl;
  else cout << b << endl;

  return 0;
}


Measured memory_bytes: 256
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n, k = map(int, input().split())
    ans = 0.0

    for i in range(1, n + 1):
        tmp = 1 / n
        while i <= k - 1:
            tmp *= 0.5
            i *= 2
        ans += tmp

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int x1, y1, x2, y2,x3,y3,x4,y4;
	cin >> x1 >> y1 >> x2 >> y2;
	if (x1 <=x2) {
		if (y2>=y1) {
			x3 = x2 - abs(y1 - y2);
			y3 = y2 + abs(x1 - x2);
			x4 = x3 - abs(x1 - x2);
			y4 = y3 - abs(y1 - y2);
		}
		else {
			x3 = x2 + abs(y1 - y2);
			y3 = y2 + abs(x1 - x2);
			x4 = x3 - abs(x1 - x2);
			y4 = y3 + abs(y1 - y2);

		}
	}
	else {
		if (y2 >= y1) {
			x3 = x2 - abs(y1 - y2);
			y3 = y2 - abs(x1 - x2);
			x4 = x3 + abs(x1 - x2);
			y4 = y3 - abs(y1 - y2);
		}
		else {
			x3 = x2 + abs(y1 - y2);
			y3 = y2 - abs(x1 - x2);
			x4 = x3 + abs(x1 - x2);
			y4 = y3 + abs(y1 - y2);

		}
	}
	cout << x3 << " " << y3 << " " << x4 << " " << y4;
}

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

using namespace std;

#define f first
#define s second
#define pub push_back
#define pob pop_back

typedef vector<int> vi;
typedef vector<vi> graf;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vii> wgraf;

typedef vector<double> vd;
typedef pair<double,double> dd;
typedef vector<dd> vdd;

typedef uint64_t ui64;

int main(){

	int n;
	cin >> n;

	vi b(n-1);

	for(auto &x: b)
		cin >> x;

	int sum = b[0];

	for(int i = 0; i < n-2; i++){

		sum += min(b[i],b[i+1]);

	}

	sum += b[n-2];

	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <deque>
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}


#define INF 1e9+7
#define LLINF 1e18+7
const ll MOD=1e9+7;
const int N=1000000;



main(){
    ll x=lin();
    ll ans=x/11ll *2ll;
    x%=11;
    if(x==0)cout<<ans;
    else if(x<=6)cout<<ans+1;
    else cout<<ans+2;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll n = 0;
  cin >> n;
  ll ar[n];
  ll c = 0;
  for (ll i = 0; i < n; ++i) {
    cin >> ar[i];
    if ((i + 1) & 1 and ar[i] & 1) ++c;
  }
  cout << c;
}



Measured memory_bytes: 3564
#include <set>
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;


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

    set<string> dict;
    int n;
    cin >> n;
    for (int i; i < n; ++i) {
        string c, s;
        cin >> c >> s;
        if (c == "insert") {
            dict.insert(s);
        } else if (c == "find") {
            if (dict.find(s) != dict.end()) {
                cout << "yes";
            } else {
                cout << "no";
            }
            cout << "\n";
        }
    }

    return 0;
}

Measured memory_bytes: 29032
//*Here I go out to sea again
//*The sunshine fills my hair
//*And dreams hang in the air

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back

int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    int a[11],k;
    cin>>n>>k;
    for(int i=0;i<k;i++){
      cin>>a[i];
    }
    int ans=n;
    while(1){
      bool ch=true;
    while(n>0){
      int temp=n%10;
      for(int i=0;i<k;i++){
        if(a[i]==temp){
           ch=false;
          break;
        }
      }
      n=n/10;
    }
    if(ch)
    break;
    ans++;
    n=ans;
  }
    cout<<ans<<"\n";

    return 0;
}


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

int main(){
    int n, k;
    cin >> n >> k;
    set<string> set_s;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        set_s.insert(s);
    }
    
    int A[26] = {};
    for(auto x : set_s){
        A[(int)(x[0] - 'A')]++;
    }

    int ans = 0;
    while(1){
        sort(A, A + 26, greater<int>());
        int x = *min_element(A, A + k);
        if(x){
            for(int i = 0; i < k; i++){
                A[i]--;
            }
        }else break;
        ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

        int m = n % 10;
        if (m == 3) {
                cout << "bon" << endl;
        } else if (m == 1 || m == 0 || m == 6 || m == 8) {
                cout << "pon" << endl;
        } else {
                cout << "hon" << endl;
        }

        return 0;
}


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

int main()
{
    long double a,b,h,m;
    cin >> a >> b >> h >> m;
    long double rad;
    rad = 2 * 3.14159265358979323846264338327950L * (h/12 + (m /60 /12 - m /60));
    long double req = ((a*a) + (b*b)) - 2 * a*b * cos(rad);
    req = sqrt (req);
    cout << setprecision(21) << req;
    return 0;
}


Measured memory_bytes: 4044
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


unsigned N;
vector<unsigned> A;

unsigned gcd(unsigned a, unsigned b);

int main()
{
	unsigned ans = 0;

	cin >> N;
	A = vector<unsigned>(N);
	for (unsigned i = 0;i<N; i++) {
		cin >> A.at(i);
	}

	vector<unsigned>R = vector<unsigned>(N);
	vector<unsigned>L = vector<unsigned>(N);
	R.at(N - 1) = A.at(N - 1);
	L.at(0) = A.at(0);

	for (unsigned i = 1; i < N - 1; i++) {
		R.at(N - 1 - i) = gcd(A.at(N-1-i),R.at(N-i) );
		L.at(i) = gcd(A.at(i), L.at(i-1));
	}

	ans = max(R.at(1),L.at(N-2));
	for (unsigned i = 1; i < N - 1; i++) {
		ans = max(ans,gcd(R.at(i+1),L.at(i-1)));
	}

	cout << ans << endl;

	return 0;
}

unsigned gcd(unsigned a, unsigned b) 
{
	unsigned t;

	if (b > a) {
		t = a;
		a = b;
		b = t;
	}

	while (b > 0) {
		t = a;
		a = b;
		b = t % b;
	}
	return a;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i,s,n) for(int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(){
    int n;
    cin >> n;
    int a[n], p[n], q[n];
    rep2(i, 1, n + 1) a[i - 1] = i;
    rep(i, n) cin >> p[i];
    rep(i, n) cin >> q[i];

    int count = 0;
    int num_p, num_q;
    do {
        count++;
        bool flag = true;
        rep(i, n) {
            if(a[i]!=p[i]){
                flag = false;
                break;
            }
        }
        if(flag)
            num_p = count;

        flag = true;
        rep(i, n) {
            if(a[i]!=q[i]){
                flag = false;
                break;
            }
        }
        if(flag)
            num_q = count;

    } while(next_permutation(a, a + n));

    cout << abs(num_p - num_q) << endl;

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools

## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for _ in range(M)]

A,B=map(str, input().split())

C = int(A+B)

if float.is_integer(math.sqrt(C)):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 77460
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	    String line = br.readLine();
	    int a = Integer.parseInt(line.split(" ")[0]);
	    int b = Integer.parseInt(line.split(" ")[1]);

	    if (a < b) {
		    System.out.println("a < b");
	    } else if (a > b) {
		    System.out.println("a > b");
	    } else {
		    System.out.println("a == b");
	    }
	}
}

Measured memory_bytes: 24192
import math
LI = lambda: list(map(int,input().split()))
MI = lambda: map(int,input().split())
yes = lambda: print("YES")
no = lambda: print("NO")
I = lambda: list(input())
J = lambda x: "".join(x)
II = lambda: int(input())
SI = lambda: input()
#---khan17---template
t = int(input())
print(math.pi*t*2)

Measured memory_bytes: 9200
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

LL K,A,B;
LL f(){
	if(K<A+1){
		return K+1;
	}
	K-=A+1;
	LL r=B;
	r+=(B-A)*(K/2);
	r+=K%2;
	return r;
}
int main() {
	cin >> K >> A >> B;
	cout << max(K+1,f()) << endl;
	return 0;
}



Measured memory_bytes: 256
#-swank
(unless (member :child-sbcl *features*)
  (quit
   :unix-status
   (process-exit-code
    (run-program *runtime-pathname*
                 `("--control-stack-size" "128MB"
                   "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                   "--eval" "(push :child-sbcl *features*)"
                   "--script" ,(namestring *load-pathname*))
                 :output t :error t :input t))))
(defmacro dp (name args memo-size &body body)
  (let ((memo (gensym)))
    `(let ((,memo (make-array ,memo-size :initial-element nil)))
       (defun ,name ,args
         (or (aref ,memo ,@args)
             (setf (aref ,memo ,@args)
                   ,@body))))))

(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
      (cons (subseq str 0 pos)
            (split x (subseq str (+ pos size))))
      (list str))))

(defmacro collect-times (time body)
  `(loop repeat ,time collect ,body))

(defun read-times (time)
  (collect-times time (read)))

(defun main (lst)
  (labels ((f (ct cx cy lst)
             (if lst
                 (let* ((clst (car lst))
                        (nt (nth 0 clst))
                        (nx (nth 1 clst))
                        (ny (nth 2 clst))
                        (dist (- nt ct))
                        (disx (abs (- cx nx)))
                        (disy (abs (- cy ny)))
                        (dissum (+ disx disy)))
                   (and (>= dist dissum) (evenp (- dist dissum)) (f nt nx ny (cdr lst))))
                 t)))
    (f 0 0 0 lst)))

(princ (if (main (collect-times (read) (list (read) (read) (read)))) "Yes" "No"))


Measured memory_bytes: 66740
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long

bool pallan(string &S)
{
    string temp = S;
    
    reverse(temp.begin(),temp.end());
    if(temp==S) return true;
    return false;
    
    
}

void solve()
{
    string s;cin>>s;
    if(!pallan(s)){
        cout<<"No\n";
        return;
    }
    ll n = s.size();
    string temp ="";
    for(ll i=0;i<((n-1)/2);i++){
        temp += s[i];
    }
    if(!pallan(temp)){
        cout<<"No\n";
        return;
    }
    temp = "";
    ll x = (n+3)/2;
    for(ll i=x-1;i<n;i++){
        temp += s[i];
    }
    
    
    if(!pallan(temp)){
        cout<<"No\n";
        return;
    }
    cout<<"Yes";
}

int main() {
    
    // ll t;cin>>t;while(t--)
    {
        solve();
    }
    
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define fo(i, a, b) for (int i=a; i<(b); i++)
#define forev(i, b, a) for (int i = (b)-1; i >= a; i--)
typedef long long int 	lli;
typedef long double 	ld;
#define mp 				make_pair
#define pb 				push_back
#define ff 				first
#define ss 				second
#define lb 				lower_bound
#define ub 				upper_bound
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define endl 			"\n"
#define fast 			ios_base::sync_with_stdio(0); cin.tie(0);
// #define PI 3.1415926535897932384626
// const int MOD = 1000000007;
// const ll INF = 1e18;
// const int MX = 100001;
//==================================================================================

int main() {
	fast;
	// int t; cin >> t; while (t--)
	int x, y; cin >> x >> y;
	string ans = "No";

	if (y % 2 == 0) ans = "Yes";

	if (x * 4 < y) ans = "No";

	if (x * 2 > y) ans = "No";

	cout << ans;


	return 0;
}

Measured memory_bytes: 3652