akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
#define Pos(i) cout<<(i?"Possible":"Impossible")<<endl
#define co(i) cout<<i<<endl
#define fcout cout<<fixed<<setprecision(10)
#define uni(i) i.erase(unique(i.begin(), i.end()), i.end());
using namespace std;

const int INF=1e9+7;
const int MOD=1e9+7;

int main(){
	int n; cin>>n;
	int a[50],b[50];
	FOR(i,0,n) cin>>a[i];
	FOR(i,0,n) cin>>b[i];
	int use[51];
	fill(use,use+51,1);
	bool flag=false;
	ROF(p,0,51){
		//cost[s][t]はsからtへ変えるのに必要な最大のk
		use[p]=0;
		int cost[51][51];
		FOR(i,0,51) FOR(j,0,51){
			cost[i][j]=1;
		}
		FOR(i,1,51) FOR(j,i,51){
			if(use[i]) cost[j][j%i]=0;
		}
		FOR(k,0,51) FOR(i,0,51) FOR(j,0,51){
			cost[i][j]=min(cost[i][j],max(cost[i][k],cost[k][j]));
		}
		FOR(i,0,51) cost[i][i]=0;
		int t=0;
		FOR(i,0,n){
			t=max(t,cost[a[i]][b[i]]);
		}
		if(t)use[p]=1;
		if(t&&p==50) flag=true;
	}
	ll ans=0;
	FOR(i,0,51) if(use[i])ans+=(ll)1<<i;
	co((flag?-1:ans));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
#define DBG false
using namespace std;

int main(){
    int a, b, c;
    int K;
    lli sum = 0;
    cin >> K;
    K++;
    for(int a=1; a<K; a++){
        for(int b=1; b<K; b++){
            for(int c=1; c<K; c++){
                sum += __gcd(__gcd(a, b), c);
            }
        }
    }
    cout << sum << endl;
}

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

int digit(int a)
{
	int ret = 0;
	while(a)
	{
		a/=10;ret++;
	}
	return ret;
}

int main()
{
	int x,y;
	while(cin >> x >> y && x != EOF)
		cout << digit(x+y) << endl;
}

Measured memory_bytes: 0
object Main extends App {
  val array: Array[Long] = readLine().split(' ').map(_.toLong)
  val A = array(0)
  val B = array(1)
  val K = array(2)

  if (A + B <= K) {
    println("0 0")
  } else if (A >= K) {
    println((A - K).toString + " " + B.toString)
  } else {
    println("0 " + (A + B - K).toString)
  }
}


Measured memory_bytes: 27080
#include <iostream>
#include <unordered_map>
#include <algorithm>
#include <math.h>
using namespace std;

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

    unordered_map<long, long> valRoots;

    for (int i = 0; i < 100000; i++) {
        valRoots[pow(i,5)] = i;
    }

    long A = 0, B = 0;
    for (int i = 0; i < 100000; i++) {
        A = i;
        long tmpB = abs(pow(A,5)-X);

        // キーの存在チェック
        if ( tmpB == 0 ) {
          	B = 0;
            break;
        } else if (valRoots[tmpB]>0){
            B = valRoots[tmpB];
            if(pow(A,5)-X<0) B*= -1L;
            break;
        }
    }
        
    cout << A << " " << B << endl;
    return 0;
}


Measured memory_bytes: 4456
from sys import stdin
from sys import setrecursionlimit

setrecursionlimit(10 ** 7)

n = int(stdin.readline().rstrip())
a = list(map(int,stdin.readline().rstrip().split()))

dic = {}
point = 0

for i,j in enumerate(a):
    if i+j in dic:
        dic[i+j] += 1
    else:
        dic[i+j] = 1

for i,j in enumerate(a):
    if i-j in dic:
        point += dic[i-j]

print(point)

Measured memory_bytes: 40548
#include <bits/stdc++.h>
using namespace std;
vector <int> v;
map <int, int> m;
int main ()
{
	int a, b, k;
	cin >> a >> b >> k;
	set <int> s;
	for(int i = a; ; i++) 
	{
		if(i < a + k && i <= b) cout << i << endl, m[i] = 1;
		else break;
	}
	for(int i = b; ; i--)
	{
		if(i > b - k && !m.count(i) && i >= a) v.push_back(i);
		else break;
	}
	sort(v.begin(), v.end());
	for(int i = 0; i < v.size(); i++)  cout << v[i] << endl;
}

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

using namespace std;

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

	int a = 0;

	if (s[0] == 'o')a++;
	if (s[1] == 'o')a++;
	if (s[2] == 'o')a++;

	cout << 700 + a * 100 << endl;

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll mod=1e9+7;

int main(){
    ll a,b;
    cin >> a >> b;
    ll c=a+b;
    a%=3;
    b%=3;
    c%=3;
    if(a==0 || b==0 || c==0){
        cout << "Possible" << endl;
    }
    else{
        cout << "Impossible" << endl;
    }
    return 0;
} 


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

// a^n mod を計算する
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    int N;
    cin >> N;
    int D[N];
    ll mod = 998244353;
    ll d[N]{};
    for (int i = 0; i < N; i++) {
        cin >> D[i];
        d[D[i]]++;
    }
    ll ans = 1;
    bool flag = false;
    for (int i = N - 1; i >= 1; i--) {
        if (d[i] != 0) {
            flag = true;
        }
        if (flag && d[i] == 0) {
            cout << "0\n";
            return 0;
        }
    }
    if (d[0] != 1) {
        cout << "0\n";
        return 0;
    }
    if (D[0] != 0) {
        cout << "0\n";
        return 0;
    }
    for (int i = 1; i < N; i++) {
        ans *= modpow(d[i - 1], d[i], mod);
        ans %= mod;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <cstring>
using namespace std;

#ifdef ENABLE_LL
#define int long long
#endif

#ifdef ENABLE_LL
#define I "%lld"
#define II "%lld%lld"
#define III "%lld%lld%lld"
#define IIII "%lld%lld%lld%lld"
#define IN "%lld\n"
#define IIN "%lld%lld\n"
#define IIIN "%lld%lld%lld\n"
#define IIIIN "%lld%lld%lld%lld\n"
#else
#define I "%d"
#define II "%d%d"
#define III "%d%d%d"
#define IIII "%d%d%d%d"
#define IN "%d\n"
#define IIN "%d%d\n"
#define IIIN "%d%d%d\n"
#define IIIIN "%d%d%d%d\n"
#endif

#ifdef __LOCALE__
#define see(a) std::cout << #a << "=" << a << std::endl
#define ses(a) std::cout << #a << "=" << a << " " 
#else
#define see(a) //std::cout << #a << "=" << a << std::endl
#define ses(a)
#endif
#define repe(a,b) for (int a=0;a<(int)b.size();a++)
#define rep(i,n) for (int i=0;i<n;i++)
#define repa(i,n) for (int i=1;i<=n;i++)
#define repi(i,a,b) for (int i=a;i<=b;i++) 
#define repb(i,a,b) for (int i=a;i>=b;i--)
typedef pair < int , int > pr;
typedef pair < pr  , int > prr;
#define L first
#define R second
template <class T> inline bool checkMin(T& a , T b) { return (a > b ? a=b,1 : 0); }
template <class T> inline bool checkMax(T& a , T b) { return (a < b ? a=b,1 : 0); }
class Scanner{ private: istream& ist;public: Scanner(istream& in):ist(in){} string next(){ string r; ist >> r; return r; } string nextLine(){ string r; getline(ist,r); return r; } int nextInt(){ int r; ist >> r; return r; } double nextDouble(){ double r; ist >> r; return r; }};
Scanner sc(cin);

int n;
vector < int > a, b;

void init() {
    scanf(I,&n);
    rep (i,n) a.push_back(sc.nextInt());
    rep (i,n) b.push_back(sc.nextInt());
}

int kth (vector < int > u) {
    int ans = 0;
    vector < int > s; rep (i,n) s.push_back(i+1);
    while (u != s) {
        ans++;
        next_permutation(s.begin(), s.end());
    }
    see(ans);
    return ans;
}

void solve() {
    printf(IN,abs(kth(a) - kth(b)));
}


#ifdef ENABLE_LL
#undef int
#endif
int main(){
    init();
    solve();
    return 0;
}


Measured memory_bytes: 256
import heapq

n, m = map(int, input().split())
a_list = []
for i in input().split(): heapq.heappush(a_list, -int(i))

for x in range(m):
	tmp = heapq.heappop(a_list) / 2
	heapq.heappush(a_list, tmp)

print(sum([int(-x // 1) for x in a_list]))

Measured memory_bytes: 14180
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
    int N;
    int a[100];
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    sort(a,a+N);
    
    int count=1;
    for(int i=0;i<(N-1);i++){
        if(a[i]!=a[i+1]){
            count+=1;
        }
        
    }
    
    cout<<count<<endl;
    
    return 0;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

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

  REP(i,k) {
    if (b <= a) b*=2;
    else c*=2;
  }
  bool ans = a < b && b < c;
  Yes(ans);

  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, a;
  cin >> n >> a;
  if (n % 500 == 0) {
  	cout << "Yes";
  } else if (n % 500 <= a) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCoder
{
	public class ABC
	{
		static public void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
			Solve(args);
			Console.Out.Flush();
		}

		private const int mod = 1000000007;  // 10^9+7

		static public void Solve(string[] args)
		{
			//string s = Console.ReadLine();
			//int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int n = vs[0];
			int m = vs[1];
			int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();

			long ans = n;
			for (int i = 0; i < m; i++) {
				ans -= a[i];
			}
			if (ans < 0) {
				ans = -1;
			}
			Console.WriteLine(ans);
		}

	}
}


Measured memory_bytes: 29248
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace debug
{

    class ProgramA
    {
        static void Main(string[] args)
        {
            //入力
            string[] s = Console.ReadLine().Split(' ');
            long a = long.Parse(s[0]);
            long b= long.Parse(s[1]);
            long c = long.Parse(s[2]);
            long k = long.Parse(s[3]);

            //もしABCならARC,ARCならABC
            if(a >= k)
                Console.WriteLine(k);
            else if(a + b >= k)
                Console.WriteLine(a);
            else
                Console.WriteLine(a - (k - a -b));

        }
    }
}


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

#define N 200100
#define ll long long

int cnt[60][30];

int main()
{
	int n;
	ll ans = 0;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		double x;
		scanf("%lf", &x);
		ll v = x * 1e9 + .5;
		int num2 = 0, num5 = 0;
		while (v % 2 == 0) {
			num2++;
			v /= 2;
		}
		while (v % 5 == 0) {
			num5++;
			v /= 5;
		}
		num2 = min(num2, 18);
		num5 = min(num5, 18);
		for (int i = 18 - num2; i <= 18; i++)
			for (int j = 18 - num5; j <= 18; j++)
				ans += cnt[i][j];
		cnt[num2][num5]++;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

class RMQ {
private:
    vector<ll> val;
    int N;
public:
    RMQ(int n, ll init);
    void update(int i, int x);
    ll find(int r, int l, int fn, int fr, int fl);
    ~RMQ();
};

RMQ::RMQ(int n, ll init) {
    N = n;
    val.resize(2*N-1, init);
}

void RMQ::update(int i, int x) {
    i += N-1;
    val[i] = x;
    while (i > 0) {
        i = (i-1)/2;
        val[i] = min(val[i*2+1], val[i*2+2]);
    }
}

ll RMQ::find(int a, int b, int k, int l, int r) {
    // [a, b)のクエリ
    // ノードk(区間[a, b)担当)が答える
    if (b <= l || r <= a) return LINF; // 区間がかぶらなければLINF
    if (a <= l && r <= b) return val[k]; // 区間が完全にかぶっていればval[k]
    else {
        // 一部だけかぶる場合は左右の子に委託する
        ll c1 = find(a, b, 2*k+1, l, (l+r)/2);
        ll c2 = find(a, b, 2*k+2, (l+r)/2, r);
        return min(c1, c2);
    }
}

RMQ::~RMQ() {
}

// --------------cut above!!------------------ //

int main(int argc, char const *argv[]) {
    int n, q;
    cin >> n >> q;
    int N = 1;
    while (N < n) {
        N*=2;
    }
    RMQ seg(N, (1ll<<31)-1);
    
    REP(i,q) {
        int c;
        cin >> c;
        if (c == 0) {
            int ind, x;
            cin >> ind >> x;
            seg.update(ind, x);
        }
        else {
            int s,t;
            cin >> s >> t;
            ll ans = seg.find(s,t+1,0,0,N);
            cout << ans << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 4912
//
//  main.cpp
//  ABC120
//
//  Created by hiroaki on 2019/03/13.
//  Copyright © 2019年 hiroaki. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int gcd(int x, int y){
    int a = max(x, y);
    int b=min(x,y);
    int r=a%b;
    
    while (r!=0) {
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}
int main() {
    int a,b,k,n;
    cin >>a>>b>>k;
    vector<int> v;
     n = gcd(a, b);
    for (int i=0; i*i <= n; i++) {
        if (n%(i+1)==0) {
            if (i+1==n/(i+1)) {
                v.push_back(i+1);
            }else {
                v.push_back(i+1);
                v.push_back(n/(i+1));
                
            }
        }
    }
    sort(v.begin(), v.end());
    cout<<v[v.size()-k]<<endl;
    return 0;
}


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

struct UnionFind {
  vector<int> par;
  int n, cnt;
  UnionFind(const int& x = 0) {
    init(x);
  }

  void init(const int& x) {
    par.assign(cnt = n = x, -1);
  }

  inline int find(const int& x) {
    return par[x] < 0 ? x : find(par[x]);
  }

  inline bool same(const int& x, const int& y) {
    return find(x) == find(y);
  }

  inline bool unite(int x, int y) {
    x = find(x); y = find(y);

    if (x != y) {
      if (par[x] > par[y]) swap(x, y);
      par[x] += par[y];
      par[y] = x;
      cnt--;
      return true;
    }

    return false;
  }

  inline int count() {
    return cnt;
  }

  inline int count(int x) {
    return -par[find(x)];
  }
};

struct Edge {
  int u;
  int v;
  double cost;

  Edge(int u, int v, double cost): u(u), v(v), cost(cost) {}
  Edge(): u(0), v(0), cost(0.0) {}

  bool operator<(const Edge& other) const {
    return cost < other.cost;
  }
};

int square(int x) {
  return x * x;
}

int main()
{
  int N, M; scanf("%d%d", &N, &M);
  vector<int> X(N), Y(N);
  vector<Edge> es(M);
  double sum = 0.0;
  double cut = 0.0;
  UnionFind uf(N);

  for (int i = 0; i < N; i++) {
    scanf("%d%d", &X[i], &Y[i]);
  }

  for (int i = 0; i < M; i++) {
    int p, q; scanf("%d%d", &p, &q); p--; q--;
    double cost = sqrt(square(X[p] - X[q]) + square(Y[p] - Y[q]));

    es.push_back(Edge(p, q, cost));
    sum += cost;
  }

  sort(es.rbegin(), es.rend());

  for (int i = 0; i < M; i++) {
    Edge e = es[i];

    if (uf.same(e.u, e.v)) continue;

    uf.unite(e.u, e.v);
    cut += e.cost;
  }

  printf("%.3lf\n", sum - cut);

  return 0;
}


Measured memory_bytes: 3456
module MakeBinaryHeap (M : sig type t val compare : t -> t -> int end) = struct

  type t = { node : M.t array; mutable size : int }

  let make n (init : M.t) = { node = Array.make n init; size = 0 }

  let empty_p t = if t.size = 0 then true else false

  let pop t =
    let rec max_heapify i =
      let l = 2*i in
      let r = 2*i + 1 in
      let m = if l <= t.size && M.compare t.node.(l) t.node.(i) > 0 then l else i in
      let m = if r <= t.size && M.compare t.node.(r) t.node.(m) > 0 then r else m in
      if m = i then ()
      else begin
        let tmp = t.node.(i) in
        t.node.(i) <- t.node.(m);
        t.node.(m) <- tmp;
        max_heapify m
      end in
    let ret = t.node.(1) in
    t.node.(1) <- t.node.(t.size);
    t.size <- t.size - 1;
    max_heapify 1;
    ret

  let push x t =
    let parent i = int_of_float (floor (float_of_int i) /. 2.) in
    let rec doit i =
      let p = parent i in
      if i <= 1 || M.compare t.node.(p) t.node.(i) >= 0 then ()
      else begin
        let tmp = t.node.(i) in
        t.node.(i) <- t.node.(p);
        t.node.(p) <- tmp;
        doit p
      end in
    t.size <- t.size + 1;
    t.node.(t.size) <- x;
    doit t.size

end

module H = MakeBinaryHeap(struct type t = (int * int) let compare (_, x) (_, y) = x - y end)

let dijkstra g n =
  let h = H.make 100000 (0, 0) in
  let d = Array.make n max_int in
  let b = Array.make n false in
  d.(0) <- 0;
  b.(0) <- true;
  H.push (0, 0) h;
  while not (H.empty_p h) do
    let (u, x) = H.pop h in
    b.(u) <- true;
    if d.(u) < -x then ()
    else
      List.iter (fun (v, c) ->
        if not b.(v) && d.(v) > d.(u) + c then begin
          d.(v) <- d.(u) + c;
          H.push (v, (-d.(v))) h;
        end) g.(u);
  done;
  d

let rec make_pair acc = function
  | [] -> acc
  | v :: c :: tl -> make_pair ((v, c) :: acc) tl
  | _ -> assert false

let make_pair lst = make_pair [] lst

let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let () =
  let n = read_int () in
  let g = Array.make n [] in
  for _ = 0 to n - 1 do
    match read_line () |> split_on_char ' ' |> List.map int_of_string with
    | u :: _ :: l -> g.(u) <- make_pair l
    | _ -> assert false
  done;
  dijkstra g n |> Array.iteri (fun i e -> Printf.printf "%d %d\n" i e)

Measured memory_bytes: 30604
#include <bits/stdc++.h>
#define MOD %1000000007
#define md %998244353
#define INF 2e9

#define EPS 1e-9
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define endl "\n"
#define FOR(i,a,b) for (long long i = a; i < b; i++)
#define REV(i,a,b) for (long long i = a; i > b; i--)
#define mset(a, v) memset(a, v, sizeof(a))
#define fd(n) fixed<<setprecision(n)
typedef std::pair<int, int> pii;
typedef std::vector<long long> vi;
typedef std::vector<vi> vvi;
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
const ll p=1e9 + 7 ;
ll solve(ll x,ll y) {
    ll res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}



int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
 
   ll t;
   cin>>t;
  
   
  ll n,i,j,k=0,flag=0,m,ans=0,x=0,y=0,c=0,a;
   
n= t%10;
if(n==3)
 cout<<"bon";
else if(n==0 || n==1 || n==6 || n==8)
 cout<<"pon";
else
cout<<"hon";
cout<<endl;


}



Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define N 200050
#define M 200
#define int long long
#define pb push_back
#define x first
#define y second
#define all(v) v.begin(),v.end()
#define coffee prince
#define sz(a) (int)a.size()
#define clr(a) a.clear()
#define ll long long
#define SIZE N
#define MOD mod
using namespace std;
int mod = 1e9 + 7;

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int req=0;
    while(a>=b){
        req++;
        b*=2;
    }
    while(b>=c){
        req++;
        c*=2;
    }
    if(req<=k)cout<<"Yes";
    else cout<<"No";
  	return 0;
}



Measured memory_bytes: 3656
class P:
  def __init__(self, score, number, bonus):
    self.score = score
    self.number = number
    self.bonus = bonus
    
  def score_at(self, number):
    if number >= self.number:
      return self.score * self.number + self.bonus
    else:
      return self.score * number

    
D, G = map(int, input().split())

problems = []

for i in range(D):
  p, c = map(int, input().split())
  problems.append(P((i + 1) * 100, p, c))

  
score_at = [[0] * 1001 for _ in range(D)]
  
# 1001 * 10種類の問題 * 小問100
for num_solved in range(1001):
  for i, p in enumerate(problems):
    for n in range(min(num_solved, p.number) + 1):
      if i == 0:
        score_at[0][n] = p.score_at(n)
      else:
        score_at[i][num_solved] = max(
          score_at[i][num_solved],
          score_at[i - 1][num_solved - n] + p.score_at(n)
        )
  if score_at[D - 1][num_solved] >= G:
    print(num_solved)
    break  

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

void show(){
    int n,k,x,y;
    cin>>n>>k>>x>>y;
    int ans=0;
    if(n>k){
        ans=k*x+(n-k)*y;
    }else{
        ans=n*x;
    }
    cout<<ans<<endl;
}

int main(){
    show();
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  long int N,K,sum=0;
  cin >> N >> K;
  vector<long int> H(N);
  for(int i=0;i<N;i++){
    cin >> H[i];
  }
  sort(H.begin(), H.end());
  if(N<=K){
    cout << 0 << endl;
  }else if(N>K){
    for(int j=0;j<N-K;j++){
      sum=sum+H[j];
    }
    cout << sum << endl;
  }
  
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <queue>
#include <functional>

#define out(t) cout << (t) << "\n"

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef unsigned int uint;

int popcount(uint x) {
    x -= x >> 1 & 0x55555555;
    x = (x & 0x33333333) + (x >> 2 & 0x33333333);
    x = x + (x >> 4) & 0x0F0F0F0F;
    return x * 0x01010101 >> 24;
}

int tzcnt(uint x) {
    return popcount(~x & x - 1);
}

struct Point {
    int x, y;

    Point(int p, int q) : x(p), y(q) {}
};

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

    string s;
    cin >> s;

    int t[3] = {};

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

    out(t[0] == 1 && t[1] == 1 && t[2] == 1 ? "Yes" : "No");

    int aaa;
    cin >> aaa;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
queue<int>a[1001];
int main(){
    int n;
    cin>>n;
    
    for(int i=1;i<=n;i++){
        for(int j=1;j<n;j++){
            int x;
            cin>>x;
            a[i].push(x);
        }
    }
	int sc=n*(n-1)/2;
	//cout<<sc<<endl;
    int cnt=0;
    while(sc>0){
    	//cout<<sc<<endl;
        vector<int>temp;
        for(int i=1;i<=n;i++){
        	//int t=a[i].front();
            if(a[a[i].front()].front()==i && i<a[i].front()){
            	
            	//cout<<i<<" "<<a[i][0]<<endl;
                temp.push_back(i);
                temp.push_back(a[i].front());
                continue;
            }
        }
        if(temp.size()==0){
            cout<<-1;
            return 0;
        }
        //cout<<"fdf"<<endl;
        cnt++;
        for(int i=0;i<temp.size();i++){
            a[temp[i]].pop();
            
        }
        sc-=(temp.size()/2);
    }
   cout<<cnt<<endl;
}


Measured memory_bytes: 6784
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
using namespace std;

int gcd(int a,int b)
{
  if(b>a) swap(a,b);

  int r=a%b;
  while(r!=0)
  {
    a=b;
    b=r;
    r=a%b;
  }
  return b;
}


int main()
{
  int n;
  cin>>n;
  int a,b;
  cin>>a;
  for(int i=0;i<n-1;i++)
  {
    cin>>b;
    a=gcd(a,b);
  }

  cout<<a<<endl;
}


Measured memory_bytes: 256
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int n;
    int[][] g;
    int i, j, u, v, k;

    n = sc.nextInt();
    g = new int[n][n];

    for(i = 0;i < n;i++){
      u = sc.nextInt();
      k = sc.nextInt();
      for(j = 0;j < k;j++){
        v = sc.nextInt();
        g[u - 1][v - 1] = 1;
      }
    }

    for(i = 0;i < n;i++){
      for(j = 0;j < n - 1;j++){
        System.out.print(g[i][j] + " ");
      }
      System.out.println(g[i][j]);
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 22128
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		while(true) {
			int a = scan.nextInt();
			String op = scan.next();
			int b = scan.nextInt();
			if(op.equals("?")) {
				break;
			}
			if(op.equals("+")) {
				System.out.println(a + b);
			}else if(op.equals("-")) {
				System.out.println(a - b);
			}else if(op.equals("*")) {
				System.out.println(a * b);
			}else {
				System.out.println(a / b);
			}
		}
		scan.close();
	}
}


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

int gcd(int x, int y){
	if(y == 0) return x;
	else return gcd(y, x%y);
}

int main(void){
	int n;
	bool ispc = true, issc = true;
	cin >> n;
	vector<int> a(n+1), b(1000001, 0);
	for(int i = 1; i <= n; i++) cin >> a[i];
	for(int i : a) b[i]++;

	// pairwise coprime
	for(int i = 2; i <= 1000000; i++){
		int temp = 0;
		for(int j = i; j <= 1000000; j+=i){
			temp += b[j];
		}
		ispc = ispc and (temp <= 1);
	}

	// setwise coprime
	int temp2 = 0;
	for(int i : a){
		temp2 = gcd(temp2, i);
	}
	issc = (temp2 == 1);

	if(ispc) cout << "pairwise coprime" << endl;
	else if(issc) cout << "setwise coprime" << endl;
	else cout << "not coprime" << endl;
	return 0;
}


Measured memory_bytes: 11140
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;


#line 2 "tmp.cpp"

int main() {
  ll fib[45] = {};
  fib[0] = 1;
  fib[1] = 1;
  FOR(i, 2, 45) { fib[i] = fib[i - 1] + fib[i - 2]; }
  int n;
  cin >> n;
  cout << fib[n] << endl;
  return 0;
}



Measured memory_bytes: 3092
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
//#include <algorithm>
#include <utility>
#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

ll f(ll n,ll k){
	if(k==1) return 0 ;
	while(n%k==0) n /= k ;
	return n%k ;
}

int main(){
	ll n ; cin >> n ;
	set<ll> ans ;
	ans.insert(2) ;
	ans.insert(n) ;
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			if(f(n,i)==1) ans.insert(i) ;
			if(f(n,n/i)==1) ans.insert(n/i) ;
		}
	}
	n-- ;
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			if(f(n+1,i)==1) ans.insert(i) ;
			if(f(n+1,n/i)==1) ans.insert(n/i) ;
		}
	}
	cout << ans.size() << endl ;
}


Measured memory_bytes: 256
s = input()
l = [0] * (len(s)+1)

for i in range(len(s)):
    if s[i] == "<":
        l[i+1] = l[i]+1

for i in range(len(s)):
    if s[len(s)-i-1] == ">":
        l[len(s)-i-1] = max(l[len(s)-i-1], l[len(s)-i]+1)

print(sum(l))

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

#define rep(X, N) for (ll X = 0LL; X < (N); X++)
#define ALL(V) (V).begin(), (V).end()
#define endl "\n"

using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

const double PI = 3.1415926535897932384626;
const ll MODN = 1000000007;
const ll MODN2 = 998244353;

int main(){

    int n;
    cin >> n;

    vector<ll> primecount(n + 1, 1);

    for(int i = 2; i <= n; i++){
        for(int j = i; j <= n; j = j + i){
            primecount[j]++;
        }
    }

    ll ans = 0;

    for(int i = 1; i <= n - 1; i++){
        ans += primecount[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 11172
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <functional>
#include <cstdint>
#define fre(i,a) for (auto& i: a)

using namespace std;

using ll = int64_t;
using ld = long double;
using pa = pair<int, int>;

using vi = vector<int>;
using vll = vector<ll>;
using vpa = vector<pa>;

using str = string;
const ll MOD = 1e9+7;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &v);
template <typename T, size_t size> ostream &operator<<(ostream &os, const array<T, size> &arr);
template <typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p);
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << '{';
  string sep;
  for (const auto &x : v)
    os << sep << x, sep = ", ";
  return os << '}';
}
template <typename T, size_t size>
ostream &operator<<(ostream &os, const array<T, size> &arr) {
  os << '{';
  string sep;
  for (const auto &x : arr)
    os << sep << x, sep = ", ";
  return os << '}';
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

ll lmax(ll a, ll b) { return a > b ? a : b; }
ll lmin(ll a, ll b) { return a < b ? a : b; }

ll bpow(ll a, ll b, ll m = MOD) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}

vpa pfc(ll N) {
	vpa res;
	for (ll factor = 2; factor * factor <= N; factor++) {
		if (N % factor > 0) continue;
		ll level = 1, cur = 0;
		while (N % factor == 0) {
			N /= factor;
			cur++;
			if (cur == level) {
				/* cout << "levelup" << level << endl; */
				level++;
				cur = 0;
			}
		}
		res.emplace_back(factor, level - 1);
	}
	if (N > 1) {
		res.emplace_back(N, 1);
	}
	return res;
}

void fileio(str p) {
#ifndef FEAST_LOCAL
	freopen((p + ".in").c_str(), "r", stdin);
	freopen((p + ".out").c_str(), "w", stdout);
#endif
}

int tmp, ta, tb;

int main() {
	cin.tie(0)->sync_with_stdio(false);
	/* fileio("problem name"); */
	ll N; cin >> N;
	vpa x = pfc(N);
	ll res = 0;
	/* cout << x << endl; */
	fre(e, x) {
		// n(n+1)/2 = x
		// n^2 + n - 2x = 0
		// n = (-1 +- sqrt(1 + 8x))/2
		/* int n = ((int)(sqrt(8 * e.second + 1)) - 1) / 2; */
		/* cout << n << endl; */
		int n = e.second;
		res += n;
	}
	cout << res << endl;
}


Measured memory_bytes: 3148
//templates
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#include <unordered_map>
#include <map>
#include <cmath>
#include <iomanip>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(x) (x).begin(),(x).end()
#define sort_key(struct_name,key_name) [](const struct_name &x, const struct_name &y){return x.key_name < y.key_name;}
#define pb(x) push_back(x)
typedef long long ll;
using namespace std;

//main
int main(){
    int N,M; cin >> N >> M;
    vector<int> a(M);
    rep(i,M) cin >> a[i];
    vector<ll> ans(N+1);
    ans[0] = 1;
    if(binary_search(ALL(a),1)) ans[1] = 0;
    else ans[1] = 1;
    for(int i=2; i<N+1; i++){
        if(binary_search(ALL(a),i)) ans[i] = 0;
        else ans[i] = (ans[i-1] + ans[i-2])%1000000007;
    }
    cout << ans[N] << endl;
}


Measured memory_bytes: 1408
from collections import defaultdict
from collections import deque
import sys
sys.setrecursionlimit(200000)

def Dinic_DFS(v,g,maxflow,lines,cost,level):
    if v == g:
        return maxflow

    realflow = 0
    tmp = [i for i in lines[v]]
    for nex in tmp:
        if level[nex] > level[v]:
            
            plusflow = Dinic_DFS(nex,g,min(maxflow , cost[v][nex]),lines,cost,level)
            cost[v][nex] -= plusflow
            if cost[v][nex] == 0:
                lines[v].remove(nex)
            if cost[nex][v] == 0:
                lines[nex].add(v)
            cost[nex][v] += plusflow
            
            realflow += plusflow
            maxflow -= plusflow

            if maxflow <= 0:
                return realflow

    return realflow

def Dinic(s,g,lines,cost):

    N = len(cost)
    ans = 0

    while True:

        #bfs
        q = deque([s])
        level = [float("inf")] * N
        level[s] = 0
        while q:
            now = q.popleft()
            for nex in lines[now]:

                if level[nex] > level[now] + 1:
                    level[nex] = level[now] + 1
                    q.append(nex)

        if level[g] == float("inf"):
            return ans

        #dfs
        delta_flow = Dinic_DFS(s,g,float("inf"),lines,cost,level)
        while delta_flow > 0:
            ans += delta_flow
            delta_flow = Dinic_DFS(s,g,float("inf"),lines,cost,level)


######MAIN#######

N,M = map(int,input().split())

lines = defaultdict(set)
cost = [ [0] * N for i in range(N) ]

for i in range(M):

    u,v,c = map(int,input().split())
    #u -= 1
    #v -= 1
    
    if c != 0:
        lines[u].add(v)
        cost[u][v] += c

print (Dinic(0,N-1,lines,cost))


Measured memory_bytes: 6152
package main

import "fmt"

func main() {
	var n, sum int
	fmt.Scan(&n)
	a := make([]int, n)
	b := make([]int, n-1)
	for i := 0; i < len(b); i++ {
		fmt.Scan(&b[i])
	}
	a[0] = b[0]
	a[1] = b[0]
	for i := 1; i < len(b); i++ {
		if b[i] < a[i] {
			a[i] = b[i]
		}
		a[i+1] = b[i]
	}
	for i := 0; i < len(a); i++ {
		sum += a[i]
	}
	fmt.Println(sum)
}

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

int n,k;
int v[NMAX],dp[NMAX];

int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
    }
    for(int i=2;i<=n;i++)
    {
        dp[i]=INT_MAX;
        for(int j=max(i-k,1);j<i;j++)
        {
            dp[i]=min(dp[i],dp[j]+abs(v[i]-v[j]));
        }
    }
    cout<<dp[n];
}


Measured memory_bytes: 1024
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>

using namespace std;
int main()
{
    string s;
    cin>>s;
    bool isgood = true;
    if(s[0] == s[1]){
        isgood = false;
    }
    if(s[1] == s[2]){
        isgood = false;
    }
    if(s[2] == s[3]){
        isgood = false;
    }
    
    if(isgood ){
        cout<<"Good";
    }
    else{
        cout<<"Bad";
    }

    return 0;
}

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

int sports[301][301];
int main()
{
    int n, m, a;

    cin >> n >> m;

    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            cin >> sports[i][j];

    for (int i = 1; i <= n; ++i)
    {
        vector<int> cur_amount(301), cur_loc(301), prev_loc(301);
        vector<bool> not_allowed(301);

        for (int k = 0; k <= m; ++k)
        {
            for (int j = 0; j < n; ++j)
            {
                while (not_allowed[sports[j][cur_loc[j]]])
                    ++cur_loc[j];

                if (cur_loc[j] >= m)
                    goto stop;

                if(cur_loc[j] != prev_loc[j] || k == 0)
                    ++cur_amount[sports[j][cur_loc[j]]];

                if (cur_amount[sports[j][cur_loc[j]]] > i)
                {
                    not_allowed[sports[j][cur_loc[j]]] = true;
                }

                prev_loc[j] = cur_loc[j];
            }
        }

        cout << i << '\n';
        return 0;

        stop:
        int x = 0;
    }
}

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

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

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    rep(i,h) {
        rep(j,w){
            if(s[i][j]=='#') continue;
            int cnt = 0;
                rep(k,8) {
                    int nj = j + dx[k]; 
                    int ni = i + dy[k]; 
                    if(nj >= w || nj < 0 || ni >= h || ni < 0) continue;
                    if(s[ni][nj]=='#') cnt++;
                }
                
                char c = '0'+cnt;
                s[i][j] = c;
            
        }
    }
    rep(i,h) {
        cout << s[i] << endl;
    }
    return 0;
}

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

#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT_ON(bit, i) (((bit >> i) & 1) > 0)

typedef long long LL;
template<typename T> std::vector<T> make_v(size_t a){return std::vector<T>(a);}
template<typename T,typename... Ts> auto make_v(size_t a, Ts... ts){ return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}    // C++14
template<typename T,typename V> typename std::enable_if<std::is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename std::enable_if<std::is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
template<class T> inline T ceil(T a, T b) { return (a + b - 1) / b; }
template<class T> inline void print(T x) { std::cout << x << std::endl; }
template<class T> inline void print_vec(const std::vector<T> &v) { for (int i = 0; i < v.size(); ++i) {  if (i != 0) {std::cout << " ";} std::cout << v[i];} std::cout << "\n"; }
template<class T> inline bool inside(T y, T x, T H, T W) {return 0 <= y and y < H and 0 <= x and x < W; }
template<class T> inline double euclidean_distance(T y1, T x1, T y2, T x2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); }
template<class T> inline double manhattan_distance(T y1, T x1, T y2, T x2) { return abs(x1 - x2) + abs(y1 - y2); }
template<typename T> T &chmin(T &a, const T &b) { return a = std::min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = std::max(a, b); }

template<class T> inline std::vector<T> unique(std::vector<T> v) {
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    return v;
}
// 初項s, 交差dのn個の数列の和
long long sum_of_arithmetic_progression(long long s, long long d, long long n) {
    return n * (2 * s + (n - 1) * d) / 2;
}

const int INF = 1 << 30;
const double EPS = 1e-9;
const long double PI = acos(-1.0);
const std::vector<int> dy4 = {0, -1, 0, 1}, dx4 = {1, 0, -1, 0};
const std::vector<int> dy8 = { 0, -1, 0, 1, 1, -1, -1, 1 }, dx8 = { 1, 0, -1, 0, 1, 1, -1, -1 };


using namespace std;


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

    int N;
    cin >> N;
    bool odd = false;
    FOR(i, 0, N) {
        LL A;
        cin >> A;
        if (A % 2 == 1) {
            odd = true;
        }
    }

    if (odd) {
        print("first");
    }
    else {
        print("second");
    }
    

    return 0;
}



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

#define int long long

signed main()
{
    int N, P;
    cin >> N >> P;
    vector<int> A(N + 10);

    for(int i = 0; i < N; i++)cin >> A[i];

    int even = 1;
    for(int i = 0; i < N; i++)if(A[i] % 2 == 0)even *= 2;

    int odd = 0, odd_N = 0, tmp = 1;
    for(int i = 0; i < N; i++)if(A[i] % 2)odd_N++;
    for(int i = 0; i <= odd_N; i++)
    {
        if(i % 2 == P)odd += tmp;
        tmp *= odd_N - i;
        tmp /= i + 1;
    }

    cout << odd * even << endl;

    return 0;
}


Measured memory_bytes: 3584
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1000003 ;

ll dp[3020][3020];//dp[index][weight]

int main(){
  int n,W;
  cin >> n >> W;
  pair<ll,ll> p[n];
  ll w[n],v[n];
  rep(i,n)cin >> p[i].first >> p[i].second;
  sort(p,p+n);
  rep(i,n){
    w[i]=p[i].first;
    v[i]=p[i].second;
  }
  rep(i,n+1){
    rep(j,W+1){
      if(j-w[i]>=0){
        dp[i+1][j]=max(dp[i][j-w[i]]+v[i],dp[i][j]);
      }
      else{
        dp[i+1][j]=dp[i][j];
      }
    }
  }
  ll ans=-1;
  for(int i=0;i+1<=n;i++){
    ans=max(ans,dp[i][W-1]+v[i]);
  }
  cout << ans << endl;
return 0;}

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

int p[15],e[15];

bool solve(int min,int max,int d,int s,int k){
    if(s==0)return true;
    if(k==0)return false;
    if(d==0){       //playe
        bool l=false,h=false;
        if(p[min]==0&&p[max]==0)return solve(min, max, (d+1)%2, s, k);
        if(p[min]){
            p[min]=0;
            l=solve(min-1, max, (d+1)%2, s-1, k);
            p[min]=1;
        }
        if(p[max]){
            p[max]=0;
            h=solve(min, max+1, (d+1)%2, s-1, k);
            p[max]=1;
        }
        if(l||h)return true;
        else return false;
    }
    else{       //enemy
        bool l=true,h=true;
        if(e[min]==0&&e[max]==0)return solve(min, max, (d+1)%2, s, k);
        if(e[min]){
            e[min]=0;
            l=solve(min-1, max, (d+1)%2, s, k-1);
            e[min]=1;
        }
        if(e[max]){
            e[max]=0;
            h=solve(min, max+1, (d+1)%2, s, k-1);
            e[max]=1;
        }
        if(l==false||h==false)return false;
        else return true;
    }
}

int main(void){
    int n;
    cin>>n;
    while (n) {
        for (int i=1; i<=13; i++) {
            p[i]=0;
            e[i]=1;
            if(i==7)e[i]=0;
        }
        int f;
        for (int i=0; i<6; i++) {
            cin>>f;
            p[f]=1;
            e[f]=0;
        }
        if(solve(6,8,0,6,6))cout<<"yes"<<endl;
        else cout<<"no"<<endl;
        n--;
    }
    return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
signed main(){
    int n;
    cin>>n;
    vector<int> num(1,1);
    for(int i=2;i<32;i++){
        int k = i;
        for(int j=2;j<10;j++){
            k *= i;
            if(k<=n)num.push_back(k);
            else break;
        }
    }
    int res = 1;
    for(int i=0;i<num.size();i++){
        res = max(res,num[i]);
    }
    cout<<res<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T1, typename T2>
inline bool cmn (T1& a, T2 b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
int main() {
	cin.tie(0); cin.sync_with_stdio(false);
	constexpr long long inf = 1LL << 60;
	int n, A, B;
	cin >> n >> A >> B;
	vector<long long> p(n + 2);
	for (int i = 1; i <= n; i++) cin >> p[i];
	p[0] = 0; p[n + 1] = n + 1;
	vector<long long> dp(n + 2, inf);
	dp[0] = 0;
	for (int i = 1; i <= n + 1; i++) {
		long long tmp = 0;
		for (int j = i - 1; j >= 0; j--) {
			if (p[j] < p[i]) {
				cmn(dp[i], dp[j] + tmp);
				tmp += B;
			} else {
				tmp += A;
			}
		}
	}
	cout << dp[n + 1] << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
//#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  int d;
  cin>>d;

  vector<ll> p(26);
  rep(i,26) cin>>p[i];

  vector<vector<ll>> q(d,vector<ll>(26));
  rep(i,d) {
    rep(j,26) {
      cin>>q[i][j];
    }
  }



  rep(i,d){
    int ans;
    ll dai=-1;
    rep(j,26){
      if(q[i][j]>dai) ans=j+1;
      chmax(dai,q[i][j]);
    }
    cout << ans << endl;
  }

}

Measured memory_bytes: 3748