akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main()
{
 int x,y,i,a;
 scanf("%d %d", &x,&y);
 while( x != 0 || y != 0) {
   i=i+1;
   if(x>y){
    a=x;
    x=y;
    y=a;
}
   printf("%d %d\n",x,y);
 scanf("%d %d", &x,&y);
 }
 return 0;
}

Measured memory_bytes: 600
(let* ((n (read))
       (m (read))
       (stu (loop :for k :from 1 :upto n :collect (list (read) (read))))
       (ckpt (loop :for k :from 1 :upto m :collect (list k (read) (read)))))
  (defun dist (a b)
    (+ (abs (- (first a) (first b))) (abs (- (second a) (second b)))))
  (defun f (k)
    (let* ((ans 1))
      (loop :for x :from 1 :upto m :do(if (> (dist k (cdr (nth (1- ans) ckpt))) (dist k (cdr (nth (1- x) ckpt)))) (setf ans x)))
      ans))
  (mapcar (lambda (j) (format t "~A~%" (f j))) stu))

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

using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))
#define FOR(i,j,k) for(int i=j;i<=k;i++)
#define REV(i,j,k) for(int i=j;i>=k;i--)
#define FORR(i,j,k,l) for(int i=j;i<=k;i+=l)
#define inf         freopen("in.txt", "r", stdin)
#define outf        freopen("out.txt", "w", stdout)
#define pf          printf
#define sf(n)       scanf("%d", &n)
#define sff(a,b)    scanf("%d %d", &a, &b)
#define sfff(a,b,c)    scanf("%d %d %d", &a, &b, &c)
#define clean(mat,n)   FOR(i,0,n) mat[i].clear()
#define minn          (long long)-1000000000000000000
#define maxx          (long long) 1000000000000000000
#define mod          1000000007
#define M_PI           3.14159265358979323846  /* pi */
#define LL           long long
#define NL '\n'
#define cnd tree[idx]
#define lnd (idx<<1)
#define rnd ((idx<<1)+1)
#define PB push_back
#define F first
#define S second
#define MAX 100010
#define MP make_pair
#define valid(nx,ny)  ((nx >= 0) && (nx < row) && (ny >= 0) && (ny < col))
typedef pair<int,int> PR;

int nega[MAX], posa[MAX], q, p, n, k;/// 3 1 -10 0 10

int main()
{
    ios::sync_with_stdio(false);
   /// inf;
    //outf;
    int a;

    cin >> n >> k;

    p = q = 1;
    FOR(i,0,n-1)
    {
        cin >> a;
        if(a < 0) nega[q++] = a;
        else if(a > 0) posa[p++] = a;
        else k--;
    }

    sort(nega, nega + q);
    reverse(nega, nega + q);

    int prin = mod;

    FOR(i,0,p-1)
    {
        int nd = k - i;
        if(nd < 0) break;
        if(nd < q)
        {
//            cout << posa[i] << ' ' << nega[nd] << endl;
            prin = min(prin, abs(posa[i] - nega[nd]) + min(abs(nega[nd]), posa[i]) );
        }
    }

    cout << prin << endl;

    return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

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

void Main()
{
    string n;
	cin >> n;
  	char c = n[0];
  	rep(i,n.size()-1) {
      	if(n[i] < n[i+1]) {
          	c = n[i]+1;
        	break;
        }else if(n[i] > n[i+1]){
        	break;
        }
    }
  	rep(i,n.size()) cout << c;
    cout << endl;
  	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline long toLong(string s) {long v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const double EPS = 1e-9;
const double INF = 1e9;



int main(){
	int x,h;
	while(cin>>x>>h){
		if(x==0&&h==0)break;
		double p=(double)x/2.0;
		double sum=x*x+sqrt(p*p+h*h)*x*2.0;
		cout<<fixed<<setprecision(6)<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 1232
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
using namespace std;


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





int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  int m;
  cin >> m;
  vector<string> t(m);
  rep(i, m) cin >> t[i];
  set<string> str;

  int ans = 0;
  for(int i = 0; i < n; ++i){
    int sum = 0;

    auto itr = str.find(s[i]);
    if(itr == str.end()){
      str.insert(s[i]);
      for(int j = 0; j < n; ++j){
        if(s[i] == s[j]){
          sum++;
        }
      }
      for(int j = 0; j < m; ++j){
        if(s[i] == t[j]){
          sum--;
        }
      }
    }

    ans = max(ans, sum);
  }
  if(ans < 0) ans = 0;
  cout << ans << endl;
}


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

double n,m,sumv,ans=0;
double a[100005];

signed main()
{
	cin>>n>>m;
	for (int i=1;i<=n;i++)
	{
		cin>>a[i];
		sumv+=a[i];
	}
	double num=sumv*(1.00/(4.00*m));
	
	for (int i=1;i<=n;i++)
	{
		if (a[i]>=num)  ans++;
	}
	if (ans>=m)  cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
long long int fa[200005];
void ff(long long int p)
{
	fa[0] = 1;
	long long int i;
	for (i = 1; i < 200005; i++)
		fa[i] = fa[i - 1] * i % p;
	return;
}
long long int modpow(long long int a, long long int n, long long int p)
{
	if (n < 0)return 0;
	long long int res = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			res = res * a % p;
		a = a * a % p;
		n /= 2;
	}
	return res;
}
long long int comb(long long int n, long long int r, long long int p)
{
	if (n < 0 || r < 0)
		return 0;
	long long int res = fa[n];
	res = res * modpow(fa[r], p - 2, p) % p;
	res = res * modpow(fa[n - r], p - 2, p) % p;
	return res;
}
int main()
{
	long long int n, m, k;
	scanf("%lld %lld %lld", &n, &m, &k);
	long long int p = 1000000007;
	long long int ans = 0;
	long long int i;
	for (i = 1; i < n; i++)
		ans = (ans + i * (n - i) * m * m) % p;
	for (i = 1; i < m; i++)
		ans = (ans + i * (m - i) * n * n) % p;
	ff(p);
	ans = ans * comb(n * m - 2, k - 2, p) % p;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int MAX_A = 1000005;

int main() {
    int N; cin >> N;
    vector<int> A(N), C(MAX_A);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        C[A[i]]++;
    }
    
    bool pairwise = true;;
    for (int i = 2; i < MAX_A; i++) {
        int cnt = 0;
        for (int j = i; j < MAX_A; j+=i) {
            cnt += C[j];
        }
        if (cnt > 1) {
            pairwise = false;
            break;
        }
    }
    if (pairwise) {
        cout << "pairwise coprime" << endl;
        return 0;
    }

    int g = 0;
    for (int i = 0; i < N; i++) g = __gcd(g, A[i]);
    if (g == 1) {
        cout << "setwise coprime" << endl;
        return 0;
    }

    cout << "not coprime" << endl;
    return 0;
}

Measured memory_bytes: 11148
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Threading.Tasks;

class Program
{
	static int D;
	static int[] Ci;
	static int[][] Sdi;
	static int[] Li;

	static int tests = 26;

	//開催しなかった場合と開催した場合の満足度の差を求める
	static int CalcDiff(int d, int i){
		//開催た場合の増加
		int plus = Sdi[d][i];
		//開催しなかった場合の減少
		int minus = Ci[i] * (d - Li[i]);

		return (plus + minus);
	}

	//Solve
	static int Solve(int d){
		//満足度の変化が最大になるiを求める
		int max = -100000000;
		int maxIdx = 0;
		for(int i=0; i<tests; i++){
			int satis = CalcDiff(d, i);
			if(satis > max){
				max = satis;
				maxIdx = i;
			}
		}

		return maxIdx;
	}

	//満足度の差異の計算
	static int CalcSatis(int d, int i){
		int satis = Sdi[d][i];

		for(int j=0; j<tests; j++){
			if(j == i){
				continue;
			}
			else{
				satis -= Ci[j] * (d - Li[j]);
			}
		}

		return satis;
	}

	//Main
	static void Main(string[] args)
	{
		//読み込む
		D = int.Parse(Console.ReadLine());

		//初期化
		Ci = new int[tests];
		Sdi = new int[D][];
		Li = new int[tests];

		//Liは-1で初期化
		for(int i=0; i<tests; i++){
			Li[i] = -1;
		}

		//読み込む
		Ci = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
		for(int i=0; i<D; i++){
			Sdi[i] = new int[tests];
			Sdi[i] = Console.ReadLine().Split(' ').Select(j => int.Parse(j)).ToArray();
		}

		/*debug
		Console.WriteLine(Ci[1]);
		Console.WriteLine(Sdi[0][0]);
		*/

		//出力準備（AutoFlushを切る）
		var sw = new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false};
		Console.SetOut(sw);

		int totalSatis = 0;

		for(int i=0; i<D; i++){
			int t = Solve(i);

			/*debug
			Console.Write("Ans:");
			*/

			//出力
			Console.WriteLine(t+1);

			/*debug
			スコアの確認
			totalSatis += CalcSatis(i,t);
			Console.WriteLine("Score:{0}", totalSatis);
			*/

			//データを更新
			Li[t] = i;
		}

		//出力終了
		Console.Out.Flush();
	}
}


Measured memory_bytes: 19724
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<Integer>();
        int dp[] = new int[N];
        for (int i=0;i<N;i++){
        dp[i] = 2147000000;
        }
      
        for(int i=0;i<N;i++){
          list.add(sc.nextInt());
        }
        dp[0] = 0;
        for(int i=0;i<N-1;i++){
          dp[i+1] = Math.min(dp[i]+Math.abs(list.get(i+1)-list.get(i)),dp[i+1]);
          if (i+2<=N-1){
          dp[i+2] = Math.min(dp[i]+Math.abs(list.get(i+2)-list.get(i)),dp[i+2]);
          }
        }
      
        System.out.println(dp[N-1]);
    }
}

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

int main(){
  int N,L;
  cin >> N >> L;
  vector<int> v(N);
  int sum = 0;
  for(int i = 0; i < N; i++){
    v.at(i) = L + i;
    sum += v.at(i);
  }
  
  int tmpans = 1000000;
  int index;
  for(int i = 0; i < N;i++){
    int after = sum - v.at(i);
    int diff = abs(sum - after);
    if(diff < tmpans){
      tmpans = diff;
      index = i;
    }
  }
  cout << sum - v.at(index) << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
	cin>>n;
	if(n == 1 || n == 2){
		puts("No");
		return 0;
	}
	if(n == 3){
		puts("Yes");
		puts("1 2");
		puts("2 3");
		puts("3 4");
		puts("4 5");
		puts("5 6");
		return 0;
	}
	int ma = 0;
	for(int i = 2;i <= n; i <<= 1){
		if(n >= i - 1)ma = i - 1;  
	}
	if(n - ma == 1){
		puts("No");
		return 0;
	}
	puts("Yes");
	for(int i = 1;i < ma; i++){
		printf("%d %d\n", i, i + 1);
		printf("%d %d\n", i + n, i + n + 1);
	}
	printf("%d %d\n", ma, n + 1);
	int now = ma + 1, sum = 0;
	for(int i = now;i <= n; i++)sum ^= i;
	if(sum == 0){
		for(int i = now;i < n; i++){
			printf("%d %d\n", i, i + 1);
			printf("%d %d\n", i + n, i + n + 1);
		}
		printf("%d %d\n", n, now + n);
		printf("%d %d\n", 1, n);
	}
	else if(sum == 1){
		for(int i = now;i < n; i++){
			printf("%d %d\n", i, i + 1);
			printf("%d %d\n", i + n, i + n + 1);
		}	
		printf("%d %d\n", n, 1);
		printf("%d %d\n", 1, n + now);	
	} 
	else {
		sum ^= n;
		int x = n ^ now;
		for(int i = now;i < n - 1; i++){
			printf("%d %d\n", i, i + 1);
			printf("%d %d\n", i + n, i + n + 1);
		}		
		if(sum == 0){
			printf("%d %d\n", n - 1, x + n - 1);
			printf("%d %d\n", x, now + n);
			printf("%d %d\n", n, now + n);
			printf("%d %d\n", x, n + n);
		}
		else {
			printf("%d %d\n", n - 1, x ^ 1);
			printf("%d %d\n", x, now + n);
			printf("%d %d\n", now + n, n);
			printf("%d %d\n", n + n, x);
		}
	}
	return 0;
}

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

typedef int i32;
typedef long long i64;
typedef unsigned int u32;
typedef unsigned long long u64;


template<typename First, typename Second, typename Third>
struct triple {
   First first;
   Second second;
   Third third;
};


#define debug(x)  cerr<<x<<"\n";
#define loop(i,n) for(i32 i = 0; i < n; ++i)
#define pi  pair<int,int>
#define ti  tuple<int,int,int>
#define mt  make_tuple
#define mk  make_pair
#define vi  vector<int>
#define vll vector<i64>
#define fastInOut ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pr(a) for(auto x:a) cout<<x<<" ";
#define prmap(m) for(auto x:m) cout<<x.first<<" "<<x.second<<"\n";
using namespace std;

bool isPrime(i64 x){
	
	for(i64 i=2;i*i<=x;i++)
		if(x%i==0)
			return false;
	return true;
}

vector<i32>v;
const i32 N=7e7+9;
bool prime[N]; 
void SieveOfEratosthenes() 
{
    

    for (int  p=2; p*p<=N; p++){ 
        if (prime[p] == false){ 
            for (int  i=p*p; i<=N; i += p) 
                prime[i] = true; 
        } 
    } 
    int u=0,mx=0;
    for (int p=2; p<=N; p++) 
      if (!prime[p]) {
          v.push_back(p);
      }
   
} 
int main(){
	fastInOut
		
	SieveOfEratosthenes();
	i32 c;
	cin>>c;
	if(isPrime(c)){
		cout<<c;
		return 0;
	}
	vector<i32>::iterator  u=upper_bound(v.begin(),v.end(),c);
	cout<<v[(u-v.begin())];
    return 0;
}


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

//使用する配列の最大要素数
#define MAX_SIZE_N 100001
//使用する変数の宣言と初期化
int N=0;
int A[MAX_SIZE_N]={0};
int n[MAX_SIZE_N]={0};
int result=0;

void sort2vectors(vector<int> &av, vector<int> &bv)
{
        int n = av.size();
        vector<int> p(n), av2(n), bv2(n);
        iota(p.begin(), p.end(), 0);
        sort(p.begin(), p.end(), [&](int a, int b) { return av[a] < av[b]; });
        for (int i = 0; i < n; i++) {
                av2[i] = av[p[i]];
                bv2[i] = bv[p[i]];
        }
        av = av2;
        bv = bv2;
}

int main()
{
  cin >> N;
  for(int i=1;i<=N;++i){ 
    cin >> A[i];
    n[i]=i;
  }

  vector<int> av(A, A+N+1);
  vector<int> bv(n, n+N+1);

  sort2vectors(av, bv);

  //答え
  for(int i=1;i<=N;++i){ 
    cout << bv[i] << " ";
  }
    
  return 0;
}

Measured memory_bytes: 2944
#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(10);
    s[0] = "pon";
    s[1] = "pon";
    s[2] = "hon";
    s[3] = "bon";
    s[4] = "hon";
    s[5] = "hon";
    s[6] = "pon";
    s[7] = "hon";
    s[8] = "pon";
    s[9] = "hon";

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


Measured memory_bytes: 3604
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long R;
  cin >> R;
  string ans = "ABC";
  if (R >= 1200) ans = "ARC";
  if (R >= 2800) ans = "AGC";
  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


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

using namespace std;

#define ll long long
#define rep(i,n) for(int i=1;i<=(n);i++)
#define rep0(i,n) for(int i=0;i<(n);i++)

const ll INF=1e9+7;
int n,gl,gr;
string s;
int main()
{
	/*freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
	cin>>n>>s;
	rep0(i,n){
		if(s[i]=='('){
			gl++;
		}
		else if(gl>0){
			gl--;
		}
		else{
			gr++;
		}
	}
	rep(i,gr){
		cout<<'(';
	}
	cout<<s;
	rep(i,gl){
		cout<<')';
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){	
      char a,b;
      cin>>a>>b;
     if (a=='H'){
	 
          if(b=='H')
              cout<<"H";
          else
	          cout<<"D";
	 
 	   }else{
 	   	 if(b=='H')
              cout<<"D";
          else
	          cout<<"H";
 	   	
		} 
		  
     
     
     
     
     
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, i;
    int arr[20];
    cin >> n;
    for(i=0; i<n; i++){
        cin >> arr[i];
    }
    int tArr[3];
    int ans=0;
    for(i=1; i<n-1; i++){
        tArr[0]=arr[i-1];
        tArr[1]=arr[i];
        tArr[2]=arr[i+1];
        sort(tArr, tArr+3);
        if(tArr[1]==arr[i]){
            ans++;
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
def main():
    h, w, m = map(int, input().split())
    mapa = {}
    strings = [0]*h
    rows = [0]*w
    for _ in range(m):
        h1, w1 = map(int, input().split())
        if not mapa.get(h1-1, 0):
            mapa[h1-1] = []
        mapa[h1-1].append(w1-1)
        strings[h1-1] += 1
        rows[w1-1] += 1
    
    max_s = max(strings)
    max_r = max(rows)
    strings_max = []
    rows_max = []
    for i in range(h):
        if strings[i] == max_s:
            strings_max.append(i)
    for i in range(w):
        if rows[i] == max_r:
            rows_max.append(i)
    
    forbidden_positions = set(mapa[strings_max[0]])
    for item in strings_max[1:]:
        forbidden_positions.intersection_update(set(mapa[item]))

    answer_set = set(rows_max).difference(forbidden_positions)
    if answer_set:
        print(max_s + max_r)
    else:
        print(max_s + max_r - 1)

main()


Measured memory_bytes: 127720
let n = Scanf.scanf " %d" (+) 0
let xyhs = Array.to_list @@ Array.init n @@ fun _ -> Scanf.scanf " %d %d %d" @@ fun a b c -> a, b, c
let f cx cy ch x y h = max 0 @@ ch - abs (x - cx) - abs (y - cy) = h
let xyh = try Some (List.find (fun (_, _, h) -> h > 0) xyhs) with _ -> None
let g cx cy = function None -> 1 | Some (x, y, h) -> h + abs (x - cx) + abs (y - cy)
let _ = for i = 0 to 100 do for j = 0 to 100 do let ch = g j i xyh in
  if List.for_all (fun (x, y, h) -> f j i ch x y h) xyhs then (Printf.printf "%d %d %d\n" j i ch; exit 0) done done

Measured memory_bytes: 1024
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iostream>

using namespace std;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b>=c){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
}



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

int main() { string str; cin >> str; int cnt = 0;

for(int i = 0; i < 4; i++){
  if(str.at(i) == '+') cnt++;
}
cout << 2 * cnt - 4 << endl;
  return 0;
 
}
   

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int num1,num2;
    for(num1 = 1; num1 < 10; num1++){
        for(num2 = 1; num2 < 10; num2++){
            printf("%dx%d=%d\n",num1,num2,num1*num2);
        }
    }
    return 0;
}

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

#define ll long long 

signed main()

{
   
      ios_base::sync_with_stdio(false);   
      cin.tie(NULL);
      ll n,c = 0;
      cin>>n;
      ll a[n];
      for(ll i = 0;i<n;i++)
      {
        cin>>a[i];
        if(a[i]<0)
        {
          a[i]=-a[i];
          c++;
        }
      }
      sort(a,a+n);
      ll x= 0;
      for (int i = 0; i < n; ++i)
      {
        x+=a[i];
        /* code */
      }
      if(c%2)
      {
        x-=2*a[0];
      }
      cout<<x;

}

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

int main(){

    int N;
    cin >> N;

    double A[N];
    for(auto& temp:A){
        cin >> temp;
    }

    double sum = 0;
    for (size_t i = 0; i < N; i++)
    {
        sum += 1/A[i];
    }
    double ans = 1/sum;
    
    cout<< std::fixed << std::setprecision(15)<< ans <<endl;

    return 0;
}

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

string s;

bool pc(int l, int r)
{
	for (int i = l; i <= r; i++)
		if (l < i && s[i] == '#' && s[i - 1] == '#')
			return false;
	return true;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n, a, b, c, d; cin >> n >> a >> b >> c >> d;
	cin >> s; s = '.' + s;
	if ((!pc(a, c)) || (!pc(b, d))) {
		cout << "No" << '\n';
		return 0;
	}
	if (d < c) {
		for (int i = b; i <= d; i++)
			if (i > 1 && i < n && s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.') {
				cout << "Yes" << '\n';
				return 0;
			}
		cout << "No" << '\n';
	}
	else 
		cout << "Yes" << '\n';
	return 0;
}

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


int main()
{
    int h, w;

    scanf("%d %d", &h, &w);

    char mass[h][w];
    char dummy;

    scanf("%c", &dummy);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            scanf("%c", &mass[i][j]);
        }
        scanf("%c", &dummy);
    }

    int idx_h[h] = {0}, idx_w[w] = {0};
    bool flag = false;

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (mass[i][j] == '#') {
                flag = true;
                break;
            }
        }
        if (flag) {
            flag = false;
            idx_h[i] = i;
            continue;
        }

        idx_h[i] = -1;
    }

    flag = false;
    for (int i = 0; i < w; i++) {
        for (int j = 0; j < h; j++) {
            if (mass[j][i] == '#') {
                flag = true;
                break;
            }
        }
        if (flag) {
            flag = false;
            idx_w[i] = i;
            continue;
        }

        idx_w[i] = -1;
    }

    int count_h = 0;
    for (int i = 0; i < h; i++) {
        if (idx_h[i] != -1) count_h++;
    }

    int count_w = 0;
    for (int i = 0; i < w; i++) {
        if (idx_w[i] != -1) count_w++;
    }

    char ans[count_h][count_w];
    int c_h = 0, c_w = 0;

    flag = false;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (idx_h[i] != -1 && idx_w[j] != -1) {
                ans[c_h][c_w] = mass[idx_h[i]][idx_w[j]];
                c_w++;
                flag = true;
            }
        }
        if (flag) {
            c_h++;
            flag = false;
        }

        c_w = 0;
    }

    for (int i = 0; i < count_h; i++) {
        for (int j = 0; j < count_w; j++) {
            printf("%c", ans[i][j]);
        }
        printf("\n");
    }
}

Measured memory_bytes: 128
N = int(input())

ls = []
P = map(int,input().split())
  
for i in P:
	ls.append(i)
  
ind_i = 0
ind_j = 1
ind_k = 2
cnt = 0
for p in range(N -2):
	i = ls[ind_i]
	j = ls[ind_j]
	k = ls[ind_k]
	if i < j < k or k < j < i:
		cnt += 1
	ind_i += 1
	ind_j += 1
	ind_k += 1
  
print(cnt)



Measured memory_bytes: 3064
use proconio::input;

fn main() {
    input! {
        a: i64,
        b: i64,
        c: i64,
        d: i64,
    }

    let x = (a + d - 1) / d;
    let y = (c + b - 1) / b;

    if x >= y {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2172
prize = {1:300000,2:200000,3:100000}

a,b = [int(i) for i in input().split()]

if a == b == 1:
    print(1000000)
elif a < 4 and b < 4:
    print(prize[a] + prize[b])
elif a >= 4 and b < 4:
    print(prize[b])
elif b >= 4 and a < 4:
    print(prize[a])
else:
    print(0)


Measured memory_bytes: 3060
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    t = f()
    v = f()
    


    sumt = sum(t)*2
    vs = [100000000] * (sumt+1)

    vs[0] = 0

    for i in range(1,sumt):
        totalt = 0
        idx = 0
        for k in range(n):
            totalt += t[k]*2
            if totalt >= i:
                idx = k
                break

        vs[i] = min(vs[i-1]+0.5, v[idx])

    vs[sumt] = 0
    for i in range(sumt-1, 0, -1):
        totalt = 0
        idx = 0
        for k in range(n):
            totalt += t[k]*2
            if totalt >= i+1:
                idx = k
                break

        vs[i] = min(vs[i+1]+0.5, vs[i], v[idx])

    ans = 0
    for i in range(sumt):
        ans += (vs[i]+ vs[i+1])/4


    # print(dict(zip(range(len(vs)), vs)))
    print(ans)

solve()


Measured memory_bytes: 3316
def solve():
    X, N = map(int,input().split())
    p = set(map(int,input().split()))

    ans = float('inf')
    for i in range(102):
        if not i in p:
            if abs(ans-X) > abs(i-X):
                ans = i
    
    print(ans)

if __name__ == '__main__':
    solve()


Measured memory_bytes: 61944
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		double r = in.nextDouble();

		double area = r * r * Math.PI;
		double circumference = 2 * r * Math.PI;

		System.out.printf("%.5f %.5f", area, circumference);
	}
}

Measured memory_bytes: 18904
#include <bits/stdc++.h>
using namespace std;
int main(){
    vector<char> vec = {'x'};
    char tmp;
    while(cin >> tmp){
        if(tmp=='S'){
            vec.push_back('S');
        }
        else if(tmp=='T'){
            if(vec.back()=='S'){
                vec.pop_back();
            }
            else{
                vec.push_back('T');
            }
        }
    }
    cout << vec.size() -1;
}



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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<long> prime, sieve(31622, 1);
    for(long i = 2; i < 31622; ++i)
        if(sieve[i]){
            prime.push_back(i);
            for(auto j = i * i; j < 31622; j += i)sieve[j] = 0;
        }

    vector<long> a(N);
    long C;
    for(auto& i : a)cin >> i;
    cin >> C;
    long u{C};
    for(const auto i : a)u = __gcd(u, abs(i));

    for(const auto p : prime)
        if(u % p == 0 && cout << p << endl)
            while(u % p == 0)u /= p;
        else if(C % p == 0 && p <= N){
            vector<long> v(p);
            for(unsigned long j = 0, k = 0; j < N; ++j, k = k == p - 2 ? 0 : ++k)v[k] += a[j];
            if(none_of(v.begin(), v.end(), [&p](auto x){return x % p;}))cout << p << endl;
        }
    if(u ^ 1)cout << u << endl;
}

Measured memory_bytes: 768
#include<iostream>
#include<vector>
#include<cstdint>
#include<algorithm>
int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int N, Q; std::cin >> N >> Q;
  std::vector<int64_t> A(N);
  for(auto& Ai: A) std::cin >> Ai;
  int tma = (N+1)/2;
  std::vector<int64_t> ans(tma+1, 0), step(tma+1, 0);
  for(int i = 1; i < ans.size(); ++i) ans[i] = ans[i-1] + A[N-i];
  int j = N+1-tma*2;
  for(int i = 1; i < step.size(); ++i) { step[i] = step[i-1] + A[j]; j+=2; }
  for(int i = 0; i < ans.size(); ++i) ans[i] += step[tma-i];

  for(int q = 0; q < Q; ++q) {
    int64_t X; std::cin >> X;
    int l = A.end() - std::lower_bound(A.begin(), A.end(), X);
    int ok = (l+1)/2, ng = l+1;
    auto isOK = [&](int nt) {
      if(nt+nt-1 > N) return false;
      int64_t tmi = *(A.end()-nt);
      int64_t ami = *(A.end()-(nt+nt-1));
      return ami >= X+X-tmi;
    };
    while(ng - ok > 1) {
      int mid = (ok+ng)/2;
      if(isOK(mid)) ok = mid; else ng = mid;
    }
    std::cout << ans[ok] << "\n";
  }
  return 0;
}

Measured memory_bytes: 3328
import java.io.*;

import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Main {
	
	
	
	
    public static void main(String[] args) {
    	Scanner sc=new Scanner(System.in);
    	int a=sc.nextInt();
    	int b=sc.nextInt();
    	int c=sc.nextInt();
    	int temp1=b;
    	b=a;
    	a=temp1;
    	int temp=c;
    	c=a;
    	a=temp;
    	
    	System.out.print(a+" "+b+" "+c);
    	
    	
       
        
       
    	

     }
    	
    	
    	
    	
    
}



Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstdlib>

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

using namespace std;

// Globals
string a, b;
int x;

void input() {
  cin >> a >> b;
}

void solve() {
  string ab = a+b;
  x = atoi(ab.c_str());
  rep(i, x) {
    if(i*i == x) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}

int main() {
  input();
  solve();
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef vector<llong> LV;

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

int main() {
	llong n,a,b;
    string S;
    llong ans=0;
    cin >>n >>a>>b;

    cout << min(n*a,b) << endl;

    return 0;
    




}


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

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'

vector<vector<pair<int,int> > > g;
vector<bool> used;

int prim(){
    priority_queue<pair<int,int>, vector<pair<int,int> >, greater<pair<int,int> > > que;
    que.push(make_pair(0,0));
    int ret = 0;
    while(!que.empty()) {
        int cst = que.top().first, v = que.top().second;
        que.pop();
        if(used[v]) continue;
        used[v] = true;
        ret += cst;
        for(int i = 0; i < g[v].size(); i++){
            que.push(make_pair(g[v][i].first, g[v][i].second));
        }
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	int n;
	cin >> n;
	g.resize(n);
	used.resize(n);
	rep(i,n) used[i] = false;
	vector< pair < pair < int, int >, int > > x(n), y(n);
	rep(i,n){
		int a,b;
		cin >> a >> b;
		x[i] = make_pair(make_pair(a,b), i);
		y[i] = make_pair(make_pair(b,a), i);
	}
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());

	rep(i,n-1){
		int cost = min(abs(x[i].first.first - x[i+1].first.first), abs(x[i].first.second - x[i+1].first.second));
		g[x[i].second].push_back(make_pair(cost, x[i+1].second));
		g[x[i+1].second].push_back(make_pair(cost,x[i].second));

		cost = min(abs(y[i].first.first - y[i+1].first.first), abs(y[i].first.second - y[i+1].first.second));
		g[y[i].second].push_back(make_pair(cost, y[i+1].second));
		g[y[i+1].second].push_back(make_pair(cost,y[i].second));
		
	}
	int ret = prim();
	cout << ret << endl;
}

Measured memory_bytes: 12404
import java.util.Scanner;
class Main{
  public static void main(String[] args){
	int ans = 0;
    Scanner scan = new Scanner(System.in);
    for(int i = 0;i < 5;i++){
      if(scan.nextInt() == 0)ans = i+1;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 35416
#include <stdio.h>

int main(void)
{
  int a, b, c;
  int s = 0;
  int f = 0;
  int i;
  scanf("%d %d %d", &a, &b, &c);
  for ( i=0; i<101; i++ ) {
    s += a;
    if ( s % b == c ) {
      f = 1;
      break;
    }
  }
  if ( f ) {
    puts("YES");
  } else {
    puts("NO");
  }
}

Measured memory_bytes: 128
#include<stdio.h>
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
int main(void){
    int a,b;
    scanf("%d %d",&a,&b);
    double a_,b_;
    a_ = a * 100.0 / 8.0;
    b_ =  b * 10;
    double ta,tb;
    ta = (a+1) * 100.0 / 8.0;
    tb = (b+1) * 10.0;
    double num = MAX(a_,b_);
    if(num > (int)num)num++;
    int n = num;
    if(num < MIN(ta,tb))printf("%d",n);
    else printf("%d",-1);
    return 0;
}

Measured memory_bytes: 128
import java.util.*;
class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNextInt()){
			int a = sc.nextInt(); 
			int b = sc.nextInt();
			int ans=a+b;
			int count=0;
			while(ans>=1){
				ans=ans/10;
				count++;
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 20372
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
int R, C, n;
vector<tuple<int, int, int> > type[4];
bool cmp(tuple<int, int, int> a, tuple<int, int, int> b){
    int ax, ay, az; tie(ax, ay, az) = a;
    int bx, by, bz; tie(bx, by, bz) = b;
    if(ax == 0){
		if(bx != 0) return true;
		return ay < by;
	}else if(ay == C){
		if(bx == 0) return false;
		if(by != C) return true;
		return ax < bx;
	}else if(ax == R){
		if(bx == 0 || by == C) return false;
		if(bx != R) return true;
		return ay > by;
	}else if(ay == 0){
		if(by != 0) return false;
		return  ax > bx;
	}
    return false;
}
int M(){
    if(!~scanf("%d %d %d", &R, &C, &n))
        return 0;
    for(int e = 0; e < 4; e++) type[e].clear();
    for(int e = 0; e < n; e++){
        int x1, y1, x2, y2;
        scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
        if(x1 == 0 || x1 == R || y1 == 0 || y1 == C){
			if(x2 == 0 || x2 == R || y2 == 0 || y2 == C){
				type[0].push_back(make_tuple(x1, y1, e));
				type[0].push_back(make_tuple(x2, y2, e));
			}
		}
    }
    sort(type[0].rbegin(), type[0].rend(), cmp);
    stack<int> stk;
    for(int e = 0; e < 4; e++)
        for(auto iv:type[e]){
            if(!stk.empty() && stk.top() == get<2>(iv)) stk.pop();
            else stk.push(get<2>(iv));
        }
    if(stk.empty()) printf("YES\n");
    else printf("NO\n");
    return 1;
}
int main(){
    while(M());
    return 0;
}


Measured memory_bytes: 4724
#include <stdio.h>

main()
{
	int n, i, ans = 0;
	scanf("%d", &n);
	char s[n+1];
	scanf("%s", s);
	for (i = 2; i < n; ++i)
		if (s[i] == 'C' && s[i-2] == 'A' && s[i-1] == 'B')
			++ans;
	printf("%d\n", ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,k,n) for(int i=k;i<=n;i++)
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define modp(x) ((x)%modn)
using namespace std;
const int maxn=100005;
const ll modn=1e9+7;
vector<int> v[maxn];
ll f[maxn][2];
int n,cnt;
void dfs(int x,int fa)
{
	if(v[x].size()==1 && fa!=-1)
	{
		f[x][0]=f[x][1]=1;
		return;
	}
	int sum0=1,sum1=1;
	rep(i,0,(int)(v[x].size()-1))
	{
		int y=v[x][i];
		if(y!=fa)
		{
			dfs(y,x);
			sum0=modp(sum0*f[y][0]);
			sum1=modp(sum1*(f[y][1]+f[y][0]));
		}
	}
	f[x][0]=sum1;
	f[x][1]=sum0;
}
int main()
{
	scanf("%d",&n);
	rep(i,0,n-2)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		v[x].pb(y);v[y].pb(x);
	}
	dfs(1,-1);
	printf("%lld",modp(f[1][0]+f[1][1]));
	return 0;
}

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

int main(){
    int a,b;
    cin >> a >> b;
    cout << max(0,a-2*b) << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string t;
	cin>>t;
	reverse(t.begin(),t.end());
	t+='0';
	ll ch[1000010][2];
	for(ll i=0;i<1000010;i++){
		for(ll j=0;j<2;j++){
			ch[i][j]=INF;
		}
	}
	ch[0][0]=0;
	for(ll i=0;i<t.size();i++){
		ll now=t[i]-'0';
		for(ll a=0;a<=9;a++){
			ll num=now;
			if(a>=now){
				ch[i+1][0]=min(ch[i+1][0],ch[i][0]+2*a-num);
			}
			if(a<now){
				ch[i+1][1]=min(ch[i+1][1],ch[i][0]+a+10-num);
			}
			if(a>=now+1){
				ch[i+1][0]=min(ch[i+1][0],ch[i][1]+2*a-(num+1));
			}
			if(a<now+1){
				ch[i+1][1]=min(ch[i+1][1],ch[i][1]+2*a+10-(num+1));
			}
		}
	}
	cout << ch[t.size()][0];
	// your code goes here
	return 0;
}

Measured memory_bytes: 20080
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define rrep(i,n) for (ll i = (n)-1; i >=0; --i)
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 (a>b) { a=b; return 1; } return 0; }

using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<ll, ll>;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const ll mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} c(200005);



int main() {
  ll n, k;
  cin >> n>>k;
  map<ll, ll> m;
  rep(i, 10) m[i]++;
  rep(i, k) {
    ll tmp;
    cin >> tmp;
    m[tmp]--;
  }

  rep(i, 110000){
    string tmp = to_string(i);
    bool flug = true;
    if(i<n)continue;
    rep(j, tmp.size()) {
      if(m[(tmp[j]-'0')]==0) {
	flug = false;
	break;
      }
    }
    if(flug){
      cout << i << endl;
      return 0;
    }
  }

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


Measured memory_bytes: 3328
#include<stdio.h>

int main(){
  
  int a,b;
  
  scanf("%d",&a);
  
  b = a % 10;
  //printf("a=%d b=%d\n",a,b);
  
  if(b == 2 || b == 4 || b == 5 || b == 7 || b ==9){
    printf("hon\n");
  }else if(b == 0 || b == 1 || b == 6 || b == 8){
    printf("pon\n");
  }else if(b == 3){
    printf("bon\n");
  }
    
  return 0;
        
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
template<class T> bool isIn(T a,vector<T> v){ for(T x:v){ if(a==x){return true;}} return false;}
string strReplace(string s,string target, string replacement){
  if (!target.empty()) {
      std::string::size_type pos = 0;
      while ((pos = s.find(target, pos)) != std::string::npos) {
        s.replace(pos, target.length(), replacement);
        pos += replacement.length();
      }
    }
    return s;
}
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MP make_pair

bool DEBUG = 0;

int main(){
  ll N; cin>>N;
  ll dp[61][3]; // 注目桁、a,bの差分
  FILL2(dp,61,3,0LL); 
  dp[60][0] = 1;
    
  for(int d=59;d>=0;--d){ // 最上位の桁から確定させていく
    for(int j=0;j<=2;++j){
      for(int k=0;k<=2;++k){
        int j_next = 2*j + ((N>>d)&1) - k; //遷移先の a,b の差分
        chmin(j_next,2);  // 大きい場合は2で十分
        if(j_next>=0){
          dp[d][j_next] += dp[d+1][j];
          dp[d][j_next] %= MOD;
        }
      }
    }
  }
  ll ans = dp[0][0];
  ans += dp[0][1];
  ans %= MOD;
  ans += dp[0][2];
  ans %= MOD;
  cout << ans << "\n";
}

Measured memory_bytes: 3640
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: i32,
        b: i32,
        c: i32,
    }
    
    println!{"{}", a * b / 2};
}

Measured memory_bytes: 4352
#include<set>  
#include<map>  
#include<stack>  
#include<cstdio>  
#include<queue>  
#include<cmath>  
#include<vector>  
#include<climits>  
#include<cstring> 
#include<iostream> 
#include<algorithm> 
using namespace std;
#define INF 0x3f3f3f3f
#define LL long long
int read(){ 
    int f=1,x=0; 
    char c=getchar(); 
    while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();} 
    while('0'<=c&&c<='9'){x=x*10+c-'0';c=getchar();} 
    return f*x; 
}
#define MAXN 2200000
struct edge{
    int v,w;
    edge(){}
    edge(int V,int W){v=V,w=W;}
};
int n,m;
struct node{
    int u,k;
    node(){}    
    node(int U,int K){u=U,k=K;}
    friend bool operator < (node a,node b){return a.u==b.u?a.k<b.k:a.u<b.u;}
};
struct node1{
    int u,v,k;
    node1(){}   
    node1(int U,int V,int K){u=U,v=V,k=K;}
};
vector<node> Make_zx;
vector<node1> Make_xx;
vector<edge> G[MAXN+5];
int dis[MAXN+5];
bool vis[MAXN+5];
queue<int>Q;
int SPFA(int S,int T){
    memset(vis,0,sizeof(vis));
    memset(dis,0x3f,sizeof(dis));
    dis[S]=0,vis[S]=1,Q.push(S);
    while(!Q.empty()){
        int u=Q.front(),v,w,siz=G[u].size();
        Q.pop();
        vis[u]=0;
        for(int i=0;i<siz;i++){
            v=G[u][i].v,w=G[u][i].w;
            if(dis[v]>dis[u]+w){
                dis[v]=dis[u]+w;
                if(!vis[v]){
                    vis[v]=1;
                    Q.push(v);
                }
            }
        }
    }
    return dis[T]==INF?-1:dis[T]/2;
}
int main(){
    n=read(),m=read();
    for(int i=1;i<=m;i++){
        int p=read()-1,q=read()-1,c=read()-1;
        Make_zx.push_back(node(p,c));
        Make_zx.push_back(node(q,c));
        Make_xx.push_back(node1(p,q,c));
        Make_xx.push_back(node1(q,p,c));
    }
    sort(Make_zx.begin(),Make_zx.end());
    for(int i=0;i<int(Make_zx.size());i++){
        G[n+i].push_back(edge(Make_zx[i].u,1));
        G[Make_zx[i].u].push_back(edge(n+i,1));
    }
    for(int i=0;i<int(Make_xx.size());i++){
        int l1=lower_bound(Make_zx.begin(),Make_zx.end(),node(Make_xx[i].u,Make_xx[i].k))-Make_zx.begin(),
        l2=lower_bound(Make_zx.begin(),Make_zx.end(),node(Make_xx[i].v,Make_xx[i].k))-Make_zx.begin();
        G[l1+n].push_back(edge(l2+n,0));
    }
    printf("%d\n",SPFA(0,n-1));
    return 0;
}

Measured memory_bytes: 96124
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);
            long lK = long.Parse(sS[1]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            long lOut = lK;
            long lKm = lK -1;
            for (int i = 2; i <= iN; i++)
            {
                lOut *= lKm;
            }

            // 出力
            Console.WriteLine("{0}", lOut.ToString());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }
}


Measured memory_bytes: 13268
<?php
fscanf(STDIN, "%d %d %d", $a, $b, $c);
$point1 = abs($a - $b) + abs($b - $c);
$point2 = abs($a - $c) + abs($b - $c);
$point3 = abs($a - $b) + abs($a - $c);

echo min($point1, $point2, $point3) . PHP_EOL;


Measured memory_bytes: 4728
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
int main(){
    int a[5];
    int max=0;
    int num=0;
    int ans=0;
    int tmp;
    rep(i,0,4){
        cin>>a[i];
        if(a[i]%10!=0) tmp = 10 - (a[i]%10);
        else tmp = 0;
        if(max<tmp){
            max = tmp;
            num = i;
        }
    }
    tmp = a[4];
    a[4] = a[num];
    a[num] = tmp;
    rep(i,0,3){
        if(a[i]%10!=0) ans += a[i] + (10 - a[i]%10);
        else ans += a[i];
    }
    ans += a[4];
    cout<<ans<<endl; 
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    // Your code here!
    var x = readLine()!!.toLong()
    var numList:MutableList<Long> = mutableListOf()
    
    for(i in 1..x){
        if(i % 3 == 0.toLong() || i % 5 == 0.toLong()){
            numList.add(0)
        }else{
            numList.add(i)     
        }
    }
    println(numList.sum())
}


Measured memory_bytes: 58452
a = int(input())
ar = [0,0,0,0]
for i in range(a):
    l = input()
    if l == "AC":
        ar[0] += 1
    if l == "WA":
        ar[1] += 1
    if l == "TLE":
        ar[2] += 1
    if l == "RE":
        ar[3] += 1
print("AC x " + str(ar[0]))
print("WA x " + str(ar[1]))
print("TLE x " + str(ar[2]))
print("RE x " + str(ar[3]))

Measured memory_bytes: 9128