akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
		String  first = br.readLine();
		int[] array = new int[Integer.parseInt(first)];
		String str = br.readLine();
		String[] stra = str.split(" ");
		for (int i = 0 ; i < array.length ; i++){
			array[i] = Integer.parseInt(stra[i]);
		}
		int max = array[0]; int min = array[0]; long sum = 0;
		for (int x = 0 ; x < array.length ;x++){
			max = Math.max(max, array[x]);
			min = Math.min(min,array[x]);
			sum = sum + array[x];
		}
		System.out.println(min + " " + max + " " + sum);
	}

}

Measured memory_bytes: 25612
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <random>
#include <algorithm>
#include <chrono>
#include <map>
#define tNow chrono::duration_cast<msec>(chrono::system_clock::now().time_since_epoch())
#define INF (1 << 30)
using namespace std;

typedef chrono::milliseconds msec;

int d, lastVal = -INF, bestVal = -INF, times = 0, groups = 0, updates = 0, positiveUpdates = 0;
vector<int> c(27), cur, ans;
vector< vector<int> > s;

int calc() {
    int sum = 0;
    vector<int> last(27, 0);
    for (int i = 1; i <= d; ++i) {
        sum += s.at(i).at(cur.at(i));
        last.at(cur.at(i)) = i;
        for (int j = 1; j <= 26; ++j) sum -= c.at(j) * (i - last.at(j));
    }
    return sum;
}

void update(int curVal) {
    lastVal = curVal;
    if (bestVal < curVal) {
        bestVal = curVal;
        ans = cur;
        ++positiveUpdates;
    }
    ++updates;
}

int main() {
    random_device r;
    msec st = tNow;
    msec lm = st + chrono::milliseconds(1980);
    cin >> d;
    s = vector< vector<int> >(d + 1, vector<int>(27));
    cur.resize(d + 1);
    for (int i = 1; i <= 26; ++i) cin >> c.at(i);
    for (int i = 1; i <= d; ++i) for (int j = 1; j <= 26; ++j) cin >> s.at(i).at(j);
    mt19937 m(r());
    for (int i = 1; i <= d; ++i) cur.at(i) = max_element(s.at(i).begin(), s.at(i).end()) - s.at(i).begin();
    update(calc());
    // cur = {0, 1, 17, 13, 14, 13};
    // update(calc());
    // cout << bestVal << endl;
    // for (int i = 1; i <= d; ++i) cout << ans.at(i) << endl;

    while (tNow < lm) {
        ++groups;
        mt19937 m(r());
        for (int i = 0; i < 100; ++i) {
            int changeAt = m() % d + 1, changeTo = m() % 26 + 1, changedFrom = cur.at(changeAt);
            if (changedFrom == changeTo) continue;
            cur.at(changeAt) = changeTo;
            int curVal = calc();
            if (m() % max(1, (lastVal - curVal) / 8) == 0) update(curVal);
            else cur.at(changeAt) = changedFrom;
            ++times;
        }
    }

    for (int i = 1; i <= d; ++i) cout << ans.at(i) << endl;
    msec ed = tNow;
    #ifdef ___DEBUG
    cout << "Best Value: " << bestVal << endl;
    cout << "Best Score: " << max(bestVal + 1000000, 0) << endl;
    cout << "Tried: " << times << "times, " << groups << "groups\n";
    cout << "Updated: " << updates << "times\n";
    cout << (ed - st).count() << "ms\n";
    #endif
    return 0;
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    int n;
    cin >> n;

    vector<int> c(26, 100);
    string s;
    for(int in=0;in<n;in++) {
        vector<int> ctmp(26, 0);
        cin >> s;
        for(int is=0;is<s.size();is++) {
            ctmp.at(s.at(is)-'a')++;
        }
        for(int i=0;i<26;i++) {
            c.at(i) = min(c.at(i), ctmp.at(i));
        }
    }

    char chara;
    for(int i=0;i<26;i++) {
        chara = i + 'a';
        for(int ic=0;ic<c.at(i);ic++) {
            cout << chara;
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3528
#include<bits/stdc++.h>
#define dbug printf("I am here\n");
#define Fast ios_base::sync_with_stdio(false); cin.tie(0);
#define vs              v.size()
#define ss              s.size()
#define sot(v)        sort(v.begin(),v.end())
#define rev(v)        reverse(v.begin(),v.end())
#define ii                pair<int,int>
#define ll                long long
#define ull              unsigned long long
#define pb              push_back
#define mpp          make_pair
#define Okay         0
#define pi               3.14159

static ll int inf = 1e9;
using namespace std;


void solve(){
       int k;
    cin >> k;
    int cur = 7;
    int ans = -1;
    for (int i = 1; i <= k; i++){
        if (cur % k == 0){
            ans = i;
            break;
        }
        cur *= 10;
        cur += 7;
        if (cur >= k){
            cur %= k;
        }
    }
    cout << ans;

}


int main(){

    solve();

    return Okay ;
}


Measured memory_bytes: 3636
package main

import (
	"fmt"
)

func main() {
	var c, ans int
	var S string
	fmt.Scan(&S)
	for _, s := range S {
		if string(s) == "R" {
			c++
		} else {
			if c > ans {
				ans = c
				c = 0
			}
		}
	}
	if c > ans {
		ans = c
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1768
#include<bits/stdc++.h>
using namespace std;
 
int main(void){
    int N;cin >> N;
    string s[N];
    map<string, int> mp;

    for (int i=0;i<N;i++){
        cin >> s[i];
        mp[s[i]]++;
    }


    if (mp.size() == 3){
        cout << "Three" << endl;
    } else {
        cout << "Four" << endl;
    }

    return 0;
}

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

int main() {
	string S; cin >> S;
	int G[26];
	for(int i=0; i<26; ++i) G[i]=1;
	for(int i=0; i<S.size(); ++i) --G[S[i]-'a'];
	if(S.size()<26){
	    int i=0;
	    while(!G[i]) ++i;
	    char add='a'+i;
	    cout << S + add << endl;
	    
	}
	else{
	    bool P=true;
	    for(int i=S.size()-1; i>=0; --i){
	        bool f=true;
	        for(int j=S[i]-'a'; j<26; ++j){
	            if(G[j]){
	                S[i]='a'+j;
	                cout << S << endl;
	                f=false;
	                break;
	            }
	        }
	        if(f){
	            ++G[S[i]-'a'];
	            S.pop_back();
	        }
	        else{
	            P=false;
	            break;
	        }
	    }
	    if(P) cout << -1 << endl;
	}
	return 0;
}


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

int main()
{
    int N;
    std::cin >> N;
    std::vector<int> R(N);
    R.reserve(1000000000);
    for (int i = 0; i < N; i++) {
        std::cin >> R[i];
    }

    int minv, maxv;
    minv = R[0];
    maxv = R[1] - minv;
    for (int j = 1; j < N; j++) {
        if (R[j] - minv > maxv) {
            maxv = R[j] - minv;
        }
        if (minv > R[j]) {
            minv = R[j];
        }
    }

    std::cout << maxv << std::endl;
}


Measured memory_bytes: 4376
#include <iostream>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <cstring>
#include <istream>
#include<cmath>
#include<map>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<cstring>
using namespace std;
typedef long long ll;
const int maxn = 100009;
int a[maxn], b[maxn], c[maxn];
ll f[maxn];
ll ans = 0;
int main()
{
	int n;
	while (~scanf("%d", &n)){
		for (int i = 0; i < n; i++)
			scanf("%d", &a[i]);
		for (int j = 0; j < n; j++) 
			scanf("%d", &b[j]);
		for (int k = 0; k < n; k++)
			scanf("%d", &c[k]);
		sort(a, a + n);
		sort(b, b + n);
		sort(c, c + n);
		ans = 0;
		for (int i = 0; i < n; i++)
		{
			if (b[i] >= c[n - 1])
				break;
			f[i + 1] =(ll)(n - (upper_bound(c, c + n, b[i]) - c));
		}
		f[0] = 0;
		for (int i = 1; i <= n; i++)
			f[i] += f[i - 1];
		for (int i = 0; i < n; i++)
		{
			if (a[i] >= b[n - 1])
				break;
			int s = upper_bound(b, b + n, a[i]) - b;
			ans += f[n] - f[s];
		}
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 2176
s = gets.chomp
k = gets.to_i
l = s.length

ans = 0
count = 0
x = 1
(l-1).times do |i|
    if s[i] == s[i+1]
        count == 0 ? x += 1 : count += 1
    else
        ans += count / 2
        count = 1
    end
end

if x == l
    puts l * k / 2
elsif s[0] == s[-1]
    puts ans * k + x / 2 + count / 2 + (x + count) / 2 * (k - 1)
else
    puts ans * k + (x / 2 + count / 2) * k
end


Measured memory_bytes: 1788
#pragma once
#include <algorithm>
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
using namespace std;
int hito=0;
int sa[200000]={};
long long int result=0;
int mycount[200000]={};
bool myf=false;
int nizyou=0;

int main(){
	scanf("%d",&hito);

	for(int i=0;i<hito;i++){
		scanf("%d",&sa[i]);
		mycount[sa[i]]++;
	}

	if(hito%2==1){
		if(mycount[0]!=1){
			myf=true;
		}
		for(int i=2;i<hito;i+=2){
			if(mycount[i]!=2){
				myf=true;
			}
		}
	}
	else{
		for(int i=1;i<hito;i+=2){
			if(mycount[i]!=2){
				myf=true;
			}
		}
	}

	nizyou=hito/2;
	if(myf==false){
		result=1;
		for(int i=0;i<nizyou;i++){
			result*=2;
			result=result%1000000007;
		}
	}
	
	printf("%lld\n",result);
	

return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <map>
#include <vector>
#include <numeric>

using namespace std;
int main() {
    int n, all;
    cin >> n >> all;

    int min = 1001;
    for(int i=0;i<n;i++) {
        int c,t;
        cin >> c >> t;
        if (t <= all && c < min) {
            min = c;
        }
    }

    if (min == 1001) {
        cout << "TLE" << endl;
    } else {
        cout << min << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
using namespace std;

const int N = 1e3;
int n,d[N];

int main(){
    cin >> n;
    for(int i=1;i<=n;++i)   cin >> d[i];
    ll ans = 0;
    for(int i=1;i<=n;++i){
        for(int j=i+1;j<=n;++j)
            ans += (d[i] * d[j]);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
// #pragma GCC optimize "trapv" Uncomment when dealing with huge numbers
/*<----------PBDS---------->

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
template <typename T>
using order_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

order_set<datatype>oset;
Kth smallest : *oset.find_by_order(k-1); // 0 based index
No of elements less than k : oset.order_of_key(k);
Erase X : oset.erase(x)
<----------PBDS---------->*/
#include<iostream>
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define pb(x) push_back(x)
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()
#define lcm(a,b) (a*b)/gcd(a,b)
#define bits(x) __builtin_popcountll(x)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int32_t main()
{
    fast;
    int n;
    cin >> n;
    int a[n],b[n],c[n];
    for(int i = 0 ; i < n ; i++ ){
    	cin >> a[i] >> b[i] >> c[i];
	}
	int dp[n][3];
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	for(int i = 1 ; i < n ; i++ ){
		dp[i][0] = a[i]+max(dp[i-1][1],dp[i-1][2]);
		dp[i][1] = b[i]+max(dp[i-1][0],dp[i-1][2]);
		dp[i][2] = c[i]+max(dp[i-1][0],dp[i-1][1]);
	}
	cout << max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
}





Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {
    private static final long MOD = (long) 1e9 + 7;

    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final long n = scanner.nextInt();
        final long a = scanner.nextInt();
        final long b = scanner.nextInt();

        long all = 1;
        for (int i = 10; i <= n; i += 10) {
            all *= 1024;
            all %= MOD;
        }
        for (int i = 1; i <= n % 10; i++) {
            all *= 2;
            all %= MOD;
        }

        all--;

        System.out.println((all + MOD - calc(n, a) + MOD - calc(n, b)) % MOD);
    }

    private static long calc(final long n, final long k) {
        long tmp = 1;
        for (long i = 1; i <= k; i++) {
            tmp *= ((n - i + 1) * modInv(i, MOD)) % MOD;
            tmp %= MOD;
        }
        return tmp;
    }

    private static long modPow(long a, long n, final long mod) {
        long res = 1;
        while (n > 0) {
            if ((n & 1) != 0) {
                res = res * a % mod;
            }
            a = a * a % mod;
            n >>= 1;
        }
        return res;
    }

    private static long modInv(final long a, final long mod) {
        return modPow(a, mod - 2, mod);
    }
}


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){

  while(x->left != NIL) x=x->left;

  return x;

}

Node treeMaximum(Node x){

  while(x->right != NIL) x=x->right;

  return x;

}

Node treeSearch(Node u, int k){

  if(u == NIL || k == u->key) return u;

  if(k < u->key) return treeSearch(u->left,k);

  else return treeSearch(u->right,k);

}

Node treeSuccessor(Node x){

  if(x->right != NIL) return treeMinimum(x->right);
  Node y = x->parent;
  while(y != NIL && x==y->right){
    x=y;
    y=y->parent;
  }
  return y;

}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;

  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;

}

void inorder(Node u){

  if(u != NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }

}
void preorder(Node u){

  if(u != NIL){
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 25208
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    
    n = I()
    a = [0] + LI()
    ans = [0 for _ in range(n+1)]

    for i in range(n,0,-1):
        cnt = 0
        for j in range(i,n+1,i):
            cnt += ans[j]
        if cnt%2 != a[i]:
            ans[i] = 1
    
    ans_lst = []
    for i in range(1,n+1):
        if ans[i] == 1:
            ans_lst.append(i)

    print(len(ans_lst))
    print(*ans_lst)

    
main()


Measured memory_bytes: 101528
#include<bits/stdc++.h>
using namespace std;
namespace mine
{
    typedef long long ll;
    #define pr pair<ll,ll>
    #define FR first
    #define SE second
    #define MP make_pair
    #define PB push_back
    #define vc vector
    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define bin(x) (1ll<<(x))
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num)
    {
        if(num<0) putchar('-'),num=-num;
        if(num>=10) write(num/10);
        putchar('0'+num%10);
    }
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):0;}

    const int INF=0x3f3f3f3f;
    const int MOD=998244353;
    inline int mm(const int x){return x>=MOD?x-MOD:x;}
    inline ll qpower(ll x,ll e)
    {
        ll ans=1;
        while(e){if(e&1)ans=ans*x%MOD;x=x*x%MOD;e>>=1;}
        return ans;
    }
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=1e6+10;

	int a[N],b[N],c[N];
	void main()
	{
		int n=qread();
		for(int i=1;i<=n;i++) a[i]=qread();
		for(int i=1;i<=n;i++) b[i]=qread();
		for(int i=1;i<n;i++) c[i]=qread();
		int ans=0;
		for(int i=1;i<=n;i++)
		{
			ans+=b[a[i]];
			if(i and a[i-1]+1==a[i]) ans+=c[a[i-1]];
		}write(ans);
	}
};
int main()
{
	srand(time(0));
	mine::main();
}

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

const int N = 16777217;

int n;
char data[16777217];

int conv(char c){
  switch(c){
  case 'A':
    return 1;
    break;
  case 'C':
    return 2;
    break;
  case 'G':
    return 3;
    break;
  case 'T':
    return 4;
    break;
  }
}

int hash(char str[10]){
  int res = 0, size = strlen(str), r = 1, i;
  for(i=size-1;i>=0;i--){
    res += r * conv(str[i]);
    r *= 4;
  }
  return res;
}

void insertElm(int d){
  data[d] = 1;
}

char findElm(int d){
  return data[d];
}

main(){
  char ope[13], str[13];
  int i;
  memset(data, 0, 16777217);
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%s", ope);
    scanf("%s", str);
    if(!strcmp(ope, "insert")) insertElm(hash(str));
    else printf("%s\n", (findElm(hash(str)) ? "yes" : "no"));
  }
  return 0;
}

Measured memory_bytes: 16000
#include <bits/stdc++.h>
using namespace std;
int main(){
	priority_queue<int,vector<int>,greater<int>> q;
	for(size_t i = 0 ; i < 3 ; i++){
		int tmp; cin >> tmp;
		q.push(tmp);
	}

	int ans = 0;
	int prev = 0;
	for(size_t i = 0 ; i < 3 ; i++){

		if(i==0){
			prev=q.top();
			q.pop();
			continue;
		}

		ans += abs(q.top()-prev);

		 prev = q.top();
		q.pop();
	}

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

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int n, m;
  cin >> n >> m;
  string s;
  cin >> s;

  vector<int> ys;
  int x = n;
  while (true) {
    if (x <= m) {
      ys.push_back(x);
      break;
    }
    int x_new = x - m;
    while (s[x_new] == '1') x_new++;
    if (x_new == x) {
      cout << -1 << endl;
      return 0;
    }
    ys.push_back(x - x_new);
    x = x_new;
  }

  reverse(ys.begin(), ys.end());
  for (int y : ys) cout << y << " ";
  cout << endl;
}

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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int N;
    cin >> N;
    int A, B, C, D;
    D = N%10;
    N = (N - D)/10;
    C = N%10;
    N = (N - C)/10;
    B = N%10;
    A = (N - B)/10;

    for(int i = 0;i < 8;i++) {
        int res = A;

        if(i&0b1) {
            res += B;
        }else{
            res -= B;
        }

        if(i&0b10) {
            res += C;
        }else{
            res -= C;
        }

        if(i&0b100) {
            res += D;
        }else{
            res -= D;
        }
        if(res == 7) {
            cout << A << (i&0b1 ? "+" : "-") << B << (i&0b10 ? "+" : "-") << C << (i&0b100 ? "+" : "-") << D << "=7" << endl;
            return 0;
        }
    }
    return 0;
}



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

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

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

  int a, b, c;
  cin >> a >> b >> c;
  if (a == b) {
    cout << c << endl;
  } else if (b == c) {
    cout << a << endl;
  } else if (c == a) {
    cout << b << endl;
  }
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC150
{
	class Program
	{
		static void Main(string[] args)
		{
		int K, N ;
        var word=Console.ReadLine().Split(' ');
		K = int.Parse(word[0]);
		N = int.Parse(word[1]);
		if (500 * K >=N)
			Console.WriteLine("Yes");

		else
			Console.WriteLine("No");

		    Console.ReadKey();
		}
	}
}


Measured memory_bytes: 11092
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <math.h>
 
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

#define MOD 1000000007LL

ll A, B, H, M;

int main()
{
  long double ans;
  long double Hl;
  long double a1, a2;
  long double x1, x2;
  long double y1, y2;

  cin >> A >> B >> H >> M;

  Hl = H + (long double)M/60;
  a1 = (long double)(3-Hl)/6 * M_PI;
  a2 = (long double)(15-M)/30 * M_PI;

//printf("%Lf %Lf\n", a1, a2);
//printf("%Lf %Lf\n", a1/M_PI*180, a2/M_PI*180);

  x1 = A * cos(a1);
  x2 = B * cos(a2);
  y1 = A * sin(a1);
  y2 = B * sin(a2);

//  printf("%Lf,%Lf %Lf,%Lf\n", x1, y1, x2, y2);

//  printf("%Lf %Lf\n", (x1-x2)*(x1-x2), (y1-y2)*(y1-y2));
  ans = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));

  printf("%.10Lf\n", ans);

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


Measured memory_bytes: 4100
package main

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

func main() {
	in := bufio.NewScanner(os.Stdin)
	for in.Scan() {
		s := strings.Split(in.Text(), " ")
		if s[0] == "0" && s[1] == "0" {
			break
		}
		h, _ := strconv.Atoi(s[0])
		w, _ := strconv.Atoi(s[1])
		for i := 0; i < h; i++ {
			for j := 0; j < w; j++ {
				if i%2 == 0 {
					if j%2 == 0 {
						fmt.Print("#")
					} else {
						fmt.Print(".")
					}
				} else {
					if j%2 == 0 {
						fmt.Print(".")
					} else {
						fmt.Print("#")
					}
				}
			}
			fmt.Println()
		}
		fmt.Println()
	}
}



Measured memory_bytes: 1104
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n+1);
    REP1(i,1,n) {
        cin >> a[i];
    }
    map<int,int> mp;
    REP1(i,1,n) {
        mp[i-a[i]]++;
    }
    LL ans=0;
    REP1(i,1,n) {
        int x=i+a[i];
        if ( mp.count(x) ) {
            ans=ans+mp[x];
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 12484
#include<stdio.h>
#define N 100000

struct Node{int r,l,in;};
struct Node T[N];

int n, length[N];

int depth(int, int);

int main() {
  int i,id,k,c,j,l,in;

  scanf("%d",&n);

  for(i = 0 ; i < n ; i++) {
    T[i].r = -1;
    T[i].l = -1;
    T[i].in = -1;
  }

  for(i = 0 ; i < n ; i++) {
    scanf("%d%d",&id,&k);
    for(j = 0 ; j < k ; j++) {
      scanf("%d",&c);
      if(j == 0) T[id].l = c;
      else T[l].in = c;
      l = c;
      T[c].r = id;
    }
  }
  for(i = 0 ; i < n ; i++)
    if(T[i].r == -1) in = i;

  depth(in, 0);

  for(i = 0 ; i < n ; i++) {
    printf("node %d: parent = %d, depth = %d,", i, T[i].r, length[i]);
    printf(" ");
    if(T[i].r == -1) printf("root, [");
    else if(T[i].l == -1) printf("leaf, [");
    else printf("internal node, [");
    c=T[i].l;
    while(c != -1) {
      if(c == T[i].l)printf("%d",c);
      c = T[c].in;
      if(c != -1)printf(", %d",c);

      
    }
    printf("]\n");
  }
  return 0;
}

int depth(int u, int q) {
  length[u] = q;
  if(T[u].in != -1) depth(T[u].in, q);
  if(T[u].l != -1) depth(T[u].l, q+1);
}

Measured memory_bytes: 5300
X, K, D = map(int, input().split())
x = abs(X)
q = x // D
if q <= K:
    x -= q * D
    k = K - q
else:
    x -= K * D
    k = 0

if k % 2 == 0:
    print(abs(x))
else:
    print(abs(x - D))

Measured memory_bytes: 9124
N = int(input())
h = list(map(int, input().split()))

cnt = 0
for i in range(100, 0, -1):
    prev = False
    for j in range(N):
        if h[j] == i:
            if not prev:
                cnt += 1
            h[j] -= 1
            prev = True
        else:
            prev = False

print(cnt)


Measured memory_bytes: 3060
from sys import stdin

def main():
    s = [int(x) if x != "?" else "?" for x in stdin.readline().rstrip()]

    dp = [1] + [0]*12
    mod = 10 ** 9 + 7

    for i in (range(0,len(s))):
        next_dp = [0]*13
        if s[i] == "?":
            for k in range(0, 10):
                for j in range(0, 13):
                    next_dp[(j*10+k)%13] += dp[j]
                    next_dp[(j*10+k)%13] %= mod

        else:
            k = s[i]
            for j in range(0, 13):
                    next_dp[(j*10+k)%13] += dp[j]
                    next_dp[(j*10+k)%13] %= mod

    #    mul = mul * 10 % 13
        dp = next_dp

    print(dp[5])

if __name__ == '__main__':
    main()

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

string s, t;

int main(){
	cin >> s >> t;
	int mn = INT_MAX;
	for(int i = 0; i <= s.size() - t.size(); i++){
		int index = 0;
		for(int j = i; j < t.size() + i; j++){
			if(t[j - i] == s[j])
				index++;
		}
		mn = min(mn, (int)(t.size() - index - 1));
	}
	cout << mn + 1 << endl;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size() 
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=1;i<=n;i++)
#define ford(i,n) for(int i=n;i>=0;i--) 
#define REP(i,a,n) for(int i=a;i<n;i++)
#define foreach(itr,c) for(__typeof((c).begin(),(c).end())itr=c.begin();itr!=c.end();itr++) 
#define fill(a,b) memset(a,b,sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi > vpi; 
int main(){
	string s;
	cin>>s;
	cout<<s[0]<<s[1]<<s[2]; 
	re 0;
}

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

int main(){
	int n,q ;
	cin >> n >> q ;
	string s ; cin >> s ;
	vector<int> ac(n,0) ;
	for(int i=1;i<n;i++){
		if(s.at(i-1)=='A'&&s.at(i)=='C') ac.at(i) = ac.at(i-1)+1 ;
		else ac.at(i) = ac.at(i-1) ;
	}
	for(int i=0;i<q;i++){
		int l,r ; 
		cin >> l >> r ;
		if(l==1) cout << ac.at(r-1) << endl ;
		else{
			if(ac.at(l-2)=='A'&&ac.at(l-1)=='C') cout << ac.at(r-1)-ac.at(l-1)-1 << endl ;
			else cout << ac.at(r-1)-ac.at(l-1) << endl ;
		}
	}
}

Measured memory_bytes: 1408
import java.util.*;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.next());
        String s = scanner.next();
        int[][] dp = new int[N][N];
        int ans = 0;
        for (int i = N - 1; i >= 0; i--) {
            char ci = s.charAt(i);
            for (int j = N - 1; j >= 0; j--) {
                if (i == j) continue;
                char cj = s.charAt(j);
                if (ci == cj) {
                    if (i == N - 1 || j == N - 1) {
                        dp[i][j] = 1;
                    } else {
                        dp[i][j] = Math.min(dp[i + 1][j + 1] + 1, Math.abs(i - j));
                    }
                }
                ans = Math.max(ans, dp[i][j]);
            }
        }

        System.out.println(ans);
    }
}



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


int main()
{
    string s, ans;
    cin >> s;
    if(s == "Sunny") ans = "Cloudy";
    else if(s == "Cloudy") ans = "Rainy";
    else ans = "Sunny";
    cout << ans << endl;

}

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int answer;
        if(n<105){
            answer = 0;
        }
        else if(n<135){
            answer = 1;
        }
        else if(n<165){
            answer = 2;
        }
        else if(n<189){
            answer = 3;
        }
        else if(n<195){
            answer = 4;
        }
        else{
            answer = 5;
        }
        System.out.println(answer);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>

using namespace std;
string a[500];
string red[500];
string blue[500];
int main(){
  int H;
  int W;
  cin >> H >> W;
  for(int i = 0; i < H; i++){
    cin >> a[i];
  }

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      red[i].push_back('.');
      blue[i].push_back('.');
    }
  }

  for(int i = 0; i < H; i++){
    red[i][0] = '#';
    blue[i][W - 1] = '#';
  }

  for(int i = 0; i < H; i++){
    for(int j = 1; j < W - 1; j++){
      if(i % 2 == 0){
        red[i][j] = '#';
      } else {
        blue[i][j] = '#';
      }
    }
  }

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(a[i][j] == '#' && red[i][j] != '#'){
        red[i][j] = '#';
      }
      if(a[i][j] == '#' && blue[i][j] != '#'){
        blue[i][j] = '#';
      }
    }
  }

  for(int i = 0; i < H; i++){
    cout << red[i] << endl;
  }
  cout << endl;
  for(int i = 0; i < H; i++){
    cout << blue[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 1536
/*                                  /   \                                 */      
/*                                 /*****\                               */
/*     Jai Shree Mataji           /       \ |\| |_| $ |-| K             */
#include<vector>
#include<iostream>
#include<algorithm>                
#include<string.h>                 
#include<bits/stdc++.h>            
#include<cstring>                  
#include<map>                     
#include<cmath>                  
#include<set>
using namespace std;            
#define ll long long int        
#define ld long double
#define MOD 1000000007 
#define PI 3.1415926535897932384626433832795                                               
#define YY cout<<"YES"
#define NN cout<<"NO"
#define ee cout<<"\n"
#define ne cout<<"-1"
#define pb push_back 
#define fi first
#define se second
#define mkp make_pair    
#define sall(v ) sort(v.begin(), v.end())      
#define all(v )  v.begin(), v.end()      
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
#define vl vector<ll>
#define vll vector< pair<ll,ll> > 
#define mpl map<ll, ll>
#define pr pair<ll,ll>
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b) {return (a.second < b.second); }
ll pow1(ll n,ll p){if(p==0)return 1;ll x=pow1(n, p/2);x=(x*x)%MOD;if(p%2==0) return x%MOD;else return (x*n)%MOD;}
ll pd(ll x,ll y){if(x%y==0) return x/y;else return x/y+1;}  
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);	
	  ll t=1;


//	   cin>>t;
	      while(t--)
{
/*
2
ABCXYZ*/
ll n,i;
cin>>n;
string s;
cin>>s;
fo(i,s.length())
{char d=((s[i]-65+n))%26+65;
	cout<<d;
}
	ee;
	
}
return 0;
}









Measured memory_bytes: 3652
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String[] s = new String[1030];
		String[] ans = new String[1030];
		int n=0;
		int count=0;
		
		while(sc.hasNext()){
			s[n] = sc.next();
			if(s[n].length()==7){
				String t = s[n].substring(6,7);
				if(t.compareTo(",")==0 || t.compareTo(".")==0){
					ans[count]=s[n].substring(0,6);
					count++;
				}	
			}else if(s[n].length()==3){
				String t = s[n].substring(2,3);
				if(t.compareTo(",")!=0 && t.compareTo(".")!=0){
					ans[count]=s[n].substring(0,3);
					count++;
				}	
			}else if(s[n].length()>3 && s[n].length()<7){
				String t = s[n].substring(s[n].length()-1,s[n].length());
				if(t.compareTo(",")==0 || t.compareTo(".")==0){
					ans[count]=s[n].substring(0,s[n].length()-1);
					count++;
				}else{
					ans[count] = s[n];
					count++;
				}
			}
			n++;
	
		}
		
		for(int i=0;i<count;i++){
			if(i!=0)System.out.print(" ");
			System.out.print(ans[i]);
		}
		System.out.println();

	}
}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t n;
    cin >> n;

    string s;
    cin >> s;

    for (auto sheep0 : {false, true}) {
        for (auto sheep1 : {false, true}) {
            vector<bool> sheep(n);
            sheep[0] = sheep0;
            sheep[1] = sheep1;

            for (auto i : irange(1L, n - 1)) {
                sheep[i + 1] = (sheep[i - 1] ^ (sheep[i] != (s[i] == 'o')));
            }

            if ((sheep[0] == (s[0] == 'o')) != (sheep[1] == sheep[n - 1])) {
                continue;
            }

            if ((sheep[n - 1] == (s[n - 1] == 'o')) !=
                (sheep[n - 2] == sheep[0])) {
                continue;
            }

            for (auto i : irange(0L, n)) {
                cout << (sheep[i] ? 'S' : 'W');
            }
            cout << endl;
            return 0;
        }
    }

    cout << -1 << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long       ll;
typedef long double     ld;
typedef string          str;
#define all(x)			(x).begin(),(x).end()
#define Sort(x)			sort(all(x))
#define A               first
#define B               second
#define sep             ' '
#define endl            '\n'
#define fast_io         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int MAX1 = 5e5 + 7;

ll a, b, c, T, d, e, l, r, x, y, z, mid, cnt, flag, mod = 1e9+7;
vector <ll> vec;

int main(){
	cin >> a >> b;
	for (int i = 0; i < a; ++i){
		cin >> x;
		if (x >= b)	++cnt;
	}
	cout << cnt;
    return 0;
}
/*                          now or never                         */


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  string s,t="keyence";
  cin >> s;
  for(int i=0; i<7; i++) {
    string a=t.substr(0,i),b=t.substr(i,7-i);
    if(a==s.substr(0,i)&&b==s.substr(s.size()-(7-i),7-i)) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}

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

typedef struct {
	int i;
	int num;
}pair;

signed compair(const void *a, const void *b){
	return ((pair *)a)->num - ((pair *)b)->num;
}

int max(int a, int b){
	return a >= b ? a : b;
}

int main(){
	int N, i, M = 100000, ans;
	scanf("%d", &N);
	int *v = (int *)malloc(sizeof(int) * N);
	pair *A = (pair *)malloc(sizeof(pair) * (M + 1));
	pair *B = (pair *)malloc(sizeof(pair) * (M + 1));
	for(i = 0; i <= M; i++){
		A[i].num = 0;
		B[i].num = 0;
		A[i].i = i;
		B[i].i = i;
	}
	for(i = 0; i < N; i++){
		scanf("%d", &v[i]);
		if(i % 2 == 0){
			A[v[i]].num++;
		}
		else{
			B[v[i]].num++;
		}
	}
	qsort(A, M + 1, sizeof(pair), compair);
	qsort(B, M + 1, sizeof(pair), compair);
	if(A[M].i != B[M].i){
		ans = A[M].num + B[M].num;
	}
	else{
		ans = A[M].num + max(A[M - 1].num, B[M - 1].num);
	}
	printf("%d\n", N - ans);
	return 0;
}

Measured memory_bytes: 2940
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())


n = int(input())
s, t = input().split(" ")
ans_s = str()
for i in range(n):
    ans_s += s[i]
    ans_s += t[i]

print(ans_s)

Measured memory_bytes: 22792
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) std::memset(arg,n,sizeof(arg))
#define mp(a,b) std::make_pair(a,b)
using std::cin;
using std::min;
using std::max;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
int N;
double t[110],v[110];
double vmax[110];//t[i]の時点で出して良い最高速度
double v0[110];//実際にt[i]の時点で出している速度
double solve(){
  double res=0;
  //vmaxの計算
  vmax[N-1]=0;
  for(int i=N-1;i>0;i--){
    vmax[i-1]=min(v[i],t[i]+vmax[i]);
  }
  if(t[0]<=min(v[0],vmax[0])){//vにもvmaxにも到達できない場合
    v0[0]=t[0];
    res+=t[0]*t[0]/2;
  }
  else{
    if(v[0]<=vmax[0]){//vmaxの前にvで頭打ちになる場合
      v0[0]=v[0];
      res+=v[0]*t[0]-v[0]*v[0]/2;
    }
    else{
      if(t[0]+vmax[0]<=2*v[0]){//頭打ちにならず三角形になる場合
	v0[0]=vmax[0];
	res+=(t[0]+vmax[0])*(t[0]+vmax[0])/4-vmax[0]*vmax[0]/2;
      }
      else{//頭打ちになって台形になる場合
	v0[0]=vmax[0];
	res+=(t[0]+vmax[0])*(t[0]+vmax[0])/4-vmax[0]*vmax[0]/2-((t[0]+vmax[0])/2-v[0])*((t[0]+vmax[0])/2-v[0]);	
      }
    }
  }
  rep1(i,N-1){
    double x=t[i],y=std::fabs(vmax[i]-v0[i-1]),z=(x+y)/2,w=v[i]-min(v0[i-1],vmax[i]);
    if(x+v0[i-1]<=min(v[i],vmax[i])){//vにもvmaxにも到達できない場合
      v0[i]=x+v0[i-1];
      res+=min(v0[i-1],v0[i])*x+x*x/2;
    }
    else{
      if(v[i]<=vmax[i]){//vmaxの前にvで頭打ちになる場合
	v0[i]=v[i];
	res+=v[i]*x-w*w/2;
      }
      else{
	if(z<=w){//頭打ちにならず三角形になる場合
	  v0[i]=vmax[i];
	  res+=min(v0[i-1],v0[i])*x+z*z-y*y/2;
	}
	else{//頭打ちになって台形になる場合
	  v0[i]=vmax[i];
	  res+=min(v0[i-1],v0[i])*x+z*z-y*y/2-(z-w)*(z-w);
	}
      }
    }
  }
  return res;
}
int main(){
  cin>>N;
  rep(i,N) cin>>t[i];
  rep(i,N) cin>>v[i];  
  printf("%.4f\n",solve());
  return 0;
}


Measured memory_bytes: 256
def main():
    N, M = map(int, input().split())
    a = set()
    for _ in range(M):
        a.add(int(input()))

    mod = pow(10, 9) + 7
    dp = [0 for _ in range(N+1)]
    dp[0] = 1
    for i in range(1, N+1):
        if i in a:
            dp[i] = 0
        else:
            if i == 1:
                dp[i] = dp[i-1]
            else:
                dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod
    return dp[N]

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 11884
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        /*var nabc = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var ls = new int[nabc[0]];
        for (var i = 0; i < nabc[0]; i++)
            ls[i] = ToInt32(ReadLine());*/
        var str = Array.ConvertAll(ReadLine().Split('/'), int.Parse);
        var h = "Heisei";
        var t = "TBD";
        if (str[0] < 2019)
            WriteLine(h);
        else if (str[0] > 2019)
            WriteLine(t);
        else if (str[1] <= 4)
            WriteLine(h);
        else
            WriteLine(t);
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int f[1002];
int main()
{
	int n;cin>>n;
	for(int i=0;i<=6;i++){
		f[i]=pow(2,i);
	}
	for(int i=6;i>=0;i-=1){
		if(f[i]<=n){
			cout<<f[i]<<"\n";return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 384
#include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin>>n;
    n%=10;
    if(n==3) cout<<"bon\n";
    else if(n==0||n==1||n==6||n==8) cout<<"pon\n";
    else cout<<"hon\n";
    return 0;
}


Measured memory_bytes: 3640
from collections import deque

H,W=map(int,input().split())

array_st=list(map(int,input().split()))
array_gl=list(map(int,input().split()))
start_point=[]
goal_point=[]
for i in range(2):
    start_point.append(array_st[i]-1)
    goal_point.append(array_gl[i]-1)

matrix=[]
for i in range(H):
    matrix.append(list(input()))

d=deque()
d.append([start_point[0],start_point[1],0])

road=[-1,1]

ans=-1
while d:
    v=d.popleft()
    if matrix[v[0]][v[1]]=="x":
        continue
    matrix[v[0]][v[1]]="x"
    if [v[0],v[1]]==goal_point:
        ans=v[2]
        break
    for i in road:
        if v[0]+i>=0 and v[0]+i<H:
            if matrix[v[0]+i][v[1]]==".":
                d.appendleft([v[0]+i,v[1],v[2]])
        if v[1]+i>=0 and v[1]+i<W:
            if matrix[v[0]][v[1]+i]==".":
                d.appendleft([v[0],v[1]+i,v[2]])

    for i in range(-2,3):
        for j in range(-2,3):
            if v[0]+i>=0 and v[0]+i<H:
                if v[1]+j>=0 and v[1]+j<W:
                    if matrix[v[0]+i][v[1]+j]==".":
                        d.append([v[0]+i,v[1]+j,v[2]+1])

print(ans)

Measured memory_bytes: 228592
N = int(input())
As = list(map(int, input().split()))
rs = []
n = max(range(N), key=lambda i: abs(As[i]))
for i in range(N):
  rs.append((n, i))
if As[n] > 0:
  for i in range(1, N):
      rs.append((i-1, i))
if As[n] < 0:
  for i in reversed(range(1, N)):
      rs.append((i, i-1))
#print(rs)
print(len(rs))
for x, y in rs:
  print(x+1, y+1)


Measured memory_bytes: 3064
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	long long int num=1;
	long long int att=0;
	long long int h;
	scanf("%lld",&h);
	while(h>1){
		att+=num;
		num*=2;
		h=h/2;
	}
	att+=num;
	printf("%lld",att);
}

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

using namespace std;

int main() {
  long N; cin>>N;
  vector<long> A(N);
  for (long i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<long> X(N);

  vector<long> tmp(N);
  for (long i = 0; i < N; i += 2) {
    if (i != N-1) {
      tmp[i] = 2*(A[i] - A[i+1]);
    } else {
      tmp[i] = 2*(A[i] - A[0]);
    }
  }

  long x2_x0 = -tmp[0];
  for (long i = 2; i < N; i += 2) {
    x2_x0 -= tmp[i];
  }
  long x1_x0 = x2_x0;
  long x0plusx1 = A[0]*2;
  long x0 = (x0plusx1 - x1_x0) / 2;
  X[0] = x0;

  for (long i = 1; i < N; i++) {
    X[i] = 2*A[i-1] - X[i-1];
  }

  for (long i = 0; i < N-1; i++) {
    cout << X[i] << " ";
  }
  cout << X[N-1] << endl;

  return 0;
}


Measured memory_bytes: 3712
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner scan = new Scanner(System.in);
    int H = scan.nextInt();
    int N = scan.nextInt();
    int A = 0;
    String result = "Yes";
    for(int i=1; i<=N; i++){
    	A = scan.nextInt();
    	H = H-A;
    }
    if(H>0) {
    	result = "No";
    }
    System.out.println(result);
  }
}

Measured memory_bytes: 47452
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    string S,T;cin>>S>>T;
    int A,B;cin>>A>>B;
    string U;cin>>U;
    if(U==S){
        cout<<A-1<<" "<<B<<endl;
        return 0;
    }
    else{
        cout<<A<<" "<<B-1<<endl;
        return 0;
    }
}

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

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

  string ans = s.at(0) + to_string(s.size() - 2) + s.at(s.size() - 1);
  cout << ans << endl;
  return 0;
}

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

#define DAY 86400
#define EPS 1e-8

int u[DAY], N, ft,L;

double calc()
{
	double f,hi=1e6, lo=0,pv=0,d1;
	for(;;)
	{
		f=(hi+lo)/2;
		bool g=true;
		double v=L;
		for(int i=0; i<DAY*2; i++)
		{
			v+=(f-1.0*u[i%DAY]);
			
			if(v>=L) v=L;
			if(v < 0)
			{
				g=false;
				lo=f;
				break;
			}
			if(i==DAY-1) d1=v;
		}
		
		if(g&&fabs(d1-v)<EPS)
		{
			if(fabs(f-pv) < EPS) break;
			pv=f;
			hi=f;
		}
		else lo=f;
	}

	return f;
}

int main()
{
	while(scanf("%d%d", &N, &L), (N||L))
	{
		memset(u,0,sizeof(u));
		for(int i=0; i<N; i++)
		{
			int s,t,f;
			scanf("%d%d%d", &s,&t,&f);
			for(int j=s; j<t; j++)
				u[j]=f;
		}
		printf("%.8lf\n", calc());
	}
}

Measured memory_bytes: 1128
#include <iostream>
#include <string>
using namespace std;
 
int main() {
	string s, ans;
	cin >> s;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == '0'){
			ans += '0';
		}else if(s[i] == '1'){
			ans += '1';
		}else if(s[i] == 'B' && ans.size() != 0){
			ans.erase(--ans.end());
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	float max, min;
	float h;
	int i;
	
	i = 0;
	
	while (scanf("%f", &h) != EOF){
		if (i == 0){
			max = min = h;
			i++;
		}
		if (max < h){
			 max = h;
		}
		else if (min > h){
			min = h;
		}
	}
	printf("%f\n", max - min);
	
	return (0);
}

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

using namespace std;

int main ()
{
  int N,W[100];
  int sum=0,sub,res;

  cin >> N;

  for (int i=0; i<N; i++)
    {
      scanf("%d", &W[i]);
      sum += W[i];
    }
  
  res = sum;
  sub = 0;
  for (int i=0; i<N; i++)
    {
      sub += W[i];            
      res = min (res, abs(sum-sub*2));
    }

  cout << res << endl;
  return 0; 
}

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

public class AtCoder_Pana_C
{
    public static void Main()
    {
        long[] line1 = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        long a = line1[0];
        long b = line1[1];
        long c = line1[2];

        if (c <= a + b)
        {
            Console.WriteLine("No");
        }
        else
        {
            if (4 * a * b < (c - a - b) * (c - a - b))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 13268
import java.util.*;
public class Main {
	public static void main(String[] args){
     	String chri = "Christmas";	
      	String chriE = "Christmas Eve";
        String chriEE = "Christmas Eve Eve";
      	String chriEEE = "Christmas Eve Eve Eve";
		Scanner sc = new Scanner(System.in);
		int d = sc.nextInt();
		if(d == 25){
          	System.out.println(chri);
        }else if(d == 24){
          	System.out.println(chriE);
        }else if(d == 23){
        	System.out.println(chriEE);
        }else{
        	System.out.println(chriEEE);
        }
	}
}


Measured memory_bytes: 21460