akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <numeric>
#include <float.h>
#include <math.h>
#include <sstream>
#include <iterator>
using namespace std;
// repマクロの定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロの定義
#define all(v) v.begin(), v.end()
// 大きい順
#define rall(v) v.rbegin(), v.rend()
#define vi vector<int>
#define vl vector<ll>
const  long long INF = 1LL << 60;
typedef  long long ll;
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;
}



int ctoi(char c) {
 	switch (c) {
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case '3': return 3;
		case '4': return 4;
		case '5': return 5;
		case '6': return 6;
		case '7': return 7;
		case '8': return 8;
		case '9': return 9;
		default: return 0;
	}
}

bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: // fall-through
        case 3: return true;
    } // n > 3 が保証された

    if(n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である

    // 6の倍数前後の数を使って試し割りをする
    for(unsigned i = 5; i * i <= n; i += 6) {
        if(n % i     == 0) return false; // (6の倍数)-1
        if(n % (i+2) == 0) return false; // (6の倍数)+1
    }

    return true;
}

map<ll,ll> mp;

auto findFactors(ll num){
	
    ll i;
    while (num % 2 == 0){ // 偶数の素数は2のみ
        if(mp.count(2)){
			mp[2] = mp[2] + 1;
		}
		else{
			mp[2] = 1;
		}
        num /= 2;
    }
    for (i = 3; i <= num; i++){ // 他の素数で割っていく
        while (num % i == 0){
			if(mp.count(i)){
			mp[i] = mp[i] + 1;
		}
		else{
			mp[i] = 1;
		}
            num /= i;
        }
    }
    return 0;
}
ll kaizyou(ll n){
    if(n == 1){
        return 1;
    }
    else{
        return (n * kaizyou(n-1)) % 1000000007;
    }
}

int main(){
ll N ,K; cin >> N >> K;
map <ll,ll> mp;
rep(i,N){
    ll a,b; cin >> a >> b;
    if(!mp[a]){
        mp[a] = b;
    }
    else mp[a] += b;
}
ll cnt = K;
    for(auto u: mp){
        if(cnt - u.second > 0){
            cnt -= u.second;
        }
        else{
            cout << u.first << endl;
            break;
        }
    }
}

Measured memory_bytes: 4224
monster, skill = map(int,input().split())

monster_hp = list(map(int,input().split()))

monster_hp.sort()

attack_count = 0

while(skill>0):
    skill -= 1
    if len(monster_hp) > 0:    
        monster_hp.pop(-1)
    

for hp in monster_hp:
    attack_count += hp

print(attack_count)

Measured memory_bytes: 26024
#include <cstring>
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 5010;
const int M = 1e9 + 7;

int main()
{
    int a, b,c;
    scanf("%d%d%d",&a,&b,&c);
    if (a == b && b !=c ){
        printf("Yes\n");
    }
    else if (a == c &&a != b){
        printf("Yes\n");
    }
    else if (a != b && b == c){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 256
import itertools
import bisect

N = int(input())
S = input()
R_set = set()
G_set = set()
B_set = set()
R = []
G = []
B = []
R_ids = [0] * N
G_ids = [0] * N
B_ids = [0] * N

for i, s in enumerate(S):
    if s == 'R':
        R_set.add(i)
        R.append(i)
        R_ids[i] = 1
    elif s == 'G':
        G_set.add(i)
        G.append(i)
        G_ids[i] = 1
    else:
        B_set.add(i)
        B.append(i)
        B_ids[i] = 1


R_ids = list(itertools.accumulate(reversed(R_ids)))[::-1]
G_ids = list(itertools.accumulate(reversed(G_ids)))[::-1]
B_ids = list(itertools.accumulate(reversed(B_ids)))[::-1]

ans = 0
for r_idx in R:
    start = bisect.bisect_left(G, r_idx)
    for g_idx in G[start:]:
        diff = g_idx - r_idx
        num = B_ids[g_idx]
        if g_idx+diff in B_set:
            num -= 1
        ans += num
    
    start = bisect.bisect_left(B, r_idx)
    for b_idx in B[start:]:
        diff = b_idx - r_idx
        num = G_ids[b_idx]
        if b_idx+diff in G_set:
            num -= 1
        ans += num

for g_idx in G:
    start = bisect.bisect_left(R, g_idx)
    for r_idx in R[start:]:
        diff = r_idx - g_idx
        num = B_ids[r_idx]
        if r_idx+diff in B_set:
            num -= 1
        ans += num
    
    start = bisect.bisect_left(B, g_idx)
    for b_idx in B[start:]:
        diff = b_idx - g_idx
        num = R_ids[b_idx]
        if b_idx+diff in R_set:
            num -= 1
        ans += num

for b_idx in B:
    start = bisect.bisect_left(G, b_idx)
    for g_idx in G[start:]:
        diff = g_idx - b_idx
        num = R_ids[g_idx]
        if g_idx+diff in R_set:
            num -= 1
        ans += num
    
    start = bisect.bisect_left(R, b_idx)
    for r_idx in R[start:]:
        diff = r_idx - b_idx
        num = G_ids[r_idx]
        if r_idx+diff in G_set:
            num -= 1
        ans += num


print(ans)

Measured memory_bytes: 9692
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <memory.h>
#include <math.h>

#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define MIN(a, b) (((a) > (b)) ? (b) : (a))
#define SWAP(t, a, b) do{t c = a; a = b; b = c;}while(0)

int main (int argc, char **argv)
{
  char *s = NULL;
  int64_t *ans = NULL;
  int64_t len = 0;
  int64_t d = 0;
  int64_t i = 0;
  int64_t j = 0;

  s = (char *)malloc(1000001 * sizeof(char));
  ans = (int64_t *)calloc(1000000, sizeof(int64_t));

  scanf("%s", s);
  len = strlen(s);

  for(i = 0; i < len; i++)
  {
    if(s[i] == 'R')
    {
      for(j = i + 1; j < len; j++)
      {
        if(s[j] == 'L')
        {
          break;
        }
      }

      d = j - i;
      if(d & 1)
      {
        ans[j - 1] += (d / 2) + 1;
        ans[j] += (d / 2);
      }
      else
      {
        ans[j - 1] += (d / 2);
        ans[j] += (d / 2);
      }

      i = j - 1;
    }
    else
    {
      for(j = i + 1; j < len; j++)
      {
        if(s[j] == 'R')
        {
          break;
        }
      }

      d = j - i;
      if(d & 1)
      {
        ans[i] += (d / 2) + 1;
        ans[i - 1] += (d / 2);
      }
      else
      {
        ans[i] += (d / 2);
        ans[i - 1] += (d / 2);
      }
      i = j - 1;
    }
  }

  for(i = 0; i < len; i++)
  {
    printf("%lld ", ans[i]);
  }
  printf("\n");

  free(s);
  free(ans);

  return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 1e5+10;
inline char get() {
	static char buf[100000], *S = buf, *T = buf;
	if (S == T) {
		T = (S = buf) + fread(buf, 1, 100000, stdin);
		if (S == T) return EOF;
	}
	return *S++;
}
inline void read(int &x) {
	static char c; x = 0; int sgn = 0;
	for (c = get(); c < '0' || c > '9'; c = get()) if (c == '-') sgn = 1;
	for (; c >= '0' && c <= '9'; c = get()) x = x * 10 + c - '0';
	if (sgn) x = -x;
}

int n;
int v[N][3];
int dp[2][3];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  read(n);
  for (int i = 0; i < n; i++) {
    read(v[i][0]); read(v[i][1]); read(v[i][2]);
  }
  for (int j = 0; j < 3; j++) {
    dp[0][j] = v[0][j];
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      dp[1][j] = 0;
      for (int k = 0; k < 3; k++) {
        if (j == k) continue;
        dp[1][j] = max(dp[1][j], dp[0][k] + v[i][j]);
      }
    }
    swap(dp[0], dp[1]);
  }
  cout << *max_element(dp[0], dp[0] + 3) << nl;
  return 0;
}


Measured memory_bytes: 1536
def mi():return map(int,input().split())
A,B,M=mi()
a=list(mi())
b=list(mi())
ans=min(a)+min(b)
for _ in range(M):
    x,y,c=mi()
    ans=min(ans,a[x-1]+b[y-1]-c)
print(ans)

Measured memory_bytes: 18608
#include <iostream>
#include <algorithm>
#include <string.h>

using namespace std;

long long f(long long x, long long y) {
    long long X, i;
    X=1;
    for (i=0; i<y; i++) X*=x;
    return X;
}

int main(void) {
    long long N, n, x, A[200005], i, j;
    char S[15];
    scanf("%lld", &N);
    for (i=0; i<N; i++) {
        scanf("%s", S);
        n=strlen(S);
        A[i]=0;
        for (j=0; j<n; j++) {
            A[i]+=(S[j]-'a'+1)*f(26, j);
        }
        // printf("%lld\n", A[i]);
    }
    sort(A, A+N);
    x=N;
    for (i=0; i<N-1; i++) {
        if (A[i]==A[i+1]) x--;
        // printf("%lld\n", A[i]);
    }
    
    printf("%lld", x);
    return 0;
}


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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N, Q;
    cin >> N;
    vector<ll> A(N);
    REP(i, N)
    {
        cin >> A[i];
    }
    cin >> Q;
    vector<ll> B(Q), C(Q);
    REP(i, Q)
    {
        cin >> B[i] >> C[i];
    }
    ll sumA = 0;
    map<ll, ll> countMap;
    REP(i, N)
    {
        sumA += A[i];
        countMap[A[i]]++;
    }
    REP(i, Q)
    {
        if (countMap.find(B[i]) != countMap.end())
        {
            sumA -= B[i] * countMap[B[i]];
            sumA += C[i] * countMap[B[i]];
            countMap[C[i]] += countMap[B[i]];
            countMap[B[i]] = 0;
        }
        cout << sumA << endl;
    }
}


Measured memory_bytes: 10608
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
typedef long long ll;
typedef vector<vector<ll>> vvi;
typedef vector<ll> vi;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;

ll max(ll x,ll y){
  if(x>y)return x;
  else return y;
}

int main(){
  ll n;
  cin >> n;
  vi a(5);
  ll MIN=1000000000000000;
  rep(i,5){
    cin >> a[i];
    MIN=min(MIN,a[i]);
  }
  
  cout << (n+MIN-1)/MIN+4 << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  int a,b,t;
  cin>>a>>b>>t;

  cout<<(t/a)*b<<endl;

  return 0;
}


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


using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<string> &o) {
    string a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

typedef pair<ll, ll> P;

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;


int main() {
    int n;
    cin >> n;
    vector<ll> numbers(n);
    rep(i, n) cin >> numbers[i];
    vector<ll> indexes(n);
    rep(i, n) indexes[numbers[i] - 1] = i;
    vector<ll> as(n), bs(n);
    rep(i, n) {
        ll r = indexes[i];
        ll a = 30000 * (i + 1);
        ll b = 30000 * (n - (i + 1)) + r + 1;
        as[i] = a;
        bs[i] = b;
    }

    rep (i, n) {
        cout << as[i];
        if (i != n - 1) cout << ' ';
    }
    cout << endl;
    rep (i, n) {
        cout << bs[i];
        if (i != n - 1) cout << ' ';
    }
    cout << endl;
}


Measured memory_bytes: 1280
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<vector>
#define inf 2147483647
#define rep(i,a,b) for(int i=a;i<b;i++)
#define  rr read()
#define ll long long
#define repb(i,a,b) for(int i=a;i<=b;i++)
#define CloseIo   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
ll read()
{
    char ch = getchar();
	int x = 0, f = 1;
    while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
    while('0' <= ch && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
    return x * f;
}
const int N = 1e5+5;

int a[N] = {0};
int b[N] = {0};
int main(){
  int n,m;
  cin>>n>>m;
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  sort(a,a+n);
  vector<pair<int,int> >v;
 for(int i=0;i<m;i++)
{

    int x,y;
    cin>>x>>y;
    v.push_back({y,x});
  }
  sort(v.begin(),v.end());

  int k=m-1;
  for(int i=0;i<n;i++)
  {
    if(a[i]<v[k].first)
	{
      a[i]=v[k].first;
      v[k].second--;
    }
    if(!v[k].second){
      k--;
    }
    if(k<0) 
	 break;
    
  }
  long long sum = 0;
  for(int  i=0;i<n;i++)
  {
    sum += a[i];
  }
cout<<sum;

}


Measured memory_bytes: 1784
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
 
#pragma GCC optimize("inline","fast-math","unroll-loops","no-stack-protector")
#pragma GCC diagnostic error "-fwhole-program"
#pragma GCC diagnostic error "-fcse-skip-blocks"
#pragma GCC diagnostic error "-funsafe-loop-optimizations"

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const int packSize = 8;
const int packSizeH = 4;

int main(){
	ll s,t;
	ll p,q,M;
	ll y;
	cin>>s>>t;
	cin>>p>>q>>M;
	cin>>y;
	p %= M;
	q %= M;

	// (((x*p+q)*p+q)*p+q)*p+q
	// p^4*x + p^3*q + p^2*q + p*q + q
	// p^4*x + (((p+1)*p+1)*p+1)*q

	ll P = p * p % M * p % M * p % M * p % M * p % M * p % M * p % M;
	ll Q = (((((((p + 1) * p % M + 1) * p % M + 1)* p % M + 1)* p % M + 1)* p % M + 1)* p % M + 1) * q % M;

	ll r[packSize] = {y};
	ll a[packSize] = {0};

	for(int i = 1; i < packSize; ++i){
		a[i] = (a[i-1]*p + q)%M;
	}
	
	const int T = 1e8;
	for(int i = 0; i < T; i+=packSize){
		for(int j = 0; j < packSizeH; ++j){
			r[j] ^= a[j];
			a[j] = (a[j]*P+Q)%M;
 		}
		for (int j = packSizeH; j < packSize; ++j) {
			r[j] ^= a[j];
			a[j] = (a[j]*P+Q)%M;
 		}
	}
	ll res = r[0];
	for(int i = 1; i < packSize; ++i){
		res ^= r[i];
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
#define m_p make_pair
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    int p,q,r;
    cin >> p >> q >> r;
    cout << p+q+r-max({p,q,r}) << endl;
    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int INF=1001001001;
const int INFLL=1001001001001001001ll;
const int mod=1000000007;
inline void am(int &a,int b){
    a+=b;
    if(a>=mod)a-=mod;
}

int K;
int N;
int A[55];

signed main(){
    cin>>N;
    rep(i,N)cin>>A[i];

    int latte=accumulate(A,A+N,0ll);
    latte=max(0ll,latte-100000);

    int ans=latte;

    rep(i,N)A[i]+=latte;
    rep(i,N){
        int tmp=A[i]/(N+1);
        chmin(tmp,latte);
        A[i]-=tmp*(N+1);
        latte-=tmp;
    }
    assert(latte==0);

    while(true){
        int ma=max_element(A,A+N)-A;
        if(A[ma]<N){
            cout<<ans<<endl;
            return 0;
        }
        A[ma]-=N;
        rep(i,N)if(i!=ma)A[i]++;
        ans++;
    }


}


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

int main()
{
  int K;
  string S;

  cin >> K >> S;

  if (S.length() <= K)
  {
    cout << S << endl;
  }
  else
  {
    string ans = S.substr(0, K);
    ans += "...";
    cout << ans << endl;
  }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define endl "\n"
#define F first
#define S second
#define EN cout<<endl;
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
const ll mod=1000000007;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yes(T b){if(b)out("yes");else out("no");}
template<class T> void Yes(T b){if(b)out("Yes");else out("No");}
template<class T> void YES(T b){if(b)out("YES");else out("NO");}
template<class T> void no(T b){if(b)out("no");else out("yes");}
template<class T> void No(T b){if(b)out("No");else out("Yes");}
template<class T> void NO(T b){if(b)out("NO");else out("YES");}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){ll res=1;a%=mod;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}
 


int main(){
    ll n;
    cin>>n;
    string s="";
    while(n){
        n--;
        s="a"+s;
        s[0]+=(n%26);
        n/=26;
        
    }
    cout<<s<<endl;
    
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v) cerr << #v << ":"; rep(i, v.size()) cerr << " " << v[i]; cerr << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;
const double pi = 3.14159265358979323846;

int main(){
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    double L, S;
    L = 30 * h + m / 2.0;
    S = m * 6;
    double diff = abs(L - S);
    if (diff > 180) diff = 360 - diff;
    double ans = a * a + b * b - 2 * a * b * cos(diff / 180 * pi);
    ans = sqrt(ans);
    cout << fixed << setprecision(15) << ans << endl;
}


Measured memory_bytes: 4072
#include "bits/stdc++.h"
using namespace std;
using P = pair<double, double>;

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

    int a, b, h, m;
    cin >> a >> b >> h >> m;

    P coorA, coorB;
    if ((h == 0 && m == 0) || (h == 6 && m == 0))
        coorA.first = 0.0;
    else
        coorA.first = a * cos(M_PI / 2.0 - ((double)h + (double)m / 60.0) / 12.0 * 2.0 * M_PI);
    if ((h == 3 && m == 0) || (h == 9 && m == 0))
        coorA.second = 0.0;
    else
        coorA.second = a * sin(M_PI / 2.0 - ((double)h + (double)m / 60.0) / 12.0 * 2.0 * M_PI);

    if (m == 0 || m == 30)
        coorB.first = 0.0;
    else
        coorB.first = b * cos(M_PI / 2.0 - (double)m / 60.0 * 2.0 * M_PI);
    if (m == 15 || m == 45)
        coorB.second = 0.0;
    else
        coorB.second = b * sin(M_PI / 2.0 - (double)m / 60.0 * 2.0 * M_PI);

    double dist = sqrt(pow(coorA.first - coorB.first, 2) + pow(coorA.second - coorB.second, 2));
    // cout << coorA.first << ' ' << coorA.second << '\n';
    // cout << coorB.first << ' ' << coorB.second << '\n';
    printf("%.12f\n", dist);
    return 0;
}

Measured memory_bytes: 4216
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
//#define int long long int
using namespace std;

int main(){
   int a,b; cin>>a>>b;
   if((a+b) % 2 == 0) cout<<(a+b)/2<<endl;
   else cout<<"IMPOSSIBLE"<<endl;
    return 0 ;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
const int inf = 1ll << 61;
typedef pair<int, int> P;


struct RAQ {
	int n = 1;
	vector<int>node, lazy;
	void init(int N) {
		while (n < N)n *= 2;
		node.resize(2 * n - 1);
		lazy.resize(2 * n - 1);
	}
	void eval(int k, int l, int r) {
		if (!lazy[k])return;
		node[k] += lazy[k] * (r - l);
		node[k] %= mod;
		if (k < n - 1) {
			rep(i, 2) {
				lazy[2 * k + i + 1] += lazy[k];
				lazy[2 * k + i + 1] %= mod;
			}
		}
		lazy[k] = 0;
	}
	void update(int a, int b, int x, int k, int l, int r) {
		eval(k, l, r);
		if (r <= a || b <= l)return;
		if (a <= l&&r <= b) {
			lazy[k] += x;
			lazy[k] %= mod;
			eval(k, l, r);
			return;
		}
		update(a, b, x, k * 2 + 1, l, (l + r) / 2);
		update(a, b, x, k * 2 + 2, (l + r) / 2, r);
		node[k] = node[k * 2 + 1] + node[k * 2 + 2];
		node[k] %= mod;
	}
	int calc(int a, int b, int k, int l, int r) {
		eval(k, l, r);
		if (r <= a || b <= l)return 0;
		if (a <= l&&r <= b)return node[k];
		int vl = calc(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = calc(a, b, k * 2 + 2, (l + r) / 2, r);
		return (vl + vr) % mod;
	}
	void add(int a, int b, int x) {
		update(a, b, x, 0, 0, n);
	}
	int getsum(int a, int b) {
		return calc(a, b, 0, 0, n);
	}
};
struct rmq {
	int n;
	vector<P>dat;
	void init(int n_) {
		n = 1;
		while (n < n_)n *= 2;
		dat.resize(2 * n - 1,P( inf,0));
	}
	void update(int k, P a) {
		k += n - 1;
		dat[k] = a;
		while (k > 0) {
			k = (k - 1) / 2;
			dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
		}
	}
	P query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l)return P(inf,0);
		if (a <= l&&r <= b)return dat[k];
		else {
			return min(query(a, b, 2 * k + 1, l, (l + r) / 2),query(a,b,k*2+2,(l+r)/2,r));
		}
	}
	P getmin(int a, int b) {//[a,b)
		return query(a, b, 0, 0, n);
	}
};

rmq seg[2];
int p[200006];
int fin[200006];

signed main() {
	int n; cin >> n;
	seg[0].init(n); seg[1].init(n);
	rep(i, n) {
		cin >> p[i];
		seg[i & 1].update(i, P(p[i], i));
	}
	vector<int>ans;
	fin[0] = n;
	priority_queue<P, vector<P>, greater<P>>Q1;
	Q1.push(P(seg[0].getmin(0, n).first, 0));
	while(Q1.size()) {
		P tp = Q1.top(); Q1.pop();
		int F = tp.first, S = tp.second;
		ans.push_back(F);
		int pos1 = seg[S & 1].getmin(S, fin[S]).second;
		P np = seg[(S + 1) & 1].getmin(pos1 + 1, fin[S]);
		ans.push_back(np.first);
		int pos2 = np.second;

		seg[S & 1].update(pos1, P(inf, 0));
		seg[(S + 1) & 1].update(pos2, P(inf, 0));
	//	cout << S<<' '<<pos1 << ' ' << pos2 << fin[S]<<endl;
		if(pos1-S>=2)Q1.push(P(seg[S & 1].getmin(S, pos1).first, S));
		if(pos2-pos1>=3)Q1.push(P(seg[(pos1 + 1) & 1].getmin(pos1 + 1, pos2).first, pos1 + 1));
		if(fin[S]-pos2>=3)Q1.push(P(seg[(pos2 + 1) & 1].getmin(pos2 + 1, fin[S]).first, pos2 + 1));

		fin[pos1 + 1] = pos2;
		fin[pos2 + 1] = fin[S];
		fin[S] = pos1;
	}
	rep(i, n) {
		if (i)cout << ' ';
		cout << ans[i] ;
	}cout << endl;
}

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

#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,fma")

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace IntModulo
{
	const int mod = 1e9 + 7;

	inline int add(int x, int y, int m = mod)
	{
		if (x + y < m)
			return x + y;
		return x + y - m;
	}

	inline int sub(int x, int y, int m = mod)
	{
		if (x >= y)
			return x - y;
		return x - y + m;
	}

	inline int mult(int x, int y, int m = mod)
	{
		return x * (LL) y % m;
	}

	inline int power(int x, int y, int m = mod)
	{
		int r = 1;
		while(y)
		{
			if (y & 1)
				r = mult(r, x, m);
			x = mult(x, x, m);
			y >>= 1;
		}
		
		return r;
	}
	
	inline int inverse(int x, int m = mod)
	{
		return power(x, m - 2, m);
	}
	
	inline void ADD(int& x, int y, int m = mod)
	{
		x += y;
		if (x >= m) x -= m;
	}
	
	inline void SUB(int& x, int y, int m = mod)
	{
		x -= y;
		if (x < 0) x += m;
	}
	
	inline void MULT(int& x, int y, int m = mod)
	{
		x = (x * (LL) y) % m;
	}
};

using namespace IntModulo;

const int N = 1 << 10;
int n;
int d[N][N];
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, 1, -1};
bool alive[N][N];
PII q[N * N];
int qh, qt;

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	cin >> n;
		
	FOR(i, 1, n + 1) FOR(j, 1, n + 1){
		d[i][j] = min(min(i - 1, n - i), min(j - 1, n - j));
	}
	
	LL res = 0;
	
	FOR(it, 0, n * n){
		int x;
		cin >> x;
		
		int posi = (x - 1) / n + 1;
		int posj = (x - 1) % n + 1;
		
		res += d[posi][posj];
		alive[posi][posj] = true;
		qh = qt = 0;
		q[qt++] = {posi, posj};
		
		while(qh < qt){
			posi = q[qh].X;
			posj = q[qh].Y;
			qh++;
			
			int D = d[posi][posj] + !alive[posi][posj];
			
			FOR(k, 0, 4){
				int i = posi + dx[k];
				int j = posj + dy[k];
				if (d[i][j] > D){				
					q[qt++] = {i, j};
					d[i][j] = D;					
				}
			}
		}	
	}
		
	cout << res << endl;
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 8124
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
//#pragma GCC optimize("unroll-loops")

#include "bits/stdc++.h"

using namespace std;

#define PI          3.1415926535897932384626433832795l

#define pb push_back
#define mp make_pair
#define lb lower_bound // First element which is not less than val
#define ub upper_bound // First element greater than val
#define f first
#define s second

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;

using pii = pair<int,int>;
using pll = pair<ll,ll>;

#define endl '\n'
#define re return
#define repz(i, a) for (ll i = 0; i < (a); i++)
#define vecin(n,v) for(ll i = 0; i < n; i++) cin>>v[i];
#define full(v) v.begin(),v.end()

void solve()
{
  string ans = "";
  string t = "ACL";
  int n;
  cin >> n;
  while(n--)
    ans += t;
  cout << ans << endl;
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  ll t = 1;
  //cin >> t;
  while (t--)
  {
    solve();
  }
}



Measured memory_bytes: 3604
#pragma GCC optimize("Ofast")

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

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

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

ll beki(ll a, ll b) {
	ll tmp = 1;
	REP(i, b) tmp *= a;
	return tmp;
}

bool used[5010][5010] = {};

int main() {

	int N;
	string S;
	vector<int> v[26];
	int cnt;
	int ans = 0;
	

	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	cin >> N >> S;

	REP(i, 26) v[i].reserve(5010);
	//らんだむに先頭とする二文字を選べばn^2で2500万？だめ
	REP(i, N) {
		//先頭おなじの記録
		v[S[i] - 'a'].emplace_back(i);
		//0~26がa~zに対応
	}
	REP(i, 26) {
		//あるアルファベットについてループ
		cnt = 0;
		REP(j, v[i].size()) {
			for (int k = j + 1; k < v[i].size(); k++) {
				//最長<=今の最大のときcontinue
//				REP(k, used[v[i][k]].size()) {
//				}
				if (v[i][k] - v[i][j] <= ans || used[v[i][k]][v[i][j]]) continue;
				REP(l, v[i][k] - v[i][j]) {
					if (v[i][k] + l < N && S[v[i][k] + l] == S[v[i][j] + l]) {
						cnt++;
						used[v[i][k] + l][v[i][j] + l] = true;
//						cout << S[v[i][k] + l];
					}
					else {
						break;
					}
				}
				ans = max(cnt, ans);
				cnt = 0;
//				cout << endl;
			}
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 24576
#include <cmath>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> t3;

int main(void) {
    ll n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    bool prev = s[0] == 'L';
    int h = 1;
    vector<int> revs;
    for(int i = 1;i < s.size();i++){
        bool left = s[i] == 'L';
        if(prev == left){
            h++;
        }
        else{
            revs.push_back(h);
            h=1;
        }
        prev = left;
    }
    revs.push_back(h);
    for(int i = 0;i < k;i++){
        if(revs.size() == 1){
            break;
        }
        if(revs.size() > 2){
            revs[0] += revs[1] + revs[2];
            revs.erase(revs.begin() + 1);
            revs.erase(revs.begin() + 1);
        }
        else{
            revs[0] += revs[1];
            revs.erase(revs.begin() + 1);
        }
    }
    ll sum = 0;
    for(auto e : revs){
        sum += e - 1;
    }
    cout << sum << endl;
    return 0;
}


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

#define ll long long
#define fast_in_out  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main()
{
    fast_in_out;
    int n,x,t;
    cin >> n >> x >> t;
    ll totalTime = 0, totalTakoyaki = 0;
    while(totalTakoyaki < n)
    {
        totalTime += t;
        totalTakoyaki += x;
    }
    cout << totalTime;
}


Measured memory_bytes: 3644
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    N=int(readline())
    A=list(map(int,readline().split()))

    res=0
    for i in range(N):
        n=A[i]
        while n%2==0:
            n//=2
            res+=1

    print(res)
if __name__=="__main__":
    main()

Measured memory_bytes: 4084
#include<set>
#include<iostream>
#include<map>
#include<vector>
#include<queue>
#include <utility>
#include<algorithm>

#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main()
{
    fast;



    long long a,b,c,d,e,f,target,i,j;
    long long sum=0;
    cin >> a >> target;

    map<long long,long long>mp;
    vector<long long>vec;
    while(a--)
    {
        cin >> b;
        vec.push_back(b);




    }
    vector<pair<long long,long long>>vec2;
    for(i=1;i<vec.size();i++)
    {
        vec2.push_back({vec[i]+vec[i-1],i});
    }
    sort(vec2.begin(),vec2.end());
    reverse(vec2.begin(),vec2.end());
    e=vec2[0].first;
    f=vec2[0].second;
    if(e>=target)
    {
        //cout << "f  ==  " << f << endl;
        cout << "Possible" << endl;
        for(i=1;i<f;i++)
            cout << i << endl;
        for(i=vec.size()-1;i>=f+1;i--)
        {
            cout << i << endl;
        }
        cout << f << endl;

    }
    else{
        cout << "Impossible" << endl;
    }









}


Measured memory_bytes: 6100
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	enums := enumPrime(N)
	ans := 0
	keys := []int{}
	for k, _ := range enums {
		keys = append(keys, k)
	}
	used := make(map[int]bool)
	for _, k := range keys {
		tmp := 1
		for enums[k] > 0 {
			tmp *= k
			if _, ok := used[tmp]; !ok {
				used[tmp] = true
				ans++
				tmp = 1
			}
			enums[k]--
		}
		used[k] = true
	}
	fmt.Println(ans)
}

func enumPrime(P int) (dividers map[int]int) {
	dividers = make(map[int]int)
	for i := 2; i*i <= P; i++ {
		tmp := 0
		_P := P
		_pow := i
		for _P%i == 0 {
			_pow *= i
			tmp++
			_P /= i
		}
		if tmp > 0 {
			dividers[i] = tmp
			P /= (_pow / i)
		}
	}
	if P > 0 {
		dividers[P] = 1
	}
	dividers[1] = 0
	return
}


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

int dp[405][405];
// dp[i][j] the minimum cost to combine between i , j
int solve(int i,int j,int *arr,int *pref){
    if(i>j) return 0;
    if(i == j) return dp[i][j] = 0;
    if(j-i+1 == 2) return dp[i][j] = arr[i]+arr[j];

    if(dp[i][j]!=-1) return dp[i][j];

    int wt = ULLONG_MAX;

    for(int x = i ; x <=j-1 ; x++){
        if(x == i){
            int rt = solve(i+1,j,arr,pref);
            wt = min(wt,arr[i]+rt + pref[j]-pref[i]);
        }
        else{
            int l = solve(i,x,arr,pref);
            int r = solve(x+1,j,arr,pref);
            int right = pref[j] - pref[x] ;
            int left = i==0?pref[x]:pref[x] - pref[i-1];

            wt = min(wt,l+r+left+right);
        }
    }
    return dp[i][j] = wt;
}


int32_t main(){

    foi(i,405){
        foi(j,405) dp[i][j] = -1;
    }
    int n;
    cin >> n;
    int *arr = new int[n];
    int *pref = new int[n];
    foi(i,n) cin >> arr[i];
    foi(i,n) pref[i] = i==0?arr[0]:arr[i]+pref[i-1];

    solve(0,n-1,arr,pref);

    cout << dp[0][n-1];

}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define li long int
#include<math.h>
#include<sstream>
#define str string
#define ll long long int
#define con continue

#define rt return 0
#define fr first
#define sec second
#define pb push_back
#define pf push_front
#define vb vct.begin()
#define ve vct.end()
#define ib it.begin()
#define ie it.end()
#define lb lst.begin()
#define le lst.end()
#define mb mp.begin()
#define me mp.end()
#define ms mp.size()
#define sb st.begin()
#define se st.end()
#define strb s.begin()
#define stre s.end() 
#define mxn 1000007
using namespace std;

int main()
{
  // ll tc;cin>>tc; while(tc--){
     
    //ll i,m,mn,j,k,n,ans=0,cnt=0;
    double d,t,v,veg;
    cin>>d>>t>>v;
    
    veg=d/(v*1.0);
    //cout<<vlcty<<endl;
     if(veg<=t)cout<<"Yes"<<endl;
     else cout<<"No"<<endl;
//}        
      return 0;
}
      

Measured memory_bytes: 3740
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define N 10000
#define false 0
#define true 1

int isprime(int);

int main(){

  int n,a[N],count=0,i;

  scanf("%d",&n);
  if(n>N)exit(1);

  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++){
    if(isprime(a[i])==true)count++;
  }
  printf("%d\n",count);

  return 0;
}

  
  
int isprime(int x){
  int i;
  if (x == 2)return true;
  if (x < 2 || x%2==0)return false;
  i = 3;
  while (i   <=sqrt(x)){
    if(x%i==0)return false;
    i = i + 2;
  }
  return true;
   }



Measured memory_bytes: 2796
#include <bits/stdc++.h>
// it starts with your mind
using namespace std;
typedef long long ll;
#define len length

int main()
{
ios_base::sync_with_stdio(0);
 cin.tie(0); cout.tie(0);
int t;
int cnt1 =0 , cnt2 = 0, cnt3 = 0, cnt4 = 0;
cin >> t;
for(int i = 0; i  < t ; i++)
{
    string s;
    cin >> s;
    if(s == "AC") cnt1++;
    else if(s == "WA") cnt2++;
    else if(s == "TLE") cnt3++;
    else cnt4++;
}
cout << "AC x " << cnt1 <<'\n';
cout <<"WA x " << cnt2 <<'\n';
cout << "TLE x " <<cnt3 <<'\n';
cout << "RE x " << cnt4;

   return 0;
}




Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
using namespace std;

int N;
double v[50];

void Input()
{
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
}

int main()
{
	Input();
	sort(v, v + N);
	for (int i = 1; i < N; i++) {
		v[i] = (v[i] + v[i - 1]) / 2.0;
	}
	cout << v[N - 1] << endl;

	return 0;
}

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

int main() {
  int n, a = 0;
  cin >> n;
  vector<int> b(n);
  for(int i = 0; i < n-1; i++)
    cin >> b.at(i);
  for(int i = 0; i < n-2; i++)
    a += min(b.at(i), b.at(i+1));
  a += b.at(0) + b.at(n-2);
  cout << a << endl;
}


Measured memory_bytes: 256
import math
N, M = map(int, input().split())
 
def enum_divisors(n, reverse=False):
    divisors = []
    for i in range(1, int(math.sqrt(n)) + 1 ):
        if n % i == 0:
            divisors.append(i)
            divisors.append(n//i)
    return sorted(divisors, reverse=reverse)
 
 
divisors = enum_divisors(M, reverse=True)
divisors = filter(lambda x: x <= M//N, divisors)
 
for cand in divisors:
    if M % cand == 0:
        print(cand)
        exit()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
const int N=1e7 + 5;
const int mod=998244353;
int fra[N],inv[N];
int n,a,b,ans;
template<class T>
inline T Min(T x,T y) {return x<y?x:y;}
inline void add(int &x,int y)
{
	x+=y;
	x>=mod?x-=mod:0;
}
inline void dec(int &x,int y)
{
	x-=y;
	x<0?x+=mod:0;
}
inline void add_prod(int &x,int u,int v)
{
	x=(1ll*u*v+x)%mod;
}
inline int quick_pow(int x,int k)
{
	int res = 1;
	while(k)
	{
		if (k&1)
			res=1ll*res*x%mod;
		x=1ll*x*x%mod;
		k>>=1;
	}
	return res;
}
inline int C(int n,int m)
{
	if (n<m)
		return 0;
	return 1ll*fra[n]*inv[n-m]%mod*inv[m]%mod;
}
inline int ask(int k)
{
	int res=C(k+b-1,b-1);
	dec(res,C(k+b-1,k-1));
	return res;
}
int main()
{
	scanf("%d%d%d",&n,&a,&b);
	if(a==0&&b==0)
		return puts("1"),0;
	fra[0]=1;
	for (int i=1;i<=n;++i)
		fra[i]=1ll*fra[i - 1]*i%mod;
	inv[n] = quick_pow(fra[n],mod-2);
	for (int i=n;i>=1;--i)
		inv[i-1]=1ll*inv[i]*i%mod;
	for (int k=0,km=Min(n-b,Min(a,b-1));k<=km;++k)
	{
		int tmp=k?ask(k):1;
		if (n-b-k==0)
		{
			if (k==a)
				add(ans,tmp);
		}
		else
		{
			int x=n-b-k-1,
				y=a-k+1;
			if (x>=0)
				add_prod(ans, tmp, C(x+y-1,y-1));
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 81884
#include <bits/stdc++.h>
#define mp make_pair
#define met(a) memset(a,0,sizeof(a))
#define ll long long
using namespace std;
const int maxn = 2000010;
int a[100010],b[100010];
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    met(a);
    int i,j,m,n;
    int maxn=0,ans=0;
    met(b);
    std::cin>>n;
    for(i=1;i<=n;i++)
    {
        std::cin>>a[i];
        if(a[i]==i)
            b[i]=1;
    }
    for(i=1;i<=n;i++)
    {
        if(b[i]&&b[i+1])
        {
            ans+=1;
            i++;
        }
        else if(b[i])
        {
            ans+=1;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
//
/*
ID: kfoozmi1
LANG: C++
TASK:
*/
#include <bits/stdc++.h>
using namespace std;

#ifdef kfoozminus
#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu() {
cerr << endl;
}

template <typename T>
void faltu(T a[], int n) {
for(int i = 0; i < n; ++i) cerr << a[i] << ' ';
cerr << endl;
}

template <typename First, typename ... hello>
void faltu(First arg, const hello&... rest) {
cerr << arg << ' ';
faltu(rest...);
}
#else
#define dbg(args...)
#endif

#define PB push_back
#define F first
#define S second
#define MP make_pair
#define SQR(a) ((a) * (a))
#define vsort(v) sort(v.begin(), v.end())
#define PQ priority_queue
#define PI acos(-1)
#define EPS 1e-9

#define B1 43
#define B2 43

#define MOD1 1000000007
#define MOD2 1000000009
#define MOD  1000000007

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

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

inline bool checkBit(ll n, int i) { return n & (1LL << i); }
inline ll setBit(ll n, int i) { return n | (1LL << i); }
inline ll resetBit(ll n, int i) { return n & (~ (1LL << i)); }
inline bool EQ(double a, double b) { return fabs(a-b) < EPS; }
inline double dist(double ix, double iy, double jx, double jy) { return sqrt(SQR(ix - jx) + SQR(iy - jy)); }

#define PMX 1000000

int marked[PMX/64+2];

#define mark(x) marked[x>>6] |= (1<<((x&63)>>1))
#define check(x) (marked[x>>6] & (1<<((x&63)>>1)))
     
bool isPrime(int x)
{
        return (x>1) && ((x==2) || ((x&1) && (!(check(x)))));
}
     
void seive(int n)
{
        int i, j;
        for(i=3; i*i<=n; i+=2)
        {
            if(!check(i))
            {
                for(j=i*i; j<=n; j+=i<<1)
                {
                    mark(j);
                }
            }
        }
}
     
ll bigMod(ll a, ll b)
{
    	ll r = 1;
    	while(b) {
    		if(b & 1) (r *= a) %= MOD;
    		b >>= 1;
    		(a *= a) %= MOD;
    	}
    	return r;
}
     
#define INF 1000000
#define MX 100007
     
vector<int> edge[MX];
int l;
     
int dfs(int i, int pre, int j)
{
	int ret = 0;
	if(j > l) ret ++;
    	for(int k = 0; k < edge[i].size(); k ++) {
     
    		if(edge[i][k] == pre) continue;
    		ret += dfs(edge[i][k], i, j + 1);
    	}
    	return ret;
}

int main()
{
    #ifdef kfoozminus
    	//freopen("in", "r", stdin);
    #endif
    	int n, k, i, ans, u, x;

    	scanf("%d %d", &n, &k);
    	for(i = 1; i < n; i ++) {
     
		scanf("%d %d", &u, &x);
    		edge[u].PB(x);
    		edge[x].PB(u);
    	}
	
	ans = INF;
	l = k >> 1;
	if(k & 1) {

		for(i = 1; i <= n; i ++)
			for(int& j : edge[i])
				ans = min(ans, dfs(i, j, 0) + dfs(j, i, 0));
	}
	else {
		for(i = 1; i <= n; i ++)
			ans = min(ans, dfs(i, 0, 0));
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 2816
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lf else if

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=200000+19;
const int oo=(1<<30)-1;

int chk[N],u[N],v[N];
int n,x,y,ans;

struct Edge{
	int y,nxt;
};

struct Tree{
	Edge E[N*2];
	int fa[20][N];
	int las[N],dep[N];
	int cnt;
	Tree(){
		memset(las,-1,sizeof(las));
	}
	void Link(int x,int y){
		E[cnt]=(Edge){y,las[x]};las[x]=cnt++;
		E[cnt]=(Edge){x,las[y]};las[y]=cnt++;
	}
	void dfs(int x){
		for (int i=las[x],y;~i;i=E[i].nxt)
			if ((y=E[i].y)!=fa[0][x]){
				fa[0][y]=x;
				dep[y]=dep[x]+1;
				dfs(y);
			}
	}
	int LCA(int x,int y){
		if (dep[x]>dep[y]) swap(x,y);
		for (int k=dep[y]-dep[x],i=0;k;k>>=1,i++) if (k&1) y=fa[i][y];
		if (x==y) return x;
		for (int i=19;~i;i--) if (fa[i][x]!=fa[i][y]) x=fa[i][x],y=fa[i][y];
		return fa[0][x];
	}
	int dis(int x,int y){
		return dep[x]+dep[y]-2*dep[LCA(x,y)];
	}
	void Work(int rt){
		dfs(rt);
		For(i,1,20) For(x,1,n+1) fa[i][x]=fa[i-1][fa[i-1][x]];
	}
} R,B;

void Dfs(int x){
	chk[x]=max(chk[R.fa[0][x]],R.dep[x]-B.dep[x]);
	for (int i=R.las[x],y;~i;i=R.E[i].nxt)
		if ((y=R.E[i].y)!=R.fa[0][x]){
			Dfs(y);
		}
}

int main(){
	//freopen("supersmall7.in","r",stdin);
	n=IN(),x=IN(),y=IN();
	For(i,1,n){
		u[i]=IN(),v[i]=IN();
		R.Link(u[i],v[i]);
	}
	For(i,1,n) B.Link(IN(),IN());
	R.Work(x);
	B.Work(y);
	chk[0]=-oo;
	Dfs(x);
	For(i,1,n){
		if (chk[u[i]]>=0&&chk[v[i]]>=0) continue;
		if (B.dis(u[i],v[i])>2){
			puts("-1");
			return 0;
		}
	}
	For(i,1,n+1) if (chk[i]<=0) ans=max(ans,B.dep[i]);
	printf("%d\n",2*ans);
}

Measured memory_bytes: 48512
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647
// MAX O(n) 10^18

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

    string ans = "No";
    rep(i, S.size()) {
        if (S == T) ans = "Yes";
        S = S.back() + S.substr(0, S.size() - 1);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3628
k, a, b = map(int, input().split())
if k <= a:
    print(k+1)
else:
    # 交換しないほうがお得
    if a+2 >= b:
        print(k+1)
    # 交換したほうがお得
    else:
        print(a+(b-a)*((k-(a-1))//2)+((k-(a-1))%2))

Measured memory_bytes: 2940
#include <stdio.h>

int main() {

  int i , j, n, m, a[100][100], b[100], c[100];


//n,m??\???
  scanf("%d %d", &n, &m);

  //c?????????
    for ( i = 0; i < n; i++) {

      c[i] = 0;

    }

//a??\???
  for( i = 0; i < n; i++){
    for ( j = 0; j < m; j++) {

      scanf("%d", &a[i][j]);

    }
  }


//b??\???
  for ( i = 0; i < m; i++) {

    scanf("%d", &b[i]);

  }



//????¨????
  for( i = 0; i < n; i++){
    for ( j = 0; j < m; j++) {

      c[i] += a[i][j] * b[j];

    }
  }

//c??????
  for( i = 0; i < n; i++){

      printf("%d\n", c[i]);

  }

  return 0;
}

Measured memory_bytes: 636
package main

import "fmt"

func main() {
	const Mod = int(1e9) + 7
	var m, n int
	fmt.Scan(&m, &n)
	ans := 1
	base := m
	for i := uint(0); i < 31; i++ {
		if n>>i&1 == 1 {
			ans = (ans * base) % Mod
		}
		base = (base * base) % Mod
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1156
N, M = map(int, input().split())
s_c = [list(map(int, input().split())) for _ in range(M)]

if N == 1:
  a, b = 0, 10**N
elif N >= 2:
  a, b = 10**(N-1), 10**N

ans = '-1'
for i in range(a, b):
  flag = True
  for j in range(M):
    if str(i)[s_c[j][0]-1] != str(s_c[j][1]):
      flag = False
  if flag:
    ans = i
    break

print(ans)

Measured memory_bytes: 9216