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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;

#define rep(a,n) for(ll a = 0;a < n;a++)

static const ll INF = 1e15;
static const ll mod = 1e9+7;

template<typename T>
static inline void chmin(T& ref, const T  value) {
    if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T& ref, const T value) {
    if (ref < value) ref = value;
}

struct MaxFlowCalculator {
	int max_flow(int s, int t, const vector<vector<pair<int, int>>>& g) {
		struct edge_ { int to, cap, rev; };
		vector<bool> used(g.size(), false);
		vector<vector<edge_>> G(g.size());
		for (int i = 0; i < g.size(); i++) for (int j = 0; j < g[i].size(); j++)
		{
			int from = i, to = g[i][j].second;
			int cap = g[i][j].first;
			G[from].push_back({ to, cap, (int)G[to].size() });
			G[to].push_back({ from, 0, (int)G[from].size() - 1 });
		}
		auto dfs = [&](auto&& f, int v, int t, int fl)->int {
			if (v == t) return fl;
			used[v] = true;
			rep(i, G[v].size()) {
				edge_& e = G[v][i];
					if (!used[e.to] && e.cap > 0) {
					int d = f(f, e.to, t, min(fl, e.cap));
					if (d > 0) {
						e.cap -= d;
						G[e.to][e.rev].cap += d;
						return d;
					}
				}
			}
			return 0;
		};
		int flow = 0;
		while (1) {
			used.assign(used.size(), false);
			int f = dfs(dfs, s, t, INT_MAX);
			if (f == 0) return flow;
			flow += f;
		}
	}
};

class modint {
	static constexpr std::int_fast64_t Modulus = 1e9 + 7;
	using u64 = std::int_fast64_t;

public:
	u64 a;
	constexpr modint(const u64 x = 0) noexcept : a(x% Modulus) {}
	constexpr u64& value() noexcept { return a; }
	constexpr const u64& value() const noexcept { return a; }
	constexpr modint operator+(const modint rhs) const noexcept {
		return modint(*this) += rhs;
	}
	constexpr modint operator-(const modint rhs) const noexcept {
		return modint(*this) -= rhs;
	}
	constexpr modint operator*(const modint rhs) const noexcept {
		return modint(*this) *= rhs;
	}
	constexpr modint operator*(const ll rhs) const noexcept {
		return modint(*this) *= rhs;
	}
	constexpr modint& operator+=(const modint rhs) noexcept {
		a += rhs.a;
		if (a >= Modulus) {
			a -= Modulus;
		}
		return *this;
	}
	constexpr modint& operator-=(const modint rhs) noexcept {
		if (a < rhs.a) {
			a += Modulus;
		}
		a -= rhs.a;
		return *this;
	}
	constexpr modint& operator*=(const modint rhs) noexcept {
		a = a * rhs.a % Modulus;
		return *this;
	}
	constexpr operator u64() const { return a; }
};

int main() {
	ll n, k;
	cin >> n >> k;
	vector<ll> vs(n);
	rep(i, n)cin >> vs[i];
	vector<ll> sums(n + 1, 0);
	vector<ll> plus(n + 1, 0);
	rep(i, n) {
		sums[i + 1] = sums[i] + vs[i];
		plus[i + 1] = plus[i] + (vs[i] >= 0 ? vs[i] : 0);
	}
	ll u = 0;
	for (int i = 0; i + k <= n;i++) {
		auto left = plus[i];
		auto right = plus[n] - plus[i + k];
		auto middle = sums[i + k] - sums[i];
		if (middle >= 0) {
			chmax(u, left + right + middle);
		}
		else {
			chmax(u, left + right);
		}
	}
	cout << u << endl;
    return 0;
}


Measured memory_bytes: 5612
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cotu cout
#define itn int
const int INF = 1e9 + 7;

int main(){
    int n,w; cin>>n>>w;
    vector<pair<ll,ll>> item(n+1);
    vector<vector<pair<ll,ll>>> dp(n+1,vector<pair<ll,ll>>(w+1,{0,0}));
    for(int i = 1; i <= n; i++) {
        ll w,v; cin>>w>>v;
        item[i] = {w,v};
    }
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= w; j++){
            dp[i][j] = dp[i-1][j];
            ll newCost = item[i].S + dp[i-1][j-item[i].F].S;
            if(item[i].F<=j && newCost > dp[i][j].S) dp[i][j] = {item[i].F + dp[i-1][j-item[i].F].S,newCost};
        }
    }
    cout<<dp[n][w].S;
}

Measured memory_bytes: 159744
/*
ye mera template hai
apna khud likho bc :P
*/

/*
Author : Sarvagya Agarwal
*/

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

//defines
#define openin freopen("input.txt","r",stdin)
#define openout freopen("output.txt","w",stdout)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define int long long
#define mod 1000000007
#define repr(i,x,y) for (__typeof(x) i=x;i>=y;i--)
#define rep(i,x,y) for (__typeof(x) i=x;i<=y;i++)
#define all(c) (c).begin(),(c).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair

/* Print pair */
template <typename T,typename S>
ostream & operator << (ostream &os , const pair<T,S> &v) {
    os << "(" ;
    os << v.first << "," << v.second << ")" ;
    return os ;
}
/* Print vector */
template <typename T>
ostream & operator << (ostream &os , const vector<T> &v) {
    os << "[" ;
    int sz = v.size() ;
    for(int i = 0 ; i < sz ; ++i) {
        os << v[i] ;
        if(i!=sz-1)os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print set */
template <typename T>
ostream & operator << (ostream &os , const set<T> &v) {
    T last = *v.rbegin() ;
    os << "[" ;
    for(auto it : v) {
        os << it  ;
        if(it != last) os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print Map */
template <typename T,typename S>
ostream & operator << (ostream &os , const map<T,S> &v) {
    for(auto it : v) {
        os << it.first << " : " << it.second << "\n" ;
    }
    return os ;
}
int power(int a , int b)
{
    int res = 1 ;
    while(b)
    {
        if(b%2) {
            res = (res * a) % mod ;
        }
        b/=2 ;
        a = (a*a) % mod ;
    }
    return res ;
}

//debug
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

int32_t main()
{
    fast;
    int x ;
    cin >> x ;
    if(x < 1200) {
        cout << "ABC" ;
    }
    else cout << "ARC" ; 
    return 0;
}


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

const int MAXN = 55;
long long dp[MAXN][MAXN][MAXN*MAXN];
int nums[MAXN];
int n,a;

int main()
{
    scanf("%d %d",&n,&a);
    for(int i = 1; i <= n; ++i)
        scanf("%d",&nums[i]);
    dp[0][0][0] = 1;
    for(int i = 1; i <= n; ++i)
    {
        for(int j = 0; j <= i; ++j)
        {
            for(int k = 0; k <= n*50; ++k)
            {
                if(k >= nums[i] && j > 0) dp[i][j][k] += (dp[i-1][j][k]+dp[i-1][j-1][k-nums[i]]);
                else dp[i][j][k] += dp[i-1][j][k];
            }
        }
    }
    long long res = 0;
    for(int i = 1; i <= n; ++i)
        res += dp[n][i][i*a];
    printf("%lld\n",res);
    return 0;
}


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

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

ll lcm(ll a, ll b){
  return a / gcd(a, b) * b;
}

int main() {
 ll n,m;
  bool flag=true;
  cin >> n >> m;
  string s,t;
  cin >> s >> t;
  
  r(i,gcd(n,m)){
    if(s[i*(n/gcd(n,m))]!=t[i*(m/gcd(n,m))])flag=false;
  }
  
  if(flag)cout<<lcm(n,m)<<endl;
  else cout<<-1<<endl;
}


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

#define MAX_N 1000
#define MAX_M 1000



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

    bool exist = true;
    for(int i = 0; i < (n-1)/2; i++){
        if(s[i] == s[(n-1)/2-1-i]) continue;
        else{
            exist = false;
            break;
        }
    }

    for(int i = ((n+3)/2)-1; i< n; i++){
        if(s[i] == s[n-1-i]) continue;
        else{
            exist = false;
            break;
        }
    }
    if(exist) cout << "Yes" << endl;
    else cout << "No" << endl;
    
}




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

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

  ll N; cin >> N;
  ll S; cin >> S;

  if (N < S) {
    cout << -1 << '\n';
    return 0;
  }
  if (N == S) {
    cout << (N + 1) << '\n';
    return 0;
  }

  ll ans = 1e12;
  ll d, N2, b;
  for (ll i = 1; i <= sqrt(N - S); i++) {
    if ((N - S) % i == 0) {
      b = i + 1, d = 0, N2 = N;
      while (N2 != 0) {
        d += (N2 % b);
        N2 /= b;
      }
      if (d == S) ans = min(ans, b);

      b = (N - S) / i + 1, d = 0, N2 = N;
      while (N2 != 0) {
        d += (N2 % b);
        N2 /= b;
      }
      if (d == S) ans = min(ans, b);
    }
  }

  if (ans == 1e12) ans = -1;
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include <cstdio>

using namespace std;
#define N 4
#define N2 16

static const int dx[4] = {0,-1,0,1};
static const int dy[4] = {1,0,-1,0};
static const char dir[4] = {'r','u','l','d'};
int MDT[N2][N2];

struct Puzzle 
{ 
	int f[N2], space, MD;
	int cost;

	bool operator < (const Puzzle &pz) const
	{
		for (int i = 0; i < N2; ++i)
		{
			if (f[i] == pz.f[i]) continue;
			return f[i] < pz.f[i];
		}
		return false;
	}
};

struct State
{
	Puzzle puzzle;
	int estimated;
	bool operator < (const State &s) const
	{
		return estimated > s.estimated;
	}
};
int getAllMD(Puzzle pz)
{
	int sum = 0;
	for (int i = 0; i < N2; ++i)
	{
		if (pz.f[i] == N2) continue;
		sum += MDT[i][pz.f[i] - 1];
	}
	return sum;
}

int astar(Puzzle s)
{
	priority_queue<State> PQ;
	s.MD = getAllMD(s);
	s.cost = 0;
	map<Puzzle, bool> V;
	Puzzle u,v;
	State initial;
	initial.puzzle = s;
	initial.estimated = s.MD;
	PQ.push(initial);

	while(!PQ.empty())
	{
		State st = PQ.top(); PQ.pop();
		u = st.puzzle;
		if (u.MD == 0) return u.cost;
		V[u] = true;

		int sx = u.space / N;
		int sy = u.space % N;

		for (int r = 0; r < 4; ++r)
		{
			int tx = sx + dx[r];
			int ty = sy + dy[r];
			if (tx < 0 || ty < 0 || tx >= N || ty >= N) continue;
			v = u;

			v.MD -= MDT[tx * N + ty][v.f[tx * N + ty] - 1]; 
			v.MD += MDT[sx * N + sy][v.f[tx * N + ty] - 1]; 

			swap(v.f[tx * N + ty], v.f[sx * N + sy]);
			v.space  = tx * N + ty;
			if (!V[v])
			{
 				v.cost++;
				State news;
				news.puzzle = v;
				news.estimated = v.MD + v.cost;
				PQ.push(news);
			}
		}
	}
	return -1;
}

int main()
{

	for (int i = 0; i < N2; ++i)
	{
		for (int j = 0; j < N2; ++j)
		{
			MDT[i][j] = abs(i / N - j / N) + abs (i % N - j % N);
		}
	}
	Puzzle in;

	for (int i = 0; i < N2; ++i)
	{
		cin>>in.f[i];
		if (in.f[i] == 0)
		{
			in.f[i] = N2;
			in.space = i;
		}

	}

	int ans = astar(in);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 257744
//package atcoder.beginner_170;

import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main (String[] args) throws Exception {

        String s = "3 6";

//        br = new BufferedReader(new StringReader(s));
        br = new BufferedReader(new InputStreamReader(System.in));
        bw = new BufferedWriter(new OutputStreamWriter(System.out));

        rl(); int X=nin(), Y=nin();


        if (Y%2==0 && X*2<=Y && X*4>=Y) {
            bw.write("Yes");
        } else {
            bw.write("No");
        }

        bw.newLine();
        bw.flush();

    }

    static BufferedReader br;
    static BufferedWriter bw;
    static StringTokenizer st;
    static void rl() throws Exception{
        st = new StringTokenizer(br.readLine());
    }
    static long nlo(){
        return Long.parseLong(st.nextToken());
    }
    static int nin(){
        return Integer.parseInt(st.nextToken());
    }
    /*private static void te(){
      }*/
    static double ndo(){
        return Double.parseDouble(st.nextToken());
    }
    static char[] nca(){
        return st.nextToken().toCharArray();
    }
    static String nstr(){
        return st.nextToken();
    }
}

Measured memory_bytes: 32632
/**
 *
 * Contest - Problem X: Nome (link)
 *
 * Abridge version.
 *
 * Solution: text
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = pair<ll, ll>;

#define REP(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define REPN(i, N) for (int (i) = 0; (i) < N; (i)++)
#define DEC(i, b, a) for (int (i) = (b); (i) >= (a); (i)--)
#define DECN(i, N) for (int (i) = N - 1; (i) >= 0; (i)--)

#define LOG(var, sep) (cerr << #var << " = " << (var) << (sep))
#define LOGM(msg) (cerr << (msg))
#define LOGV(vec, sep) { cerr << #vec << " ="; for (const auto& v : (vec)) cerr << " " << v; cerr << (sep); }
#define LOGA(arr, N, sep) { cerr << #arr << " ="; for (int i = 0; i < N; ++i) cerr << " " << (arr)[i]; cerr << (sep); }
#define LOGA2(arr, N, M, sep) { cerr << #arr << " =\n"; for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) cerr << (arr)[i][j] << " "; cerr << endl; } cerr << (sep); }

ostream& operator<<(ostream& os, const ii& p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

const int MAX { 2000010 };
const ll oo { 1LL << 62 };
const int MOD { 1000000007 };

void solve(ll N)
{
    cout << N << endl;
}

int main()
{
    ios::sync_with_stdio(false);

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

    cout << (A % 2 and B % 2 ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <cstdio>
#include <queue>
#include <deque>
using namespace std;
int h,w,cnt=0;
char maze[51][51];
int d[51][51];
int dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};
const int INF=100000000;
typedef pair<int,int> P;

int bfs(){
  queue<P> que;
  //初期化
  for(int i=0;i<w;i++)
    for(int j=0;j<h;j++)
      d[i][j] = INF;
  que.push(P(0,0));
  d[0][0]=0;
  
  //ループ
  while(que.size()){
    P p=que.front();
    que.pop();
    if(p.first == w && p.second == h) break;
    //移動4方向
    for(int i=0;i<4;i++){
      int nx = p.first + dx[i];
      int ny = p.second + dy[i];
      if(0<=nx && nx<w && 0<=ny && ny<h && maze[nx][ny] != '#' && d[nx][ny] == INF){
        que.push(P(nx,ny));
        d[nx][ny] = d[p.first][p.second] + 1;
      }
    }
  }
  return d[w-1][h-1];
}
int main(){
  scanf("%d%d",&h,&w);
  for(int i=0;i<h;i++){
    char str[52];
    scanf("%s",str);
    for(int j=0;j<w;j++){
      maze[j][i] = str[j];
      if(maze[j][i] == '#') cnt++;
    }
  }
  int res = bfs();
  if(res == INF)
    printf("-1\n");
  else{
  	//printf("(%d-%d-%d)=%d\n",w*h,cnt,res,w*h - cnt - res);
  	printf("%d\n",w*h - cnt - res - 1);
  }
  return 0;
}

Measured memory_bytes: 256
import bisect
import collections
import functools
import heapq
import math
from collections import deque
from collections import defaultdict
MOD = 10**9+7

a,b,h,m = map(int,(input().split()))
hkakudo = math.radians(30*h+0.5*m)
mkakudo = math.radians(6*m)
kakudo = abs(hkakudo-mkakudo)
ans = a**2 + b**2 - 2*a*b*math.cos(kakudo)
print(ans**0.5)

Measured memory_bytes: 68676
// https://atcoder.jp/contests/abc150/tasks/abc150_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int c, int d) { return c / gcd(c, d) * d; }

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    unordered_set<int> st;
    int ans = 1;
    REP(i, N) {
        uint64_t t;
        cin >> t;
        st.insert(__builtin_ctzll(t));
        if (t % 2 == 0 && st.size() >= 2) {
            cout << "0\n";
            return 0;
        }
        ans = lcm(ans, t / 2);
    }
    cout << (M / ans + 1) / 2 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <string>
using namespace std;

struct CARD {
	int number;
	char mark;
};

int partition(vector<CARD>& A, int p, int r) {
	int i,j,x=A[r].number;
	i=p-1;
	for(j=p; j<r; ++j) {
		if(A[j].number<=x) {
			++i;
			swap(A[i],A[j]);
		}
	}
	swap(A[i+1],A[r]);
	return i+1;
}

void quickSort(vector<CARD>& A, int p, int r) {
	if(p<r) {
		int q;
		q=partition(A,p,r);
		quickSort(A,p,q-1);
		quickSort(A,q+1,r);
	}
	return;
}

int main() {
	int n;
	int i;
	bool stability=true;
	vector<CARD> A;
	map<int,queue<char> > M;

	scanf("%d",&n);
	A.resize(n);

	for(i=0; i<n; ++i) {
		(void)getchar();
		scanf("%c %d",&A[i].mark,&A[i].number);
		M[A[i].number].push(A[i].mark);
	}
	quickSort(A,0,n-1);
	for(i=0; i<n; ++i) {
		stability=stability && (A[i].mark==M[A[i].number].front());
		M[A[i].number].pop();
	}
	printf((stability?"Stable\n":"Not stable\n"));
	for(i=0; i<n; ++i) {
		printf("%c %d\n",A[i].mark,A[i].number);
	}
	return 0;
}

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



int main(){
  int n;
  cin >> n;
  vector<int> d(n);
  for(int i=0; i<n; i++){
    cin >> d.at(i);
  }
  int a = 0;
  for(int i=0; i<n; i++){
    for(int j=i+1; j<n; j++){
      a += d[i] * d[j];
    }
  }
  cout << a << endl;
}


Measured memory_bytes: 256
// Problem : B - Mix Juice
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

void solve(){
	int n, k;
	cin >> n >> k;
	int arr[n];
	for(int i = 0; i < n; i++){
		cin >> arr[i];
	}
	sort(arr, arr + n);
	int sum = 0;
	for(int i = 0; i < k; i++){
		sum += arr[i];
	}
	cout << sum << endl;
	
}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


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

using namespace std;

int main()
{
  int a,b; cin>>a>>b;
  int price = -1;
  for(int i = 10*b; i<(10*b+10);i++)
  {
    if(floor(i*0.08) == a)
    {
      price = i;
      break;
    }
  }
  
  cout<<price<<endl;
}

Measured memory_bytes: 384
A, B, K = map(int, input().split())
if K > B-A:
    ans = list(range(A, B+1))
else:
    ans = list(range(A, A+K)) + list(range(B, B - K, -1))
ans = list(set(ans))
ans.sort()
print(*ans, sep='\n')

Measured memory_bytes: 9184
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
LL A[200001];
int main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	
	LL ans=A[N-1];
	LL now=A[N-1];
	if(A[N-1]>=N){
		cout<<-1<<endl;
		return 0;
	}
	
	for(int i=N-2;i>=0;i--){
		if(A[i]>=(i+1)){
			cout<<-1<<endl;
			return 0;
		}
		if(A[i]<A[i+1]-1){
			cout<<-1<<endl;
			return 0;
		}
		if(A[i]!=A[i+1]-1){
			ans+=A[i];
		}
	}
	cout<<ans<<endl;
	return(0);
}

Measured memory_bytes: 1792
#import math
n=input()
#=int(input())
#=map(int,input().split())
#=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]

a = int(n[len(n)-1])
if a == 3:
    print('bon')
elif (a == 0)or(a == 1)or(a == 6)or(a == 8):
    print('pon')
else:
    print('hon')


Measured memory_bytes: 9164
/*                        ______
 _______   /\     |``\   |        |  /
    |     /  \    |__/   |____    |/
    |    / _ _\   |  \   |        |\
    |   /      \  |   \  |______  |  \

            Dept. of CSE
        Comilla  University

*/
#include<bits/stdc++.h>
#define pi 2*acos(0.0)
#define ll long long
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define Node struct node
#define spc " "
#define  E  2.71828182845904523536
#define pb push_back
#define pp pop_back
#define valid(nx,ny) nx>=0 && nx<n && ny>=0 && ny<m
#define ee endl
#define pii pair<int,int>
#define infinity 10000000000000000
#define mod 1000000007
int fx[]={0,0,+1,-1};
int fy[]={+1,-1,0,0};

using namespace std;
///check n=1;
///check corner case;
const int maX=1e5+1;
vector<ll>Graph[maX],cost[maX];
ll visit[maX];
ll x[10];
ll y[10];

int main()
{
    ll n,m,i,j,cc=0;
    cin>>n>>m;
    ll x,y;
    cin>>x>>y;
    ll mx=x;
    ll mn=y;
    for(i=1;i<m;i++){
        cin>>x>>y;
        mx=max(mx,x);
        mn=min(mn,y);
    }
    cout<<max(0ll,mn-mx+1)<<endl;
return 0;
}


Measured memory_bytes: 4992
module Main where

import qualified Data.ByteString.Char8         as BS
import qualified Data.ByteString.Lazy.Char8    as BSL
import qualified Data.ByteString.Builder       as BSB
import           Data.Char                      ( isSpace )
import           Data.List                      ( unfoldr )

main :: IO ()
main = do
  [l, r, d] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  print $ length [x | x <- [l..r], x `mod` d == 0]


Measured memory_bytes: 3772
K, S = gets.split.map(&:to_i)
ans = 0
(0..K).each do |x|
  y_z = S - x
  next if y_z < 0
  next if K * 2 < y_z
  (0..K).each do |y|
    z = y_z - y
    next if z < 0
    next if K < z
    ans += 1
  end
end

p ans

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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if((c - (a-b)) >= 0) cout << c - (a-b) << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
ruiseki = [0]*(N+1)
total = 0
now = 10**20
sa = 0
now_2 = 0
for i in range(N):
  total += A[i]
  ruiseki[i+1] = total
for i in range(1,len(ruiseki)-1):
  snuke = ruiseki[i]-ruiseki[0]
  arai = ruiseki[N]-ruiseki[i]
  now_2 = abs(snuke-arai)
  now = min(now,now_2)
print(now)


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

int n,m;

int main(){
	scanf("%d%d",&n,&m);
	if (n==1&&m==1){
		printf("1\n");
		return 0;
	}
	if (n==1){
		printf("%d\n",m-2);
		return 0;
	}
	if (m==1){
		printf("%d\n",n-2);
		return 0;
	}
	printf("%lld\n",1ll*(n-2)*(m-2));
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <vector>
#define ll long long int
#define mp make_pair
#define pb push_back
#define vi vector<int>
using namespace std;
using namespace std::chrono;
long long int p=1e9 +7;
int n;
bool compatibility[21][21];
ll ans[21][1ll<<21];
bool debugging=0;
bool outputcheck=0;
bool timecheck=0;
void init(){
    if(debugging){
        
    }
    else{
       cin>>n;
       for(int i=0;i<n;i++){
           for(int j=0;j<n;j++){
               cin>>compatibility[i][j];
           }
       }
    }
}
long long int modpower(ll b,ll po, ll mod=p){
    long long int ans=1;
    while(po){
        if(po&1){
            ans*=b;
            ans%=mod;
        }
        b*=b;
        b%=mod;
        po>>=1;
    }
    return ans;
}
ll solve(int N,int left){
    ll currans=0;
    if(ans[N-1][left]!=-1){
        return ans[N-1][left];
    }
    if(N==1){
        for(int j=0;j<n;j++){
            int x=1<<j;
            if(left & x){
                if(compatibility[N-1][j]){
                    ans[N-1][left]=1;
                    return 1;
                }
                else{
                    ans[N-1][left]=0;
                    return 0;
                }
            }
        }
    }
    for(int i=0;i<n;i++){
        if(left & (1ll<<i)){
            if(compatibility[N-1][i]){
            currans+=solve(N-1,left - (1ll<<i));
            }
        }
    }
    currans%=p;
    ans[N-1][left]=currans;
    return ans[N-1][left];
}
ll solve(){
    for(int i=0;i<n;i++){
        for(int j=0;j<(1ll<<n);j++){
            ans[i][j]=-1;
        }
    }
  /*  for(int i=0;i<n;i++){
        for(int j=0;j<(1<<n);j++){
            cout<<ans[i][j]<<" ";
        }
        cout<<"\n";
    }
    */
    return solve(n,(1<<n)-1);
}
ll solvebad(){
    
}
int output(){
   
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t;
	//cin >>t;
	t=1;
    srand(time(0));
	while(t--){
	   init();
	   if(debugging){
	       if(outputcheck){
	          if(solve()!=solvebad()){//checking for random input
	             output();
	          }
	       }
	       if(timecheck){
	           auto start=high_resolution_clock::now();
	           solve();
	           auto stop=high_resolution_clock::now();
	           auto duration = duration_cast<microseconds>(stop - start);
	           cout<<duration.count()<<" Fast\n";
	           start=high_resolution_clock::now();
	           solvebad();
	           stop=high_resolution_clock::now();
	           duration = duration_cast<microseconds>(stop - start);
	           cout<<duration.count()<<" Slow\n";
	       }
	   }
	   else{
	       cout<<solve()<<"\n";//solving it correctly
	   }
	}
}

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

int main() {
  // 入力される(c11,c12,c13)をs1, (c21,c22,c23)をs2として入力
  string s1, s2;
  cin >> s1 >> s2;

  // s1の1文字目(c11) と s2の3文字目(c23) が同じ
  // かつ
  // s1の3文字目(c13) と s2の1文字目(c21) が同じ
  //
  // この条件を満たす時、180°回転させた時に、元のマス目と一致する。
  if(s1.at(0) == s2.at(2) && s1.at(1) == s2.at(1) && s1.at(2) == s2.at(0)) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 3552
N=int(input())
A=list(map(int, input().split()))

L=[0]*(10**6)
for i in range(N):
    if i-A[i]>=0:
        L[i-A[i]]+=1
ans=0
for i in range(N):
    tall=A[i]
    if tall+i<len(L):
        ans+=L[tall+i]
print(ans)
#print(L[:10])

Measured memory_bytes: 32376
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
#define isNum(a) (a>='0'&&a<='9')
#define SP putchar (' ')
#define EL putchar ('\n')
#define inf 2147483647
#define N 100005
#define File(a) freopen(a".in", "r", stdin), freopen(a".out", "w", stdout)
template<class T1>inline void read(T1&);
template<class T1>inline void write(T1);
class Pre {
public:
    int bel, num, year;
    int id;
}a[N];
int sum[N];
int main () {
    int n, m;
    read(n);
    read(m);
    for (int i=1; i<=m; ++i) {
        read(a[i].bel);
        read(a[i].year);
        a[i].id=i;
    }
    sort(a+1, a+m+1, [](Pre i, Pre j) {
        return i.year<j.year;
    });
    for (int i=1; i<=m; ++i) {
        a[i].num=++sum[a[i].bel];
    }
    sort(a+1, a+m+1, [](Pre i, Pre j) {
        return i.id<j.id;
    });
    cout.fill('0');
    for (int i=1; i<=m; ++i) {
        cout<<setw(6)<<a[i].bel<<setw(6)<<a[i].num<<endl;
    }
    return 0;
}
template<class T1>void read(T1 &r_e_a_d) {
    T1 k=0;
    char ch=getchar();
    int flag=1;
    while (!isNum(ch)) {
        if (ch=='-') {
            flag=-1;
        }
        ch=getchar();
    }
    while (isNum(ch)) {
        k=(k<<1)+(k<<3)+ch-'0';
        ch=getchar();
    }
    r_e_a_d = flag*k;
}
template<class T1>void write(T1 w_r_i_t_e) {
    if (w_r_i_t_e<0) {
        putchar('-');
        write(-w_r_i_t_e);
    }else {
        if (w_r_i_t_e<10) {
            putchar(w_r_i_t_e+'0');
        }else {
            write(w_r_i_t_e/10);
            putchar((w_r_i_t_e%10)+'0');
        }
    }
}


Measured memory_bytes: 3456
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class A
{
	public static readonly int FALSE = 0;
	public static readonly int TRUE = 1;

	public static void Main()
	{
		long N = GetLong();
		List<int> digits = new List<int>(64);
		long tmp = N;
		while(tmp > 0)
		{
			digits.Add((int)(tmp % 10));
			tmp /= 10;
		}
		digits.Reverse();

		int[,] dp = new int[digits.Count + 1, 2];
		dp[1, FALSE] = digits[0];
		dp[1, TRUE] = digits[0] - 1;
		for(int i = 1; i < digits.Count; i++)
		{
			dp[i + 1, FALSE] = dp[i, FALSE] + digits[i];
			dp[i + 1, TRUE] = dp[i, TRUE] + 9;
			if(digits[i] > 0)
				dp[i + 1, TRUE] = Math.Max(dp[i + 1, TRUE], dp[i, FALSE] + (digits[i] - 1));
		}
		
		Console.WriteLine(Math.Max(dp[digits.Count, FALSE], dp[digits.Count, TRUE]));
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}

Measured memory_bytes: 13140
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    string s;
    int k;
    cin >> k;
    cin >> s;
    if(k  < s.size()){
        string scopy;
        rep(i,k){
            scopy += s[i];
        }
        cout << scopy << "..." << endl;
    }else{
        cout << s << endl;
    }
}

Measured memory_bytes: 3632
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

    def get_size(self, x):
        x = self.find(x)
        return self.size[x]


N, M = map(int, input().split())
uf = UnionFind(N)
for i in range(M):
    A, B = map(int, input().split())
    uf.union(A-1, B-1)

ans = 0
for i in range(1, N):
    if not uf.is_same(0, i):
        uf.union(0, i)
        ans += 1

print(ans)

Measured memory_bytes: 79440
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

int asc(const void* a, const void* b) {
	return *(int*)a - *(int*)b;
}

int main(void) {
	int a[101], i, n, count=1;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	
	qsort(a, n, sizeof(int), asc);

	for (i = 0; i < n-1; i++) {
		if (a[i] < a[i + 1]) {
			
			count++;
		}
	}

	printf("%d", count);

	return 0;
}

Measured memory_bytes: 128
/*!enjoy karo yaar!*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

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

/*-----<Defines>-----*/
#define     int             long long int
#define     fast()          ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)          begin(x),end(x)
#define     rz(x)           resize(x)
#define     asn(x,y)        assign(x,y)
#define     mem(a,b)        memset(a,b,sizeof(a))
#define     sz(x)           ((int)size(x))
#define     eb              emplace_back
#define     pb              push_back
#define     pf              push_front
#define     pob             pop_back
#define     pof             pop_front
#define     ins             insert
#define     vi              vector<int>
#define     pii             pair<int,int>
#define     mii             map<int,int>
#define     F               first
#define     S               second
#define     remax(a,b)      a=max(a,b)
#define     remin(a,b)      a=min(a,b)
#define     bitcount(x)     __builtin_popcountll(x)
#define     iceil(n,x)      (((n)-1)/(x)+1)
#define     flush           fflush(stdout)

using ull=unsigned long long;
using ll=long long;
using ld=long double;
/*-----</Defines>-----*/

/*-----<Debugging Stuff>-----*/
string to_string(char s)
{   string res="'''";res[1]=s;return res; }

string to_string(string s)
{   return '"'+s+'"'; }

string to_string(const char* s)
{   return to_string((string)s); }

string to_string(bool b)
{   return (b?"true":"false"); }

template<typename A, typename B>
string to_string(pair<A, B> p)
{   return "("+to_string(p.F)+", "+to_string(p.S)+")"; }

template<typename A>
string to_string(A v)
{
    bool first=1; string res="{";
    for(const auto &x:v)
    {
        if(!first)  res+=", ";
        first=0;
        res+=to_string(x);
    }
    res+="}";
    return res;
}

void debug() { cout<<"\n"; }
template<typename Head, typename... Tail>
void debug(Head H, Tail... T)
{
    cout<<" "<<to_string(H);
    debug(T...);
}

#define show(...) cout << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
/*-----</Debugging Stuff>-----*/

/*-----<Mod Operations>-----*/
const int M=1e9+7;
inline int add(int a,int b,int p=M){ a=a+b; if(a>=p) a-=p; return a; }
inline int sub(int a,int b,int p=M){ a=a-b; if(a<0) a+=p; return a; }
inline int mul(int a,int b,int p=M){ a=(a*1ll*b)%p; return a; }
/*-----</Mod Operations>-----*/

/*-----<Constants>-----*/
const ld pi=acos(-1),eps=1e-9;
const ll inf=1e18;
const int N=1;
/*-----</Constants>-----*/

void solve()
{
    int n,m,k;
    cin>>n>>m>>k;

    vi a(n+1),b(m);
    for(int i=1;i<=n;++i)
        cin>>a[i];
    for(int i=0;i<m;++i)
        cin>>b[i];

    vi pre(m+1);
    for(int i=0;i<m;++i)
        pre[i+1]=pre[i]+b[i];

    int sum=0;
    int ans=0;
    for(int i=0;i<=n;++i)
    {
        sum+=a[i];
        int req=k-sum;

        if(req<0)
            break;

        int pos=upper_bound(all(pre),req)-begin(pre);
        --pos;
        ans=max(ans,i+pos);
    }

    cout<<ans;
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    for(int z=1;z<=t;++z)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}



Measured memory_bytes: 7964
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll n,a,b,le=0,ri=1100000000,t;
  cin >> n >> a >> b;
  vector<ll> h(n);
  for(int i=0;i<n;i++){
    cin >> h[i];
  }
  while(ri-le>1){
    t = (le+ri)/2;
    ll cnt=0,bdm = t*b,la = a-b;
    for(int i=0;i<n;i++){
      ll th = h[i]-bdm;
      if(th>0){
        cnt += (th+la-1)/la;
      }
    }
    if(cnt>t){
      le = t;
    }else{
      ri = t;
    }
  }
  cout << ri << endl;
}


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

typedef struct{
  double x,y;
} Point;

void print(Point p){
  printf("%.8f %.8f\n",p.x,p.y);
}
void kock(int n,Point p1,Point p2){
  Point s,t,u;
  double th = 60.0*(acos(-1)/180.0);
  if(n == 0)return;
  s.x = (2.0 * p1.x + 1.0 * p2.x)/3.0;
  s.y = (2.0 * p1.y + 1.0 * p2.y)/3.0;
  t.x = (1.0 * p1.x + 2.0 * p2.x)/3.0;
  t.y = (1.0 * p1.y + 2.0 * p2.y)/3.0;
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

  kock(n-1,p1,s);
  print(s);
  kock(n-1,s,u);
  print(u);
  kock(n-1,u,t);
  print(t);
  kock(n-1,t,p2);
}
main(){
  Point p1,p2;
  int n;
  scanf("%d",&n);

  p1.x = 0;
  p1.y = 0;
  p2.x = 100;
  p2.y = 0;
  print(p1);
  kock(n,p1,p2);
  print(p2);

  return 0;
}



Measured memory_bytes: 2100
import           Data.List (minimumBy)
import           Data.Ord  (comparing)

main :: IO ()
main = do
  n <- readLn
  [t, a] <- map read . words <$> getLine
  hs <- take n . map read . words <$> getLine
  print $ f t a hs

f :: Int -> Int -> [Int] -> Int
f t a =
  fst .
  minimumBy (comparing $ difference (fromIntegral a) . averageTemperature t . snd) .
  zip [1..]

averageTemperature :: Int -> Int -> Double
averageTemperature t height = fromIntegral t - fromIntegral height * 0.006

difference :: Num a => a -> a -> a
difference = (abs .) . subtract


Measured memory_bytes: 1404
#include <iostream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
const int INF = 1<<15;
const ll MOD = 1e9+7;
const double EPS = 1e-9;


int main(int argc, const char * argv[]) {
  
  vector<int> v(5);
  for (int i=0; i<5; i++)
    cin >> v[i];
  
  int k; cin >> k;

  string ans = "Yay!";
  for (int i=0; i<5; i++){
    for (int j=i; j<5; j++){
      if (abs(v[i] - v[j]) > k)
        ans = ":(";
    }
  }
  
  cout << ans <<endl;
  return 0;
}

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

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

    ll q, h, s, d;
    cin >> q >> h >> s >> d;
    ll n;
    cin >> n;

    ll o = min(q * 4, min(h * 2, s));

    ll ans = 0;
    if (o * 2 > d) {
        ans += (n / 2) * d;
        n = n % 2;
    }
    ans += n * o;

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


Measured memory_bytes: 256
//コンパイラ最適化用
#pragma GCC optimize("O3")
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

signed main(){
  string s;
  cin >> s;
  int temp = 0;
  if(s.at(0) == 'R' || s.at(1)== 'R'||s.at(2) == 'R'){
    temp = 1;
  if(s.at(0) == 'R' && s.at(1) == 'R' )  temp ++;
  if(s.at(1) == 'R'  && s.at(2) == 'R' )  temp++;
  }
  cout << temp;
}



Measured memory_bytes: 3544
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <cmath>

using namespace std;

inline int ctoi(const char c)
{
	return c >= '0'&&c <= '9' ? c - '0' : -1;
}

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

	string res;
	if (n < 4) {
		res = "No";
	}
	else if (n % 4 == 0 || n % 7 == 0) {
		res = "Yes";
	}
	else {
		// 4a + 7b = nとなるa, bが存在する
		res = "No";
		for (int a = 0; a <= n; a++) {
			for (int b = 0; b <= (n - a); b++) {
				if (4 * a + 7 * b == n) {
					res = "Yes";
					break;
				}
			}
			if (res == "Yes") {
				break;
			}
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    ll N, Z, W;
    cin >> N >> Z >> W;
    vector<ll> a(N);
    Rep (i, N) cin >> a[i];

    ll ans;
    if (N == 1) ans = abs(a[0] - W);
    else ans = max(abs(a[N-1] - W), abs(a[N-1] - a[N-2]));

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/abc103/tasks/abc103_d

int main() {
    int N, M; cin >> N >> M;
    vector<P> ab;
    REP(i, M) {
        int a, b; cin >> a >> b;
        ab.push_back({b, a});
    }

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

    int now = 0;
    int ans = 0;
    for (P t : ab) {
        int l = t.second;
        int r = t.first;
        if (l >= now) {
            now = r;
            ans++;
        }
    }

    cout << ans << "\n";

    return 0;
}


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

int main() {
	int n, k, x[100010], answer = 1e9;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> x[i];
	}
	for (int i = 0; i < n - k + 1; i++) {
		answer = min(min(abs(x[i]), abs(x[i + k - 1])) + abs(x[i] - x[i + k - 1]), answer);
	}
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"

bool check(vector<pair<int, int>>v) {
	return v[0].first == v[1].first&&v[0].second == v[2].first&&
		v[1].second == v[2].second;
}

int main() {
	map<pair<int, int>, int>mp;

	for (int i = 0; i < 6; ++i) {
		int a, b; cin >> a >> b;
		if (a > b)swap(a, b);
		mp[make_pair(a, b)]++;
	}
	bool ok = true;
	for (auto m : mp) {
		if (m.second %2)ok = false;
	}
	if (ok) {

		pair<int, int>p;
		pair<int, int>q;
		pair<int, int>r;
		if (mp.size() == 3) {

			p = (mp.begin()->first);
			q = (next(mp.begin())->first);
			r = (next(next(mp.begin()))->first);
		}
		else if (mp.size() == 2) {

			p = (mp.begin()->first);
			q = (next(mp.begin())->first);
			if (mp.begin()->second == 2)r = q;
			else r = p;
		}
		else {
			p = q = r = (mp.begin()->first);
			
		}

		vector<pair<int, int>>av{ p,q,r };
		sort(av.begin(), av.end());
		if (!(check(av)))ok = false;
	}

	if (ok)cout << "yes" << endl;
	else cout << "no" << endl;
	
	return 0;
}

Measured memory_bytes: 3088
#pragma GCC optimize(2)
#pragma GCC optimize(3)   
#include<bits/stdc++.h>
#include<cstdlib>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds; 
//#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long ll;
typedef vector < ll > vl;
typedef vector < vl > vvl;
typedef pair < ll, ll > pll;
typedef long double ld;
typedef vector < pair < ll, ll > > vpll;
#define Boost() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define forn(i,n) for (ll i = 0; i < n; i++)
#define fo(i,n) for (ll i = 1; i <= n; i++)
#define fore(i,l,r) for (ll i = l; i <= r; i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define all(c) c.begin(), c.end()
#define go(c,it) for(auto it=(c).begin(); it!=(c).end(); it++)
//#define back(c,it) for(auto it=(c).rbegin(); it!=(c).rend(); it++)
#define fi first
#define se second
#define MOD 998244353
#define MAX 1000000007
#define N 2000009
#define N1 100007
ll power(ll a,ll b){ll res=1;a=a%MOD;while(b>0){if(b&1){res=(res*a)%MOD;}a=(a*a)%MOD;b>>=1;}return res;}
ll fact[500009];
ll fermat_inv(ll y){return power(y,MOD-2);}
ll nCrMod(ll n, ll r){ ll p=fact[n];ll q=(fact[r]*fact[n-r])%MOD;return (p*fermat_inv(q))%MOD;} 
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
const ld PI = acos(-1.0);
vl g[N1];


  int main(){
      #ifndef ONLINE_JUDGE
      freopen("input.cpp","r",stdin);
      freopen("output.cpp","w",stdout);
      #endif
      Boost();
      int t;
      cin>>t;
      //t=1;
      int t1=t;
      map<string,int> m;
      while(t--)
      {
        string s;
        cin>>s;
        m[s]++;
      }
      cout<<"AC x "<<m["AC"]<<endl<<"WA x "<<m["WA"]<<endl<<"TLE x "<<m["TLE"]<<endl<<"RE x "<<m["RE"]<<endl;
      return 0;
  }

Measured memory_bytes: 6008
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <iomanip>

using namespace std;

const double inf = 1e+30;

struct Circle {
  double x, y, r;
  Circle(double x, double y, double r) : x(x), y(y), r(r) {}
  Circle() {}
};

struct Edge {
  double cost;
  int next;
  Edge (double c, int n) : cost(c), next(n) {}
  Edge () {}
};

bool operator > (Edge e1, Edge e2) {
  return e1.cost > e2.cost;
}

int main () {
  double sx, sy, tx, ty;
  int N;
  cin >> sx >> sy >> tx >> ty;
  cin >> N;
  vector<Circle> vc(N);
  for (int i = 0; i < N; i++) {
    cin >> vc[i].x >> vc[i].y >> vc[i].r;

  }
  vc.push_back(Circle(sx, sy, 0));  // N
  vc.push_back(Circle(tx, ty, 0));  // N + 1
  vector<vector<double> > dis(N + 2, vector<double>(N + 2, 0.0));
  for (int i = 0; i < N + 2; i++) {
    for (int j = 0; j < N + 2; j++) {
      if (sqrt((vc[i].x - vc[j].x) * (vc[i].x - vc[j].x) + (vc[i].y - vc[j].y) * (vc[i].y - vc[j].y)) > vc[i].r + vc[j].r) {
	dis[i][j] = sqrt((vc[i].x - vc[j].x) * (vc[i].x - vc[j].x) + (vc[i].y - vc[j].y) * (vc[i].y - vc[j].y)) -(vc[i].r + vc[j].r);
      } else {
	dis[i][j] = 0.0;
      }
    }
  }
  
  priority_queue<Edge, vector<Edge>, greater<Edge> > pq;
  pq.emplace(0.0, N);
  vector<int> isAccess(N + 2, 0);
  vector<double> cost(N + 2, inf);
  
  while (pq.size()) {
    Edge edge = pq.top();
    pq.pop();
    if (isAccess[edge.next]) continue;
    isAccess[edge.next] = 1;
    for (int i = 0; i < N + 2; i++) {
      if (isAccess[i]) continue;
      if (edge.cost + dis[edge.next][i] < cost[i]) {
	cost[i] = edge.cost + dis[edge.next][i];
	pq.emplace(cost[i], i);
      }      
    }
  }
  cout << fixed << setprecision(30) << cost[N + 1] << endl;
  
  return 0;
}


Measured memory_bytes: 12528
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 3e3 + 5, mod = 998244353;

int n, s, a[N], dp[N][N];

int add(int a, int b){
    a = (a + mod)%mod;
    b = (b + mod) % mod;
    return (a + b) % mod;
}

int mul(int a, int b){
    a = (a + mod) % mod;
    b = (b + mod) % mod;
    return 1LL * a * b % mod;
}

int solve(int idx, int sum){
    if(idx == n) return (sum == s);
    if(dp[idx][sum] != -1) return dp[idx][sum];
    int op1 = 0, op2 = 0;
    op1 = mul(2, solve(idx + 1, sum));
    if(sum + a[idx] <= s) op2 = solve(idx + 1, sum + a[idx]);
    return dp[idx][sum] = add(op1, op2);
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> n >> s;
    for(int i = 0; i < n; i++) cin >> a[i];
    memset(dp, -1, sizeof dp);
    cout << solve(0, 0);


    return 0;

}


Measured memory_bytes: 39128