akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll n,k;
vector<ll> a;

// 約数の列挙
vector<ll> divisor(ll num) {
    vector<ll> ret;
    for(ll i=1; i*i<=num; i++) {
        if(num % i == 0) {
            ret.push_back(i);
            if(num / i != i) ret.push_back(num/i);
        }
    }
    return ret;
}


bool f(ll num){
    vector<ll> v;
    rep(i,n){
        if(a[i]%num!=0) v.push_back(a[i]%num);
    }
    int m=v.size();
    sort(ALL(v));
    vector<ll> front(m+1,0),back(m+1,0);
    for(int i=0;i<m;i++){
        front[i+1]=front[i]-v[i];
    }
    for(int i=m-1;i>=0;i--){

        back[i]=back[i+1]+(num-v[i]);
    }
    ll o_o=LINF;
    rep(i,m+1){
        o_o=min(o_o,max(back[i],-front[i]));
    }
    // cout<<num<<endl;
    // debug(front);
    // debug(back);
    // cout<<o_o<<endl<<endl;
    return (o_o<=k);
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    ll sum=0;
    cin>>n>>k;
    a.resize(n);
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    auto v=divisor(sum);
    sort(ALL(v),greater<ll>());
    for(auto num:v){
        if(f(num)){
            cout<<num<<endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

h,w,k = map(int,input().split())
M=[input().rstrip() for _ in range(h)]
ans = 0
for ib in range(1<<h):
    for jb in range(1<<w):
        cc = 0 
        for i in range(h):
            if ib&(1<<i):continue
            for j in range(w):
                if jb&(1<<j):continue
                cc+=M[i][j]=='#'
        if cc==k:
            ans+=1
print(ans)


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

#include <atcoder/scc>
using namespace atcoder;


void solve(long long N, long long M, std::vector<long long> a, std::vector<long long> b){
    scc_graph graph(N);
    for (int i = 0 ; i < M ; i++) {
        graph.add_edge(a[i], b[i]);
    }
    auto components = graph.scc();
    cout << components.size() << endl;
    for (auto component: components) {
        cout << component.size() << " ";
        for (int i = 0; i < component.size(); i++) {
            cout << component[i] << (i == component.size() - 1 ? "\n" : " ");
        }
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> a(M-1-0+1);
    std::vector<long long> b(M-1-0+1);
    for(int i = 0 ; i < M-1-0+1 ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
    }
    solve(N, M, std::move(a), std::move(b));
    return 0;
}


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

typedef pair<int, int> pii;
typedef long long ll;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cerr << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U> void chmin(T& t, const U& u) { if (t > u) t = u; }
template<class T, class U> void chmax(T& t, const U& u) { if (t < u) t = u; }

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

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

class unionfind {
	vector<int> par, rank;

public:
	void init(int n) {
		par.resize(n);
		rank.resize(n);

		for (int i = 0; i < n; i++) {
			par[i] = i;
			rank[i] = 0;
		}
	}

	int find(int x) {
		if (par[x] == x) return x;
		else return par[x] = find(par[x]);
	}

	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return ;

		if (rank[x] < rank[y]) par[x] = y;
		else {
			par[y] = x;
			if (rank[x] == rank[y]) ++rank[x];
		}
	}

	bool same(int x, int y) { return (find(x) == find(y)); }
} uf;

void dfs(int v, int p, V<int>& mx, VV<pii>& g) {
	for (auto e : g[v]) {
		if (p == e.fi) continue;
		mx[e.fi] = max(mx[v], e.se);
		dfs(e.fi, v, mx, g);
	}
}

const ll MOD = TEN(9) + 7;
ll p2[2010];

int main() {
	p2[0] = 1;
	for (int i = 1; i < 2010; ++i) {
		p2[i] = p2[i-1] * 2 % MOD;
	}

	int N, M; cin >> N >> M;
	ll X; cin >> X;

	V<pair<int, pii>> edges;

	rep(i, M) {
		int U, V, W;
		cin >> U >> V >> W;
		--U; --V;
		edges.eb(W, mp(U, V));
	}
	sort(ALL(edges));
	uf.init(N);

	VV<pii> g(N);

	ll sum = 0;
	V<ll> df;

	rep(i, M) {
		int a, b;
		tie(a, b) = edges[i].se;
		int ct = edges[i].fi;
		if (uf.same(a, b)) {
			V<int> mx(N);
			dfs(a, -1, mx, g);
			int cur = mx[b];
			df.pb(ct - cur);
		} else {
			uf.unite(a, b);
			g[a].eb(b, ct);
			g[b].eb(a, ct);
			sum += ct;
		}
	}

	if (sum > X) {
		puts("0");
		return 0;
	}

	int sm = 0, eq = 0, bg = 0;
	for (auto &x : df) {
		if (x == X - sum) {
			++eq;
		} else if (x < X - sum) {
			++sm;
		} else {
			++bg;
		}
	}

	ll ans = (p2[eq] + MOD - 1) * p2[bg] * 2 % MOD;

	if (X == sum) {
		ans += (p2[N-1] + MOD - 2) * p2[M+1-N] % MOD;
		ans %= MOD;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e17;
 
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
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;}

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

int a[55][55],H,W;

void dfs(int i,int j,vector<vector<int>>&used){
	used[i][j] = true;
	rep(k,0,8){
		int ni = i + dy[k],nj = j + dx[k];
		if(ni<0||nj<0||H<=ni||W<=nj)continue;
		if(a[ni][nj]==0)continue;
		if(used[ni][nj])continue;
		dfs(ni,nj,used);
	}
}

signed main()
{
	//IOS();
	vector<int>ans;
	while(1){
		cin>>W>>H;
		if(W==0&&H==0)break;
		for(int i = 0;i < H;i++){
			for(int j = 0;j < W;j++){
				cin>>a[i][j];
			}
		}
		vector<vector<int>>used(H,vector<int>(W,0));
		int cnt = 0;
		for(int i = 0;i < H;i++){
			for(int j = 0;j < W;j++){
				if(used[i][j])continue;
				if(a[i][j]==0)continue;
				dfs(i,j,used);
				cnt++;
			}
		}
		ans.push_back(cnt);
	}
	for(auto e:ans){
		cout<<e<<endl;
	}
}



Measured memory_bytes: 3184
#include<cstdio>
#include<string>

using namespace std;
int main(){
    int H,W,N,sr,sc;
    int i;
    scanf("%d %d %d", &H, &W, &N);
    char *s = new char[N];
    char *t = new char[N];
    scanf(" %d %d",&sr,&sc);
    scanf(" %s", s);
    scanf(" %s", t);
    //高橋君が最も移動させられる距離が分かればよい
    int L=0,R=0,U=0,D=0;
    for(i=0;i<N;i++){//高橋君の可能な最大移動量を求める（負のときは青木君が可能な最大移動量になる)
        if(s[i]=='L') L++;
        if(s[i]=='R') R++;
        if(s[i]=='U') U++;
        if(s[i]=='D') D++;
        if(L>=sc||R>W-sc||U>=sr||D>H-sr){//盤面から出すことが可能ならＮＯ
            printf("NO");
            return 0;
        }
        if(t[i]=='L' && sc+R>1) R--;
        if(t[i]=='R' && sc-L<H) L--;
        if(t[i]=='U' && sr+D>1) D--;
        if(t[i]=='D' && sr-U<H) U--;
        
    }
    
    printf("YES");
    delete[] s,t;
    return 0;
}

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

using namespace std;

int main(){
  string s;
  cin >> s;
  string a="Yes";
  for(int i=0;i<s.size();i++){
    if(i%2==0){
      if(s[i]=='L'){
        a="No";
      }
    }
    else{
      if(s[i]=='R'){
        a="No";
      }
    }
  }
    cout << a << endl;
}


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

int main(void){
	char word[11];		// input; target word, size<=10
	char str[100];		// input; check word
	int cnt=0;			// answer; word counter
	int i=0;			// loop index;

	scanf("%s", word);
	for(i=0;i<strlen(word);i++){
		if(word[i]>='A' && word[i]<='Z') word[i] += 0x20;
	}
	scanf("%s", str);
	while(strcmp(str, "END_OF_TEXT") != 0){
		for(i=0;i<strlen(str);i++){
			if(str[i]>='A' && str[i]<='Z') str[i] += 0x20;
		}
		if(strcmp(str, word) == 0) cnt++;
		scanf("%s", str);
	}
	
	printf("%d\n", cnt);

	return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a, b;
  cin >> n >> a >> b;
  int d = b - a;
  if(d % 2 == 0) {
    cout << "Alice" << endl;
  } else {
    cout << "Borys" << endl;
  }
  return 0;
}

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

int main(){
  int n,a,b,c;
  cin>>n;
  int A[3];
  a=n/100;
  n=n%100;
  b=n/10;
  c=n%10;
  n=a*100+b*10+c;
  if(a==1)a=9;
  else if(a==9)a=1;
  if(b==1)b=9;
  else if(b==9)b=1;
  if(c==1)c=9;
  else if(c==9)c=1;
  n=a*100+b*10+c;
  cout<<n;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SIZE(a) int((a).size())
const int INF=INT_MAX;

int main(){
    string s;
    cin>>s;
    int n=SIZE(s);
    bool ans=true;
    
    if(ans){
      REP(i,(n-1)/2){
        if(s[i]!=s[n-1-i]){ans=false;}
      }
    }
    if(ans){
      REP(i,(n+1)/4){
        if(s[i]!=s[(n-3)/2-i]){ans=false;}
      }
    }
    
  if(ans){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
int al[4];
int main() {
	std::string S;
	std::cin >> S;
	for (auto u : S) {
		al[u - 'a']++;
	}
	int M = std::max({ al[0],al[1],al[2] });
	int m = std::min({ al[0],al[1],al[2] });
	std::cout << (M - m < 2 ? "YES" : "NO") << std::endl;
	return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
// using System.Linq;

namespace easy_Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            // float[] ABN = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            int[] ABCK = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // long K = long.Parse(Console.ReadLine());
            // int[] abc = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // string S = Console.ReadLine();
            // int a = int.Parse(Console.ReadLine());
            // int b = int.Parse(Console.ReadLine());
            // int h = int.Parse(Console.ReadLine());
            // float N = float.Parse(Console.ReadLine());
            // string c = Console.ReadLine();
            // string B = Console.ReadLine();
            // string[] AopB = Console.ReadLine().Split();
            // var s = (new string[] { Console.ReadLine(), Console.ReadLine(), Console.ReadLine() }).Select(float.Parse);
            // float[] a = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // var X = Console.ReadLine();
            // int[,] abcd = new int[NMQ[2],4];
            // int[] A = new int[NMQ[0]];
            // int[] A_num = new int[NMQ[0]];
            // long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // var hs=new Dictionary<long,long>();
            // for(int i=0;i<s[0];i++){
            //     long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            //     if(hs.ContainsKey(q[0])){hs[q[0]]+=q[1];}
            //     else{hs.Add(q[0],q[1]);}
            // }
            // List<long> kl=new List<long>(hs.Keys);
            // kl.Sort();
            // foreach(long k in kl){
            //     s[1]-=hs[k];
            //     if(s[1]<1){Console.WriteLine("{0}",k);break;}
            // }
            long sum = 0;
            if(ABCK[0]>=ABCK[3]){
                sum+=ABCK[3]*1;
            }else{
                sum+=1*ABCK[0];
                ABCK[3] = ABCK[3]-ABCK[0];
                if(ABCK[3]>=ABCK[1]){
                    ABCK[3] = ABCK[3]-ABCK[1];
                    sum += -1*ABCK[3];
                }else{
                    sum+=0;
                }
            }
            Console.WriteLine(sum);

        }
        //最小公倍数
        static long Lcm(long a, long b)
        {
            return a/Gcd(a,b)*b;
        }

        //最大公約数
        static long Gcd(long m, long n)
        {
            if(n==0)return m;
            return Gcd(n,m%n);
        }
    }
}


Measured memory_bytes: 17832
#include <stdio.h>
#include <math.h>
#include <cmath>

int main(int argc, char* argv[]){
    double r;
    scanf("%lf", &r);
    printf("%f %f\n",
        M_PI * std::pow(r, 2.0),
        2.0f * M_PI * r
    );
}


Measured memory_bytes: 2748
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    int sum=0;
    for(int i=0;i<2;i++){
    if(a>b){
        sum+=a;
        a--;
    }
    else{
        sum+=b;
        b--;
    }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
import numpy as np
 
N = int(input())
F = np.array([list(map(int, input().split(' '))) for _ in range(N)])
P = np.array([list(map(int, input().split(' '))) for _ in range(N)])
 
ans = - (10 ** 11)
 
for n in range(1, 1024):
    bits = np.array(list(map(int, list('{:010b}'.format(n)))))
    dup = np.sum(F * bits, axis=1)
    ans = max(ans, np.sum(P[range(N), dup]))

print(ans)

Measured memory_bytes: 27332
from collections import defaultdict


def main():
  N = int(input())
  A = list(map(int, input().split()))
  Q = int(input())
  # map_ = []
  # for _ in range(Q):
  #   b, c = list(map(int, input().split()))
  #   map_.append([b, c])
  map_ = [list(map(int, input().split())) for _ in range(Q)]

  mem = defaultdict(int)
  for a in A:
    mem[a] += 1

  sum_ = sum(A)
  for i in range(Q):
    from_, to_ = map_[i]
    if not(from_ in mem):
      print(sum_)
      continue
    idiff = mem[from_]
    mem[to_] += mem[from_]
    mem[from_] = 0
    diff = idiff * (to_ - from_)
    sum_ += diff
    # print(mem)
    print(sum_)


if(__name__ == '__main__'):
  main()

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

int gcd(int x, int y){
	if(y == 0) return x;
	else       return gcd(y, x % y);
}

int main(void){
	int k; //a,b,c [MAX]
	cin >> k;

	int sum = 0; //合計

	int num;
	for(int a = 1; a <= k; a++){
		for(int b = 1; b <= k; b++){
			num  = gcd(a,b);
			for(int c = 1; c <= k; c++){
				sum += gcd(num,c);
			}
		}
	}

	cout << sum;
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include<map>
#include<math.h>

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    int a, b, c;
    cin >> a >> b >> c;
    a -= b;

    c = max(0, c-a);
    cout << c << endl;
    return 0;
} /*atcoder*/



Measured memory_bytes: 3612
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
const long long mod=1e9+7;
int n , k;
vector<ll>v;
ll dp[55][55][105];

ll f(int i , int j , int k){
    if(i>j)return 0;
    if(k==0)return 0;
    if(dp[i][j][k]!=-1)return dp[i][j][k];
    ll value = 0;
    if(k>=1){
        value = max(value , f(i+1 , j , k-1)+v[i]);
        value = max(value , f(i , j-1 , k-1)+v[j]);
    }
    if(k>=2){
        value = max(value , f(i+1 , j , k-2));
        value = max(value , f(i , j-1 , k-2));
    }
    return dp[i][j][k] = value;
}
int main(void)
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);

    cin >> n >> k;
    for(int i=0;i<n;i++){
        ll in;
        cin >> in;
        v.push_back(in);
    }
    memset(dp , -1 , sizeof(dp));
    cout << f(0 , n-1 , k) << endl;
    return 0;
}


Measured memory_bytes: 2688
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class D
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		long mod = (long)(1e9 + 7);
		long X = GetLong();
		long Y = GetLong();

		if((X + Y) % 3 != 0 || (2 * X - Y) % 3 != 0 || (2 * Y - X) % 3 != 0)
		{
			WriteLine(0);
			return;
		}

		long a = (2 * Y - X) / 3;
		long b = (2 * X - Y) / 3;
		if(a < 0 || b < 0)
		{
			Console.WriteLine(0);
			return;
		}
		var mct = new ModCombTable(2 * (int)1e6 + 1, mod);
		WriteLine(mct.ModComb(a + b, a));
	}
}

public class ModCombTable
{
	private long[] f = null;
	private long[] fInv = null;
	private long mod;

	public ModCombTable(int N, long m)
	{
		mod = m;

		// calc factorial
		f = new long[N+1];
		f[0] = 1;
		for(int i = 1; i <= N; i++)
			f[i] = (f[i-1] * i) % mod;

		// calc factorial inverse
		fInv = new long[N+1];
		fInv[N] = ModInv(f[N]);
		for(int i = N; i > 0; i--)
			fInv[i-1] = (fInv[i] * i) % mod;
	}

	public long ModComb(long n, long k)
	{
		if(n < 0 || n < k)
			return 0;
		
		return (((f[n] * fInv[k]) % mod) * fInv[n-k]) % mod;
	}

	public long ModInv(long x)
	{
		return ModPow(x, mod - 2);
	}

	public long ModPow(long x, long n)
	{
		long res = 1;
		while(n > 0)
		{
			if((n & 1) == 1)
				res = (res * x) % mod;
			x = (x * x) % mod;
			n >>= 1;
		}
		return res;
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

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

int main(){
    bool st[31];
    for( int i=1; i<=30; i++ ){
        st[i] = false;
    }
    for( int i=0; i<28; i++ ){
        int n;
        cin >> n;
        st[n] = true;
    }
    for ( int i=1; i<=30; i++ ){
        if( !st[i] )
            cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 1156
import java.io.*

val pw = PrintWriter(System.out)
const val MOD = 1000000007L
const val INF = 2147483647
const val LINF = 9223372036854775807L

fun main(args: Array<String>) {
    solve()
    pw.flush()
}

fun solve() {
    val n = nextInt()
    val map: MutableMap<Int, Int> = mutableMapOf()
    val list = nextIntList()
    for (a in list) {
        if (map.containsKey(a)) {
            map[a] = map[a]!! + 1
        } else {
            map[a] = 1
        }
    }

    var ans = 0
    for ((key, value) in map) {
        if (value < key) {
            ans += value
        } else if (value > key) {
            ans += value - key
        }
    }

    println(ans)

}


fun println(v: String) {
    pw.println(v)
}

fun print(v: String) {
    pw.print(v)
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ").toMutableList()
fun nextIntList(index: Int = 0) = next().split(" ").map { it.toInt() + index }.toMutableList()
fun nextLongList(index: Long = 0L) = next().split(" ").map { it.toLong() + index }.toMutableList()
fun nextDoubleList() = next().split(" ").map { it.toDouble() }.toMutableList()

fun ary(n: Int, init: String = "") = Array(n) { init }
fun intAry(n: Int, init: Int = 0) = IntArray(n) { init }
fun longAry(n: Int, init: Long = 0L) = LongArray(n) { init }
fun doubleAry(n: Int, init: Double = 0.0) = DoubleArray(n) { init }
fun ary2(n: Int, m: Int, init: String = "") = Array(n) { Array(m) { init } }
fun intAry2(n: Int, m: Int, init: Int = 0) = Array(n) { IntArray(m) { init } }
fun longAry2(n: Int, m: Int, init: Long = 0) = Array(n) { LongArray(m) { init } }
fun doubleAry2(n: Int, m: Int, init: Double = 0.0) = Array(n) { DoubleArray(m) { init } }
fun ary3(n: Int, m: Int, k: Int, init: String = "") = Array(n) { Array(m) { Array(k) { init } } }
fun intAry3(n: Int, m: Int, k: Int, init: Int = 0) = Array(n) { Array(m) { IntArray(k) { init } } }
fun longAry3(n: Int, m: Int, k: Int, init: Long = 0L) = Array(n) { Array(m) { LongArray(k) { init } } }
fun doubleAry3(n: Int, m: Int, k: Int, init: Double = 0.0) = Array(n) { Array(m) { DoubleArray(k) { init } } }

fun abs(n: Int): Int = Math.abs(n)
fun abs(n: Long): Long = Math.abs(n)
fun abs(n: Double): Double = Math.abs(n)
fun max(a: Int = -INF, b: Int = -INF, c: Int = -INF, d: Int = -INF, e: Int = -INF): Int = listOf(a, b, c, d, e).max()!!
fun max(a: Long = -LINF, b: Long = -LINF, c: Long = -LINF, d: Long = -LINF, e: Long = -LINF): Long =
    listOf(a, b, c, d, e).max()!!.toLong()

fun min(a: Int = INF, b: Int = INF, c: Int = INF, d: Int = INF, e: Int = INF): Int = listOf(a, b, c, d, e).min()!!
fun min(a: Long = LINF, b: Long = LINF, c: Long = LINF, d: Long = LINF, e: Long = LINF): Long =
    listOf(a, b, c, d, e).min()!!.toLong()


Measured memory_bytes: 59564
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

int n, a, b;
vector<int> p;
vector<bool> used;
bool f() {
	vector<bool> u = used;
	int aa = -1;
	for (int i = 0; i < n; i++) {
		if (u[i]) {
			continue;
		}

		if (p[i] <= a) {
			aa = i;
			u[aa] = true;
			break;
		}
	}

	int bb = -1;
	for (int i = 0; i < n; i++) {
		if (u[i]) {
			continue;
		}

		if (a < p[i] && p[i] <= b) {
			bb = i;
			u[bb] = true;
			break;
		}
	}

	int cc = -1;
	for (int i = 0; i < n; i++) {
		if (u[i]) {
			continue;
		}

		if (b < p[i]) {
			cc = i;
			u[cc] = true;
			break;
		}
	}

	if (aa == -1 || bb == -1 || cc == -1) {
		return false;
	}

	used = u;
	return true;
}

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

	cin >> n >> a >> b;

	p.resize(n);
	used.resize(n);

	for (auto &v : p) {
		cin >> v;
	}
	sort(begin(p), end(p));

	int ans = 0;
	while (f()) {
		ans++;
	}

	cout << ans << endl;
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;
const int MOD = 1e9 + 7;

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

	int n; cin >> n;
	vector<ll> t(n), a(n);
	for (int i = 0; i < n; i++) cin >> t[i];
	for (int i = 0; i < n; i++) cin >> a[i];
	if (n == 1 && t[0] != a[0]) {
		cout << 0 << endl;
		return 0;
	}
	vector<P> v(n, P(INF,0)); // max min;
	v[0] = P(t[0], t[0]);
	v[n - 1] = P(a[n - 1], a[n - 1]);
	bool flag = false;
	for (int i = 1; i < n; i++) {
		if (t[i] != t[i - 1]) {
			if (t[i] > v[i].first || v[i].second > t[i]) {
				flag = true;
				break;
			}
			else {
				v[i] = P(t[i], t[i]);
			}
		}
		else {
			ll ma = min(v[i].first, t[i]);
			ll mi = max(v[i].second, (ll)1);
			v[i] = P(ma, mi);
		}
	}
	if (flag) {
		cout << 0 << endl;
		return 0;
	}
	for (int i = n - 2; i >= 0; i--) {
		if (a[i] != a[i + 1]) {
			if (a[i] > v[i].first || v[i].second > a[i]) {
				flag = true;
				break;
			}
			else {
				v[i] = P(a[i], a[i]);
			}
		}
		else {
			ll ma = min(v[i].first, a[i]);
			ll mi = max(v[i].second, (ll)1);
			v[i] = P(ma, mi);
		}
	}
	if (flag) {
		cout << 0 << endl;
		return 0;
	}
	ll res = 1;
	for (int i = 0; i < n; i++) {
		if (v[i].first < v[i].second) {
			cout << 0 << endl;
			return 0;
		}
		res = res*(v[i].first - v[i].second + 1);
		res %= MOD;
	}
	cout << res << endl;
}


Measured memory_bytes: 3456
import numpy as np
s=input().split()
l=[int(s[i]) for i in range(4)]
v1=np.array([l[0],l[1]])
v2=np.array([l[2],l[3]])
v=v2-v1
A=np.array([[0,-1],[1,0]])
v3=v2+np.dot(A,v)
v=v3-v2
v4=v3+np.dot(A,v)
print(v3[0],v3[1],v4[0],v4[1])

Measured memory_bytes: 12448
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long MOD = 1e9 + 7;
const long long INF = 1LL << 60;
using namespace std;

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

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

int main()
{
  int n, r;
  cin >> n >> r;
  if(n>= 10){
    cout << r << endl;
  }else {
    cout << r + 100 * (10 - n) << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n;
  cin >> n;
  cout << n*800-n/15*200 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double dd;
const int N = 1e5+5;
const dd eps = 1e-8;
const int mod = 1e9+7;

ll ans,n,l,r;

int main(){
  // freopen("input.txt","r",stdin);
  cin>>n;
  for(int i = 1;i <= n;i++){
    ans += i*(n-i+1);
  }
  for(int i = 1;i < n;i++){
    cin>>l>>r;
    if(l > r) swap(l,r);
    ans -= l*(n-r+1);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3572
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
int main(void){
  int n,m,i,a,t;
  long ans=0;
  priority_queue<int> pque;
  cin >> n >> m;
  for (i=0;i<n;i++){
    cin >> a;
    pque.push(a);
  }
  for (i=0;i<m;i++){
    t=pque.top();
    pque.pop();
    t/=2;
    pque.push(t);
  }
  for (i=0;i<n;i++){
    t=pque.top();
    pque.pop();
    ans+=t;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 892
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<cmath>
#include<ctime>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<bitset>
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
char c[1000000];
int num[100];
int main()
{	scanf("%s",c+1);
	int n=strlen(c+1),tag=1,le=0,ri;
	for(rint i=1;i<=n;i++) num[c[i]-'a']++;
	sort(num,num+26,greater<int>());
	for(rint i=25;;i--) if(num[i]){ri=i;break;}
	while(le<ri-1)
	{	if(num[le]-1>num[ri])
		{	num[le]-=num[ri];
			num[ri-1]-=num[ri];
			ri--;
		}
		else
		{	num[ri]-=num[le]-1;
			num[ri-1]-=num[le]-1;
			num[le]=0;
			le++;
		}
	}
	for(rint i=0;i<26;i++) if(num[i]!=0&&num[i]!=1) tag=0;
	if(!tag) cout<<"NO\n";
	else cout<<"YES\n";
 	return 0;
}


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

#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ms(a, b) memset((a), (b), sizeof(a))
#define len(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define lb lower_bound
#define ub upper_bound
#define fore(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define fort(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define ford(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#define bug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <class T> void __f(const char* name, T&& a) {
    cerr << name << ": " << a << '\n';
}
template <class T, class... Ts> void __f(const char* names, T&& a, Ts&&... b) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << a << " /";
    __f(comma + 1, b...);
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <class T> bool mini(T& a, const T& b) { return a > b ? (a = b, 1) : 0; }
template <class T> bool maxi(T& a, const T& b) { return a < b ? (a = b, 1) : 0; }

typedef long long ll;
typedef double db;
typedef pair<int, int> pi;
typedef pair<int, pi> ti;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ti> vti;
typedef vector<vpi> vvpi;

const int inf = (int)0x3f3f3f3f3f3f3f3f;
const int ninf = (int)0xc0c0c0c0c0c0c0c0;
const int M = (int)1e9 + 7;

main() {
#ifndef ONLINE_JUDGE
    freopen("CP.inp", "r", stdin);
//    freopen("CP.out", "w", stdout);
#endif // ONLINE_JUDGE
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    vi a(n); for (int& x : a) cin >> x;
    sort(rall(a));
    int ans = a[0];
    fore(i, 2, n) ans += a[i / 2];
    cout << ans << '\n';
}


Measured memory_bytes: 4756
#include<iostream>
#include<queue>
#include<algorithm>
using namespace std;

typedef pair<int,int> P;

const int inf=10000;
const int maxh=1010;
const int maxw=1010;
const int maxn=9;

int h,w,n;
int d[maxh][maxw];
char m[maxh][maxw];

int bx,by;
int dx[]={0,0,-1,1}; 
int dy[]={1,-1,0,0};

int bfs(char c){
	for(int i=0;i<h;i++){
		fill(d[i],d[i]+w,inf);
	}
	d[bx][by]=0;
	queue<P> que;
	que.push(P(bx,by));
	while(!que.empty()){
		P p=que.front();
		que.pop();
		if(m[p.first][p.second]==c){
			bx=p.first,by=p.second;
			break;
		}
		for(int i=0;i<4;i++){
			int nx=p.first+dx[i];
			int ny=p.second+dy[i];
			if(0<=nx && nx<h && 0<=ny && ny<w && m[nx][ny]!='X' && d[nx][ny]==inf){
				que.push(P(nx,ny));
				d[nx][ny]=d[p.first][p.second]+1;
			}
		}
	}
	return d[bx][by];
}

void solve(){
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(m[i][j]=='S'){
				bx=i,by=j;
				break;
			}
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		ans+=bfs('0'+i);
	}
	cout<<ans<<endl;
}

int main(){
	while(cin>>h>>w>>n){
		for(int i=0;i<h;i++){
			cin>>m[i];
		}
		solve();
	}
	return 0;
}



Measured memory_bytes: 7968
fun main() {
    val x = readLine()!!.toDouble()
    var a = 1.0
    var b = 0.0

    while (true) {
        val comp = Math.pow(b, 5.0) + x
        val compa = Math.pow(a, 5.0)
        if (comp == compa) {
            println("${a.toInt().toString()} ${b.toInt().toString()}")
            return
        } else if (comp < compa) {
            a++
            b = a - 1
        } else {
            b--
        }
    }

}



Measured memory_bytes: 34604
#define _USE_MATH_DEFINES

#include <vector>
#include <list>
#include <map>
#include <string>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <utility>
#include <ctgmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

const ll inf = 10e17;
const ll mod = inf;//1000000007;
const ld eps = 10e-9;



ll solve(void);
ll gcd(ll x, ll y);


ll mulmod(ll x, ll y)
{
	return (x * y) % mod;
}

ll submod(ll x, ll y)
{
	return (x - y + 100 * mod) % mod;
}

ll power(ll n, ll r)
{
	if ( r == 0 ) { return 1; }
	if ( r == 1 ) { return n; }
	if ( n == 0 ) { return 0; }
	if ( n == 1 ) { return 1; }

	if (r % 2 == 0)
	{
		ll y = power(n, r/2);
		return mulmod(y, y);
	}
	else
	{
		ll y = power(n, (r-1)/2);
		return n * mulmod(y, y) % mod;
	}
}

ll gcd(ll x, ll y)
{
	if (y == 1) { return 1;}
	if (x % y == 0) { return y; }
	return gcd(y, x % y);
}

vector<ll> perm;
vector<ll> inv;
void init_inv(ll m)
{
	perm.resize(m);
	inv.resize(m);
	
	perm[0] = 1;
	inv[0] = 1;

	for (ll i = 1; i < m; i++)
	{
		perm[i] = mulmod(perm[i-1], i);
	}
	
	for (ll i = 1; i < m; i++)
	{
		inv[i] = power(perm[i], mod - 2);
	}
}

ll ncr(ll n, ll r)
{
	// n (n-1) ... (n-r)
	if ( r == n || r == 0 ) { return 1; }

	ll ans = 1;
	for (ll i = 0; i < r; i++)
		ans = mulmod(ans, n - i);

	 return mulmod(ans, inv[r]);
	// return mulmod(perm[n], mulmod(inv[n-r], inv[r]));
}

bool binary_check(ll mid, ll key)
{
	return mid >= key;
}

ll binary_search()
{
//	ll ng = 0;
//	ll ok = x;
//
//	while (abs(ok - ng) > 1)
//	{
	//	ll mid = (ok+ng) / 2;
	//	if (binary_check(mid, k)) ok = mid;
	//	else ng = mid;
	//}

	return 0;
	//return ok;
}

void pushorcreate(map<ll, vector<ll>> &m, ll key, ll i)
{
	if (m.find(key) == m.end())
	{
		m[key] = vector<ll>(1, i);
	}
	else {
		m[key].push_back(i);
	}
}

ll solve(void)
{
	// abs(i - j) = A[i] + A[j]
	// j - i = A[i] + A[j]
	// A[i] + i, A[j] - j

	ll n;
	cin >> n;
	vector<ll> a(n);
	map<ll, vector<ll>> r, l;
	for (auto& ai :a)
		cin >> ai;

	for (ll i = 0; i < n; i++)
	{
		pushorcreate(r, a[i] + i, i);
		pushorcreate(l, -a[i] + i, i);
	}

	// A[i] >= N: 考慮しなくていい
	
	ll count = 0;
	for (auto ri : r)
	{
		for (auto i : l[ri.first])
		{
			for (auto j : ri.second)
			{
				count ++;
//				cout << i << " " << j << endl;
			}
		}
	}

	cout << count << endl;

	return 0;
}

int main(void)
{
	while (solve())
	{
	}
	return 0;
}


Measured memory_bytes: 59068
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    ll ans;
    ans=(n*(n+1))/2;
    for(int i=1;i<=n;i++)
    {
        if(i%3==0&&i%5==0)
        {
            ans=ans-i;
        }
        else if(i%3==0||i%5==0)
        {
            ans=ans-i;
        }
    }
    cout<<ans<<endl;
    return 0;

}


Measured memory_bytes: 3648
#include <stdio.h>

int main() {
  int n, count = 0;
  char a[100], b[100], c[100];
  scanf("%d\n%s\n%s\n%s\n", &n, a, b, c);
  
  for(int i=0; i<n; i++) {
    if(a[i] == b[i]) {
      if(a[i] == c[i]);
      else count++;
    }else{
      if(a[i] == c[i]) count++;
      else if(b[i] == c[i]) count++;
      else count += 2;
    }
  }
  
  printf("%d\n", count);
  return 0;
}

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

// 
public class Main {
	public static void main(String[] args) {
		FastReader r = new FastReader();
		int[] arr = r.ria();
		if(arr[0] + arr[1] >=  arr[2]) print("Yes");
		else print("No");
	}

	public static void rolling(int[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}

	public static void reverse(int[] arr) {
		for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		}
	}

	public static void print(String s) {
		System.out.println(s);
	}

	public static void print(long s) {
		System.out.println(s);
	}

	public static void print(int s) {
		System.out.println(s);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		int ri() {
			return Integer.parseInt(string());
		}

		long rl() {
			return Long.parseLong(string());
		}

		double rd() {
			return Double.parseDouble(string());
		}

		String string() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		String[] rsa() {
			return string().split(" ");
		}

		int[] ria() {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		}

		long[] rla() {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		}

		char[] rca() {
			String s = string();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		}

		int[] riaml(int m) {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(string());
			return arr;
		}

		long[] rlaml(int m) {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(string());
			return arr;
		}
	}
}


Measured memory_bytes: 23252
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int x, y;
	int t;

	for (;;) {
		scanf("%d", &x);
		scanf("%d", &y);
		if (x == 0 && y == 0) break;
		if (x > y) t = x, x = y, y = t;
		printf("%d %d\n", x, y);
	}
	return 0;
}



Measured memory_bytes: 1988
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<ll>>;
using P = pair<int,int>;
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; }
#define MOD 1000000007
#define INF 1000000
#define PI 3.14159265358979323846264338327950L
#define MAX_N 200010
#define lb lower_bound 

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

  string s="";
  int count=0;
  while (N>0)
  {
    N--;
    ll r = N%26;
    s += 'a'+r;
    if (N<26) break;
    N /=26;
  }

  reverse(s.begin(),s.end());
  cout<<s<<endl;
}

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

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

    vector<int> p(N);
    for(int i = 0; i < N; i++)
    {
        cin >> p[i];
    }

    vector<int> ans(N);
    for(int i = 0; i < N; i++)
    {
        ans[i] = i + 1;
    }

    if(ans == p)
    {
        cout << "YES" << endl;
    }

    else
    {
        int l = -1, r = -1;
        for(int i = 0; i < N - 1; i++)
        {
            if(p[i] > p[i + 1])
            {
                l = i;
                break;
            }
        }

        for(int i = 0; i < N - 1; i++)
        {
            if(l != i && p[i] > p[i + 1])
            {
                r = i + 1;
                break;
            }
        }

        if(l == r || r == -1 || l == -1)
        {
            cout << "NO" << endl;
        }

        else
        {
            int tmp = p[l];
            p[l] = p[r];
            p[r] = tmp;

            if(ans == p)
            {
                cout << "YES" << endl;
            }

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

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;


int main()
{
    lint A;
    cin >> A;
    lint B;
    cin >> B;
    lint C;
    cin >> C;

    cout << min(B / A, C) << endl;
    return 0;
}


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

int main(void) {
    int A,B,C;
    
    cin >> A >> B >> C;
    if(A == B) {
        cout << C << "\n";
    } else {
        if(B == C) {
            cout << A << "\n";
        } else {
            cout << B << "\n";
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map> // pair

using namespace std;
typedef long long ll;

#define all(x) (x).begin(),(x).end()
#define FOR(x) for(ll i = 0;i < x;++i)

int main() {
	int N;
  cin>>N;
	int C[100],V[100];
	FOR(N)
     cin>>C[i];
    FOR(N)
      cin>>V[i];
	int ans = 0;
  int tmp;
  for(int i = 0;i < N;i++){
    tmp = C[i]-V[i];
    if(tmp > 0)
      ans += tmp;
  }
    
cout<<ans;
	return 0;
}




//vector,pairでのソート
//http://dai1741.github.io/maximum-algo-2012/docs/cpp-sort/

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cassert>

using namespace std;

const int N = 2e5 + 7;
const int LOG = 25;

int n;
vector<int> adj[N];
int ans;

int dfs(int u, int from) {
	int all = 0, least = 0;
	for (int v : adj[u]) {
		if (v == from) continue;
		int mask = dfs(v, u);
		for (int j = 0; j < LOG; j++) {
			if ((all >> j & 1) && (mask >> j & 1)) {
				least = max(least, j + 1);
			}
		}
		all |= mask;
	}
	assert(least + 1 < LOG);
	for (int i = least; ; i++) {
		if (~all >> i & 1) {
			ans = max(ans, i);
			all ^= (1 << i);
			for (int j = i - 1; j >= 0; j--) {
				if (all >> j & 1) {
					all ^= (1 << j);
				}
			}
			return all;
		}
	}
}

int solve() {
	ans = 0;
	dfs(rand() % n + 1, 0);
	return ans;
}

int main() {
	scanf("%d", &n);
	//n = 1e5;
	for (int i = 1; i < n; i++) {
		int u, v;
		scanf("%d %d", &u, &v);
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	int ret = n;
	for (int r = 1; r <= 1; r++) {
		ret = min(ret, solve());
	}
	printf("%d\n", ret);
}


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

void solve(long long x)
{

    cout << (x == 0 ? 1 : 0) << endl;
}

signed main()
{
    long long x;
    scanf("%lld", &x);
    solve(x);
    return 0;
}


Measured memory_bytes: 3796
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}
pii Dir [] = {
	{ 1,0 },{ 0,1 }
};



signed main() {
	char str [1000000];
	scnaf("%s", str);
	string s;
	REP(i, strlen(str)) {
		if (str[i] == 'B') {
			if(!s.empty())
				s.erase(--s.end());
		}
		else
			s += str[i];
	}
	printf("%s\n", s.c_str());
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,p[222222];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>p[i];
  }
  int cn1[222222]={};
  int cn2[222222]={};
  int ma=0;
  for(int i=0;i<n;i++){
    cn1[p[i]]=cn1[p[i]-1]+1;
    ma=max(ma,cn1[p[i]]);
  }
  cout<<n-ma<<endl;
  return 0;
}


Measured memory_bytes: 1920
#include <cstdio>

int main()
{
    int a;
    scanf("%d", &a);
    int num = 0;
    if (a % 10 == 1)
    {
        num = num + 1;
    }
    
    if ((a / 10) % 10 == 1)
    {
        num = num + 1;
    }
    
    if (a / 100 == 1)
    {
        num = num + 1;
    }
    printf("%d", num);
    
}

Measured memory_bytes: 1708
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a=[int(input()) for _ in [0]*5]
c=10
for i in range(5):
	if int(str(a[i])[-1])==0:
		continue
	c=min(int(str(a[i])[-1]),c)
	
for i in range(5):
	a[i]=(-(-(a[i])//10))*10

if c==0:
	print(sum(a))
else:
	print(sum(a)-(10-c))

Measured memory_bytes: 3064