akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

using Graph = vector<vector<int> >;
vector<bool> seen, finished;
int pos = -1;
vector<int> hist;
void dfs(const Graph &G, int v) {
   seen[v] = true;
   hist.push_back(v);
   for (auto nv : G[v]) {
      if (finished[nv]) continue;
      if (seen[nv] && !finished[nv]) {
         pos = nv;
         return;
      }
      dfs(G, nv);
      if (pos != -1) return;
   }
   hist.pop_back();
   finished[v] = true;
}

int main() {
   int N, M;
   cin >> N >> M;
   Graph G(N);
   for (int i = 0; i < M; i++) {
      int a, b;
      cin >> a >> b;
      a--;
      b--;
      G[a].push_back(b);
   }

   seen.assign(N, false);
   finished.assign(N, false);
   pos = -1;
   for (int v = 0; v < N; v++) {
      pos = -1;
      dfs(G, v);
      if (pos != -1) break;
   }
   if (pos == -1) {
      cout << -1 << endl;
      return 0;
   }

   vector <int> cycle;
   while (!hist.empty()) {
      int t = hist.back();
      cycle.push_back(t);
      hist.pop_back();
      if (t == pos) break;
   }
   reverse(cycle.begin(), cycle.end());
   
   while (true) {
      int from = -1;
      int to = -1;
      vector<int> ord(N, -1);
      for (int i = 0; i < cycle.size(); i++) ord[cycle[i]] = i;
      for (int i = 0; i < cycle.size(); i++) {
         for (auto nv : G[cycle[i]]) {
            if (nv != cycle[(i+1)%cycle.size()] && ord[nv] != -1) {
               from = i;
               to = ord[nv];
            }
         }
      }
      if (from == -1) break;

      vector<int> ncycle;
      ncycle.push_back(cycle[from]);
      int id = to;
      while (id != from) {
         ncycle.push_back(cycle[id]);
         id = (id + 1) % cycle.size();
      }
      cycle = ncycle;
   }
   cout << cycle.size() << endl;
   for (auto v : cycle) cout << v + 1 << endl;
   return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>

#define rep(i, n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A[i];

  int mx = 0;
  int mx2 = 0;
  rep(i, N)
  {
    if (mx < A[i])
    {
      mx2 = mx;
      mx = A[i];
    }
    else if (mx2 < A[i])
    {
      mx2 = A[i];
    }
  }

  rep(i, N)
  {
    if (A[i] == mx)
      cout << mx2 << endl;
    else
      cout << mx << endl;
  }

  return 0;
}


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

#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__ << endl;

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int x;
    cin >> x;

    int sum = 0;
    FOR(i, 1, 10000000000) {
        sum += i;
        if (x <= sum) {
            cout << i << endl;
            break;
        }
    }

    return 0;
}


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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

template <typename T> using vector2d = vector<vector<T>>;

// clang-format off
template <typename T> void sort(vector<T> &v) { sort(all(v)); }
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  int64_t n = in(), m = in();

  if (n > m) swap(n, m);

  if (n >= 2)
    cout << (n - 2) * (m - 2) << endl;
  else if (m == 1)
    cout << 1 << endl;
  else
    cout << m - 2 << endl;
}


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

typedef struct
{
	int a;
	int b;
}ab_set;

int cmp(const void *p, const void *q)
{
	return ((ab_set *)p)->a - ((ab_set *)q)->a;
}

int main()
{
	int N;
	long long int K;

	cin >> N >> K;

	ab_set lst[N];

	for (int i = 0; i < N; i++)
	{
		cin >> lst[i].a >> lst[i].b;
	}

	qsort(lst, N, sizeof(ab_set), cmp);

	long long int count = 0;
	int i_ans;

	for (int i = 0; i < N; i++)
	{
		count += (long long int)lst[i].b;
		if ((long long int)count >= K)
		{
			i_ans = i;
			break;
		}
	}

	cout << lst[i_ans].a << endl;

	return 0;
}


Measured memory_bytes: 1788
#include <cstdio>
#include <iostream>

using namespace std;

int a[1<<20], b[1<<20];;

int main() {
  int N;

  scanf("%d", &N);

  for(int i=0; i<(1<<N); i++) {
    scanf("%d", a+i);
  }

  int ans = 0;

  for(int i=0; i<(1<<N); i++) {
    if(!a[i]) {
		for(int j=0;j<N;j++) {
			if (i & (1 << j)) {
				if(a[i^(1<<j)]) {
    		    	cout << -1 << endl;
					return 0;
				}
			}	
		}
		continue;
	}

    bool ok = true;

    for(int j=0; j< N; j++) {
      if (i & (1 << j)) {
        ok &= !a[i ^ (1<<j)];
      }
    }

    ans += ok;

  }


  cout << ans << endl;
}


Measured memory_bytes: 7312
#include <bits/stdc++.h>
using namespace std;
int main()
{
  long long int n,i,t=0;
  cin>>n;
  long long int arr[n],brr[n];
  for(i=0;i<n;i++)
  {
    cin>>arr[i];
  }
  for(i=0;i<n;i++)
  {
    brr[i]=arr[i];
  }
  
  sort(arr,arr+n);
  for(i=0;i<n;i++)
  {
    if(arr[i]!=brr[i])
    {
      t++;
    }
  }
  /*for(i=0;i<n;i++)
  {
    cout<<arr[i];
  }
  cout<<endl;
  for(i=0;i<n;i++)
  {
    cout<<brr[i];
  }*/
  if(t==2 || t==0)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
from math import pi
from math import cos
from math import sqrt

A,B,h,m=map(int,input().split())

a=2*pi*(h/12+m/720)
b=2*pi*(m/60)
t=a-b

l=sqrt(A*A+B*B-2*A*B*cos(t))

print(l)

Measured memory_bytes: 9488
/*
	Nishant Singh
	nishant.ns19
*/
#include <bits/stdc++.h>
#include <functional> 
#include <iostream> 

// ******** Big Integer ********
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// #define ll1024  int1024_t
// ******** Big Integer ********

// ******** Using PBDS ********
// #include <ext/pb_ds/assoc_container.hpp> // Common file 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ook order_of_key    //count of strictly smaller elements
// #define fbo find_by_order   //find element at an index 
// ******** Using PBDS ********

using namespace std;
#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vll vector<ll>
#define vec vector
#define setcount(x) __builtin_popcountll(x)
#define f first
#define s second
#define mp make_pair
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define REV(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define in insert
#define init(x,a) memset(x,a,sizeof(x))
#define all(c) c.begin(),c.end()
#define pq priority_queue
#define ffl fflush(stdout)
#define mset multiset
#define out(x) cout<<#x<<" = "<<" "<<x<<"\n";
#define ub upper_bound
#define lb lower_bound 
#define ln "\n"
#define Y "YES"
#define N "NO"
ll const mod=1e9 + 7;
ll const inf=2e18;

// ******** Using PBDS ********
// typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
//              tree_order_statistics_node_update> 
//                 os; 
// ******** Using PBDS ********

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

inline ll mul(ll a,ll b) 
{ 
	return (a%mod * b%mod + mod)%mod; 
}

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

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

ll modexp(ll x, ll n){
	if(n==0){
		return 1;
	}
	else if(n&1){
		return (modexp((x*x)%mod, n/2)%mod * x%mod)%mod;
	}
	else{
		return (modexp((x*x)%mod, n/2)%mod);
	}
}

ll modinv(ll n)
{
	return modexp(n,mod-2);
}

// ******** GLOBAL VARIABLES ********


// ******** GLOBAL VARIABLES ********

void solve(){
	ll l,r,d;
	cin>>l>>r>>d;
	cout<<(r/d) - (l/d) +(l%d==0);

}  

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll T=1;
	// cin>>T; 	
	for(int t=1;t<=T;t++)
	{
		// cout<<"Case #"<<t<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 3648
#エラトステネス
def era(n):
    table = [0] * (n + 1)
    prime_list = []
    
    for i in range(2, n + 1):
        if table[i] == 0:
            prime_list.append(i)
            for j in range(2*i, n + 1, i):
                table[j] = 1
    
    return prime_list


s = (era(55555))
ans = []
N = int(input())
for i in s:
    if len(ans) == N:
        break
    if i % 5 == 1:
        ans.append(str(i))


print(' '.join(ans))

Measured memory_bytes: 3572
list = gets.split("\s").map {|s|s.to_i}
result = true
idx = list.index(5)

if(idx!=nil)then
  list.delete_at(idx)
else
  result = false
end

idx = list.index(5)
if(idx!=nil)then
  list.delete_at(idx)
else
  result = false
end

if(list[0]!=7)then
  result = false
end

if(result==true)then
  puts "YES"
else
  puts "NO"
end

Measured memory_bytes: 1788
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	long long int sum = 0;
	long long int rest = mod;
	for(int i = 0; i < n; i++){
		long long int a, b;
		cin >> a >> b;
		sum += a;
		if(a > b) rest = min(rest, b);
	}
	if(rest == mod) cout << 0 << endl;
	else cout << sum - rest << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

typedef vector<int> vec;
typedef vector<vec> mat;

const ll mod = 1000000007;

int main(){
    int r;
    cin >> r;
    int ans = 3 * r * r;
    cout << ans << endl;
}

Measured memory_bytes: 3608
#include<iostream>
using namespace std;
int main(void){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(a-c<=d && c-a<=d){
    cout<<"Yes"<<endl;
  }else if((c-b<=d && b-a<=d) && (a-b<=d && b-c<=d)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
vector<int>zalgo(string s)
{
	vector<int>r;
	r.resize(s.size());
	r[0] = s.size();
	s.push_back('$');
	int pt = 1, kn = 0;
	for (;;)
	{
		if (pt == s.size() - 1)break;
		for (;;)
		{
			if (s[pt + kn] != s[kn])break;
			else kn++;
		}
		r[pt] = kn;
		int t = 1;
		for (;;)
		{
			if (r[t] < kn - t)r[pt + t] = r[t], t++;
			else break;
		}
		pt += t;
		kn = max(0, kn - t);
	}
	return r;
}
typedef long long ll;
vector<ll>get1(ll a, string s)
{
	vector<ll>r;
	r.resize(26);
	for (int i = 0; i < s.size(); i++)r[s[i] - 'a'] += a / s.size();
	for (int i = 0; i < a%s.size(); i++)r[s[i] - 'a']++;
	return r;
}
vector<ll>fib[1000];
ll len[1000];
vector<ll>get2(ll a, string x, string y)
{
	if (a <= x.size() + y.size())
	{
		vector<ll>r;
		r.resize(26);
		for (int i = 0; i < min(a, (ll)(x.size())); i++)r[x[i] - 'a']++;
		for (int i = x.size(); i < a; i++)r[y[i - x.size()] - 'a']++;
		return r;
	}
	int rr;
	for (int i = 0;; i++)
	{
		if (len[i] <= a)rr = i;
		else break;
	}
	vector<ll>r = fib[rr];
	vector<ll>s = get2(a - len[rr], x, y);
	for (int i = 0; i < 26; i++)r[i] += s[i];
	return r;
}
int main()
{
	string zs;
	cin >> zs;
	ll lb, ub;
	scanf("%lld%lld", &lb, &ub);
	string s;
	for (int i = 0; i < zs.size() / 2; i++)s.push_back(zs[i]);
	vector<int>v = zalgo(s);
	int rr = -1;
	for (int i = 1; i < v.size(); i++)
	{
		if (v[i] == s.size() - i)
		{
			rr = i;
			break;
		}
	}
	if (rr == -1 || s.size() % rr == 0)
	{
		vector<ll>a = get1(ub, s), b = get1(lb - 1, s);
		for (int i = 0; i < 26; i++)printf("%lld ", a[i] - b[i]);
		printf("\n");
	}
	else
	{
		string x, y;
		for (int i = 0; i < rr; i++)x.push_back(s[i]);
		for (int i = rr; i < s.size(); i++)y.push_back(s[i]);
		for (int i = 0; i < 200; i++)fib[i].resize(26);
		for (int i = 0; i < x.size(); i++)fib[0][x[i] - 'a']++, fib[1][x[i] - 'a'] += 2;
		for (int i = 0; i < y.size(); i++)fib[0][y[i] - 'a']++, fib[1][y[i] - 'a']++;
		for (int i = 2; i < 200; i++)for (int j = 0; j < 26; j++)fib[i][j] = fib[i - 1][j] + fib[i - 2][j];
		len[0] = x.size() + y.size(), len[1] = x.size() + y.size() + x.size();
		for (int i = 2; i < 200; i++)len[i] = len[i - 1] + len[i - 2];
		vector<ll>a = get2(ub, x, y), b = get2(lb - 1, x, y);
		for (int i = 0; i < 26; i++)printf("%lld ", a[i] - b[i]);
		printf("\n");
	}
}

Measured memory_bytes: 1412
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <limits.h>
#include <assert.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <bitset>
#include <vector>
using namespace std;

#define LL long long

#define fi first
#define se second
#define lson l,mid,id<<1
#define rson mid+1,r,id<<1|1
#define ls id<<1
#define rs id<<1|1
#define MID(a,b) (((a)+(b))>>1)
#define maxx(a,b) ((a)<(b)?(b):(a))
#define minx(a,b) ((a)<(b)?(a):(b))
#define absx(a) ((a)<0?-(a):(a))
#define mk(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define itr iterator
#define lowbit(x) ((x)&-(x))

typedef unsigned LL ULL;
typedef unsigned uint;
typedef map<int,int> mii;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<LL,LL> pLL;

template< typename T > inline void read(T &x) {
    static bool fr_f; static char fr_ch;
    fr_f=0; x=0; fr_ch=getchar();
    while(fr_ch<'0' || '9'<fr_ch) {if(fr_ch=='-') fr_f=1; fr_ch=getchar();}
    while('0'<=fr_ch && fr_ch<='9') {x=(x<<1)+(x<<3)+fr_ch-'0'; fr_ch=getchar();}
    if(fr_f) x=-x;
}

template< typename T > inline void Max (T &a, T b) {if(a<b) a=b;}
template< typename T > inline void Min (T &a, T b) {if(b<a) a=b;}
template< typename T > inline void Swap(T &a, T &b) {T c=a;a=b;b=c;}
template< typename T > inline T Abs(T a) {if(a<0) return -a; else return a;}

const double   pi = acos(-1.0) ;
const int     MOD = (int)1e9+7 ;
const int     INF = (int)0x3f3f3f3f ;
const LL     LINF = (LL)INF<<32|INF ;
const int    SINF = (uint)(-1)>>1 ;
const LL    SLINF = (ULL)(-1)>>1 ;
const double DINF = 1e50 ;
const double  eps = 1e-5 ;
const int    maxn = (int) 2e5+20 ;
const int    maxm = (int) 1e6+20 ;
const int    maxk = (int) 1000+20 ;

inline int sig(double x) {return x<-eps?-1:x>eps;}
inline LL fp(LL a,LL n,LL p) {LL res=1; for(;n;n>>=1,a=a*a%p) if(n&1) res=res*a%p; return res;}
template<typename T>inline T gcd(T a,T b) {for(T c;b;c=a%b,a=b,b=c); return a;}

//--------------------start--------------------

int dp[maxn];

void work()
{
    int n;
    read(n);
    for(int i = 0; i <= n; i++) dp[i] = i;
    for(int j = 6; j <= n; j *= 6)
    {
        for(int i = j; i <= n; i++) Min(dp[i], dp[i - j] + 1);
    }
    for(int j = 9; j <= n; j *= 9)
    {
        for(int i = j; i <= n; i++) Min(dp[i], dp[i - j] + 1);
    }
    cout <<dp[n] <<endl;
}

//---------------------end---------------------

int main()
{
#ifdef yukihana0416
freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif // yukihana0416
    work();
    return 0;
}


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

typedef long long ll;


string rot(string s){
    s =  *(s.end()-1) + s.substr(0, s.size()-1 );
    //cout << s <<  endl;
    return s;
}

int main(){
    string s, t;
    cin >> s;
    cin >> t;

    for(int i = 0; i < s.size(); i++){
        if(s == t){
            cout << "Yes" << endl;
            return 0;
        }
        s = rot(s);       
    }

    cout << "No" << endl;

}

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

ll times(ll n);

ll times(ll n){
  ll res;
  if(n==1) res = 1;
  else res = 1 + 2*times(n/2);
  return res;
}

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

  ll ans = times(H);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BGridCompression solver = new BGridCompression();
        solver.solve(1, in, out);
        out.close();
    }

    static class BGridCompression {
        static final char BLACK = '#';
        static final char WHITE = '.';

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int h = in.nextInt(), w = in.nextInt();

            boolean[][] a = new boolean[h][w];
            for (int i = 0; i < h; i++) {
                String s = in.next();
                for (int j = 0; j < w; j++) {
                    a[i][j] = s.charAt(j) == BLACK;
                }
            }

            boolean[] skipRow = new boolean[h];
            boolean[] skipCol = new boolean[w];
            Arrays.fill(skipRow, true);
            Arrays.fill(skipCol, true);
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    skipRow[i] &= !a[i][j];
                    skipCol[j] &= !a[i][j];
                }
            }

            for (int i = 0; i < h; i++) {
                if (skipRow[i])
                    continue;
                for (int j = 0; j < w; j++) {
                    if (skipCol[j])
                        continue;

                    out.print(a[i][j] ? BLACK : WHITE);
                }

                out.println();
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

int main(){
  int N,count=0;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    if(A.at(i)%2==1){
      count++;
    }
    else if(A.at(i)%3==0 || A.at(i)%5==0){
      count++;
    }
  }
  if(count==N){
    cout << "APPROVED" << endl;
  }
  else{
    cout<< "DENIED" << endl;
  }
} 

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

bool num[1000000];

void prime(){
	num[0] = false;
	num[1] = false;
	for(int i = 2; i < 1000000; i++) num[i] = true;
	for(int i = 2; i < 1000; i++){
		if(!num[i]) continue;
		for(int j = 2*i; j < 1000000; j += i) num[j] = false;
	}
}

int main(){
	prime();
	int n,p;
	while(scanf("%d%d", &n, &p)){
		vector<int> v,vec;
		if(n == -1 && p == -1) break;
		for(int i = n+1; i < 1000000; i++){
			if(num[i]) v.push_back(i);
			if(v.size() == p) break;
		}
		for(int i = 0; i < p; i++){
			for(int j = i; j < p; j++){
				vec.push_back(v[i]+v[j]);
			}
		}
		sort(vec.begin(),vec.end());
		printf("%d\n", vec[p-1]);
	}
}

Measured memory_bytes: 2084
def main():
	# a,b,k = map(int,input().split())
	n = int(input())
	# s = str(input())
	# h = list(map(int,input().split()))
	# l = [list(map(int, input().split())) for _ in range(n)]
	# s = list(s)
	waru = 2
	if n <= 3:
		print(n)

	while n > 3:
		if n == waru:
			# print("break!")
			print(n)
			break
		elif n % waru == 0:
			n += 1
			waru = 2
			
		else:
			waru += 1

		# print(n,waru)
	

if __name__ == '__main__':
	main()

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

using namespace std;
#define ll long long
#define M 1000000007


int main()
{
    ll n,w;
    cin>>n>>w;
    vector<pair<ll,ll>>arr(n+1);
    for(ll i=1;i<=n;i++)
    {
        ll a,b;
        cin>>a>>b;
        arr[i].first=a;
        arr[i].second=b;
    }
    ll dp[n+1][w+1]={0};
    for(ll i=0;i<=n;i++)
        for(ll j=0;j<=w;j++)
            dp[i][j]=0;
    dp[0][0]=0;
    for(ll i=1;i<=n;i++)
    {
        ll we=arr[i].first,val=arr[i].second;
        for(ll j=1;j<=w;j++)
        {
            dp[i][j]=dp[i-1][j];
            if(we<=j)
            {
                dp[i][j]=max(dp[i-1][j],val+dp[i-1][j-we]);
                // dp[i][j]=dp[i-1][j];
                // if(dp[i-1][j-we])
            }
            // cout<<dp[i][j]<<" ";
        }
        // cout<<endl;
    }
    cout<<dp[n][w]<<endl;
}

Measured memory_bytes: 79104
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
int a[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	int ptr = 1;
	LL ans = 0;
	int sum = 0;
	for (int i = 1; i <= n; i++)
	{
		while (ptr <= n && (sum & a[ptr]) == 0)
		{
			sum |= a[ptr++];
		}
		ans += ptr - i;
		sum ^= a[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 100000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
/*---------------------------------------------------*/

int main(){
  string s,t,ans="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
  string ju=ans;
  cin>>s>>t;
  rep(i,s.size()-t.size()+1){
    string tmp="";
    bool ok=true;
    //cout<<i<<endl;
    for(int j=0;j<i;j++){
      if(s[j]=='?')tmp+='a';
      else tmp+=s[j];
    }
    //cout<<tmp<<endl;
    for(int j=0;j<t.size();j++){
      if(s[i+j]=='?'||s[i+j]==t[j])tmp+=t[j];
      else ok=false;
    }
    //cout<<tmp<<endl;
    for(int j=i+t.size();j<s.size();j++){
      if(s[j]=='?')tmp+='a';
      else tmp+=s[j];
    }
    //cout<<tmp<<endl;
    if(ok)ans=min(ans,tmp);
  }
  if(ans==ju)cout<<"UNRESTORABLE"<<endl;
  else cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define MN 100005
using namespace std;
typedef long long ll;
int n,inv[MN],sum[MN],a[MN];
ll ans;
const int mod=1e9+7;
int main(){
	scanf("%d",&n);inv[0]=inv[1]=1;
	for(int i=2;i<=n;i++)inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
	for(int i=1;i<=n;i++)sum[i]=sum[i-1]+inv[i],sum[i]%=mod;
	for(int i=1;i<=n;i++)scanf("%d",&a[i]),ans+=1ll*a[i]*(sum[i]+sum[n-i+1]-1)%mod,ans%=mod;
	for(int i=1;i<=n;i++)ans=1ll*ans*i%mod;
	printf("%lld\n",ans);
}


Measured memory_bytes: 1280
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
using namespace std;
constexpr int64_t INF = 1000000000;

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

  int32_t N;
  cin >> N;
  int32_t min;
  cin >> min;
  int32_t cnt = 1;
  for (int i = 1; i < N; i++) {
    int32_t p;
    cin >> p;
    if (p < min) {
      cnt++;
      min = p;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
import math
a,b,x = list(map(int,input().split()))

check = a*a*b/2

if x >= check: 
    ans = math.degrees(math.atan(2*(b/a-x/(a**3))))
else :
    c_=a*b*b/2
    ans = math.degrees(math.atan((c_/x)))
    
print(ans)

Measured memory_bytes: 62452
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define ALL(v) v.begin(), v.end()
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
	ll N ; cin >> N ;
	if (N==1 || N==2) {
		cout << N << endl ;
		return 0 ;
	}
	vector<int> A ;
	ll sum = 0 ;
	FOR(i, 1, N) {
		sum += i ;
		A.push_back(i) ;
		if(sum >= N) break ;
	}
	if (sum==N) {
		for(auto n:A) cout << n << endl ;
	} else {
		ll rest = sum - N ;
		ll M = A.size() ;
		vector<int> B ;
		FOR(i, 1, M+1) {
			//cout << A[M-i] << rest << endl ;
			if (A[M-i] > rest) {
				B.push_back(A[M-i]);
			} else {
				rest -= A[M-i] ;
			}
		}
		sort(ALL(B)) ;
		for(auto n:B) cout << n << endl ;
	}
}

Measured memory_bytes: 384
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int c = 0;
    for(int i = 1;i <= N;i++){
      c+=i;
    }
  System.out.println(c);
  }
}

Measured memory_bytes: 22612
import sys
import numpy as np

N = int(sys.stdin.readline())
ind = np.fromstring(sys.stdin.read(), dtype='i8', sep=' ').reshape((N, 2))
a = ind[:, 0]
b = ind[:, 1]
arg = np.argsort(b)
a = a[arg]
b = b[arg]
ac = np.add.accumulate(a)
if np.all(b - ac >= 0):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 23592
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main() {
  
  int N;
  cin >> N;

  vector<vector<int>> g(N,vector<int>(0));

  for(int i = 0;i < N-1;i++) {
    int a,b;
    cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  vector<int> color(N,0),seen(N,0);
  queue<int> Q;
  Q.push(0);
  seen[0] = 1;
  int w = 0,b = 0;
  w++;
  while(!Q.empty()) {
    int q = Q.front(); Q.pop();
    for(auto nv :g[q]) {
      if(seen[nv]) continue;
      Q.push(nv);
      seen[nv] = 1;
      if(color[q]) {
        color[nv] = 0;
        w++;
      }else {
        color[nv] = 1;
        b++;
      }
    }
  }

  int on = 1,tw = 2,th = 3;
  
  if(w > N/3 && b > N/3) {
      for(int i = 0;i < N;i++) {
        if(color[i]) {
          if(on <= N) {
            cout << on << " ";
            on+=3;
          }else {
            cout << th << " ";
            th+=3;
          }
        }else {
          if(tw <= N) {
            cout << tw << " ";
            tw+=3;
          }else {
            cout << th << " ";
            th+=3;
          }
        }
      }
  }else if(b <= N/3) {
      for(int i = 0;i < N;i++) {
        if(color[i]) {
            cout << th << " ";
            th+=3;
        }else {
          if(on <= N) {
            cout << on << " ";
            on+=3;
          }else if(tw <= N) {
            cout << tw << " ";
            tw+=3;
          }else {
            cout << th << " ";
            th+=3;
          }
        }
      }
  }else if(w <= N/3) {
      for(int i = 0;i < N;i++) {
        if(!color[i]) {
            cout << th << " ";
            th+=3;
        }else {
          if(on <= N) {
            cout << on << " ";
            on+=3;
          }else if(tw <= N) {
            cout << tw << " ";
            tw+=3;
          }else {
            cout << th << " ";
            th+=3;
          }
        }
      }
  }
  cout << endl;
  

}


Measured memory_bytes: 15220
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};

const long long MAX = 1000001;
const long long MOD = 1000000007;
long long inv[MAX];

void invAll(){
    inv[1] = 1;
    for(long long i = 2; i < MAX; i++){
        inv[i] = MOD - inv[MOD % i] *  (MOD / i) % MOD;
    }
}

ll N, A[10001], B[10001], maxp[1000001];
map<ll, ll> mp[10001];

signed main(){
    invAll();
    cin >> N;
    ll maxA = 0;
    REP(i, N){
        cin >> A[i];
        maxA = max(maxA, A[i]);
    }
    REP(i, N){
        ll n = A[i];
        for(ll j = 2; j * j <= A[i]; j++){
            if(n % j != 0) continue;
            while(n % j == 0){
                n /= j;
                mp[i][j]++;
            }
        }
        if(n > 1) mp[i][n]++;
        for(auto p : mp[i]){
            maxp[p.first] = max(maxp[p.first], p.second);
        }
    }
    ll L = 1;
    for(ll p = 2; p <= maxA; p++){
        REP(i, maxp[p]) L = (L * p) % MOD; 
    }
    ll ans = 0;
    REP(i, N) ans = (ans + L * inv[A[i]]) % MOD;
    PRINT(ans);
    return 0;
}

Measured memory_bytes: 17920
#include <bits/stdc++.h>
#define N 100020
#define ll long long
using namespace std;
inline int read(){
  int x=0,f=1;char ch=getchar();
  while(ch>'9'||ch<'0')ch=='-'&&(f=0)||(ch=getchar());
  while(ch<='9'&&ch>='0')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
  return f?x:-x;
}
int a[N];
int main(int argc, char const *argv[]) {
  int n = read(), l = read();
  for (int i = 1; i <= n; ++ i) {
    a[i] = read();
  }
  int flag = 0;
  for (int i = 1; i < n; ++ i) {
    if (a[i] + a[i + 1] >= l) {
      flag = i;
      break;
    }
  }
  if (!flag) {
    return puts("Impossible"), 0;
  }
  puts("Possible");
  for (int i = 1; i < flag; ++ i) {
    printf("%d\n", i);
  }
  for (int i = n - 1; i > flag; -- i) {
    printf("%d\n", i);
  }
  printf("%d\n", flag);
  return 0;
}

Measured memory_bytes: 1152
using System;
using System.Linq;

namespace DPL_1_E
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1 = Console.ReadLine();
            string s2 = Console.ReadLine();
            int[,] dp = new int[s1.Length + 1,s2.Length + 1];
            for (int i = 0; i <= s1.Length; i++) dp[i,0] = i;
            for (int i = 0; i <= s2.Length; i++) dp[0,i] = i;
            for (int i = 1; i <= s1.Length; i++)
            {
                for (int j = 1; j <= s2.Length; j++)
                {
                    int cost = s1[i - 1] == s2[j - 1] ? 0 : 1;
                    int[] a = new int[] { dp[i - 1,j] + 1,dp[i,j - 1] + 1,dp[i - 1,j - 1] + cost };
                    dp[i,j] = a.Min();
                }
            }
            Console.WriteLine(dp[s1.Length,s2.Length]);
        }
    }
}


Measured memory_bytes: 16748
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
 
int main() {
    string S;
    cin >> S;

    int n = S.size();
    int flag = 0;

    for(int i = 0; i < n; i++) {
        for(int j = i+1; j < n; j++) {
            if(S[i] == S[j]) {
                flag = 1;
                break;
            }
        }
        if(flag == 1) {
            break;
        }
    }

    if(flag == 0) {
        cout << "yes";
    }
    else {
        cout << "no";
    }
    
    cout << endl;
    return 0;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    priority_queue<long> que;
    for (int i = 0; i < n; i++) {
        long e;
        cin >> e;
        que.emplace(e);
    }
    
    while (m--) {
        long e = que.top(); que.pop();
        que.emplace(e / 2);
    }
    
    long ans = 0;
    while (not que.empty()) {
        ans += que.top();
        que.pop();
    }
    
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 1400
// In The Name Of Allah
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair <int, int> pii;
 
#define error(x) cout << #x << " = " << x << endl;
 
const int N = 1e5 + 5, mod = 1e9 + 7;
const ll inf = 1e15;
 
inline int sum(int a, int b) {
	a += b;
	if(a >= mod)
		a -= mod;
	if(a < 0)
		a += mod;
	return a;
}
 
inline int mult(int a, int b) {
	return (1LL * a * b) % mod;
}
 
int n, m, dp[N][2], S, T;
ll dist[N][2];
vector <pii> adj[N];
vector <pair <pii, int> > edge;
 
inline void dijkstra(int src, int id) {
	for (int i = 0; i < n; i++)
		dist[i][id] = inf;
	dp[src][id] = 1;
	dist[src][id] = 0;
	set <pair <ll, int>> s;
	s.insert({0, src});
	while(!s.empty()) {
		pair <ll, int> p = (*s.begin());
		s.erase(p);
		int v = p.second;
		for (auto e : adj[v]) {
			int u = e.first, w = e.second;
			if(dist[u][id] > dist[v][id] + w) {
				s.erase({dist[u][id], u});
				dist[u][id] = dist[v][id] + w;
				s.insert({dist[u][id], u});
				dp[u][id] = dp[v][id];
			}
			else if(dist[u][id] == dist[v][id] + w)
				dp[u][id] = sum(dp[u][id], dp[v][id]);
		}
	}
}
 
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);	
	cin >> n >> m >> S >> T;
	S--, T--;
	for (int i = 0; i < m; i++) {
		int v, u, w;
		cin >> v >> u >> w;
		v--, u--;
		adj[v].push_back({u, w});
		adj[u].push_back({v, w});
		edge.push_back({{u, v}, w});
	}
	dijkstra(S, 0);
	dijkstra(T, 1);
	int ans = mult(dp[S][1], dp[T][0]);
	// error(dp[S][1]);
	// error(dp[T][0]);
	for (int i = 0; i < n; i++) {
		if(dist[i][0] == dist[i][1]) {
			// error(i);
			ans = sum(ans, - mult(mult(dp[i][0], dp[i][0]), mult(dp[i][1], dp[i][1])));
		}
	}

	for (auto e : edge) {
		int vv = e.first.first, uu = e.first.second, w = e.second;
		for (auto x : {make_pair(vv, uu), make_pair(uu, vv)}) {
			int v = x.first, u = x.second;
			if(dist[v][0] < (dist[S][1] / 2) && dist[u][1] < (dist[S][1] / 2) && dist[v][0] + dist[u][1] + w == dist[S][1]) {
				ans = sum(ans, -mult(mult(dp[v][0], dp[u][1]), mult(dp[v][0], dp[u][1])));
			}
		}
	}

	cout << ans << "\n";
 
}

Measured memory_bytes: 22156
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,a,b;
  cin >> n >> m;
  bool t=true;
  int ans[n],num[n];
  for(int i=0;i<n;i++)ans[i]=0;
  if(m==0){
    if(n>=2)cout << 1;
    else cout << 0;
    for(int i=0;i<n-1;i++)cout << 0;
    cout << endl;
    t=false;
  }
  for(int i=0;i<m;i++){
    cin >> a >> b;
    if(num[a-1]==1 && ans[a-1]!=b){
      cout << -1 << endl;
      t=false;
    }
    ans[a-1]=b;
    num[a-1]=1;
    if(a==1 && b==0 && n>=2){
      t=false;
      cout << -1  << endl;
    }
  }
  if(t){
  for(int i=0;i<n;i++){
    if(num[i]==0 && i==0 && n>=2)ans[i]=1;
    else continue;
  }
  for(int i=0;i<n;i++)cout << ans[i];
  cout << endl;
  }
}

Measured memory_bytes: 3644
import java.io.*;
import java.util.*;
public class Main{
   public static String baseConversion(String number, 
                                 int sBase, int dBase) 
    {
        return Integer.toString( 
            Integer.parseInt(number, sBase), 
            dBase); 
    } 
     public static void main(String []args){
       Scanner s=new Scanner(System.in);
       long n=s.nextLong();
       int k=s.nextInt();
       String c=String.valueOf(n);
       System.out.println(baseConversion(c,10,k).length());
     }}

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

using namespace std;

#define ll long long
#define mod ((ll)1e9 + 7)

//#define TEST

signed main(){
    ll n;
    int k;
    cin >> n >> k;

    if (n == 1){
        cout << 1 << endl;
        return 0;
    }

    ll sq = (ll)sqrt(n); // √n
    if (sq * (sq + 1) > n) --sq;
    ll* st = new ll[sq + 1];
    for (int i = 1;i <= sq;++i)
        st[i] = n / (i + 1) + 1;
    ll* ct = new ll[sq + 1];
    ct[1] = n - st[1] + 1;
    for (int i = 2;i <= sq;++i)
        ct[i] = st[i - 1] - st[i];

#ifdef TEST
    cout << "---------st---------" << endl;
    for (int i = 1;i <= sq;++i)
        cout << st[i] << " ";
    cout << endl;
    cout << "---------ct---------" << endl;
    for (int i = 1;i <= sq;++i)
        cout << ct[i] << " ";
    cout << endl;
#endif

    ll** dp1 = new ll*[k + 1];
    ll** dp2 = new ll*[k + 1];
    for (int i = 0;i <= k;++i){
        dp1[i] = new ll[st[sq]];
        dp2[i] = new ll[sq + 1];
    } 
    // 初期化
    for (int i = 1;i < st[sq];++i)
        dp1[1][i] = 1;
    for (int i = 1;i <= sq;++i)
        dp2[1][i] = ct[i];
    // 遷移
    for (int i = 2;i <= k;++i){
        /* dp1の直前の累積和を求める */
        vector<ll> sum1{0};
        for (int j = 1;j < st[sq];++j){
            auto iter = sum1.end() - 1;
            sum1.push_back((*iter + dp1[i - 1][j]) % mod);
        }
        /* dp2の直前の累積和を求める */
        vector<ll> sum2{0};
        for (int j = 1;j <= sq;++j){
            auto iter = sum2.end() - 1;
            sum2.push_back((*iter + dp2[i - 1][j]) % mod);
        }
        /* dp1を更新する */
        for (int j = 1;j < st[sq];++j)
            dp1[i][j] = (sum1[st[sq] - 1] + (sum2[sq] - sum2[(int)min((ll)j - 1,sq)] + mod) % mod) % mod;
        /* dp2を更新する */
        for (int j = 1;j <= sq;++j)
            dp2[i][j] = sum1[(int)min((ll)j,st[sq] - 1)] * ct[j] % mod;
    }

#ifdef TEST
    cout << "---------dp---------" << endl;
    for (int i = 1;i <= k;++i){
        for (int j = 1;j < st[sq];++j)
            cout << dp1[i][j] << " ";
        for (int j = 1;j <= sq;++j)
            cout << dp2[i][j] << " ";
        cout << endl;
    }
#endif

    ll ans = 0;
    for (int j = 1;j < st[sq];++j){
        ans += dp1[k][j];
        ans %= mod;
    }
    for (int j = 1;j <= sq;++j){
        ans += dp2[k][j];
        ans %= mod;
    }

#ifdef TEST
    cout << "---------ans--------" << endl;
#endif
    //if (ans < 0) ans += mod;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 51100
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

ll gcd(ll a, ll b){
    if(b == 0) return a;
    if(a < b){
        ll swap = a;
        a = b;
        b = swap;
    }

    while(b != 0){
        ll tmp = b;
        b = a%b;
        a = tmp;
    }

    return a;
}

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    vector<ll> ag(n);
    rep(i, n) ag[i] = gcd(a[i], a[0]);
    sort(ag.begin(), ag.end());
    cout << ag[0] << endl;
    return 0;
}

Measured memory_bytes: 1792
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define V vector
template <typename T> bool chmin(T &a, const T &b) {if(a > b){a = b; return true;} return false;}
template <typename T> bool chmax(T &a, const T &b) {if(a < b){a = b; return true;} return false;}
template<typename A, size_t N, typename T> void Fill (A (&array)[N], const T & val) {fill ((T*)array, (T*)(array+N), val);}
V<int> dx = {-1, 1,  0, 0, -1, -1,  1, 1};
V<int> dy = { 0, 0, -1, 1, -1,  1, -1, 1};

int main () {
    int n; cin >> n;
    V<int> a(1e6+5, 0);
    int g = 0;
    rep(i, n) {
        int x; cin >> x;
        a[x]++;//a[x]:xを因数に含むものの個数
        g = __gcd(g, x);
    }
    for (int i = 1; i <= 1e6; i++) {
        for (int j = 2; i*j <= 1e6; j++) {
            a[i] += a[i*j];
        }
    }
    bool ps = true;
    for (int i = 2; i <= 1e6; i++) {
        if (a[i] > 1) ps = false;
    }
    if (ps) {
        puts("pairwise coprime");
        return 0;
    }

    if (g == 1) puts("setwise coprime");
    else puts("not coprime");

    return 0;
}

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

#define lli long long int
#define REP(i,s,n) for(lli i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define MOD (1000000007)
#define TO_STRING(VariableName) # VariableName
#define LOG(xx) if(DEBUG)cout<<TO_STRING(xx)<<"="<<xx<<" "<<endl;
#define LOG2(xx,yy) if(DEBUG)cout<<TO_STRING(xx)<<"="<<xx<<" "<<TO_STRING(yy)<<"="<<yy<<endl;
#define LOG3(xx,yy,z) if(DEBUG)cout<<TO_STRING(xx)<<"="<<xx<<" "<<TO_STRING(yy)<<"="<<yy<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,xx,yy,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(xx)<<"="<<xx<<" "<<TO_STRING(yy)<<"="<<yy<<" "<<TO_STRING(z)<<"="<<z<<endl;

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; }
typedef struct UnionFind{
    vector<lli> par; //par[i]:iの親番号 par[3] = 2 : 3の親が2
    vector<lli> size;//size[i]:iの大きさ 自分のみのときは1,根っこにsizeを持たせる*/

    UnionFind(int N){/*最初はすべてが根であると初期化*/
        REP(i,0,N){
            par.push_back(i);
            size.push_back(1);
        }
    }

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

    void unite(lli x,lli y){/*xとyの併合*/
        lli rx = root(x);
        lli ry = root(y);
        if(rx == ry)return;
        par[rx] = ry; /*xとyの根が同じじゃない: xの根をrxをyの根ryに変更する */
        lli resize = size[rx] + size[ry];
        size[rx] = resize;
        size[ry] = resize;
    }

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

    lli getSize(lli x){
        lli rx = root(x);
        return size[rx];
    }
};

void solve(){

	lli n,m;
	cin>>n>>m;
	UnionFind uf(n);
	REP(i,0,m){
		lli a,b;
		cin>>a>>b;
		a--,b--;
		uf.unite(a,b);
	}
	lli ans = 0;
	REP(i,0,n){
		chmax(ans,uf.getSize(i));
	}
	cout<<ans<<endl;

}

int main(){
	
    // cout << fixxed << setprecision(5);
    lli t=1;
    //cin>>t;
    while(t--)solve();

    return 0;
}


Measured memory_bytes: 12544
#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

const int My_Inf=2147483647;
const long long int My_LInf=9223372036854775807;

int num[5001][5001];
int sum[5001][5001];

int main() {
	memset(num, 0, sizeof(num));
	memset(sum, 0, sizeof(num));
	int N, M; cin >> N >> M;
	vector<pair<int, int>>tres;
	vector<int>xs, ys;
	for (int i = 0; i < N; ++i) {
		int x, y; cin >> x >> y;
		tres.push_back(make_pair(x, y));
		xs.push_back(x);
		ys.push_back(y);
	}
	sort(xs.begin(), xs.end());
	xs.resize(unique(xs.begin(), xs.end()) - xs.begin());
	sort(ys.begin(), ys.end());
	ys.resize(unique(ys.begin(), ys.end()) - ys.begin());
	for (int i = 0; i < N; ++i) {
		tres[i].first = lower_bound(xs.begin(), xs.end(), tres[i].first) - xs.begin();
		tres[i].second = lower_bound(ys.begin(), ys.end(), tres[i].second) - ys.begin();
	}
	for (int i = 0; i < N; ++i) {
		num[tres[i].first][tres[i].second]++;
	}
	for (int i = 0; i < 5000; ++i) {
		for (int j = 0; j < 5000; ++j) {
			sum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + num[i][j];
		}
	}


	for (int i = 0; i < M; ++i) {
		int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
		x1 = lower_bound(xs.begin(), xs.end(), x1) - xs.begin();
		x2 = upper_bound(xs.begin(), xs.end(), x2) - xs.begin();
		y1 = lower_bound(ys.begin(), ys.end(), y1) - ys.begin();
		y2 = upper_bound(ys.begin(), ys.end(), y2) - ys.begin();
		int ans = sum[x2][y2] - sum[x2][y1] - sum[x1][y2] + sum[x1][y1];
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 198664