akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define INF 1LL << 60;
#define LLINF 1e12
#define PI 3.14159265359
#define ALL(a) (a).begin(), (a).end()
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int dy8[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dx8[] = {0, 1, 0, -1, 1, 1, -1, -1};
int ny, nx;
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

ll llmin(ll x, ll y) { return x < y ? x : y; }
ll llmax(ll x, ll y) { return x > y ? x : y; }

unsigned GetDigit(unsigned num) { return to_string(num).length(); }

template <typename Container>
bool exist_in(const Container &c, const typename Container::value_type &v)
{
    return (c.end() != std::find(c.begin(), c.end(), v));
}

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;
}

ll nCr(int n, int r)
{
    if (n == r or n == 0)
        return 1;
    if (n < r)
        return 0;
    if (r == 1)
        return n;
    return nCr(n - 1, r - 1) + nCr(n - 1, r);
}

//素因数分解
vector<ll> decom;

void decompositPrime(ll n)
{
    ll a = 2;
    while (n >= a * a)
    {
        if (n % a == 0)
        {
            decom.push_back(a);
            n /= a;
        }
        else
        {
            a++;
        }
    }
    decom.push_back(n);
}

//std::cout << std::defaultfloat << std::setprecision(10);
////////////////////////////////////////
int main()
{
    int k; cin >> k;
    int x = 7%k;
    set<int> s;
    int i = 1;
    while(s.count(x) == 0){
        if(x==0){
            cout << i << endl;
            return 0;
        }
        s.insert(x);
        x = (x * 10 + 7) % k;
        ++i;
    }

    cout << -1 << endl;
    return 0;
}


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

typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define DECIM8  fixed<<setprecision(8) 
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

using namespace std;
int succ(int a,int L){
  vector<int> av;
  REP(i,L) av.PB(0);
  for(int i=0;i<L;i++){
    av[i]=a%10;
    a/=10;
  }
  SORT(av);
  int answer=0;
  REP(i,L) 
    answer+=av[i]*(pow(10,i)-pow(10,L-1-i));
  return answer;
}

int main(void)
{
  for(;;){
    int firstopen[1048576]={};
    int a,L;
    cin >> a >> L;
    if(!a&&!L) return 0;
    firstopen[a]=1;
    FOR(i,2,100){
      a=succ(a,L);
      if(firstopen[a]){
	cout << firstopen[a]-1 << ' ' << a << ' ' << i-firstopen[a] << endl;
	break;
      }
      firstopen[a]=i;
    }
  }
}

Measured memory_bytes: 5356
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000000
#define endl '\n'
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; }
using namespace std;

int s[15],N;
int ans=0;

void dfs(int i, int sum, int now){
    if(i==N-1){
        ans+=sum+now;
    }else{
        dfs(i+1,sum+now,s[i+1]);
        dfs(i+1,sum,now*10+s[i+1]);
    }
}

signed main(){
    string str; cin>>str; N=str.size();
    rep(i,N)s[i]=str.at(i)-'0';
    dfs(0,0,s[0]);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  cin >> n;
  if (n % 2 == 0) {
    int m = n*(n-2)/2;
    cout << m << endl;
    for (int i = n; i >= 1; --i) {
      for (int j = 1; j <= i; ++j) {
        if (i == j) continue;
        if (i+j == n+1) continue;
        cout << i << " " << j << "\n";
      }
    }
  }
  else {
    int m = n-1 + (n-1)*(n-3)/2;
    cout << m << endl;
    for (int i = 1; i < n; ++i) {
      cout << i << " " << n << "\n"; //全部繋ぐ
    }
    for (int i = n-1; i >= 1; --i) {
      for (int j = 1; j <= i; ++j) {
        if (i == j) continue;
        if (i+j == n) continue;
        cout << i << " " << j << "\n";
      }
    }
  }
  return 0;
}

Measured memory_bytes: 384
#include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(int i=0;i<n;i++)

int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}

int N, D;
int X[20][20];
int ans = 0;

int main() {
	cin >> N >> D;
	REP(i, N) {
		REP(j, D) {
			cin >> X[i][j];
		}
	}

	REP(i, N) {
		for (int j = i + 1; j < N; j++) {
			float l = 0;
			REP(k, D) {
				l += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
			}
			//lが整数の二乗か調べる
			float lf = sqrtf(l);
//			cout << "lf" << lf << endl;
			if (lf == (int)lf) {
				ans++;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import math

N = int(input())

tmp1 = input().split()
tmp2 = input().split()

P = []
Q = []

P_tmp = []
Q_tmp = []

for i in range(N):
  tmp11 = int(tmp1[i])
  tmp22 = int(tmp2[i])
  
  P.append(tmp11)
  P_tmp.append(tmp11)
  P_tmp.sort()
  Q.append(tmp22)
  Q_tmp.append(tmp22)
  Q_tmp.sort()

sumP = 1
sumQ = 1

for i in range(N-1):
  nanban = P_tmp.index(P[i])
  tmp = nanban*math.factorial(N-i-1)
  if tmp < 0:
    tmp = 0
  sumP += tmp
  P_tmp.pop(nanban)
  
for i in range(N-1):
  nanban = Q_tmp.index(Q[i])
  tmp = nanban*math.factorial(N-i-1)
  if tmp < 0:
    tmp = 0
  sumQ += tmp 
  Q_tmp.pop(nanban)
 
print(abs(sumP - sumQ)) 

Measured memory_bytes: 3064
typedef long long int ll;
typedef unsigned long long int ull;
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MOD 1000000007
#define M_PI           3.14159265358979323846  /* pi */
#define sec second
#define fir first
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repe(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define entire(a) (a).begin(),(a).end()
#define pb push_back
#define pii pair<int,int>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
void solve()
{
	ll n, k;
	cin >> n >> k;
	std::vector<ll> v(n);
	rep(i, n)cin >> v[i];
	std::vector<ll> res(n, INT_MAX);
	res[0] = 0;
	res[1] = abs(v[1] - v[0]);
	for (int i = 2; i < n; i++)
	{
		ll Min = INT_MAX;
		for (int j = i - 1; j >= i - k && j > -1; j--)
			Min = min(abs(v[i] - v[j]) + res[j], Min);
		res[i]=Min;
	}
	cout << res[n - 1] << endl;
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fast
	int T = 1;
	// cin >> T;
	while (T--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 4684
#include <bits/stdc++.h>
#define rep0(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define mREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
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; }
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  rep1(i,b+1){
    if(a*i%b==c){
      cout<<"YES"<<endl;
      return 0;
    }
  }
  cout<<"NO"<<endl;
  return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <memory.h>
#include <vector>

using namespace std;
typedef long long LL;
const int maxn = 405;
const int maxm = 100005;
const int inf = 1<<29;

int x[maxm],y[maxm],n,m,ans;
int bac[maxn][maxn],ok[maxn];
int main()
{
	#ifdef Amberframe
		freopen("agc016e.in","r",stdin);
		freopen("agc016e.out","w",stdout);
	#endif
	scanf("%d %d",&n,&m);
	for (int i=1;i<=m;i++)
		scanf("%d %d",&x[i],&y[i]);
	for (int i=1;i<=n;i++) {
		bac[i][i]=1;ok[i]=true;
		for (int j=m;j>=1;j--)
		if (bac[i][x[j]]&&bac[i][y[j]]) {ok[i]=false;break;}
		else if (bac[i][x[j]]) bac[i][y[j]]=1;
		else if (bac[i][y[j]]) bac[i][x[j]]=1;
	}
	
	for (int i=1;i<=n;i++)
	for (int j=i+1;j<=n;j++)
	if (ok[i]&&ok[j]) {
		int cnt=0;
		for (int k=1;k<=n;k++)
			cnt+=bac[i][k]&&bac[j][k];
		ans+=(cnt==0);
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1664
# ABC 151 C Maze Master
from collections import deque

H, W = map(int, input().split())          
graph = [list(input()) for _ in range(H)]

dy = [0, 1, 0, -1]
dx = [-1, 0, 1, 0]

ans = 0
for si in range(H):
    for sj in range(W):
        if graph[si][sj] == "#": continue
        que = deque()
        que.append([si, sj])

        dist = [[-1 for _ in range(W)] for _ in range(H)]
        dist[si][sj] = 0
        
        while que:
            y, x = que.popleft()

            for dir in range(4):
                ny = y + dy[dir]
                nx = x + dx[dir]
                if ny < 0 or ny >= H or nx < 0 or nx >= W: continue
                if graph[ny][nx] == "#": continue
                if dist[ny][nx] != -1: continue

                if graph[ny][nx] == ".":
                    dist[ny][nx] = dist[y][x] + 1
                    que.append([ny, nx])

        for i in range(H):
            for j in range(W):
                if dist[i][j] == -1: continue
                ans = max(ans, dist[i][j])

print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define si set <ll>
#define vi vector <ll>
#define popcount(x) __builtin_popcountll(x)
#define mii map <ll,ll>
#define vpi vector <pair <ll,ll> >
#define sz(c) (int)c.size()
#define fr first
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define mem0(a) memset(a,0,sizeof(a))
#define rep(i,a,n) for( ll i=a ; i<n ; i++)
#define ld long double
#define rall(a) (a).rbegin(),(a).rend()
#define SET(s) cout<<fixed<<setprecision(s)

ll power(ll b,ll e,ll m)
{
  if(e==0) return 1;
  if(e&1) return b*power(b*b%m,e/2,m)%m;
  return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
  if(e==0) return 1;
  if(e&1) return b*power(b*b,e/2);
  return power(b*b,e/2);
}  
bool isPowerOfTwo(ll x)
{
    // x will check if x == 0 and !(x & (x - 1)) will check if x is a power of 2 or not
    return (x && !(x & (x - 1)));
} 


void solve()
{
  ll x;
  cin>>x;
  ll p=1;
  while(true)
  {
    ll a=360*p;
    if(a%x==0)
    {
      cout<<a/x;
      return;
    }
    p++;
  }
}

int main()       
{
  fastio
  ll tt=1;
  // cin>>tt;
  while(tt--)
  {
    solve();
    cout<<"\n";
  }
  return 0;
}


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

int main() {
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i,m*2){
        int b;
        cin >> b;
        a[b-1]++;
    }
    rep(i,n) cout << a[i] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for (int i = 0; i<(n); i++)
#define in(n) cin >> (n)
#define out(ans) cout << (ans) << endl;
using ll = int64_t;
using v = vector<int>;

int main() {
  int R;
  in(R);
  out(2*R*3.14159);

  

}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
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 ll MOD = 1e9+7;

int main(){
    string S, T;
    cin >> S >> T;
    
    int NS = S.length();
    int NT = T.length();

    vector<int> A[30];
    for(int i = 0; i < NS; i++){
        int t = S[i] - 'a';
        A[t].push_back(i);
    }

    ll ans = 0;
    bool ok = true;
    for(int i = 0; i < NT; i++){
        int t = T[i] - 'a';
        if(A[t].size() == 0){
            ok = false;
            break;
        }
        //auto iter = upper_bound(A[t].begin(), A[t].end(), ans%NS);
        auto iter = lower_bound(A[t].begin(), A[t].end(), ans%NS);
        if(iter == A[t].end()){
            iter = A[t].begin();
            ans += (NS - ans%NS) + *iter;
        }
        else{
            ans += *iter - ans%NS;
        }
        ans++;
    }

    if(ok){
        //cout << ans+1 << endl;
        cout << ans << endl;
    }
    else{
        cout << -1 << endl;
    }

    return 0;
}


Measured memory_bytes: 1216
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <numeric>
typedef long long ll;
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> b(N-1);
  for(int i = 0; i < N-1; ++i){
    cin >> b[i];
  }
  vector<int> a(N);
  a[0] = b[0];
  a[N-1] = b[N-2];
  for(int i = 1; i <= N-2; ++i){
    a[i] = min(b[i-1], b[i]);
  }
  cout << accumulate(a.begin(), a.end(), 0) << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;

public class Main
{
	public static void main(String[] args)
	{
		Scanner cin = new Scanner(System.in);
		
		int n,t;
		int[] data = new int[3];

		n = cin.nextInt();
		while(n-- > 0)
		{
			for(int i=0; i<3; i++)
			{
				t = cin.nextInt();
				data[i] = t*t;
			}
			Arrays.sort(data);
			
			if(data[0]+data[1] == data[2])
			{
				System.out.println("YES");
			}
			else
			{
				System.out.println("NO");
			}
		}
	}
}

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

int main(){
  int n; cin >> n;
  string s; cin >> s;
  vector<int> cumb(n+1);
  vector<int> cumw(n+1);
  cumb.at(0) = 0;
  for(int i=0; i<n; i++){
    if(s.at(i)=='#'){
      cumb.at(i+1) = cumb.at(i)+1;
    }else{
      cumb.at(i+1) = cumb.at(i);
    }
  }
  cumw.at(n) = 0;
  for(int i=0; i<n; i++){
    if(s.at(n-1-i)=='.'){
      cumw.at(n-1-i) = cumw.at(n-i)+1;
    }else{
      cumw.at(n-1-i) = cumw.at(n-i);
    }
  }
  int ans = 1000000000;
  for(int i=0; i<=n; i++){
    //cout << 'w' << cumw.at(i) << 'b' << cumb.at(i) <<endl;
    ans = min(ans, cumw.at(i)+cumb.at(i));
  }
  cout << ans <<endl;
}
      

Measured memory_bytes: 2180
object Main extends App {

  import scala.io.StdIn._

  val n = readInt
  val a = readLine.split("[ ]+").map(_.toInt)
  var sum = readLine.split("[ ]+").map(_.toInt).sum
  val c = readLine.split("[ ]+").map(_.toInt)
  for (i <- 0 until n - 1) {
    if (a(i + 1) == a(i) + 1)
      sum += c(a(i) - 1)
  }
  println(sum)
}


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

int main(int argc, char const *argv[])
{
    int n; cin >> n;
    string s;
    double x, sum=0;
    
    const double rate = 380000.0;
     for(int i=0;i<n;++i) {
        cin >> x >> s;
        if (s=="BTC") x *= rate;
        sum += x;
     }
     cout << sum << endl;





    return 0;
}


Measured memory_bytes: 256
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func main() {
	scanner.Split(bufio.ScanLines)

	line := nextString()

	fmt.Println(strings.ToUpper(line))
}



Measured memory_bytes: 1056
fn main() {
    let mut editor = String::new();

    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer);
    for k in buffer.trim().chars() {
        match k {
            '0' => editor.push_str("0"),
            '1' => editor.push_str("1"),
            'B' => { editor.pop(); },
            _ => unreachable!("unknown key"),
        }
    }

    println!("{}", editor);
}

Measured memory_bytes: 380
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<list>
#include<set>
#include<string>
using namespace std;
int gcd(int a, int b) {
	int c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
typedef long long ll;

ll M = 1000000007;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n) {
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % M;
	return tmp * fac[a] % M;
}
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a) {
	long long b = M, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= M;
	if (u < 0) u += M;
	return u;
}
vector<vector<ll>> mul(vector<vector<ll>> a,vector<vector<ll>> b,int n){
	int i,j,k,t;
	vector<vector<ll>> c(n);
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			t = 0;
			for (k = 0; k < n; k++)
				t = (t + a[i][k]*b[k][j] % M)%M;
			c[i].push_back(t);
		}
	}
	return c;
}
int main() {
	int a, b;
	cin >> a >> b;
	cout << (a - 1)*(b - 1) << endl;
}


Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#define REP(i,n) for (int i=0;i<(n);i++)
using namespace std;
int main(void){
    int H,W;
    char a;
    cin >> H >> W;
    REP(i,W+2){cout << "#";}cout <<endl;
    REP(j,H){
        cout << "#";
        REP(i,W){
            cin >> a;
            cout << a;
        }
        cout << "#" << endl;
    }
    REP(i,W+2){cout << "#";}cout <<endl;
    
    return 0;
}


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

using namespace std;

const int md = 998244353;

inline void add(int &x, int y) {
  x += y;
  if (x >= md) {
    x -= md;
  }
}

inline void sub(int &x, int y) {
  x -= y;
  if (x < 0) {
    x += md;
  }
}

inline int mul(int x, int y) {
  return (int) ((long long) x * y % md);
}

inline int power(int x, int y) {
  int res = 1;
  while (y) {
    if (y & 1) {
      res = mul(res, x);
    }
    x = mul(x, x);
    y >>= 1;
  }
  return res;
}

inline int inv(int a) {
  int b = md, u = 0, v = 1;
  while (a) {
    int t = b / a;
    b -= t * a;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  if (u < 0) {
    u += md;
  }
  return u;
}

namespace ntt {
int base = 1, root = -1, max_base = -1;
vector<int> rev = {0, 1}, roots = {0, 1};
void init() {
  int temp = md - 1;
  max_base = 0;
  while (temp % 2 == 0) {
    temp >>= 1;
    ++max_base;
  }
  root = 2;
  while (true) {
    if (power(root, 1 << max_base) == 1 && power(root, 1 << (max_base - 1)) != 1) {
      break;
    }
    ++root;
  }
}
void ensure_base(int nbase) {
  if (max_base == -1) {
    init();
  }
  if (nbase <= base) {
    return;
  }
  assert(nbase <= max_base);
  rev.resize(1 << nbase);
  for (int i = 0; i < 1 << nbase; ++i) {
    rev[i] = rev[i >> 1] >> 1 | (i & 1) << (nbase - 1);
  }
  roots.resize(1 << nbase);
  while (base < nbase) {
    int z = power(root, 1 << (max_base - 1 - base));
    for (int i = 1 << (base - 1); i < 1 << base; ++i) {
      roots[i << 1] = roots[i];
      roots[i << 1 | 1] = mul(roots[i], z);
    }
    ++base;
  }
}
void dft(vector<int> &a) {
  int n = a.size(), zeros = __builtin_ctz(n);
  ensure_base(zeros);
  int shift = base - zeros;
  for (int i = 0; i < n; ++i) {
    if (i < rev[i] >> shift) {
      swap(a[i], a[rev[i] >> shift]);
    }
  }
  for (int i = 1; i < n; i <<= 1) {
    for (int j = 0; j < n; j += i << 1) {
      for (int k = 0; k < i; ++k) {
        int x = a[j + k], y = mul(a[j + k + i], roots[i + k]);
        a[j + k] = (x + y) % md;
        a[j + k + i] = (x + md - y) % md;
      }
    }
  }
}
}

int n, m, fac[16384], ifac[16384];

int main() {
  scanf("%d%d", &n, &m);
  vector<int> f(16384), g(16384);
  int I = inv(16384);
  fac[0] = fac[1] = ifac[0] = ifac[1] = 1;
  for (int i = 2; i < 16384; i++) {
    fac[i] = mul(fac[i - 1], i);
    ifac[i] = mul(md - md / i, ifac[md % i]);
  }
  for (int i = 2; i < 16384; i++) {
    ifac[i] = mul(ifac[i], ifac[i - 1]);
  }
  f[0] = 1;
  for (int i = 1; i < 8192; i++) {
    g[i] = ifac[i + 2];
  }
  ntt::dft(g);
  for (int i = 1; i <= m; i++) {
    vector<int> h(16384);
    for (int i = 0; i < 8192; i++) {
      h[i] = mul(f[i], 1 + i + i * (i - 1) / 2);
      f[i] = mul(f[i], ifac[i]);
    }
    ntt::dft(f);
    for (int i = 0; i < 16384; i++) {
      f[i] = mul(f[i], mul(g[i], I));
    }
    reverse(f.begin() + 1, f.end());
    ntt::dft(f);
    for (int i = 0; i < 8192; i++) {
      add(h[i], mul(f[i], fac[i + 2]));
    }
    f = h;
  }
  int ans = 0;
  for (int i = 0; i <= n; i++) {
    add(ans, mul(mul(fac[n], mul(ifac[i], ifac[n - i])), f[i]));
  }
  printf("%d\n", ans);
}


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

struct flower {
    int ht, bty;
};

int solve(vector<flower>& vec, int N) {
    map<int, int> meaningful;
    int dp[N], ans = vec[0].bty;
    dp[0] = vec[0].bty;
    meaningful[vec[0].ht] = dp[0];

    for(int i=1; i<N; i++) {
        dp[i] = vec[i].bty;
        auto it = meaningful.lower_bound(vec[i].ht + 1);
        if(it != meaningful.begin()) {
            it--;
            dp[i]+= it->second;
        }
        meaningful[vec[i].ht] = dp[i];
        it = meaningful.upper_bound(vec[i].ht);
        while(it != meaningful.end() && it->second <= dp[i]) {
            auto tmp = it;
            tmp++;
            meaningful.erase(it);
            it = tmp;
        }
        ans = max(ans, dp[i]);
    }
    return ans;
}

int32_t main() {
    int N; cin>>N;
    vector<flower> vec(N);
    for(int i=0; i<N; i++) cin>>vec[i].ht;
    for(int i=0; i<N; i++) cin>>vec[i].bty;

    cout<<solve(vec, N)<<endl;
    return 0;
}


Measured memory_bytes: 20420
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<list>
#include<cmath>
using namespace std;
using ll = long long;
const int INF = 1e9;
int main() {
	int N, K;
	cin >> N >> K;
	int x[100010];
	for (int i = 0; i < N; ++i) {
		cin >> x[i];
	}
	int xmax, xmin;
	int ans = INF;
	for (int i = 0; i <= N - K;++i){
			int sum = 0;
			xmax = x[i+K-1];
			xmin = x[i];
			int ans1 = abs(xmin) + abs(xmax - xmin);
			int ans2 = abs(xmax) + abs(xmin - xmax);
			sum+= min(ans1, ans2);
			ans = min(sum, ans);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

struct points {
	int y1, x1, y2, x2;
};

int main() {

	int h, w; cin >> h >> w;

	vector<vector<int>> a(h, vector<int>(w));

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

			a[i][j] = a[i][j] % 2;
		}
	}

	vector<points> ans;


	for (int i = 0; i <h; i++) {
		for (int j = 0; j < w-1; j++) {
			if (a[i][j] == 1) {
				a[i][j + 1] = (a[i][j + 1] + a[i][j]) % 2;

				points p;
				p.y1 = i;
				p.x1 = j;

				p.y2 = i;
				p.x2 = j + 1;

				ans.push_back(p);
			}

			
		}
	}

	for (int i = 0; i < h-1; i++) {
		if (a[i][w - 1] == 1) {
			a[i+1][w-1] = (a[i+1][w-1] + a[i][w-1]) % 2;

			points p;
			p.y1 = i;
			p.x1 = w - 1;

			p.y2 = i + 1;
			p.x2 = w - 1;

			ans.push_back(p);
		}

		
	}

	cout << ans.size() << endl;

	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i].y1+1 << " " << ans[i].x1+1 << " " << ans[i].y2+1 << " " << ans[i].x2+1 << endl;
	}

	return 0;
}

Measured memory_bytes: 5232
#include<bits/stdc++.h>
#define MAX 1000000007
#define ll long long int
#define fo(i,a,n) for(int i=a;i<n;i++)
#define ull unsigned long long int
#define pb push_back
#define eb emplace_back
using namespace std;


class DisjointSet{

public:

    int *parent;
    // pointer to array containing depth of each representative node...
    int *rank;

    DisjointSet(int n){
        parent = new int[n];
        rank = new int[n];
        for(int i=0;i<n;i++){
            parent[i] = i;
            rank[i]=1;
        }
    }

    // make a new set with v as a parent..
    void make_set(int v){
        parent[v] = v;
    }

    // find the set in which vertex v belongs....
    int find_set(int v){
        if(parent[v]==v){
            return v;
        }
        // applying path compression technique to improve amortized time complexity...
        return parent[v] = find_set(parent[v]);
    }

    // merge two sets in which elements a and b are located....
    void union_sets(int a, int b){
        int sa = find_set(a);
        int sb = find_set(b);
        if(sa==sb)
            return;

        // using union rank technique to optimize tree height...
        if(rank[sa] < rank[sb])
            swap(sa,sb);
        
        parent[sb] = sa;
        // in this case rank of one of the tree will increase...
        rank[sa] += rank[sb];
    }

    // return size of subset element belong to...
    int size(int v){
        return rank[find_set(v)];
    }

};


int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n,m;
    cin>>n>>m;

    DisjointSet ds(n);

    int a,b;
    for(int i=0;i<m;i++){
        cin>>a>>b;
        a--; b--;
        ds.union_sets(a,b);
    }

    int ans = 0;

    fo(i,0,n){
        ans = max(ans, ds.size(i));
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 5212
/*
ID: dorijan1
TASK: tu napisi ime zadatka molim te molim te ali samo ako si na usaco training
LANG: C++11
*/
#include <bits/stdc++.h>

using namespace std;

const int MOD=1000000007;
typedef long long int ll;
const ll LLINF=1ll<<60;
const char en='\n';

void yes() {cout<<"YES"<<en; exit(0);}
void no() {cout<<"NO"<<en; exit(0);}

ll raand()
{
   return rand()*RAND_MAX+rand();
}

ll sti(string a)
{
	ll k=0;
	for (int i=0;i<a.size();++i)
	{
		k*=10;
		k+=a[i]-'0';
	}
	return k;
}

string its(ll k)
{
	if (k==0) return "0";
	string a;
	while (k)
	{
		a.push_back((k%10)+'0');
		k/=10;
	}
	reverse(a.begin(),a.end());
	return a;
}

int gcd(int a,int b)
{
	if (b==0) return a;
	return gcd(b,a%b);
}

template<class T,class K>
pair<T,K> mp(T a,K b)
{
	return make_pair(a,b);
}

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

ll pot(ll n,ll k)
{
	if (k==0) return 1;
	ll a=pot(n,k/2);
	a=mult(a,a);
	if (k%2) return mult(a,n);
	else return a;
}

ll divide(ll a,ll b)
{
	return mult(a,pot(b,MOD-2));
}

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

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

bool prime(ll a)
{
	if (a==1) return 0;
	for (int i=2;i<=round(sqrt(a));++i)
	{
		if (a%i==0) return 0;
	}
	return 1;
}

int n;
int h[200001];
int l[200010];
int se;
int am[200010];

int main()
{
	ios_base::sync_with_stdio(false);
	cin>>n;
	for (int i=0;i<n;++i)
	{
		cin>>h[i];
		if (am[h[i]]) l[h[i]]=l[h[i]-1]+1;
		else l[h[i]]=1;
		am[h[i]+1]=i+1;
	}
	for (int i=1;i<=n;++i) se=max(se,l[i]);
	cout<<n-se<<endl;
}



Measured memory_bytes: 2560
N,A,B = map(int, input().split())

count = 0
sum1 = 0

for i in range(1, N+1):
    i_str = str(i)
    tmp = 0
    for j in range(len(i_str)):
        tmp += int((i_str[j]))
    if A <= tmp <= B:
        sum1 += i
print(sum1)

Measured memory_bytes: 3060
#include<stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  while (n>0) {
    if (n%10==7) {
      printf("Yes");
      break;
    }
    n/=10;
    if (n<=0) {
      printf("No");
    }
  }
  return 0;
}

Measured memory_bytes: 1736
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            if (!S.StartsWith("A", StringComparison.CurrentCulture))
            {
                Console.WriteLine("WA");
                return;
            }
            int Ccount = 0;
            for (var i = 2; i < S.Length - 1; i++)
            {
                if (S[i].Equals('C'))
                    Ccount++;
            }
            if (Ccount != 1)
            {
                Console.WriteLine("WA");
                return;
            }

            foreach (char c in S)
            {
                if (c != 'A' && c != 'C' && !char.IsLower(c))
                {
                    Console.WriteLine("WA");
                    return;
                }
            }
            Console.WriteLine("AC");
        }
    }
}


Measured memory_bytes: 13396
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    intmax_t L;
    long double ans = 1;

    scanf("%jd", &L);

    ans *= ((long double)L / 3);
    ans *= ((long double)L / 3);
    ans *= ((long double)L / 3);

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

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
  string S;
  cin >> S;
  sort(S.begin(), S.end());
  if(S[0] == S[1] && S[1] != S[2] && S[2] == S[3]) cout << "Yes" << endl;
  else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using P = pair<ll,ll>;

using DV = vector<vector<ll>>;

using pqg = priority_queue<ll,vector<ll>, greater<ll> >; // 1,3,5..
using pql = priority_queue<ll,vector<ll> >; //5, 3, 1...

using pqg_p = priority_queue<P,vector<P>, greater<P> >; // 1,3,5..
using pql_p = priority_queue<P,vector<P> >; //5, 3, 1...

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)

#define F first
#define S second
#define PB push_back
#define MP make_pair




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

  int V,H,W;

  cin >> H >> W;

  V = 10;

  ll d[V][V];

  ll inf = 100000000000;

  REP(i,V) {
    REP(j,V) {
      ll c;
      cin >> c;

      d[i][j] = c;
    }
  }


  REP(k,V) {
    REP(i,V) {
      REP(j,V) {
        if(d[i][k] == inf || d[k][j] == inf) continue;
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }

  ll ans = 0;
  REP(h,H) {
    REP(w,W) {
      ll c;
      cin >> c;
      if (c == -1 ) continue;
      ans += d[c][1];
    }   
  }

  cout << ans << endl;




}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

i64 N, u, v;

vector<vector<i64>> G;

vector<i64> udist;
vector<i64> vdist;

void dfs(vector<i64>& dist, i64 x, i64 f) {
  for(auto y: G[x]) {
    if(y == f) continue;
    dist[y] = dist[x] + 1;
    dfs(dist, y, x);
  }
}

vector<i64> able;

void dfs_able(i64 x, i64 f) {
  if(udist[x] >= vdist[x]) {
    able[x] = 0;
    return;
  }
  able[x] = 1;
  for(auto y: G[x]) {
    if(y == f) continue;
    dfs_able(y, x);
  }
}

int main() {
  cin >> N >> u >> v;
  u--;
  v--;
  G.resize(N);
  udist.resize(N);
  vdist.resize(N);
  able.resize(N);
  rep(i,0,N - 1) {
    i64 a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  udist[u] = 0;
  dfs(udist, u, -1);
  vdist[v] = 0;
  dfs(vdist, v, -1);

  dfs_able(u, -1);

  i64 MAX = 0;
  rep(i,0,N) {
    if(able[i]) {
      i64 cost = udist[i];
      i64 remain = vdist[i] - udist[i];
      cost += remain - 1;
      MAX = std::max(MAX, cost);
    }
  }
  cout << MAX << endl;
}


Measured memory_bytes: 13440
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int counter = 1;
		int a = sc.nextInt();
		while (a != 0) {
			System.out.println("Case " + counter + ": " + a);
			a = sc.nextInt();
			counter += 1;
		}
	}
}


Measured memory_bytes: 33048
#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<ll> par;
//     vector<ll> siz;
    
//     UnionFind(ll N): par(N), siz(N,1LL) {
//         for (ll i=0;i<N;i++) par[i] = i;
//     }

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

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

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

//     ll size(ll x) {
//         return siz[root(x)];
//     }
// };

int main(void) {
    int N, K;
    cin >> N >> K;
    vector<int> p(200010);
    for (int i=0;i<N;i++) cin >> p[i];
    // vector<double> q(200010,0.0);
    // for (int i=0;i<N;i++) {
    //     q[i] += (p[i]+1)/2.0;
    //     q[i] -= (p[i]+1)/2.0;
    // }
    ll X = 0;
    for (int i=0;i<K;i++) X += p[i];
    double m = (X+K)/2.0;
    for (int i=K;i<N;i++) {
        X += p[i] - p[i-K];
        m = max(m, (X+K)/2.0);
    }
    cout << fixed << setprecision(10) << m << endl;

    return 0;
}


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

using namespace std;

long long kek(int x) {
  return 1ll * x * (x - 1) / 2;
}

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

  int n;
  cin >> n;
  vector<int> a(n), cnt(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    ++cnt[--a[i]];
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += kek(cnt[i]);
  }
  for (int i = 0; i < n; ++i) {
    ans -= kek(cnt[a[i]]);
    --cnt[a[i]];
    ans += kek(cnt[a[i]]);
    cout << ans << '\n';
    ans -= kek(cnt[a[i]]);
    ++cnt[a[i]];
    ans += kek(cnt[a[i]]);
  }

  return 0;
}

Measured memory_bytes: 4224
s = str(input())
t = str(input())

d = {}

c = 0
for i in range(len(s)):
  if s[i] not in d:
    d[s[i]] = c
    c += 1

d_ = {}
used = set()
for i in range(len(t)):
  if t[i] not in d_ and s[i] not in used:
    d_[t[i]] = d[s[i]]
    used.add(s[i])
  elif t[i] not in d_ and s[i] in used:
    print('No')
    exit()
  else:
    pass

for i in range(len(s)):
  if d[s[i]] != d_[t[i]]:
    print('No')
    exit()
else:
  print('Yes')

Measured memory_bytes: 41932
from sys import stdin
import math
n = int(stdin.readline())
a = list(map(int,stdin.readline().split()))
a.sort()
ans = 0
maxval = a[-1]
seen = set()
for i in range(n):
    if a[i] not in seen and (i == n-1 or a[i] != a[i+1]):
        ans += 1
    j = a[i]
    while j <= maxval:
        seen.add(j)
        j += a[i]
print(ans)

Measured memory_bytes: 217892
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

const lint MOD = pow(10, 9) + 7;

lint gcd(lint a, lint b) {
	//aとbの最大公約数を返す
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(a % b, b);
}

lint lcm(lint a, lint b) {
	//aとbの最小公倍数を返す
	return a / gcd(a, b) * b;
}

lint sgm(lint n) {
	//0からの総和を返す
	return n * (n + 1) / 2;
}

lint fact(lint n) {
	//n!を返す
	if (n == 0) return 1;
	else return n * fact(n - 1);
}

lint power(lint x, lint n, lint m) {
	//(x^n)%mを返す
	lint res = 1;
	x %= m;
	while (n > 0) {
		if (n % 2 == 1) {
			res = res * x % m;
		}
		x = x * x % m;
		n /= 2;
	}
	return res;
}

/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/


int main() {
	int X;
	cin >> X;
	vector<int>V(41);
	V = { 1,4,8,16,32,64,128,256,512,
	9,27,81,243,729,25,125,625,
	36,216,49,343,100,1000,121,144,
	169,196,225,289,324,361,400,
	441,484,529,576,676,784,
	841,900,961 };
	sort(V);
	reverse(V);
	rep(i, 41) {
		if (V[i] <= X) {
			cout << V[i] << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define db double

using namespace std;

int n; db d,x,ans;

int main(){
	scanf("%d%lf%lf",&n,&d,&x);
	while (n){
		ans+=(2*d+(2*n-1)*x)*0.5;
		d+=(2.0*d+5.0*x)*0.5/n; x+=2.0*x/n;
		n--;
	}
	printf("%.15lf\n",ans);
	return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    cin >> N;
    vector<tuple<ll, string, ll>> S(N);
    rep(i, N) {
        get<0>(S[i]) = i + 1;
        cin >> get<1>(S[i]) >> get<2>(S[i]);
    }
    sort(S.begin(), S.end(), [](tuple<ll, string, ll> &a, tuple<ll, string, ll> &b) {
        return get<1>(a) < get<1>(b) || (get<1>(a) == get<1>(b) && get<2>(a) > get<2>(b));
    });
    iter(i, S) cout << get<0>(i) << endl;
    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vv = vector<vi>;
using vvv = vector<vv>;
using P  = pair<int,int>;
using vP   = vector<P>;
using vvP  = vector<vP>;
using vvvP = vector<vvP>;
using t3   = tuple<int,int,int>;

const int INF = 1001001001;

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    x1--; y1--; x2--; y2--;
    
    vector<string> s(h);
    rep(i,h)cin>>s[i];
    
    vvv cost(h, vv(w, vi(4, INF)));
    vvv used(h, vv(w, vi(4,   0)));
    priority_queue<P, vector<P>, greater<P>> q;
    
    rep(i,4){
        cost[x1][y1][i]=0;
        used[x1][y1][i]=0;
        q.push(P(0, (x1*w+y1)*4+i));//始点, 全方位
    }
    
    vector<int> dx={0,1,0,-1};
    vector<int> dy={1,0,-1,0};
    
    while(!q.empty()){
        int c  = q.top().first;//コスト
        int p  = q.top().second;//場所,方向
        int go = c%k;//その方向に何マス直進してきたか
        c /= k;
        
        int px = p/(4*w);//x座標
        int py = (p/4)%w;//y座標
        int d  = p%4;//方向
        q.pop();
        
        if(used[px][py][d])continue;
        used[px][py][d] = 1;
        
        //if(c*k+go>cost[px][py][d])continue;
        cost[px][py][d] = c*k+go;
        
        //左右に向きを変える遷移
        if(!used[px][py][(d+1)%4])q.push(P(((c*k+go+k-1)/k)*k,(px*w+py)*4+(d+1)%4));
        if(!used[px][py][(d+3)%4])q.push(P(((c*k+go+k-1)/k)*k,(px*w+py)*4+(d+3)%4));
        
        //直進する遷移
        int nx = px+dx[d];
        int ny = py+dy[d];
        if(nx<0 || ny<0 || nx>=h || ny>=w)continue;
        if(s[nx][ny]=='@')continue;
        
        if(!used[nx][ny][d])q.push(P(c*k+go+1, (nx*w+ny)*4+d));
        
    }
    
    int ans = INF;
    
    rep(i,4)ans = min(ans, cost[x2][y2][i]);
    cout << (ans==INF?-1:(ans+k-1)/k) << endl;
    return 0;
}

Measured memory_bytes: 168192
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,k,i,sum=0;
    cin>>k>>n;
    ll arr[n];
    for(i=0;i<n;i++){
        cin>>arr[i];
        sum+=arr[i];
    }
    if(sum>=k)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 1024
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

const int MOD = 1e9 + 7;
const int INF = INT_MAX;

signed main() {
    Fast();

    int n, m, x, y;

    cin >> n >> m >> x >> y;

    vector<int> xs;
    vector<int> ys;
    for(int i=0; i<n; i++)
    {
        int v;
        cin >> v;
        xs.push_back(v);
    }
    for(int i=0; i<m; i++)
    {
        int v;
        cin >> v;
        ys.push_back(v);
    }

    xs.push_back(x);
    ys.push_back(y);

    int max_x = *max_element(xs.begin(), xs.end());
    int min_y = *min_element(ys.begin(), ys.end());

    if(max_x < min_y) cout << "No War";
    else cout << "War";

    cout << endl;

    return 0;
}



Measured memory_bytes: 256