akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
	if(!b)return 1;	if(b&1)return modpow(a,b-1,m)*a%m;
	int memo = modpow(a,b>>1,m);
	return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
out((a-c)*(b-d));
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int N;
pii nums[200009];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N;
    rep(i,N) cin>>nums[i].first;
    rep(i,N) cin>>nums[N+i].first;
    rep(i,N) nums[N+i].second=1;
    sort(nums,nums+2*N);
    
    int a=0,b=0;
    ll cnt=1;
    rep(i,2*N){
        int n=nums[i].first;
        int t=nums[i].second;
        if(t){
            if(a>0) (cnt*=a--)%=MOD;
            else b++;
        }else{
            if(b>0) (cnt*=b--)%=MOD;
            else a++;
        }
    }
    cout1(cnt)
}

Measured memory_bytes: 1792
import heapq
from itertools import chain
from operator import mul

exp10 = [10 ** a for a in range(8, -1, -1)]
movables = [{1, 3}, {0, 2, 4}, {1, 5}, {0, 4, 6}, {1, 3, 5, 7}, {2, 4, 8}, {3, 7}, {4, 6, 8}, {5, 7}]

destination = 123456780


def swap(board, move_from, move_to):
    return board + (exp10[move_to] - exp10[move_from]) * (board // exp10[move_from] % 10)


board0 = sum(map(mul, exp10, chain.from_iterable(map(int, input().split()) for _ in range(3))))
p0 = ('0' + str(board0))[-9:].index('0')

appeared = ({board0: 0}, {destination: 0})
queue = []
queue.extend((0, 0, move_from, p0, board0) for move_from in movables[p0])
queue.extend((0, 1, move_from, 8, destination) for move_from in movables[8])
heapq.heapify(queue)

while True:
    total_cost, direction, move_from, move_to, board = heapq.heappop(queue)
    if board in appeared[not direction]:
        print(total_cost + appeared[not direction][board])
        break
    new_board = swap(board, move_from, move_to)
    if new_board in appeared[direction]:
        continue
    appeared[direction][new_board] = total_cost + 1
    for move_from2 in movables[move_from]:
        if move_from2 != move_to:
            heapq.heappush(queue, (total_cost + 1, direction, move_from2, move_from, new_board))

Measured memory_bytes: 11032
import java.io.*;
import java.util.*;

public class Main
{
    public static void main (String[] args) throws java.lang.Exception    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int[] a = new int[101];
        int s1 = 0,
            s2 = 0;
        for (int i=0 ; i<n ; i++) {
            st = new StringTokenizer(br.readLine());
            int k = Integer.parseInt(st.nextToken());
            a[k]++;
            if (k%10 == 0) s2+= k;
            else s1 += k;
        }
        if (s1 == 0) {
            System.out.println(0);
            return;
        }
        if (s1%10 != 0) {
            System.out.println(s1+s2);
            return;
        }
        
        for (int i=1 ; i<=100 ; i++) {
            if (a[i] == 0 || i%10==0) continue;
            s1 -= i;
            break;
        }
        System.out.println(s1+s2);
    }
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
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 main()
{
    int64_t N;
    cin >> N;
    vector<int64_t>vec(N);
    for (int64_t i=0; i<N; i++) {
        cin >> vec.at(i);
    }

    int64_t max_ = 0;
    int64_t n = vec[0];
    int64_t now_count = 0;
    for (int64_t i=1; i<N; i++) {
        if (n >= vec[i]) {
            now_count += 1;
            if (now_count > max_) {
                max_ = now_count;
            }
        } else {
            now_count = 0;
        }
        n = vec[i];
    }

    cout << max_ << endl;
    return 0;
}

Measured memory_bytes: 3996
#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cout << *it << " = " << a << endl;
	err(++it, args...);
}
 
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
 
#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e4 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	read(n);
	
	readarr(a, n);
	int freq[n + 1] = {};
	FOR (i, 1, n) freq[a[i]]++;
	
	int ans = 0;
	FOR (i, 1, n)
	{
	    ans += freq[i] * (freq[i]-1) /2;
	}
	
	FOR (i, 1, n)
	{
	    print(ans - freq[a[i]] + 1);
	}
	
}




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


int main() {
  int a,b;
  cin >> a >> b;
  int ans;
  ans += a-1;
  if(a <= b) ans += 1;

  cout << ans << endl;
}


Measured memory_bytes: 3624
/* In the name of Allah */
#include<bits/stdc++.h>
using namespace std;

const int N = 1e3 + 5;
char c[N][N];
int n;

int main() {
	cin >> n;
	if (n < 3)
		return cout << -1, 0;
	if (n == 3)
		return cout << "aa.\n..a\n..a", 0;
	for (int i = 0; i < n; i++)
		fill(c[i], c[i] + n, '.');
	for (int i = 0; i < n; i += 4)
		if (n - i == 5) {
			c[i][i] = c[i][i + 1] = 'a';
			c[i + 3][i] = c[i + 4][i] = 'a';
			c[i][i + 2] = c[i][i + 3] = 'b';
			c[i + 1][i] = c[i + 2][i] = 'b';
			c[i][i + 4] = c[i + 1][i + 4] = 'a';
			c[i + 4][i + 3] = c[i + 4][i + 4] = 'a';
			c[i + 2][i + 4] = c[i + 3][i + 4] = 'b';
			c[i + 4][i + 1] = c[i + 4][i + 2] = 'b';
			c[i + 1][i + 3] = c[i + 2][i + 3] = 'c';
			c[i + 3][i + 1] = c[i + 3][i + 2] = 'c';
		}
		else if (n - i == 6) {
			c[i][i] = c[i][i + 1] = 'b';
			c[i + 4][i] = c[i + 5][i] = 'd';
			c[i][i + 5] = c[i + 1][i + 5] = 'a';
			c[i + 1][i] = c[i + 1][i + 1] = 'c';
			c[i][i + 4] = c[i + 1][i + 4] = 'd';
			c[i + 2][i + 3] = c[i + 3][i + 3] = 'a';
			c[i + 4][i + 1] = c[i + 5][i + 1] = 'a';
			c[i + 2][i + 4] = c[i + 2][i + 5] = 'b';
			c[i + 4][i + 2] = c[i + 4][i + 3] = 'b';
			c[i + 3][i + 4] = c[i + 3][i + 5] = 'c';
			c[i + 5][i + 2] = c[i + 5][i + 3] = 'c';
			c[i + 2][i + 2] = c[i + 3][i + 2] = 'd';
		}
		else if (n - i == 7) {
			c[i][i + 6] = c[i + 1][i + 6] = 'a';
			c[i + 6][i] = c[i + 6][i + 1] = 'a';
			c[i][i + 2] = c[i + 1][i + 2] = 'd';
			c[i][i + 5] = c[i + 1][i + 5] = 'd';
			c[i + 2][i] = c[i + 2][i + 1] = 'd';
			c[i + 5][i] = c[i + 5][i + 1] = 'd';
			c[i + 2][i + 6] = c[i + 3][i + 6] = 'b';
			c[i + 6][i + 2] = c[i + 6][i + 3] = 'b';
			c[i + 4][i + 6] = c[i + 5][i + 6] = 'c';
			c[i + 6][i + 4] = c[i + 6][i + 5] = 'c';
			c[i + 2][i + 3] = c[i + 2][i + 4] = 'd';
			c[i + 3][i + 2] = c[i + 4][i + 2] = 'd';
			c[i + 3][i + 5] = c[i + 4][i + 5] = 'd';
			c[i + 5][i + 3] = c[i + 5][i + 4] = 'd';
		}
		else if (n - i > 3) {
			c[i][i] = c[i][i + 1] = 'b';
			c[i + 2][i] = c[i + 3][i] = 'd';
			c[i][i + 3] = c[i + 1][i + 3] = 'a';
			c[i + 1][i] = c[i + 1][i + 1] = 'c';
			c[i][i + 2] = c[i + 1][i + 2] = 'd';
			c[i + 2][i + 1] = c[i + 3][i + 1] = 'a';
			c[i + 2][i + 2] = c[i + 2][i + 3] = 'b';
			c[i + 3][i + 2] = c[i + 3][i + 3] = 'c';
		}
	for (int i = 0; i < n; i++)
		cout << c[i] << endl;
}


Measured memory_bytes: 2176
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#define ll long long
using namespace std;

int arr[55];
ll memo[5000][55];
int totalsum = 0;
int n, p;
//a = total sum so far b = index
ll dp (int a, int b){
    if (b > n){
        if (a%2 == p)
            return 1;
        return 0;
    }
    if (memo[a][b] != -1)
      return memo[a][b]; 
    return memo [a][b] = dp(a+arr[b],b+1) + dp(a,b+1);
}

int main()
{
    cin >> n >> p;
    
    for (int i = 1; i <= n; i++){
        cin >> arr[i];
    }
    
    memset (memo, -1, sizeof(memo));
    cout << dp(0,1) << endl;

    return 0;
}

Measured memory_bytes: 2432
import math
k=int(input())
ans=0
for i1 in range(1,k+1):
  for i2 in range(1,k+1):
    for i3 in range(1,k+1):
      x=math.gcd(i1,i2)
      x=math.gcd(x,i3)
      ans+=x
print(ans)

Measured memory_bytes: 68816
/// Author: Sarfaraz Alam
# include <bits/stdc++.h>
# define pb push_back
# define ll long long

# define fi first
# define se second
# define all(vc) vc.begin(),vc.end()
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define DEBUG
typedef unsigned long long int ull;
using namespace std;
#include<string>
#include<cmath>
const int N = 1e5 + 7;
const int mod = 1e9 + 7;


int main()
{
    speed;
    #ifdef DEBUGfd
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif // DEBUG

    //Code begins
    int n;
    cin>>n;
    int a[n][26];

    for(int i = 0; i<n; i++)
    {
      for(int j = 0; j<26; j++)
      {
        a[i][j] = INT_MAX;
      }
    }

    string s;
    for(int i = 0; i<n; i++)
    {
      cin>>s;

      for(int j = 0; j<s.size(); j++)
      {
        int k = a[i][s[j] - 'a'];
        if(k != INT_MAX)
         a[i][s[j] - 'a'] += 1;
         else
         {
           a[i][s[j] - 'a' ] = 1;
         }
      }
    }


    int f[26] ;

    for(int i = 0; i<26; i++)
    f[i] = -1;

    for(int i = 0; i<26; i++)
    {
      int min = INT_MAX;
      int dont = 0;
      for(int j = 0 ; j<n; j++)
      {
        if(a[j][i] == INT_MAX)
        {
          dont  = 1;
          break;
        }
        if(a[j][i] < min)
        min = a[j][i];
      }
      if(dont == 0)
      f[i] = min;
      else
      f[i] = INT_MAX;
    }

    int empty = 1;

    for(int i = 0; i<26; i++)
    {
      if(f[i] != INT_MAX)
      {
        char k = 'a' + i;
        cout<<string( f[i], k);
        empty = 0;
      }
    }
    //
    // for(int i = 0; i<26; i++)
    // cout<<f[i]<<" ";
    // cout<<endl;
    string w = "";
    if(empty == 1)
    cout<<w<<endl;


    return 0;
}


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

int main(){
    int A, B;
    cin >> A >> B;
    double APrime = 0, BPrime = 0;
    for(int i = 1; i <= 1250; i++){
        double IPrime1 = i * 0.08;
        double IPrime2 = i * 0.1;
        int I1 = (int) IPrime1 / 1;
        int I2 = (int) IPrime2 / 1;

        if(I1 == A && I2 == B){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}

Measured memory_bytes: 256
object Main {
  def main (args: Array[String]) {
    var count:Int = 0
    for(line <- scala.io.Source.stdin.getLines()){
        val Array(min, max, o) = line.split(" ").map(_.toInt)
        var list: List[Int] = List() 
        for( i <-  1 to o if ((o % i)  == 0 ) )  list = i::list
        println(list.filter(_ >= min).filter(_ <= max).length )
    }
  }
}

Measured memory_bytes: 44332
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(a[K-1])

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

const int MAX_N = 112345;
const int MAX_M = 112345;

int N, M;
ll X[MAX_N];
ll A[MAX_M];

ll D[MAX_N];
ll B[MAX_N];
ll BB[MAX_N];
ll tmp[MAX_N];

void apply(ll* D, ll *B) {
  REP(i, N) tmp[i] = D[B[i]];
  REP(i, N) D[i] = tmp[i];
}

int main2() {
  N = nextInt();
  REP(i, N) X[i] = nextInt();
  M = nextInt();
  ll K = nextLong();
  REP(i, M) A[i] = nextInt()-1;

  D[0] = X[0];
  REP(i, N-1) D[i+1] = X[i+1] - X[i];

  REP(i, N) B[i] = i;
  REP(i, M) swap(B[A[i]], B[A[i]+1]);
  REP(i, N) BB[i] = B[i];

  REP(i, 60) {
    if (K >> i & 1) {
      apply(D, B);
    }
    apply(BB, B);
    REP(i, N) B[i] = BB[i];
  }

  X[0] = D[0];
  REP(i, N-1) {
    X[i+1] = D[i+1] + X[i];
  }
  REP(i, N) printf("%lld\n", X[i]);
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

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

using namespace std;

#define PB push_back
#define f first
#define s second
#define what_is(x) cerr << #x << " is " << x << endl;

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

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int k;
    cin >> k;
    int st = 7;
    for(int i=1; i<=k+1; i++)
    {
        if(st%k == 0)
        {
            cout << i;
            return 0;
        }
        st = (10 * st + 7) % k;
    }
    cout << -1;
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  cin.ignore();
  while( n-- ) {
    string s;
    int pos;
    getline(cin, s);
    pos = s.find("Hoshino");
    while( pos != -1 ) {
      s[pos+6] = 'a';
      pos = s.find("Hoshino");
    }

    cout << s << endl;
  }
}

Measured memory_bytes: 1208
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cassert>
#include <cinttypes>

using namespace std;

typedef int64_t ll;
typedef uint64_t ull;

typedef pair<int, int> P;
inline P operator+(const P& p1, const P& p2) {
  return P(p1.first + p2.first, p1.second + p2.second);
}

int main() {
  int n;
  cin >> n;
  map<int, int> a;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    a[t]++;
  }

  int ans = 0;
  for (auto elem : a) {
    int num = elem.first;
    int cnt = elem.second;
    if (num > cnt) {
      ans += cnt;
    } else {
      ans += cnt - num;

    }
  }
  cout << ans << endl;

  return 0;
}

/* */

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

using namespace std;

const int MAXN = 2e5 + 5;

int A[MAXN], N, bit[MAXN], cnt[MAXN];
pair<int, int> B[MAXN];
map<int, int> mp;

void update(int pos, int v){
	for(; pos<=N; pos+=(pos&(-pos))) bit[pos] += v;
}

int query(int pos){
	int res = 0;
	for(; pos>0; pos-=(pos&(-pos))) res += bit[pos];
	return res;
}

int main(){
	scanf("%d", &N);
	for(int i=1; i<=N; ++i){ scanf("%d", &B[i].first); B[i].second = i; }
	sort(B + 1, B + N + 1);
	int c = 0;
	for(int i=1; i<=N; ++i){
		if(B[i].first != B[i - 1].first) c++;
		A[B[i].second] = c;
		mp[c] = B[i].first;
		cnt[c]++;
	}
	for(int i=1; i<=N; ++i) update(A[i], +1);
	int sz = (N / 2) - 1;
	for(int i=1; i<=N; ++i){
		update(A[i], -1);
		cnt[A[i]]--;
		int lo = 1, hi = N, mid, res = -1;
		while(lo <= hi){
			mid = (lo + hi)>>1;
			int x = query(mid - 1);
			if(x <= sz && x + cnt[mid] > sz) res = mid, hi = mid - 1;
			else if(x > sz) hi = mid - 1;
			else lo = mid + 1;
		}
		printf("%d\n", mp[res]);
		cnt[A[i]]++;
		update(A[i], +1);
	}
	return 0;
}

Measured memory_bytes: 15232
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if((b<a && b<c) || (b<a && b==c)){
		swap(a,b);
	}else if((c<a && c<b) || (c<a && c==b)){
		swap(a,c);
	} 
	if(b>c){
		swap(b,c);
	}
	cout<<a<<" "<<b<<" "<<c<<endl;
	return 0;
}

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

#define int long long
#define double long double

const int INF=2147483647;
const int MOD=1000000007;
const int mod=998244353;
const double eps=1e-18;

using namespace std;



signed main(){

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

    char s[1001],t[1001];
    int ls,lt;
    int cnt,Min;

    cin>>s>>t;

    ls=strlen(s);
    lt=strlen(t);


    Min=INF;
    for(int i=0;i<=ls-lt;i++){

        cnt=0;

        for(int j=0;j<lt;j++){
            if(s[i+j]!=t[j]){
                cnt++;
            }
        }

        Min=min(Min,cnt);

    }

    cout<<Min<<endl;

    return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

ll dp[2010][2];
int n, z, w, a[2000];
ll rec(int c, bool turn){
	ll &res = dp[c][turn];
	if(res < 1e18) return res;
	res = c == 0 ? abs(w - a[n - 1]) : abs(a[c - 1] - a[n - 1]);
	
	for(int i = c; i < n - 1; i++){
		if(turn) res = min(res, rec(i + 1, 1 - turn));
		else res = max(res, rec(i + 1, 1 - turn));
	}
	return res;
}
int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	cin >> n >> z >> w;
	rep(i, n) cin >> a[i];
	rep(i, n + 1) rep(j, 2) dp[i][j] = (ll)1e18;
	cout << rec(0, 0) << endl;
	
	return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) {
    cout << 0 << endl;
    return 0;
  }
  if (a == b && b == c) {
    cout << -1 << endl;
    return 0;
  }
  bool flag = true;
  ll ans = 0;
  while (flag) {
    ll ha = a / 2, hb = b / 2, hc = c / 2;
    a = hb + hc;
    b = ha + hc;
    c = hb + ha;
    ans++;
    flag = (a % 2 == 0 && b % 2 == 0 && c % 2 == 0);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

long long int find_root(std::vector<long long int> &root, long long int s);
int unite(std::vector<long long int> &root, std::vector<long long int> &rank, long long int x, long long y);


int main(){

  // read problem
  long long int N, tmp;
  std::vector<long long int> A, B;
  scanf("%lld", &N);
  for(long long int i = 0; i < N; i++){
    scanf("%lld", &tmp);
    A.push_back(tmp);
  }
  for(long long int i = 0; i < N; i++){
    scanf("%lld", &tmp);
    B.push_back(tmp);
  }

  // solve problem
  // check impossible
  std::vector<std::pair<long long int, long long int> > A2, B2;
  for(long long int i = 0; i < N; i++){
    A2.push_back(std::make_pair(A[i], i));
    B2.push_back(std::make_pair(B[i], i));
  }
  std::sort(A2.begin(), A2.end());
  std::sort(B2.begin(), B2.end());

  long long int impossible = 0;
  for(long long int i = 0; i < N; i++){
    if(A2[i].first > B2[i].first){
      impossible = 1;
      break;
    }
  }
  if(impossible){
    std::cout << "No" << std::endl;
    return 0;
  }
  // check possible
  long long int possible = 0;
  for(long long int i = 0; i < N-1; i++){
    if(B2[i].first >= A2[i+1].first){
      possible = 1;
      break;
    }
  }
  if(possible){
    std::cout << "Yes" << std::endl;
    return 0;
  }

  // final check
  std::vector<long long int> root, rank;
  for(long long int i = 0; i < N; i++){
    root.push_back(i);
    rank.push_back(0);
  }
  for(long long int i = 0; i < N; i++){
    unite(root, rank, A2[i].second, B2[i].second);
  }

  impossible = 1;
  for(long long int i = 0; i < N-1; i++){
    if(find_root(root, i) != find_root(root, i+1)){
      impossible = 0;
      break;
    }
  }

  if(impossible){
    std::cout << "No" << std::endl;
  }
  else{
    std::cout << "Yes" << std::endl;
  }

  return 0;
}


long long int find_root(std::vector<long long int> &root, long long int x){
  if(root[x] == x){
    return x;
  }
  else{
    root[x] = find_root(root, root[x]);
    return root[x];
  }
}

int unite(std::vector<long long int> &root, std::vector<long long int> &rank, long long int x, long long y){
  x = find_root(root, x);
  y = find_root(root, y);
  
  if(x == y){
    return 0;
  }
  else if(rank[x] < rank[y]){
    root[x] = y;
  }
  else if(rank[y] < rank[x]){
    root[y] = x;
  }
  else{ // if (x != y && rank[x] == rank[y])
    root[x] = y;
    rank[y]++;
  }
  
  return 0;
}


Measured memory_bytes: 7828
#include <algorithm>
#include<iostream>
#include<stdio.h>
#include <algorithm>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;
int main() {
	ll ans = 0;
	long long int N; cin >> N;
	for(long long int i = 1; i*i <= N; i++) {
			if (N % i == 0&&i!=1) {
				ll n = N, ni = N, I = N / i;
				while (n % i == 0) { n /= i; }
				if (n % i == 1) {
					ans++;


				}
				if (i != I) {
					while (ni % I == 0) { ni /= I; }
					if (ni % I == 1) {
						ans++;
						
					}
				}
			
		    }
			else if(i==1) { ans++; }
	}
	for (long long int i = 1; i * i <= N; i++) {
		if ((N - 1) % i == 0&&N>2) {			
			if (i * i == (N - 1)||i==1) { ans++; }
			else { ans += 2; }
		}
		
				

	}

	
	cout << ans << endl;

}




	
	


	


	


		






Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int n;
  int d[100];
  int s = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
  {
    scanf("%d", &d[i]);
  }
  for (int i = 0; i < n - 1; i++)
  {
    for (int j = i + 1; j < n; j++)
    {
      s += d[i] * d[j];
    }
  }
  printf("%d", s);
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main(){
  int x, b, sum, c, sum2;
  scanf("%d",&x);
  
 	sum = x / 500;
	c = x % 500;
	sum2 = c / 5;
  
      printf("%d\n",(sum * 1000) + (sum2 * 5));
 return 0;
}

Measured memory_bytes: 128
MOD=10**9+7
N=int(input())
S1=input()
S2=input()

if N==1:
  print(3)
  exit()

if S1[0]==S2[0]:
  ans,i=3,1
else:
  ans,i=6,2

while i<N:
  if S1[i]==S2[i]:
    if S1[i-1]==S2[i-1]:
      ans=ans*2%MOD
    i+=1
  else:
    if S1[i-1]==S2[i-1]:
      ans=ans*2%MOD
    else:
      ans=ans*3%MOD
    i+=2
    
print(ans)

Measured memory_bytes: 9216
#include <stdio.h>
#include <string.h>

long long dp[13][5];
char s[13];

int main() {
  scanf("%s", s);
  int n = strlen(s);
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 4; j++) {
      int val = 0;
      for (int k = i; k < n; k++) {
        if (val == 0 && s[k] == '0') {
          dp[k + 1][j + 1] += dp[i][j];
          break;
        }
        val = val * 10 + (s[k] - '0');
        if (val <= 255) {
          dp[k + 1][j + 1] += dp[i][j];
        } else break;
      }
    }
  }
  printf("%lld\n", dp[n][4]);
}


Measured memory_bytes: 2756
s = [i for i in input()]
one,zero = [0],[0]
for i in range(len(s)):
    if s[i] == '1': one.append(one[i]+1)
    else:   one.append(one[i])
    if s[i] == '0': zero.append(zero[i]+1)
    else:   zero.append(zero[i])
print(min(one[-1],zero[-1])*2)


Measured memory_bytes: 8596
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
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; }

int main(){
	string n;cin>>n;
	ll ans = 0;
	for(int i = 0; i < n.size(); i++) {
		ans += (n[i] - '0');
	}
	if(ans % 9 == 0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

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

int M, N;
char field[1010][1010];
char emblem[2][2];
int ex[1010][1010][3];

int f(char c) {
  if (c == 'J') return 0;
  if (c == 'O') return 1;
  if (c == 'I') return 2;
  exit(1);
}

int main() {
  cin >> M >> N;
  for (int i=0; i<M; i++) {
    for (int j=0; j<N; j++) {
      cin >> field[i][j];
    }
  }
  for (int i=0; i<2; i++) {
    for (int j=0; j<2; j++) {
      cin >> emblem[i][j];
    }
  }

  int ans = 0;
  for (int i=0; i<M-1; i++) {
    for (int j=0; j<N-1; j++) {
      int c = 0;
      if (field[i  ][j  ] == emblem[0][0]) c++;
      if (field[i+1][j  ] == emblem[1][0]) c++;
      if (field[i  ][j+1] == emblem[0][1]) c++;
      if (field[i+1][j+1] == emblem[1][1]) c++;
      if (c == 4) ans++;
      if (c == 3) {
        if (field[i  ][j  ] != emblem[0][0]) ex[i  ][j  ][f(emblem[0][0])]++;
        if (field[i+1][j  ] != emblem[1][0]) ex[i+1][j  ][f(emblem[1][0])]++;
        if (field[i  ][j+1] != emblem[0][1]) ex[i  ][j+1][f(emblem[0][1])]++;
        if (field[i+1][j+1] != emblem[1][1]) ex[i+1][j+1][f(emblem[1][1])]++;
      }
    }
  }
  int s = 0;
  for (int i=0; i<M; i++) {
    for (int j=0; j<N; j++) {
      for (int k=0; k<3; k++) {
        s = max(s, ex[i][j][k]);
      }
    }
  }
  cout << ans + s << "\n";
  return 0;
}

Measured memory_bytes: 15932
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def lcm(a, b):
    return a // gcd(a, b) * b

N, M = map(int, input().split())
A = list(map(int, input().split()))
A = [a//2 for a in A]

while A[0] % 2 == 0:
    for i in range(N):
        if A[i] % 2 != 0:
            print(0)
            exit()
        A[i] //= 2
    M //= 2

for i in range(N):
    if A[i] % 2 == 0:
        print(0)
        exit()

lcm_ = 1
for i in range(N):
    lcm_ = lcm(lcm_, A[i])
    if M < lcm_:
        print(0)
        exit()

print((M // lcm_ + 1) // 2)


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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);


// ABC0６１B - Counting Roads
int main(){
  int n, m;
  cin >> n >> m;

  VECTOR_DIM1(int, data, n+10, 0);

  rep(i, m) {
    int a, b;
    cin >> a >> b;
    data[a]++;
    data[b]++;
  }
  REP(int,i,1,n+1) {
    cout << data[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <climits>
#include <cstdlib>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;

template<class T> inline void chmax(T& a, const T& b) { if(b > a) a = b; }
template<class T> inline void chmin(T& a, const T& b) { if(b < a) a = b; }

struct edge {
	int to, cost;
	edge(int t, int c):to(t), cost(c){}
};
typedef pair<int, int> P;
vector<vector<edge> > es;

vector<int> dijkstra(int s) {
	priority_queue<P, vector<P>, greater<P> > que;
	vector<int> dist(es.size(), INT_MAX);
	que.push(P(0, s));
	dist[s] = 0;
	
	while(!que.empty()) {
		P p = que.top();
		que.pop();
		int v = p.second;
		if(dist[v] < p.first)
			continue;
		for(int i = 0; i < es[v].size(); ++i) {
			edge& e = es[v][i];
			if(dist[e.to] > dist[v] + e.cost) {
				dist[e.to] = dist[v] + e.cost;
				que.push(P(dist[e.to], e.to));
			}
		}
	}

	return dist;
}

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

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

	es.resize(n);
	vector<P> con(m);
	vector<int> len(m);
	for(int i = 0; i < m; ++i) {
		int a, b, l;
		cin >> a >> b >> l;
		--a;
		--b;

		es[a].push_back(edge(b, l));
		es[b].push_back(edge(a, l));
		con[i] = make_pair(a, b);
		len[i] = l;
	}

	vector<int> mn_dist(n, INT_MAX);
	for(int i = 0; i < k; ++i) {
		int s;
		cin >> s;

		vector<int> dist = dijkstra(s - 1);
		for(int i = 0; i < n; ++i)
			chmin(mn_dist[i], dist[i]);
	}

	int ans = 0;
	for(int i = 0; i < n; ++i)
		chmax(ans, mn_dist[i]);

	for(int i = 0; i < m; ++i)
		chmax(ans, (mn_dist[con[i].first] + mn_dist[con[i].second] + len[i] + 1) / 2);

	cout << ans << endl;

	return EXIT_SUCCESS;
}

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

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

  ll N;
  string S;
  cin>>N>>S;
  vector<ll> A(N);
  rep(i,N){
  	A[i]=S[i]-'0';
  }

  if(N<=5){
  	while(N>1){
  		vector<ll> nxt;
  		rep(i,N-1){
  			nxt.push_back((ll)abs(A[i]-A[i+1]));
  		}
  		A=nxt;
  		N--;
  		/*rep(i,N){
  			cout<<A[i]<<" ";
  		}
  		cout<<endl;*/
  	}
  	cout<<A[0]<<endl;
  	return 0;
  }

	{
  	vector<ll> nxt;
  	rep(i,N-1){
  		nxt.push_back(abs(A[i]-A[i+1]));
  	}
  	A=nxt;
  	N--;
  }

  ll t=1;
  {
  	bool aru1=false;
  	rep(i,N){
  		if(A[i]==1)aru1=true;
  	}
  	if(!aru1){
  		rep(i,N){
  			A[i]/=2;
  		}
  		t=2;
  	}
  }

  for(ll i=0;i<N;){
  	ll j=i;
  	while(j<N&&A[j]!=1){
  		A[j]=0;
  		j++;
  	}
  	i=j+1;
  }

  while(N>1){
  	ll p=1;
  	while(p*2<=N){
  		p*=2;
  	}
  	ll sum=0;
  	vector<ll> nxt;
  	rep(i,N){
  		sum^=A[i];
  		if(i>=p-1){
  			nxt.push_back(sum);
  			sum^=A[i-(p-1)];
  		}
  	}
  	A=nxt;
  	N=A.size();
  }
  cout<<A[0]*t<<endl;

  return 0;
}


Measured memory_bytes: 19604
n = int(input())
MOD = 10 ** 9 + 7

ma = 1
zero,nine,bot = 1,1,1
for i in range(n):
    ma = ma * 10 % MOD
    zero = zero * 9 % MOD
    nine = nine * 9 % MOD
    bot = bot * 8 % MOD
    
cur = (zero + nine + MOD - bot) % MOD
ans = ((ma+MOD) - cur) % MOD

print(ans)

Measured memory_bytes: 63556
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
const long double PI = 3.14159265358979323846;
int main()
{
  long double A, B, H, M;
  cin >> A >> B >> H >> M;
  long double tyou = (M * 360.0) / 60.0;
  long double tann = (H * 60.0 + M) * 360 / (12 * 60);
  long double rad = min(360 - abs(tann - tyou), abs(tann - tyou));
  //cout << tyou << " " << tann << endl;
  // cout << rad << endl;
  // cout << cos(PI * rad / 180.0) << endl;
  // cout << A * A + B * B - 2 * B * A * cos(PI * rad / 180.0) << endl;
  long double kaku = cos(PI * rad / 180.0);
  long double ans = sqrt(A * A + B * B - 2.0 * B * A * kaku);
  // cout << ans << endl;
  printf("%.10Lf", ans);
  return 0;
}

Measured memory_bytes: 4160
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    string s;
    cin >> s;
    cout << (count(all(s), 'o') + 15-(int)s.size() >= 8 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 3616
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int n;
		int[] s = new int[100];
		int i = 0;
		
		while(scan.hasNextInt()){
			n = scan.nextInt();
			if(n != 0){
				s[i] = n;
				i++;
			}else{
				i--;
				System.out.println(s[i]);
			}
		}
	}
}

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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

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

ll calc_num(int len, ll n) {
  ll sum = 0;
  REP(i, len - 1) {
    sum += pow(26, i + 1);
  }
  ll ret = n - sum;

  return ret;
}

string makestring(int len, ll num) {
  string ret;
  num--;

  REP(i, len) {
    int t = len - i - 1;
    char ch;

    // ANS("num");
    // ANS(num);
    // ANS(ll(num / pow(26, t)));
    int tmp = num / pow(26, t);
    // ANS("tmp");
    // ANS(tmp);
    // if (num < pow(26, t)) {
    //   ch = 'a';
    // } else {
    ch = 'a' + tmp;
    num -= pow(26, t)*tmp;
    // }
    ret += ch;
  }
  return ret;
}

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

  string ans;
  ll sum = 26;
  int i = 1;
  while (true) {
    if (n <= sum) {
      int len = i;
      ll num = calc_num(len, n);
      ans = makestring(len, num);
      ANS(ans);
      break;
    } else {
      sum += pow(26, i + 1);
    }
    i++;
  }

  return 0;
}


Measured memory_bytes: 4032
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(A));

        sc.close();
    }

    static int solve(int[] A) {
        Set<Integer> divisors = new HashSet<>();
        for (int i = 0; i < 2; ++i) {
            for (int j = 1; j * j <= A[i]; ++j) {
                if (A[i] % j == 0) {
                    divisors.add(j);
                    divisors.add(A[i] / j);
                }
            }
        }

        return divisors.stream()
                .filter(divisor -> Arrays.stream(A).filter(x -> x % divisor == 0).count() >= A.length - 1)
                .mapToInt(x -> x).max().getAsInt();
    }
}

Measured memory_bytes: 59476
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sn = new Scanner(System.in);
        
        int s = sn.nextInt();
        int w = sn.nextInt();
        
        if(s <= w) {
            System.out.print("unsafe");
            return;
        }
        
        System.out.print("safe");
    }
}


Measured memory_bytes: 35756
#include <iostream>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
  int n, i, sum=0;
  cin >> n;
  int a[n+2];
  a[0]=0;
  a[n+1]=0;
  for(i=1; i<=n; i++)
    cin >> a[i];
  for(i=0; i<=n; i++)
    sum+=abs(a[i+1]-a[i]);
  for(i=1; i<=n; i++){
    cout << sum+(abs(a[i+1]-a[i-1])-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])) << endl;
  }
  return 0;
}

Measured memory_bytes: 1664
#include<stdio.h>
int main(){
  int a[5];
  int i,j,t,c;
  scanf("%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4]);
  for(i=0;i<5;i++){
    t=i;
    for(j=i+1;j<5;j++){
      if(a[t]>a[j]){
	t=j;
      }
    }
    c=a[i];
    a[i]=a[t];
    a[t]=c;
  }
  printf("%d %d %d %d %d\n",a[4],a[3],a[2],a[1],a[0]);
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define debug(x) cout << #x << " = " << x << endl
#define print(x) cout << x << endl;
const ll MOD = 1000000007;

int main()
{
    ll N, M;
    cin >> N >> M;
    priority_queue<ll> A;

    ll max_elem = 0;
    rep(i, N)
    {
        ll temp;
        cin >> temp;
        A.push(temp);
    }

    rep(i, M)
    {
        ll maxPrice = A.top();
        A.pop();
        A.push(maxPrice / 2);
    }

    ll ans = 0;
    while (!A.empty())
    {
        ll p = A.top();
        A.pop();
        ans += p;
    }

    cout << ans << endl;
}


Measured memory_bytes: 1400
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cstdio>
using namespace std;
int n,x,a[1000],res; 
int main()
{
	cin>>n>>x;
	for(int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++) 
		if(a[i]<=x) x-=a[i],res++;
		else break;
	if(res==n&&x) res--;
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 1000000007;

int main() {
    int x, n, dmin, ans;
    cin >> x >> n;
    vector<int> p(n);
    rep(i,n) cin >> p[i];

    dmin = 10000;
    for(int i = 300; i >= -300; i--){
        if(find(p.begin(), p.end(), i) == p.end()){
            if(dmin >= abs(i - x)){
                dmin = abs(i - x);
                ans = i;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<math.h>
#include<bitset>
#include<random>
#include<set>
#include <cstdint>
#include<tuple>
using namespace std;
using ll = __int64_t;
using lll = __int128_t;
typedef pair<ll,ll> P;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
const ll longinf=1ll<<60;
const int inf=(1<<30)-1;
const ll mod=1e9+7;
vector<pair<ll,ll>> primeFactorDecomp(ll n){
      vector<pair<ll,ll>> ret;
      ll m=n;
      for(ll i=2;i*i<=m;i++){
            if(n%i!=0) continue;
            int cnt=0;
            while(n%i==0){
                  cnt++;
                  n/=i;
            }
            ret.push_back({i,cnt});
      }
      if(n>1){
            ret.push_back({n,1});
      }
      return ret;
}
int main(void){
  ll a,b;
  cin>>a>>b;
  vector<P> d=primeFactorDecomp(__gcd(a,b));
  cout<<d.size()+1<<endl;
  return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

//#pragma GCC target("avx2")
//#pragma GCC optimization("unroll-loops")
//#pragma GCC optimize("O2")
//#pragma GCC optimize("O3")

#define FOR(i,a) for (int i=0;i<(a);++i)
#define FORD(i,a) for (int i=(a)-1;i>=0;i--)
#define FORT(i,a,b) for (int i=(a);i<=(b);++i)
#define FORTD(i,b,a) for (int i=(b);i>=(a);--i)
#define trav(i,v) for (auto i : v)
#define all(v) v.begin(),v.end()
#define ad push_back
#define fr first
#define sc second
#define mpr(a,b) make_pair(a,b)
#define pir pair<int,int>
#define make_unique(v) v.erase(unique(all(v)),v.end())
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define srng mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define y1 EsiHancagorcRepa

const int N=2e5; 
const ll MOD=1e9+7;
int tv[10],zr=N-1,mk=N-2;
struct oper{
	char type;
	int i,j,k;
	oper(){}
	oper(char _type,int _i,int _j,int _k){
		type=_type;
		i=_i;
		j=_j;
		k=_k;
	}
};
vector<oper> ans;
void add(int a,int b,int c){
	ans.ad({'+',c,b,a});
}
void harc(int a,int b,int c){
	ans.ad({'<',c,b,a});
}
void plant(int ind){
	harc(tv[0],0,zr);
	harc(tv[1],1,zr);
	add(tv[2],tv[0],tv[1]);
	harc(ind,tv[2],zr);
}
void multp2(int ind,int pw){
	FOR(i,pw){
		add(ind,ind,ind);
	}
}
int cnt=3;
int ba[70],bb[70];
int pa[70],pb[70];
void represent(int ind,int* bn,int* pw){
	int bsch=cnt++;
	int tiv=cnt++;
	FORD(i,31){
		pw[i]=cnt++;
		plant(pw[i]);
		multp2(pw[i],i);
		add(bsch,tiv,pw[i]);
		harc(pw[i],ind,bsch);
		multp2(pw[i],i);
		add(tiv,tiv,pw[i]);
		bn[i]=cnt++;
		harc(bn[i],pw[i],zr);
	}
}
int main(){
	srng;
	fastio;
	FOR(i,10){
		tv[i]=N-i-4;
	}
	plant(mk);
	add(0,0,mk);
	add(1,1,mk);
	represent(0,ba,pa);
	represent(1,bb,pb);
	FOR(i,31){
		FOR(j,31){
			add(tv[0],ba[i],bb[j]);
			harc(tv[0],tv[0],mk);
			multp2(tv[0],i+j);
			add(2,2,tv[0]);
		}
	}
	cout<<ans.size()<<endl;
	FOR(i,ans.size()){
		cout<<ans[i].type<<" "<<ans[i].i<<" "<<ans[i].j<<" "<<ans[i].k<<endl;
	}
	return 0;
}	


Measured memory_bytes: 4220
#include <bits/stdc++.h>
//#pragma GCC optimize "-O3"
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned short us;
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ll infll=(1ull<<63)-1,mod=1e9+7;
const int inf=(1ull<<31)-1;
int n,a[100000];
bool q=true;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);cout.precision(18);
	cin>>n;
	for (int i=0;i<n;i++)
		cin>>a[i];
	a[0]--;
	for (int i=1;i<n;i++){
		if (a[i-1]>a[i])
			q=false;
		else if (a[i-1]<a[i]){
			a[i]--;
		}
	}
	cout<<(q?"Yes":"No");
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <cmath>
#include <iomanip>
#include <stdexcept>
// #include <bits/stdc++.h>
#define ll long long
#define ld long double
#define req(i,h) for(int i = 0; i < h; i++)
#define req1(i,h) for(int i = 0; i <= h; i++)

using namespace std;


int main(void) {
    int n;
    cin >> n;
    vector<int> a(n);
    req(i,n) cin >> a.at(i);
    vector<int> s(n);
    req(i,n) s.at(i) = a.at(i);
    sort(s.rbegin(),s.rend());
    req(i,n) {
      int ans = s.at(0);
      if(ans == a.at(i)) ans = s.at(1);
      cout << ans << endl;
    }
    return 0;
}






Measured memory_bytes: 3200
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

const int MAX_N=200,INF=1E9;
const int MAX_DAY=1E6;

struct edge{
	int to,cost;
};

int N,M;
vector<int> q[MAX_DAY+1];
vector<edge> G[MAX_N];

bool flg[MAX_N];	//???????????????????????°
bool used[MAX_N]; 	//????????????????????????????????°
int mincost[MAX_N];

int last;	//?????????????????¶

void prim(){
	int ans=0;
	fill(flg,flg+N,false);
	fill(mincost,mincost+N,INF);
	fill(used,used+N,false);
	mincost[last]=0;
	for (int i=MAX_DAY;i>=0;i--){
		if (q[i].empty()) continue;
		for (int j=0;j<q[i].size();j++){
			used[q[i][j]]=true;
		}
		while(1){
			int v=-1;
			for (int j=0;j<N;j++){
				if (!flg[j] && used[j] && (v==-1 || mincost[j]<mincost[v])){
					v=j;
				}
			}
			if (v==-1) break;
			if (mincost[v]==INF){
				fill(flg,flg+N,false);
				fill(mincost,mincost+N,INF);
				mincost[last]=0;
				ans=0;
				break;
			}
			ans+=mincost[v];
			flg[v]=true;
			for (int j=0;j<G[v].size();j++){
				edge e=G[v][j];
				mincost[e.to]=min(mincost[e.to],e.cost);
			}
		}
	}
	printf("%d\n",ans);
}

int main(){
	do{
		scanf("%d %d",&N,&M);
		if (N || M){
			int lastd=-1;
			last=-1;
			for (int i=0;i<=MAX_DAY;i++){
				q[i].clear();
			}
			for (int i=0;i<N;i++){
				G[i].clear();
			}
			for (int i=0;i<N;i++){
				int t;
				scanf("%d",&t);
				q[t].push_back(i);
				if (t>lastd){
					lastd=t;
					last=i;
				}
			}
			for (int i=0;i<M;i++){
				int a,b,c;
				scanf("%d %d %d",&a,&b,&c);
				G[a-1].push_back((edge){b-1,c});
				G[b-1].push_back((edge){a-1,c});
			}
			prim();
		}
	}while (N || M);
	return 0;
}

Measured memory_bytes: 24972