akhauriyash/Code-Regression huggingface dataset:
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <stack>
#include <deque>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <time.h>
#include <cassert>
#include <fstream>
#include <stdio.h>
#include<unordered_map>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mapa make_pair
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template<typename T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<typename T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }
template<typename T>
void vdeb(std::vector<T> &da) {
	for (int i = 0;i < da.size();i++) {
		if (i == da.size() - 1) std::cout << da[i];
		else std::cout << da[i] << ' ';
	}
	std::cout << std::endl;
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
	for (int i = 0;i < da.size();i++) vdeb(da[i]);
	std::cout << std::endl;
}

using namespace std;

int main() {
	int n;
	cin >> n;
	string s; cin >> s;
	vector<bool> ju(3);
	rip(i, n, 0) {
		ju[s[i] - '1'] = true;
	}
	bool ok = false;
	if (ju[1]) {
		rip(i, n, 0) {
			if ((((n - 1) ^ i) | i) == n - 1) {
				if (s[i] == '1' | s[i] == '3') ok ^= true;
			}
		}
		if (ok) {
			cout << 1 << endl;
		}
		else {
			cout << 0 << endl;
		}
	}
	else {
		vector<int> da(n - 1);
		rip(i, n - 1, 0) da[i] = abs(s[i + 1] - s[i]);
		rip(i, n - 1, 0) {
			if ((((n - 2) ^ i) | i) == n - 2) {
				if (da[i] == 2) ok ^= true;
			}
		}
		if (ok) {
			cout << 2 << endl;
		}
		else {
			cout << 0 << endl;
		}
	}
}

Measured memory_bytes: 5252
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long M = sc.nextLong();
		sc.close();
		long ans = 0;
		if(N == 1 && M == 1) ans = 1;
		else if((N == 1)||( M == 1)) ans = (N * M) - 2;
		else ans = (N - 2) * (M - 2);
		System.out.println(ans);
	}
}


Measured memory_bytes: 21588
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define BUF_SIZE 40

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

int get_int2(int *a1, uint64_t *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %llu", a1, a2);
#else
#error
#endif
  return 0;
}

#define NUM_MAX 200000

int main(void) {
    uint64_t digit_sum = 0;
    uint64_t digit_cnt = 0;
    int num = get_int();
    int i;
    for(i = 0; i < num; i++) {
        int d; uint64_t c;
        get_int2(&d, &c);
        digit_cnt += c;
        digit_sum += (c*(uint64_t)d);
    }
    // change number such as one of the following 2 patterns:
    // 1. decrease the number of digit by 1
    // 2. decrease the sum of digitis by 9
    uint64_t ans = (digit_cnt-1) + (digit_sum-1)/9;
    printf("%llu\n", ans);
    return 0;
}

Measured memory_bytes: 128
<?php
// Here your code !
# $ans = ($a+$b)/($c-$d)
$n = intval(trim(fgets(STDIN)));
$a = explode(' ',trim(fgets(STDIN)));
sort($a);

$ans = 0.0;
$array = range(1, $n);
foreach ($array as $i) {
    $cd = @$a[$i] - @$a[$i-1];

    if ($i == $n-1) {
        $ab = intval($a[$n-3])+intval($a[$n-4]);
    } elseif ($i == $n-2) {
        $ab = intval($a[$n-1])+intval($a[$n-4]);
    } else {
        $ab = intval($a[$n-1])+intval($a[$n-2]);
    }
    $ans=max($ans, $ab/$cd);

}
echo $ans . "\n";

exit(0);

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

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

  int l[110];
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }

  int ans = 1;
  int counter = 0;
  for (int i = 0; i < n; i++) {
    counter += l[i];
    if (counter <= x) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main()
{
    int x, a, b;
    scanf("%d %d %d", &x, &a, &b);
    if (abs(a - x) < abs(b - x))
        printf("A\n");
    else
        printf("B\n");
    return 0;
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline
suuzi = int(input())
num = []
num = [int(i) for i in input().split()]

sa = sum(num)+1
for i in range(suuzi):
    left = sum(num[:i])
    right = sum(num[i:])
    temp_sa = abs(right - left)
    if temp_sa == 0:
        print(0)
        break;
    elif i == len(num):
        print(temp_sa)
        break;
    elif sa > temp_sa:
        sa = temp_sa
    else:
        print(sa)
        break;

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


int main(){
    ll a;
    cin >> a;

    cout <<(a+1)/2 << endl;




    return 0;

}


Measured memory_bytes: 256
//Ojas Kumar Dubey //
// el_freki //
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")

#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define v1 vector<int>
#define mapp map<int,int>
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int modulo=1000000007;
#define deb(x) cout << #x << "=" << x << endl
#define test int t;cin>>t;while(t--)
#define f(i,j,n) for(int i=j;i<n;i++)
#define r(i,j,n) for(int i=j-1;i>=n;i--)
#define min INT_MIN
#define maxx INT_MAX
#define all(container) container.begin() , container.end()
#define sz(container) (int)container.size()
#define pii pair <int , int>
#define pll pair <long long int , long long int>
#define setp(x) setprecision(x)
int power(int a,int n){
    a%=modulo;
    n%=modulo;
    int var=a,ans=1;
    while(n){
        if(n&1)
            ans=((ans%modulo)*(var%modulo))%modulo;
        var=((var%modulo)*(var%modulo))%modulo;
        n=n>>1;
    }
    return ans;
}
// ------------------------------------Template End------------------------------ //
void solve(){
    int n,m,o ;
    cin>>n>>m>>o;
    if(m*o >= n) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
       
}
signed main(){
	fast;
    #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt",
    #endif
	solve();
}

			
	



Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

struct edge{ int from,to,cost; };

vector<edge> vec;

signed main(){
	int n,m,l,keta = 0,tmp;
	cin >> l;
	tmp = l;
	while(tmp){
		keta++;
		tmp /= 2;
	}
	n = keta;
	for(int i = keta - 2;i >= 0;i--){
		vec.pb({i,i + 1,0});
		vec.pb({i,i + 1,l / 2});
		if(l % 2) vec.pb({0,i + 1,l - 1});
		l /= 2;
	}
	cout << n << " " << vec.size() << endl;
	for(edge e : vec) cout << e.from + 1 << " " << e.to + 1 << " " << e.cost << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAX 100005
#define NIL -1

int parent[MAX],left[MAX],right[MAX];
int n,D[MAX];

void print(int u){
  int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",parent[u]);
  printf("depth = %d, ",D[u]);
  if(parent[u]==NIL) printf("root, ");
  else if (left[u]==NIL)printf("leaf, ");
  else printf("internal node, ");
  printf("[");
  for(i=0,c=left[u];c!=NIL; i++, c=right[c]){
    if(i) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}
  void rec(int u,int p){
    D[u]=p;
    if(right[u]!=NIL){  rec(right[u],p);}
    if(left[u]!=NIL) {  rec(left[u],p+1);}
  }

  int main(){
    int i,j,d,v,c,l,r;
    scanf("%d",&n);
    for (i=0;i<n;i++) {
      parent[i]=left[i]=right[i]=NIL;
    }
    for (i=0;i<n;i++){
      scanf("%d %d",&v,&d);
    for(j=0;j<d;j++){
      scanf("%d",&c);
      if(j==0)left[v]=c;
      else right[l]=c;
      l=c;
      parent[c]=v;
    }
  }
  for (i=0;i<n;i++){
    if (parent[i]==NIL)r=i;
  }
  rec(r,0);

  for (i=0;i<n;i++) print(i);
  return 0;
}


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

template <int mod = (int)(1e9 + 7)>
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  ModInt &operator+=(const ModInt &p) {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (int)(1LL * x * p.x % mod);
    return *this;
  }
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt &p) const { return x == p.x; }
  bool operator!=(const ModInt &p) const { return x != p.x; }
  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  ModInt pow(int64_t n) const {
    ModInt res(1), mul(x);
    while (n) {
      if (n & 1) res *= mul;
      mul *= mul;
      n >>= 1;
    }
    return res;
  }
  friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; }
  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  static int get_mod() { return mod; }
};

struct Combination {
  vector<ModInt<>> _fact, _rfact, _inv;
  Combination(long long nsize = 5000000)
      : _fact(nsize + 1), _rfact(nsize + 1), _inv(nsize + 1) {
    _fact[0] = _rfact[nsize] = _inv[0] = 1;
    for (int i = 1; i <= nsize; i++) _fact[i] = _fact[i - 1] * i;
    _rfact[nsize] /= _fact[nsize];
    for (int i = nsize - 1; i >= 0; i--) _rfact[i] = _rfact[i + 1] * (i + 1);
    for (int i = 1; i <= nsize; i++) _inv[i] = _rfact[i] * _fact[i - 1];
  }
  inline ModInt<> fact(int k) const { return _fact[k]; }

  inline ModInt<> rfact(int k) const { return _rfact[k]; }

  inline ModInt<> inv(int k) const { return _inv[k]; }

  ModInt<> P(int n, int r) const {
    if (r < 0 || n < r) return 0;
    return fact(n) * rfact(n - r);
  }

  ModInt<> C(int p, int q) const {
    if (q < 0 || p < q) return 0;
    return fact(p) * rfact(q) * rfact(p - q);
  }
  // n types,choose r
  ModInt<> H(int n, int r) const {
    if (n < 0 || r < 0) return (0);
    return r == 0 ? 1 : C(n + r - 1, r);
  }
};

long long n, m;
Combination com;

ModInt<> solve();

int main() {
  cin >> n >> m;
  cout << solve() << endl;
  return 0;
}

ModInt<> solve() {
  ModInt<> res = 0;
  for (int i = 0; i <= n; ++i) {
    ModInt<> now = 0;
    now = com.C(n, i) * com.C(m - i, n - i) * com.fact(n - i);
    if (i % 2)
      res -= now;
    else
      res += now;
  }
  return res * com.C(m, n) * com.fact(n);
}

Measured memory_bytes: 61664
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

int max(int a, int b){
  return a >= b ? a : b;
}
int min(int a, int b){
  return b >= a ? a : b;
}
int sei(int a){
  return a>0 ? a : 0;
}
int factorial(int n) {
    if (n > 0) return n*factorial(n - 1);
		else return 1;
}
int compare_up_int(const void *a, const void *b){
   return *(int*)a - *(int*)b;
}
int compare_down_int(const void *a, const void *b){
   return *(int*)b - *(int*)a;
}
int euclid(int a, int b){
  if(a < b){int tmp = a;a = b;b = tmp;}
  int r = a % b;
  if(r < 0) r += b;
  while(r != 0){
    a = b;b = r;r = a % b;
    if(r < 0) r += b;
  }
  return b;
}

int main(){
  int N,count1=0,count2=0;
  scanf("%d",&N);
  int num[N];
  for(int i=0;i<N;i++) scanf("%d",&num[i]);
  qsort(num,N,sizeof(int),compare_down_int);
  for(int i=0;i<N;i++){
    if(i%2==0)count1+=num[i];
    else count2+=num[i];
  }
  printf("%d",count1-count2);
  return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
struct RollingHash{
	using ull=unsigned long long;
	const ull mask30=(1ll<<30)-1;
	const ull mask31=(1ll<<31)-1;
	const ull mod=(1ll<<61)-1;
	const ull positivizer=(mod<<2);
 
	ull calcmod(ull x){
		ull ret=(x>>61)+(x&mod);
		if(ret>=mod) ret-=mod;
		return ret;
	}
	ull mul(ull a, ull b){
		ull au=(a>>31), ad=(a&mask31), bu=(b>>31), bd=(b&mask31);
		ull mid=au*bd+ad*bu;
		ull midu=(mid>>30), midd=(mid&mask30);
		ull ret=((au*bu)<<1)+midu+(midd<<31)+ad*bd; //ret<2^63
		/*ret=(ret>>61)+(ret&mod);
		if(ret>=mod) ret-=mod;*/
		return ret;
	}
 
	vector<ull> hash, power;
 
	RollingHash(const string &s, ull base=1000000007){
		int sz=s.size();
		hash.resize(sz+1);
		power.resize(sz+1);
		power[0]=1;
		for(int i=0; i<sz; i++){
			power[i+1]=calcmod(mul(power[i], base));
			hash[i+1]=calcmod(mul(hash[i], base)+s[i]);
		}
	}
 
	ull get(int l, int r){ // [l, r)
		return calcmod(hash[r]+positivizer-mul(hash[l], power[r-l]));
	}
 
	ull concat(ll h1, ll h2, int len2){ //h1+h2
		return calcmod(mul(h1, power[len2])+h2);
	}
};
int main()
{
	int n; cin>>n;
	string s; cin>>s;
	RollingHash rh(s);
	int ans=0;
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			if(s[i]!=s[j]) continue;
			int l=1, r=min(j-i, n-j)+1;
			while(r-l>1){
				int m=(l+r)>>1;
				if(rh.get(i, i+m)==rh.get(j, j+m)) l=m;
				else r=m;
			}
			ans=max(ans, l);
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	int n,m;
	while(1){
		cin>>n>>m;
		if(n+m==0) break;
		vi d(n),e(n);
		rep(i,0,n){
			cin>>d[i];
		}
		rep(i,0,m){
			cin>>e[i];
		}
		int now=0,ans=-1;
		rep(i,0,m){
			now+=e[i];
			if(now>=n-1){
				ans=i+1;
				break;
			}
			now+=d[now];
			if(now>=n-1){
				ans=i+1;
				break;
			}
		}
		o(ans);
	}
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef long double ld;
typedef pair<ld,ld> pdd;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif
template<class T>
bool chmax(T& a,const T& b){
  if(a<b){
    a=b;
    return true;
  }
  return false;
}
template<class T>
bool chmin(T& a,const T& b){
  if(a>b){
    a=b;
    return true;
  }
  return false;
}
template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}
ll distance(ll x1,ll y1,ll x2,ll y2,ll level=30){
  if(level==0){
    return abs(y1-y2);
  }
  ll size=1;
  REP(level){
    size*=3;
  }
  ll sizes=size/3;
  pll f,s;
  f.first=x1/sizes;
  f.second=y1/sizes;
  s.first=x2/sizes;
  s.second=y2/sizes;
  if(f.first==s.first&&f.second==s.second){
    return distance(x1%sizes,y1%sizes,x2%sizes,y2%sizes,level-1);
  }
  if(f.first!=s.first&&f.second!=s.second){
    return abs(x1-x2)+abs(y1-y2);
  }
  if(f.second==s.second){
    swap(f.first,f.second);
    swap(s.first,s.second);
    swap(x1,y1);
    swap(x2,y2);
  }
  if(sizes<=x1&&x1<2*sizes&&abs(f.second-s.second)>1){
    return abs(y1-y2)+min(abs(sizes-1-x1)+abs(sizes-1-x2),abs(2*sizes-x1)+abs(2*sizes-x2));
  }
  return distance(x1%sizes,y1,x2%sizes,y2,level-1);
}
void solve(long long Q, std::vector<long long> a, std::vector<long long> b, std::vector<long long> c, std::vector<long long> d){
  REP(Q){
    cout<<distance(a[i],b[i],c[i],d[i])<<endl;
  }
}

int main(){
  cout<<setprecision(1000);
    long long Q;
    scanf("%lld",&Q);
    std::vector<long long> a(Q);
    std::vector<long long> b(Q);
    std::vector<long long> c(Q);
    std::vector<long long> d(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
        scanf("%lld",&c[i]);
        scanf("%lld",&d[i]);
        --a[i];--b[i];--c[i];--d[i];
    }
    solve(Q, std::move(a), std::move(b), std::move(c), std::move(d));
    return 0;
}


Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<double> dvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

int main(){
    ll a,b,c,cnt=0;
    cin>>a>>b>>c;
    ll ans=0;
    while(cnt<c){
        ans++;
        cnt+=a;
        if(ans%7==0) cnt+=b;
    }
    cout<<ans<<endl;
}


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

int main(){
  int n;
  cin >> n;
  
  if(n==1 || n==2 || n==3 || n==5 || n==6 || n==9 || n==10 || n==13 || n==17){
  	cout << "No" << endl;
  }
  else{
  	cout << "Yes" << endl;
  }
}


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

using namespace std;

typedef long long int ll;

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 pair<int,int> pair;

int main(){
    ll n,k; cin >> n >> k;
    vector<ll> h(n); for(int i=0;i<n;i++) cin >> h[i];

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

    ll ans=0;

    for(int i=0;i<n-k;i++){
        ans+=h[i];
    }

    cout << ans << endl;
}

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

signed main(){
    int n;
    cin>>n;
    vector<int>v(n);
    for(int &i:v)
        cin>>i;
    map<int,int>mp;
    vector<int>sum(n),diff(n);
    for(int i=0;i<n;i++){
        sum[i]=v[i]+i+1;
        mp[sum[i]]++;
        diff[i]=i+1-v[i];
    }
    int ans=0;
    for(int i=0;i<n;i++)
    {
        ans+=mp[diff[i]];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 30620
use io::*;
use std::*;

fn solve(N: i64, A: Vec<i64>) {
    let N: usize = N as usize;
    let mut dpl = vec![0; N+2];
    let mut dpr = vec![0; N+2];
    dpl[0] = 0;
    for i in 0..N {
        dpl[i+1] = gcd(dpl[i], A[i]);
    }
    dpl[N+1] = dpl[N];

    dpr[N+1] = 0;
    for i in (2..N+2).rev() {
        dpr[i-1] = gcd(dpr[i], A[i-2]);
    }
    dpr[0] = dpr[1];

    let mut ans = 0i64;
    for i in 0..N {
        ans = cmp::max(ans, gcd(dpl[i], dpr[i+2]));
    }
    println!("{}", ans);
}

fn gcd(a: i64, b: i64) -> i64 {
    if b == 0 {
        return a
    }
    gcd(b, a%b)
}



// Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
fn main() {
    let con = read_string();
    let mut scanner = Scanner::new(&con);
    let mut N: i64;
    N = scanner.next();
    let mut A: Vec<i64> = vec![0i64; (N) as usize];
    for i in 0..(N) as usize {
        A[i] = scanner.next();
    }
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(move || solve(N, A)).unwrap().join().unwrap();
}

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


Measured memory_bytes: 10620
#include<bits/stdc++.h>
#define int long long
using namespace std ;
int read() {
  int x = 0 , f = 1 ;
  char c = getchar() ;
  while(c < 48 || c > 57) {
    if(c == '-') f = -1 ;
    c = getchar() ;
  }
  while(c > 47 && c < 58) {
    x = (x << 1) + (x << 3) + (c & 15) ;
    c = getchar() ;
  }
  return x * f ;
}
void print(int x) {
  if(x < 0) x = -x , putchar('-') ;
  if(! x) { putchar('0') ; }
  static char st[30] ; int stp = 0 ;
  while(x) { st[++ stp] = x % 10 ^ 48 ; x /= 10 ;}
  while(stp) { putchar(st[stp --]) ; }
  putchar('\n') ;
}
signed main() {
  string s ;
  cin >> s ;
  int len = s.length() ; s = " " + s ;
  int ans = 0 ;
  for(int i = 1 ; i <= (len >> 1) ; i ++)
    if(s[i] != s[len - i + 1]) ans ++ ;
  print(ans) ;
  return 0 ;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] nums = new long[n];
        for(int i = 0; i < n; i++) {
          nums[i] = sc.nextLong();
        }

        long[] prefixSum = new long[n];

        long minCost = 0;
        if(nums[0] == 0) {
          nums[0] = 1;
          minCost = 1 + count(nums);

          nums[0] = -1;
          minCost = Math.min(minCost, 1 + count(nums));
        } else {
          minCost = count(nums);
          long org = nums[0];
          if(org > 0) {
            nums[0] = -1;
            minCost = Math.min(minCost,count(nums) + org + 1);
          } else {
            nums[0] = 1;
            minCost = Math.min(minCost,count(nums) + 1 - org);
          }
          
        }
        System.out.println(minCost);
    }

    private static long count(long[] nums) {
      long cnt = 0;
      long prev = nums[0];
      long cur = 0;
      for(int i = 1; i < nums.length; i++) {
        cur = nums[i] + prev;
        if(cur * prev < 0) {
          prev = cur;
          continue;
        }

        if(prev > 0) {
          cnt += cur + 1;
          prev = -1; 
        } else {
          cnt += 1 - cur;
          prev = 1;
        }
      }
      return cnt;
    }
}


Measured memory_bytes: 59632
#include <bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	ULL pow10[19] = {
		1, 10, 100, 1000, 10000,
		100000, 1000000, 10000000, 100000000,
		1000000000, 10000000000, 100000000000, 1000000000000,
		10000000000000, 100000000000000, 1000000000000000, 10000000000000000,
		100000000000000000, 1000000000000000000
	};

	void Solve() {
		ULL K; cin >> K;
		vector<ULL> ans;
		pair<ULL, ULL> buf = { 1000000000000000, 1 };
		for (int d = 15; d >= 4; d--) {
			ULL off = pow10[d - 4];
			for (ULL i = 9999; i > 1000; i--) {
				pair<ULL, ULL> Sbuf = {
					i * off + off - 1,
					i / 1000 + i / 100 % 10 + i / 10 % 10 + i % 10 + 9 * (d - 4)
				};
				if (buf.first * Sbuf.second >= Sbuf.first * buf.second) {
					ans.push_back(Sbuf.first);
					//cout << buf.first << "/" << buf.second << "<="
					//	<< Sbuf.first << "/" << Sbuf.second << endl;
					buf = Sbuf;
				}
			}
		}
		for (ULL i = 999; i > 0; i--) {
			pair<ULL, ULL> Sbuf = { i, i % 100 + i / 10 % 10 + i % 10 };
			if (buf.first * Sbuf.second >= Sbuf.first * buf.second) {
				ans.push_back(Sbuf.first);
				//cout << buf.first << "/" << buf.second << "<="
				//	<< Sbuf.first << "/" << Sbuf.second << endl;
				buf = Sbuf;
			}
		}
		reverse(ans.begin(), ans.end());
		rep(i, K) cout << ans[i] << endl;
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 256
#
import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

def main():
    s = list(input())
    s.sort()
    if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
import java.io.*;

public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int i =1;
		while(true){
			int x = Integer.parseInt(br.readLine());
			if (x==0) {
				break;
			}
			sb.append("Case ").append(Integer.toString(i++)).append(": ").append(Integer.toString(x)).append("\n");
		}
		System.out.print(sb);
	}
}

Measured memory_bytes: 31276
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>

ll n, ans;

int main() {
	cin >> n;
	vector<ll> s(n);
	REP(i, n)cin >> s[i];
	FOR(i, 1, n - 1) {
		//cout << i << endl;
		vector<ll> now(3);
		now[0] = s[i - 1];
		now[1] = s[i];
		now[2] = s[i + 1];
		sort(ALL(now));
		if (now[1] == s[i])ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int	main(void)
{
  int k,n;
  scanf("%d%d", &k, &n);
  int a[n];
  int max = 0;
  
  int i = 0;
  while (i < n)
  {
    scanf("%d", &a[i]);
    i++;
  }
  i = 1;
  while (i < n)
  {
    if (a[i] - a[i - 1] > max)
      max = a[i] - a[i - 1];
    i++;
  }
  if ((k - a[n - 1] + a[0]) > max)
    	max = k - a[n - 1] + a[0];
  printf ("%d", (k - max));
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  IOS;
  int n=5,ans=INF;
  int a[n], b[n],sum=0;
  REP(i,n) {
    cin >> a[i];
    b[i] = (a[i]%10==0) ? a[i] : a[i]+(10-a[i]%10);
    sum+=b[i];
  }
  REP(i,n) chmin(ans, sum-b[i]+a[i]);

  COUT(ans);
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;
// constexpr ll MOD = 998244353;
constexpr ll MOD = 1000000007;

// struct UnionFind {
//     vector<int> par;
    
//     UnionFind(int N): par(N) {
//         for (int i=0;i<N;i++) par[i] = i;
//     }

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

//     void unite(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         if (rx == ry) return;
//         par[rx] = ry;
//     }

//     bool same(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         return rx == ry;
//     }
// };

int main(void) {
    int N;
    map<int,int> A;
    cin >> N;
    for (int i=0;i<N;i++) {
        int x;
        cin >> x;
        A[x] = i+1;
    }
    for (auto itr: A) {
        cout << itr.second << " ";
    }
    cout << endl;


    return 0;
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

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

class UnionFind{
  public:
  // 親の番号を格納する．親の場合は-(その集合のサイズ)
  vector<int> Parent; 
  
  // 全て-1
  UnionFind(int N){
    Parent = vector<int>(N, -1);
  }
  
  // Aがどのグループに属しているか
  int root(int A){
    if(Parent[A] < 0) return A;
    return Parent[A] = root(Parent[A]); // return前に自分の親を更新することで高速化
  }
  
  // 自分のいるグループの頂点数を調べる
  int size(int A){
    return -Parent[root(A)]; 
  }
  
  // AとBをくっつける
  bool connect(int A, int B){
    // AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
    A = root(A);
    B = root(B);
    if(A == B){
      // すでにくっついているからくっつけない
      return false;
    }
    
    // グループのサイズが大きい方(A)に小さい方(B)をくっつけたい
    // 大小が逆ならひっくり返す
    if(size(A) < size(B)) swap(A, B);
    
    // Aのサイズを更新する
    Parent[A] += Parent[B];
    // Bの親をAに変更する
    Parent[B] = A;
    
    return true;
  }
};

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int n,m; cin>>n>>m;
  vi a(m), b(m);
  rep(i,m){
    cin>>a[i]>>b[i];
    a[i]--; b[i]--;
  }
  auto uf = UnionFind(n);
  vector<ll> ans(m);
  ans[m-1]=1LL*n*(n-1)/2;
  for(int i=m-2; i>=0; i--){
    if(uf.root(a[i+1])==uf.root(b[i+1])){
      ans[i]=ans[i+1];
      continue;
    }
    ans[i]=ans[i+1]-(1LL*uf.size(a[i+1])*uf.size(b[i+1]));
    uf.connect(a[i+1],b[i+1]);
  }
  rep(i,m) cout<<ans[i]<<endl;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>

using namespace std;

#define PI 3.14159265358979323846
#define INF 1e+9
#define DIV_NUM (1000000007)


// ★ 桁DP
// dp[ 決めた桁数 ][ 未満フラグ ] := 総数
// 未満フラグとは
// 　過去に対応する桁より小さい値を入れたことがある → 全ての値を自由に入れられる
// 　過去に対応する桁より小さい値を入れたことが無い → ０以上D以下の値しか入れられない
//　dp[i][j]からの遷移は
//　　for ( int d = 0; d <= ( j ? 9 : D ); ++d )
//　　　dp[ i + 1 ][ j || ( d < D ) ] += dp[ i ][ j ];
//　の様に書ける
//　更新が終わったあと，dp[ L ][ 0 ] + dp[ L ][ 1 ] が答え
//　求めるのが N未満の整数の数だったら dp[ L ][ 0 ] だけ見ればよい

long long dpA[101][2][5];
// dp[決めた桁数][未満フラグ][0でない数を含む数]
int main() {

	string A;
	int K;
	cin >> A >> K;

	int lenA = A.size();
	dpA[0][0][0] = 1;

	for (int i = 0; i < lenA; i++) {
		for (int j = 0; j < 2; j++) {
			int D = A[i] - '0';
			for (int d = 0; d <= (j ? 9 : D); ++d) {
				for (int k = 0; k < K+1; k++) {
					dpA[i + 1][j || (d < D)][k+(d!=0)] += dpA[i][j][k];
				}
			}
		}
	}

	cout << dpA[lenA][1][K] + dpA[lenA][0][K] << endl;


	return 0;
}


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

int main(void)
{
    string S;
    cin >> S;
    int K;
    cin >> K;
    int size = S.length();
    set<string> ss;
    for (int j = 0;j<K;j++){
        for (int i = 0;i<size-j;i++){
                ss.insert(S.substr(i,j+1));
        }
    }
    int temp;
    for (auto& i:ss){
        if(temp == K-1){
            cout << i << endl;
            return 0;
        }
        temp++;
    }

}

Measured memory_bytes: 1664
n = int(input())
inning = 0

while inning != n:
    score = 0
    info = [0, 0, 0]
    out_count = 0
    while True:
        event = input()
        if event == "OUT":
            out_count += 1
        if out_count == 3:
            inning += 1
            print(score)
            break

        if event == "HIT":
            score += info[-1]
            info = [1] + info[:2]
        elif event == "HOMERUN":
            score += sum(info) + 1
            info = [0, 0, 0]



Measured memory_bytes: 5596
#include <stdio.h>

#define LENGTH 25000

int mennseki(char *ascii,int length,int p,int q) {
	int hukami = 0,i;
	double a =0;
	
	for(i = p; i < q; i++) {
		if(ascii[i] == '/') {
			a += (double)hukami - 0.5;
			hukami--;
		} else if (ascii[i] == '\\') {
			a +=(double)hukami + 0.5;
			hukami++;
		} else if(ascii[i] =='_') {
			a += hukami;
		}
	}
	return a;
}

int main(void) {
	char ascii[LENGTH];
	int i,length,dis;
	int sum=0,num=0,alt=0,j=0;
    int height[LENGTH] = {0};
	int width[LENGTH] = {0};
	scanf("%s",ascii);
	
	for(length = 0; ; length++) {
		height[length] = alt;
		if(ascii[length] =='/') {
			alt++;
		} else if(ascii[length] == '\\') {
			alt--;
		} else if(ascii[length] == '\0') {
			break;
		}
	}
	    
	
	while(num < length) {
		while(ascii[num] != '\\' && num < length) {
			num++;
		}
		dis= num + 1;
		while(dis <= length && height[dis] != height[num]) {
			dis++;
		}
		if(dis <= length) {
			width[j++] = mennseki(ascii,length,num,dis);
			num = dis;
		} else {
			num++;
		}
	}
	
	for(i = 0; i <j; i++) {
		sum += width[i];
	}
	
	
	printf("%d\n%d", sum, j);
 
  for(i = 0; i < j; i++){
    printf(" %d", width[i]);
  }
  printf("\n");
 
  return 0;
}
	
		
		


Measured memory_bytes: 2104
import java.util.*;

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

        int a = scan.nextInt();
        int[] b = new int[a+1];
        int[] c = new int[a];
        for(int i=0;i<a+1;i++){
            int d=scan.nextInt();
            b[i]=d;
        }
        for(int i=0;i<a;i++){
            int d=scan.nextInt();
            c[i]=d;
        }
        long ans=0;
        for(int i=0;i<a;i++){
            if(c[i]<=b[i]){
                ans+=c[i];
            }else{
                c[i]-=b[i];
                ans+=b[i];
                b[i]=0;
                int e = i+1;
                if(c[i]<=b[e]){
                    ans+=c[i];
                    b[e]-=c[i];
                }else{
                    ans+=b[e];
                    b[e]=0;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 64980
n = int(input())
t = 0
x = 0
y = 0
for i in range(n):
  T,X,Y = map(int,input().split())
  man = abs(X-x) + abs(Y-y)
  woman = T-t
  if man > woman or man % 2 != woman % 2:
    print('No')
    break
  t,x,y = T,X,Y
else:
  print('Yes')

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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }

void solve() {
  ll X;
  cin >> X;
  ll ma = 1;
  for(int b = 2; b <= X; b++) {
    ll now = b * b;
    do {
      now *= b;
    } while(now <= X);
    if (now / b > X) continue;
    ma = max(ma, now / b);
  }
  cout << ma << endl;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  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++)
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;
typedef long long ll;  /* 10^18 くらいまでいける */

vector<string> split(const string &s, char delim) {
    vector<string> elems;
    string item;
    for (char ch: s) {
        if (ch == delim) {
            if (!item.empty())
                elems.push_back(item);
            item.clear();
        }
        else {
            item += ch;
        }
    }
    if (!item.empty())
        elems.push_back(item);
    return elems;
}

int main(){
  string s;
  cin >> s;
  
  auto separatedStr = split(s, '/');
  if (stoi(separatedStr[1]) > 4)
    cout << "TBD" << endl;
  else
    cout << "Heisei" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000

int partition(int *A,int p,int r){
  int x,i,j,a;

  x = A[r];
  i = p-1;
  for(j=p;j<r;j++){
    if(A[j] <= x){
      i = i+1;
      a = A[i];
      A[i] = A[j];
      A[j] = a;
    }
  }
  a = A[i+1];
  A[i+1] = A[r];
  A[r] = a;
  return i+1;
}
  
int main(){
  int A[MAX],i,n,q;

  scanf("%d",&n);

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

  q = partition(A,0,n-1);

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

  return 0;
}



Measured memory_bytes: 2140
x1,y1,x2,y2 = map(int, input().split())

x = x2 - x1
y = y2 - y1

x3 = x2 - y
y3 = y2 + x
x4 = x3 - x
y4 = y3 - y

print(x3,y3,x4,y4)

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

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int N, D, sum = 0; cin >> N;
	D = N;
	while (N != 0){
		sum += N % 10;
		N /= 10;
	}
//	cout << sum  << "\n";
	cout << ( (D % sum == 0) ? "Yes" : "No") << "\n";
	
	return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <cmath>
#include <string>
#include <typeinfo>
#include <climits>
#include <algorithm>
#include <cctype>
#include <cstring>
#include <stdio.h>
#include <cstdlib>
using namespace std;

int main(){
    char a;
    cin >> a;
    if(a=='a'||a=='i'||a=='u'||a=='e'||a=='o'){
        cout << "vowel";
    }else{
        cout <<"consonant";
    }
}


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


# dp[i]: i yen 卸すのに必要な最小の手数
dp = [1e+5]*(N+1)
dp[0] = 0
for i in range(1,N+1):
    dp[i] = dp[i-1]
    tmp = 6
    while i-tmp >= 0:
        dp[i] = min(dp[i], dp[i-tmp])
        tmp *= 6
    tmp = 9
    while i-tmp >= 0:
        dp[i] = min(dp[i], dp[i-tmp])
        tmp *= 9
    dp[i] += 1

print(dp[N])

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define ll long long
#define pb push_back
#define mp make_pair
#define nt _int128
#define ld long double
long double PI =3.14159265358979323846;


const ll modo=1e9+7;
const ll inf=2e14;
const ll ms=(2e5) +5;


int main()
{
    idfc;
    int n;
    cin>>n;
    int i;
    int e;
    set<int> ss;
    for(i=0;i<n;i++)
    {
        cin>>e;
        ss.insert(e);
    }
    if(ss.size()==n)cout<<"YES";
    else cout<<"NO";
    return 0;
}

Measured memory_bytes: 9600
#pragma GCC optimize("Ofast")
	#pragma GCC target("avx,avx2,fma")
	#pragma GCC optimization ("unroll-loops")

	#include <bits/stdc++.h>
	using namespace std;
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define vpll vector < pair<long long,long long> >
	#define fill(a,val)  memset(a,val, sizeof (a))
	#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
	#define mp make_pair
	#define pb push_back
	#define f first
	#define s second
	#define all(cont) cont.begin(), cont.end()
	#define max3(a,b,c) max(a,max(b,c))
	#define min3(a,b,c) min(a,min(b,c))
	#define max4(a,b,c,d) max(max(a,d),max(b,c))
	#define MAX   1e9
	#define MIN  -1e9
	#define PI 3.14159265358979
	#define eps 1e-9
	typedef map<int,int> mpi;
	typedef set<int> seti;
	typedef multiset<int> mseti;
	#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
	#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
	#define repA(i, a, n)  for(long long int i = a; i <= (n); ++i)
	#define repD(i, a, n)  for(long long int i = a; i >= (n); --i)
	#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
	#define trav(a, x) for(auto& a : x)
	#define dbg(x) cout << #x << " = " << x << '\n'
	#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl
	#define inp(a,start,len) for(long long int i = start;i < len;i++) cin>>a[i]
	struct Interval{ll start,end;};
	bool compare(Interval i1, Interval i2) {return (i1.start < i2.start);}


	int main(){
		fio;
		#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
		#endif
		ll T = 1;
		// cin>>T;
		while(T--){
			ll a,b,c,d;
			cin>>a>>b>>c>>d;
			cout<<max(max(a*c,a*d),max(b*c,b*d));
			// if(b>= 0 && d >=0)
			// 	cout<<max(b*d,a*c);
			// else if(b<0 && d>=0 && c>=0)
			// 	cout<<c*b;
			// else if(b>=0 && d<0 && a>=0)
			// 	cout<<a*d;
			// else
			// 	cout<<a*c;
		}
		return 0;
	}


Measured memory_bytes: 3644
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

# 01ナップサック問題
N,W = map(int,readline().split())
AB = [tuple(map(int,readline().split())) for i in range(N)]
AB.sort(key=lambda x: x[0])
dp = [0]*(W+1)

for (w,v) in AB:
    dpnew = dp[::]
    for j in range(W):
        dpnew[min(j+w,W)] = max(dp[min(j+w,W)],dp[j] + v)
    dp = dpnew

print(dp[W])


Measured memory_bytes: 75280
#include <cstdio>


void swap(int *a,int *b){
		int tmp = *a;
		*a=*b;
		*b=tmp;
}


int SameInteger(int a,int b,int c){
		int res=0;
		if (a==b && b==c){
				return 0;
		}
		res+=(a-b);
		if ((b-c)%2==0){
				res+=((b-c)/2);
		}else{
				res++;
				res+=((b-c)/2);
				res++;
		}
		return res;
}


int main(){
		int a,b,c,res=0;
		scanf("%d %d %d",&a,&b,&c);
		if(b-a>0){
				swap(&a,&b);
		}
		if(c-b>0){
				swap(&b,&c);
		}
		if(b-a>0){
				swap(&b,&a);
		}

		printf("%d\n",SameInteger(a,b,c));

		return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main() {
    string s;
    long long sum = 0;
    cin >> s;
    int n = s.size();

    for(int i = 0; i < (1 << (n - 1)); i++) {
        long long tmp = (s[0] - '0');
        long long tmp2 = 0;
        for(int j = 1; j < n; j++) {
            if((i >> (j-1)) & 1) {
                tmp2 += tmp;
                tmp = (s[j] - '0');
            } else {
                tmp *= 10;
                tmp += (s[j] - '0');
            }
        }
        tmp2 += tmp;
        sum += tmp2;
    }

    cout << sum << endl;
}

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

using namespace std;

int main(){
    int count[26]={0};
    set<char> letters;
    char S[4];
    cin >> S;
    //for(int i = 0; i< 26; ++i) cout<<count[i];
   // cout <<"\n";
    bool morethantwo = false;
    for(int i = 0; i<4;++i){
        letters.insert(S[i]);
        int a = ++count[(int)S[i]-'A'];
       // cout << a<<"===a\n"<<"count==="<<count['A'-S[i]]<<"\n";
        if(a>2){
            morethantwo = true;
        }
    }
   // for(int i = 0; i< 26; ++i) cout<<count[i];
    //cout <<"\n";
    if(letters.size()==2 && !morethantwo){
        cout << "Yes";
    }else cout << "No";
}

Measured memory_bytes: 3628
while True:
    H, W = map(int,input().split())

    if H + W == 0:
        exit()
    
    oddline = "#." * (W//2) + ("#" if W % 2 != 0 else "")
    eveline = ".#" * (W//2) + ("." if W % 2 != 0 else "")
    
    for i in range(H):
        if (i+1) % 2 == 1:
            print(oddline)
        else:
            print(eveline)
    print("")


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
long long int a,b;
int main(){
  cin >> a >>b;
           if(b-2*a >=0){
             cout << a+(b-2*a)/4 << endl;
               }
           else if(b-2*a<0){
             cout << b/2 << endl;
           }
          }
             


Measured memory_bytes: 256