akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;


//      DEEP

using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define all(v) v.begin(),v.end()
#define pb push_back
#define endl '\n'
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef pair<long long,long long> pll;
typedef set<int> si;


/*
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
*/
/*
typedef tree<
pair<int, int>,
null_type,
less<pair<int, int>>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
*/

const ll mod = 1e9 + 7;
const ll modl=998244353;
const double pie=3.1415926535;
                                                    //power
ull power(ull x,ull y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}

                        //                    Modular Exponentiation

ll mod_power(ll x, ll y, ll m)
{
    ll r = 1;     // Initialize result

    x = x % m; // Update x if it is more than or equal to m

    if (x == 0) return 0; // In case x is divisible by m;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            r = (r*x) % m;

        // y must be even now
        y = y/2;
        x = (x*x) % m;
    }
    return r;
}

                                                      //GCD
ll gcd(ll x,ll y){
   if(y==0)return x;
   return gcd(y,x%y);
}
                                              // SIEVE

/*
bool isPrime[100001];
void sieve(int N) {

        for(int i = 0; i <= N;++i) {
            isPrime[i]=true;
        }
        isPrime[0]=false;
        isPrime[1]=false;

        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
*/


 
int main(){
    boost;
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        int r;
        cin>>r;
        cout<<r*r<<endl;
    }
}












Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int N, M;
  cin >> N >> M;
  vector<int> memo(N);
  vector<int> A(M), B(M);
  for (int i = 0; i < M; i++) {
    cin >> A.at(i) >> B.at(i);
    if (A.at(i) == 1) {
      memo.at(B.at(i) - 1)++;
    }
    if (B.at(i) == 1) {
      memo.at(A.at(i) - 1)++;
    }
  }
  bool ok = false;
  for (int i = 0; i < M; i++) {
    if (A.at(i) == N) {
      if (memo.at(B.at(i) - 1) != 0) {
        ok = true;
        break;
      }
    }
    if (B.at(i) == N) {
      if (memo.at(A.at(i) - 1) != 0) {
        ok = true;
        break;
      }
    }
  }
  if (ok) {
    cout << "POSSIBLE" << endl;
  }
  else {
    cout << "IMPOSSIBLE" << endl;
  }
}

Measured memory_bytes: 5592
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
const ll inf = 1e9;
multimap<string, ll> mp;
int main(){
    int n, m;
    cin >> n;
    set<ll> a;
    rep(i,n){
        ll an; cin >> an;
        a.insert(an);
    }
    cin >> m;
    set<ll> b;
    rep(i,m){
        ll bn; cin >> bn;
        b.insert(bn);
    }

    vector<ll> c;
    set_symmetric_difference(all(a), all(b), back_inserter(c));
    rep(i,c.size())cout << c[i] << endl;
    return 0;
}


Measured memory_bytes: 25812
#include <iostream>
#include <vector>
#include <limits>
#include <queue>

using namespace std;

struct Node {
  int label;
  int weight;

  bool operator>(const Node& other) const{
    return weight > other.weight;
  }
};

using ListGraph = vector<vector<Node>>;


const int max_num = numeric_limits<int>::max();


// priority_queueはpriorityが大きいのもから取り出す。
// デフォルトでは < (less<T>)を要素の比較に用いる。
// lessの場合要素が小さい時に入れ替える、つまりmaxHeapであり、priortyが大きいものから取り出される。

vector<int> shortest_cost(ListGraph &list_graph, int started_label) {
  vector<bool> visited_vertices(list_graph.size() ,false);
  vector<int> costs(list_graph.size(), max_num);
  priority_queue<Node, vector<Node>, greater<Node>> adjacency_costs;

  costs[started_label] = 0;
  adjacency_costs.push({started_label, costs[started_label]});

  while(!adjacency_costs.empty()) {
    Node nearest_node = adjacency_costs.top();
    adjacency_costs.pop();

    if(nearest_node.weight != costs[nearest_node.label]) {
      continue;
    }

    for(int i = 0; i < list_graph[nearest_node.label].size(); i++) {
      Node adjacency = list_graph[nearest_node.label][i];
      if(visited_vertices[adjacency.label]) {
        continue;
      }

      if(costs[nearest_node.label] + adjacency.weight < costs[adjacency.label]) {
        costs[adjacency.label] = costs[nearest_node.label] + adjacency.weight;
        adjacency_costs.push({adjacency.label, costs[adjacency.label]});
      }
    }
  }

  return costs;
}

int main() {
  int vertex_num;
  ListGraph list_graph;
  cin >> vertex_num;
  list_graph.resize(vertex_num);

  for(int i = 0; i < vertex_num; i++) {
    int label, degree;
    cin >> label >> degree;
    list_graph[i].resize(degree);

    for(int j = 0; j < degree; j++) {
      Node adjacency;
      cin >> adjacency.label >> adjacency.weight;

      list_graph[i][j] = adjacency;
    }
  }

  vector<int> costs = shortest_cost(list_graph, 0);

  for(int i = 0; i < costs.size(); i++) {
    cout << i << ' ' << costs[i] << endl;
  }
}



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

using namespace std;

#define ll long long
#define ld long double

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector <int> d(1e5 + 1);
    ll sum = 0; int a, b;
    for (int i = 0; i < n; i++) {
        cin >> a;
        d[a] ++;
        sum += a;
    }
    int q;
    cin >> q;
    for (int i = 0; i < q; i ++) {
        cin >> a >> b;
        sum += d[a] * (b - a);
        d[b] += d[a];
        d[a] = 0;
        cout << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 3728
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <complex>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cwchar>
#include <cwctype>
#include <exception>
#include <locale>
#include <numeric>
#include <new>
#include <stdexcept>
#include <limits>
#include <valarray>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <list>
#include <utility>
#include <bitset>
#include <algorithm>
#include <functional>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int INF = 1e9 + 7;

int ans = INF;
int n, k, q, dat[2005];
set<int> S;

bool check(int lb, int ub)
{
	int hv = 0, cnt = 0, tot = 0;
	for(int i = 0; i <= n; i ++)
	if(dat[i] < lb) {
		if(hv >= k) tot += min(cnt, hv - k + 1);
		hv = 0;
		cnt = 0;
	} else {
		hv ++;
		if(dat[i] <= ub) cnt ++;
	}
	return tot >= q;
}

int main()
{
	scanf("%d%d%d", &n, &k, &q);
	rep(i, n) scanf("%d", &dat[i]);
	rep(i, n) S.insert(dat[i]);
	set<int>::iterator l, r;
	l = r = S.begin();
	while(r != S.end()) {
		if(check(*l, *r)) {
			ans = min(ans, *r - *l);
			if(l == r) r ++;
			l ++;
		} else r ++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#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 REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll A, B;
ll ret = 0;
string s;

int main(void){
  IN(A);
  IN(B);
  IN(N);

  ll r = (N >= B-1) ? B-1 : N;

  PRINT((r * A) / B);
}


Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

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

const int inf = 1001001000;
const int mod = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int digitsum(int i){
    int t = i;
    int ret = 0;
    while(t){
        ret += t%10;
        t /= 10;
    }
    return ret;
}

int main(){
    int n;
    cin >> n;
    int i = 0;
    while(i*i <= n)i++;
    cout << (i-1) * (i-1) << endl; 
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstdlib>
using namespace std;
int main()
{
	long long n;
	cin>>n;
	string ans="";
	while(n)
	{
		n--;
		ans+=	char('a'+n%26);
		n/=26;
	}
	reverse(ans.begin(),ans.end());
	cout<<ans<<'\n';
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
const int INF=1e9+5;
int main() {
long n,h[100000];
cin>>n;
    vector<long>dp(n,INF);
for(long i=0;i<n;i++)
    cin>>h[i];
dp[0]=0;
for(long i=0;i<n;i++)
{
    for(long j:{i+1,i+2})
    {
        if(j<n)
        dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
    }
}
cout<<dp[n-1]<<endl;
}


Measured memory_bytes: 1792
fun binarySearch(array: List<Int>, num: Int): Boolean {
    var left = 0
    var right = array.size
    while (left < right) {
        val mid = (left + right) / 2
        when {
            (array[mid] == num) -> return true
            (num < array[mid]) -> right = mid
            else -> left = mid + 1
        }
    }
    return false
}

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!.split(" ").map(String::toInt)
    if (n != s.size) return
    val q = readLine()!!.toInt()
    val t = readLine()!!.split(" ").map(String::toInt)
    if (q != t.size) return

    var count = 0
    val sortedS = s.sorted()
    t.forEach { num ->
        if (binarySearch(sortedS, num)) count++
    }
    println(count)
}


Measured memory_bytes: 67640
#include <stdio.h>

int M=1000000000+7;

int main(){
  int S;
  scanf("%d", &S);
  long long int A[3000];
  A[0]=0LL;
  A[1]=0LL;
  A[2]=0LL;
  A[3]=1LL;
  for(int i=4;i<=S;i++){
    A[i]=A[i-1]+A[i-3];
    A[i]%=M;
  }
  printf("%lld\n",A[S]);
  return 0;
}

Measured memory_bytes: 1748
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

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

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

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

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

int main(void){
    string s;
    cin >> s;
    ll n;
    cin >> n;

    ll p = 0;
    for(int i = 0; i < s.size() - 1; i++){
        if(s[i] == s[i + 1]){
            p++;
            i++;
        }
    }

    ll ans = p * n;

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

    if(n == 1){
        cout << ans << endl;
        return 0;
    }

    if(s[0] == s[s.size() - 1]){
        int r = 2;
        for(int i = 1; i < s.size(); i++){
            if(s[i] == s[0]){
                r++;
                if(i == s.size() - 1){
                    cout << (ll)(s.size()) * n / 2 << endl;
                    return 0;
                }
            } else {
                break;
            }
        }

        for(int i = s.size() - 2; i >= 0; i--){
            if(s[i] == s[0]){
                r++;
            } else {
                break;
            }
        }

        if(r % 2 == 0){
            ans += n - 1;
        }

    }


    cout << ans << endl;

}


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

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

  vector<double> x( N, 0.0 );
  vector<string> u( N, "" );
  rep( i, 0, N ) cin >> x.at(i) >> u.at(i);

  double Ans = 0.0;

  rep( i, 0, N ) {
    if ( u.at(i) == "JPY" ) Ans += x.at(i);
    else Ans += 380000.0*x.at(i);
  }

  cout << Ans << endl;
}


Measured memory_bytes: 256
// In the name of God

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

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int a;	
	string s;
	cin >> a >> s;
	if(a>=3200) cout << s;
	else cout << "red";
	return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <cstdio>
#include <cstring>
#include <queue>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <map>
#include <complex>
#include <ctime>
#include <numeric>
#include <set>

using namespace std;

typedef long long ll;

typedef struct node{
    int s, e, val, pos;
    bool operator<(const node& n) const{
        if(e != n.e) return e < n.e;
        return val > n.val;
    }
    node(){};
    node(int ss, int ee, int v, int p){
        s = ss, e = ee, val = v, pos = p;
    }
}node;

const ll N = 6e5+5; 
int occs[(int)1e6 + 5], tree[4*N], n, ans[N];

void update(int x, int val){
    while(x <= n){
        tree[x] += val;
        x += x & -x;
    }
}

int query(int x){
    int ret = 0;
    while(x > 0){
        ret += tree[x];
        x -= x & -x;
    }
    return ret;
}

int main()
{
    
    int q, s, e;
    vector<node> v;
   	cin >> n >> q;
    for(int i = 1; i <= n; i++){
        scanf("%d", &s);
        v.push_back(node(i, i, s, -1));
    }
    for(int i = 0; i < q; i++){
        scanf("%d %d", &s, &e);
        v.push_back(node(s, e, 0, i));
    }
    
    sort(v.begin(), v.end());
    
    for(int i = 0;i < v.size(); i++){
        if(v[i].val == 0){
            ans[v[i].pos] = query(v[i].e) - query(v[i].s - 1);
        }else{
            if(occs[v[i].val] != 0) update(occs[v[i].val], -1);
            update(v[i].s, 1);
            occs[v[i].val] = v[i].s;
        }
    }
    
    for(int i = 0; i < q; i++){
        printf("%d\n", ans[i]);
    }
    
    return 0;
}



Measured memory_bytes: 25320
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define rep(index,num) for(int index=0;index<num;index++)
#define eps 1e-15
typedef long long ll;
int main(){
	int a,b,h;
	scanf("%d %d %d",&a,&b,&h);
	printf("%d\n",(a+b)*h/2);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;
const long long int INF=1000000000000000000;
int main(){
	long long int N;
	cin>>N;
	vector<long long int>A(N+1,0);
	vector<long long int>Sum(N+1,0);
	vector<vector<long long int>>DP(N+1,vector<long long int>(N+1,INF));
	long long int i,j,k;
	for(i=1;i<=N;i++){
		cin>>A[i];
		Sum[i]=Sum[i-1]+A[i];
		DP[i][i]=0;
	}
	for(k=1;k<N;k++){
		for(i=1;i+k<=N;i++){
			for(j=0;j<k;j++){
				DP[i][i+k]=min(DP[i][i+k],DP[i][i+j]+DP[i+j+1][i+k]+Sum[i+k]-Sum[i-1]);
			}
		}
	}
	cout<<DP[1][N];
}


Measured memory_bytes: 1536
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

public:
    class proxy
    {
        std::ostream& cout;

    public:
        proxy() : cout(std::cout) {}
        ~proxy() { cout << '\n'; }
        template <class T>
        proxy& operator,(T&& val)
        {
            cout << ' ' << val;
            return *this;
        }
    };

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class T>
    proxy operator<<(T&& val)
    {
        cout << val;
        return {};
    }

    template <class T>
    void print(const T& container)
    {
        bool first = true;
        for (auto&& x : container) {
            if (!first) {
                cout << ' ';
                first = false;
            }
            cout << x;
        }
    }
};

int main()
{
    input in;
    output out;

    int N, K;
    in >> N, K;
    int res = 0;
    in.online<int>(N, [&](int h) {if (K<=h)++res; });

    out << res;

    return 0;
}


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

signed main() {
  int N; cin >> N;
  int A;
  map<int, int> bou;
  rep(i, N) {
    cin >> A;
    bou[-A]++;
  }
  
  int ans = 1;
  int i = 0;
  for(auto b : bou) {
    while(b.second >= 2) {
      b.second -= 2;
      ans *= b.first;
      i++;
      if(i == 2) {
        cout << ans << endl;
        return 0;
      }
    }
  }
  cout << 0 << endl;

}

Measured memory_bytes: 6528
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


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

    ll n;
    cin >> n;
    cout <<"ABC"<<n<<endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			
			final int mod = N % 10;
			
			if(mod == 3) {
				System.out.println("bon");
			}else if(mod == 0 || mod == 1 || mod == 6 || mod == 8) {
				System.out.println("pon");
			}else {
				System.out.println("hon");
			}
			
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}


Measured memory_bytes: 32684
#include<bits/stdc++.h>
using namespace std;
struct edge{
  int to, cost;
};
bool used[10000];
int dfs(int r, vector<vector<edge> > &g, int val = 0){
  //std::cout << "r:" << r << " val:" << val << std::endl;
  // if(g[r].size() == 1){
  //   return val;
  // }
  int res = 0;
  for(int i = 0; i < g[r].size(); i++){
    if(used[g[r][i].to] || g[g[r][i].to].size() == 1)continue;
    used[g[r][i].to] = true;
    res = max(res, dfs(g[r][i].to, g, val + g[r][i].cost));
    used[g[r][i].to] = false;
  }
  return max(res, val);
}
  
int main(int argc, char *argv[]){
  int n;
  while(cin >> n, n){
    vector<vector<edge> > g(n);
    edge e[n];
    for (int i = 0; i < n - 1; i++) {
      cin >> e[i].to;
      e[i].to--;
    }
    int sum = 0;
    for (int i = 0; i < n - 1; i++) {
      cin >> e[i].cost;
      sum += e[i].cost;
      g[i + 1].push_back(e[i]);
      g[e[i].to].push_back((edge){i + 1, e[i].cost});
    }
    // for (int i = 0; i < n; i++) {
    //   std::cout << "g[" << i << "]:" << std::endl;
    //   for (int j = 0; j < g[i].size(); j++) {
    //     std::cout << g[i][j].cost << " ";
    //   }
    //   std::cout << std::endl;
    // }
    // std::cout << std::endl;
    sum *= 3;
    int diam = 0, leaf = 0;
    for(int i = 0; i < n; i++){
      if(g[i].size() == 1){
        leaf += g[i][0].cost;
        continue;
      }
      memset(used, 0, sizeof(used));
      used[i] = true;
      diam = max(diam, dfs(i, g));
    }
    // cout << "sum:" << sum << endl;
    // cout << "diam:" << diam << endl;
    // cout << "leaf:" << leaf << endl;
    std::cout << sum - diam - 2*leaf << std::endl;
  }
  return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}

struct P {
  int val, pos;
  bool operator < (const P& o) const {
    return val < o.val;
  }
};

int main2() {
  int N = nextInt();
  vector<int> A(N), B(N);
  REP(i, N) A[i] = nextInt();
  REP(i, N) B[i] = nextInt();

  ll ans = 0;
  priority_queue<P> pq;
  REP(i, N) {
    if (A[i] < B[i]) pq.push((P){B[i], i});
    if (A[i] > B[i]) ans = -1;
  }
  if (ans == -1) {
    cout << ans << endl;
    return 0;
  }

  while (!pq.empty()) {
    P p = pq.top(); pq.pop();
    int k = B[(p.pos - 1 + N) % N] + B[(p.pos + 1 + N) % N];
    int t = max(1, (B[p.pos] - A[p.pos]) / k);
    ans += t;
    B[p.pos] -= t * k;

    if (B[p.pos] < A[p.pos]) {
      ans = -1;
      break;
    }

    if (B[p.pos] > A[p.pos]) {
      pq.push((P){B[p.pos], p.pos});
    }

  }

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

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 3956
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
 
using namespace std;

void solve()
{
	int n,m;
	scanf("%d%d", &n, &m);
	vector<int> a(m), p(m);
	int i,j;
	for (i = 0; i < m; i++) {
		int num;
		scanf("%d", &num);
		for (j = 0; j < num; j++) {
			int tmp;
			scanf("%d", &tmp); tmp--;
			a[i] += (1 << tmp);
		}
	}
	for (i = 0; i < m; i++) {
		scanf("%d", &p[i]);
	}
	int cnt = 0;
	int k;
	for (i = 0; i < (1 << n); i++) {
		for (j = 0; j < m; j++) {
			int add = 0;
			for (k = 0; k < n; k++) {
				if (a[j] & (1 << k)) {
					if (i & (1 << k)) {
						add++;
					}
				}
			}
			if (add % 2 != p[j])
				break;
		}
		if (j == m)
			cnt++;
	}
	printf("%d\n", cnt);


    return;
}


int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int p,n;
  int max=0;
  cin>>p>>n;
  int arr[n];
  for(int i=0;i<n;i++)
    cin>>arr[i];
  for(int j=1;j<n;j++)
  {
    int n=arr[j]-arr[j-1];
    if(max<n)
      max=n;
  }
  int s=(p-arr[n-1])+arr[0];
  if(max<s)
    max=s;
  cout<<(p-max)<<"\n";
    
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <bitset>

using namespace std;

const double EPS = 1e-9;

struct P3 {
    double x, y, z;
    P3() {}
    P3(double x, double y, double z) : x(x), y(y), z(z) {}
};

P3 operator +(const P3 &a, const P3 &b) {
    return P3(a.x+b.x, a.y+b.y, a.z+b.z);
}

P3 operator -(const P3 &a, const P3 &b) {
    return P3(a.x-b.x, a.y-b.y, a.z-b.z);
}

double dot(const P3 &p, const P3 &q) {
    return p.x*q.x + p.y*q.y + p.z*q.z;
}

P3 cross(const P3 &a, const P3 &b) {
    return P3(a.y*b.z - b.y*a.z, a.z*b.x - b.z*a.x, a.x*b.y - b.x*a.y);
}

double abs(const P3 &p) {
    return sqrt(dot(p, p));
}

istream& operator >>(istream &is, P3 &p) {
    return is >> p.x >> p.y >> p.z;
}

// line(a, b) and c
double dist(const P3 &a, const P3 &b, const P3 &c) {
    if(dot(c-a, b-a) <= 0) return abs(c-a);
    if(dot(c-b, a-b) <= 0) return abs(c-b);
    return abs(cross(c-a, b-a)) / abs(b-a);
}

struct Sphere {
    P3 center;
    double r;
};

bool intersect(const P3 &a, const P3 &b, const Sphere &s) {
    const double d_ca = abs(s.center-a);
    const double d_cb = abs(s.center-b);
    if(d_ca < s.r+EPS && d_cb < s.r+EPS) return false;
    return dist(a, b, s.center) < s.r + EPS;
}

bool solve() {
    int N, M, R;
    cin >> N >> M >> R;
    if(!N && !M && !R) return false;

    vector<Sphere> balloons(N);
    vector<P3> lights(M);
    vector<double> brightness(M);
    for(int i = 0; i < N; ++i) {
        cin >> balloons[i].center >> balloons[i].r;
    }
    for(int i = 0; i < M; ++i) {
        cin >> lights[i] >> brightness[i];
    }
    P3 target;
    cin >> target;

    vector<bitset<2000>> dependency(M);
    for(int i = 0; i < M; ++i) { // lights[i]
        for(int j = 0; j < N; ++j) { // balloons[j]
            if(intersect(lights[i], target, balloons[j])) {
                dependency[i][j] = true;
            }
        }
    }
    double ans = 0;
    for(int pat = 0; pat < (1<<M); ++pat) {
        bitset<2000> to_remove;
        for(int i = 0; i < M; ++i) {
            if(pat & (1<<i)) {
                to_remove |= dependency[i];
            }
        }
        if(to_remove.count() > R) continue;

        double res = 0;
        for(int i = 0; i < M; ++i) { // lights[i]
            if((to_remove & dependency[i]) == dependency[i]) {
                //cout << pat << " " << i << endl;
                const P3 d = lights[i] - target;
                res += brightness[i] / dot(d, d);
            }
        }
        ans = max(ans, res);
    }
    printf("%.6f\n", ans);
    return true;
}

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

    while(solve()) ;
    return 0;
}

Measured memory_bytes: 1312
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define df 0
int dc=100000;
#define MAX 100010
int ans[MAX]={};

int main(){
  if(df)printf("*** debug mode ***\n");
  char str[MAX];
  scanf(" %s",str);
  int i;
  char temp='R';
  int count=0,j=0,len=strlen(str);
  if(df)printf("len:%d   %s\n",len,(0<len)?"xxx":"yyy");
  for(i=0;i<len;i++) {
    
    if(df)printf("(%c,%c)\n",str[i],temp);
    
    if (temp==str[i]) {
      count++;
      continue;
    }
    if(temp=='R'){
      j=i;
      ans[j]+=count/2;
      ans[j-1]+=(count+1)/2;
      if(df)printf("R->L,%d/%d\n",(count+1)/2,count/2);
    }else{
      if(df)printf("L->R,%d/%d(%d)\n",(count)/2,(1+count)/2,count);
      ans[j-1]+=count/2;
      ans[j]+=(count+1)/2;
    }
    count=1;
    temp=str[i];
  }
  
  ans[j-1]+=count/2;
  ans[j]+=(count+1)/2;
  for(i=0;i<strlen(str);i++)
    printf("%d ",ans[i]);
  return 0;
}


/// confirm df==0 ///


Measured memory_bytes: 896
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val MOD = 998244353L
    val (N, S) = nextIntList()
    val A = listOf(0) + nextIntList()
    val dp = Array(N + 1) { LongArray(S + 1) }
    dp[0][0] = 1L
    for (n in 1..N) {
        for (s in 0..S) {
            dp[n][s] = (dp[n - 1][s] * 2L) % MOD
            if (s - A[n] >= 0) dp[n][s] = (dp[n][s] + dp[n - 1][s - A[n]]) % MOD
        }
    }
    println(dp[N][S])
}

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

#define REP(i,n) for(decltype(n) i=0; i<(n); ++i)
#define ALL(c) (c).begin(), (c).end()
#define st first
#define nd second
#define pb push_back

typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long long ll;

void solve(){
    int n,m,k;
    cin>>n>>m>>k;
    for(int a=0;a<=n;++a){
        int rh = k-a*m;
        int lh = n-2*a;
        if(lh == 0){
            if(rh == 0){
                cout<<"Yes\n";
                return;
            }
            continue;
        }
        if(rh % lh == 0 && rh/lh >= 0 && rh/lh <= m){
            cout<<"Yes\n";
            return;
        }
    }
    cout<<"No\n";
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    int a, b, c, x;
    cin >> a >> b >> c >> x;

    int count = 0;

    for (int i = 0; i <= a; i++) {
        for (int j = 0; j <= b; j++) {
            for (int k = 0; k <= c; k++) {
                if (i * 500 + j * 100 + k * 50 == x) {
                    count++;
                }
            }
        }
    }

    cout << count << endl;

    return 0;
}

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

using namespace std;
namespace Fast {

char buf[1 << 21], buf2[1 << 21], a[20];
char *p1 = buf, *p2 = buf;
void read() {}
inline int getc() {
    return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++;
}
template <typename T, typename... T2>
inline void read(T &x, T2 &... oth) {
    bool f = false;
    x = 0;
    char ch = getchar();
    while (!isdigit(ch)) {
        if (ch == '-')
            f = true;
        ch = getchar();
    }
    while (isdigit(ch)) {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    x = f ? -x : x;
    read(oth...);
}
} // namespace Fast

typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define debug printf("(hao)")
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define clr(a, v) memset(a, v, sizeof(a))
using Fast::read;

const int M = 2e5 + 10;

/*===========================================================================*/
void solve() {
    int n;
    read(n);
    int ans = n % 1000;
    if (ans) {
        printf("%d\n", 1000 - ans);
        return;
    }
    printf("0\n");
}
/*===========================================================================*/

int main() {
    std::ios::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
    freopen("test.in", "r", stdin);
    freopen("test.out", "w", stdout);
#endif
    // int T;
    // read(T);
    // while (T--)
    solve();
    return 0;
}

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

int main(){
    int n,k; cin >> n >> k;
    vector<int> l(n);
    int sum = 0;
    for(int i=0;i<n;i++){
        cin >> l[i];
        sum += l[i];
    }
    sort(l.begin(),l.end());
    int ans = 0;
    for(int i=0;i<n-k;i++){
        ans += l[i];
    }
    cout << sum-ans << endl;

}



Measured memory_bytes: 256
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; ansli = []; tmpli = []; candili = []
eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]

n = i()
a = [0] + wi()
listb = []
zo = [0] * (n + 1)
re = 1
for i in range(n, 0, -1):
    re = 2
    s = 0
    while True:
        if i * re > n:
            re -= 1
            if (s + a[i]) % 2 == 1:
                listb.append(i)
                zo[i] = 1
            break
        else:
            s += zo[i * re]
            re += 1

print(len(listb))
for i in range(len(listb)):
    print(listb[-i-1])

Measured memory_bytes: 98000
import sys
from bisect import bisect_right

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    N, *A = map(int, read().split())

    vec = [INF] * N
    for a in reversed(A):
        vec[bisect_right(vec, a)] = a

    print(N - vec.count(INF))
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 14092
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;
ll dp[110][10], num[8][8];

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

	int mod = 1e9 + 7;
	int H, W, K;
	cin >> H >> W >> K;
	memset(num, 0, sizeof(num));
	memset(dp, 0, sizeof(dp));

	for(int mask = 0; mask < 1 << (W - 1); mask++) {
		bool flag = true;
		rep(i, 0, W - 2) {
			if(mask & 1 << i and mask & 1 << (i + 1)) {
				flag = false;
				break;
			}
		}

		if(!flag) continue;

		vector<int> P(W);
		rep(i, 0, W) P[i] = i;

		rep(i, 0, W - 1) {
			if(mask & 1 << i) swap(P[i], P[i + 1]);
		}

		rep(i, 0, W) num[i][P[i]]++;
	}

	dp[0][0] = 1;
	rep(i, 0, H) rep(j, 0, W) rep(k, 0, W) {
		(dp[i + 1][k] += (dp[i][j] * num[j][k] % mod)) %= mod;
	}

	cout << dp[H][K - 1] << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ignore ignore
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define bitcount(x)  __builtin_popcount(x)
#define bitcountll(x)  __builtin_popcountll(x)
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define YES printf("YES\n")
#define NO printf("NO\n")
#define yes printf("Yes\n")
#define no printf("No\n")
#define lin printf("\n")
// Iterator
#define rep(i,n) for(i=0;i<n;++i)
#define rrep(i,n) for(i=n-1;i>=0;--i)
#define lp(i,a,b) for(i=a;i<b;++i)
#define rlp(i,a,b) for(i=a;i>=b;--i)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// function
#define sz(x) x.size()
#define inrange(i,a,b) (i>=a && i<=b)
#define FLUSH fflush(stdout)
#define precision(x) cout << setprecision(x) << fixed
#define remax(a,b) a=max(a,b)
#define remin(a,b) a=min(a,b)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
// Constant
const double PI = acos(-1);
const double eps = (1e-9);
const ll INF = 2e15;
const int M = (1e9)+7;
const ll N = (2e5)+1;  // check the limit, man
int main()
{
    int n,m,k,x;
    in3(n,m,k);
    x=max(n,m);
    out(k/x+min(1,k%x));
}






Measured memory_bytes: 256
def fun(i,j):
	# print(i,j)
	if i>j or i>=n or j<0:
		return 0
	elif i==j:
		dp[i][j]=arr[i]
		return dp[i][j]
	else:
		if dp[i][j]==0:
			dp[i][j]=max(arr[i]+min(fun(i+1,j-1),fun(i+2,j)),arr[j]+min(fun(i+1,j-1),fun(i,j-2)))
		return dp[i][j]
n=int(input())
dp=[0]*n
for i in range(n):
	dp[i]=[0]*n
arr=list(map(int,input().split()))

for i in range(n-1,-1,-1):
	for j in range(i,n,1):
		if i==j:
			dp[i][j]=arr[i]
		else:
			dp[i][j]=max(arr[i]-dp[i+1][j],arr[j]-dp[i][j-1])
		# print(dp[i])
print(dp[0][n-1])
# print(2*fun(0,n-1)-sum(arr))

Measured memory_bytes: 112988
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime> 
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

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

	string s;
	cin >> s;
	int c = 0;
	for (auto x : s) {
		c += (x - '0');
	}
	if (c % 9 == 0) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
}

Measured memory_bytes: 3368
#include <bits/stdc++.h>
using namespace std;
long long L[100];

int main(){
  int n;
  cin >> n;
  L[0]=2;
  L[1]=1;
  for (int i=2;i<=n;++i){
    L[i]=L[i-1]+L[i-2];
  }
  cout << L[n] << endl;
  return 0;
}
  


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 200000


int main(){
  int R[MAX],n,i;
  scanf("%d",&n);

  for(i=0;i<n;i++)
    scanf("%d",&R[i]);
  int max=-2000000000;
  int min=R[0];

  for(i=1;i<n;i++){
    if(max<R[i]-min)
      max=R[i]-min;
   
    if(min>R[i])
      min=R[i];
   
  }
  printf("%d\n",max);
  return 0;
}



Measured memory_bytes: 3480
n = [int(input()) for i in range(5)]
m = 10
x = n[0]
#1の位が最も小さいものはそのまま足す・残りは1の位を切り上げて足す

for i in n:
  if int(str(i)[-1]) < m and int(str(i)[-1]) > 0:
    m = int(str(i)[-1])
    x = i



n.remove(x)
    
for i in range(len(n)):
  if n[i]%10 != 0:
    n[i] = n[i] + 10 - int(str(n[i])[-1])

print(sum(n) + x)

Measured memory_bytes: 3064
fun main(args: Array<String>) {
    val n= readLine()!!.toInt()
    var t = arrayOfNulls<Int>(n+1)
    var x = arrayOfNulls<Int>(n+1)
    var y = arrayOfNulls<Int>(n+1)
    t[0] = 0
    x[0] = 0
    y[0] = 0
    for( i in 1..n){
        var s = readLine()!!.split(" ").map{ num -> num.toInt()}
        t[i] = s[0]
        x[i] = s[1]
        y[i] = s[2]
    }

    var isOK = true

    for( i in 0..n-1){
        var abst = t[i + 1]!! - t[i]!!
        var absx = Math.abs(x[i + 1]!! - x[i]!!)
        var absy = Math.abs(y[i + 1]!! - y[i]!!)
        if( abst < absx + absy || abst % 2 != (absx + absy) % 2) {
            isOK = false
            break
        } else {
            continue
        }
    }
    println( if(isOK) "Yes" else "No")
}


Measured memory_bytes: 60968
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>

using namespace std;

typedef long long int int64;

#define NMAX 15
int x[NMAX][NMAX], y[NMAX][NMAX], A[NMAX];
int flag[15];

int search(int target, int N)
{
    if (target == N) {
        // validation
        for (int i = 0; i < N; ++i) {
            if (flag[i] == 1) {
                for (int j = 0; j < A[i]; ++j) {
                    if (y[i][j] != flag[x[i][j] - 1]) {
                        return 0;
                    }
                }
            }
        }
        int count = 0;
        for (int i = 0; i < N; ++i) if (flag[i] == 1) count++;
        return count;
    }
    else {
        flag[target] = 1;
        int hCount = search(target + 1, N);
        flag[target] = 0;
        int lCount = search(target + 1, N);
        return max(hCount, lCount);
    }
}

int main(int argc, char **argv)
{
    int N;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        for (int j = 0; j < A[i]; ++j) {
            cin >> x[i][j] >> y[i][j];
        }
    }

    for (int i = 0; i < N; ++i) flag[i] = 0;
    cout << search(0, N) << endl;
    return 0;
}


Measured memory_bytes: 256
L = []
L.append(list("abcde"))
L.append(list("fghij"))
L.append(list("klmno"))
L.append(list("pqrst"))
L.append(list("uvwxy"))
L.append(list("z.?! "))

while True:
    try:
        tmp = input()
        l = [int(x)-1 for x in list(tmp)]
    except:
        break
    if len(l) % 2 > 0:
        print("NA")
        continue

    ferr = 0
    M = []
    for i, j in zip(l[0::2],l[1::2]):
        if i not in range(len(L)) or j not in range(len(L[0])):
            ferr += 1
        else:
            M.append(L[i][j])
    if ferr > 0:
        print("NA")
    else:
        print("".join(M))




Measured memory_bytes: 5608
#include<iostream>

using namespace std;

int main()
{
	const int maxn = 105;
	int N;
	int A[maxn];
	bool a = true;
	string ans;


	cin >> N;
	for (int ii = 0; ii < N; ii++)
	{
		cin >> A[ii];
	}

	for (int ii = 0; ii < N; ii++)
	{
		if ((A[ii] % 2 == 0) && (A[ii] % 3 != 0) && (A[ii] % 5 != 0)) a = false;
	}

	if (a) ans = "APPROVED";
	else ans = "DENIED";

	cout << ans;

	return 0;
}

Measured memory_bytes: 256