akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int x, n;

signed main() {
	cin >> x;
	while (x>0) x -= ++n;
	cout << n << ln;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
vector<int> v;
void isPalindrome(string str) 
{ 
    // Start from leftmost and rightmost corners of str 
    int l = 0; 
    int h = str.length() - 1; 
  
    // Keep comparing characters while they are same 
    while (h > l) 
    { 
        if (str[l++] != str[h--]) 
        { 
            v.push_back(0);
            return; 
        } 
    } 
     v.push_back(1); 
} 
int main() {
	string s;
	cin>>s;
	v.clear();
	isPalindrome(s);
	int n=s.length();
	int z=(n-1)/2;
	string s1;
	for(int i=0;i<z;i++){
	    s1.push_back(s[i]);
	}
	isPalindrome(s1);
	int f=(n+3)/2;
	string s2;
	for(int i=f-1;i<s.length();i++){
	    s2.push_back(s[i]);
	}
	isPalindrome(s2);
	if(v[0]==1 && v[1]==1 && v[2]==1){
	    cout<<"Yes"<<endl;
	}else{
	    cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
//#include <fstream>
#include <vector>

using namespace std;

int main(int argc, const char * argv[]) {
//    ifstream in("input.txt");
//    cin.rdbuf(in.rdbuf());
    
    int n;
    cin >> n;
    
    vector<int> vec(n);
    for (int i=0; i<n; i++)
    {
        cin >> vec[i];
    }
    
    int cnt = 0;
    for (int i=1; i<n-1; i++)
    {
        if ((vec[i-1]>vec[i] && vec[i]>vec[i+1]) || (vec[i-1]<vec[i] && vec[i]<vec[i+1]))
        {
            ++cnt;
        }
    }
    
    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 504
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         arr = new int[N];
         st = new StringTokenizer(infile.readLine());
         for(int i=0; i < N; i++)
            arr[i] = Integer.parseInt(st.nextToken());
         //solve
         dp = new long[N][N];
         for(int i=0; i < N; i++)
            Arrays.fill(dp[i], -1);
         System.out.println(dfs(0, N-1));
      }
      static long[][] dp;
      static int[] arr;
      public static long dfs(int left, int right)
      {
         if(dp[left][right] != -1)
            return dp[left][right];
         if(left == right)
            return dp[left][right] = 0;//arr[left];
         long sum = 0L;
         for(int i=left; i <= right; i++)
            sum += arr[i];
         long res = dfs(left, left)+dfs(left+1, right);
         for(int i=left+1; i < right; i++)
            res = Math.min(res, dfs(left, i)+dfs(i+1, right));
         return dp[left][right] = res+sum;
      }
   }

Measured memory_bytes: 25256
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    cout<<fixed<<setprecision(9);
    ld R;
    cin>>R;
    R=2*M_PI*R;
    cout<<R<<endl;

//-----------------------------------------------------------------------------------------------------------//


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

Measured memory_bytes: 3808
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;

public class Main {
	static class ConnectedComponents {
		public void CC (InputReader ir) {
			
			int n = ir.nextInt();
	        int m = ir.nextInt();
	        @SuppressWarnings("unchecked")
			ArrayList<Integer>[] friend = new ArrayList[n];
	        
	        for (int i = 0; i < n; i++) {
	            friend[i] = new ArrayList<Integer>();
	        }
	 
	        for (int i = 0; i < m; i++) {
	            int s = ir.nextInt();
	            int t = ir.nextInt();
	            friend[s].add(t);
	            friend[t].add(s);
	        }
	 

	        int[] ccNum = makeCCNum(friend, n);
	         
	        int q = ir.nextInt();
	        for (int i = 0; i < q; i++) {
	            int s = ir.nextInt();
	            int t = ir.nextInt();
	            System.out.println(ccNum[s] == ccNum[t] ? "yes" : "no");
	        }
			
		}

		 static int[] makeCCNum(ArrayList<Integer>[] friend, int n) {
		        int[] ccNum = new int[n];
		        int num = 1;
		        boolean[] flg = new boolean[n]; // visited?
		        for (int i = 0; i < n; i++) {
		            if (flg[i])
		                continue;
		 
		            // 未到達の点から連結成分を作成
		            Queue<Integer> q = new LinkedList<Integer>();
		            q.add(i);
		             
		            while (!q.isEmpty()) {
		                int top = q.poll();
		                flg[top] = true;
		                ccNum[top] = num;
		 
		                for (int adj : friend[top]) {
		                    if (!flg[adj]) {
		                        flg[adj] = true;
		                        q.add(adj);
		                        ccNum[adj] = num;
		                    }
		                }
		            }
		 
		            // 次の連結成分には別の番号をつける
		            num++;
		        }
		        return ccNum;
		    }
		
	}
		
	static class InputReader {
		BufferedReader br;
		StringTokenizer st;
		
		public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(nextString());
		}
					
		public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		}
		
	}
	
	public static void main (String[] args) {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		ConnectedComponents obj = new ConnectedComponents ();
		obj.CC (in);
	}
	
	
}



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

int main() {
  int x, y;
  cin >> x >> y;
  vector<int> A = {1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
  if (A.at(x-1) == A.at(y-1)) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)n; i++)
#define PI 3.14159265358979323846
#define vll vector<long long>
#define vvll vector<vector<long long>>
#define pll pair<long long, long long>
using namespace std;
using ll = long long;
using ld = long double;

// グローバル変数（入力）
ll d, c[26], s[365][26], t[365], sc[365], last[26];

// コンテストとその日付をcontest:{日付,日付,...}で保持する
unordered_map<ll, vll> contests;

void input() {
  cin >> d;
  rep(i, 26) { cin >> c[i]; }
  rep(i, d) {
    rep(j, 26) { cin >> s[i][j]; }
  }
}

// satisfactory decrease
ll satDec(ll date, ll con) {
  ll ans = 0;
  rep(i, 26) {
    if (i != con) { ans += c[i] * (date - last[i]); }
  }
  return ans;
}

// コンテストconを選んだときの満足度の変化を計算する
// 26回ループで求まる
ll satChange(ll date, ll con) { return s[date][con] - satDec(date, con); }

// 満足度を1日ごとに計算する
void calcSat() {
  ll s = 0;
  rep(i, d) {
    s += sc[i];
    cout << s << endl;
  }
}

void randomImprove(ll cq, ll q2) {
  ll q1 = t[cq];

  ll befq1, nextq1, befq2, nextq2;
  auto cq1Iter = lower_bound(contests[q1].begin(), contests[q1].end(), cq);
  if (cq1Iter - contests[q1].begin() == 0) {
    befq1 = -1;
  } else {
    befq1 = *(cq1Iter - 1);
  }
  if (contests[q1].end() - cq1Iter == 1) {
    nextq1 = d;
  } else {
    nextq1 = *(cq1Iter + 1);
  }

  auto cq2Iter = lower_bound(contests[q2].begin(), contests[q2].end(), cq);
  if (cq2Iter - contests[q2].begin() == 0) {
    befq2 = -1;
  } else {
    befq2 = *(cq2Iter - 1);
  }
  if (contests[q2].end() - cq2Iter == 0) {
    nextq2 = d;
  } else {
    nextq2 = *cq2Iter;
  }

  ll satChange = -s[cq][q1] - c[q1] * (cq - befq1) * (nextq1 - cq) + s[cq][q2] +
                 c[q2] * (cq - befq2) * (nextq2 - cq);
  if (satChange > 0) {
    contests[q1].erase(cq1Iter);
    contests[q2].insert(cq2Iter, cq);
    t[cq] = q2;
  }
}

void solve() {

  clock_t start = clock();

  rep(i, 26) { last[i] = -1; }
  // 貪欲法
  rep(i, d) {
    // 終わったあとのことをシミュレーションしてみて，一番良くなるやつを選ぶ
    ll maxS, maxC;
    rep(j, 26) {
      ll sj = satChange(i, j);
      if (j == 0) {
        maxS = sj;
        maxC = 0;
        continue;
      }
      if (sj > maxS) {
        maxS = sj;
        maxC = j;
      }
    }

    // maxCを選ぶ
    // cout << maxC + 1 << endl;
    last[maxC] = i;
    t[i] = maxC;
    sc[i] = maxS; // satisfactory change
  }

  // ランダムにimproveを時間の限り繰り返す
  rep(i, d) { contests[t[i]].push_back(i); }
  srand(time(nullptr));

  while (clock() - start <=  19 * CLOCKS_PER_SEC / 10) {
    ll cq = rand() % d;
    ll q2 = rand() % 26;
    randomImprove(cq, q2);
  }

  rep(i, d) { cout << t[i]+1 << endl; }
}

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


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

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

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

int n, z, w;
vector<int> a;

int main() {
    cin >> n >> z >> w;
    if (n == 1) {
        int b;
        cin >> b;
        cout << abs(b - w) << endl;
        return 0;
    }
    a.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    reverse(a.begin(), a.end());
    // dpz[i]:zが残りi枚でターンが回ってきたときのスコア
    vector<int> dpx(n + 1, INT_MIN);
    vector<int> dpy(n + 1, INT_MAX);
    dpx[1] = dpy[1] = abs(a[1] - a[0]);
    for (int i = 2; i <= n; i++) {
        // j枚引く
        for (int j = 1; j < i; j++) {
            chmax(dpx[i], dpy[j]);
            chmin(dpy[i], dpx[j]);
        }
        //全部引く
        if (i == n) {
            chmax(dpx[i], abs(w - a[0]));
            chmin(dpy[i], abs(z - a[0]));

        } else {
            chmax(dpx[i], abs(a[i] - a[0]));
            chmin(dpy[i], abs(a[i] - a[0]));
        }
    }
    cout << dpx[n] << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] a = new int[m];
        int[] b = new int[m];
        List<List<Integer>> list = new ArrayList<>();
        for (int i = 0 ; i < n ; i++) {
            list.add(new ArrayList<Integer>());
        }
        for (int i = 0; i < m; i++) {
            a[i] = sc.nextInt() - 1;
            b[i] = sc.nextInt() - 1;
            list.get(a[i]).add(b[i]);
            list.get(b[i]).add(a[i]);
        }
        Queue<Integer> queue = new ArrayDeque<>();
        int[] seen = new int[n];
        seen[0] = 1;
        int[] dist = new int[n];

        Arrays.fill(dist, 10000000);
        dist[0] = 0;
        queue.add(0);
        while (queue.size() != 0) {
            int state = queue.peek();
            int now = queue.poll();
            for (int x : list.get(state)) {
                if (seen[x] == 0) {
                    seen[x] = 1;
                    queue.add(x);
                    dist[x] = dist[now] + 1;
                }
            }
        }
        for (int i = 0 ; i < n ; i++) {
            if (dist[i] >= 10000000) {
                System.out.print("No");
                return;
            }
        }
        System.out.println("Yes");
        for (int i = 1 ; i < n ; i++) {
            int d = dist[i];
            int ans = 0;
            for (int x : list.get(i)) {
                if (dist[x] == d - 1) {
                    ans = x + 1;
                }
            }
            System.out.println(ans);
        }
    }

}


Measured memory_bytes: 78564
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;


int main(void){
  int n,i,ans=0;
  string s;
  
  cin >> s;
  
  n=s.size();
  for (i=0;i<n;i++){
    if (s[i]!=s[n-i-1]){
      s[n-i-1]=s[i];
      ans++;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

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

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

void bfs(std::vector<std::vector<int> > &G, std::vector<int> &component_number, int i, int c){
	std::queue<int> que;

	que.push(i);
	component_number[i] = c;
	while(!que.empty()){
		int n = que.front(); que.pop();
		
		for(int j = 0; j < G[n].size(); j++){
			int nn = G[n][j];
			if(component_number[nn] < 0){
				component_number[nn] = c;
				que.push(nn);
			}
		}
	}
	return;
}


int main(int argc, char **argv){
	int n, m, u, v, q, s, t;
	std::vector<std::vector<int> > G;
	std::vector<int> component_number;
	int c = 0;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif

#if INPUT_FROM_FILE
	ifs >> n >> m;
#else
	std::cin >> n >> m;
#endif

	G.resize(n);
	component_number.resize(n, -1);
	for(int i = 0; i < m; i++){
#if INPUT_FROM_FILE
		ifs >> u >> v;
#else
		std::cin >> u >> v;
#endif
		G[u].push_back(v);
		G[v].push_back(u);
	}

	for(int i = 0; i < n; i++){
		if(component_number[i] < 0){
			bfs(G, component_number, i, c);
			c++;
		}
	}

#if INPUT_FROM_FILE
	ifs >> q;
#else
	std::cin >> q;
#endif
	for(int i = 0; i < q; i++){
#if INPUT_FROM_FILE
		ifs >> s >> t;
#else
		std::cin >> s >> t;
#endif
		if(component_number[s] == component_number[t]){
			std::cout << "yes" << std::endl;
		}
		else{
			std::cout << "no" << std::endl;
		}
	}
	return 0;
}


Measured memory_bytes: 8712
#include <iostream>
#include <set>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <unordered_map>
using namespace std;

typedef long long llong; // -2.1e-9 <= int <= 2.1e9 bool compare_by_b(pair<string, int> a, pair<int, int> b) {

bool compare(pair<string, int>& a, pair<string, int>& b)
{
    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return a.first < b.first;
    }
}


int main()
{
    size_t N; cin >> N;
    unordered_map<string, int> dict;
    for (size_t i=0; i<N; i++) {
       string str; cin >> str;
       if(dict.find(str) != end(dict)) {
           dict[str]++;
       }
       else {
           dict[str] = 1;
      }
    }

    vector<pair<string, int>> vec(dict.size());
    size_t i= 0;
    for (const auto &d: dict) {
        vec[i].first = d.first;
        vec[i].second = d.second;
        i++;
    }
    sort(vec.begin(), vec.end(), compare);
    cout << vec[0].first << endl;
    for (size_t i=1; i<vec.size(); i++) {
        if (vec[i].second == vec[0].second) {
            cout << vec[i].first << endl;
        }
        else {
            break;
        }
    }

}


Measured memory_bytes: 27208
N = int(input())
flags = []
for _ in range(N):
    d1, d2 = map(int, input().split())
    flags.append(d1 == d2)
#print(flags)
for i in range(N - 2):
    if flags[i] and flags[i + 1] and flags[i + 2]:
        print('Yes')
        exit()
print('No')

Measured memory_bytes: 9172
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#define ll long long int
#define lim 100010
#define INF 1e9
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define ABS(x) ((x)>0?(x):-(x))

int main(void){
	double w,h,x,y;
	scanf("%lf%lf%lf%lf",&w,&h,&x,&y);
	bool hukusuu=false;
	if(w/2==x && h/2==y)hukusuu=true;
	printf("%lf ",w*h*0.5);
	if(hukusuu)printf("1");
	else printf("0");
	return 0;
}

Measured memory_bytes: 128
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,m = li()

# mの約数を求める
i = 1
div = []
while i*i <= m:
    if m%i == 0:
        div.append(i)
        div.append(m//i)
    i += 1
    
ans = 1
for d in div:
    if m//d >= n:
        ans = max(ans, d)
        
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N, K;
  cin >> N >> K;
  int x = 1;
  
  for (int i = 0; i < N; i++) {
    
    if (x * 2 <= x + K) {
      x *= 2;
    }
    else {
      x += K;
    }
  }
  cout << x << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int max(int input[]){
    int maxValue = input[0];
    for(int i = 1; i < 5; i++){
        if(maxValue < input[i]) maxValue = input[i];
    }

    return maxValue;
}

int min(int input[]){
    int minValue = input[0];
    for(int i = 1; i < 5; i++){
        if(minValue > input[i]) minValue = input[i];
    }

    return minValue;
}

int main(int argc, char const *argv[])
{
    int a, b, c, d, e, k;

    cin >> a >> b >> c >> d >> e >> k;
    
    int input[5] = {a, b, c, d, e};

    int maxValue = max(input);
    int minValue = min(input);

    if(maxValue - minValue > k){
        cout << ":(" << endl;
    }else{
        cout << "Yay!" << endl;
    }

    return 0;
}


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

long long int n,i,x,a;
string s,t;

signed main()
{
    ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>s>>t;
	n=s.size();
	for (i=0;i<n;i++) t.push_back(s[i]);
	cout<<t;
}

Measured memory_bytes: 3564
#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(){
    int N, K;
    string S;
    cin >> N >> K;
    cin >> S;

    int last = 0;
    int right = 0;
    int left = 0;
    ll ans = 0;
    bool same = (S[0] == S[N-1]);
    REP(i,N){
        char c = S[i];
        int n = (c == 'L') ? -1 : 1;
        if(last != 0){
            if(last != n){
                if(last == 1) right++;
                else left++;
            }
            else{
                ans++;
            }

        }
        last = n;
    }

    if(last == 1) right++;
    else left++;

    if(right == 0 || left == 0){
        cout << ans << endl;
        return 0;
    }

    int high = max(right-1, left-1);
    if(high < K){
        ans += 2*high + !same;
    }
    else{
        ans += 2*K;
    }

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


Measured memory_bytes: 512
#include <chrono>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 10;
//    const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 179;
//    const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")

const int MAXN = 1e5 + 1;

int d[MAXN][3];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    #else
//        freopen("capitals.in", "r", stdin);
//        freopen("capitals.out", "w", stdout);
    #endif
    for (int i = 0; i < MAXN; i++) {
        for (int j = 0; j < 3; j++) d[i][j] = INF;
    }
    int n, m;
    cin >> n >> m;
    vector<vector<int>> g(n);
    int u, v;
    for (int i = 0; i < m; i++) {
        cin >> u >> v;
        u--, v--;
        g[u].pb(v);
    }
    int s, t;
    cin >> s >> t;
    s--, t--;
    d[s][0] = 0;
    set<pair<pii, int>> q;
    q.insert({{d[s][0], 0}, s});
    int md, nxt;
    while (!q.empty()) {
        md = q.begin()->first.second;
        v = q.begin()->second;
        nxt = (md + 1) % 3;
        q.erase(q.begin());
        for (auto u : g[v]) {
            if (d[u][nxt] > d[v][md] + 1) {
                d[u][nxt] = d[v][md] + 1;
                q.insert({{d[u][nxt], nxt}, u});
            }
        }
    }
    if (d[t][0] == INF) cout << -1;
    else cout << d[t][0] / 3;
}
/*

*/


Measured memory_bytes: 8824
#include <iostream>
#include <string>

using namespace std;

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

		int ans = 1e9;
		for (char c = 'a'; c <= 'z'; c++) {
				int cnt = 0, maxc = 0;
				for (auto&& var : S) {
						if (var == c) {
								cnt = 0;
						} else {
								cnt++;
								maxc = max(maxc, cnt);
						}
				}
				ans = min(ans, maxc);
		}

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


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

int main()
{
    const int mod = 1000000007;
    std::string s;
    std::cin >> s;

    std::reverse(s.begin(), s.end());

    std::vector<long long> reminds(13, 0);
    reminds[0] = 1;

    int pos = 1;
    for (auto c : s) {
        std::vector<long long> new_reminds(13, 0);
        if (c == '?') {
            for (int i = 0; i < 10; i++) {
                for (int j = 0; j < 13; j++) {
                    new_reminds[(i * pos + j) % 13] += reminds[j];
                    new_reminds[(i * pos + j) % 13] %= mod;
                }
            }
        } else {
            int i = c - '0';
            for (int j = 0; j < 13; j++) {
                new_reminds[(i * pos + j) % 13] = reminds[j];
                new_reminds[(i * pos + j) % 13] %= mod;
            }
        }
        pos *= 10;
        pos %= 13;
        swap(reminds, new_reminds);
    }

    std::cout << reminds[5] << std::endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
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; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

struct unionFind
{
  // par[i]：データiが属する木の親の番号。i == par[i]のとき、データiは木の根ノードである
  vector<int> par;
  // sizes[i]：根ノードiの木に含まれるデータの数。iが根ノードでない場合は無意味な値となる
  vector<int> sizes;

  unionFind(int n) : par(n), sizes(n, 1) {
    // 最初は全てのデータiがグループiに存在するものとして初期化
    rep(i,n) par[i] = i;
  }

  // データxが属する木の根を得る
  int find(int x) {
    if (x == par[x]) return x;
    return par[x] = find(par[x]);  // 根を張り替えながら再帰的に根ノードを探す
  }

  // 2つのデータx, yが属する木をマージする
  void unite(int x, int y) {
    // データの根ノードを得る
    x = find(x);
    y = find(y);

    // 既に同じ木に属しているならマージしない
    if (x == y) return;

    // xの木がyの木より大きくなるようにする
    if (sizes[x] < sizes[y]) swap(x, y);

    // xがyの親になるように連結する
    par[y] = x;
    sizes[x] += sizes[y];
    // sizes[y] = 0;  // sizes[y]は無意味な値となるので0を入れておいてもよい
  }

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

  // データxが含まれる木の大きさを返す
  int size(int x) {
    return sizes[find(x)];
  }
};

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n,m; cin >> n >> m;
    unionFind uf(n);
    rep(i,m){
        int a,b; cin >> a >> b;
        a--; b--;
        uf.unite(a,b);
    }
    int res=0;
    rep(i,n){
        chmax(res,uf.size(i));
    }
    cout<<res<<endl;
}

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

int main(){
    int H;
    cin >> H;
    
    int heap[H+1];
    for(int i = 1; i <= H; i++) cin >> heap[i];
    
    for(int i = 1; i <= H; i++){
        cout << "node " << i << ": key = " << heap[i] << ", ";
        
        if((i / 2) >= 1) cout << "parent key = " << heap[i/2] << ", ";
        if((i * 2) <= H) cout << "left key = " << heap[i*2] << ", ";
        if((i * 2 + 1) <= H) cout << "right key = " << heap[i*2+1] << ", ";
        
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3080
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  i64 P, Q, R;
  std::cin >> P >> Q >> R;
  std::cout << std::min({P + Q, Q + R, R + P}) << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

  	ll x;
  	cin >> x;
  	ll u500=0;
  	ll u5=0;
  	u500 =x / 500;
  	x%=500;
  	u5 = x / 5;
  	cout << 1000*u500 + 5* u5<<endl;
  	return 0;
}

Measured memory_bytes: 256
A, B, C, X, Y=map(int, input().split())
if (A+B)>2*C:
  ans=2*C*min(X, Y)
  if X>Y:
    if A>2*C:
      ans+=2*C*(X-Y)
    else:
      ans+=A*(X-Y)
  else:
    if B>2*C:
      ans+=2*C*(Y-X)
    else:
      ans+=B*(Y-X)
else:
  ans=A*X+B*Y

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i, n) for (long long i = 0; i < (int)(n); i++)
#define put(i) cout<<fixed<<i<<endl
using namespace std;
using ll = long long;

int main(){
    ll n; cin >> n;
    vector<ll> a(n); rep(i,n) cin >> a[i];
    ll qur = 0, two = 0;

    for(long long i = 0; i < n; i++){
        if(a[i] % 4 == 0){
            qur++;
        }else if(a[i] % 2 == 0){
            two++;
        }
    }

    if(qur + two / 2 >= n / 2){
        put("Yes");
    }else{
        put("No");
    }
}

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

int main(void) {
    int N;
    int d;
    int s = 0;
    cin >> N;
    d = N;
    while(d){
        s += d%10;
        d /= 10;
    }

    if(N%s) cout << "No\n";
    else    cout << "Yes\n";
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>

using namespace std;


int main(){
    int n,t,a;
    int h[1000];
    cin>>n>>t>>a;

    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    double diff;
    int hnum;
    diff=(double)abs(a-(t-h[0]*0.006));
    //cout<<diff<<endl;
    hnum=0;
    for(int i=1;i<n;i++){
        if((double)abs(a-(t-h[i]*0.006))<=diff){
            diff=(double)abs(a-(t-h[i]*0.006));
            hnum=i;
            //cout<<hnum<<" "<<diff<<endl;
        }
    }
    cout<<hnum+1<<endl;
    return 0;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int n, m, t, p, d, c, x, y;
		Scanner s = new Scanner(System.in);

		while (true) {
			n = s.nextInt();
			m = s.nextInt();
			t = s.nextInt();
			p = s.nextInt();
			int[][] a = new int[m][n];
			int[][] b = new int[m][n];
			for (int i = 0; i < m; i++) {
				for (int j = 0; j < n; j++) {
					a[i][j] = 1;
					b[i][j] = 1;
				}
			}

			if (n == 0 && m == 0 && t == 0 && p == 0) {
				break;
			}
			//
			for (int i = 0; i < t; i++) {
				d = s.nextInt();
				c = s.nextInt();

				for (int j = 0; j < m; j++) {
					for (int k = 0; k < n; k++) {
						b[j][k] = a[j][k];
					}
				}

				if (d == 1) {
					if (c * 2 <= n) {
						//
						for (int j = 0; j < m; j++) {
							int w = 0;
							for (int k = 0; k < c; k++) {
								a[j][k] = b[j][c + w] + b[j][c - 1 - w];
								w++;
							}
							for (int k = c; k < n - c; k++) {
								a[j][k] = b[j][c + w];
								w++;
							}
						}
						n -= c;
					} else {
						//
						for (int j = 0; j < m; j++) {
							int w = 0;
							for (int k = 0; k < n - c; k++) {
								a[j][k] = b[j][c + w] + b[j][c - 1 - w];
								w++;
							}
							//
							for (int k = n - c; k < c; k++) {
								a[j][k] = b[j][c - 1 - w];
								w++;
							}
						}
						n = c;
					}
				}
				if (d == 2) {
					if (c * 2 <= m) {
						for (int j = 0; j < n; j++) {
							int w = 0;
							for (int k = 0; k < c; k++) {
								a[k][j] = b[c + w][j] + b[c - 1 - w][j];
								w++;
							}
							for (int k = c; k < m - c; k++) {
								a[k][j] = b[c + w][j];
								w++;
							}
						}
						m -= c;
					} else {

						for (int j = 0; j < n; j++) {
							int w = 0;
							for (int k = 0; k < m - c; k++) {
								a[k][j] = b[c + w][j] + b[c - 1 - w][j];
								w++;
							}

							for (int k = m - c; k < c; k++) {
								a[k][j] = b[c - 1 - w][j];
								w++;
							}
						}
						m = c;
					}
				}
			}
			for (int j = 0; j < p; j++) {
				x = s.nextInt();
				y = s.nextInt();
				System.out.println(a[y][x]);
			}
		}
		s.close();
	}
}



Measured memory_bytes: 41980
#![allow(unused)]

use std::io::{Read, Stdin, StdinLock};
use std::iter::{FromIterator, Iterator};
use std::str::{FromStr};
use std::string::String;

use std::cmp::{min, Ordering, Reverse};
use std::collections::BinaryHeap;

macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

struct TokenReader<'a> {
    lock: StdinLock<'a>,
}

impl<'a> TokenReader<'a> {
    fn new(s: &'a Stdin) -> TokenReader<'a> {
        TokenReader { lock: s.lock() }
    }

    fn read_chars<T: FromIterator<char>>(&mut self) -> T {
        self.lock
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<T>()
    }

    fn read_str(&mut self) -> String {
        self.read_chars::<String>()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read_str().parse().ok().unwrap()
    }
}

//==============================================================================
//
// Problem specific code
//
//==============================================================================

type Graph = Vec<Vec<(usize, usize, i64)>>;

fn for_each_adjacent_states<F>(
    t: usize,
    k: usize,
    xs: &Vec<(usize, i64)>,
    g: &Graph,
    kmax: usize,
    mut f: F,
) where
    F: FnMut((usize, usize), i64)
{
    let (c, d) = xs[t];
    f((t, min(k + c, kmax)), d);
    for &(t_, a, b) in &g[t] {
        if k >= a {
            f((t_, k - a), b);
        }
    }
}

fn main() {
    let sin = std::io::stdin();
    let mut tr = TokenReader::new(&sin);

    let n: usize = tr.read();
    let m: usize = tr.read();
    let s: usize = tr.read();
    let ls: Vec<(usize, usize, usize, i64)> =
        (0..m).map(|_| (tr.read(), tr.read(), tr.read(), tr.read())).collect();
    let xs: Vec<(usize, i64)> =
        (0..n).map(|_| (tr.read(), tr.read())).collect();

    let mut g: Graph = vec![vec![]; n];
    for i in 0..m {
        let (u, v, a, b) = ls[i];
        g[u - 1].push((v - 1, a, b));
        g[v - 1].push((u - 1, a, b));
    }

    let kmax: usize = ls.iter().map(|x| x.2).sum::<usize>() * 2;
    let mut ws: Vec<Vec<i64>> = vec![vec![std::i64::MAX; kmax + 1]; n];
    let mut q = BinaryHeap::new();

    q.push((Reverse(0), 0, min(s, kmax)));

    while !q.is_empty() {
        let (Reverse(w), t, k) = q.pop().unwrap();
        if ws[t][k] < w {
            continue;
        }

        for_each_adjacent_states(t, k, &xs, &g, kmax, |(t_, k_), d| {
            let w_ = w + d;
            if ws[t_][k_] > w_ {
                for i in 0..=k_ {
                    if ws[t_][k_ - i] <= w_ {
                        break;
                    }
                    ws[t_][k_ - i] = w_;
                }
                ws[t_][k_] = w + d;
                q.push((Reverse(w + d), t_, k_));
            }
        });
    }

    for t in 1..n {
        println!("{}", ws[t][0]);
    }
}


Measured memory_bytes: 4160
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

int main()
{
    int n, k;
    std::cin >> n >> k;

    if (n == 1) {
        std::cout << 1 << std::endl;
        return 0;
    }
    std::cout << ceil(log(n) / log(k)) << std::endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<string>


using namespace std;



int main(){
	string s;
	int fit = 0;
	int i, j;

	while (cin >> s){
		for (i = 0, j = s.size() - 1;; i++, j--){
			if (i == j || i > j){
				fit++;
				break;
			}
			else if (s[i] != s[j]){
				break;
			}
		}
		
	}

	cout << fit << endl;

}

Measured memory_bytes: 1184
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 998244353, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

#ifdef _DEBUG
#include "../../library/library/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

struct init {
	init() {
		cin.tie(nullptr); ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
	}
} init_;

template<int Modulo = MOD>
struct Mint {

	lint val;
	constexpr Mint(lint v = 0) noexcept : val(v% Modulo) { if (val < 0) val += Modulo; }

	constexpr Mint& operator+=(const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator-=(const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator*=(const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator/=(const Mint& r) noexcept {
		lint a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			lint t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}

	constexpr Mint operator+(const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator-(const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator*(const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator/(const Mint& r) const noexcept { return Mint(*this) /= r; }

	constexpr Mint operator-() const noexcept { return val ? Modulo - val : 0; }

	constexpr bool operator==(const Mint& r) const noexcept { return val == r.val; }
	constexpr bool operator!=(const Mint& r) const noexcept { return !((*this) == r); }
	constexpr bool operator< (const Mint& r) const noexcept { return val < r.val; }

	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept { return os << x.val; }
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		lint tmp; is >> tmp;
		x = Mint(tmp);
		return is;
	}

	constexpr Mint pow(lint n) const noexcept {
		Mint res = 1, tmp = val;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

	int N, S;
	cin >> N >> S;

	vector<int> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];

	vector<mint> dp(S + 1), tmp(S + 1);
	dp[0] = 1;
	for (int i = 0; i < N; i++) {
		tmp = dp;
		for (int s = S; s >= 0; s--) {
			dp[s] = tmp[s] * 2;
			if (s + A[i] <= S) dp[s + A[i]] += tmp[s];
		}
	}

	cout << dp[S] << "\n";

	return 0;
}



Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s.at(1)=='R'){
    if(s.at(0)=='R'&&s.at(2)=='R'){
      cout<<3<<endl;
      return 0;
    }
    else if(s.at(0)=='R'||s.at(2)=='R'){
      cout<<2<<endl;
      return 0;
    }
    else{
      cout<<1<<endl;
      return 0;
    }
  }
  else if(s.at(0)=='R'||s.at(2)=='R'){
    cout<<1<<endl;
  }
  else{
    cout<<0<<endl;
  }
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
vector<string> in;
void init(){
  in.clear();
}
int input(){
  init();
  int n;
  cin>>n;
  if(n==0)return false;
  in.resize(n);
  for(int i=0;i<n;i++){
    cin>>in[i];
  }
  return true;
}
int istop[30];
void top(){
  for(int i=0;i<30;i++){
    istop[i]=0;
  }
  for(int i=0;i<in.size();i++){
    if(in[i].size()!=1){
      istop[in[i][0]-'A']=true;
    };
  }
}
bool isTop(char c){
  return istop[c-'A'];
}

vector<pair<int,char>> num;
void convert(){
  map<char,int> dp;
  dp.clear();
  for(int i=0;i<in.size();i++){
    int c = 1;
    if(i==in.size()-1)c*=-1;
    for(int j=0;j<in[i].size();j++){
      dp[in[i][in[i].size()-j-1]] += c;
      c*=10;
    }
  }
  num.clear();
  for(auto i:dp){
    num.push_back(make_pair(i.second,i.first));
  }
  sort(num.begin(),num.end());
}

vector<int> used;
int tmp;
int req(int n){
  if(n==num.size()){
    return tmp == 0;
  }
  if(n==0) tmp = 0;
  if(tmp>0)return 0;
  int res = 0;
  for(int i=0;i<10;i++){
    if(isTop(num[n].second)&&i==0)continue;
    if(!used[i]){
      tmp += num[n].first * i;
      used[i]=true;
      int tt= req(n+1);
      res += tt;
      used[i]=false;
      tmp -= num[n].first * i;
    }
  }
  return res;
}

int solve(){
  top();
  convert();
  used.resize(10);
  for(int i=0;i<10;i++){
    used[i]=0;
  }
  return req(0);
}

int main(){
  while(input()){
    cout<<solve()<<endl;
  }
}

Measured memory_bytes: 1212