akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;

namespace aizu
{
    class OnlineJudge
    {
        static void Main()
        {
            string input;
            HashSet<char> rightMap = new HashSet<char>("yuiophjklnm");
            while((input = Console.ReadLine()) != "#") {
                bool isRight = rightMap.Contains(input[0]);
                int change = 0;
                for(int i=1; i < input.Length; ++i) {
                    if(isRight != rightMap.Contains(input[i])){
                        ++change;
                        isRight = !isRight;
                    }
                }
                Console.WriteLine(change);
            }
        }
    }
}

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

int main()
{
    int n,d;
    scanf("%d",&n);
    double c;

    for(int i=n;i<=n;i--){
            c =sqrt((double)i);
            d =c;
        if(c-d == 0){
            printf("%d",i);
            break;
        }
    }
}


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

int main() {
    int n;
    cin >> n;
    vector<int> vec(n);
    rep(i, n) cin >> vec[i];
    
    int num = 1, cnt = 0;
    rep(i, n){
        num = vec[num - 1];
        cnt++;
        if(num == 2){
            cout << cnt << endl;
            break;
        }
    }
    if(cnt == n) cout << -1 << endl;
    
}

Measured memory_bytes: 3668
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>

#define llint long long int
#define NUM 1000000007

int residual[100001][10] = {};
void prev_calc(){
  for(int i=0; i<10; i++){
    residual[1][i] = i;
    for(int j=2; j<=100000; j++){
      residual[j][i] = (residual[j-1][i]*10)%13;
    }
  }
}

int ctoi(char c){
  return c - '0';
}

int main(void){

  prev_calc();
  
  std::string s;
  std::cin >> s;
  s = s + "S"; 
  std::reverse(s.begin(), s.end());

  std::vector<std::vector<llint> > dp(s.size() + 1, std::vector<llint>(13));
  for(int j=0; j<s.size(); j++){
    //std::cout << s[j] << " " << j << std::endl;
    if(s[j] == 'S'){
      dp[j][0] = 1;
    }else if(s[j] == '?'){
      for(int i=0; i<10; i++){
	for(int k=0; k<13; k++){
	  int ind = (k+residual[j][i])%13;
	  dp[j][ind] = (dp[j][ind] + dp[j-1][k])%NUM;
	}
      }
    }else{
      int num = ctoi(s[j]);
      for(int k=0; k<13; k++){
	int ind = (k+residual[j][num])%13;
	dp[j][ind] = (dp[j][ind] + dp[j-1][k]) % NUM;
      }
    }

    //for(int k=0; k<13; k++){
    //  std::cout << dp[j][k] << " ";
    //}
    //std::cout << std::endl;
  }
  std::cout << dp[s.size()-1][5] << std::endl;

  return 0;
}


Measured memory_bytes: 17532
def main():
    s = input()
    num = 2**(len(s)-1)
    bit_len = len(bin(num))

    def func(ｎ):
        n = bin(n)
        n_len = len(n)
        n = "0"*( bit_len - n_len - 1 ) + n[-len(n)+2:]
        indexes = [i+1 for i, x in enumerate(ｎ) if x == "1"]
        ans = 0
        temp = 0
        for i in indexes:
            ans += int(s[temp:i])
            temp = i
        else:
            if temp != bit_len-2:
                ans += int(s[temp:])

        return ans

    ans = 0
    for i in range(num):
        ans += func(i)
    print(ans)

main()


Measured memory_bytes: 3320
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1e18+100;
const ll MOD = 1000000007;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//
 
string s;
 
int main() {	
	cin >> s;
	
	int ans = 0;
	
	int l = 0, r = s.size() - 1, lc = 0, rc = 0;
	while (l <= r) {
		lc = rc = 0;
		while (l < s.size() && s[l] == 'x') l++, lc++;
		if (l > r) break;
		while (r >= 0 && s[r] == 'x') r--, rc++;
		if (s[l] != s[r]) {
			puts("-1");
			return 0;
		}
		
		ans += abs(lc - rc);
		l++;
		r--;
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main() {
	long long n, m, M, p; cin >> n >> p;
	m = p; M = p;
	for (int i = 1; i < n; i++) {
		cin >> p;
		if (p < m)m = p;
		if (p > M)M = p;
	}
	cout << M - m << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
struct node{
	int x,y;
}a[100005];
bool cmp(node a,node b)
{
	return a.y>b.y||(a.y==b.y&&a.x<b.x);
}
int n,m,i,ans,f[100005];
int find(int x)
{
	return f[x]==x?x:f[x]=find(f[x]);
}
int main()
{
	scanf("%d%d",&n,&m);
	m++;
	for (i=1;i<=n;i++)
	scanf("%d%d",&a[i].x,&a[i].y);
	sort(a+1,a+n+1,cmp);
	for (i=1;i<=m;i++)
	f[i]=i;
	for (i=1;i<=n;i++)
	if (m>a[i].x&&find(f[m-a[i].x]))
	ans+=a[i].y,f[find(f[m-a[i].x])]=f[find(f[m-a[i].x])-1];
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1280
N, M = map(int, input().split())
ships = [[] for _ in range(2*10**5+1)]
for _ in range(M):
  _from, _to = map(int, input().split())
  ships[_from].append(_to)
for _to in ships[1]:
  if N in ships[_to]:
    print('POSSIBLE')
    exit()
print('IMPOSSIBLE')

Measured memory_bytes: 29044
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  string s;
  cin >> s;
  if(s == "zyxwvutsrqponmlkjihgfedcba") cout << -1 << endl;
  else{
    if(s.size() < 26){
      v1b v(26, 1);
      rep(i, s.size()) v[s[i]-'a'] = 0;
      rep(i, 26){
        if(v[i]){
          s += (char)'a'+i;
          break;
        }
      }
      cout << s << endl;
    }
    else{
      string t = "";
      int z = 24;
      while(s[z] > s[z+1]) --z;
      rep(i, z) t += s[i];
      priority_queue<char, vector<char>, greater<char>> pq;
      rep(i, 26-z) pq.push(s[z+i]);
      while(!pq.empty()){
        if(pq.top() > s[z]){
          t += pq.top();
          break;
        }
        else pq.pop();
      }
      cout << t << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	char a[100];
	int n;
	cin>>n;
	scanf("%s",a);
	int ans=0,maxn=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]=='I')
		  ans++;
		else
		  ans--;
		maxn=max(maxn,ans);    
	}
	cout<<maxn<<endl;
	return 0;
}

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

int main()
{
    int m=0;
    string s, t;
    cin >> s >> t;
    for (int i=0; i<s.size(); i++)
    {
        if (s[i] != t[i])
            m++;
    }
    cout << m;
    return 0;
}


Measured memory_bytes: 3888
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int[] h = new int[N];
    for (int i = 0; i < N; i++) {
      h[i] = sc.nextInt();
    }
    Arrays.sort(h);
    int min = Integer.MAX_VALUE;
    for (int i = 0; i <= N - K; i++) {
      int sub = h[i + K - 1] - h[i];
      if (sub < min) {
        min = sub;
      }
    }
    System.out.println(min);
  }
}

Measured memory_bytes: 52392
#include <bits/stdc++.h>
#define int long long
#define P(x) cout << x << endl
#define D(x) P(#x << ": " << x)
#define F(i,n) for (int i=0; i<(int)(n); i++)
#define DEC(i,n) for (int i=(int)(n); --i>=0;)
#define S(s) (int)((s).size())
#define ALL(v) v.begin(), v.end()
#define MI(a,v) a = min(a,(v))
#define MA(a,v) a = max(a,(v))
#define V vector
#define pb push_back
#define mt make_tuple
using namespace std;
const int N=1e5;

int p[N];
set<int> adj[N];
int find(int a) {return p[a] == a ? a : (p[a] = find(p[a]));}

signed main() {
    int n; cin>>n;
    queue<pair<int,int>> q;
    F(i,2*(n-1)) {
        int a,b; cin>>a>>b;
        a--, b--;
        if (adj[a].count(b))
            q.push({a,b});
        adj[a].insert(b);
        adj[b].insert(a);
    }
    F(i,n) p[i] = i;
    int cnt=0;
    while (!q.empty()) {
        cnt++;
        int a,b;
        tie(a,b) = q.front(); q.pop();
        //D(a), D(b);
        a = find(a), b = find(b);
        if (S(adj[a]) < S(adj[b]))
            swap(a,b);
        p[b] = a;
        for (int v : adj[b]) if (v != a) {
            if (adj[a].count(v))
                q.push({a,v});
            adj[a].insert(v);
            adj[v].erase(b);
            adj[v].insert(a);
        }
    }
    //D(cnt);
    if (cnt == n-1) P("YES");
    else P("NO");
}

Measured memory_bytes: 33280
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int main() {
    int k;
    cin >> k;
    if(k%2==0)
        cout << -1 << endl;
    else{
        if(k%7==0) k/=7;

        ll now = 0;
        ll p = 1;
        int ans = -1;
        REP(i, k){
            now = (now + p) % k;
            p = (p * 10) % k;
            if(now % k == 0){
                ans = i+1;
                break;
            }
        }
        cout << ans << endl;

    }
    return 0;
}

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

int main()
{
    int ans=0;
    vector<int> x(5);
    for(int i=0;i<5;++i)
    {
        cin>>x.at(i);
        if(x.at(i)==0){
            ans=i+1;
        }
    }
    cout<<ans<<endl;
    

}

Measured memory_bytes: 3588
#include<stdio.h>
#include<math.h>
#define M_PI 3.141592653589

void koch(int n, double ax, double ay, double bx, double by) {
   if (n == 0) {
     return;
   }

   double sx, sy, tx, ty, ux, uy;
   double th = M_PI * 60.0 / 180.0;

   sx = (2.0*ax + 1.0*bx) / 3.0;
   sy = (2.0*ay + 1.0*by) / 3.0;
   tx = (1.0*ax + 2.0*bx) / 3.0;
   ty = (1.0*ay + 2.0*by) / 3.0;
   ux = (tx - sx)*cos(th) - (ty - sy)*sin(th) + sx;
   uy = (tx - sx)*sin(th) + (ty - sy)*cos(th) + sy;

   koch(n-1, ax, ay, sx, sy);
   printf ("%.8f %.8f\n", sx, sy);

   koch(n-1, sx, sy, ux, uy);
   printf("%.8f %.8f\n", ux, uy);

   koch(n-1, ux, uy, tx, ty);
   printf("%.8f %.8f\n", tx, ty);

   koch(n-1, tx, ty, bx, by);
}

int main () {
   double ax, ay, bx, by;
   int n;

   scanf ("%d", &n);

   ax = 0;
   ay = 0;
   bx = 100;
   by = 0;

   printf("%.8f %.8f\n", ax, ay);
   koch(n, ax, ay, bx, by);
   printf("%.8f %.8f\n", bx, by);

   return 0;
}

Measured memory_bytes: 640
x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ab=[]
abc=[]
a.sort()
a.reverse()
b.sort()
b.reverse()
for i in range(len(a)):
  for j in range(len(b)):
    ab.append(a[i]+b[j])
    if (i+1)*(j+1)>k:
      break
ab.sort()
ab.reverse()
c.sort()
c.reverse()
l=min(k,len(ab))
for i in range(l):
  for j in range(len(c)):
    abc.append(ab[i]+c[j])
    if (i+1)*(j+1)>k:
      break
abc.sort()
abc.reverse()
for i in range(k):
  print(abc[i])

Measured memory_bytes: 5484
#include <stdio.h>

#define N 100
#define A 100

/*int swap(int num[],int n)
{
  int i;
  for(i=0;i<=n;i++){
    if(num[i]<num[i-1]){



    return num;
}
*/

int main(){
  int flag,i,j,num[N],count=0,in,key;

  scanf("%d",&in);

  for(i=0;i<in;i++){

    scanf("%d",&num[i]);

  }
  for(j=in-1;j>0;j--){
  for(i=in-1;i>0;i--){

      if(num[i-1]>num[i]){

	key=num[i-1];
	num[i-1]=num[i];
	num[i]=key;

    count++;
      }
  }
  }

  for(i=0;i<in-1;i++){

    printf("%d ",num[i]);

  }
  printf("%d",num[i]);
  printf("\n");
  printf("%d\n",count);

  return 0;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s,t,u;int a,b;
	cin>>s>>t;
	cin>>a>>b;
	cin>>u;
	if(s==u) a=a-1;
	if(t==u) b=b-1;
	cout<<a<<" "<<b<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main()
{
	long long n, mx = 0;
	scanf("%lld", &n);
	priority_queue<pair<long long, long long>> q;
	for(long long i = 0, h, hor = 0; i < n; hor = ++i)
	{
		scanf("%lld", &h);
		for(long long t, u; !q.empty(); )
		{
			t = q.top().first;
			u = q.top().second;
			if(t > h)
			{
				mx = max(mx, t * (i - u));
				hor = min(hor, u);
				q.pop();
			}
			else if(t == h)
			{
				hor = min(hor, u);
				q.pop();
			}
			else
			{
				break;
			}
		}
		q.push(make_pair(h, min(hor, i)));
	}
	for(; !q.empty(); )
	{
		mx = max(mx, q.top().first * (n - q.top().second));
		q.pop();
	}
	printf("%lld\n", mx);
}



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

int n, m, g[1024][1024] = {0};
int e[11] = {0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023};

void construct (int x) {
    if (x == 1) {
        g[x][x] = 1; return;
    }
    int y = x - 1;
    construct (y);
    g[e[y] + 1][e[y] + 1] = 1;
    for (int i = e[y] + 2; i <= e[x]; i ++)
        for (int j = 1; j <= e[y]; j ++)
            g[i][j] = g[i - e[y] - 1][j];
    
    for (int i = 1; i <= e[x]; i ++)
        for (int j = e[y] + 2; j <= e[x]; j ++)
            g[i][j] = g[i][j - e[y] - 1];
}

int main () {
    cin >> n >> m;
    construct (max (n, m));
    for (int i = 1; i <= e[n]; i ++) {
        for (int j = 1; j <= e[m]; j ++)
            cout << g[i][j];
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 5376
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define dbg(x) { cerr<<"> "<<#x<<": "<<x<< endl; }
#define dbg2(x,y) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
const int inf = INT_MAX;
const double eps = 0.0000001;
const double PI = acos(-1.0);
const int MOD = 1e9+7;
const int N  = 1e5+5;

int a[N], dp[N];

signed main(){
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif  
    IOS;

    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
    	cin >> a[i];
    for (int i = n-1; i >= 1; i--) {
    	dp[i] = inf;
    	for (int j = i+1; j <= min(i+k,n); j++) {
			dp[i] = min(dp[i], dp[j] + abs(a[j]-a[i]));
    	}
    }
    cout << dp[1];
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h> 
#include <time.h>
#define F(i,a,b) for(long long i=a;i<=(b);++i)
#define dF(i,a,b) for(long long i=a;i>=(b);--i) 
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define pb push_back
#define maxnkp make_pair
#define fi first
#define se second
#define eps 1e-10
#define PI acos(-1.0)
using namespace std;
typedef long long ll;
const int mods = 1e9+7;
const int maxn = 500+10;
const int N = 1e5+10;
const int E = 1e6+10;  
int x,y;

int main(){
	cin>>x>>y;
	if(y%2==1||y<2*x||y>4*x){
		cout<<"No"<<endl;
		return 0;
	}
	else cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <math.h>
#define swap(a,b) a^=b^=a^=b

	int ans = 8;
	int A[31] = {0} ;
	int B[] = {0,1,1,1,1,1,1,1,1,1,2,2,2,4,4,4,6,6,6,5,5,5,3,3,3,3,3,3,3,3,3} ;

	void a(){
    	swap(A[1],A[24]);
    	swap(A[4],A[27]);
    	swap(A[7],A[30]);
    	swap(A[10],A[21]);
    	swap(A[16],A[18]);
    return;
	}
 
	void b(){
    	swap(A[3],A[22]);
    	swap(A[6],A[25]);
    	swap(A[9],A[28]);
    	swap(A[12],A[19]);
    	swap(A[13],A[15]);
	}
 
	void c(){
    	swap(A[1],A[28]);
    	swap(A[2],A[29]);
    	swap(A[3],A[30]);
    	swap(A[15],A[16]);
    	swap(A[19],A[21]);
	}
 
	void d(){
    	swap(A[7],A[22]);
    	swap(A[8],A[23]);
    	swap(A[9],A[24]);
    	swap(A[13],A[18]);
    	swap(A[10],A[12]);
	}


	void solve(int num){
  		int cnt=0, i;
  		
  		for(i=1;i<31;i++){
    	if(A[i]==B[i]) cnt++;
  		}
 
  		if(cnt==30) ans=num;
  		if(ans<=num) return;
  	
  		a();solve(num+1);a();
 		b();solve(num+1);b();
		c();solve(num+1);c(); 
  		d();solve(num+1);d();
	}

	int main(){
		int n, j, k;
		scanf("%d", &n);
	
		for(j=0; j<n; j++){
			for(k=1; k<31; k++){
				scanf("%d", &A[k]);
			}		
			ans = 8;
			solve(0);
			printf("%d\n", ans);
		}
		return 0;
	}

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


int main(int argc, char* argv[])
{
    int a,b;
    scanf("%d%d", &a, &b);
    if(a>=1 && a<=9 && b>=1 && b<=9) {
        printf("%d\n", a*b);
    }
    else {
        printf("-1\n");
    }



    return 0;
}


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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int X, N; cin >> X >> N;
    int ans = mod;
    vector<bool> ng(200, false);
    rep(i, N){
        int a; cin >> a;
        ng[a] = true;
    }
    rep(i, 200) if(!ng[i] && abs(ans-X) > abs(i-X)) ans = i; 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
import java.util.*;

public class Main{ // Main
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] scores = new int[n];
		int sum = 0;
		int grade = 0;
		for(int i = 0; i < n; i ++) {
			scores[i] = scanner.nextInt();
			sum += scores[i];
		}
		if(sum % 10 != 0) {
			grade = sum;
		} else {
			Arrays.sort(scores);
			for(int score: scores) {
				if(score % 10 != 0) {
					grade = sum - score;
					break;
				}
			}
		}
		System.out.println(grade);
		
		
		scanner.close();
	}
	
}

Measured memory_bytes: 21972
#include <stdio.h>

int main(void) {
  int S, h, m, s;
  scanf("%d", &S);
  s = S % 60;
  h = S / 3600;
  m = (S - h * 3600) / 60;
  printf("%d:%d:%d\n", h, m, s);
  return 0;
}



Measured memory_bytes: 2124
#include<stdio.h>
int main(void){
	int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k = 0;
	scanf("%d", &k);
	printf("%d\n", a[k-1]);
	return 0;
}


Measured memory_bytes: 128
import sys
input = sys.stdin.readline

class UnionFind:
    def __init__(self, node:int) -> None:
        self.n = node
        self.par = [i for i in range(self.n)]
        self.rank = [0 for i in range(self.n)]
        
    def find(self, x:int) -> int:
        if x == self.par[x]:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
        
    def unite(self, x:int, y:int) -> bool:
        if self.isSame(x,y):
            #print("x and y has already united")
            return False
        
        rx = self.find(x)
        ry = self.find(y)
        
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = self.par[ry]
        else:
            self.par[ry] = self.par[rx]
            
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1
                
        return True
                
    
    def isSame(self, x:int, y:int) -> bool:
        return self.find(x) == self.find(y)
    
    
def kruskal(edges: list, node_num: int) -> int:
    edges.sort(key=lambda x:x[0])
    
    uf = UnionFind(node_num)
    rem = node_num-1
    ans = 0
    
    for cost, prev, nex in edges:
        if uf.find(prev) != uf.find(nex):
            uf.unite(prev, nex)
            ans += cost
            rem -= 1
            
        if rem == 0:
            break
        
    return ans


N = int(input().rstrip())

town = []
for i in range(N):
    x,y = map(int, input().split())
    town.append(tuple([i,x,y]))


edges = []
for xy in [1,2]:
    town.sort(key=lambda x: x[xy])
    
    for i in range(N-1):
        edges.append(tuple([town[i+1][xy] - town[i][xy],town[i+1][0], town[i][0]]))
        
        
ans = kruskal(edges, N)
print(ans)


Measured memory_bytes: 47740
package main

import "fmt"

func main() {
	// Code for A - Hitachi String
	var S string
	fmt.Scanf("%s", &S)

	if len(S)%2 != 0 {
		fmt.Println("No")
	} else {
		var ans string
		for i := 0; i < len(S); i++ {
			if i%2 == 0 {
				ans += "h"
			} else {
				ans += "i"
			}
		}

		if S == ans {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}


Measured memory_bytes: 1836
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }

void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int n;
  cin >> n;
  if (abs((double)sqrt(1 + 8 * n) - (int)sqrt(1 + 8 * n)) < 1e-8) {
    cout << "Yes" << endl;
    int k = 1 + sqrt(1 + 8 * n);
    k /= 2; // グループ数
    // cout << k << endl;

    // kx/2 = n;
    // x : 1 つのグループの個数

    int x = n * 2 / k;
    // cout << k << " " << x << endl;
    cout << k << endl;
    
    vector<vector<int> > v(k);
    rep(i, x) v[0].eb(i + 1);
    int notused = x + 1;

    rep3(i, 1, k) {
      rep(j, i) v[i].eb(v[j][i - 1]);
      rep(j, x - i) {
        v[i].eb(notused);
        notused++;
      }
    }
    rep(i, k) {
      cout << x << " ";
      rep(j, sz(v[i])) { if (j) cout << " ";cout << v[i][j]; }
      cout << endl;
    }
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 2304
import java.io.*;
import java.util.*;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long N;
        N = sc.nextLong();
        long[] X = new long[(int)(N)];
        for(int i = 0 ; i < N ; i++){
                X[i] = sc.nextLong();
        }

        final Solver solver = new Solver();
        solver.solve(N, X);
    }
}

class Solver {
    public void solve(long N, long[] X) {
        long min = Long.MAX_VALUE;
        for (int i = 0; i < 100; i++) {
            long sum = 0;
            for (int j = 0; j < N; j++) {
                sum += Math.pow(X[j] - i, 2);
            }

            min = Math.min(min, sum);
        }
        System.out.println(min);
    }
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

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

    int n, m, t;
    cin >> n >> m >> t;
    int res = 0;
    int a[n + 1];
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    res += max(0, a[1] - m);
    for (int i = 1; i < n; i++)
        res += max(0, a[i + 1] - a[i] - 2 * m);
    res += max(0, t - a[n] - m);
    cout << res << endl;
}


Measured memory_bytes: 3204
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> v;
    for(int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        v.push_back(x);
    }
    int m;
    cin >> m;
    vector<int> w;
    for(int i = 0; i < m; i++)
    {
        int x;
        cin >> x;
        w.push_back(x);
    }
    cout << (includes(v.begin(), v.end(), w.begin(), w.end()) ? 1 : 0) << endl;
}
//
// int main()
// {
//     cin.tie(0);
//     ios::sync_with_stdio(false);
//     int n;
//     cin >> n;
//     map<int, bool> mp;
//     for(int i = 0; i < n; i++)
//     {
//         int x;
//         cin >> x;
//         mp[x] = true;
//     }
//     int m;
//     cin >> m;
//     bool ok = true;
//     for(int i = 0; i < m; i++)
//     {
//         int x;
//         cin >> x;
//         if(mp[x]) continue;
//         ok = false;
//     }
//     cout << (ok ? 1 : 0) << endl;
//     return 0;
// }
//



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

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n, ans=0;
    cin >> n;
    vector<ll> a(n+1), b(n);
    rep(i,n+1) cin >> a[i];
    rep(i,n) cin >> b[i];
    rep(i,n){
        ll l = min(a[i], b[i]);
        ans += l;
        a[i] -= l;
        b[i] -= l;
        ll r = min(a[i+1], b[i]);
        ans += r;
        a[i+1] -= r;
        b[i] -= r;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4856
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int R;
	cin>>R;
	cout<<fixed<<setprecision(10)<<R*2*3.1415926535<<endl;
	return 0;
}

Measured memory_bytes: 3784
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<tuple>
#include<utility>
#include<vector>
using namespace std;

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

#define rep(i, a, n)  for(int i=a; i<n; i++)
#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 PER(i, n) for(int i=(int)(n)-1; i>= 0; i--)
#define PERS(i, n)  for(int i=(int)(n)-1; i>0; i--)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define RFOR(i, c)  for(__typeof((c).rbegin()) i=(c).rbegin(); i!=(c).end(); i++)
#define ALL(container)  (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) (container).size()
#define FILL0(n)  setfill('0') << right << setw(n)
#define mp(a, b)  make_pair(a, b)
#define toLower(c)  c+0x20
#define toUpper(c)  c-0x20
#define pb  push_back
#define eb  emplace_back

const int INF = 1e9;
const long long LLINF = 1e18;
const int MOD = 1000000007;

int main(){
  int n;  cin >> n;
  vector<int> d(n);
  REP(i, n) cin >> d[i];
  sort(ALL(d));
  cout << d[n/2] - d[n/2-1] << endl;
  return 0;
}


Measured memory_bytes: 640
def main():
    N = int(input())
    s = input()
    ans = 0
    temp = 0

    for i in range(1,N):
        if s[i] == 'E':
            ans += 1

    temp = ans
    #print(temp)

    for j in range(1,N):
        if s[j-1] == 'W':
            temp += 1

        if s[j] == 'E':
            temp -=1


        if temp < ans:
            ans = temp
        #print(temp)

    return ans

print(main())


Measured memory_bytes: 3780
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

struct P {
    int y;
    int x;
    int m;
};

int main() {
    int H, W;
    cin >> H >> W;

    int Ch, Cw, Dh, Dw;
    cin >> Ch >> Cw >> Dh >> Dw;
    --Ch, --Cw, --Dh, --Dw;

    vec<string> S(H);
    rep(i, H) cin >> S[i];

    deque<P> q;
    q.push_front({Ch, Cw, 0});

    auto push = [&](int y, int x, int m, bool front) {
        if (y < 0 || y > H - 1 || x < 0 || x > W - 1) return;
        if (S[y][x] == '#') return;

        if (front) q.push_front({y, x, m});
        else
            q.push_back({y, x, m});
    };

    int ans = 1000000;
    while (!q.empty()) {
        int y = q.front().y;
        int x = q.front().x;
        int m = q.front().m;
        q.pop_front();
        S[y][x] = '#';

        if (y == Dh && x == Dw) {
            cout << m << '\n';
            return 0;
        }

        push(y + 1, x, m, true);
        push(y, x + 1, m, true);
        push(y - 1, x, m, true);
        push(y, x - 1, m, true);

        for (int i = -2; i <= 2; ++i)
            for (int j = -2; j <= 2; ++j) {
                push(y + i, x + j, m + 1, false);
            }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 12056
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
using ll=long long;

const ll INF = pow(10,18)+1;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

template<typename T> bool chmin(T& a, T b) {return a > b ? a = b, true : false;}
template<typename T> bool chmax(T& a, T b) {return a < b ? a = b, true : false;}
 
int main(){
    int A, B;
    cin >> A >> B;
    int ans = 1;
    REP(i,20){
        if (A * i - (i-1) >= B){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>

using namespace std;

int main() {
	string s;
	cin >> s;
	int l = s.size();
	int ans=0;

	for (int i = 0; i < l / 2; i++) {
		if (s[i] != s[l - i - 1])ans++;
	}

	cout << ans;
	

}



Measured memory_bytes: 256
start, k , x = map(int, input().split())
start = abs(start)
y = start//x
if y >= k:
    start -= (x*k)
    print(start)
else:
    start -= (x*y)
    k -= y
    k %= 2
    if k == 1:
        print(min(abs(start+x), abs(start-x)))
    else:
        print(start)

Measured memory_bytes: 9136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N, M;
string s;
ll f[100001];

//x-M以上でs=0なる最小の値を出力
ll ms(ll x) {
  if (x-M > 0) {
    ll ub = x+1; ll lb = x-M-1;
    while (ub-lb > 1) {
      ll mid = (ub+lb)/2;
      ((f[mid] > f[x-M-1])? ub:lb) = mid;
    }
    return ub;
  } else {
    return 0;
  }
}

int main() {
  cin >> N >> M;
  cin >> s;
  f[0] = 0;
  for (ll i = 1; i < N+1; i++) {
    if (s[i] == '0') {f[i] = f[i-1]+1;}
    if (s[i] == '1') {f[i] = f[i-1];}
  }
  //cout << ms(1) << endl;
  //cout << f[6] << f[7] << f[8] << f[9] << f[10] << endl;
  
  vector<ll> v;
  ll pos = N;
  while (pos > 0) {
    v.push_back(pos - ms(pos));
    if (pos == ms(pos)) {cout << -1 << endl; return 0;}
    pos = ms(pos);
  }
  for (ll i = v.size()-1; i >= 0; i--) {
    cout << v[i] << " ";
  }
  cout << endl;
}

Measured memory_bytes: 2296
#include <stdio.h>

int main(void){
    int num=0;
    scanf("%d",&num);
//    int num =9834523;

    int h=num/3600;
    int m=(num/60)%60;
    int s=num%60;
    
    printf("%d:%d:%d\n",h,m,s);

    return 0;

}



Measured memory_bytes: 2744
N, M = (int(x) for x in input().split())
task_list = [
    {
        "index": i,
        "a": 0,
        "b": 0,
    } for i in range(M)
]
for i in range(M):
    task_list[i]["a"], task_list[i]["b"] = (int(x) for x in input().split())

task_list.sort(key=lambda x:x["b"])
ans, pointer = 0, 0
while pointer < M-1:
    task = task_list[pointer]
    j = 1
    while pointer+j < M and task_list[pointer+j]["a"] <= task["b"]-1/2\
    and task["b"]-1/2 <= task_list[pointer+j]["b"]:
        j += 1
    else:
        ans += 1
        if pointer+j == M:
            print(ans)
            exit()
        else:
            pointer += j
else:
    print(ans+(M-pointer))


Measured memory_bytes: 44840
using System;

namespace ABC145B
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            int x = 0;
            for(int i = 0;i <= a / 2 - 1;i++)
            {
                if (s[i] == s[a / 2 + i])
                    x += 1;
            }
            if (a % 2 != 0)
                x -= 1;

            if(x == a/2)
            Console.WriteLine("Yes");
            else
            Console.WriteLine("No");
        }
    }
}

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

class UnionFind
{
    public:
        const int n;
        vector<int> rank;
        vector<int> par;
        UnionFind(int num):n(num)
        {
            rep(i, 0, n)
            {
                rank.push_back(1);
                par.push_back(i);
            }
        }

        int find(int x)
        {
            if (par[x] == x) return x;
            else return par[x] = find(par[x]);
        }

        void unite(int x, int y)
        {
            x = find(x);
            y = find(y);

            if (x == y) return;

            if (rank[x] == rank[y])
            {
                rank[x]++;
                par[y] = x;
            }
            else
            {
                if (rank[x] > rank[y]) swap(x, y);
                par[x] = y;
            }
        }

        bool is_same(int x, int y)
        {
            return find(x) == find(y);
        }
};


vector<pair<int, int>> edges;

int main()
{
    int n, m;
    cin >> n >> m;

    rep(i, 0, m)
    {
        int a, b;
        cin >> a >> b;
        a--, b--;
        edges.emplace_back(a, b);
    }


    int ans = 0;
    rep(i, 0, m)
    {
        UnionFind uf_tree(n);
        rep(j, 0, m)
        {
            if (j == i) continue;
            uf_tree.unite(edges[j].first, edges[j].second);
        }

        bool ok = true;
        rep(j, 0, n) ok &= uf_tree.is_same(j, 0);
        ans += int(not ok);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <string>
#include <algorithm>
#include <vector> 
#include <math.h>
#include <iostream>
using namespace std;
long long mod = 1000000000 + 7;



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

	char black = '#';
	char white = '.';

	long long bs = 0;
	long long ws = 0;
	int bnum[200001];
	if (s[0] == black) {
		bs++;
		bnum[0] = 1;
	}
	else {
		ws++;
		bnum[0] = 0;
	}
	for (int i = 1; i < n; i++) {
		if (s[i] == black) {
			bs++;
			bnum[i] = bnum[i - 1] + 1;
		}
		else {
			ws++;
			bnum[i] = bnum[i - 1];
		}
	}

	long long ans = 999999;
	for (int i = 0; i < n; i++) {
		ans = min(ans, (long long)bnum[i] + ws - i - 1 + bnum[i]);
	}
	ans = min(ans, ws);

	cout << ans << endl;
	return 0;

}

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

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> A(N, 0);

	vector<int>store;
	vector<int>table;
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}

	for (int i = 0; i < N; i++)
	{
		bool found = false;
		for (int j = 0; j < store.size(); j++)
		{
			if (A[i] == store[j])
			{
				found = true;
				table[j] ++;
				break;
			}
		}

		if (!found)
		{
			table.push_back(1);
			store.push_back(A[i]);
			if (store.size() > 3)
			{
				cout << "No" << endl;
				return 0;
			}
		}
	}

	if (store.size() == 1)
	{
		if (store[0] == 0)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
		return 0;
	}

	if (store.size() == 2)
	{
		// 1, 1, 0
		if (table[0] > table[1])
		{
			std::swap(table[0], table[1]);
			std::swap(store[0], store[1]);
		}

		if (table[1] == table[0] * 2 && store[0] == 0)
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}

		return 0;
	}

	int res = store[0] ^ store[1] ^ store[2];

	if (res)
	{
		cout << "No" << endl;
	}
	else
	{
		if (table[0] == table[1] && table[1] == table[2])
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}
	
	return 0;
}


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

int main() {
	int N;
	cin>>N;
	int M;
	int a[N+1];
	for(int i=1; i<=N; i++){
	    cin>>a[i];
	}
	for(int i = N ; i>=1; i--){
	    int s=0;
	    int j=1;
	    while(i*j<=N){
	        s=s+a[i*j];
	        j++;
	    }
	    if(s%2 != a[i]){
	        a[i]++;
	    }
	    a[i]=a[i]%2;
	    if(a[i]!=0){
	        M++;
	    }
	}
	cout<<M<<endl;
	for(int i=1;i<=N;i++){
	    if(a[i]!=0){
	        cout<<i<<" ";
	    }
	}
	return 0;
}


Measured memory_bytes: 1792
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

void solve(){
    ll a;
    cin >> a;
    print(a + a*a + a*a*a);
    

}

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

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

int main()
{
    int n;
    cin >> n;
    n%=10;
    if(n==3)
        cout << "bon";
    else if(n==0 || n == 1 || n==6 || n ==8)
        cout << "pon";
    else
        cout << "hon";



 return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	int a[26];
	memset(a, 0, sizeof(a));
	while(cin >> s){
		int len = s.size();
		for(int i=0; i<len; i++){
			if(s[i]>='A' && s[i]<='Z')
				s[i] += 'a'-'A';
			int t = s[i]-'a';
			a[t] ++;
		}
	}
	for(int i=0; i<26; i++){
		cout << (char) (i+'a') << " : " << a[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3172
# https://atcoder.jp/contests/arc080/tasks/arc080_a

import itertools
from collections import Counter
from collections import defaultdict
import bisect

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = []
    for a in A:
        if a % 4 == 0:
            B.append(2)
        elif a % 2 == 0:
            B.append(1)
        else:
            B.append(0)
    four_num = B.count(2)
    two_num = B.count(1)
    one_num = B.count(0)

    if two_num == 0:
        if four_num >= one_num - 1:
            print("Yes")
        else:
            print("No")
    else:
        if four_num >= one_num:
            print("Yes")
        else:
            print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 14508
#include<stdio.h>
int main(void){
        int N,a[100],i,M,m;
        scanf("%d",&N);
        for(i=0;i<N;i++){
           scanf("%d",&a[i]);
       }
       M=m=a[0];
       for(i=1;i<N;i++){
           if(M<a[i]){
             M=a[i];
           }
       }
        for(i=1;i<N;i++){
           if(m>a[i]){
             m=a[i];
           }
       }
       printf("%d\n",M-m);
	return 0;
}

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

mt19937_64 llrand((int) chrono::steady_clock::now().time_since_epoch().count());

#define st first
#define nd second
#define pb push_back

#ifndef ONLINE_JUDGE
  #define db(x) cerr << #x << " == " << x << endl
  #define dbs(x) cerr << x << endl
  #define _ << ", " <<
#else
  #define db(x) ((void)0)
  #define dbs(x) ((void)0)
#endif

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;

const int INF = 0x3f3f3f3f, MOD = 1e9+7;
const int N = 1e2+5;

int n, m, q, ans;
vector<int> v;

struct query {
  int a, b, c, d;
};

vector<query> qs;

void brute(vector<int> &v) {
  if(v.size() == n) {
    int scr = 0;
    for(auto x : qs) if(v[x.b-1] - v[x.a-1] == x.c) scr += x.d;
    ans = max(ans, scr);
    return;
  }

  for(int i = v.size() ? v.back() : 1; i <= m; i++) v.push_back(i), brute(v), v.pop_back();
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n >> m >> q;
  qs.resize(q);
  for(int i = 0; i < q; i++) cin >> qs[i].a >> qs[i].b >> qs[i].c >> qs[i].d;
  brute(v);
  cout << ans << "\n";
}


Measured memory_bytes: 3592
n,a,b = map(int,input().split())
# (2**n-1)-nCa-nCb
mod = 10**9+7
M = pow(2,n,mod)-1

def comb(v):
    ans = 1
    for i in range(1,v+1): 
        ans *= n-i+1
        ans *= pow(i,mod-2,mod)
        ans %= mod
    return ans

print((M-comb(a)-comb(b))%mod)

Measured memory_bytes: 72672
#include <stdio.h>

int sort(int a[], int n)
{
	int i, j, minj, temp;
	int cnt = 0;

	for (i = 0; i < n - 1; i++) {
		minj = i;
		for (j = i + 1; j < n; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		if (minj != i) {
			cnt++;
			temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;
		}
	}

	return cnt;
}

int main(void) {
	int n, cnt;
	int line[100];
	int i;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%d", &line[i]);
	}

	cnt = sort(line, n);

	for (i = 0; i < n; i++) {
		printf("%d", line[i]);
		if (i < n - 1) {
			printf(" ");
		}
	}
	printf("\n%d\n", cnt);

	return 0;
}


Measured memory_bytes: 2100
function Main(input) {
	input = input.split("\n");
	tmp = input[0].split(" ");
	var number = input[1].split(" ");
	number = number.map(Number);
	var answer = 0;
	number.sort(
      function(a,b){
        return (a < b ? -1 : 1);
      }
    );
	answer = Number(number[0]);
	for(var i=1;i<tmp;i++){
      answer = (answer+Number(number[i]))/2;
    }
	console.log(answer);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using namespace std;

#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int main()
{
    FAST();
    int n,ans=1,mod;
    cin >> n;
    mod=7%n;
    while(mod > 0  &&  ans < n)
    {
        ++ans;
        mod=(mod*10+7)%n;
    }
    if(mod == 0)cout << ans;
    else cout << "-1";
    return 0;
}


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

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

ll mod=1e9+7;

using namespace std;


ll inputValue(){
	ll a;
	cin >> a;
	return a;
};

void inputArray(int * p, ll a){
	rep(i, a){
		cin >> p[i];
	}
};

template<typename T>
void inputVector(vector<T>& p, ll a){
	rep(i, a){
		T input;
		cin >> input;
		p.emplace_back(input);
	}
}


template <typename T>
void output(T a) {
	cout << a << "\n";
}

ll count(ll i,ll j, vector<string>& m)
{
	return 0;     
}



int main(int argc, const char * argv[]) {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	ll n;
	vector<pair<ll,ll>> jobs;

	cin >> n;	
	rep(i,n)
	{
		ll a,b;
		cin>>a>>b;
		jobs.emplace_back(a,b);
	}

	sort(jobs.begin(),jobs.end(),[](auto a,auto b){ return a.second < b.second; });

	ll sum =0;
	bool yes=true;

	for (auto v:jobs)
	{
		sum+= v.first;
		if(sum > v.second)
		{
			yes=false;
			break;
		}	
	}

	if(yes)
	{
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

}


Measured memory_bytes: 5872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main(){

	int n;
	cin>>n;
	
	
	while(n!=0){
		if(n%10==7)
		{
			cout<<"Yes";
			return 0;
		}
		n/=10;
	}
	cout<<"No";
	return 0;
}




Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){long long n;cin>>n;
long long a[n+1],i,p;
for(i=1;i<=n;i++){
    cin>>p;
    a[p]=i;
}for(i=1;i<=n;i++)
cout<<a[i]<<" ";
    return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <map>
#include <bitset>
#include <stack>
#define mp make_pair
#define pb push_back
#define mst(a,b)  memset((a),(b),sizeof (a))
#define eps 1e-9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf=1e8;
const int maxn=1e5+100;
const int mod=1e9+7;
int c[15][15];
int dis[15];
bool vis[15];
int to[15];
struct node{
    int pos,dis;
    bool operator<(const node&p)const{
        return dis>p.dis;
    }
    node(int a,int b):pos(a),dis(b){}
};
priority_queue<node>qu;
void run(int pos){
    mst(vis,0);
    while(!qu.empty())qu.pop();
    for(int i=0;i<10;++i)dis[i]=c[pos][i],qu.push( node( i,dis[i]) );
    while(!qu.empty()){
        node use=qu.top();qu.pop();
        if(vis[use.pos])continue;
        vis[use.pos]=true;
        if(use.pos==1)return;
        for(int i=0;i<10;++i){
            if(vis[i])continue;
            if(use.dis+c[use.pos][i]<dis[i]){
                dis[i]=use.dis+c[use.pos][i];
                qu.push(node(i,dis[i]) );
            }
        }
    }
}
int main() {
#ifdef local
//    freopen("in.txt", "r", stdin);
#endif
    int n,m;cin>>n>>m;
    for(int i=0;i<10;++i)for(int j=0;j<10;++j)cin>>c[i][j];
    for(int i=0;i<10;++i){
        run(i);
        to[i]=dis[1];
    }
    int ans=0;
    for(int i=0;i<n;++i){
        for(int j=0;j<m;++j){
            int d;cin>>d;
            if(d!=-1)ans+=to[d];
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
from fractions import gcd

A, B, C, D = map(int, input().split())

num1 = B // C - (A-1) // C
num2 = B // D - (A-1) // D
gcdCD = C * D // gcd(C, D)
num3 = B // gcdCD - (A-1) // gcdCD

print(B - A - num1 - num2 + num3 + 1)

Measured memory_bytes: 5048