akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		double a = Math.sqrt(X);
		long max=1;
		for(int b =2;b<=X;b++) {
			for(int q =2;Math.pow(b, q)<=X;q++) {
					max=Math.max((int)Math.pow(b, q),max);
			}
		}
		System.out.println(max);
		sc.close();
	}
}


Measured memory_bytes: 21844
import java.util.Scanner;
import java.util.ArrayList;
public class Main {
	public static void main (String [] args){
		Scanner s = new Scanner (System.in);
		String inter = s.nextLine().trim();
		String [] interArr = inter.split(" ");
		int H = Integer.parseInt(interArr[0]);
		int W = Integer.parseInt(interArr[1]);
		ArrayList <String> strings = new ArrayList <String>();
		for (int i = 0; i < H; i++){
			strings.add(s.nextLine());
		}
		char [][] matrix = new char [H][W];
		for (int x = 0; x < H; x++){
			for (int y = 0; y < W; y++){
				matrix[x][y] = strings.get(x).charAt(y);
			}
		}
		String [][] matrixOut = new String[H][W];
		for (int x = 0; x < H; x++){
			for (int y = 0; y < W; y++){
				int counter = 0;
				if (matrix[x][y] == '.'){
					if (x - 1 >= 0){
						if (matrix [x-1][y] == '#') counter++;
					}
					if (y - 1 >= 0){
						if (matrix [x][y-1] == '#') counter++;
					}
					if (x -1 >= 0 && y - 1 >= 0){
						if (matrix [x-1][y-1] == '#') counter++;
					}
					if (x + 1 < H){
						if (matrix [x+1][y] == '#') counter++;
					}
					if (y + 1 < W){
						if (matrix [x][y + 1] == '#') counter++;
					}
					if (x + 1 < H && y + 1 < W){
						if (matrix [x+1][y+1] == '#') counter++;
					}
					if (x + 1 < H && y - 1 >= 0){
						if (matrix [x+1][y-1] == '#') counter++;
					}
					if (y + 1 < W && x - 1 >= 0){
						if (matrix [x-1][y+1] == '#') counter++;
					}
					matrixOut[x][y] = Integer.toString(counter);
				} else {
					matrixOut[x][y] = Character.toString(matrix[x][y]);
				}
			}
		}
		// print matrix
		for (int x = 0; x < H; x ++){
			String out = "";
			for (int y = 0; y < W; y ++){
				out += (matrixOut[x][y]);
			}
			System.out.println(out);
		}
		
	}
	
}

Measured memory_bytes: 26836
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include<ext/rope>
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> P;
#define X real()
#define Y imag()
ld restant(P p){return abs(p);}
//polar(x,y) mag=l,arg=y
//typedef unordered_set<ll> usll;
//typedef unordered_multiset<ll> umsll;
typedef multiset<ll> msll;
typedef set<ll> sll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pair<ll,ll> > vpll;
typedef priority_queue<ll> pqll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
//typedef unordered_multiset<int> umsi;
//typedef unordered_set<int> usi;
typedef pair<int,int> pi;
typedef vector<pair<int,int> > vpi;
typedef vector<pair<double,double> > vpd;
typedef pair<double,double> pd;
typedef priority_queue<int> pqi;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ind_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ind_setll;
#define in insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define be begin
#define en end
#define itr iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mo 1000000007
#define inf 1000000000000000001
#define ninf -1000000000000000001
#define ima INT_MAX
#define imi INT_MIN
#define oncnt __builtin_popcount
#define zerobegin __builtin_clz
#define zeroend __builtin_ctz
#define parity __builtin_parity
#define all(x) x.be(),x.en()
#define eps 1e-9
const ld pii=3.14159265359;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return((a-b+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}



int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{	
int a[3][3];

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

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

bool f=false;


for(int i=0;i<3;i++)
{
	int c=0;
	for(int j=0;j<3;j++)
	{
		if(a[i][j]==0)
		c++;
	}
	if(c==3)
	{f=true;
	break;
	}
}

if(!f)
{
	for(int i=0;i<3;i++){
		int c=0;
	for(int j=0;j<3;j++)
	{
		if(a[j][i]==0)
		c++;
	}
	if(c==3)
	{f=true;
	break;
	}
}
}


if(!f)
{int c=0;
	for(int i=0;i<3;i++)
	{
		if(a[i][i]==0)
		c++;
	}
	if(c==3)
	{
		f=true;
	
	}
}

if(!f)
{
	if(a[0][2]==0&&a[1][1]==0&&a[2][0]==0)
	{
		f=true;
	}
}



if(f==true)
cout<<"Yes";
else
cout<<"No";

}return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define ll long long int

using namespace std;

int main()
{
  int n, k;
  cin >> n >> k;
  if ((n + 1) / 2 >= k)
  {
    cout << "YES" << endl;
  }
  else
  {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var n = o.a();
  var a = o.a();
  var b = o.a();
  return (b-a) % 2 ? "Borys" : "Alice";
}

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

namespace abc67
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] str = Console.ReadLine().Split(' ');
            int[] a = new int[N];
            long arai = 0;
            long sunuke = 0;
            for (int i = 0; i < N; i++)
            {
                a[i] = int.Parse(str[i]);
                arai += a[i];
            }
            arai -= a[0];
            sunuke = a[0];
            long ans = Math.Abs(arai - sunuke);
            for(int i = 1; i < N-1; i++)
            {
                arai -= a[i];
                sunuke += a[i];
                ans = Math.Min(ans, Math.Abs(arai - sunuke));
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 31196
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();

        while (true) {
            String data[] = reader.readLine().split(" ");
            int a = Integer.parseInt(data[0]);
            int b = Integer.parseInt(data[1]);
            if(a == 0 && b == 0) break;
            
            
            sb.append(Integer.toString(a < b ? a : b )).append(" ").append(Integer.toString( a < b ? b :a)).append("\n");

        }
        
        System.out.print(sb);

    }
}

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

int main() {
  long long a, v, b, w, t;

  cin >> a >> v;
  cin >> b >> w;
  cin >> t;

  long long d = abs(a-b);
  long long dd = (v-w)*t;

  if (d <= dd) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 3636
def fact(c)
    ret=1
    for i in 2..c do
        ret*=i
    end
    return ret
end

a,b,r=gets.split.map(&:to_i)
r=r-a*b
m=0
if r<0 then
    puts "0"
else
    p fact(a+r-1)/fact(r)/fact(a-1)
end

Measured memory_bytes: 82348
def search(y,x):
    if 0<=y<=h-1 and 0<=x<=w-1:
        if s[y][x]=="#":
            return 1
        else:
            return 0
    else:
        return 0
h,w = map(int,input().split())
s = [list(input()) for i in range(h)]
m = [[-1]*w for i in range(h)]
for y in range(h):
    for x in range(w):
        si = s[y][x]
        n = 0
        n+=search(y+1,x)
        n+=search(y+1,x+1)
        n+=search(y+1,x-1)
        n+=search(y-1,x-1)
        n+=search(y-1,x)
        n+=search(y-1,x+1)
        n+=search(y,x-1)
        n+=search(y,x+1)
        
        m[y][x]=n
for y in range(h):
    for x in range(w):
        si = s[y][x]
        if si=="#":
            m[y][x]="#"
for mi in m:
    print("".join([str(i) for i in mi]))

Measured memory_bytes: 3064
using System;

class Problem
{
    public static void Main()
    {
        char[] a = { 'A', 'T', 'C', 'G' };
        char[] b = { 'T', 'A', 'G', 'C' };
        string s = Console.ReadLine();
        for(int i=0; i < 4; i++)
        {
            if (s[0] == a[i])
            {
                Console.Write(b[i]);
            }
        }
    }
    
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std ; 
int a[2][120] ;
int main()
{
	int n , ans=0 ; 
	cin >> n ; 
	for(int i=1 ; i<=n ; i++)	
		cin >> a[0][i] ; 
	for(int i=1 ; i<=n ; i++)
		cin >> a[1][i] ;
	for(int x=1 ; x<=n ; x++)
	{
		int res=0; 
		for(int i=1 ; i<=n ; i++)
		{
			if(i >= x)
				res += a[1][i] ; 
			if(i <= x)
				res += a[0][i] ; 
		}
		ans = max(ans , res) ; 
	}
	cout << ans << endl ; 
}

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

struct Node{
	long key;
	Node *parent, *left, *right;
};

Node *root, *NIL;

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

	z = new 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) return;
	inorder(u->left);
	cout << " " << u->key;
	inorder(u->right);
}

void preorder(Node *u){
	if (u == NIL) return;
	cout << " " << u->key;
	preorder(u->left);
	preorder(u->right);
}

int main(){
	long n, x;
	string com;
	cin >> n;
	for (long i = 0; i < n; i++){
		cin >> com;
		if (com == "insert"){
			cin >> x;
			insert(x);
		}
		else if (com == "print"){
			inorder(root);
			cout << endl;
			preorder(root);
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 24648
import java.util.*;
public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    
    int h = sc.nextInt();
    int n = sc.nextInt();
        
    int sum = 0;
    String ans;
    
    for(int i=0; i<n; i++){
      sum += sc.nextInt();
    }
    
    if(sum >= h){
      ans = "Yes";
    } else {
      ans = "No";
    }
    
    System.out.println(ans);
  }
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

int main(){
	cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
	ll n, d;cin >> n >> d;
	d = 2 * d + 1;
	cout << (n + d - 1) / d << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=100003,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int M;cin>>M;
    while(M--){
        string S;cin>>S;
        set<string> SE;
        
        for(int i=1;i<S.size();i++){
            string left=S.substr(0,i),right=S.substr(i,S.size()-i);
            SE.insert(left+right);
            reverse(all(right));
            SE.insert(left+right);
            reverse(all(left));
            SE.insert(left+right);
            reverse(all(right));
            SE.insert(left+right);
            reverse(all(left));
            
            swap(left,right);
            
            SE.insert(left+right);
            reverse(all(right));
            SE.insert(left+right);
            reverse(all(left));
            SE.insert(left+right);
            reverse(all(right));
            SE.insert(left+right);
            reverse(all(left));
        }
        
        cout<<SE.size()<<endl;
    }
    
}



Measured memory_bytes: 3308
//AT3859
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define fst first
#define scd second
using namespace std;
inline ll read() {
	ll f=1,x=0;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
const int MOD=998244353;
map<string,int> f,g;
int F(string s);
int G(string s) {
	if(g.find(s)!=g.end()) return g[s];
	if(s.length()==1) return (g[s]=(s[0]=='0'?1:2));
	for(int i=1;i<(int)s.length();++i) {
		if((int)s.length()%i) continue;
		string t="";
		for(int j=0;j<i;++j) {
			bool x=1;
			for(int k=0;k<(int)s.length()/i;++k) {
				x&=(s[i*k+j]-'0');
			}
			t+=(char)(x+'0');
		}
		g[s]=(g[s]+F(t))%MOD;
	}
	return g[s];
}
int F(string s) {
	if(f.find(s)!=f.end()) return f[s];
	for(int i=1;i<=(int)s.length();++i) {
		f[s]=((ll)f[s]+(ll)G(s.substr(0,i))*F(s.substr(i,s.length()-i))%MOD)%MOD;
	}
	return f[s];
}
int main() {
//	freopen("","r",stdin);
//	freopen("","w",stdout);
	ios::sync_with_stdio(0);cin.tie(0);/*syn加速*/
	string S;
	cin>>S;
	f[""]=1;
	cout<<F(S)<<endl;
	return 0;
}

Measured memory_bytes: 12940
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>
//#include<bits/stdc++.h>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define REPR(i,s,n) for(int i=(s);i>=(n);--(i))
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
const ll mod = 1e9 + 7;
ll dx[4] = { 1,0,-1,0 };
ll dy[4] = { 0,1,0,-1 };

ll gcd(ll x, ll y)
{
	ll r;

	if (x == 0 || y == 0)  // 引数チェック
	{
		fprintf(stderr, "引数エラーです。\n");
		return 0;
	}

	// ユーグリッドの互除法
	while ((r = x % y) != 0)  // yで割り切れるまでループ
	{
		x = y;
		y = r;
	}
	return y;
}

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

	ll n, p = M, ans = 0;
	cin >> n;
	vll v(n);
	rep(i, n) cin >> v[i];
	bool high = false, low = false;
	REP(i, 0, n) {
		//cout << p << " " << v[i] << endl;
		if (!high && !low) {
			//ok1
			if (p == M) {
				ans++;
				p = v[i];
			}
			else if (v[i] > p) {
				high = true;
				p = v[i];
			}
			else if(v[i] < p){
				low = true;
				p = v[i];
			}
			else {
				low = high = true;
				p = v[i];
			}
		}
		else if (v[i] >= p && high) {
			p = v[i];
			low = false;
		}
		else if (v[i] <= p && low) {
			p = v[i];
			high = false;
		}
		else {
			high = low = false;
			p = v[i];
			ans++;
		}
		//cout << ans << endl;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <vector>
#include <bitset>
#include <stack>
#include <queue>
#include <set>
#include <map>
 
using namespace std;

typedef long long ll;

const int MAXN = 305;
const ll MOD = 1000000007;

int n,ans;
int tp[MAXN << 1];
int match[MAXN << 1];
int f[MAXN << 1][MAXN][MAXN];

bool vis[MAXN << 1];

vector<int> v;

int main()
{
	scanf("%d",&n);
	int N = n,cnt = 0;
	for (int a,b,i = 1;i <= n;i++)
	{
		scanf("%d%d",&a,&b);
		if (~a && ~b)
		{
			vis[a] = vis[b] = 1;
			N--;
		}
		else if (a == -1 && b == -1)
			cnt++;
		else if (~a)
			v.push_back(a);
		else if (~b)
			v.push_back(b);
	}
	for (int i = 1;i <= 2 * n;i++)
		match[i] = match[i - 1] + !vis[i];
	for (int i = 0;i < v.size();i++)
		tp[match[v[i]]] = 1;
	f[2 * N + 1][0][0] = 1;
	for (int i = 2 * N + 1;i > 1;i--)
		for (int j = 0;j <= N;j++)
			for (int k = 0;k <= N;k++)
				if (f[i][j][k])
				{
					if (tp[i - 1])
					{
						(f[i - 1][j + 1][k] += f[i][j][k]) %= MOD;
						if (k)
							(f[i - 1][j][k - 1] += f[i][j][k]) %= MOD;
					}
					else
					{
						(f[i - 1][j][k + 1] += f[i][j][k]) %= MOD;
						if (j)
							(f[i - 1][j - 1][k] += (ll)f[i][j][k] * j % MOD) %= MOD;
						if (k)
							(f[i - 1][j][k - 1] += f[i][j][k]) %= MOD;
					}
				}
	int ans = f[1][0][0];
	while (cnt)
		ans = (ll)ans * (cnt--) % MOD;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 219008
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>
  
using namespace std;
  
double EPS = 1e-8;
  
double add(double a,double b){
  if(abs(a+b)<EPS*(abs(a)+abs(b)))return 0;
  return a+b;
}
  
struct point{
  double x,y;
  point() {}
  point(double x,double y):x(x),y(y){
  }
  point operator + (point p){
    return point(add(x,p.x),add(y,p.y));
  }
  point operator - (point p){
    return point(add(x,-p.x),add(y,-p.y));
  }
  point operator * (double d){
    return point(x*d,y*d);
  }
  point operator / (double d){
    return point(x/d,y/d);
  }
};
  
double dist(point a,point b){
    return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}

int main(void){
    int n,x,y,v;
    vector<point>P;
    vector<double>V;
     
    while(cin >> n,n){
        P.clear();
        V.clear();
         
        for(int i=0;i<n;i++){
            cin >> x >> y >> v;
            P.push_back(point(x,y));
            V.push_back(v);
        }
        
        double r=0.98;
        point now(0,0);
         
        for(double d=10;d>EPS;d*=r){
            int mx=0;
            double mxd=0;
             
            for(int j=0;j<P.size();j++)
                if(dist(now,P[j])/V[j]>mxd)
		  mx=j,mxd=dist(now,P[j])/V[j];
             
            now=now+((P[mx]-now)/dist(P[mx],now)*d);
        }
         
        double ans=0;
        for(int i=0;i<P.size();i++){
	  ans=max(ans,dist(now,P[i])/V[i]);
        }
        printf("%.8f\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1248
#include <bits/stdc++.h>
const long long MOD = 1000000007;
const long long INF = MOD + 1;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++)
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
using namespace std;
string s;
vector<ll> v;
vector<pair<ll, ll>> vp;
vector<vector<ll>> vv(110, vector<ll>(110, INF));
vector<tuple<ll, ll, ll>> vt;
set<ll> st;
map<char, ll> mp;

int main()
{
	int n;
	while (cin >> n)
	{
		if (!n) break;
		int dp[70000];
		REP(i, 70000) dp[i] = INF;
		int cost[20][20];
		REP(i, n) REP(j, n + 1) cin >> cost[i][j];
		dp[0] = 0;
		REP(i, n) dp[1 << i] = cost[i][0];
		int m = 1 << n;
		FOR(i, 1, m)
		{
			queue<int> q;
			auto f = [i](int num) {if (((i >> num) & 1)) return true; else return false; };
			REP(j, n) {
				if (!((i >> j) & 1)) q.push(j);
			}
			while (!q.empty())
			{
				int j = q.front();
				q.pop();
				int mini = INF;
				REP(k, n + 1) {
					if (!k) mini = min(mini, cost[j][k]);
					else if(f(k-1)) mini = min(mini, cost[j][k]);
				}
				dp[i + (1 << j)] = min(dp[i + (1 << j)], dp[i] + mini);
			}
		}
		cout << dp[(1 << n) - 1] << endl;
	}
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    ll n, m;
    cin >> n >> m;

    ll sum = 0;
    sum += min(n, m / 2);
    if (m - sum * 2 > 0) {
        sum += (m - sum * 2) / 4;
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++i)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
bool f(string s){
  bool ans=true;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()/2+i]){
      ans=false;
      break;
    }
  }
  return ans;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int K,X;
  cin>>K>>X;
  if(K!=1&&X!=1)
    cout<<1<<endl;
  else if(K!=2&&X!=2)
    cout<<2<<endl;
  else
    cout<<3<<endl;



}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    char s;
    cin >> s;
    switch (s) {
        case 'A':
            cout << 'T';
            break;
        case 'T':
            cout << 'A';
            break;
        case 'G':
            cout << 'C';
            break;
        case 'C':
            cout << 'G';
            break;
        default:
            break;
    }
}

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

class Main {

	void solve() {
		
		int k = inint(), s = inint();
		int count = 0;
		
		for (int x=0; x<=k; x++) {
			for (int y=0; y<=k; y++) {
				int z = s - x - y;
				if ((0 <= z && z <= k) && x + y + z == s) count++;
			}
		}
		
		out.println(count);

	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

	public int inint() {
		return in.nextInt();
	}

	public long inlong() {
		return in.nextLong();
	}

	public String instr() {
		return in.next();
	}

	public char inchar() {
		return in.next().charAt(0);
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

#if defined(DEBUG)

#include <unistd.h>
#include <sys/fcntl.h>
#define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
#define DCALL(func, ...) func(__VA_ARGS__)

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#else  // defined(DEBUG)

#define DLOG(...)
#define DCALL(func, ...)

#endif // defined(DEBUG)
// ----------------------------------------------------------------------

// ----------------------------------------------------------------------
int main(int argc, char *argv[]) {
#if defined(DEBUG)
  // GDB on Cygwin ignores redirection at run command.
  if (argc == 2) dup2(open(argv[1], 0), 0);
#else
  // For performance.  We should not use C-style stdio functions
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#endif
  cout << setprecision(20);

  string S;
  cin >> S;

  bool judge = true;
  for (size_t i = 0; i < S.size(); i++) {
    if (i % 2 == 1) {
      if (S.at(i) == 'R') {
	judge = false;
	break;
      }
    }else {
      if (S.at(i) == 'L') {
	judge = false;
	break;
      }
    }
  }
  cout << (judge ? "Yes" : "No") << endl;

  return 0;
}



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

int main()
{
  int n;
  cin>>n;
  
  vector<int>a(n+1);
  for(int i=0;i<=n;i++)cin>>a[i];
  
  sort(a.begin(),a.end());
  int ans=0;
  for(int i=1;i<=n;i++)
  {
    ans=__gcd(ans,(a[i]-a[i-1]));
  }
  cout<<ans<<endl;
  return 0;
}
  

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

using namespace std;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define fo(i, n) for(int i = 1; i <= n; ++i)

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

const int N = 200200;
const int mod = 1e9 + 7;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	ll q,h,s,d;
	ll n;
	cin >> q >> h >> s >> d;
	cin >> n;
	ll quadro = q;
	ll half = min(h, quadro * 2);
	ll one = min(s, half * 2);
	ll two = min(d, one * 2);
	cout << n / 2 * two + (n % 2) * one;			
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
using namespace std;
int main(){
    int K,S;
    cin >> K >> S;
    
    int cnt=0;
    int X,Y,Z;
    for(X=0;X<=K;X++){
        for(Y=0;Y<=K;Y++){
            Z = S-X-Y;
            if(X+Y+Z==S && Z<=K && Z>=0){
                cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 764
using System;

namespace ABC048B
{
    class Program
    {
        static void Main(string[] args)
        {
            var target = Console.ReadLine().Split(' ');
            long a = long.Parse(target[0]);
            long b = long.Parse(target[1]);
            long x = long.Parse(target[2]);
            long a1 = a / x;
            long b1 = b / x;
            if(a % x == 0) b1++;
            Console.WriteLine(b1 - a1);
        }
    }
}


Measured memory_bytes: 13140
#include <stdio.h>
#include <limits.h>

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

int n;
struct
{
    int m;
    int a, b;
} p[128];
int stack[128];

int check(int start, int m, int a, int b)
{
    int i;
    int maxi = m;

    for (i = start; i < n; i++){
        if ((a <= p[i].a && p[i].a < b) || (a < p[i].b && p[i].b <= b)){
            int tmp;

            if (m + p[i].m > 150) return m + p[i].m;
            tmp = check(i + 1, m + p[i].m, max(a, p[i].a), min(b, p[i].b));
            if (maxi < tmp) maxi = tmp;
        }
        else if ((p[i].a <= a && a < p[i].b) || (p[i].a < b && b <= p[i].b)){
            int tmp;

            if (m + p[i].m > 150) return m + p[i].m;
            tmp = check(i + 1, m + p[i].m, max(a, p[i].a), min(b, p[i].b));
            if (maxi < tmp) maxi = tmp;
        }
    }

    return maxi;
}

int main(void)
{
    while (scanf("%d", &n), n){
        int i;

        for (i = 0; i < n; i++) scanf("%d %d %d", &p[i].m, &p[i].a, &p[i].b);
        puts(check(0, 0, 0, INT_MAX) > 150 ? "NG" : "OK");
    }

    return 0;
}

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

class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		boolean[][] ok = new boolean[4][1000];
		ok[0][0] = true;
		int N = sc.nextInt();
		char[] s = sc.next().toCharArray();
		for (int i = 0; i < N; ++i) {
			int v = (int) (s[i] - '0');
			for (int len = 2; len >= 0; --len) {
				for (int pre = 0; pre < 1000; ++pre) {
					if (pre * 10 + v < 1000)
						ok[len + 1][pre * 10 + v] |= ok[len][pre];
				}
			}
		}
		int ans = 0;
		for (int i = 0; i < ok[3].length; ++i)
			if (ok[3][i])
				++ans;
		System.out.println(ans);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


Measured memory_bytes: 24276
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (i = 0; i < n; ++i) 
#define REP(i,k,n) for (i = k; i <= n; ++i) 
#define REPR(i,k,n) for (i = k; i >= n; --i)
 
 
using namespace std;
 ll s = 100005;
vector<ll> SOE(int n) 
{ 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
   
        if (prime[p] == true) 
        {   
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
	vector<ll> ans;
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          ans.push_back(p);
          
          return ans; 
} 
 
 
int main()
    {
		ll t;
		t=1;
		//scanf("%lld",&t);
		while(t--)
		{
			ll c;
			cin>>c;
			vector<ll> a;
			a = SOE(s);
			for(ll i=0;i<a.size();i++)
				if(c<=a[i])
				{
					cout<<a[i]<<endl;
					break;
				}
			
		}
	
	return 0;
	}
 



Measured memory_bytes: 512
import java.util.Scanner;

class Main{
  public static void main(String args[]){
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int c = scan.nextInt();

    int x;

    if(a>b){
      x=a; a=b; b=x;
    }
    if(b>c){
      x=b; b=c; c=x;
    }
    if(a>b){
      x=a; a=b; b=x;
    }

    System.out.println(a+" "+b+" "+c);

  }
}



Measured memory_bytes: 26056
#include<bits/stdc++.h>
#define pb push_back
#define ef(i,u) for(int i=b[u];i;i=nxt[i])
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define per(i,b,a) for(int i=b;i>=a;--i)
#define gcd(a,b) __gcd(a,b)
#define MEM(a,x) memset(a,x,sizeof(a))
#define VI vector<int>
#define PII pair<int,int>
#define ull unsigned long long
#define ll long long
#define fi first
#define se second
#define INF 0x3f3f3f3f
using namespace std;
const int N=2e5+5;
const double PI=asin(1)*2;
template<class T>inline void read(T &res)
{
char c;T flag=1;
while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}
int r;
int main(){
    cin>>r;
    cout<<2*PI*r<<'\n';
	return 0;
}


Measured memory_bytes: 3808
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("no-stack-protector")
//#pragma GCC push_options
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC pop_options
//#pragma GCC target("popcnt")
//#pragma GCC target("sse4")
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rng(a) a.begin(),a.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i > -1; i--)
#define rer(i, x, n) for (int i = x; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef long double ld;















signed main(){
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    for (int i = 0; i < n; i++) cin >> p[i];
    set<int> ff;
    int ans = 1;
    for (int i = 0; i < k; i++) ff.insert(p[i]);
    int dp[n];
    dp[n - 1] = 1;
    for (int i = n - 2; i >= 0; i--){
        if (p[i] < p[i + 1]) dp[i] = dp[i + 1] + 1;
        else dp[i] = 1;
    }
    int kk = 0;
    for (int i = 0; i < n; i++){
        if (dp[i] == k) kk++;
    }
    ans -= max(0,(kk - 1));
    for (int i = k; i < n; i++){
        int r = p[i - k];
        ff.erase(r);
        int maxx = *(ff.rbegin());
        int minx = *(ff.begin());
        int e = p[i];
        if (!(r < minx && e > maxx)){
                ans++;
        }
        ff.insert(e);
    }
    cout << ans;


}


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

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C, long long D){
    rep(i,100){
        C = C -B;
        A = A - D;
        if(C < 1){
            cout << "Yes" << endl;
            return;
        }if(A < 1){
            cout << "No" << endl;
            return;
        }

    }

}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long D;
    scanf("%lld",&D);
    solve(A, B, C, D);
    return 0;
}


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

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

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

/*** MOD CALCULATION ***/

const int MOD = 1e9+7;
const int MAX = 100100;

ll addM(ll a, ll b){
	return (a + b) % MOD;
}

ll mulM(ll a, ll b){
	return ((a%MOD) * (b%MOD)) % MOD;
}

ll powM(ll a, ll b){
	if(b == 0) return 1;
	else if(b == 1) return a%MOD;
	else if(b%2==0) return mulM(powM(a,b/2),powM(a,b/2));
	else return mulM(a,mulM(powM(a,(b-1)/2),powM(a,(b-1)/2)));
}

// b^{-1} = b^{p-2} (mod p)
// a/b = a*b^{p-2} (mod p)
ll divM(ll a, ll b){ 
	return mulM(a,powM(b,MOD-2));
}

// n!, (n!)^{-1} のテーブル作成
ll fac[MAX], finv[MAX], inv[MAX];
void COMBinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	rep3(i,2,MAX-1){
		fac[i] = fac[i-1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i-1] * inv[i] % MOD;
	}
}

// 二項係数計算
ll COMB(int n, int k){
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

/*** MOD CALCULATION ここまで ***/

void Main()
{
	int n, m;
	cin >> n >> m;
	if(abs(n-m) > 1) {
		cout << 0 << endl;
		return;
	}
	COMBinit();
	ll ans = mulM(fac[n], fac[m]);
	// n == m -> 2 * n! * m!
  	if(n == m){
		ans = mulM(ans, 2);
	}
	cout << ans << endl;
	return;
}

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

Measured memory_bytes: 2560
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

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

int main() {
  ll N, C;

  cin >> N >> C;

  vector<ll> x(N);
  vector<ll> v(N);
  vector<ll> fsum(N + 1);
  vector<ll> bsum(N + 1);
  vector<ll> fopt(N + 1);
  vector<ll> bopt(N + 1);

  for (ll i = 0; i < N; i++) {
    cin >> x[i] >> v[i];
  }

  for (ll i = 1; i <= N; i++) {
    fsum[i] = fsum[i - 1] + v[i - 1];
    fopt[i] = max(fsum[i] - x[i - 1], fopt[i - 1]);
    bsum[i] = bsum[i - 1] + v[N - i];
    bopt[i] = max(bsum[i] - (C - x[N - i]), bopt[i - 1]);
  }

  ll ans = 0;
  ans = max(ans, fopt[N]);
  ans = max(ans, bopt[N]);
  for (ll i = 1; i < N; i++) {
    ans = max(ans, fopt[i]);
    ans = max(ans, bopt[i]);
    ans = max(ans, fopt[i] - x[i - 1] + bopt[N - i]);
    ans = max(ans, bopt[i] - (C - x[N - i]) + fopt[N - i]);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int p[N];
    for(int i=0;i<N;i++){
        cin >> p[i];
    }
    int ans = 0;
    for(int i=1;i+1<N;i++){
        int a,b,c;
        a = p[i-1];
        b = p[i];
        c = p[i+1];
        if((a < b && b < c) || (a > b && b > c)){
            ans++;
        }
    }
    cout << ans;
}


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

#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; ++i)
#define FORD(i, a, b) for (int i = (int)a; i >= (int)b; --i)
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define Debug(x) cerr << #x << " = " << x << '\n';
#define HERE cerr << "HERE\n\n";
#define X first
#define Y second
#define pb push_back
#define FASTER { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }

using namespace std;

typedef pair <int, int> ii;
typedef vector <int> vi;

int const Nmax = 1e5 + 5;
vi Adj[Nmax];
int distV[Nmax], distU[Nmax];
int LCA[Nmax][30];
int Ancestor[Nmax], H[Nmax];
int n;
int A, B;


void DFS(int u, int type){
    //Debug(u);
    REP(i, Adj[u].size()){
        int v = Adj[u][i];
        if (type == 1 && Ancestor[v] == 0){
            Ancestor[v] = u;
            H[v] = H[u] + 1;
            DFS(v, type);
        }
        if (type == 2 && distV[v] == 0){
            distV[v] = distV[u] + 1;
            DFS(v, type);
        }
        if (type == 3 && distU[v] == 0){
            distU[v] = distU[u] + 1;
            DFS(v, type);
        }
    }
}

void process(){
    FOR(i, 1, n) LCA[i][0] = Ancestor[i];
    for(int j = 1; (1 << j) <= n; ++j)
        FOR(i, 1, n) if (LCA[i][j-1] != 0){
            LCA[i][j] = LCA[LCA[i][j-1]][j-1];
        }
}

int findLCA(int u, int v){
    if (H[u] < H[v]) swap(u, v);

    int log = log2(H[u]);
    int u1=u, v1=v;

    FORD(i, log, 0)
        if (H[u] - (1 << i)>= H[v]) u = LCA[u][i];

    if (u == v) return u;

    FORD(i, log, 0) if (LCA[u][i] != 0 && LCA[u][i] != LCA[v][i]){
        u = LCA[u][i];
        v = LCA[v][i];
    }
    return Ancestor[u];
}


void Solve(){
    Ancestor[1] = -1; DFS(1, 1);
    distV[B] = 1; DFS(B, 2);
    distU[A] = 1; DFS(A, 3);
    process();
    int ans = 0;
    //FOR(i, 1, n) Debug(Ancestor[i]);
    FOR(i, 1, n){
        //Debug(i);
        int anc = findLCA(i, A);
        if (findLCA(i, A) == A && findLCA(B, A) == A) continue;
        if (distU[anc] < distV[anc]){
           // Debug(distU[anc]);
           // Debug(distV[anc]);
            ans = max(ans, distV[i] - 2);
        }
    }
    cout << ans;
}

void Enter(){
    cin >> n >> A >> B;
    FOR(i, 1, n-1){
        int u, v;
        cin >> u >> v;
        Adj[u].pb(v);
        Adj[v].pb(u);
    }
}

int main(){
    FASTER
//    freopen("x.INP", "r", stdin);
//    freopen("x.OUT", "w", stdout);
    Enter();
    Solve();
}


Measured memory_bytes: 25728
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto x = readln.chomp.to!double;
  int[int] a;
  auto x2 = sqrt(x).to!int + 1;
  a[1] = 1;
  foreach (i; 2..x2) {
    auto tmp = i ^^ 2;
    while (tmp <= x) {
      a[tmp] = 1;
      tmp *= i;
    }
  }

  sort(a.keys)[$-1].writeln;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;
using namespace std;


int main(){
	ll N; cin >> N;
    vector<string> S(N);
    set<string> st;
    REP(i,N){
      cin >> S[i];
      st.insert(S[i]);  
    }
    cout << st.size();
      
  	return 0;
}

Measured memory_bytes: 25108
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE FlexibleContexts #-}

import Data.Bits
import Data.List
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as BSL
import Data.IntMap.Strict (IntMap)
import qualified Data.IntMap.Strict as IMS
import Data.IntSet (IntSet)
import qualified Data.IntSet as IS
import qualified Data.Sequence as Seq
import Data.Sequence (Seq)
import qualified Data.Array.IArray as A
import qualified Data.Array.MArray.Safe as A
import qualified Data.Array.MArray as A
import Data.Array (Array)
import Data.Array.Unboxed (UArray)
import Data.Array.IArray (IArray)
import Data.Array.MArray.Safe (MArray)
import Data.Array.IO.Safe (IOArray, IOUArray)
import Data.Array.ST.Safe (STArray, STUArray, runSTArray, runSTUArray)
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import Control.Monad
import Control.Monad.ST
-- import Control.Monad.ST.Safe
import Control.Applicative
import Data.Maybe
import Data.Tuple
import Data.Ord
import Control.Monad.State.Strict
import Data.Int
import System.IO
import Data.Function
import Control.Monad.Primitive
import qualified Data.Vector.Primitive.Mutable as VPM
import qualified Data.Vector.Generic.Mutable as VGM
import Data.STRef
import Data.IORef

main = do
  getLine
  [as,bs,cs] <- replicateM 3 $ getLine
  print $ sum $ zipWith3 (\a b c -> length (nub [a,b,c]) - 1) as bs cs


Measured memory_bytes: 508
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
int n;
int l[100000];
int r[100000];
int goukei;
cin>>n;
for(int i=0;i<n;i++){
cin>>l[i]>>r[i];
}
for(int i=0;i<n;i++)
{
goukei+=r[i]-l[i]+1;
}
cout<<goukei<<endl;

}



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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    int A, B, K;
    cin >> A >> B >> K;

    rep(i, K) {
        if (i%2) {
            if (B%2) --B;
            A += B/2, B /= 2;
        } else {
            if (A%2) --A;
            B += A/2, A /= 2;
        }
    }
    cout << A << ' ' << B << endl;
    return 0;
}

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

using lint = int64_t;
#define bit(n) ((lint)1 << n);
const int INF = 1e9;
const lint LINF = 1e18;

const lint MOD = 1e9 + 7;
// const lint MOD = 998244353;

class IoSetup {
    public:
    IoSetup() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(12);
        cerr << fixed << setprecision(12);
    }
} iosetup;

struct UnionFind {
    int n;
    vector<int> pars, sizes;

    UnionFind(int n): pars(n), sizes(n) {
        for (int i = 0; i < n; i++) {pars[i] = i; sizes[i] = 1;}
    }
    int root(int i) {
        if (pars[i] == i) return i;
        else return pars[i] = root(pars[i]);
    }
    bool is_same(int i, int j) {
        return root(i) == root(j);
    }
    void unite(int i, int j) {
        sizes[root(i)] += sizes[root(j)];
        pars[root(j)] = root(i);
    }
};

int main() {
    int n;
    cin >> n;
    vector<int> x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }

    int ans = n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i != j) {
                UnionFind uf(n);
                uf.unite(i, j);
                int p = x[i] - x[j], q = y[i] - y[j];
                for (int k = 0; k < n; k++) {
                    for (int l = 0; l < n; l++) {
                        if (k != l and p == x[k] - x[l] and q == y[k] - y[l]) {
                            uf.unite(k, l);
                        }
                    }
                }

                set<int> nd;
                for (int k = 0; k < n; k++) {
                    nd.insert(uf.root(k));
                }
                ans = min(ans, (int)nd.size());
            }
        }
    }

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

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

using namespace std;

using LL = long long;
const int INF = (int)1e9 + 7;
const int NS = (int)50 + 4;
int N, M;
char arr[NS][NS];
int chk[NS][NS];
vector < vector < int > > way;
vector < int > now;
vector < pair < int, int > > pos;
int augchk[NS * NS], l[NS * NS], r[NS * NS], chkN;

void dfs(int x, int y){
    if(chk[x][y] || x < 1 || y < 1|| arr[x][y] == '#') return;
    chk[x][y] = 1;
    dfs(x - 1, y), dfs(x, y - 1);
}

int aug(int x){
    for(auto&i:way[x]){
        if(augchk[i] == chkN) continue;
        augchk[i] = chkN;
        if(r[i] == -1 || aug(r[i])){
            r[i] = x; l[x] = i;
            return 1;
        }
    }
    return 0;
}

int main(){
    scanf("%d %d", &N, &M);
//    N = M = 50;
    for(int i = 1; i <= N; ++i){
        scanf("%s", arr[i] + 1);
//        for(int j = 1; j <= M; ++j){
//            arr[i][j] = (i <= 2 ? 'o' : '.');
//        }
    }
    for(int I = N + M; I >= 2; --I){
        int i = 1, j = I - i;
        while(j >= 1){
            if(i <= N && j <= M && arr[i][j] != '#'){
                now.clear();
                memset(chk, 0, sizeof(chk));
                dfs(i, j);
                for(int k = N + M; k >= 2; --k){
                    int a = 1, b = k - 1;
                    while(b >= 1){
                        if(a <= N && b <= M && chk[a][b] && arr[a][b] == 'o'){
                            now.push_back((a - 1) * M + b);
                        }
                        ++a, --b;
                    }
                }
                way.push_back(now);
                pos.push_back(make_pair(i, j));
            }
            ++i, --j;
        }
    }
    memset(r, -1, sizeof(r));
    for(int i = 0; i < (int)way.size(); ++i){
        ++chkN;
        aug(i);
    }
    int ans = 0;
    for(int i = 0; i < (int)way.size(); ++i){
        if(l[i]){
            int x = (l[i] - 1) / M + 1, y = (l[i] - 1) % M + 1;
//            printf("%d %d %d %d\n", pos[i].first, pos[i].second, x, y);
            ans += -(x + y - pos[i].first - pos[i].second);
        }
    }
    printf("%d\n", ans);
    return 0;
}


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

int main(){

  char str[1024],ho[]="Hoshino";
  int n,i;
  char *a;

  scanf("%d\n",&n);
  for(i=0;i<n;i++)
    {
      fgets(str,sizeof(str),stdin);
      while((a=strstr(str,ho)) != NULL)
	{
	  a[6] = 'a';
	}
      printf("%s",str);
    }
  return 0;
}

Measured memory_bytes: 608
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,sum;
cin>>a>>b>>c;
sum=(a*100)+(b*10)+c;
if(sum%4==0){
    cout<<"YES"<<endl;
}
else{
    cout<<"NO"<<endl;
}
return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long int ll;

int cnt[5];

int main(){
	int n; cin >> n;
	for(int i=0;i<n;i++){
		string s; cin >> s;
	    if(s[0]=='M')cnt[0]++;
		if(s[0]=='A')cnt[1]++;
		if(s[0]=='R')cnt[2]++;
		if(s[0]=='C')cnt[3]++;
		if(s[0]=='H')cnt[4]++;
	}
	ll ans=0;
	for(int i=0;i<5;i++){
		for(int j=i+1;j<5;j++){
			for(int k=j+1;k<5;k++){
				ans+=(ll)cnt[i]*cnt[j]*cnt[k];
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<string>
#include<iomanip>

using namespace std;

int main(void){
    double ans = 0.0;
    const double BTC2JPY = 380000.0;
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        double x;
        string u;
        cin >> x >> u;
        if(u == "BTC") ans += BTC2JPY * x;
        else ans += x;
    }
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 256