akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new ABC131().SolveB(new ConsoleInput(Console.In, ' '));
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
  class ABC131
  {
  	public void SolveB(ConsoleInput cin)
        {
            var n = cin.ReadInt;
            var l = cin.ReadInt;
            var tastes = new int[n];
            for (int i = 0; i < n; i++)
            {
                tastes[i] = i + l;
            }
            int minNo = 0;
            for(int i = 0; i < n; i++)
            {
                if(Abs(tastes[minNo]) > Abs(tastes[i])){
                    minNo = i;
                }
            }
            WriteLine(tastes.Sum()-tastes[minNo]);
            ReadLine();
        }
  }
}


Measured memory_bytes: 13396
import scala.io.StdIn.{readInt,readLine}

object Main {

  def main(args: Array[String]) = {
    val n = readInt
    val read:Map[String,Int] = (1 to n).map(_=> readLine.trim -> 1).toMap

    for(x <- List("S","H","C","D"); y<-1 to 13) {
      if(!read.contains(x+" "+y))
        println(x+" "+y)
    }
  }
}

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

int main(){
  int N;
  cin >> N;
  vector<string> S(N);
  for(int i=0;i<N;i++){
    cin >> S.at(i);
    sort(S.at(i).begin(),S.at(i).end());
  }
  vector<char> A(0);
  for(int i=0;i<S.at(0).size();i++){//S0の第i文字が他全てのSに入ってるならAに追加
    char x = S.at(0).at(i);
    bool all = true;
    for(int j=1;j<N;j++){//Sjにxが入ってますか？
      bool exist = false;
      for(int k=0;k<S.at(j).size();k++){//Sjの各要素を調べる
        if(S.at(j).at(k) == x){
          S.at(j).at(k) = '0';
          exist = true;
          break;
        }
      }
      if(exist){
      }else{
        all = false;
        break;
      }
    }
    if(all){
      A.push_back(x);
    }
  }
  for(int i=0;i<A.size();i++){
    cout << A.at(i);
  }
  cout << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<lint, lint> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI=3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	if (!b)return T(1);
	if (b & 1)return mypow(a, b - 1) * a;
	T memo = mypow(a, b >> 1);
	return memo * memo;
}
lint modpow(lint a, lint b, lint m) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	lint memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size() - 1)std::cout << vec[i] << " ";
	std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int main(){
	char c;
	std::cin>>c;
	if(isupper(c))std::cout<<"A"<<std::endl;
	else std::cout<<"a"<<std::endl;
	return 0;
}


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

int main(){
    using namespace std;
    int N; cin >> N;
    vector<int> A;
    vector<int> x(N,0);
    long val = 0;
    for (int i = 0; i < N; i++)
    {
        int a; cin >> a;
        A.push_back(a);
        if(i%2==0) val -= a;
        else val += a;
    }

    x[N-1] = 2 * A[N-1] + val;
    for (int i = 1; i <= N/2; i++)
    {
        x[N-1 - 2 * i] = x[N-1 - 2 * i + 2] - 2*(A[N-1 - 2 * i +1]-A[N-1 - 2 * i]);
    }
    for (int i = 0; i < N/2; i++)
    {
        x[2*i+1] = A[2*i+1] - x[2*i+2]/2 + A[2*i] - x[2*i]/2;
    }
    for (int i = 0; i < N; i++)
    {
        if(i!=N-1) cout << x[i] << " ";
        else cout << x[i] << endl;
    }
}


Measured memory_bytes: 2168
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Dice
{
    int t;
public:
    vector<int> pip; // 東南西北上下の目
    Dice(){
        t = 0;
        pip.assign(6, -1);
    }
    void roll(int d){ // 東南西北右左に回転
        int dir[][4] = {{4,2,5,0},{4,3,5,1},{4,0,5,2},{4,1,5,3},{0,3,2,1},{0,1,2,3}};
        int tmp = pip[dir[d][0]];
        for(int i=0; i<3; ++i)
            pip[dir[d][i]] = pip[dir[d][i+1]];
        pip[dir[d][3]] = tmp;
    }
    void next()
    {
        roll(0);
        ++ t;
        if(t % 4 == 0){
            if(t % 24 == 16)
                roll(4);
            else if(t % 24 == 20)
                roll(4), roll(4);
            else
                roll(1);
        }
    }
    bool operator==(const Dice& d) const{
        return pip == d.pip;
    }
};

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<Dice> d(4);
        map<string, int> color;
        for(int i=0; i<n; ++i){
            vector<int> a(6);
            for(int j=0; j<6; ++j){
                string s;
                cin >> s;
                if(color.find(s) == color.end()){
                    int k = color.size();
                    color[s] = k;
                }
                a[j] = color[s];
            }
            d[i].pip[1] = a[0];
            d[i].pip[0] = a[1];
            d[i].pip[4] = a[2];
            d[i].pip[5] = a[3];
            d[i].pip[2] = a[4];
            d[i].pip[3] = a[5];
        }

        int ret = INT_MAX;
        for(int a=0; a<24; ++a){
            for(int b=0; b<24; ++b){
                for(int c=0; c<24; ++c){
                    int tmp = 0;
                    for(int i=0; i<6; ++i){
                        int x = 0;
                        map<int, int> m;
                        for(int j=0; j<n; ++j)
                            x = max(x, ++m[d[j].pip[i]]);
                        tmp += n - x;
                    }
                    ret = min(ret, tmp);

                    d[3].next();
                }
                d[2].next();
            }
            d[1].next();
        }

        cout << ret << endl;
    }
}

Measured memory_bytes: 932
#include <stdio.h>

int main(){
    int n, a, b, tmp, sum, sums=0;

    scanf("%d %d %d", &n, &a, &b);
    for(int i=1; i<=n; i++){

        tmp = i;
        sum = 0;
        while( tmp > 0 ){
            sum += tmp % 10;
            tmp /= 10;
        }
        if( sum >= a && sum <= b ){ sums += i; }
    }
    printf("%d\n", sums);
    return 0;
}

Measured memory_bytes: 1736
#!python3.8
# -*- coding: utf-8 -*-
# abc175/abc175_c
import sys
import math

def s2nn(s): return [int(c) for c in s.split(' ')]
def ss2nn(ss): return [int(s) for s in list(ss)]
def ss2nnn(ss): return [s2nn(s) for s in list(ss)]
def i2s(): return sys.stdin.readline().rstrip()
def i2n(): return int(i2s())
def i2nn(): return s2nn(i2s())
def ii2ss(n): return [i2s() for _ in range(n)]
def ii2nn(n): return ss2nn(ii2ss(n))
def ii2nnn(n): return ss2nnn(ii2ss(n))


def main():
    X, K, D = i2nn()
    absX = abs(X)
    if absX >= K * D:
        print(abs(absX - K * D))
        return
    a, c = divmod(absX, D)
    b = K - a
    if b % 2:
        print(abs(c - D))
    else:
        print(abs(c))
    return


main()


Measured memory_bytes: 9220
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() { 
    int a, b;
    cin >> a >> b;
    if (a % 2 != 0 && b % 2 != 0) {
        cout << "Odd" << endl;
    } else {
        cout << "Even" << endl;
    }
}




Measured memory_bytes: 3596
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<string>
#include<queue>
using namespace std;

#define INF 1000000007

int main(){
  int n,k;
  cin >> n >> k;
  string s;
  cin >> s;
  queue<int> inner;
  queue<int> outer;
  int ans = 0;
  for(int i = 0; i < s.length()-1; i++){
    if(s[i] == 'R' && s[i+1] == 'L') inner.push(i);
    if(s[i] == 'L' && s[i+1] == 'R') outer.push(i);
    if(s[i] == s[i+1]) ans++;
  }
  for(int i = 0; i < k; i++){
    if(inner.empty() && outer.empty() ) break;
    if(inner.empty()){
      outer.pop();
      ans += 1;
    }
    else if(outer.empty()){
      inner.pop();
      ans += 1;
    }
    else{
      inner.pop();
      outer.pop();
      ans += 2;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 768
#include<iostream>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using namespace std;

int main() {
  int H, W;
  while (cin >> H >> W) {
    if (H == 0 && W == 0) return 0;
    REP(h, H) {
      REP(w, W) {
        if (h % 2 == w % 2) cout << '#';
        else cout << '.';
      }
      cout << endl;
    }
    cout << endl;
  }
}


Measured memory_bytes: 3088
#include<stdio.h>
char map[13][13];
void search(int h,int w){
	if(w<0||h<0||w>11||h>11||map[h][w]=='0')return;
	map[h][w]='0';
	search(h-1,w);
	search(h,w+1);
	search(h+1,w);
	search(h,w-1);
}
int main(){
	int i,j,c=0,f=0;
	for(;1;c=0){
		for(i=0;i<12;i++){
			if(scanf("%s",map[i])==EOF){f=1;break;}
		}
		if(f)break;
		scanf("\n");
		for(i=0;i<12;i++){
			for(j=0;j<12;j++){
				if(map[i][j]=='1'){search(i,j);c++;}
			}
		}
		printf("%d\n",c);
	}
	exit(0);
}

Measured memory_bytes: 0
#include <stdio.h>
int main(void)
{
    int w,h,x,y,r;
    scanf("%d%d%d%d%d",&w,&h,&x,&y,&r);
    if(w>=x+r&&0<=x-r&&h>=y+r&&0<=y-r)
    {
        printf("Yes\n");
    }
    else printf("No\n");
    return 0;
}


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

using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define pb push_back
#define int long long

signed main(){
	

	int n,m;

	cin>>n>>m;

	char a[n][n];
	char b[m][m];

	bool flag=true;



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

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

	for(int i=0;i<n-m+1;i++){
		for(int j=0;j<n-m+1;j++){

			flag=true;

			for(int k=0;k<m;k++){
				for(int l=0;l<m;l++){
					if(a[i+k][j+l]!=b[k][l])flag=false;

				}
			}

			if(flag){
				cout<<"Yes"<<endl;
				return 0;
			}


		}
	
	}

	cout<<"No"<<endl;
	

}

Measured memory_bytes: 256
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int t = sc.nextInt();
        if (x >= t) {
        	System.out.println(x - t);
        }else{
        	System.out.println(0);
        }
	}
}

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

using namespace std;

const int N = 200005;

int vis[N];
vector<int> g[N]; 

void dfs(int u, int d) {
  vis[u] = 1;
  if (d < 2) {
    for (auto v : g[u]) {
      if (!vis[v]) {
        dfs(v, d + 1);
      }
    }
  }
}

int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, 0);
  puts(vis[n] ? "POSSIBLE" : "IMPOSSIBLE");
  return 0;
}


Measured memory_bytes: 12784
import java.util.Scanner;

/**
 * https://abc050.contest.atcoder.jp/tasks/abc050_a
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		String op = sc.next();
		int b = sc.nextInt();
		sc.close();
		
		int ans = op.equals("+") ? a+b : a-b;
		
		System.out.println(ans);

	}

}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    string s; cin >> s;
    bool ok = true;
    REP(i, 3) if(s[i] == s[i + 1]) ok = false;
    cout << (ok ? "Good" : "Bad") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define SQR(X) (1LL * (X)*(X))
 
int N, X[100000], R[100000];
 
bool check(double val)
{
  double left = -1e9, right = 1e9;
  for(int i = 0; i < N; i++) {
    if(R[i] < val) return(false);
    double width = sqrt(SQR(R[i]) - SQR(val));
    right = min(right, X[i] + width);
    left = max(left, X[i] - width);
  }
  return(left < right);
}
 
int main()
{
  scanf("%d", &N);
  for(int i = 0; i < N; i++) {
    scanf("%d %d", &X[i], &R[i]);
  }
  double low = 0, high = 1e6;
  for(int i = 0; i < 50; i++) {
    double mid = (low + high) / 2;
    if(check(mid)) low = mid;
    else high = mid;
  }
  printf("%.5lf\n", low);
}

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

using namespace std;

typedef long long ll;

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


int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, X; cin >> N >> X;
    int mmin = 100010;
    rep(i, N) {
        int m; cin >> m;
        X -= m;
        mmin = min(mmin, m);
    }
    cout << N + X / mmin << endl;
}


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

using namespace std;

int main(){
    int x, y, z;
    cin >> x >> y >> z;

    if(max(max(x, y), z) == x)
        cout << y * z / 2 << endl;
    if(max(max(x, y), z) == y)
        cout << x * z / 2 << endl;
    if(max(max(x, y), z) == z)
        cout << x * y / 2 << endl;

    return 0;
}


Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
a = a.unshift(0)
a << 0
ans = 0
i = 1
while true
    ans += (a[i] - a[i-1]).abs
    if i == n + 1
        break
    end
    i += 1
end
j = 1
while true
    all = ans
    kesumae = (a[j+1] -a[j-1]).abs
    #p kesumae
    keshitaato = (a[j]-a[j-1]).abs + (a[j+1]-a[j]).abs
    #p keshitaato
    ans += (kesumae - keshitaato)
    #p ans
    j += 1
    if j != n + 1
        puts ans
        ans = all
    else
        puts ans
        break
    end
end

Measured memory_bytes: 22068
#include <stdio.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <cassert>

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

const int MAXN = 3e5 + 1;
const int MOD = 1e9 + 7;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define FAILNO {printf("NO\n"); return 0;}
#define FAIL1 {printf("-1\n"); return 0;}

int N;
int A[101];
int st[101];
int head = 0;

int main() {
#ifdef OJ
	freopen("input.txt", "rt", stdin);
	//freopen("output.txt", "wt", stdout);
#endif

	scanf("%d", &N);
	for (int i = 0; i < N; i++) scanf("%d", &A[i]);

	if (A[0] != 1) FAIL1;

	st[head++] = 1;
	for (int i = 1; i < N; i++) {
		int a = A[i];
		if (a-1 > head) FAIL1;

		int j;
		for (j = head; j >= a; j--) {
			st[j] = st[j-1];
		}
		st[j] = a;
		head++;
	}

	for (int i = 0; i < N; i++) printf("%d\n", st[i]);

	return 0;
}


Measured memory_bytes: 128
/*
    ThunderClap and Flash
    Raunaq Singh
*/
#include "bits/stdc++.h" 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define ThunderClap ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
#define debugg(something)   cout<<#something<<" - "<<something<<"\n";
#define vi vector
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define LB lower_bound
#define UB upper_bound
#define mp make_pair
#define pb push_back
#define in insert
#define s second
#define f first
#define pQueue priority_queue
#define maxElement *max_element
#define minElement *min_element
#define MAX 100000LL
#define mod 1000000007LL
#define inf 1000000000000000000LL
#define mI2 500000004LL
inline ll add(ll a, ll b){ return ((a%mod) + (b%mod))%mod;}
inline ll mul(ll a, ll b){ return ((a%mod) * (b%mod))%mod;}
inline ll sub(ll a, ll b){ return ((a%mod) - (b%mod) + mod)%mod;}

void Flash(){
    ll n;
    cin>>n;
    ll a[n], b[n];
    map <ll, ll> freqA, freqB;
    for (ll i = 0; i < n; i++) {
        cin>>a[i];
        ++freqA[a[i]];
    }
    for (ll i = 0; i < n; i++) {
        cin>>b[i];
        ++freqB[b[i]];
    }
    bool chk = true;
    for (auto it: freqA) {
        if (it.s > (n - freqB[it.f])) {
            chk = false;
            break;
        }
    }
    if (!chk) {
        cout<<"No\n";
        return;
    }
    ll start = 0, end = n - 1;
    reverse(b, b + n);
    for (ll i = 0; i < n; i++) {
        if (a[i] == b[i]) {
            if (i > start) {
                if (b[start] != a[i] && a[start] != b[i]) {
                    swap(b[start], b[i]);
                    ++start;
                } else {
                    swap(b[end], b[i]);
                    --end;
                }
            } else if (i < end) {
                if (b[end] != a[i] && a[end] != b[i]) {   
                    swap(b[end], b[i]);
                    --end;
                } else {
                    swap(b[start], b[i]);
                    ++start;
                }
            }
        }
    }
    /*
    for (ll i = 0; i < n; i++) {
        if (a[i] == b[i]) {
            cout<<"No\n";
            return;
        }
    }
    */
    cout<<"Yes\n";
    for (ll i = 0; i < n; i++) {
        cout<<b[i]<<" ";
    }
    cout<<"\n";
}

int main(int argc, char const *argv[]){ 
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
    #endif
    ThunderClap;
    ll t = 1;
    for(ll i = 1; i <= t; i++){
        //cout<<"Case #"<<i<<": ";
        Flash();
    }
    return 0;
}


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

using namespace std;

struct node {
  char c;
  int odd;
  int even;
  int used;
};

void hoge(vector<node> &vec, int c, int last = -1) {
  int next = vec[c].c == 'R' ? c + 1 : c - 1;
  if (vec[next].used == 1) {
    vec[c].even = vec[next].odd;
    vec[c].odd = vec[next].even;
    vec[c].used = true;
  }
  else if (next == last) {
    vec[c].even = c;
    vec[c].odd = next;
    vec[c].used = true;
  }
  else {
    hoge(vec, next, c);
    vec[c].even = vec[next].odd;
    vec[c].odd = vec[next].even;
    vec[c].used = true;
  }
}

int main() {
  vector<node> vec;
  char c;
  while (cin >> c)
    vec.push_back({c, 0, 0, 0});

  for (int i = 0; i < static_cast<int>(vec.size()); ++i)
    hoge(vec, i);

  vector<int> ans(static_cast<int>(vec.size()), 0);
  for (int i = 0; i < static_cast<int>(vec.size()); ++i)
    ++ans[vec[i].even];

  cout << ans[0];
  for (int i = 1; i < static_cast<int>(ans.size()); ++i)
    cout << " " << ans[i];
  cout << endl;
}

Measured memory_bytes: 8004
#include <iostream>
using namespace std;
int main() {
    int a, b, c, count = 0;
    cin >> a >> b >> c;
    if (a != b) {
        count++;
    }
    if (b != c) {
        count++;
    }
    if (c != a) {
        count++;
    }
    if (count == 0) {
        count++;
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=2e5+5;
int a[maxn];
map<int,int>mp;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    ll cnt=0;
    for(int i=1;i<=n;i++)
    {
        cnt+=mp[i-a[i]];
        mp[i+a[i]]++;
    }
    cout<<cnt<<'\n';

}


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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	// debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, left, right)  (a).begin()+(left),(a).begin()+(right)	// left to (right-1)


int main() {
	int n;
	cin >> n;
	int res = 0;
	pv((n - 1) / 2);
	return 0;
}

Measured memory_bytes: 3564
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll K, X;

int main()
{
  std::cin >> K >> X;

  std::cout << (K*500>=X ? "Yes" : "No") << std::endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int n,i,result=0;
    int h[100]={};
    scanf("%d", &n);
    for(i=0;i<n;i++)scanf("%d", &h[i]);
    while(1){
        for(i=0;i<n &&h[i]==0;i++);
        if(n==i)break;
        for(;i<n && h[i]>0;i++)h[i]--;
        result++;
    }
    printf("%d\n", result);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int h,w;
  cin>>h>>w;
  int ans=h*w;
  for(int k=0;k<2;k++){
    for(int i=1;i<h;i++){
      int s1=i*w;
      int s2=(h-i)*(w/2);
      int s3=h*w-s1-s2;
      int tmp=max(max(s1,s2),s3)-min(min(s1,s2),s3);
      ans=min(ans,tmp);
    }
    swap(h,w);
  }
  ans=min(ans,h);
  ans=min(ans,w);
  if(h%3==0||w%3==0) ans=0;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN];
int head, tail, n;

void enqueue(P x){
  Q[tail]=x;
  tail=(tail +1)%LEN;
}

P dequeue(){
  P x =Q[head];
  head=(head+1)%LEN;
  return x;
}

int min(int a,int b){return a<b ? a:b;}
  int main(){
int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);
head=1;
  tail=n+1;
  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }

  while(head!=tail){
    u = dequeue();
    c =min(q,u.t);
    u.t-= c;
    elaps+=c;
    if(u.t>0) enqueue(u);
    else{
      printf("%s ", u.name);
      printf("%d\n", elaps);
    }
  }
  return 0;
}



Measured memory_bytes: 11868
/*
 Atcoder ACL
*/


#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int,int> pii;
typedef pair <db,db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline int gcd(int a,int b){if(a==0) return b;return gcd(b%a,a);}
inline int power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };

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

const int N=200005;

int parent[N+1];

int find(int i)
{
    if(parent[i]==i)
        return i;
    return parent[i]=find(parent[i]);
}

void Union(int i,int j)
{
    int x=find(i),y=find(j);
    if(x!=y)
        parent[y]=x;
}


void solve()
{
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        parent[i]=i;
    int u,v;
    for(int i=0;i<m;i++){
    
        cin>>u>>v;
        Union(u,v);
    }
    int ans=0;
    for(int i=1;i<=n;i++)
        if(find(i)==i)
            ans++;
    cout<<ans-1<<endl;
    
    
    
    
    
}


int32_t main(){
    
    IOS;
    
    int t;
    t=1;
    // cin>>t;
    while(t--)
    {
        
        solve();
    }
    return 0;
}




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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
    return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
    return a / gcd(a, b) * b;
}

string IntToString(int number)
{
    stringstream ss;
    ss << number;
    return ss.str();
}

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

int main()
{
    llint n;
    llint a;

    llint mn = 1LL << 62;
    
    ci >> n;
    rep(i, 5) {
	ci >> a;
	mn = min(mn, a);
    }

    llint m = 0;
    if(n % mn) m = 1;
    
    co << 5 + n / mn + m - 1<< en;
    
  
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;


int main()
{
	string a;
	cin >> a;
	if(a[0] == a[1] && a[0] == a[2] && a[1] == a[2])
	{
		cout << "No";	
	}	
	else
	{
		cout << "Yes";
	}
}



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

# if K ==0:
#     keta = 0
# else:
#     keta = (len(bin(K)[2:]))
keta = (len(bin(K)[2:]))

num1s = [0] * keta
for a in A:
    for j in range(keta):
        if (1 << j) & a :
            num1s[j] = num1s[j] + 1
#print(num1s)
#print("keta")
#print(keta)

half = N/2
X = 0
if K != 0:
    for j in range(keta):
        #print("j:")
        #print(j)
        #if num1s[j] < half:
            X = X + ((num1s[j] < half)<<j)
answer = 0
#print(X)


def f (X):
    r = 0
    for a in A:
        r = r + (a^X)
    return r

maxfx = f(K)
for j in range(keta):
    if (1<<j)&K:
        
        x = (((1<<j) -1)&X ) 
        x = x | ((~((1<<(j+1))-1))&K)
        if f(x) > maxfx:
            maxfx = f(x)
            #print(x,maxfx,f(x)) 
print(maxfx)





Measured memory_bytes: 69264
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cerr<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
int getInt(){int x;scanf("%d",&x);return x;}
template<typename T>istream& operator>>(istream&i,v(T)&v){rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v){stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const v(T)&v){if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.fi<<","<<v.se;}
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
template<typename T>ll suma(const v(T)&a){ll res(0);for(auto&&x:a)res+=x;return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;



int main() {
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll ans = 0;
  ans = a*c;
  maxs(ans,a*d);
  maxs(ans,b*c);
  maxs(ans,b*d);
  cout<<ans<<endl;
  return 0;
}






















Measured memory_bytes: 3672
n=5
m=5
z=0
sum=0
A=[]

while n!=0:
    n,m=[int(i) for i in input().split()]
    if n==0 and m==0:
        break
    val=[int(i) for i in input().split()]
    ans1=0
    mm=0
    for i in range(0,n):
        for j in range(i+1,n):
            if i==j:
                break
            ans1=val[i]+val[j]
            if ans1>mm and ans1<=m:
                mm=ans1
        ans1=0
    A.append(mm)
    z=z+1

for i in range(z):
    if A[i]==0:
        A[i]="NONE"
    print(A[i])



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

long long n;
int k;


int main(){
    ios_base::sync_with_stdio(0);
    //freopen("input.txt","r",stdin);

    cin>>n>>k;

    int cnt = 0;
    while(n>0){
        cnt++;
        n/=k;
    }
    cout << cnt;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main()
    {
        var nm = ReadLine().Split().Select(long.Parse).ToArray();
        var lcm = Lcm(nm[0], nm[1]);
        var dic = new Dictionary<long, char>();
        var s = ReadLine();
        for (int i = 0; i < nm[0]; i++)
        {
            dic[lcm / nm[0] * i] = s[i];
        }
        var t = ReadLine();
        for (int i = 0; i < nm[1]; i++)
        {
            if (dic.ContainsKey(lcm / nm[1] * i) && dic[lcm / nm[1] * i] != t[i])
            {
                WriteLine(-1);
                return;
            }
        }
        WriteLine(lcm);
    }
    static long Lcm(long a, long b)
    {
        return a * b / Gcd(a, b);
    }
    static long Gcd(long a, long b)
    {
        if (b == 0) return a;
        return Gcd(b, a % b);
    }
}


Measured memory_bytes: 20192
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;


ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}


int main(){FIN

    ll n, m;
    cin>>n>>m;
    vll x(n), y(n), z(n);
    REP(i,n) cin>>x[i]>>y[i]>>z[i];
    ll ans =0;
    for(ll i=0; i<(1<<3); i++){
        vll pm(3,1);
        REP(j,3) if(1&(i>>j)) pm[j]=-1;

        vll w(n);
        REP(i,n) w[i] = pm[0]*x[i] + pm[1]*y[i] + pm[2]*z[i];
        VSORTR(w);
        ll sum =0;
        REP(i,m) sum+=w[i];
        ans = max(ans, sum);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
S = input()
T = input()

if len(S) < len(T):
    print('UNRESTORABLE')
    exit()

ans = 'z'*51
for i in range(len(S)-len(T)+1):
    s = S[i:i+len(T)]
    for a,b in zip(s,T):
        if a==b or a=='?': continue
        break
    else:
        cand = S[:i] + T + S[i+len(T):]
        ans = min(ans, cand.replace('?','a'))

print('UNRESTORABLE' if ans=='z'*51 else ans)

Measured memory_bytes: 9064
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

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

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm> 
using namespace std;
#define ll long long
#define MN 100000
ll u[20],un,ans;
void dfs(int x,ll d,ll k)
{
	if(x>un){if(!d)ans+=k;return;}
	if(!u[x]){if(!d)ans+=k*10;return;}
	for(int i=-9;i<=9;++i)
		if(d+i*u[x]>=-u[x]&&d+i*u[x]<=u[x])
			dfs(x+1,d+i*u[x],k*(10-abs(i)-(x==1)));
}
int main()
{
	int d,i;ll a,b,c;
	scanf("%d",&d);
	for(c=10;;c*=10)
	{
		for(a=1,b=c,un=0;a<=b;a*=10,b/=10)u[++un]=b-a;
		if(u[un]>d)break;
		dfs(1,d,1);
	}
	cout<<ans;
}

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

int main(){
    int num,point[2] = {};
    string str1,str2;
    
    cin >> num;
    
    for(int i = 0;i < num;++i){
        cin >> str1 >> str2;
        
        
        if(str1 == str2){
            point[0]++;
            point[1]++;
        }
        else{
            long min1 = min(str1.length(),str2.length());
            for(int j = 0;j < min1;++j){
                if(str1.at(j) == str2.at(j)){
                    
                }
                else if(str1.at(j) == max(str1.at(j),str2.at(j))){
                    point[0] += 3;
                    break;
                }
                else if(str2.at(j) == max(str1.at(j),str2.at(j))){
                    point[1] += 3;
                    break;
                }
                
                // 最後まで同じ文字だった場合
                if(j + 1 >= min1){
                    // 文字数が多いほうがwin
                    if(str1.length() > str2.length()){
                        point[0] += 3;
                    }
                    else {
                        point[1] += 3;
                    }
                }
            }
        }
    }
    cout << point[0] << " " << point[1] << endl;
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll c1 = a * c;
    ll c2 = a * d;
    ll c3 = b * c;
    ll c4 = b * d;
    ll ans = max({c1, c2, c3, c4});
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
# -*- coding: utf-8 -*-
 
from math import ceil
times = [int(input()) for i in range(5)]

# timesの各要素を10で割った余りをキーとしてソート
# ただし、余り0は最後に持ってきたいので各要素に-1してから余りを出している
times = sorted(times, key=lambda time: (time-1)%10)

# 端数が一番小さい時間以外は10の倍数に揃えて、最後に一番端数が小さい時間を足す
times= [(ceil(time/10))*10 for time in times[1:]] + [times[0]]
print(sum(times))


Measured memory_bytes: 2940
import heapq

n,m = map(int,input().split())

tank = []

p = []

for i in range(n):
    a,b = map(int,input().split())
    p.append([a,b])
p.sort()

q = 0
res = 0

for i in range(m+1):
    while q <= n-1 and p[q][0] <= i:
        heapq.heappush(tank,-p[q][1])
        q += 1
    
    if len(tank) == 0:
        continue
    else:
        res -= heapq.heappop(tank)
    #print(res)

print(res)

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    char c;
    int sum = 0;
    while (cin >> c){
        sum += c - '0';
        sum %= 9;
    }

    if (sum != 0)
        cout << "No\n";
    else
        cout << "Yes\n";

    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<string> s;
    s.push_back("pon");
    s.push_back("pon");
    s.push_back("hon");
    s.push_back("bon");
    s.push_back("hon");
    s.push_back("hon");
    s.push_back("pon");
    s.push_back("hon");
    s.push_back("pon");
    s.push_back("hon");

    cout << s[n % 10] << endl;
    return 0;
}


Measured memory_bytes: 3524
#include <iostream>
#include <algorithm>
#include <cmath>

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

int64_t lcm (int a, int b) {
  int64_t gcd = GCD(std::max(a, b), std::min(a,b));
  int64_t res = (int64_t)a * b / gcd;
  return res;
}

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

  int32_t A, B;
  std::cin >> A >> B;
  std::cout << lcm(A,B) << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
 
using namespace std;
typedef long long int ll;
const int INF = 0x3f3f3f3f;

  
 
int main(){
	int T = 1;
	//cin >> T;
	while (T--){
		string s,t;
		cin >> s >> t;
		if (t.substr(0,t.size()-1) == s) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}


Measured memory_bytes: 3600
#include <iostream>
#include <cstring>
#include <algorithm>
#include<queue>
#include<vector>
using namespace std;
#define rep(i,m,n) for(int i=m;i<=n;i++)
const int N = 3e5 + 10 , M = 1e3 + 10;
int a[M][M] , vis[M][M];
int nex[4][2] = {{1 , 0} , {-1 , 0} , {0 , 1} , {0 , -1}};
int n , m , cnt;
int c1 , c2 , d1 , d2;
int ans1=0;
int ans2=0;
struct node{
	int x , y;
};
bool check(int x , int y)
{
	ans1=ans2=0;
	if(x < 1 || x > n || y < 1 || y > m || a[x][y] == 2) return false;
	return true;
}
void bfs(int x , int y)
{ans1=ans2=0;
	queue<node>que;
	que.push({x , y});ans1=ans2=0;
	vis[x][y] = ++ cnt;
	while(!que.empty())
	{ans1=ans2=0;
		node u = que.front();
		que.pop();ans1=ans2=0;
		rep(i , 0 , 3)
		{ans1=ans2=0;
			int tx = u.x + nex[i][0] , ty = u.y + nex[i][1];
			if(vis[tx][ty] || !check(tx , ty)) continue ;ans1=ans2=0;
			vis[tx][ty] = cnt;ans1=ans2=0;
			que.push({tx , ty});ans1=ans2=0;
		}
	}
}
int vis1[N];
vector<int>G[N];
signed main()
{
	cin >> n >> m;ans1=ans2=0;
	cin >> c1 >> c2 >> d1 >> d2;ans1=ans2=0;
	rep(i , 1 , n) rep(j , 1 , m)
	{ans1=ans2=0;
		char ch;
		cin >> ch;ans1=ans2=0;
		if(ch == '.') a[i][j] = 1;
		else a[i][j] = 2;
	}
	rep(i , 1 , n) rep(j , 1 , m)
	{ans1=ans2=0;
		if(!vis[i][j] && a[i][j] == 1) bfs(i , j);
		ans1=ans2=0;
	}
	rep(i , 1 , n)
	{ans1=ans2=0;
		rep(j , 1 , m)
		{ans1=ans2=0;
			int x = vis[i][j];
			ans1=ans2=0;
			for(int h = i - 2 ; h <= i + 2 ; h ++)
			{ans1=ans2=0;
				for(int w = j - 2 ; w <= j + 2 ; w ++ )
				{ans1=ans2=0;
					if(!check(h , w) || !vis[i][j]) continue ;
					int y = vis[h][w];ans1=ans2=0;
					if(y == x) continue ;
					ans1=ans2=0;
					G[x].push_back(y) , G[y].push_back(x);
				}
			}
		}
	}ans1=ans2=0;
	queue<node>que;
	int ans = 0;ans1=ans2=0;
	if(vis[c1][c2] == vis[d1][d2]) return cout << 0 << '\n' , 0;
	que.push({vis[c1][c2] , 0});
	ans1=ans2=0;
	while(!que.empty())
	{ans1=ans2=0;
		node u = que.front() ; que.pop();
		for(auto i : G[u.x])
		{ans1=ans2=0;
			if(i == vis[d1][d2]) return cout << u.y + 1+ans1+ans2 << '\n' , 0;
			if(vis1[i]) continue ;ans1=ans2=0;
			vis1[i] = 1;ans1=ans2=0;
			que.push({i , u.y + 1});ans1=ans2=0;
		}
	}ans1=ans2=0;
	cout << -1 << '\n';
	return 0;
}


Measured memory_bytes: 40772
#if 0
date

solution
#endif
#include <cstdio>
#include <algorithm>
#include <cstring>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;
struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	inline operator char () { char x[3]; return scanf("%s", x), *x; }
} read;

const int maxn = 190;
char s[maxn][maxn];
int f[maxn][maxn][maxn], g[maxn][maxn][maxn];

void chkmax(int &x, int y) {
	if(y > x) x = y;
}

int main() {
	int n = read, m = read;
	for(int i = 1; i <= n; i ++)
		scanf("%s", s[i] + 1);

	for(int x = n; x; x --)
		for(int l = 1; l <= m; l ++)
			for(int r = l; s[x][l] == s[x][r]; r ++)
				f[x][l][r] = 1 + (s[x][l] == s[x + 1][l] ?
						f[x + 1][l][r] : 0);

	int ans = 0;
	while(f[1][1][m] < n) {
		++ ans;

		for(int x = 1; x <= n; x ++)
			for(int l = 1; l <= m; l ++)
				for(int r = l; r <= m; r ++)
					std::swap(f[x][l][r], g[x][l][r]);

		for(int x = 1; x <= n; x ++)
			for(int l = 1; l <= m; l ++) {
				int p = l;
				for(int r = l; r <= m; r ++) {
					int d = g[x][l][r];
					chkmax(f[x][l][r], d + g[x + d][l][r]);
					int now = std::min(g[x][l][p], g[x][p + 1][r]);
					int nxt = std::min(g[x][l][p + 1], g[x][p + 2][r]);
					while(p + 1 < r and now <= nxt) {
						++ p;
						now = nxt;
						nxt = std::min(g[x][l][p + 1], g[x][p + 2][r]);
					}
					chkmax(f[x][l][r], now);
				}
			}
	}

	printf("%d\n", ans);
}


Measured memory_bytes: 53376
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
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 (b<a) {a=b; return 1;} return 0;}

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...)
#define print(...)
#endif

int main() {
    int n, k; cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<ll> b;
    rep(i, n) {
        ll tmp = a[i];
        b.push_back(tmp);
        FOR(j, i+1, n) {
            tmp += a[j];
            b.push_back(tmp);
        }
    }
    sort(b.rbegin(), b.rend());
    vector<vector<int>> c(sz(b), vector<int>(41, 0));
    int loc = 0;
    for(const auto& num : b) {
        for(int i=40; i>=0; i--) {
            if (1ll<<i & num) c[loc][i]++;
            // debug(num, loc, i);
        }
        loc++;
    }
    print(c);
    ll ans = 0;
    bool found = false;
    set<int> st;
    for(int i=40; i>=0; i--) {
        if (!found) {
            st.clear();
            rep(j, sz(c)) {
                if (c[j][i]) st.insert(j);
            }
            if (sz(st)>=k) {
                found = true;
                ans += 1ll<<i;
            }
        } else {
            set<int> st2;
            for(const auto& s: st) {
                if (c[s][i]) st2.insert(s);
            }
            if (sz(st2)>=k) {
                st = st2;
                ans += 1ll<<i;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 108400
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  ll A, B, K;
  cin >> A >> B >> K;
  set<ll> st;
  rep(i,K){
    st.insert(A+i);
    st.insert(B-i);
  }
  for(auto s:st){
    if(A<=s && s<=B){
      cout << s<< endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256