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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

struct b{
  int num;
  int c;
};

int main(){
  int n;
  cin >> n;
  vector<list<int>> e(n,list<int>());
  int a,b;
  for(int i=0;i<n-1;i++){
    cin >> a >> b;
    a--;
    b--;
    e[a].push_back(b);
    e[b].push_back(a);
  }
  queue<struct b> bfs;
  vector<int> color(n,-1);
  bfs.push({0,0});
  bfs.push({n-1,1});
  struct b now;
  while(!bfs.empty()){
    now=bfs.front();
    bfs.pop();
    for(auto itr=e[now.num].begin();itr!=e[now.num].end();itr++){
      if(color[(*itr)]==-1){
        color[(*itr)]=now.c;
        bfs.push({(*itr),now.c});
      }
    }
  }
  int f=0,s=0;
  for(int i=0;i<n;i++){
    if(color[i]==0) f++;
    else s++;
  }
  cout << (f>s?"Fennec":"Snuke") << endl;
  return 0;
}


Measured memory_bytes: 8448
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int i,c=0;
string s,t;
cin>>s;
cin>>t;
for(i=0;i<s.size();i++)
{
	if(s[i]!=t[i])
	{
		c++;
	}
}
cout<<c<<endl;


return 0;
}

Measured memory_bytes: 3448
#include "bits/stdc++.h"
using namespace std;
#define int long long

signed main() {
	string s;
	cin >> s;
	//vector<tuple<int, int, int>> t(m);
	//vector<int> p(m);
	
	vector<int> cnt(10);

	int a = 0;
	for (size_t i = 0; i < s.size(); i++)
	{
		if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
			cnt[a]++;
		}
		else {
			a++;
		}
	}

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

	cout << cnt[0] << endl;
}




Measured memory_bytes: 256
#include<stdio.h>
//#include<math.h>
int ifcl(int p0[2],int p1[2],int p2[2],int p3[2]){
  long long x0=p1[0]-p0[0],x1=p2[0]-p0[0],x2=p3[0]-p0[0],x3=x2-x1,x4=x0-x1,x5=-x1;
  long long y0=p1[1]-p0[1],y1=p2[1]-p0[1],y2=p3[1]-p0[1],y3=y2-y1,y4=y0-y1,y5=-y1;
  long long x6=p2[0]-p1[0],x7=p3[0]-p1[0]/*,x3=x2-x1,x4=x0-x1,x5=-x1*/;
  long long y6=p2[1]-p1[1],y7=p3[1]-p1[1]/*,y3=y2-y1,y4=y0-y1,y5=-y1*/;
  
  long long c1=(x0*y1-y0*x1)*(x0*y2-y0*x2),c2=(x3*y4-y3*x4)*(x3*y5-y3*x5);
  long long d1=x1*x6+y1*y6,d2=x2*x7+y2*y7,d3=x1*x2+y1*y2,d4=x6*x7+y6*y7;
  if(c1==0&&c2==0)return (d1>0&&d2>0&&d3>0&&d4>0)?0:1;
  return (c1<=0&&c2<=0)?1:0;
}
/*double dMIN(double a,double b){return a<b?a:b;}
double drpl(int p0[2],int p1[2],int p2[2]){
  int a=p0[1]-p1[1],b=p0[0]-p1[0],c=p0[0]*p1[1]-p1[0]*p0[1];
  int d=p2[1]-p1[1],e=p2[0]-p1[0];
  int f=p2[1]-p0[1],g=p2[0]-p0[0];
  if(a*d+b*e<0||a*f+b*g>0)return dMIN(hypot(d,e),hypot(f,g));
  return abs(p2[0]*a-p2[1]*b+c)/hypot(a,b);
}
double drll(int *p0,int *p1,int *p2,int *p3){
  double l=drpl(p2,p3,p0);
  l=dMIN(l,drpl(p2,p3,p1));
  l=dMIN(l,drpl(p0,p1,p2));
  l=dMIN(l,drpl(p0,p1,p3));
  if(ifcl(p0,p1,p2,p3))l=0;
  return l;
  }*/
int main(){
  int p[4][2],n,i;
  scanf("%d",&n);
  while(n--){
    for(i=0;i<8;i++)scanf(" %d",&p[i/2][i%2]);
    printf("%d\n",ifcl(p[0],p[1],p[2],p[3]));
  }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    ll n,ans=0;cin>>n;
    vector<ll> pos(200010,INF);
    rep(i,n){
        int x;cin>>x;
        pos[x]=i;
    }

    set<int> se;
    se.insert(-1);
    se.insert(n);

    for(int i=1;i <= n;i++)
    {
        se.insert(pos[i]);
        int rpos=*se.upper_bound(pos[i]);
        int lpos=*(--se.lower_bound(pos[i]));
        
        ans+=i*(rpos-pos[i])*(pos[i]-lpos);
    }

    cout<<ans<<endl;
}



Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

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

int main(){
    int d, w;
    while(cin>>d>>w, d){
        int e[d][w];
        for(int i=0; i<d; i++){
            for(int j=0; j<w; j++){
                cin>>e[i][j];
            }
        }

        int ans=0;
        for(int i=0; i<d; i++){
            for(int j=i+2; j<d; j++){
                for(int k=0; k<w; k++){
                    for(int l=k+2; l<w; l++){

                        int nmin=10, nmax=0;
                        for(int y=i; y<=j; y++){
                            for(int x=k; x<=l; x++){
                                if(y==i || y==j || x==k || x==l){
                                    chmin(nmin, e[y][x]);
                                }
                                else{
                                    chmax(nmax, e[y][x]);
                                }
                            }
                        }

                        int sum=0;
                        if(nmax<nmin){
                            for(int y=i; y<=j; y++){
                                for(int x=k; x<=l; x++){
                                    if(y==i || y==j || x==k || x==l){
                                        continue;
                                    }
                                    sum+=nmin-e[y][x];
                                }
                            }
                        }

                        chmax(ans, sum);
                    }
                }
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    bool yes = true;
    rep(i,n/2) if(s[i] != s[n-1-i]) yes = false;
    int m = (n-1)/2;
    rep(i,m/2) if(s[i] != s[m-1-i]) yes = false;
    int k = (n+3)/2 - 1;
    rep(i,m/2) if(s[i+k] != s[n-1-i]) yes = false;
    if(yes) cout << "Yes" << endl;
    else cout << "No" << endl;
	return 0;
}

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


using namespace std;

int main() {
    int A, B, C, K;
    
    cin >> A >> B >> C >> K;
    
    int a = max(A, max(B, C));
    
    int ans = A + B + C - a;
    
    for(int i = 0; i < K; ++i){
        a *= 2;
    }
    
    ans += a;
    
    cout << ans << endl;
}

Measured memory_bytes: 256
# include <algorithm>
# include <cassert>
# include <cctype>
# include <cstdio>
# include <cstdlib>
# include <cstring>
# include <cmath>
# include <iostream>
# include <map>
# include <queue>
# include <set>
# include <sstream>
# include <stack>
# include <string>
# include <vector>
# include <iomanip>

# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++)

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

const int INF = 1001001001;

int N, L;

int main() {
  cin >> N >> L;
  vector<string> S(N);

  rep (i, N) {
    cin >> S[i];
  }


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

  rep (i, S.size()) {
    cout << S[i];
  }

  cout << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main(){
long i,j,k;
string s;
double a[80];
for(;;){
getline(cin,s);
if(s=="")break;
i=j=0;
for(;;){
while(s[j]==' ')j++;
if(s[j]==0)break;
else if(s[j]=='+'){i--;a[i]+=a[i+1];j++;}
else if(s[j]=='-'&&(s[j+1]==' '||s[j+1]==0)){i--;a[i]-=a[i+1];j++;}
else if(s[j]=='*'){i--;a[i]*=a[i+1];j++;}
else if(s[j]=='/'){i--;a[i]/=a[i+1];j++;}
else{
k=s.find(' ',j);if(k==string::npos)k=s.size();
i++;a[i]=atof(s.substr(j,k-j).c_str());
j=k;
}
}
printf("%.6f\n",a[1]);
}
return 0;
}

Measured memory_bytes: 1256
#include <stdio.h>
int main(){
int a,b,c;
  scanf ("%d%d%d",&a,&b,&c);
  if (a>b-1 && a>c-1){
  printf ("%d",b+c);
  }
  else if (b>a-1 && b>c-1){
  printf ("%d",a+c);
  }
  else{
  printf ("%d",a+b);
  }
return 0;
}

Measured memory_bytes: 128
str_ori = input()
num = int(input())

result = []

for _ in range(num):

    table = list(map(str, input().split()))
    start = int(table[1])
    end = int(table[2]) + 1

    if table[0] == "print":
        result.append(str_ori[start:end])
    elif table[0] == "reverse":
        rev = str_ori[start:end]
        srev = rev[::-1]
        str_ori = str_ori[:start] + srev + str_ori[end:]
    elif table[0] == "replace":
        rep = table[3]
        str_ori = str_ori[:start] + rep + str_ori[end:]

for p in result:
    print(p)


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define ALL(v) v.begin(),v.end()
typedef long long ll;
int main() {
  int n; 
  int count=0; 
  cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin >> a.at(i);
  }
  for(int i=0; i<n; i++){
    if(a.at(i)==i+1){
      count++;
      i++;
    }
  }
  cout << count << endl;
}

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

using namespace std;

int main()
{

    int S;

    cin >> S;

    if(S < 100 || S > 1299){
        if(S % 100 >= 1 && S % 100 <= 12){
            cout << "YYMM" << endl;
        }else{
            cout << "NA" << endl;
        }
    }else{
        if(S % 100 >= 1 && S % 100 <= 12){
            cout << "AMBIGUOUS" << endl;
        }else{
            cout << "MMYY" << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <limits> 
using namespace std;


int main(){
	int n,min, max, offset;
//	int offset = numeric_limits<int>::min();
	cin>>n;
//	int array[n];
	cin>>min;
	cin>>max;
	offset = max - min;
	if(min>max) min = max;
	for(int i = 0; i<n-2; i++)
	{
		int temp, tempoff;
		cin>>temp;	
		if(min>temp) 
		{
			min = temp;
			
		} else
		{
			tempoff = temp-min;
			if(offset<tempoff) offset = tempoff;
		}
	}
		
//		if(i>=1)
//		{
//			for(int j = i-1; j>=0; j--) {
//				if(offset<array[i]-array[j])
//				offset = array[i]-array[j];
//			}
//		}
//	}
	
	cout<<offset<<endl;
	
	return 0;
}

Measured memory_bytes: 1160
points=[]
N=int(input())
dic={}
for _ in range(N):
    a,b=list(map(int,input().strip().split(' ')))
    points+=[(a,b)]

points=sorted(points)
for i in range(len(points)):
    dic[points[i]]=i

def find(points):
    diff={}
    for i in range(len(points)):
        for j in range(i+1,len(points)):
            a=points[j][0]-points[i][0]
            b=points[j][1]-points[i][1]
            if a!=0 or b!=0:
                diff[(a,b)]=1
    
    return diff

diff=find(points)

def find(X):
    a,b=X
    checked=[0]*len(points)
    ans=0
    for i in range(len(checked)):
        if checked[i]==0:
            ans+=1
            x,y=points[i]
            for j in range(1,len(checked)+1):
                temp_x,temp_y=x+a*j,y+b*j
                if (temp_x,temp_y) in dic:
                    order=dic[(temp_x,temp_y)]
                    checked[order]=1
                else:
                    break
    return ans

ANS=len(points)

for X in diff:
    ANS=min(ANS,find(X))
print(ANS)

                
                
    


Measured memory_bytes: 3188
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<int[]> map = new ArrayList<>();
        for (int i = 0; i < N; i++) {
        	int[] pos = new int[2];
        	pos[0] = sc.nextInt();
        	pos[1] = sc.nextInt();
        	map.add(pos);
        }
        String str = "";
        int index = 1;
        while (str.length() < N) {
        	str += index;
        	index++;
        }
        List<String> order = new ArrayList<>();
        pmt(str, "", order);
        double all = 0.0;
        for (String s : order) {
        	double total = 0.0;
        	for (int i = 1; i < s.length(); i++) {
        		int[] now = map.get((s.charAt(i) - '0') - 1);
        		int[] before = map.get((s.charAt(i - 1) - '0') - 1);
        		int x = (before[0] - now[0]) * (before[0] - now[0]);
        		int y = (before[1] - now[1]) * (before[1] - now[1]);
        		double dis = Math.sqrt(x + y);
        		total += dis;
        	}
        	all += total;
        }
        System.out.println(all/(double) order.size());
        
    }
    private static void pmt(String str, String c, List<String> order) {
    	for (int i = 0; i < str.length(); i++) {
    		if (str.length() == 1) {
    			order.add(c + str);
    		} else {
    			pmt(str.substring(0, i) + str.substring(i + 1),
    					c + str.substring(i, i + 1),
    					order);
    		}
    	}
    }
}

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

int main() {
  int N,A,B;
  int ab = 1;
  int w = 0;
  string S;

  cin >> N >> A >> B >> S;
  for(int i=0;i<N;++i){
    if(S.at(i) == 'a' && w < A+B){
      w+=1;
      cout << "Yes" << endl;
    }else if(S.at(i) == 'b' && w < A+B && ab <= B){
      w += 1;
      ab += 1;
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3724
A,B=map(int,input().split())
G=[[0]*100 for i in range(100)]
for i in range(50,100):
    G[i]=[1]*100
A-=1
B-=1
i=0
j=0
while(B):
    G[i][j]=1
    B-=1
    if j==98:
        j=0
        i+=2
    else:
        j+=2
i=51
j=0
while(A):
    G[i][j]=0
    A-=1
    if j==98:
        j=0
        i+=2
    else:
        j+=2
S=[]
print(100,100)
for i in range(100):
    s=""
    for j in range(100):
        if G[i][j]==0:
            s+="."
        else:
            s+="#"
    print(s)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>

#define rep(i,n) for(long long int (i)=0;(i)<n;(i)++)
#define repa(i,n) for(long long int (i)=0;i<=n;i++)
#define co(a) cout<<(a)<<endl;
typedef long long ll;
using namespace std;

int main(){
  string s,ans="";
  int n,a;
  cin >> s;
  cin >> n;
  a=s.size();
  for(int i=0;i<a;i+=n){
  	ans=ans+s[i];
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <map>
#include <iomanip>
#include <stdio.h>
#include <bitset>

typedef long long ll;

constexpr long long INFLL = 1e18;

using namespace std;

int main()
{
    ll n, k;
    cin >> n >> k;

    ll a;

    if (n > k)
    {
        a = n / k;
        n = n - k * a;
    }
    if (n == 0)
    {
        cout << n << endl;
        return 0;
    }

    while (n > k)
    {
        if (n - k < 0)
        {
            n = -1 * (n - k);
        }
        else
        {
            n = n - k;
        }
    }

    ll m;
    if (n - k < 0)
    {
        m = -1 * (n - k);
    }
    else
    {
        m = n - k;
    }

    if (n < m)
    {
        cout << n << endl;
    }
    else
    {
        cout << m << endl;
    }
    /*
    while (n > k)
    {
        n = abs(n - k);
    }

    if (n < abs(n - k))
    {
        cout << n << endl;
    }
    else
    {
        cout << abs(n - k) << endl;
    }
    */

    return 0;
}

Measured memory_bytes: 3156
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mxn= 5e5+5;
#define mod 1000000007
#define endl '\n'
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int main() {
    int n;
    cin>>n;
    float temp=ceil(n/1.08);
    if(floor(temp*1.08)==n)
    cout<<temp;
    else cout<<":(";
}



Measured memory_bytes: 3804
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int32_t, int32_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int32_t N, A, B;
  cin >> N >> A >> B;
  int32_t result = 0;
  for (int32_t value = 1; value <= N; ++value) {
    int32_t sum = 0;
    int32_t temp = value;
    while (temp > 0) {
      sum += temp % 10;
      temp /= 10;
    }
    if (sum >= A && sum <= B) {
      result += value;
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, m, flag = 1;
	char a[51][51], b[51][51];
    int i,j,k,l;
 
	cin >> n >> m;
	for(i=0; i < n; i++)
		cin >>a[i];
	for(i=0; i < m; i++)
		cin>>b[i];
 
	for(i=0; i < n-m+1; i++) {
		for(j=0; j < n-m+1; j++) {
			for(k=0; k < m; k++) {
				for(l=0; l < m; l++) {
					if(a[i+k][j+l] != b[k][l])
						flag = 0;
				}
			}
			if(flag) {
				cout<<"Yes"<<endl;
				return 0;
			}
			flag = 1;
		}
	}
	cout <<"No"<<endl;
 
	return 0;
}

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

using namespace std;

int a[3];

int main(){
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    
    int ans = a[2] - a[1];
    a[0] += ans;
    ans = ans + (a[2] - a[0] + 1) / 2;
    if ((a[2] - a[0]) % 2 == 1) ans++;
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647);
static const ll LLINF = (9223372036854775807);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Printer{
    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T>
    void print(T x, T y){
        cout << x << "," << y << endl;
    }

    template<class T>
    void print(vector<T> v){
        rep(i, v.size()){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class T>
    void print(vector<vector<T> > vv){
        rep(i, vv.size()){
            rep(j, vv[i].size()){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void print(pair<int, int> p){
        cout << "(" << p.first << ", " << p.second << ")" << endl;
    }
};
using namespace Printer;

//--global--//


vector<string> vv;
int used[21][21];
int dx[4] = {0, 0, -1, 1};
int dy[4] = {-1, 1, 0, 0};
//----------//

int solve(int x, int y, int h, int w){
    rep(i, 21){
        fill(used[i], used[i]+21, 0);
    }
    queue<pair<int, int> > q;
    q.push(make_pair(x, y));
    int cnt = 0;
    used[y][x] = 1;
    while(1){
        queue<pair<int, int> > q2;
        while(!q.empty()){
            pair<int, int> f = q.front(); q.pop();
            int fx = f.first;
            int fy = f.second;
            rep(i, 4){
                if(fx + dx[i] >= 0 && fx + dx[i] < w && fy + dy[i] >= 0 && fy+dy[i] < h){
                    if(vv[fy+dy[i]][fx+dx[i]] == '.'){
                        if(!used[fy+dy[i]][fx+dx[i]]){
                            q2.push(make_pair(fx+dx[i], fy+dy[i]));
                            used[fy+dy[i]][fx+dx[i]] = 1;
                        }
                    }
                }
            }
        }
        q = q2;
        if(q.empty()){
            break;
        }
        cnt++;
    }

    return cnt;
}

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//

    int h, w;
    cin >> h >> w;
    rep(i, h){
        string str;
        cin >> str;
        vv.push_back(str);
    }

    int ans = 0;
    rep(i, h){
        rep(j, w){
            if(vv[i][j] != '#'){
                ans = max(ans, solve(j, i, h, w));
            }
        }
    }
    cout << ans << endl;

    return 0;
}


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


using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i+=2)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define repv(arr)  for(auto it=arr[i].begin();it!=arr[i].end();it++)  
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vl vector<long long int>
#define ssortA(arr)   stable_sort(arr.begin(),arr.end())
#define search(arr,c)  binary_search(arr.begin(),arr.end(),c)
#define pb   push_back
#define ll long long
#define LCM(a,b) boost::math::lcm(a,b)
#define cl_bf cin.ignore(numeric_limits<streamsize>::max(), '\n');

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    char c;
    cin>>c;
    if(c-'A'>=0&&c-'A'<26){
        cout<<"A"<<endl;
    }
    if(c-'a'>=0&&c-'a'<26){
        cout<<"a"<<endl;
    }
}

Measured memory_bytes: 3580
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
#include <bitset>
using namespace std;
#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}

vector<int> G[1002];

int main(void){
  fast_io
  cout<<fixed<<setprecision(15);

  ll n,q;cin>>n>>q;
  string s;cin>>s;
  vector<char> T(q);
  vector<char> D(q);
  rep(i,q){
    cin>>T[i]>>D[i];
  }
  ll L = -1, R = n;
  ll l = -1, r = n;
  REP(i,q){
    if(D[i] == 'L'){
      if(l+1 < n && s[l+1] == T[i]) l = min(n, l+1);
      if(r+1 <= n && s[r] == T[i]) r = min(n, r+1);
    }else{
      if(l-1 >= -1 && s[l] == T[i]) l = max(-1ll, l-1);
      if(r-1 >= 0 && s[r-1] == T[i]) r = max(-1ll, r-1);
    }
    if(r <= l){
      cout<<0<<endl;
      return 0;
    }
    //cout<<l<<" "<<r<<endl;
  }
  cout<<max(0ll, r-l-1)<<endl;
  return 0;
}

Measured memory_bytes: 1044
#include <stdio.h>

int main(void) {
	char Now = 'A';
	char a, b;
	while (scanf("%c,%c", &a, &b) != EOF) {
		if (a == Now) {
			Now = b;
		}
		else if (b == Now) {
			Now = a;
		}
	}
	printf("%c\n", Now);
	return 0;
}

Measured memory_bytes: 544
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    S=list(input())
    if S[0]==S[1]==S[2]:
        print('No')
    else:
        print('Yes')

if __name__ == '__main__':
    main()


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

#define MOD 1000000007

long long POW(long long a, long long b){
    long long ans = 1;
    while(b > 0){
        if(b & 1){
            ans = ans * a %MOD;
        }
        a = a * a % MOD;
        b >>= 1;
    }
    return ans;
}

long long combin(long long n, long long r, vector<long long> factorial){
    return factorial.at(n) * POW(factorial.at(r)*factorial.at(n-r)%MOD, MOD-2) % MOD;
}


int main(void){
    long long n,m;
    cin >> n >> m;
    long long ans = 1;
    long long i=2;

    vector<long long> factorial(100+n);
    factorial.at(0) = 1;
    for(int i=1; i<100+n; i++){
        factorial.at(i) = i*factorial.at(i-1)%MOD;
    }


    while(m > 1){
        long long cnt = 0;
        while(m%i == 0){
            m /= i;
            cnt++;
        }
        if(cnt > 0){
            ans *= combin(cnt+n-1,cnt,factorial) % MOD;
        }
        ans %= MOD;
        i++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
long long n, m, a, b, dp[100005], ans;
vector<long long> c[100005];
void solve (int idx){
	if (c[idx].empty() or dp[idx]) return;
	long long sol=-1;
	for (int i=0; i<c[idx].size(); i++){
		solve (c[idx][i]); 
		sol = max(sol, dp[c[idx][i]]);
	} dp[idx] = sol+1;
	return;
}
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> m;
for (int i=0; i<m; i++){
	cin >> a >> b;
	c[a].push_back(b);
}
for (int i=1; i<=n; i++)
	solve(i);
for (int i=1; i<=n; i++)
	ans = max(ans, dp[i]);
cout << ans;
return 0;
}


Measured memory_bytes: 11812
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////
 
#define fs first
#define sc second
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define len(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef pair<ll, ll> pll;
 
template<typename T>
const T INF = (is_same<T, int>::value ? 1e9 : 1e18);
template<typename T>
inline T mod(T n, T mod){ T res = n%mod; if(res < 0) res += mod; return res; }
 
/// command for char arrays with spaces -> scanf(" %[^\n]", text);
 
////////////////////////// Solution starts below. //////////////////////////////
 
const int N = 2e5+5;
int bit[N];
 
int n;
void updt(int v, int x){
	while(v <= n){
		bit[v] += x;
		v += (v&(-v));
	}
}
 
int sum(int v){
	int ans = 0;
	while(v > 0){
		ans += bit[v];
		v -= (v&(-v));
	}
	return ans;
}
 
int main(){
	fastio;
	cin >> n;
	int ans = 0, x;
	for(int i = 0; i < n; i++){
		cin >> x;
		if(sum(x) == 0) ans++;
		updt(x, 1);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
def tmp(a, b, c):
    return abs(a - b), abs(a - b + 2 * c)


def solve(string):
    n, *a = map(int, string.split())
    l, c, r = 1, 2, 3
    sll, slr, srl, srr = sum(a[:l]), sum(a[l:c]), sum(a[c:r]), sum(a[r:])
    ans = max(sll, slr, srl, srr) - min(sll, slr, srl, srr)
    while c < n - 1:

        d, dn = tmp(sll, slr, a[l])
        while dn < d:
            sll, slr, l = sll + a[l], slr - a[l], l + 1
            d, dn = tmp(sll, slr, a[l])
        d, dn = tmp(srl, srr, a[r])
        while dn < d:
            srl, srr, r = srl + a[r], srr - a[r], r + 1
            d, dn = tmp(srl, srr, a[r])
        ans = min(ans, max(sll, slr, srl, srr) - min(sll, slr, srl, srr))
        slr, srl, c = slr + a[c], srl - a[c], c + 1
    return str(ans)


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))


Measured memory_bytes: 25712
from collections import Counter

def main():
  n = int(input())
  S = input()
  A = S[:n]
  B = S[n:][::-1]
  ans = 0
  La = []
  for i in range(2**n):
    a1, a2 = "", ""
    for j in range(n):
      if i>>j & 1:
        a1 += A[j]
      else:
        a2 += A[j]
    La.append(a1+"#"+a2)

  Da = Counter(La)

  for i in range(2**n):
    b1, b2 = "", ""
    for j in range(n):
      if i>>j & 1:
        b1 += B[j]
      else:
        b2 += B[j]
    ans += Da[b1+"#"+b2]

  print(ans)
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 42600
from itertools import combinations
x = int(input())
s = []
tov = dict()
for i in range(1000):
    s.append(i**5)
    tov[i**5] = i
    s.append(-i**5)
    tov[-i**5] = -i
for a, b in combinations(s, 2):
    if a - b == x:
        print(tov[a], tov[b])
        break
    elif b - a == x:
        print(tov[b], tov[a])
        break


Measured memory_bytes: 67712
import sys
sys.setrecursionlimit(10 ** 6)

import functools
import operator
n = int(input())
p = list(map(float, input().split()))
half = n // 2 + 1

dp = [[None] * (n + 1) for _ in range(n + 1)]
def dfs(n=half, depth=n - 1):
    if depth < 0 or (n - 1) > depth:
        return 0

    if dp[n][depth] is not None:
        return dp[n][depth]

    if n == 0:
        r = functools.reduce(operator.mul, map(lambda x: 1 - x, p[:depth + 1]))
    elif (n - 1) == depth:
        r = functools.reduce(operator.mul, p[:depth + 1])
    else:
        r = dfs(n - 1, depth - 1) * p[depth] + dfs(n, depth - 1) * (1 - p[depth])
    dp[n][depth] = r
    return r

print(sum(dfs(i) for i in range(half, n + 1)))


Measured memory_bytes: 220040
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int answer = 0;
		if(x == 2) {
			System.out.println(2);
			return;
		}
		boolean flg = false;
		for(int i =x; ;i++) {
			for(int j = 2; j < i; j++) {
				if(i % j == 0) {
					break;
				}
				if(j == i-1) {
					flg = true;
				}
			}
			if(flg) {
				answer = i;
				break;
			}
		}
		System.out.println(answer);

	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

const int MAX_N = 1e5 + 1;
const ll INF = 1LL << 60;

int main() {
    int N, M;
    cin >> N >> M;
    vector<P> v;
    ll A, B;
    for (int i = 0; i < N; i++) {
        cin >> A >> B;
        v.push_back(P(A, B));
    }
    sort(v.begin(), v.end());
    ll l = 0, r = INF;
    while (r - l > 1) {
        ll mid = (l + r) / 2;
        ll cnt = 0, now_cost = mid;
        for (int i = 0; i < v.size(); i++) {
            if (now_cost >= v[i].first * v[i].second) {
                now_cost -= v[i].first * v[i].second;
                cnt += v[i].second;
            }
            else {
                ll rest = now_cost / v[i].first;
                now_cost -= rest * v[i].first;
                cnt += rest;
            }
            if (cnt > M || now_cost == 0) break;
        }
        if (cnt >= M) r = mid;
        else l = mid;
    }
    cout << r << endl;
    return 0;
}

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

using namespace std;

#define endl "\n"
#define lln long long int
#define IOS ios::sync_with_stdio(0);cin.tie(0);

const lln MOD = 1e9 + 7;

int main(){
	IOS;

	int n;
	cin >> n;
	vector<lln> a,b;
	for(int i=0;i<n;i++){
		lln x,y;
		cin >> x >> y;
		a.push_back(x+y);
        b.push_back(x-y);
	}
	sort(a.begin(),a.end());
  	sort(b.begin(),b.end());
	cout << max(abs(b.front()-b.back()),abs(a.front()-a.back()));
	return 0;    
}


Measured memory_bytes: 6696
n = int(input())
ls = list(map(int, input().split()))

ls.sort()

ans = 0
if n%2 == 1:
    ans = sum(ls[-(-n//2):n-1]) * 2 + ls[n-1] + ls[n//2]
else:
    ans = sum(ls[n//2:n-1]) * 2 + ls[n-1]

print(ans)

Measured memory_bytes: 31612
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
#include<vector>
#include <utility>
using namespace std;
int a = 0, b = 0, c = 0, d = 0, e[60][60], f[120], g[10100], h[10100], counto = 0, ans = 0, x[100] = {}, y, z;
int64_t ab[10000] = {}, abc = 0, abcd = 0;
pair<int, int>manji[101] = {};
char rikka, toka[150][150] = {};
vector<int> train,code;
string saya, homu, kyok, mami[108], mado[100];
bool gg;
bool exist[1000];
int main() {
	cin >> a;
	for (int i = 0; i < a; i++) {
		cin >> f[i];
		counto = max(f[i], counto);
	}
	for (int i = 0; i < a; i++) {
		if (f[i] == counto && b == 0) {
			ans += counto / 2;
			b++;
		}
		else {
			ans += f[i];
		}
	}
	cout << ans << endl;
	return 0;
}

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

int n, m, ball[300], ans=0;

int main(){
	cin >> n >> m;
	for (int i=0;i<n+m;i++){
		if (i<n) ball[i]=0;
		else ball[i]=1;
	}
	for (int i=0;i<n+m;i++){
		for (int j=i+1;j<n+m;j++){
			if ((ball[i]+ball[j])%2==0) ans++;
		}
	}
	cout << ans << "\n";
}

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

using std::cin;
using std::cout;
using std::endl;
using std::string;

int check(unsigned int d, int x[], int y[])
{
	unsigned int i;
	double d1 = 0.0;
	double df, di;

	for (i = 0; i < d; i++) {
		d1 += std::pow( (double)(x[i] - y[i]), 2);
	}
	df = std::modf( std::sqrt(d1), &di );

	return ( df == 0.0 ) ? 1 : 0 ;
}

int main()
{
	unsigned int n, d, ans, i, j;
	int x[10][10] = { 0 };

	// input
	cin >> n >> d;
	for (i = 0; i < n; i++) {
		for (j = 0; j < d; j++) {
			cin >> x[i][j];
		}
	}

	// calc
	ans = 0;
	for (i = 0; i < n; i++) {
		for (j = i + 1; j < n; j++) {
			ans += check(d, x[i], x[j]);
		}
	}

	// output
	cout << ans;
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define VAL 100000
#define ll long long
#define INF 10000000000000000LL
#define pll pair<long long , long long>
const int MAX=1e5+10;
const int MOD=1e9+7;
const int TOT_PRIMES=19;
const int MAX_A=70;
using namespace std;
vector<int>adj[MAX];
int coun(int x){
	return __builtin_popcount(x);
}
ll dp[105][MAX];
int n;
int main() 
{ 
	//ios_base::sync_with_stdio(false);
  //  cin.tie(NULL);	
//	#ifndef ONLINE_JUDGE
	//freopen("inp.txt" ,"r", stdin );
//	freopen("out.txt", "w", stdout);
//	#endif
	int k ;
	cin>>n>>k;
	int arr[n+1];
	for(int i=1;i<=n;i++)
		cin>>arr[i];
	memset(dp , 0 , sizeof(dp));
	for(int j=0;j<=k;j++)
		dp[0][j]=0;
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		int sum[k+1];
		memset(sum , 0 , sizeof(sum));
		sum[0]=dp[i-1][0];
		for(int j=1;j<=k;j++)
			sum[j]=(sum[j-1]+dp[i-1][j])%MOD;
		for(int j=0;j<=k;j++){
			int tr=sum[j];
			int un=j-arr[i]-1;
			if(un>=0)
				tr=(tr-sum[un]+MOD)%MOD;
			dp[i][j]=tr;

		}
	}
	cout<<dp[n][k];

}

Measured memory_bytes: 84992
#include <cstdio>
#include <string>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <map>
#include <math.h>
using namespace std;

int main() {
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    if (a*b > c*d) printf("%d\n", a*b);
    else printf("%d\n", c*d);
}


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

public class hello
{
	public static void Main()
	{
		while (true)
		{
			var n = int.Parse(Console.ReadLine().Trim());
			if (n == 0) break;
			var f1 = new string[n];
			var f2 = new int[n, 2];
			for (int i = 0; i < n; i++)
			{
				string[] line = Console.ReadLine().Trim().Split(' ');
				f1[i] = line[0];
				f2[i, 0] = int.Parse(line[1]);
				f2[i, 1] = int.Parse(line[2]);
			}
			getAns(f1, f2, n);
		}
	}
	static List<int> getCDD (int[,] f2, int n , string a)
	{
		var c = new List<int>();
		var csum = 0;
		for (int i = 0; i < n; i++)
			if (!a.Contains(i.ToString()))
			{
				c.Add(i);
				csum += f2[i, 0];
			}
		var ans = new List<int>();
		foreach (var x in c)
		{
			var w = csum - f2[x, 0];
			if (w <= f2[x, 1]) ans.Add(x);
		}
		return ans;
	}
	static string getFinal(int[,] f2, int n , List<string> Lc)
	{
		var gmin = int.MaxValue;
		var gs = "";
		foreach (var x in Lc)
		{
			var g = 0;
			for (int i = 0; i < n; i++)
			{
				var t = x[i] - '0';
				g += f2[t, 0] * (i + 1);
				if (g > gmin) goto next;
			}
			if (g < gmin) { gmin = g; gs = x; }
		next:;
		}
		return gs;
	}
	static void print (string[] f1,string a)
	{
		foreach (var x in a)
			Console.WriteLine(f1[x-'0']);
	}
	static void getAns (string[] f1, int[,] f2, int n)
	{
		var q = new Queue<string>();
		var c = getCDD(f2, n, "");
		foreach (var x in c) q.Enqueue(x.ToString());
		var Lc = new List<string>();
		while (q.Count() > 0)
		{
			var w = q.Dequeue();
			if (w.Length == n)  Lc.Add(w);
			var tt = getCDD(f2, n, w);
			if (tt.Count() > 0)
				foreach (var x in tt) q.Enqueue(w + x);
		}
		var ans = getFinal(f2, n, Lc);
		print(f1, ans);
	}
}



Measured memory_bytes: 49252
// Problem : A - Plural Form
// Contest : AtCoder - AtCoder Beginner Contest 179
// URL : https://atcoder.jp/contests/abc179/tasks/abc179_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ff         first
#define ss         second
#define endl       '\n'
#define pb         push_back
#define int        long long
#define vi         vector<int>
#define mii        map<int, int>
#define pii        pair<int, int>
#define all(x)     (x).begin(), (x).end()
#define fill(a,b)  memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)
#define rep(i,x,y) for(int i=(int)x; i<y; i++)
#define px(a)      for(auto x: a) cout<<x<<" "; cout<<'\n';
#define pxy(a,n)   rep(i,0,n) {px(a[i])};
const long long MOD=1e9+7,N=1e5+5;
int power(int x, unsigned int y)  
{  
    int res = 1;
    x = x % MOD;
    if (x == 0) return 0;
  
    while (y > 0)  
    { 
        if (y & 1)  
            res = (res*x) % MOD;
        y = y>>1;
        x = (x*x) % MOD;  
    }  
    return res;  
}

/*_________________________________________________________*/


int solve()
{
	string s;
	cin>>s;
	if(s.back()=='s') s+="es";
	else s+="s";
	cout<<s<<endl;
	return 0;
}
int32_t main()
{	
	std::ios::sync_with_stdio(false); 
	cin.tie(NULL);
	cout.tie(NULL);
	int t=1; 
	//cin>>t;
	while(t--)  solve();
	
	//cout<<solve()<<endl;
	//cout<<(solve()?"YES":"NO")<<endl;
}

Measured memory_bytes: 3652
A = int(input())
B = int(input())
C = int(input())
X = int(input())//50

cnt = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 10*a + 2*b + c == X:
                cnt += 1
print(cnt)

Measured memory_bytes: 3060
#include<stdio.h>
#include<stdlib.h>

int table[100][100];
int d[100], f[100], flag[100], tt;

typedef struct{
  int u;
  int k;
  int *v;
}DATA;

void DFS_visit(int u, int n){
  int v;
  flag[u] = 1;
  d[u] = ++tt;
  for(v = 0; v < n; v++){
    if(table[u][v] == 0)continue;
    if(flag[v] == 0){
      DFS_visit(v, n);
    }
  }
  flag[u] = 2;
  f[u] = ++tt;
}

void DFS(int n){
  int u;
  for(u = 0; u < n; u++) flag[u] = 0;
  tt = 0;

  for(u = 0; u < n; u++){
    if(flag[u] == 0) DFS_visit(u, n);
  }
  for(u = 0;u < n; u++){
    printf("%d %d %d\n", u + 1, d[u], f[u]);
  }
}
  
int main(){
  int i, j, n, next;
  DATA a[100];

  scanf("%d", &n);
  if(n >= 1 && n <= 100){
    for(i=0;i<n;i++){
      d[i] = 0;
      f[i] = 0;
    }
    
    for(i = 0; i < n; i++){
      scanf("%d %d", &a[i].u, &a[i].k);
      a[i].u--;
      a[i].v = (int *)malloc(sizeof(int) * a[i].k);
      for(j = 0; j < a[i].k; j++){
	scanf("%d", &next);
	a[i].v[j] = next-1;
	table[a[i].u][next-1] = 1;
      }
    }
    
    DFS(n);
  }
  return 0;
}




Measured memory_bytes: 2052
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner()
	N := sc.NextInt()

	switch N % 10 {
	case 2, 4, 5, 7, 9:
		fmt.Println("hon")
	case 0, 1, 6, 8:
		fmt.Println("pon")
	default:
		fmt.Println("bon")
	}

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

struct Point
{
    double x, y;
};

void koch(int n, Point a, Point b)
{
    if (n == 0)
        return;

    Point s, t, u;
    double th = M_PI * 60.0 / 180.0;

    s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 * b.x) / 3, 0;
    t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    koch(n - 1, a, s);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(n - 1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(n - 1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(n - 1, t, b);
}

int main()
{
    Point a, b;
    int n;

    scanf("%d", &n);

    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;

    printf("%.8f %.8f\n", a.x, a.y);
    koch(n, a, b);
    printf("%.8f %.8f\n", b.x, b.y);

    return 0;
}


Measured memory_bytes: 2716
n = int(input())
dict1 = {}

for _ in range(n):
    s = input()
    if s in dict1:
        dict1[s] += 1
    else:
        dict1[s] = 1

dict_sorted = sorted(dict1.items(), key = lambda x: x[0])
dict_sorted.sort(key = lambda x: x[1], reverse = True)

max1 = dict_sorted[0][1]

for i in range(len(dict_sorted)):
    if dict_sorted[i][1] == max1:
        print(dict_sorted[i][0])
    else:
        break


Measured memory_bytes: 46556
#include<cstdint>
#include<limits>
#include<cstdbool>
#include<cmath>
#include<iostream>
#include<vector>
#include<array>
#include<list>
#include<string>
#include<sstream>
#include<algorithm>

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


}


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

int main() {
  int n,m,c;
    cin>>n>>m>>c;
  int sum=0;
  int resum=0;
  
  vector<int>vec(m);
  for(int i=0;i<m;i++){
    cin>>vec[i];
  }
  
    for(int j=0;j<n;j++){
      for(int k=0;k<m;k++){        
      int a;
        cin>>a;
      sum+=a*vec[k];
    }
      if(-c<sum){
        resum+=1;
      }
      sum=0;
    }  
  cout<<resum<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
signed main(){
  string s;
  int a=0,b=0;
  cin>>s;
  for(int i=0;i<s.size();i++){
    if(s[i]=='1') a++;
    else b++;
  }
  cout<<min(a,b)*2<<"\n";
  }

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

using namespace std;

#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

typedef long long ll;
typedef pair<int, int> pii;


ll C2(int n) {
    return n * 1LL * (n - 1) / 2;
}

int main()
{
    //freopen("input.txt", "r", stdin);


    int n;
    scanf("%d", &n);
    vector<int> a(n), cnt(n + 1, 0);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
        ++cnt[a[i]];
    }

    ll ans = 0;
    for (int x = 0; x <= n; ++x)
        ans += C2(cnt[x]);

    for (int i = 0; i < n; ++i) {
        printf("%lld\n", ans - cnt[a[i]] + 1);
    }

}


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

typedef long long ll;
typedef pair<ll, ll> P;

const int mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 11


int main()
{
    int n; cin >> n;
    int ans[4];
    rep(i,4) ans[i] = 0;
    rep(i,n){
        string s; cin >>s;
        if(s == "AC") ans[0]++;
        else if (s == "WA") ans[1]++;
        else if(s == "TLE") ans[2]++;
        else ans[3]++;
    }
    cout << "AC x " << ans[0] << endl;
    cout << "WA x " << ans[1] << endl;
    cout << "TLE x " << ans[2] << endl;
    cout << "RE x "  << ans[3] << endl;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int n;
int l[2005];
int use[2005];

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for(int i = 0; i < n; i++) {
    scanf("%d", &l[i]);
    use[i] = l[i];
  }
  ll ret = 0;
  for(int i = 0; i < n; i++) {
    ret += l[i];
  }
  for(int x = 1; x <= n; x++) {
    for(int i = 0; i < n; i++) {
      int d = (i+n-x)%n;
      use[i] = min(use[i], l[d]);
    }
    ll curr = x*(ll)m;
    for(int i = 0; i < n; i++) {
      curr += use[i];
    }
    ret = min(ret, curr);
  }
  printf("%lld\n", ret);
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define MOD 1000000007

int main()
{
    int N, K;
    cin >> N >> K;
    if (K == 1)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << N - K << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#include<iomanip>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long
const double pi = 3.141592653589793;

using namespace std;

//最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

//階乗
ll fact(ll a) {
	int ans = 1;
	for (int i = 1; i <= a; i++) {
		ans *= i;
	}
	return ans;
}

//コンビネーション
ll combi(ll a, ll b) {
	return fact(a) / (fact(b) * fact(a - b));
}

int main() {
	ll a;
	string b;
	cin >> a >> b;
	ll nb = (b[0] - '0') * 100 + (b[2] - '0') * 10 + (b[3] - '0');
	ll ans = a * nb / 100;

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


Measured memory_bytes: 3624