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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int d,n,b;
int p[15];
int h[15];
 
double y(double x,double vx,double vy){
	return -(1.0/2.0/vx/vx)*x*x+(vy/vx)*x;
}

double check(const double unit,const double htar){
	const double vx=sqrt(unit*unit/8.0/htar);
	const double vy=unit/2.0/vx;  
	rep(i,n){
		double pos=1.0*p[i];
		int div=pos/unit;
		pos-=div*unit;
		//dump(pos)
		double height=y(pos,vx,vy);
		//dump(height)

		if(abs(pos)<eps)
			return false;

		if(height < h[i])
			return false;
	}
	return true;
}


int main(void){

	cin >> d >> n >> b;
	rep(i,n) cin >> p[i] >> h[i];

	double ans=inf;

	rep(i,b+1){
		const double unit=1.0*d/(i+1);

		double lb=eps,ub=INF;

		rep(loop,200){
			double m=(lb+ub)/2.0;
		//dump(m)
			if(check(unit,m))
				ub=m;
			else
				lb=m;
		}
		double vx=sqrt(unit*unit/8.0/lb);
		double vy=unit/2.0/vx;
		ans=min(ans,sqrt(vx*vx+vy*vy));

		const double t=unit/4.0;
		if(check(unit,t)){
			double vx=sqrt(unit*unit/8.0/t);
			double vy=unit/2.0/vx;
			ans=min(ans,sqrt(vx*vx+vy*vy));
		}
	}
	cout.precision(9);
	cout << fixed;
	cout  << ans << endl;
	return 0;
}

Measured memory_bytes: 1240
a,b,c,k = map(int, input().split())

ans = 0
x = k - a
if x < 0:
  ans += k
  print(ans)
  exit()
else:
  ans += a
  k = k - a


y = k - b
if y < 0:
  print(ans)
  exit()
else:
  k = k - b

z = k - c
ans -= k
print(ans)



Measured memory_bytes: 61764
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("trapv")
#pragma GCC target("sse4")

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

#define deb(x) cout << #x << " is " << x << "\n"
#define int long long
#define mod 1000000007
#define PI acos(-1)
// void swap(int *a, int *b)
// {
//     int t = *a;
//     *a = *b;
//     *b = t;
// }

int32_t main()
{
    string st;
    cin>>st;
    int s =0; 
    for(int i =0; i < st.length(); i++)
      s += (st[i] - 48);

    string p = (s % 9 == 0)? "Yes": "No";
    cout<<p;
    

    return 0;
}

Measured memory_bytes: 3712
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define MAXCHAR 200000

int main(void)
{
    int c;
    int i = 0;
    char strinput[MAXCHAR];
    while ((c = getchar()) != ' ')
    {
        strinput[i] = c;
        /* printf("%s\n",strinput); */
        i=i+1;
    }
    strinput[i] = '\0';

    double tap= atof(strinput);

    i=0;
    while ((c = getchar()) != EOF)
    {
        strinput[i] = c;
        /* printf("%s\n",strinput); */
        i=i+1;
    }
    strinput[i] = '\0';

    double hope=atof(strinput);

    /* (A-1)(n-1) + A > B */
    /* (A-1)n + 1 > B */
    /* n > (B-1)/(A-1) */

    /* double result = (hope-1)/(tap -1); */
    /* printf("%f",result); */

    int result2 = (hope-1)/(tap -1) + 0.9;
    printf("%d",result2);
    return 0;
}


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

using namespace std;
int main() {
	string s;

	cin >> s;
	int win = 0;
	for (int c : s) {
		if (c == 'o') {
			win++;
		}
	}

	int possible = win + 15 - s.length();

	if (possible >= 8) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}

	return 0;

}

Measured memory_bytes: 760
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

const ll INF = 1ll << 28;

struct Enclosure {
  double min, max;
  bool exists;
  Enclosure()
      : min(INF), max(-INF), exists(false) {
  }
  void expand(double x) {
    exists = true;
    chmin(min, x);
    chmax(max, x);
  }
  double dist() const {
    return max - min;
  }
};

vector<double> findEventPoints(const Enclosure& X, const Enclosure& L, const Enclosure& R) {
  vector<double> res;
  if (X.exists && L.exists) {
    if (X.max < L.max) res.push_back(L.max - X.max);
    if (X.min < L.min) res.push_back(L.min - X.min);
  }
  if (X.exists && R.exists) {
    if (X.max > R.max) res.push_back(X.max - R.max);
    if (X.min > R.min) res.push_back(X.min - R.min);
  }
  if (L.exists && R.exists) {
    if (L.max > R.max) res.push_back((L.max - R.max) * 0.5);
    if (L.min > R.min) res.push_back((L.min - R.min) * 0.5);
  }
  return res;
}

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int N;
  while (cin >> N) {
    vector<double> x(N), y(N);
    vector<char> dir(N);
    for (int i = 0; i < N; i++) cin >> x[i] >> y[i] >> dir[i];
    Enclosure X, Y, U, D, L, R;
    for (int i = 0; i < N; i++) {
      if (dir[i] == 'U') U.expand(y[i]), X.expand(x[i]);
      if (dir[i] == 'D') D.expand(y[i]), X.expand(x[i]);
      if (dir[i] == 'L') L.expand(x[i]), Y.expand(y[i]);
      if (dir[i] == 'R') R.expand(x[i]), Y.expand(y[i]);
    }
    auto f = [&](double t) {
      Enclosure nX = X, nY = Y;
      if (L.exists) nX.expand(L.min - t), nX.expand(L.max - t);
      if (R.exists) nX.expand(R.min + t), nX.expand(R.max + t);
      if (U.exists) nY.expand(U.min + t), nY.expand(U.max + t);
      if (D.exists) nY.expand(D.min - t), nY.expand(D.max - t);
      return nX.dist() * nY.dist();
    };
    vector<double> events = {0, INF};
    for (double t : findEventPoints(X, L, R)) events.push_back(t);
    for (double t : findEventPoints(Y, D, U)) events.push_back(t);
    double res = 1ll << 60;
    for (double t : events) chmin(res, f(t));
    printf("%.20lf\n", res);
  }
  return 0;
}


Measured memory_bytes: 1920
w = input()
wl = []

for i in range(len(w)):
  wl.append(w[i])
  
wl.sort()

a = 1
judge = 1
if len(w)%2 == 0:
  for n in range(len(w)-1):
    if wl[a+n] == wl[a+n-1]:
      judge += 1
    else:
      if judge%2 != 0:
        print("No")
        exit()
      else:
        judge = 1
    if n == len(w)-2:
      if judge%2 == 0:
        print("Yes")
      else:
        print("No")
else:
  print("No")

Measured memory_bytes: 9152
using System;
using System.Collections.Generic;
using System.Linq;
class a{
  public static void Main(){
    String str = Console.ReadLine();
    char c = str[0];
    if('a' <= c && c <= 'z'){
      Console.WriteLine("a");
    }
    else{
      Console.WriteLine("A");
    }
  }
}


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

int main()
{
	int cnt = 0;
	int N;
	cin >> N;
	for(int i=0;i<N;i++){
		int a;
		cin >> a;
		if(a%2)
			cnt++;
		
	}
	if(cnt%2)
		cout << "NO" << endl;
	else
		cout << "YES" << endl;
	return 0;
}

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

int main(){
    long long INF = -1e15;
    int N, M;
    long long P;
    cin >> N >> M >> P;
    vector<int> par[N+1];
    bool able[N+1];
    fill_n(able, N+1, false);
    struct edge {long long from, to, cost;};
    edge es[M];
    long long d[N+1];
    long long A, B, C;
    rep(i, M){
        cin >> A >> B >> C;
        es[i].from = A;
        es[i].to = B;
        es[i].cost = C-P;
        par[B].push_back(A);
    }
    queue<int> que;
    que.push(N);
    able[N] = true;
    while(!que.empty()){
        int i = que.front();
        que.pop();
        rep(j, par[i].size()){
            if(!able[par[i][j]]){
                able[par[i][j]] = true;
                que.push(par[i][j]);
            }
        }
    }
    rep2(i, 2, N+1) d[i] = INF;
    d[1] = 0;
    long long count = 0;
    while(true){
        bool update = false;
        rep(i, M){
            edge e = es[i];
            if(d[e.from] != INF && d[e.to] < d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
                update = true;
            }
        }
        if(update){
            count++;
        }
        else break;
        if(count > N) break;
        
    }
    if(count > N){
        queue<int> que2;
        rep(i, M){
            edge e = es[i];
            if(d[e.from] != INF && d[e.to] < d[e.from] + e.cost){
                que2.push(e.from);
            }
        }
        bool check = false;
        while(!que2.empty()){
            int i = que2.front();
            que2.pop();
            if(able[i]) check = true;
        }
        if(check) cout << -1 << endl;
        else if(d[N] < 0) cout << 0 << endl;
        else cout << d[N] << endl;
    }
    else if(d[N] < 0) cout << 0 << endl;
    else cout << d[N] << endl;
}

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

long double min(double a, double b) {
  return a < b ? a : b;
}

int main() {
  long double d, e;
  while(cin >> d >> e, d && e) {
    long double ans = 1001001001;
    for (int i=0; i<d; i++) {
      long double j = d - i;
      long double d_ = abs(sqrt(pow(i, 2) + pow(j, 2)) - e);
      ans = min(ans, d_);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3272
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	s := nextStr()

	if IsKaibun(s) == false {
		fmt.Println("No")
		return
	}
	if IsKaibun(s[:(len(s)-1)/2]) == false {
		fmt.Println("No")
		return
	}
	if IsKaibun(s[(len(s)+1)/2:]) == false {
		fmt.Println("No")
		return
	}

	fmt.Println("Yes")

}

// IsKaibun return IsKaibun
func IsKaibun(s string) bool {
	n := len(s)

	for i, c := range s {
		if c != rune(s[n-i-1]) {
			return false
		}
	}

	return true
}

// ---- readfunc
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 640
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (1<<20)
#define LLINF (1LL<<60)
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
    ll a,b,n;
    cin>>a>>b>>n;
    if(b==1){
        cout<<0;
        return 0;
    }
    if(b>n){
        cout<<floor(a*n/b);
    }
    else{
        cout<<a-1-(a/b);
    }
    return 0;
}


Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define mreps(i,j,n) for(int i = j; i <= n; i++)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define el cout << endl
#define sp(x) cout << setprecision(x);
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vpii vector<pair<int,int>> 
#define vl vector<ll> 
#define vvl vector<vector<ll>> 
#define vb vector<bool> 
#define vvb vector<vector<bool>>
#define vs vector<string>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a * b / g; }
bool is_prime(ll x) { for (ll i = 2; i * i <= x; i++) { if (x % i == 0)return false; } return true; }

vvi to;
vi dp;
int rec(int n)
{
	if (to[n].empty())return dp[n] = 0;
	if (dp[n]>=0)return dp[n];
	int res = 0;
	for (int i = 0; i < sz(to[n]); i++)
	{
		int next = to[n][i];
		chmax(res, rec(next) + 1);
	}
	return dp[n] = res;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m; cin >> n >> m;
	to = vvi(n);
	rep(i, m)
	{
		int x, y; cin >> x >> y;
		x--; y--;
		to[x].push_back(y);
	}
	dp = vi(n, -1);
	int ans = -1;
	rep(i, n)
	{
		if (dp[i] < 0)rec(i);
		chmax(ans, dp[i]);
	}
	co(ans);
	return 0;
}


Measured memory_bytes: 8192
#include<stdio.h>
#define N 100000
#define Q 50000

int i,j;

int main(){
  int n,q,count=0,l,r,m;
  int S[N],T[Q];

  scanf("%d",&n);
  for(i=0 ; i<n ; i++){
    scanf("%d",&S[i]);
  }

  scanf("%d",&q);
  for(i=0 ; i<q ;i++){
    scanf("%d",&T[i]);
  }

 
  for(i=0 ; i<q ; i++){
    l=0;
    r=n;
    while(l<r){
      m=(l+r)/2;
      if(S[m]==T[i]){count++;break;}
      if(S[m]>T[i])r=m;
      if(S[m]<T[i])l=m+1;
    }
  } 
    printf("%d\n",count);
    
    return 0;
  }

Measured memory_bytes: 1184
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
ll const mod=998244353;
const ll MAX=300000;
using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}


//////////////////////////////////////


int main(){
    int a,b;
  cin>>a>>b;
  if(a<=9&&b<=9)cout<<a*b<<endl;
  else cout<<-1<<endl;
  return 0;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
	int h,a;
	int ans=0;
	cin>>h>>a;
	while(h>0){
		h-=a;
		ans++;
	}
	cout<<ans<<"\n";
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	solve();
	return 0;
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def enum_primes(n):
    flag_num = (n + 1) // 2
    prime_flag = [True] * flag_num

    for num in range(3, int(n ** 0.5) + 1, 2):
        idx = (num - 1) // 2 - 1
        if prime_flag[idx]:
            for j in range(idx + num, flag_num, num):
                prime_flag[j] = False

    primes = [2]
    temp = [(i+1) * 2 + 1 for i in range(flag_num) if prime_flag[i]]
    primes.extend(temp)

    return primes


def main():
    n = int(readline())
    primes = set(enum_primes(55555))
    x = []
    l = 0
    for prime in primes:
        if len(x) == n:
            break
        if prime % 5 == 1:
            x.append(prime)
    print(*x)


if __name__ == '__main__':
    main()


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

int main() {
    int N;
    int max1 = 0;
    int max2 = 0;
    int max1id;
    cin >> N;
    for(int i = 0; i < N; i++){
        int tmp = 0;
        cin >> tmp;
        if(tmp > max1){
            max2 = max1;
            max1 = tmp;
            max1id = i;
        }else if (tmp > max2){
            max2 = tmp;
        }
    }

    for(int i = 0; i < N; i++){
        if(i == max1id){
            cout << max2 << endl;
        }else{
            cout << max1 << endl;
        }
    }
}

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

int main(){
    int A, B, C, X;
    cin >> A >> B >> C >> X;

    int count = 0;
    for(int i = 0; i <= A; i++){
        for(int j = 0; j <= B; j++){
            for(int k = 0; k <= C; k++){
                if(500*i + 100*j + 50*k == X){
                    count++;
                }
            }
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
//
//#include <immintrin.h>
//#include <emmintrin.h>

#include <bits/stdc++.h>
//#pragma GCC optimize("O2")
#define vi vector<int>
#define pii pair<int, int >
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define LL long long
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define all(x) (x).begin(), (x).end()
#define all2(x,n) (x+1), (x+1+n)
#define sz(x) ((int)(x).size())
#define mod(x) ((x)%MOD)
#define debug(x) cerr<<#x<<" : "<<x<<endl
#define mt make_tuple
#define eb emplace_back
#define o(X) (1<<(X))
#define oL(X) (1LL<<(X))
#define contain(S,X) (((S)&o(X))!=0)
#define containL(S,X) (((S)&oL(X))!=0)
using namespace std;
const int INF=0x3f3f3f3f,N=1e6+5,MOD=998244353;
const LL INF_LL=0x3f3f3f3f3f3f3f3fLL;
inline int getplc(int x,int y) { return (x>>y)&1; }
template<typename T>
T square(T x) {return x*x;}
LL qpow(LL a,LL b=MOD-2,LL _MOD=MOD){
	LL res=1;
	for(;b;b>>=1,a=a*a%_MOD){
		if(b&1)res=res*a%_MOD;
	}
	return res;
}
// Smax
//int Smax() { return -INF; }
template <typename T>
T Smax(T x) { return x; }
template<typename T, typename... Args>
T Smax(T a, Args... args) { return max(a, Smax(args...)); }
// Smin
template <typename T>
T Smin(T x) { return x; }
template<typename T, typename... Args>
T Smin(T a, Args... args) { return min(a, Smin(args...)); }
template <typename T>
// erro
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); errl(_it, args); }

void errl(istream_iterator<string> it) {}
template<typename T, typename... Args>
void errl(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	errl(++it, args...);
}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr<<endl;}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << "=" << a << " # ";
	err(++it, args...);
}
void Solve();
int main() {
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//    freopen("o1.txt","w",stdout);
#endif
	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
	Solve();
	return 0;
}

//////////////////////////////////////////////////////////////////

int a[N];
void Solve(){
  int n;
  cin>>n;
  rep(i,1,n)cin>>a[i];
  sort(a+1,a+1+n);
  LL ans=0;
  rep(i,1,n-1)ans+=a[n-i/2];
  cout<<ans<<endl;
}

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

using namespace std;

typedef long long ll;

struct Point
{
    ll x,y;
    Point(){ x = y = 0.0; }
    Point(ll _x, ll _y) : x(_x), y(_y){}

    Point operator+ (Point p)
    {
        return Point(p.x + x, p.y + y);
    }

    Point operator- (Point p)
    {
        return Point(x - p.x, y - p.y);
    }

    ll operator* (Point p)
    {
        return p.x * x + p.y * y;
    }

    Point operator* (ll t)
    {
        return Point(x*t, y*t);
    }

    ll operator~ ()
    {
        return x * x + y * y;
    }

    ll operator% (Point p)
    {
        return x * p.y - y * p.x;
    }

};

int main()
{
    cout.precision(10);
    cout << fixed;
    int q;
    Point p0, p1, p2, vec, vec1;
    cin >> p0.x >> p0.y >> p1.x >> p1.y;
    cin >> q;
    while(q--)
    {
        cin >> p2.x >> p2.y;
        vec = (p2 - p0);
        vec1 = (p1 - p0);
        if( vec%vec1 < 0LL ) puts("COUNTER_CLOCKWISE");
        else if( vec%vec1 > 0LL) puts("CLOCKWISE");
        else
        {
            if(vec * vec1 < 0LL) puts("ONLINE_BACK");
            else
            {
                if(~vec > ~vec1) puts("ONLINE_FRONT");
                else puts("ON_SEGMENT");
            }
        }
    }

    return 0;
}

Measured memory_bytes: 3068
#include<bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define int long long
#define double long double


using namespace std;
const int N = 501777;
int h1, m1;
int h2, m2;
int k;
string s;


signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	//freopen("input.txt", "r", stdin);
    cin >> s;
    for (int i = 0; i < s.size(); i++){
        if (s[i] == '?'){
            cout << 'D';
        }
        else {
            cout << s[i];
        }
    }
}


Measured memory_bytes: 3740
// Author : Rifayat Samee (Sanzee)
// Problem :
// Algorithm:

/*

*/
#include <bits/stdc++.h>
using namespace std;
void dfs(int u,vector<int>&color,const vector<vector<int>>&graph,vector<int>&top){
    color[u] = 1;
    for(int i=0;i<graph[u].size();i++){
        int v = graph[u][i];
        if(color[v] == 0){
            dfs(v,color,graph,top);
        }
    }
    top.push_back(u);
}

int main(){

	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
    int n,m;
    scanf("%d %d",&n,&m);
    vector<vector<int>>graph(n+1);
    for(int i=0;i<m;i++){
        int u,v;
        scanf("%d %d",&u,&v);
        graph[u].push_back(v);
    }
    vector<int>topo;
    vector<int>color(n+1,0);
    for(int i=1;i<=n;i++){
        if(color[i] == 0){
            dfs(i,color,graph,topo);
        }
    }
    vector<int>dp(n+1,0);
    int res = 0;
    for(int i=topo.size()-1;i>=0;i--){
        int u = topo[i];
        for(int j = 0;j<graph[u].size();j++){
            int v = graph[u][j];
            dp[v] = max(dp[v],dp[u] + 1);
            res = max(res,dp[v]);
        }
    }
    printf("%d\n",res);
    return 0;
}


Measured memory_bytes: 9720
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>
 
using namespace std;

pair <long long, long long> xy[100];
long long x[100];
long long y[100];
vector <pair <long long, long long> > c_hull;
 
template <typename T,typename U>                                                   
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {   
    return {l.first+r.first,l.second+r.second};                                    
}
template <typename T,typename U>                                                   
std::pair<T,U> operator-(const std::pair<T,U> & l,const std::pair<T,U> & r) {   
    return {l.first-r.first,l.second-r.second};                                    
}
 
 
long long cross(pair <long long, long long> xy1, pair <long long, long long> xy2){
    return xy1.first * xy2.second - xy1.second * xy2.first;
}
 
long long dot(pair <long long, long long> xy1, pair <long long, long long> xy2){
    return xy1.first * xy2.first + xy1.second * xy2.second;
}
 
double norm(pair <long long, long long> xy){
    return sqrt((double)(xy.first * xy.first) + (double) (xy.second * xy.second));
}
 
void convex_hull(int N){
    sort(xy, xy + N);
 
    int k = 0;
    c_hull.resize(2 * N);
    for(int i = 0; i < N; i++){
        while(k > 1 && cross(c_hull[k - 1] - c_hull[k - 2], xy[i] - c_hull[k - 1]) <= 0){
            k--;
        }
        c_hull[k] = xy[i];
        k++;
    }
    int lower_half = k;
    for(int i = N - 2; i >= 0; i--){
        while(k > lower_half && cross(c_hull[k - 1] - c_hull[k - 2], xy[i] - c_hull[k - 1]) <= 0){
            k--;
        }
        c_hull[k] = xy[i];
        k++;
    }
    c_hull.resize(k - 1);
}
 
int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> xy[i].first >> xy[i].second;
        x[i] = xy[i].first;
        y[i] = xy[i].second;
    }
 
    convex_hull(N);
 
    map <pair <long long, long long>, double> ans;
    if(c_hull.size() == 2){
        ans[c_hull[0]] = 0.5;
        ans[c_hull[1]] = 0.5;
    } else {
      for(int i = 1; i < c_hull.size() + 1; i++){
        double cos_value = (double) dot(c_hull[i % c_hull.size()] - c_hull[i - 1], c_hull[(i + 1) % c_hull.size()] - c_hull[i % c_hull.size()]) 
            / norm(c_hull[i % c_hull.size()] - c_hull[i - 1]) / norm(c_hull[(i + 1) % c_hull.size()] - c_hull[i % c_hull.size()]);
        double prob = acos(cos_value) / (2 * M_PI);
        ans[c_hull[i % c_hull.size()]] = prob; 
      }
    }
 
 
    for(int i = 0; i < N; i++){
        if(ans.find(make_pair(x[i], y[i])) == ans.end()){
            cout << fixed << setprecision(17) << 0.0 << endl;
        } else {
            cout << fixed << setprecision(17) << ans[make_pair(x[i], y[i])] << endl;
        }
    }
    
 
    return 0;
}

Measured memory_bytes: 256
N = int(input())
al = list(map(int, input().split()))

al = [0] + al # 1-index
multi_cnts = [0]*(N+1)
ans = []
for n in range(N,0,-1):
    if multi_cnts[n] != al[n]:
        ans.append(n)
        for i in range(1, int(n**0.5)+1):
            if n%i == 0:
                multi_cnts[i]+=1
                multi_cnts[i]%=2
                if i*i != n:
                    multi_cnts[n//i]+=1
                    multi_cnts[n//i]%=2


print(len(ans))
if ans: print(*ans)

Measured memory_bytes: 99696
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

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

  int ans = 1;
  for (int i = k + 1; i <= n; i += k - 1)
    ans++;

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define fl(i,x,y) for( int i=x;i<y;i++)
#define w(t) while(t--)
#define vi vector<ll>
#define vvi vector< vi >
#define si set<ll>
#define msi multiset<ll>
#define si_d set<ll, greater<ll> >
#define mii map<ll,ll>
#define pb push_back
#define msi_it  multiset<ll> :: iterator
#define si_it set<ll> :: iterator
#define sort1(v) sort(v.begin(),v.end());
#define F first
#define S second
using namespace std;
#define N 1000000007
#define mod 15000000000031
int main()
{
	int n,m;
	cin>>n>>m;
	cout<<(n*(n-1)/2)+(m*(m-1)/2);
}

Measured memory_bytes: 256
def calc_gcd(a, b) 
  if b > 0 then
    calc_gcd(b,a % b) 
  else
    a
  end
end

def calc_lcm(a, b)
  (a / calc_gcd(a, b)) * b
end

while line = STDIN.gets
  line.chomp!
  arr = line.split(" ")
  gcd = calc_gcd(arr[0].to_i, arr[1].to_i)
  lcm = calc_lcm(arr[0].to_i, arr[1].to_i)
  puts "#{gcd} #{lcm}" 
end

Measured memory_bytes: 8612
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>

typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PRECISION std::cout << std::fixed << std::setprecision(20);
  
using namespace std;
 
const ll inf = 1e18;
const ll N = 2e5+1;
const ll bits = 20;
const ld pi = 3.14159265358979323846;
const ll mod = 1e9+7;
const ll p = 29;

int main(){

    FASTIO;
    PRECISION; 

    string s;
    cin>>s;

    if(s[2]==s[3]&&s[4]==s[5]){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
    

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P;

int main(){
	int sx,sy,tx,ty;
	scanf("%d %d %d %d", &sx, &sy, &tx, &ty);

	for(int i=sy;i<ty;i++){
		printf("U");
	}
	for(int i=sx;i<tx;i++){
		printf("R");
	}
	for(int i=ty;i>sy;i--){
		printf("D");
	}
	for(int i=tx;i>sx;i--){
		printf("L");
	}
	printf("L");
	for(int i=sy;i<ty+1;i++){
		printf("U");
	}
	for(int i=sx-1;i<tx;i++){
		printf("R");
	}
	printf("D");
	printf("R");
	for(int i=ty;i>sy-1;i--){
		printf("D");
	}
	for(int i=tx+1;i>sx;i--){
		printf("L");
	}
	printf("U\n");

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 3005
#define M 1000000007

ll arr[20][20], dp[1 << 17], cost[1 << 17];
int n;

void upd(int i, int om, int mask, int gm)
{
    if(i > n){
    dp[mask] = max(dp[mask], dp[om] + cost[gm]);
    return;
    }
    //dp[mask] = max(dp[mask], dp[om] + cost[gm]);
    upd(i + 1, om, mask, gm);
    if(((om >> (i - 1)) & 1) == 0)
        upd(i + 1, om, mask | (1 << (i - 1)), gm | (1 << (i - 1)));
}

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++)
            cin >> arr[i][j];
    }
    for(int i = 0; i < (1 << n); i++)
    {
        for(int j = 1; j <= n; j++)
        {
            if((i >> (j - 1)) & 1)
            {
                for(int k = j + 1; k <= n; k++)
                    if((i >> (k - 1)) & 1)
                        cost[i] += arr[j][k];
            }
        }
    }
    for(int i = 0; i < (1 << n); i++)
    {
        upd(1, i, i, 0);
    }
    cout << dp[(1 << n) - 1] << endl;
}



Measured memory_bytes: 1280
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        a: f64, b: f64, h: f64, m: f64,
    }
    let el = h + m / 60.0;
    let pi = (-1.0f64).acos();
    let adeg = 2.0 * pi / 12.0 * el;
    let bdeg = adeg * 12.0;
    let (ax, ay) = (a * adeg.cos(), a * adeg.sin());
    let (bx, by) = (b * bdeg.cos(), b * bdeg.sin());
    puts!("{}\n", ((ax - bx).powf(2.0) + (ay - by).powf(2.0)).sqrt());
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 3008
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void array_sort(int array[], int array_size);
void print_array(int array[], int array_size);

int main(void){
	int i,num_count,val[100];
	char buf[512],*ch;
	
	fgets(buf, sizeof(buf), stdin);
  	sscanf(buf, "%d\n", &num_count);

	fgets(buf,sizeof(buf),stdin);
	ch = strtok(buf," ");
	for (i = 0;i < 100;i++) {
		if (ch == NULL) {
			break;
		} else {
			val[i] = atoi(ch);
		}
		ch = strtok(NULL," ");
	}
	print_array(val, num_count);
	array_sort(val, num_count);
}

void array_sort(int array[], int array_size){
	for(int i = 1; i < array_size; i++){
		int key = array[i];
		int j = i - 1;
		while (j >= 0 && array[j] > key){
			array[j+1] = array[j];
			j--;
		}
		array[j+1] = key;
		print_array(array, array_size);
	}
}

void print_array(int array[], int array_size){
	for (int i = 0; i < array_size;i++){
		printf("%d",array[i]);
		if (i != array_size - 1){
			printf(" ");
		} else{
			printf("\n");
		}
	}
}


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

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

    if (N <= 104){
        cout << 0;
    }
    else if (N <= 134){
        cout << 1;
    }
    else if (N <= 164){
        cout << 2;
    }
    else if (N <= 188){
        cout << 3;
    }
    else if (N <= 194){
        cout << 4;
    }
    else {
        cout << 5;
    }

    return 0;
}


Measured memory_bytes: 256
icase=0
if icase==0:
    n,m=map(int,input().split())
    a=[""]*n
    for i in range(n):
        a[i]=input()
    b=[""]*m
    for i in range(m):
        b[i]=input()
#    n,m=3,2
#    a=['#.#', '.#.', '#.#']
#    b=['#.', '.#']
    for ni in range(n-m+1):
        for nj in range(n-m+1):
            yn=""
            for im in range(m):
#                print(a[ni+im][nj:nj+m],b[im])
                if a[ni+im][nj:nj+m]!=b[im]:
                    yn="NG"
                    break
            if yn=="NG":
                continue
            if yn=="":
                yn="OK"
                break
        if yn=="OK":
            break
        else:
            continue
    if yn=="OK":
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll inf = 1e18;
ll a[100010][3];
ll dp[100010][3];

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }
    for (int i = 1; i <= n; i++) {
        for (int f = 0; f < 3; f++) {
            for (int t = 0; t < 3; t++) {
                if (f == t) continue;
                dp[i][t] = max(dp[i][t], dp[i-1][f] + a[i][t]);
            }
        }
    }
    cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;
    return 0;
}

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

using namespace std;

#pragma GCC optimize "-O3"

#define watch(x) cout << (#x) << " is " << (x) << endl

#define rep(i,a,b)  for(int i=a;i<b;i++)
#define repd(i,a,b) for(int i=a-1;i>=b;i--)
#define nl          cout<<endl;
#define test()      lli t;cin>>t;while(t--)
#define sp(n)       setprecision(n)

#define lli     long long int
#define ulli    unsigned long long int
#define ld      long double
#define uld     unsigned long double
#define S       string
#define C       char
#define elif    else if
 
#define pb      push_back
#define pp      pop_back
#define plli    pair<lli,lli>
#define vlli    vector<lli>
#define vulli   vector<ulli>
#define vld     vector<ld>
#define vs      vector<string>

#define bs      binary_search
#define ub      upper_bound
#define lb      lower_bound

#define vsort(v) sort(v.begin(),v.end())

#define max1 1000001    //10^6 + 1
#define max2 10000001   //10^7 + 1
#define max3 1000000007 //10^9 + 7
#define inf  1000000009 //10^9 + 9

const int N = 1e5+5;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lli n,k;
    cin >> n >> k;
    lli h[n+1];
    for (int i = 0; i < n; ++i)
    {
    	cin >> h[i];
    }
    lli dp[n+k];
    for (int i = 0; i < n+k; ++i)
    {
        dp[i] = inf;
    }
    dp[0] = 0;
    // dp[1] = 0;
    // dp[2] = abs(h[2]-h[1]);
    // int a2;
    for (int i = 0; i < n; ++i)
    {
        // a2 = k;
        // dp[i] = 9999999;
        for(int j = i+1; j <= i+k; ++j )
        {   
         if (j < n) {
        	   dp[j] = min(dp[j], abs(h[i]-h[j])+dp[i]);
                }
            }
    }
    cout << dp[n-1] << '\n';
    
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

ll A[3007],dp[3007];

int main(){
  ll N,S,ANS=0;
  cin >> N >> S;
  rep(i,N){
    cin >> A[i+1];
  }
  Rep(i,1,N+1){
    rrep(j,S+1){
      if(j==0){
        dp[j]++;
      }
      if(j>=A[i]){
        dp[j]+=dp[j-A[i]];
        if(j==A[i]){
          dp[j]++;
        }
      }
      dp[j]%=MOD2;
    }
    ANS=(ANS+dp[S])%MOD2;
  }
  cout << ANS << endl;
}

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


int main(){
    int64_t N;
    cin >> N;
    N--;
    string s = "abcdefghijklmnopqrstuvwxyz";
    string ans = "";
    while(N/26 != 0){
        //cout << N << endl;
        ans = s.at(N%26) + ans;
        N = N/26-1;
    }
    ans = s.at(N%26) + ans;
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;

ll dp[2010][2010];
int main(void){
    int n,m;
    cin>>n>>m;
    vector<int>s(n),t(m);
    for(int i=0;i<n;i++)cin>>s[i];
    for(int i=0;i<m;i++)cin>>t[i];
    for(int i=0;i<=n;i++)dp[i][0]=1;
    for(int i=0;i<=m;i++)dp[0][i]=1;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(s[i-1]==t[j-1])
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%N;
            else{
                dp[i][j]=
                    ((dp[i-1][j]+dp[i][j-1])%N-dp[i-1][j-1]+N)%N;
            }
        }
    }
    cout<<dp[n][m]<<endl;
    return 0;
}


Measured memory_bytes: 31744
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String word = input.readLine();
        if (word.length() == 2){
            System.out.println(word);
        }else {
            System.out.println(revert(word));
        }
    }

    public static  String revert(String word){
        StringBuilder revetWord = new StringBuilder();
        for (int i = word.length() - 1; i > -1 ; i--) {
            revetWord.append(word.charAt(i));
        }
        return revetWord.toString();
    }
}


Measured memory_bytes: 22996
N, M = map(int, input().split())

count = 1
ab = []

for i in range(M):
    ab.append(list(map(int, input().split())))
ab.sort()

a, b = ab[0]

for i in range(1, M):
    a_new, b_new = ab[i]

    if b <= a_new:
        a, b = a_new, b_new
        count += 1

    elif  b_new <= b:
        a, b = a_new, b_new

    else:
        a = a_new

print(count)






Measured memory_bytes: 29528
#include<stdio.h>
int main(){
	int h,w;
	scanf("%d%d",&h,&w);
	while(h!=0&&w!=0){
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if(i==0||i==h-1||j==0||j==w-1)printf("#");
				else printf(".");
			}
			printf("\n");
		}
		
		printf("\n");
		scanf("%d%d",&h,&w);
	}
	return 0;
}


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

using namespace std;
using ll = long long;

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

int main() {
  ll r, d, x;
  cin >> r >> d >> x;
  rep(i, 10) {
    x = r * x - d;
    cout << x << endl;
  }
  return 0;
}


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

#define rep(i,a,b) for(auto i=(a); i<(b); ++i)
#define all(a) begin(a),end(a)

const int MAXN = 3000;
const int MOD = 1000000007;
int dp[MAXN + 5];
int psum[MAXN + 5];

auto sadd(auto& a, auto b){
  a += b;
  if (a >= MOD) a -= MOD;
}

template <typename T>
T add(T a, T b){return (a + b) % MOD;}
template <typename T>
T sub(T a, T b){return (a - b + MOD) % MOD;}

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

  int n;
  cin >> n;
  string s;
  cin >> s;

  auto sum = [&](int i, int j){return i ? sub(psum[j], psum[i - 1]) : psum[j];};

  dp[0] = 1;
  rep(i, 1, n) {
    partial_sum(all(dp), begin(psum), add<int>);
    memset(dp, 0, sizeof(dp));
    rep(j, 0, i + 1) {
      if (s[i - 1] == '<')
	sadd(dp[j], sum(0, j - 1));
      else
	sadd(dp[j], sum(j, i - 1));
    }
  }
  auto res = accumulate(all(dp), 0, add<int>);
  cout << res << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
constexpr long long MAX = 1e15;

vector<long long> dijkstra(const vector<vector<pair<int, long long>>> &G, int s){
    struct RadixHeap {
        using P = pair<long long, int>;
        int bsr(long long x){ return (x == 0) ? -1 : 63-__builtin_clz(x); }
        vector<P> v[65];
        long long last, sz;
        RadixHeap() : last(0), sz(0) { }
        bool empty () { return (sz == 0); }
        void push(long long x, int u) { sz++; v[bsr(x^last)+1].emplace_back(x, u); }
        P pop () {
            if (!v[0].size()) {
                int i = 1;
                while (!v[i].size()) { i++; }
                last = min_element(v[i].begin(), v[i].end())->first;
                for (auto x : v[i]) { v[bsr(x.first^last)+1].emplace_back(x); }
                v[i].clear();
            }
            P res = v[0].back(); sz--; v[0].pop_back(); return res;
        }
    };
    const long long inf = INT64_MAX;
    vector<long long> ret(G.size(), inf); ret[s] = 0;
    RadixHeap rh; rh.push(ret[s], s);
    while (!rh.empty()) {
        long long dist; int node;
        tie(dist, node) = rh.pop();
        if (ret[node] < dist) continue;
        for (auto &e : G[node]) {
            int next_node; long long next_dist;
            tie(next_node, next_dist) = e;
            if (ret[next_node] > ret[node] + next_dist){
                ret[next_node] = ret[node] + next_dist;
                rh.push(ret[next_node], next_node);
            }
        }
    }
    return ret;
}

int main() {
    int n, m, s, t;
    cin >> n >> m >> s >> t;
    s--; t--;
    vector<vector<pair<int, long long>>> g1(n), g2(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        long long c1, c2;
        cin >> a >> b >> c1 >> c2;
        a--; b--;
        g1[a].emplace_back(b, c1);
        g1[b].emplace_back(a, c1);
        g2[a].emplace_back(b, c2);
        g2[b].emplace_back(a, c2);
    }
    
    vector<long long> d1 = dijkstra(g1, s); // yen
    vector<long long> d2 = dijkstra(g2, t); // snuuk
    vector<long long> d(n);
    for (int i = 0; i < n; i++) d[i] = d1[i] + d2[i];
    for (int i = n-1; i > 0; i--) d[i-1] = min(d[i-1], d[i]);
    
    for (auto& ans : d) cout << MAX - ans << '\n';
    return 0;
}

Measured memory_bytes: 19108
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
/* global variables */
/* function */
/* main */
int main(){
    string t;
    cin >> t;

    string ac = "AC";
    for (int i = 0; i < t.size() - 1; i++) {
        if (t.substr(i, 2) == ac) {
            cout << "Yes" << '\n';
            return 0;
        }
    }

    cout << "No" << '\n';
}

Measured memory_bytes: 3600
#include <stdio.h>
#include <iostream>

using namespace std;

int main() {
	int n;
	int x,y,h,w;
	int ryoukin;
	int sum;
	while (cin >> n) {
		if (n== 0) {
			break;
		}
		ryoukin = 0;
		for (int i = 0; i < n; i++) {
			cin >> x >> y >> h >> w;
			sum = x + y + h;
			if (sum <= 60 && w <= 2) {
				ryoukin += 600;
			} else if (sum <= 80 && w <= 5) {
				ryoukin+= 800;
			} else if (sum <= 100 && w <= 10) {
				ryoukin += 1000;
			} else if (sum <= 120 && w <= 15) {
				ryoukin += 1200;
			} else if (sum <= 140 && w <= 20) {
				ryoukin += 1400;
			} else if (sum <= 160 && w <= 25) {
				ryoukin += 1600;
			}
		}
		cout << ryoukin << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
n = int(input())
lg = 0
while n>>lg >=1:
    lg += 1

a = [[0 for _ in range(n)] for __ in range(n)]
for i in range(n):
    for j in range(i+1,n):
        for k in range(lg):
            if (i>>k)&1!=(j>>k)&1:
                a[i][j] = k+1
                break

for i in range(n):
    for j in range(i+1,n):
        print(a[i][j], end = " ")
    print()


Measured memory_bytes: 6000