akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		SC sc = new SC(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		int C=sc.nextInt();
		if((A<=C && C<=B)||(A>=C && C>=B)) {
			pl("Yes");
		}
		else {
			pl("No");
		}
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
}

Measured memory_bytes: 20820
#include<bits/stdc++.h>
#define fi first
#define se second
#define LL long long

using namespace std;
const int maxn = 1e5 + 5;
typedef pair<int, int> P;

vector<int> g[maxn];
char s[maxn];
int sz[maxn], rt;
LL dp[maxn][3], ans = 1LL << 30;
LL f[3][4];

void dfs(int u, int fa) {
    for(auto v:g[u]) {
        if(v == fa)
            continue;
        dfs(v, u);
    }
    for(int i = 0; i < 3; i++) {
        for(int j = 0; j < 4; j++)
            f[i][j] = 1LL << 30;
        f[i][i] = 1 + (i > 1);
    }
    for(auto v:g[u]) {
        if(v == fa)
            continue;
        if(sz[v]) {
            for(int i = 0; i < 3; i++) {
                f[i][3] = min(f[i][0] + dp[v][2], f[i][3] + dp[v][0]) + 1;
                f[i][2] = min(f[i][1] + dp[v][1] + 1, f[i][2] + dp[v][0] + 1);
                f[i][1] = min(f[i][0] + dp[v][1], f[i][1] + dp[v][0] + 1);
                f[i][0] = f[i][0] + dp[v][0] + 1;
            }
            sz[u]++;
        }
    }
    for(int i = 0; i < 3; i++)
        dp[u][i] = 1LL << 30;
    int op = (sz[u] + (s[u] == 'W')) & 1;
    for(int j = 0; j < 3; j++) {
        dp[u][j] = min(dp[u][j], f[0][j] + ((op + (j == 0) + (j == 2 && u == rt)) & 1));
    }
    dp[u][2] = min(dp[u][2], f[0][3] + ((op + 1 + (u == rt)) & 1));
    for(int j = 1; j < 3; j++) {
        dp[u][j] = min(dp[u][j], f[1][j] + ((op + 1 + (j == 2 && u == rt)) & 1));
    }
    dp[u][2] = min(dp[u][2], f[1][3] + ((op + (u == rt)) & 1));
    for(int j = 2; j < 3; j++) {
        dp[u][j] = min(dp[u][j], f[2][j] + ((op + 2 + (j == 2 && u == rt)) & 1));
    }
    dp[u][2] = min(dp[u][2], f[2][3] + ((op + 1 + (u == rt)) & 1));
    if(s[u] == 'W')
        sz[u]++;
}

int main() {
#ifdef CX_TEST
    freopen("E:\\program--GG\\test_in.txt", "r", stdin);
#endif
    int n, i, u, v;
    scanf("%d", &n);
    for(i = 1; i < n; i++) {
        scanf("%d%d", &u, &v);
        g[u].push_back(v);
        g[v].push_back(u);
    }
    scanf("%s", s + 1);
    for(i = 1; i <= n; i++) {
        if(s[i] == 'W')
            break;
    }
    rt = i;
    if(i > n)
        return puts("0"), 0;
    dfs(i, 0);
    cout << min(min(dp[i][0], dp[i][1]), dp[i][2] - 1) << endl;
    return 0;
}


Measured memory_bytes: 16384
c500=int(input())
c100=int(input())
c50=int(input())
x=int(input())
a=0
for i in range(c500+1):
    for j in range(c100+1):
        for k in range(c50+1):
            amount=k*50+j*100+i*500
            if amount==x:
                a+=1
print(a)
            

Measured memory_bytes: 3060
S = int(input())
S_lst = [S]

for i in range(10**5):
    if S_lst[i] % 2 == 0:
        S_lst.append(S_lst[i] / 2)
    else:
        S_lst.append(3 * S_lst[i] + 1)
    if S_lst[i+1] in S_lst[:-1]:
        print(i+2)
        break

Measured memory_bytes: 9152
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18

N,M=rl()

if M%N==0:
    print(M//N)
else:
    x = M//N
    ans = 1
    for i in range(x,0,-1):
        if M%i != 0:
            continue
        else:
            ans = i
            break
    print(ans)

Measured memory_bytes: 40044
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int h,n;
    cin>>h>>n;
    int ans=0;
    vector<int>a(n);
    rep(i,n){
        cin>>a[i];
        ans+=a[i];
    }
    if(ans>=h)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 640
/*
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
*/
#include <bits/stdc++.h>

#define rep(i,n)  for(int i=0; i<(n); i++)
using ll = long long;
using namespace std;

int main()
{
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;

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

char a, b;

int main() {
  cin >> a >> b;
  if (a == 'H') {
    if (b == 'H') {
      cout << "H";
    } else {
      cout << "D";
    }
  } else {
    if (b == 'H') {
      cout << "D";
    } else {
      cout << "H";
    }
  }
}


Measured memory_bytes: 3584
import collections

n=int(input())
s=[(input()) for _ in range(n)]

lis=[list(s[i]) for i in range(n)]
lis_sort = [sorted(lis[i]) for i in range(n)]
lis_sort = [''.join(lis_sort[i]) for i in range(n)]
lis_sort.sort()

c = collections.Counter(lis_sort)
values, counts = zip(*c.most_common(len(c)))
cnt=0
for i in range(len(counts)):
    if counts[i]==2: cnt+=1
    elif counts[i]>2: cnt+=counts[i]*(counts[i]-1)//2
print(cnt)

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

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

  string s; cin >> s;
  if(s == "RRR") cout << 3 << endl;
  else if(s == "RRS" || s == "SRR") cout << 2 << endl;
  else if(s == "SSS") cout << 0 << endl;
  else cout << 1 << endl;

}








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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    bool ans = false;
    
    if ((abs(a - c) <= d)) {
        ans = true;
    }
    else if ((abs(a - b) <= d) && (abs(b - c) <= d)) {
        ans = true;
    }
    
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#define REP(i,n) for(int i=0;i<n;i++)
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

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


    cout << 3*r*r << endl;
    return 0;
}

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

int main(){
    char a,b;
    cin >> a >> b;
    if(a == 'H'){
        if(b == 'H')cout << 'H' << endl;
        else cout << 'D' << endl;
    }

    else{
        if(b == 'H')cout << 'D' << endl;
        else cout << 'H' << endl;
    }

    return 0;
}

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

int main() {
	vector<int> v(3); int n; cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) { cin >> v[j]; v[j] = pow(v[j], 2); }
		sort(v.begin(), v.end());
		if (v[0] + v[1] == v[2]) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 3020
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>
#include<cstdio>
#include<cstring>
#include<map>
#include<set>
#include<fstream>
#include<sstream>
#include<queue>
#include<iterator>
#include<stack>
using namespace std;
vector<int> g[100000];
stack<int> path;
int cnt[100000],mid,n;
void dfs(int x,int pre){
	path.push(x);
	if(x==n-1){
		int up=(path.size())/2,down=up;
		stack<int> p;
		while(up--){
			p.push(path.top());
			path.pop();
		}
		mid=p.top();
		while(down--){
			path.push(p.top());
			p.pop();
		}
	}
	cnt[x]=1;
	for(int i=0;i<g[x].size();i++){
		if(g[x][i]!=pre){
			dfs(g[x][i],x);
			cnt[x]+=cnt[g[x][i]];
		}
	}
	path.pop();
}


int main(){
	cin>>n;
	for(int i=1;i<n;i++){
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	dfs(0,-1);
	if(cnt[mid]>=n-cnt[mid])cout<<"Snuke\n";
	else cout<<"Fennec\n";
	
	
	
	

  return 0;
}


Measured memory_bytes: 26880
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

map<ll, int> mp;
int N;
const int MAX_N = (int) 1e5;

void solve() {
    int ans = 0;
    EACH(m, mp) if (m.second % 2 != 0) ans++;
    cout << ans << endl;
}

int main() {
    cin >> N;
    ll temp;
    REP(i, N) {
        cin >> temp;
        mp[temp]++;
    }
    solve();
    return 0;
}

Measured memory_bytes: 6528
#include <stdio.h>

int main()
{
    while (1)
    {
        int w, h;
        scanf("%d %d", &h, &w);
        if (w == 0 && h == 0)
        {
            break;
        }
        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2580
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int number = 0;
  
  for(int i=0;i<N;i++){
    int l,r;
    cin>>l>>r; 
    number = number + (r-l+1);
  }
  cout<<number<<endl;
}

    


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  vector<ll> a(n);
  rep(i,n) R a[i];
  vector<ll> b=a;
  sort(all(b));
  rep(i,n) {
    REP(j,i,n) {
      swap(a[i],a[j]);
      if(a==b) {
        pr("YES");
        return;
      }
      swap(a[i],a[j]);
    }
  }
  pr("NO");
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> piipii;

#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back
const int mod = 1e9+7;

ll dp[1000005];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    ll sum = 0;
    int cnt = n-2+1;
    for(int i=1;i<=n;i++){
        if(i == 1) dp[i] = n;
        else if(i == 2) dp[i] = n*1ll*n%mod;
        else{
            if(i >= 4) sum = (sum + dp[i-3])%mod;
            dp[i] = (dp[i] + dp[i-1])%mod;

            dp[i] = (dp[i] + (n-1)*1ll*(n-1))%mod;

            dp[i] = (dp[i] + sum)%mod;
            dp[i] = (dp[i] + cnt)%mod;
            cnt--;
        }
    }
    printf("%lld\n", dp[n]);
}

Measured memory_bytes: 11572
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = LLONG_MAX;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */

int main() {
    int d,n;cin >> d >> n;
    if(d==0){
        if(n==100)cout << 101 << endl;
        else cout << n << endl;
    }
    if(d==1) {
        if(n==100) cout << 10100 << endl;
        else cout << n*100 << endl;
    }
    if(d==2) {
        if(n%10==0) cout << 10000*(n+1) << endl;
        else cout << 10000*n << endl;
    }
    return 0;
}

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

#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(v) int(v.size())
#define pii pair<int, int>
#define mp make_pair
#define f first
#define ll long long
#define s second
#define vec vector<int>

using namespace std;

const int N = (int) 3e5 + 10;
const int M = (int) 1e6 + 10;
const int K = (int) 500 + 10;
const int mod = (int) 998244353;

int n;
ll a, b, m;
int f[N], inv[N];

int mult(int x, int y) {
	return 1ll * x * y % mod;
}

void add(int &x, int y) {
	x += y;
	if (x >= mod)
		x -= mod;
}

int mult(vec x) {
	int cur = 1;
	for (auto it : x) {
		cur = mult(cur, it);
	}
	return cur;
}

int c(int x1, int x2, int x3, int x4) {
	return mult({f[n], inv[x1], inv[x2], inv[x3], inv[x4]});
}

int bp(int x, int y) {
	int ans = 1;
	while (y) {
		if (y & 1) 
			ans = mult({ans, x});
		x = mult({x, x});
		y >>= 1;
	}
	return ans;
}

int cnk(int n, int k) {
	return k > n ? 0 : mult({f[n], inv[n - k], inv[k]});
}

int solve(int n, ll sum) {
	//cout << sum << ":\n";
	int res = 0;
	for (ll x = 0; x <= n; x++) {
		ll y = (sum - a * x) / b;
		if (y < 0 || y > n - x) continue;
		if (a * x + b * y != sum) continue;
		cout << x << ' ' << y << endl;
		add(res, mult({cnk(n - x, y), cnk(n, x)}));
	}
	return res;
}

int main() {
	#ifdef sony
		freopen("input.txt", "r", stdin);
		freopen("output1.txt", "w", stdout);
	#endif
	srand(time(0));
	cin >> n >> a >> b >> m;
	for (int i = 0; i <= n; i++) {
		f[i] = i == 0 ? 1 : mult({f[i - 1], i});
		inv[i] = bp(f[i], mod - 2);
	}
	ll g = __gcd(a, b);
	int ans = 0;
	for (ll x = 0; x <= n; x++) {
		ll y = (m - a * x) / b;
		if (y < 0 || y > n) 
			continue;
		if (a * x + b * y != m) 
			continue;
		add(ans, mult({cnk(n, x), cnk(n, y)}));
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
	int n;
  cin >> n;
  vector<int> a(n);
  vector<int> tmp(n);
  rep(i, n){
    cin >> a[i];
    tmp[i] = a[i];
  }

  sort(tmp.rbegin(), tmp.rend());
  rep(i, n){
    if(a[i] == tmp[0]){
      cout << tmp[1] << endl;
    }
    else{
      cout << tmp[0] << endl;
    }
  }

	return 0;
}



Measured memory_bytes: 3200
#include<iostream>
#include<vector>
#include<utility>
#include<map>
#include<deque>
#include<numeric>
#include<algorithm>

using namespace std;
using ll = long long int;
constexpr int INF = 1 << 29;
int n, a, b, c;
int l[1001];
int ret = 0;

int dfs(int num = 0, int an = 0, int bn = 0, int cn = 0) {
	if (num == n) {
		int ret;
		if (min({ an, bn, cn }) > 0)
			ret = abs(a - an) + abs(b - bn) + abs(c - cn) - 30;
		else
			ret = INF;
		return ret;
	}
	int ret0 = dfs(num + 1, an, bn, cn);
	int ret1 = dfs(num + 1, an + l[num], bn, cn) + 10;
	int ret2 = dfs(num + 1, an, bn + l[num], cn) + 10;
	int ret3 = dfs(num + 1, an, bn, cn + l[num]) + 10;
	vector<int> ret = { ret0, ret1, ret2, ret3 };
	return *min_element(ret.begin(), ret.end());
}


int main(void) {
	cin >> n >> a >> b >> c;
	for (int i = 0; i < n; i++) {
		cin >> l[i];
	}
	cout << dfs() << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll lcm(ll a,ll b)
{
   ll c=a*b;
  ll d= __gcd(a,b);
  return c/d;
}
  
int main()
{
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll x,y,z,p;
  x=(b/c)-(a/c);
  if(a%c==0)
    x++;
    //cout<<x<<endl;
   y=(b/d)-(a/d);
  if(a%d==0)
    y++;
    //cout<<y<<endl;
  p=lcm(c,d);
  z=(b/p)-(a/p);
  if(a%p==0)
    z++;
    //cout<<z<<endl;
    //cout<<p<<endl;
  cout<<b-a-x-y+z+1;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;

ll mod=1e9+7;

ll mpow(ll x, ll n) {
  ll ans=1;
  while(n>0) {
    if(n&1) {
      ans=ans*x%mod;
    }
    x=x*x%mod;
    n>>=1;
  }
  return ans;
}

vector<ll> tfact(1e7+1);
void fact(ll n) {
  for(ll i=0;i<=n;i++) {
    if(i==0) {
      tfact[i]=1;
    }
    else {
      tfact[i]=tfact[i-1]*i%mod;
    }
  }
}

ll comb(ll n, ll k) {
  return tfact.at(n)*mpow(tfact.at(k),mod-2)%mod*mpow(tfact.at(n-k),mod-2)%mod;
}

int main() {
  fact(1e7);
  ll x,y;
  cin >> x >> y;
  ll n=min(x,y)-abs(x-y);
  if(n<0||n%3) {
    cout << 0 << endl;
    return 0;
  }
  n/=3;
  cout << comb(abs(x-y)+n*2,n) << endl;
}

Measured memory_bytes: 78336
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    int aa, ab, ac;
    cin >> aa >> ab >> ac;
    if(aa+ab+ac>=22){
        cout << "bust" << endl;
        return 0;
    }
    else{
        cout << "win" << endl;
        return 0;
    }
}

Measured memory_bytes: 3640
#include <iostream>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a==1)a=14;
    if(b==1)b=14;
    if(a<b){
        cout<<"Bob"<<endl;
    }else if(a>b){
        cout<<"Alice"<<endl;
    }else{
        cout<<"Draw"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; i<(n); i++)
int main()
{
    ll a, b;
    cin >> a >> b;
    ll m = max(a,b);
    ll s = min(a,b);
    ll g = 1;
    while (true) {
        if (m*g % s == 0) break;
        ++g;
    }

    cout << g*m << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
a=[int(i) for i in input().split()]
d=[]
tmp=0
for i,j in enumerate(a):
    if i==0:
        tmp+=abs(j)
        d.append(((abs(j)+abs(a[i]-a[i+1])),abs(a[i+1])))
    elif i==n-1:
        tmp+=abs(a[i-1]-a[i])+abs(j)
        d.append((abs(a[i-1]-a[i])+abs(j),abs(a[i-1])))
    else:
        f=abs(a[i]-a[i-1])
        tmp+=f
        d.append((abs(a[i-1]-a[i])+abs(a[i]-a[i+1]),abs(a[i-1]-a[i+1])))

for i in d:
    print(tmp-i[0]+i[1])


Measured memory_bytes: 21640
# coding: utf-8
# Your code here!

#n=int(input())


c=[]
n,T=[int(i) for i in input().split()]

for _ in range(n):
    c0,t0=[int(i) for i in input().split()]
    if t0 <= T:
        c.append(c0)

if len(c)==0:
    print("TLE")
else:
    print(min(c))

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

int main() {
  int N,H;
  cin>>H>>N;
  vector<int> p(H+1,167167167);
  p[0]=0;
  for(int j=0;j<N;j++){
    int a,b;
    cin>>a>>b;
    for(int i=1;i<=H;i++){
      p[i]=min(p[i],p[max(i-a,0)]+b);
    }
  }
  cout<<p[H]<<endl;
}

Measured memory_bytes: 3652
#include<iostream>
#include <bits/stdc++.h>
#include <cstdio>
#include<set>
using namespace std;
typedef long long int64;

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

int main()
{
    int64 M, n, L;
    cin >> L;
    cin >> M;
    
    n = gcd(L, M);
    if (n == 1){
        cout << 1 << endl;
        return 0;
    }
    //fprintf(stderr, "l = %d, m = %d, n = %d\n", L, M, n);
    int64 a = 2;
    int64 ans = 1;
    int64 prev_a = -1;
    set<int>  s; 
    s.insert(1);
    
    while (n >= a * a) {
        // a �Ŋ���؂ꂽ��Aa �͑f����
        // �����āA�����鐔�� a �Ŋ���
        // a �Ŋ���؂�Ȃ�������A a �� 1 ����������
        if (n % a == 0) {
      //      fprintf(stderr, "%d *", a);
            
            if (s.find(a) == s.end()){
                s.insert(a);
                ans++;
            }
            n /= a;
        } else {
            a++;
        }
    }
    //    fprintf(stderr, "%d\n", n);
    
    // �Ō�Ɏc���� n �͑f����
    if (s.find(n) == s.end()){
        s.insert(n);
        ans++;
    }
    //fprintf(stderr, "a = %d\n", a);
    cout << ans << endl;
    return 0;    
}


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


using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){
  
  srand((unsigned)time(NULL));
  int d;
  int res = 0;
  cin >> d;
  vector<int> c(26);
  rep(i,26)cin >> c[i];
  vector<vector<int>> v(d,vector<int>(26));
  vector<int> contest(d,0);
  vector<int> last(26,0);
  vector<int> satisfy(26,0);
  rep(i,d)rep(j,26){
    int x;cin >> x;
    v[i][j] = x;
  }
  {
    int j = d;
    for(int i = 0;j;i++){
      contest[j-1] = (i%26);
      j--;
    }
  }
  for(int i = 1;i <= d;i++){
    //rep(j,26)if(v[i-1][contest[i-1]] < v[i-1][j])contest[i-1] = j;
    last[contest[i-1]] = i;
    res += v[i-1][contest[i-1]];
    rep(j,26)res -= c[j]*(i-last[j]),satisfy[j] += c[j]*(i-last[j]);
  }
  while(1.0*clock()/CLOCKS_PER_SEC <= 1.95){
    //int now_time = clock();
    //if(1.0*now_time/CLOCKS_PER_SEC > 1.7)break;
    int day = rand()%d,pos = rand()%26;
    vector<int> new_contest = contest;
    int res_ = res;
    int pre = new_contest[day];
    res_ += satisfy[pos];
    res_ += satisfy[pre];
    res_ -= v[day][pre];
    res_ += v[day][pos];
    int pos_satisfy = 0,pre_satisfy = 0;
    last[pos] = last[pre] = 0;
    new_contest[day] = pos;
    for(int i = 1;i <= d;i++)last[pos] = (new_contest[i-1] == pos ? last[pos] = i : last[pos]),pos_satisfy += c[pos]*(i-last[pos]);
    for(int i = 1;i <= d;i++)last[pre] = (new_contest[i-1] == pre ? last[pre] = i : last[pre]),pre_satisfy += c[pre]*(i-last[pre]);
    res_ -= (pos_satisfy+pre_satisfy);
    if(res < res_){
      res = res_;
      contest = new_contest;
      satisfy[pre] = pre_satisfy;
      satisfy[pos] = pos_satisfy;
    }
  }
  rep(i,d)cout << contest[i]+1 << endl;
  


  return 0;
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << x << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 30;
constexpr lint   INFL = 1LL << 62;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n;
  cin >> n;
  vector<int> a(n + 1), b(n);
  rep (i, n + 1) cin >> a[i];
  rep (i, n) cin >> b[i];
  lint sum1 = 0;
  vector<int> ac = a, bc = b;
  rep (i, n) {
    sum1 += min(ac[i], bc[i]);
    bc[i] = max(0, bc[i] - ac[i]);
    sum1 += min(bc[i], ac[i + 1]);
    ac[i + 1] = max(0, ac[i + 1] - bc[i]);
  }
  ac = a, bc = b;
  reverse(all(ac));
  reverse(all(bc));
  lint sum2 = 0;
  rep (i, n) {
    sum2 += min(ac[i], bc[i]);
    bc[i] = max(0, bc[i] - ac[i]);
    sum2 += min(bc[i], ac[i + 1]);
    ac[i + 1] = max(0, ac[i + 1] - bc[i]);
  }
  cout << max(sum1, sum2) << endl;
  return 0;
}

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

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

    int min = INT32_MAX;
    int A;
    for (int i = 0; i < N; ++i) {
        std::cin >> A;
        int cnt = 0;
        while (A % 2 == 0) {
            A /= 2;
            ++cnt;
        }

        min = std::min(min, cnt);
    }

    std::cout << min << std::endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if (b >= c) {

			System.out.println("delicious");

		} else if ((a + b + 1) <= c) {

			System.out.println("dangerous");

		} else if ((a + b + 1) >= c) {

			System.out.println("safe");

		}
	}
}


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

using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
const int M=301;
int n,m,x,y;
int dp[M][M][M];
string s;
int calc(int i,int j,int c){
    if(c<0)return -1e9;
    if(j<=i)return j==i;
    int &k=dp[i][j][c];
    if(k!=-1)return k;
    k=max(calc(i+1,j,c),calc(i,j-1,c));
    return k=max(k,2+calc(i+1,j-1,c-(s[i]!=s[j])));
}
int main()
{
    memset(dp,-1,sizeof dp);
    cin>>s>>x;
    n=s.size();
    cout<<calc(0,n-1,x);
    return 0;
}


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

int main(){
    int n, m;
    scanf("%d %d",&n,&m);
    vector<int> road[51];
    for(int i=0;i<m;++i){
        int a, b;
        scanf("%d %d",&a,&b);
        road[a].push_back(b);
        road[b].push_back(a);
    }

    for(int i=1;i<=n;++i){
        printf("%d\n",road[i].size());
    }

    return 0;
}


Measured memory_bytes: 256
S=input()
memR=[0]*2
memL=[0]*2
l=[0]*len(S)
for i in range(len(S)):
  j=len(S)-1-i
  if S[i]=='R':
    memR[i%2]+=1
  else:
    if i%2==1:
      l[i]+=memR[1]
      l[i-1]+=memR[0]
    else:
      l[i]+=memR[0]
      l[i-1]+=memR[1]
    memR=[0]*2
  if S[j]=='L':
    memL[j%2]+=1
  else:
    if j%2==1:
      l[j]+=memL[1]
      l[j+1]+=memL[0]
    else:
      l[j]+=memL[0]
      l[j+1]+=memL[1]
    memL=[0]*2
print(*l)

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

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

using namespace std;
using ll = long long;
int mod = 1000000007;

void solve();

int main(void){
    int num[101] = {0};
    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            num[i*j] = 1;
        }
    }
    int N; cin >> N;
    if(num[N] == 1) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

void solve(){}

Measured memory_bytes: 256
s=input()
odd=["R","U","D"]
even=["L","U","D"]
l=len(s)
for i in range(l):
    if i % 2==0:
        if s[i] in odd:
            pass
        else:
            print("No")
            exit(0)
    else:
        if s[i] in even:
            pass
        else:
            print("No")
            exit(0)
print("Yes")

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

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

int main(void) {
    int i,j;
    int n;
    cin >> n;
    rep(i,n){
        if(n-i*4 >=0 && (n-i*4)%7==0){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
--import Data.Array
--import Data.Array.Unboxed
import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe

-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
-- templete



main = do
    [_,a,b] <- getInts
    putStrLn $ cond "Alice" "Borys" $ even $ b - a




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

class Edge {
  public:
    int from;
    int to;
    long long coin;
    Edge(int _from, int _to, int _coin) {
      from = _from;
      to = _to;
      coin = _coin;
    }
};

class Node {
  public:
    long long coin;
    Node() {
      coin = -1e9;
    }
};

long long bellman_ford(vector<Node>& node, const vector<Edge>& edge)
{
  node.front().coin = 0;
  for (size_t i = 0; i < node.size(); i++) {
    for (const auto& e : edge) {
      node.at(e.to).coin = max(node.at(e.to).coin, node.at(e.from).coin + e.coin);
    }
  }

  // detect negative weight cycle
  long long result = node.back().coin;
  for (size_t i = 0; i < node.size(); i++) {
    for (const auto& e : edge) {
      node.at(e.to).coin = max(node.at(e.to).coin, node.at(e.from).coin + e.coin);
    }
  }
  if (result == node.back().coin) {
    return max(0LL, result);
  } else {
    return -1;
  }
}

int main()
{
  int nnodes, nedges, p;
  cin >> nnodes >> nedges >> p;
  vector<Node> node(nnodes);
  vector<Edge> edge;
  for (int i = 0; i < nedges; i++) {
    int from, to, coin;
    cin >> from >> to >> coin;
    from--;
    to--;
    edge.emplace_back(from, to, coin - p);
  }
  cout << bellman_ford(node, edge) << '\n';
  return 0;
}


Measured memory_bytes: 512
h,w = map(int,input().split())
A = [list(input()) for i in range(h)]
B = []

for aa in A:
    flag = 0
    for a in aa:
        if a == "#":
            flag = 1
            break
    if flag:
        B.append(aa)

for i in range(w):
    flag = 1
    for j in range(len(B)):
        if B[j][i] == "#":
            flag = 0
            break
    if flag:
        for j in range(len(B)):
            B[j][i] = ""

[print("".join(b)) for b in B]

Measured memory_bytes: 3064
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int x = new java.util.Scanner(System.in).nextInt();
		int y = 0;
		int t = x/15;
		System.out.println(x*800-(t*200));
	}
}


Measured memory_bytes: 21588
import sys

a = range(1,1001) + range(1001,0,-1)
for s in sys.stdin:
    n = int(s)
    r = 0
    for i in range(min(2000,n),-1,-1):
        if n - i <= 2000:
            r += a[i] * a[n - i]
    print r

Measured memory_bytes: 4308
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod=1e9+7;
void solve(){
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll m1,m2,m3,m4;
  m1=a*c;
  m2=a*d;
  m3=b*c;
  m4=b*d;
  cout<<max({m1,m2,m3,m4})<<endl;

}
int main()
{
   int t=1;
   //int t;
   //cin>>t;
    while(t--)
        solve();
     
   return 0;   
}


 

Measured memory_bytes: 3620
#include <stdio.h>

int main(){
  int w[11], s[11], i, j, n, wmax, res, sum;
  char f[11][21];

  while(scanf("%d", &n) && n){
    sum = 0;
    for(i = 0; i < n; ++i){
      scanf("%s %d %d", f[i], &w[i], &s[i]);
      sum += w[i];
    }

    for(j = 0; j < n; ++j){
      wmax = 0;
      for(i = 0; i < n; ++i)
	if(sum - w[i] <= s[i] && wmax <= w[i])
	  res = i, wmax = w[i];
      
      puts(f[res]);
      s[res] = -999999;
      sum -= w[res];
    }
  }
  return 0;
}

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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

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

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

template<typename T, size_t size> void fill(T (&ary)[size], const T& val){
    fill_n((T*)ary, size, val);
}

void solve() {
    //const i64 mod = 1'000'000'007;

    i64 X,Y,Z,K;
    cin >> X >> Y >> Z >> K;

    vector<i64> A(X),B(Y),C(Z);
    rep(i,0,X) cin >> A[i];
    rep(i,0,Y) cin >> B[i];
    rep(i,0,Z) cin >> C[i];

    sort(begin(A),end(A));
    sort(begin(B),end(B));
    sort(begin(C),end(C));

    vector<i64> ab;
    rep(i,0,X){
        rep(j,0,Y){
            ab.emplace_back(A[i]+B[j]);
        }
    }

    sort(rbegin(ab),rend(ab));

    auto count=[&](i64 x){
        i64 res=0;
        rep(i,0,ab.size()){
            res+=C.size()-(lower_bound(begin(C),end(C),x-ab[i])-begin(C));
        }
        return res;
    };

    i64 lb=0,ub=inf64;
    while(ub-lb>1){
        i64 mid=(lb+ub)/2;
        if(count(mid)>=K) lb=mid;
        else ub=mid;
    }

    sort(rbegin(C),rend(C));

    vector<i64> ans;
    rep(i,0,ab.size()){
        if(ans.size()==K) break;
        rep(j,0,C.size()){
            if(ans.size()==K) break;
            if(ab[i]+C[j]<=lb) break;
            ans.emplace_back(ab[i]+C[j]);
        }
    }

    while(ans.size()<K) ans.emplace_back(lb);

    sort(rbegin(ans),rend(ans));

    rep(i,0,K){
        cout << ans[i] << endl;
    }
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 10608
#include <bits/stdc++.h>
#include <iostream>
#include <utility>
#include <algorithm>
#include <numeric>
#define load ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define ll long long
#define ull unsigned long long
#define fori(i,n) for (int i=0; i<int(n);i++)
#define srt(v) sort(v.begin(), v.end())
#define MOD 1000000007
const int INF = 1e9;
const double PI = 3.14159265358979323846;

ll gcd(ll a, ll b) {
    return b != 0 ? gcd(b, a % b) : a;
}
 
ll lcm(ll a, ll b) {
    return (a * b) / gcd(a, b);
}

void solve(){

}

int main(){
	load;
    ll n;
    cin>>n;
    string ans = "";
    while(n>0){
    	n -= 1;
    	ans += (char) 'a' + n%26;
    	n /= 26;
    }

    reverse(ans.begin(), ans.end());
    cout << ans << "\n";
	return 0;



	
}



Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); i++)
#define rrep(i, to) for (int i = (to) - 1; i >= 0; i--)
#define repf(i, from, to) for (int i = (from); i < (to); i++)
#define all(v) v.begin(), v.end()
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

int main() {
  int n, m;
  cin >> n >> m;

  priority_queue<int, vector<int>, less<int>> a;

  rep(i, n) {
    int el_a;
    cin >> el_a;
    a.push(el_a);
  }

  rep(i, m) {
    int max_el = a.top();
    a.pop();

    int discount = max_el / 2;
    a.push(discount);
  }

  ll ans = 0;
  while(!a.empty()) {
    int el = a.top();
    a.pop();

    ans += el;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3844
A,B,K = map(int, input().split())

if (B-A)*0.5+1<=K:
    for i in range(A,B+1):
        print(i)
else:
    _list=[]
    for i in range(K):
        _list.append(A+i)
        _list.append(B-i)
    _list.sort()
    for i in _list:
        print(i)

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

int main()
{
    while (true) {
        int a, b;
        string op;
        cin >> a >> op >> b;
        if (op == "+") {
            cout << a + b << "\n";
        }
        else if (op == "-") {
            cout << a - b << "\n";
        }
        else if (op == "*") {
            cout << a * b << "\n";
        }
        else if (op == "/") {
            cout << a / b << "\n";
        }
        else break;
    }
}

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

int main(){
  string S;
  cin >> S;
  
  sort(S.begin(), S.end());
  
  if((S[0] == 'a') && (S[1] == 'b') && (S[2] == 'c') ){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    char[] s = scanner.next().toCharArray();
    long[] M = {999_999_937, 1_000_000_007};
    long B = 9973;
    int left = 0;
    int right = N / 2 + 1;
    while (right - left > 1) {
      int mid = (left + right) / 2;
      if (possible(s, mid, N, B, M)) left = mid;
      else right = mid;
    }
    System.out.println(left);
  }

  private static boolean possible(char[] s, int K, int N, long B, long[] M) {
    long[] bn = new long[M.length];
    for (int i = 0; i < M.length; i++) {
      bn[i] = 1;
      for (int j = 0; j < K - 1; j++) {
        bn[i] *= B;
        bn[i] %= M[i];
      }
    }

    HashMap<Tuple, Integer> occurrences = new HashMap<>();
    long[] hash = new long[M.length];
    for (int i = 0; i < M.length; i++) {
      hash[i] = hash(s, K, B, M[i]);
    }
    occurrences.put(new Tuple(hash), 0);
    for (int i = 1; i <= N - K; i++) {
      for (int j = 0; j < M.length; j++) {
        hash[j] -= s[i - 1] * bn[j] % M[j];
        if (hash[j] < 0) hash[j] += M[j];
        hash[j] *= B;
        hash[j] %= M[j];
        hash[j] += s[i + K - 1];
        if (hash[j] >= M[j]) hash[j] -= M[j];
      }
      Tuple key = new Tuple(hash);
      if (occurrences.containsKey(key)) {
        if (occurrences.get(key) + K <= i) return true;
      }
      else occurrences.put(key, i);
    }
    return false;
  }

  private static long hash(char[] s, int len, long B, long M) {
    if (s.length < len) throw new IllegalArgumentException("len must be equal to or more than s.length: len=" + len + ", s.length=" + s.length);
    long hash = 0;
    for (int i = 0; i < len; i++) {
      hash *= B;
      hash %= M;
      hash += s[i];
      if (hash >= M) hash -= M;
    }
    return hash;
  }

  private static class Tuple {
    private final long[] elements;

    private Tuple(long[] elements) {
      this.elements = Arrays.copyOf(elements, elements.length);
    }

    @Override public boolean equals(Object o) {
      if (this == o) return true;
      if (o == null || getClass() != o.getClass()) return false;
      Tuple tuple = (Tuple) o;
      return Arrays.equals(elements, tuple.elements);
    }

    @Override public int hashCode() {
      return Arrays.hashCode(elements);
    }
  }
}


Measured memory_bytes: 29516
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int ans = 1;
        int tmp = a;

        while(tmp < b){
            tmp += a - 1;
            ans++;
        }
        if(b == 1){
            ans = 0;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
typedef long long int ll; 
typedef long double ld; 


int main()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	ll m,d;
	cin>>m>>d;
	
	ll ans = 0;
	
	for(ll i=1;i<=d;i++)
	{
		if(i%10 < 2)continue;
		if(i/10 < 2)continue;
		ll val = (i%10)*(i/10);
		//cout<<i<<" "<<val<<endl;
		if(val>=1 and val<=m){
			//cout<<i<<" "<<val<<endl;
			ans++;
		}
	}
	cout<<ans<<endl;
	
}



Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
int32_t main()
{
	#ifndef ONLINE_JUDGE
	freopen("in","r",stdin);
	freopen("out","w",stdout);
	#endif
	string s;
	cin>>s;
	int n=s.length();
	for(int i=0;i<n-1;i++)
	{
		if(s[i]==s[i+1])
		{cout<<i+1<<" "<<i+2<<"\n";return 0;}
	}
	for(int i=0;i<n-2;i++)
	{
		if(s[i]==s[i+2]){cout<<i+1<<" "<<i+3<<"\n";return 0;}
	}
	puts("-1 -1");
}


Measured memory_bytes: 3752
{-# LANGUAGE BangPatterns #-}
import Data.Maybe
import Data.List
import qualified Data.IntMap.Strict as IntMap

countElements :: [Int] -> IntMap.IntMap Int
countElements xs = fst4 $ foldl' acc (IntMap.singleton maxI 0, maxI, maxLen, 1) (xs' ++ [(0, 10^9+1)])
  where ((maxLen, maxI) : xs') = sortBy (flip compare) $ zip xs [1..]
        acc (!counter, !current, !lastLen, !countMet) (l, i) =
          let nextCount = IntMap.adjust ((lastLen - l) * countMet +) current counter
          in if i < current
               then (IntMap.insert i 0 nextCount, i, l, countMet + 1)
               else (nextCount, current, l, countMet + 1)
        fst4 (x, _, _, _) = x

im2is :: Int -> IntMap.IntMap Int -> [Int]
im2is n cnt = map (fromMaybe 0 . flip IntMap.lookup cnt) [1..n]

main :: IO ()
main = do
  n <- readLn
  as <- mapM readIO . words =<< getLine
  let cnt = countElements as
  mapM_ print $ im2is n cnt


Measured memory_bytes: 86524
#include<stdio.h>

int main () {
long long int t, sum =1;
scanf("%lld",&t);

long long int n[t];
for(int i=0;i<t;i++){
    scanf("%lld",&n[i]);
}
for(int i=0; i<t; i++){
  if (n[i] ==0 ){
    printf("0");
    return 0;
  }

}
for (int i=0; i<t;i++){
  if(n[i] <=1000000000000000000 /sum){
    sum *= n[i];
  }
  else{
    printf("-1");
    return 0;
  }
}
printf("%lld",sum);
return 0;
}

Measured memory_bytes: 4024
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

class Main {
    public static long MAX = 100000000000L;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long k = sc.nextLong();
        long[] w = new long[n];
        int[] v = new int[n];
        int totalValue = 0;
        for(int i = 0; i < n; i++) {
            w[i] = sc.nextLong();
            v[i] = sc.nextInt();
            totalValue += v[i];
        }
        ArrayList<Long> dp = new ArrayList<>(Collections.nCopies(totalValue + 1, MAX));
        dp.set(0, 0L);
        int maxValue = 0;
        for(int i = 0; i < n; i++) {
            for(int value = totalValue - v[i]; value >= 0; value--) {
                dp.set(value + v[i], Math.min(dp.get(value + v[i]), w[i] + dp.get(value)));
            }
        }
        for(int i = 0; i <= totalValue; i++) {
            if(dp.get(i) <= k) {
                maxValue = i;
            }
        }
        System.out.println(maxValue);

    }
}


Measured memory_bytes: 98732
n, m, l = list(map(int, input().split()))
A = [[0]*m for i in range(n)]
B = [[0]*l for i in range(m)]
C = [[0]*l for i in range(n)]
for i in range(n):
  a = list(map(int, input().split()))
  for j in range(m):
    A[i][j] = a[j]
for i in range(m):
  b = list(map(int, input().split()))
  for j in range(l):
    B[i][j] = b[j]
for i in range(n):
  for j in range(l):
    for k in range(m):
      C[i][j] += A[i][k]*B[k][j]
for i in range(n):
  print(" ".join(map(str, C[i])))


Measured memory_bytes: 6880