akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
	int n,m;
	cin>>n>>m;
	
	int h[n]={0};
	for(int i=0;i<n;i++) cin>>h[i];
	
	vector<int> ans(n,1);  // Initialize all 1
	
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		if(h[a-1]>h[b-1]) ans[b-1]=0;
		else if(h[a-1]<h[b-1]) ans[a-1]=0;
		else ans[a-1]=ans[b-1]=0;
	}
	int sum=0;
	for(int i=0;i<n;i++){
		sum+=ans[i];
	}
	cout << sum << endl;
}

Measured memory_bytes: 4020
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;
 
#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int main() {
  char x,y;
  cin >> x >> y;
  if(x > y)
    cout << ">" << endl;
  else if(x < y)
    cout << "<" << endl;
  else
    cout << "=" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	double d;
	while(cin >> d)
	{
		if(91.00 < d) cout << "heavy" << endl;
		if(81.00 < d && d <= 91.00) cout << "light heavy" << endl;
		if(75.00 < d && d <= 81.00) cout << "middle" << endl;
		if(69.00 < d && d <= 75.00) cout << "light middle" << endl;
		if(64.00 < d && d <= 69.00) cout << "welter" << endl;
		if(60.00 < d && d <= 64.00) cout << "light welter" << endl;
		if(57.00 < d && d <= 60.00) cout << "light" << endl;
		if(54.00 < d && d <= 57.00) cout << "feather" << endl;
		if(51.00 < d && d <= 54.00) cout << "bantam" << endl;
		if(48.00 < d && d <= 51.00) cout << "fly" << endl;
		if(d <= 48.00) cout << "light fly" << endl;
	}
	return 0;
}

Measured memory_bytes: 1216
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);    
        int N=0;
        N = sc.nextInt();
        int[] A;
        A = new int[N];
        int count=0;
        for(count=0;count<N;count++){
            A[count] = sc.nextInt();
        }
        
        int i;
        int j;
        int minj;
        int z=0;
        int swap=0;
        for(i=0;i<N;i++){
            minj = i;
            for(j=i;j<N;j++){
                if(A[j] < A[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                z = A[i];
                A[i] = A[minj];
                A[minj] = z;
                swap++;
            }
        }

        for(i=0;i<N-1;i++){
            System.out.print(A[i]+" ");
        }
        System.out.println(A[N-1]);
        System.out.println(swap);   
        sc.close();
    }
}


Measured memory_bytes: 26416
#include "bits/stdc++.h"

using namespace std;

long long dp[105][105];
bool memoize[105][105];

int arr[105];

string s;
int k;

long long solve(int pos, int one = 0, bool flag = 1, bool take = 0) {  
      if (pos < 0) return one == k;  
      long long &ret = dp[pos][one];  
      bool &mem = memoize[pos][one];  
      if (!flag && take && mem) return ret;  
      int loop = 9;  
      if (flag) {
	loop = arr[pos];  
	}	
      long long sum = 0;  
      for (int i = 0; i <= loop; i++) {  
            if (!take && i == 0) sum += solve(pos-1, 0, 0, 0);  
            else sum += solve(pos-1, one + (i > 0), flag & i == arr[pos], 1);  
      }  
      if (!flag && take) {
		mem = 1, ret = sum;  
      }
	return sum;  
} 

long long digitDp() {
	int len = 0;
	for (int i = s.size() - 1; i >= 0; i--) {
		arr[len++] = s[i] - '0';
	}
	return solve(len - 1);
}

signed main() {
	cin >> s >> k;
	cout << digitDp() << endl;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pop pop_back()
#define sz size()
using namespace std;
typedef long long ll;
bool isPrime(ll n)
{
    if(n==1)
        return false;
    for(ll i=2;i*i<=n;i++)
        if(n%i==0)
        return false;
    return true;
}
unordered_map<ll,ll>mapp;
ll ma=-999,mi=100000000000,my=-999999999999999999,miy=100000000000;
///////////////////////////////////////////
ll cnt=0,n,m,x,y,i,j,k,l,r,d,t,in=-1,sum,in1=0;
string s[1000];
ll bo[1000];
int main(){
    ios_base::sync_with_stdio(0);
    cin>>n>>m;
    for(i=1;i<=n;i++){
        cin>>s[i];
    }
    sort(s+1,s+n+1);
    for(i=1;i<=n;i++){
        cout<<s[i];
    }
}




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

int main() {
    int n;
    cin >> n;
    vector<pair<ll, ll>> pos(n);
    for(int i = 0; i < n; i++) cin >> pos[i].first >> pos[i].second;

    // すべてのiについてパリティが一致しているかチェック．一致していなければ-1．
    // 同時に，座標を45度回転させ(x+y, x-y)とする．後続処理でここに辿りつくステップを考える．
    int par = (abs(pos[0].first) + abs(pos[0].second)) % 2;
    for (int i = 0; i < n; i++) {
        int tmp = (abs(pos[i].first) + abs(pos[i].second)) % 2;
        pos[i] = pair<ll, ll>(pos[i].first + pos[i].second, pos[i].first - pos[i].second);
        if (tmp != par) {
            cout << -1 << endl;
            return 0;
        }
    }

    vector<ll> d;
    for(int i = 30; i >= 0; i--) d.emplace_back(1LL<<i);
    if (par % 2 == 0) d.emplace_back(1);
    cout << d.size() << endl;
    for (int j = 0; j < d.size(); j++) cout << d[j] << " ";
    cout << endl;

    for (int i = 0; i < n; i++) {
        int xdir, ydir;
        ll xsum = 0, ysum = 0;
        for (int j = 0; j < (int)d.size(); j++) {
            if (xsum <= pos[i].first) xdir = 1, xsum += d[j];
            else xdir = -1, xsum -= d[j];
            if (ysum <= pos[i].second) ydir = 1, ysum += d[j];
            else ydir = -1, ysum -= d[j];

            if (xdir == 1 && ydir == 1) cout << "R";
            else if (xdir == 1 && ydir == -1) cout << "U";
            else if (xdir == -1 && ydir == -1) cout << "L";
            else cout << "D";
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		double a[] = new double[n];
		for(int i=0;i<n;i++) {
			a[i]=sc.nextInt();
		}
		Arrays.sort(a);
		double ans=a[0];	
		for(int i=1;i<n;i++){
			ans+=a[i];
			ans/=2;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
#include<iostream>
using namespace std;
int main(){
  int sum=0;
  int cnt[27];
  char s[4];
  
  for (int i = 0; i < 27; i++){
   cnt[i] = 0; 
  }
  
  cin >> s;
  
  for (int i = 0; i < 4; i++){
    int j = 0;
  	for (char alp = 'A'; alp <= 'Z' ; alp++) {
    	if (s[i] == alp) {
        	cnt[j]++;
          	//cout << "cnt=" << cnt[j];
        }
 		j++;
  	}
  }
  
  for (int i = 0; i < 27; i++) {
   	if(cnt[i] == 2) {
    	sum += 1; 
     	//cout << "sum=" << sum << endl;
    }	
  }
  
  if (sum == 2){
   cout << "Yes" << endl; 
  }
  else {
  	cout << "No" << endl;
  }
//  cout << cnt;
  return 0;
}

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back

using namespace std;

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

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll LINF=1LL<<60, lmod = 1e9+7;
const int MAX_N = 100005;

vector<Pl> graph[MAX_N];
ll d[MAX_N];

int main(){
  int N,M; scanf("%d%d",&N,&M);
  rep(i,M){
    int l,r; ll dd; scanf("%d%d%lld",&l,&r,&dd);
    l--; r--; graph[l].pb(Pl(r,dd)); graph[r].pb(Pl(l,-dd));
  }
  fill(d,d+N,-LINF);
  queue<int> que;
  rep(i,N){
    if(d[i]!=-LINF) continue;
    d[i] = 0LL; que.push(i);
    while(!que.empty()){
      int u = que.front(); que.pop();
      for(Pl pl: graph[u]){
        int v; ll di;
        tie(v,di) = pl;
        if(d[v]!=-LINF){
          if(d[v]!=d[u]+di){
            cout << "No" << endl;
            return 0;
          } 
        }else{
          d[v] = d[u] + di;
          que.push(v);
        }
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

int main(void) {
  int n, i, j=0;
  int* p;
  scanf("%d", &n);
  p = (int*)malloc(n*sizeof(int));
  for(i=0; i<n; i++) {
    scanf("%d", &p[i]);
  }
  for(i=0; i<n-2; i++) {
    if(p[i] < p[i+1] && p[i+1] < p[i+2] || p[i+2] < p[i+1] && p[i+1] < p[i]) {
      j++;
    }
  }
  printf("%d\n", j);
  return 0;
}


Measured memory_bytes: 128
#include <cassert>
#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>
*/

// 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 <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>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

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

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  std::vector<ll> v(n);
  rep(i,n) cin>>v[i];
  sort(all(v));
  cout<<abs(v[n-1] - v[0])<<endl;

}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 892
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:268435456")
#pragma warning( disable : 6031)
#pragma warning( disable : 4244)
#pragma warning( disable : 26451)
#endif
#ifndef _MSC_VER
#pragma GCC target ("sse4.2")
#endif
#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#  define __builtin_popcountll __popcnt64
#include <intrin.h>

static inline int __builtin_ctz(unsigned x) {
    unsigned long ret;
    _BitScanForward(&ret, x);
    return (int)ret;
}
static inline int __builtin_ctzll(unsigned long long x) {
    unsigned long ret;
    _BitScanForward64(&ret, x);
    return (int)ret;
}
static inline int __builtin_clz(unsigned x) {
    return (int)__lzcnt(x);
}

static inline int __builtin_clzll(unsigned long long x) {
    return (int)__lzcnt64(x);
}
#endif
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdint>
#include <climits>
#include <cassert>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <random>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <chrono>
#include <array>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)
#define ar array

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef pair<ll, ll> pll;
typedef vector< pii > vpii;
typedef vector< pll > vpll;
typedef vector<ll> vl;
typedef vector<vector<long long>> vvl;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef tuple<int, int, int> tiii;
const long long mod = int(1e9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;



int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
#ifdef LOCAL_MACHINE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
#endif
    
    int n, k;
    cin >> n >> k;
    vi a(n);
    for (auto& x : a)
        cin >> x;
    int l = 1, r = *max_element(all(a));
    int res = INT_MAX;
    while (l <= r) {
        int mid = l + (r - l) / 2;
        long long tk = 0;
        for (int i = 0; i < n; i++)
            tk += (a[i] + mid - 1) / mid - 1;
        if (tk <= k) {
            res = min(res, mid);
            r = mid - 1;
        }
        else
            l = mid + 1;
    }
    cout << res;
    return 0;    
}

Measured memory_bytes: 4028
A,B,H,M=map(int,input().split())
import math

if abs(H*30+M*0.5-M*6)<=180:
    C=A**2+B**2-2*A*B*math.cos(math.radians(abs(H*30+M*0.5-M*6)))
    print(math.sqrt(C))
else:
    C=A**2+B**2-2*A*B*math.cos(math.radians((360-abs(H*30+M*0.5-M*6))))
    print(math.sqrt(C))

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int res(int s, int e) {
	if (s <= e) return e - s;
	return s - e + 2;
}
int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int X, Y; cin >> X >> Y;
	int ans = res(X, Y);
	ans = min(ans, 1 + res(-X, Y));
	ans = min(ans, 1 + res(X, -Y));
	ans = min(ans, 2 + res(-X, -Y));
	print(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define VMAX 100000
#define MAXLOOP 200000000
void solve(long long N, long long W, vector<long long> w, vector<long long> p){
  long long vmax = (MAXLOOP/N)/13;
  vector<vector<long long>> dp(N, vector<long long>(vmax+1, LLONG_MAX));
  dp[0][0] = 0;
  dp[0][p[0]] = w[0];

  for(long long i = 1; i < N; i++) {
    for(long long j = 0; j <= vmax; j++) {
      long long source = j - p[i];
      if(source < 0 || dp[i-1][source] == LLONG_MAX) {
        dp[i][j] = dp[i-1][j];
        continue;
      }

      dp[i][j] = min(dp[i-1][j], dp[i-1][source] + w[i]);
    }
  }


  #ifdef DEBUG
  for(long long i = 0; i < N; i++) {
    for(long long j = 0; j <= VMAX; j++) {
      if(dp[i][j] != LLONG_MAX) {
        cout << "[" << i << "][" << j << "]=" << dp[i][j] << " ";
      }
    }

    cout << endl;
  }
  #endif

  for(long long j = vmax; j >= 0; j--) {
    if(dp[N-1][j] <= W) {
      cout << j << endl;
      break;
    }
  }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  long long W;
  scanf("%lld",&W);
  vector<long long> ws;
  vector<long long> ps;
  long long w, p;
  for(int i = 0 ; i < N ; i++){
    cin >> w >> p;
    ws.push_back(w);
    ps.push_back(p);
  }
    solve(N, W, std::move(ws), std::move(ps));
    return 0;
}


Measured memory_bytes: 240640
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <iomanip>

using namespace std;


int main(void)
{
     int n;
    while(cin>>n){
        if(n==-1)break;
        double x,y;
        x=1.0;
        y=0.0;
        for(int i=0; i<n-1; i++){
            double temp_x=x;
            double temp_y=y;
            y+=sin((M_PI_2-atan2(temp_y, temp_x)));
            x-=cos((M_PI_2-atan2(temp_y, temp_x)));
        }
        cout<<x<<endl<<y<<endl;
    }
    
}

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

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define EACH(begin, end) for(auto itr = (begin); itr != (end); itr++)

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;



ll N = 0;
string S;
ll K = 0;
ll ret = 0;

void input() {
  IN(N);
  IN(S);
  IN(K);
}

void solve() {
  char c = S[K-1];
  for (ll i = 0; i<N; i++) {
    char out = S[i];
    if (c != out) {
      out = '*';
    }
    cout << out;
  }
  cout << endl;
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long x,k,d; 
int main(){
	cin>>x>>k>>d;
	long long t=x/d;
	x=abs(x);
	if(x/d>k){
		cout<<abs(x-k*d);
		return 0;
	}else{
		if((k-x/d)%2==0){
			cout<<abs(x-(x/d)*d);
			return 0;
		}else{
			cout<<abs(x-(x/d+1)*d);
		}
	}
	return 0;
} 

Measured memory_bytes: 3632
#pragma GCC optimize("Ofast,vpt,unroll-loops,shrink-wrap-separate,loop-nest-optimize")
 
#include <bits/stdc++.h>
// #include <tr1/unordered_map>
// #include <ext/rope>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/trie_policy.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
#define IOS ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define mt make_tuple
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define mat vector<vector<ll>>
#define mat2 vector<vector<mat>>
#define vi vector<int>
#define vll vector<ll>
#define lll __int128_t
#define psi pair<string, int>
#define pis pair<int, string>
#define pic pair<int, char>
#define pcc pair<char, char>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define piiii pair<pii, pii>
#define mii map<int, int>
#define umii tr1::unordered_map<int, int>
#define iter vector<int>::iterator
#define lb lower_bound
#define ub upper_bound
 

#define fi first
#define se second

/*
#define fi first.first
#define se first.second
#define th second.first
#define fo second.second
*/

/*
#define piii pair<int, pii>
#define fi first
#define se second.fi
#define th second.second
*/
 
/*
#define piii pair<pii, int>
#define fi first.first
#define se first.th
#define th second
*/
 
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
 
using namespace std;
// using namespace __gnu_cxx;
// using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
// typedef tree<pii, null_type, greater<pii>, rb_tree_tag, tree_order_statistics_node_update> ost;
 
const int nax = 500005, lgax = 24, bit = 64, mod = 1000000007, inf = 1000000007;
const ll llax = 9e18;
// const ld pi = 3.14159265358979323846, eps = 1e-7;
 
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

inline int read() {
	char c = getchar_unlocked();
	int t = 0, f = 1;
	while (!isdigit(c) && c != EOF)
		f = (c == '-' ? -1 : 1), c = getchar_unlocked();
	while (isdigit(c) && c != EOF)
		t = t * 10 + c - '0', c = getchar_unlocked();
	return t * f;
}

inline void read(char* s) {
	char c = getchar_unlocked();
	while (isspace(c))
		c = getchar_unlocked();
	while (!isspace(c))
		*s++ = c, c = getchar_unlocked();
	*s = '\0';
}

/*
struct chash {
	static uint64_t splitmix64(uint64_t x)
	{
		x += 0x9e3779b97f4a7c15;
		x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
		x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
		return x ^ (x >> 31);
	}
	size_t operator()(uint64_t x) const
	{
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		return splitmix64(x + FIXED_RANDOM);
	}
};
*/

int main() {
	int n = read(), k = read(),  l = 1, r = inf, m, cnt;
	vi a(n);
	for (int& i : a)
		i = read();
	while (l < r) {
		m = (l + r) / 2, cnt = 0;
		for (int i : a)
			cnt += (i + m - 1) / m - 1;
		if (cnt > k)
			l = m + 1;
		else
			r = m;
	}
	printf("%d\n", l);
	return 0;
}


Measured memory_bytes: 3920
#include <stdio.h>

int main(void){
	int a, b;
	scanf("%2d%2d", &a, &b);
	if(1 <= a && a <= 12){
		if(1 <= b && b <= 12)printf("AMBIGUOUS\n");
		else printf("MMYY\n");
	}else{
		if(1 <= b && b <= 12)printf("YYMM\n");
		else printf("NA\n");
	}
	return 0;
}


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

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

Measured memory_bytes: 3604
x = input().split('/')
flag = 0
if int(x[0]) > 2019:
    flag = 1
elif int(x[0]) == 2019 :
    if int(x[1]) > 4:
        flag = 1
    
if flag == 0:
    print('Heisei')
else:
    print('TBD')


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);
    string A, B;
    cin >> A >> B;

    if(A.length() > B.length()){
        cout << "GREATER" << endl;
        return 0;
    }
    if(A.length() < B.length()){
        cout << "LESS" << endl;
        return 0;
    }

    REP(i, A.length()){
        if(A[i]-'0' > B[i]-'0'){
            cout << "GREATER" << endl;
            return 0;
        }
        if(A[i]-'0' < B[i]-'0'){
            cout << "LESS" << endl;
            return 0;
        }
    }
    cout << "EQUAL" << endl;
    return 0;
}

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

int main() {
    int N;
    int t[110000], x[110000], y[110000];
    cin >> N;
    t[0] = x[0] = y[0] = 0;  // 初期状態                                                                                                                                                                    
    for (int i = 0; i < N; ++i) cin >> t[i+1] >> x[i+1] >> y[i+1];  // 1-index にしておく                                                                                                                   

    bool can = true;
    for (int i = 0; i < N; ++i) {
	int dt = t[i+1] - t[i];
	int dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
	if (dt < dist) can = false;
	if (dist % 2 != dt % 2) can = false;  // dist と dt の偶奇は一致する必要あり！                                                                                                                      
    }

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



Measured memory_bytes: 1408
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
//#include <utility>
#include <set>
#include <iostream>
//#include <memory>
#include <string>
#include <vector>
#include <algorithm>
//#include <functional>
#include <sstream>
//#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
//#include <cctype>
#include <cstring>
//#include <ctime>
#include <iterator>
#include <bitset>
//#include <numeric>
//#include <list>
//#include <iomanip>
#include <unordered_map>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define map unordered_map

#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;
vint ma(1000010);
priority_queue<pll> pq;

void mainmain(){
	ll n,q;
	cin>>n>>q;
	pq.push(mkp(0,-1));
	rep(i,q){
		ll a,b;
		cin>>a>>b;
		ll c=ma[a]+=b;
		pq.push(mkp(c,-a));
		while(1){
			pii top=pq.top();
			if(ma[-top.S]!=top.F){
				pq.pop();
				continue;
			}
			else{
				cout<<-top.S<<" "<<top.F<<endl;
				break;
			}
		}
	}
}

}
main() try{
    mainmain();
}
catch(...){
}

Measured memory_bytes: 7060
n, t = map(int, input().split())

ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort()

a = []
b = []
for ai, bi in ab:
    a.append(ai)
    b.append(bi)

dp = [[0 for j in range(t+1)] for i in range(n+1)]

for i in range(n):
    for j in range(t):
        if j + a[i] <= t-1:
            if dp[i+1][j + a[i]] < dp[i][j] + b[i]:
                dp[i+1][j + a[i]] = dp[i][j] + b[i]
        if dp[i+1][j] < dp[i][j]:
            dp[i+1][j] = dp[i][j]

ans = 0

for i in range(n):
    ans = max(ans, dp[i][t-1] + b[i])

print(ans)






Measured memory_bytes: 124504
/*
　　　　 ∧＿∧　にっぽんちゃちゃちゃ
　／＼（　・∀・）／ヽ
（ ●　と　　　つ　● ）　にっぽんちゃちゃちゃ
　＼/⊂、 ノ　　＼ノ
　　　　　し'
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define MOD 1000000007
#define INF 9223372036854775807

signed main()
{
int x=0,y=0,z=0,w=0,n=0,d=0;
std::cin >> x>>y;
x+=1;
rep(i,y){
  std::cin >> z;
  w+=z;
}
if(w<x)std::cout << 1 << '\n';
else if(w%x==0)std::cout << w/x << '\n';
else std::cout << w/x+1 << '\n';
}



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

typedef long long ll;
#define all(x) (x).begin(),(x).end()

int main(){
    
    int H,W;cin>>H>>W;
    vector<vector<int>> S(H,vector<int>(W)),T(H,vector<int>(W));
    for(int i=0;i<H;i++){
        string a;cin>>a;
        int cnt=0;
        for(int j=0;j<W;j++){
            if(a[j]=='#'){
                cnt=0;
                S[i][j]=0;
            }else if(a[j]=='.'){
                cnt++;
                S[i][j]=cnt;
            }
        }
    }
    for(int i=0;i<H;i++){
        int cnt=0;
        for(int j=W-1;j>=0;j--){
            if(S[i][j]!=0){
                S[i][j]=max(S[i][j],cnt);
                cnt=S[i][j];
            }else if(S[i][j]==0){
                cnt=0;
            }
        }
    }
    for(int j=0;j<W;j++){
        int cnt=0;
        for(int i=0;i<H;i++){
            if(S[i][j]==0){
                T[i][j]=0;
                cnt=0;
            }else if(S[i][j]!=0){
                cnt++;
                T[i][j]=cnt;
            }
        }
    }
    for(int j=0;j<W;j++){
        int cnt=0;
        for(int i=H-1;i>=0;i--){
            if(T[i][j]!=0){
                T[i][j]=max(T[i][j],cnt);
                cnt=T[i][j];
            }else if(T[i][j]==0){
                cnt=0;
            }
        }
    }
    int ans=0;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            int a=S[i][j]+T[i][j]-1;
            ans=max(ans,a);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 33664
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define  show for(int j=0;j<v.size();j++) cout<<v[j]<<" ";
#define ld long double
#define e endl
#define bc __builtin_popcount
#define MOD 1000000007
#define INT_SIZE 32
#define me(x) memset(x,0,sizeof(x))
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
int main()
{
    int n,i;
    cin>>n;
    string s,s1,s2;
    cin>>s;
    if(n%2==1)
        cout<<"No";
    else{
    for(i=0;i<n/2;i++)
        s1+=s[i];
        for(i=n/2;i<n;i++)
            s2+=s[i];
            if(s1==s2)
                cout<<"Yes";
            else
                cout<<"No";
    }




}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n" 
#define ll long long 
#define sp " "
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	#ifndef ONLINE_JUDGE
    	freopen("input.txt", "r", stdin);
    	freopen("output.txt", "w", stdout);
	#endif
	ll q=1;//cin>>q;
	while(q--){
		int n;string s;cin>>n>>s;
		if(s.length()<=n)
			cout<<s;
		else 
			cout<<s.substr(0,n)<<"...";
	}
}


Measured memory_bytes: 3604
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int numOfChar = Integer.parseInt(sc.nextLine());
		String str = sc.nextLine();
		int sysoutResult = 0;
		for(int i = 0; i < numOfChar; i++){
			String str0 = str.substring(0,i);
			String str1 = str.substring(i,numOfChar);
			String[] inputStr = str0.split("");
			int count = 0;
			Set<String> set = new HashSet<>();
			for(int ii = 0; ii < i; ii++){
				set.add(inputStr[ii]);
			}
			Iterator<String> it = set.iterator();
			for(int ii = 0; ii < i; ii++){
				while(it.hasNext()){
					int result = str1.indexOf(it.next());
					if(result != -1){
						count = count + 1;
					}
				}
			}
			if(count > sysoutResult){
				sysoutResult = count;
			}
		}
		System.out.println(sysoutResult);
	}
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll ,ll >
#define pii pair<int, int> 
#define mod 1000000007
ll power(ll a,ll b){
    ll res=1;
    while(b>0){
        if(b%2!=0) res=(res*a);
        a=(a*a);
        b/=2;
    }
    return res;
}
ll ncr(ll n,ll k){
    if(k==0||k==n) return 1ll;
    if(k>n-k) k=n-k;
    ll pro=1;
    for(ll i=0;i<k;i++){
        pro=(pro*(n-i));
        pro/=(i+1);
    }
    return pro;
}
vector<int> prime;
void seive(){
    vector<bool > isprime(101,true);
    for(int i=2;i*i<=100;i++){
        if(isprime[i]){
            for(int j=i*i;j<=100;j+=i){
                isprime[j]=false;
            }
        }
    }
    for(int i=2;i<=100;i++){
        if(isprime[i]) prime.push_back(i);
    }
}
int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,m;
    cin>>n>>m;
    ll ans=ceil((m-1)/((n-1)*1.0));
    cout<<ans;
    return 0;
}


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

int main() {
  int N, ans = 0;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) cin >> vec.at(i);
  int minimum = N+1;
  for (int i = 0; i < N; i++) {
    minimum = min(minimum,vec.at(i));
    if (minimum == vec.at(i)) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
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; }

int allmin(vector<int>&v, int l, int r) {
	// [l,r)
	if (!(l < r))return 0;

	int x = distance(v.begin(), min_element(v.begin() + l, v.begin() + r));

	return (x - l + 1)*(r - x)*v[x] + allmin(v, l, x) + allmin(v, x + 1, r);
}


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N;
	vector<int> v(N), pos(N); rep(i, 0, N) {
		cin >> v[i];
		v[i]--;
		pos[v[i]] = i;
	}
	int ans(0);
	set<int>s;
	s.insert(-1);
	s.insert(N);
	rep(i, 0, N) {
		auto x = s.insert(pos[i]);
		set<int>::iterator l, r;
		l = r = x.first;
		l--, r++;

		ans += (i + 1)*(pos[i] - *l)*(*r - pos[i]);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 12800
import math
data = list(map(float, input().split()))
a, b, theta = data[0], data[1], data[2]/180*math.pi
data[1] = (a**2+b**2-2*a*b*math.cos(theta)) ** 0.5 + a + b
data[2] = b * math.sin(theta)
data[0] = a * data[2] / 2
for i in range(3):
    print(data[i])



Measured memory_bytes: 5708
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define Mid ((l+r)/2)
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define drep(i,a,b) for(int i=(a);i>=(b);--i)
#define file(a) freopen(#a".in","r",stdin),freopen(#a".out","w",stdout);
const int maxn=1e5+5,mod=1e9+7,inf=0x3f3f3f3f;
int n,m,Q,k,T,x,d;
int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}
int get(){
    if(x==0){
        if(k&1)return d;
        return 0;
    }
    if(x<0){
        int a=(-x)/d;
        if(x%d==0)--a;
        if(a>=k)return abs(x+k*d);
        x+=a*d;k-=a;
        if(k&1)return abs(x+d);
        return abs(x);
    }
    if(x>0){
        int a=x/d;
        if(x%d==0)--a;
        if(a>=k)return abs(x-k*d);
        x-=a*d;k-=a;
        if(k&1)return abs(x-d);
        return abs(x);
    }return 0;
}
signed main(){
    //file(a);
    x=read();k=read();d=abs(read());
    printf("%lld\n",abs(get()));


    return 0;
}


Measured memory_bytes: 3756
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

int main(){
    ll n,k;cin>>n>>k;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    vector<ll> sum;
    for(int i=0;i<n;i++){
        ll tmp=0;
        for(int j=i;j<n;j++){
            tmp+=a[j];
            sum.push_back(tmp);
        }
    }
    sort(ALL(sum),greater<ll>());
    //debug(sum);
    ll tmp=sum[0];
    ll keta=0;
    while(tmp>0){
        tmp>>=1;
        keta++;
    }

    // cout<<keta<<endl;
    // cout<<((1<<(keta-1))&sum[0])<<endl;

    //最上位桁の確定
    ll shif=keta-1;
    bool f=false;
    vector<ll> v;
    for(ll i=shif;i>=0;i--){
        for(int j=0;j<sum.size();j++){
            if((1)&(sum[j]>>i)) v.push_back(sum[j]);
        }
        if(!f&&v.size()>=k){
            break;
        }
        else{
            v.clear();
        }
    }
    sort(ALL(v),greater<ll>());
    //debug(v);
    keta=0;
    tmp=v[0];
    while(tmp>0){
        keta++;
        tmp>>=1;
    }
    keta--;
    for(ll i=keta;i>=0;i--){
        vector<ll> v2;
        for(int j=0;j<v.size();j++){
            if((1)&(v[j]>>i)){
                v2.push_back(v[j]);
            }
        }
        if(v2.size()>=k){
            swap(v,v2);
        }
        //debug(v);
    }
    sort(ALL(v),greater<ll>());
    ll ans=v[0];
    for(int i=1;i<k;i++){
        ans&=v[i];
    }
    cout<<ans<<endl;
    return 0;
}


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

int main (void){
  long long int n = 0,cur = 1,l = 0,h = 0;
  unsigned long long int k = 0;
  cin >> n >> k;
  h = n + 5;
  vector<tuple<long long int,long long int,int>> g(h);
  for(int i = 1;i <= n;i++){
    long long int pq = 0;
    cin >> pq;
    get<0>(g[i]) = pq;
    get<1>(g[i]) = 0;
    get<2>(g[i]) = 0;
  }

  for(unsigned long long int i = 1;i <= k;i++){
    cur = get<0>(g[cur]);
    if(get<2>(g[cur]) < 2){
      get<1>(g[cur]) = i;
      get<2>(g[cur])++;
    }else{
      l = i - get<1>(g[cur]);
      k = k - get<1>(g[cur]);
      k = k % l;
      i = 0;
    }
  }
  cout << cur << endl;
  return 0;
}


Measured memory_bytes: 8016
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>

#include <cctype>
#include <utility>
#include <climits>



using namespace std;

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

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
  int n;cin>>n;
	cout << a[n-1] << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a;
        Map<Integer, Integer> map = new HashMap<>();
        for (int i=0; i<N; i++) {
            a = sc.nextInt();
            map.put(a, map.containsKey(a) ? map.get(a) + 1 : 1);
            map.put(a+1, map.containsKey(a+1) ? map.get(a+1) + 1 : 1);
            map.put(a-1, map.containsKey(a-1) ? map.get(a-1) + 1 : 1);
        }
        int max = 0;
        for (Integer num : map.keySet()) {
            if (map.get(num) > max) {
                max = map.get(num);
            }
        }
        System.out.println(max);
    }
}

Measured memory_bytes: 63908
#include<stdio.h>
 int main(void)
 {
   int n,i,j,s;

   scanf("%d",&n);
   for (i=1;i<=9;i++)
     for (j=1;j<=9;j++){
      if (i*j==n){
      printf("Yes\n");
      return 0;
      }
   }
   printf("No\n");
 }


Measured memory_bytes: 128
/*
 * Author : Andrew J
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
using ll = long long;
using ii = pair <ll , ll>;
void in(ll &x);
const ll N = 21;
const ll M = 1e9 + 7;
ll n;
ll grid[N][N], dp[N + 5][1 << N];

inline ll f(ll cur , ll mask) {
  if (cur >= n) return __builtin_popcount(mask) == n;
  ll &sol = dp[cur][mask];
  if (sol != -1) return sol;
  sol = 0;
  for (ll i = 0 ; i < n ; i++) {
    if (mask & (1 << i)) {

    } else {
      if (grid[i][cur]) {
        (sol += f(cur + 1 , mask | (1 << i))) %= M;
      }
    }
  }
  return sol;
}

int main() {
  in(n);
  for (ll i = 0 ; i < n ; i++) {
    for (ll j = 0 ; j < n ; j++) {
      in(grid[i][j]);
    }
  }
  // for (ll cur = 0 ; cur <= n ; cur++) {
  //   for (ll mask = (1 << n) - 1 ; mask >= 0 ; mask--) {
  //     ll &sol = dp[cur][mask];
  //     if (cur == 0) {
  //       sol = __builtin_popcount(mask) == n;
  //     } else {
  //       for (ll i = 0 ; i < n ; i++) {
  //         if (mask & (1 << i)) {
  //
  //         } else {
  //           if (grid[i][cur - 1]) {
  //             sol += dp[cur - 1][mask | (1 << i)];
  //           }
  //         }
  //       }
  //     }
  //   }
  // }
  // printf("%d\n" , dp[n][0]);
  memset (dp , -1 , sizeof dp);
  printf("%lld\n" , f(0 , 0));
  return 0;
}

void in(ll &x){
	bool neg = false;
	register ll c;
	x = 0;
	c = getchar();
	if(c == '-'){
		neg = true;
		c = getchar();
	}
	for (; c > 47 && c < 58; c = getchar())
	x = (x << 1) + (x << 3) + c - 48;
	if (neg) x *= -1;
}


Measured memory_bytes: 429620
x, n = map(int, input().split())
try:
  p = list(map(int,input().split()))
except EOFError:
  p = [0]

ans = 0
i = 0
flag = 1

while flag == 1:
  if not((x-i) in p):
    print(x-i)
    exit()
  elif not((x+i) in p):
    print(x+i)
    exit()
  else:
    i = i+1
  

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  int N;
  cin >> N;
  
  int ans;
  if (N >= 64) ans = 64;
  else if (N >= 32) ans = 32;
  else if (N >= 16) ans = 16;
  else if (N >= 8) ans = 8;
  else if (N >= 4) ans = 4;
  else if (N >= 2) ans = 2;
  else ans = 1;
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000
#define NIL -1
void depth(int a, int i);
void print(int a,int i);

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

int main(){
  int i,j,n1,n2,le,ri,c,a,b;

  scanf("%d",&n1);
  for(i=0;i<n1;i++){parent[i]=left[i]=right[i]=NIL;}

  for(i=0;i<n1;i++){
    scanf("%d%d",&a,&n2);
    for(j=0;j<n2;j++){
      scanf("%d",&c);
      if(j==0){left[a]=c;}
      else{right[le]=c;}
      le=c;
      parent[c]=a;
    }
  }
  for(i=0;i<n1;i++){if(parent[i]==NIL)ri=i;}

  depth(ri,0);
  for(i=0;i<n1;i++){print(i,n1);}

  return 0;
}

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

  printf("]\n");
}

void depth(int a, int i){
  D[a] = i;
  if(right[a] != NIL) depth(right[a],i);
  if(left[a] != NIL) depth(left[a],i+1);
}


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

string S;

int main() {
    cin >> S;
    long N = S.length();
    bool flag = false;
    if (S[0] == S[N - 1] && !(N & 1)) flag = true;
    if (S[0] != S[N - 1] && (N & 1)) flag = true;
    cout << (flag? "First": "Second") << endl;
}




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

int main() {
  vector<int> sumcount;
  while (true) {
    int n, x, count = 0;
    cin >> n >> x;
    if (n == 0 && x == 0) break;
    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        if (x - i - j <= n && j < x - i - j) count++;
      }
    }
    sumcount.push_back(count);
  }
  for (size_t i = 0; i < sumcount.size(); i++) {
    cout << sumcount.at(i) << endl;
  }
}


Measured memory_bytes: 3148
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int N = 1e5 + 5;
vector<ll> v;
int k;
void solve(int i , ll num , int lst) {
    if(num)
        v.push_back(num);
    if(!i) {
        for (int j = 1; j <= 9; j++)
            solve(i + 1, num * 10ll + j, j);
    } else if(i < 11){
        solve(i + 1 , num * 10ll + lst , lst);
        if(lst)
            solve(i + 1 , num * 10ll + (lst - 1) , lst - 1);
        if(lst != 9)
            solve(i + 1 , num * 10ll + (lst + 1) , lst + 1);
    }
}
int main() {
    abdelrahman010
    cin >> k;
    solve(0 , 0 , 0);
    sort(v.begin() , v.end());
    cout << v[k - 1];
    return 0;
}


Measured memory_bytes: 10604
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<math.h>
#include<climits>
#include<set>
//#include<bits/stdc++.h>
#define debug(x) cout <<#x<<" = "<<x<<endl
#define debug2(x, y) cout<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<endl
#define gg cout <<"---------------QAQ---------------"<<endl
#define fi first
#define SZ(x) (int)x.size()
#define se second
#define pb push_back
#define inf 0x3f3f3f3f
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, string> pii;
typedef pair<pii, ll> Pii;
template<class T> inline void read(T &x){
    x=0; char c=getchar(); int f=1;
    while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
    while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
const int N = 2e5+10, maxn = 1e6+10;
void FAST(){ios::sync_with_stdio(false);cin.tie(nullptr); cout.tie(nullptr);}
const ll mod =  1e9+7;

int n, m, k;

void solve()
{
    string s, t;
    cin>>s>>t;
    for(int i = 0; i < s.size(); ++i)
    if(s[i] != t[i]) {
        cout<<"No\n";
        return ;
    }
    cout<<"Yes\n";
}

int main()
{
//    init();
//    int _;scanf("%d", &_); while(_--)
    solve();
    return 0;
}


Measured memory_bytes: 3548