akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

using namespace std;

bool isKaibun(string s){
    for(int i=0;i<s.length()/2;i++){
        if(s[i] != s[s.length()-1-i]) return false;
    }
    return true;
}

int main(){

    string str; cin>>str;
    int n = str.length();
    bool f1 = false, f2 = false, f3 = false;
    if(isKaibun(str)) f1 = true;
    if(isKaibun(str.substr(0, (n-1)/2))) f2 = true;
    if(isKaibun(str.substr((((n+3)/2)-1), n))) f3 = true;
    
    if(f1 && f2 && f3){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
def resolve():
    (N, L) = list(map(int, input().split(" ")))
    Ts = []
    offset = L - 1
    absmin = float('inf')
    mini = float('inf')
    for i in range(1, N+1):
        Ts.append(i+offset)
        if abs(i + offset) < absmin:
            absmin = abs(i + offset)
            mini = i + offset
    print(sum(Ts)-mini)
        
    
if '__main__' == __name__:
    resolve()

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

using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;

int l, r;
//3 673
//1 2019


int main() {
    ios::sync_with_stdio(0);
    cin >> l >> r;
    int l1 = max(r - 2019, l);
    ll ans = 5e18;
    for (int i = l1; i < r; ++i) {
        for (int j = i + 1; j <= r; ++j) {
            ans = min(ans, 1LL * i % 2019 * j % 2019);
        }
    }
    cout << ans;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
int h[25];

int main(){
  cin>>n;
  REP(i,n)cin>>h[i];
  int ans = 0;
  REP(i,n){
    bool ok = true;
    REP(j,i)ok = ok && h[j]<=h[i];
    if(ok)ans++;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
const ll MOD = (1e+9)+7;
typedef pair<ll, ll> LP;
ll POW(ll m,ll n)
{
  if(n<0) return 0;
  if(n==0) return 1;
  return m*POW(m,n-1);
}
 
int main()
{
  int a;
  cin >> a;
  if(a%4==0){

    printf("Yes");
  }
  if(a%4==1){
    if(a<19)printf("No");
    else printf("Yes");
  }
  if(a%4==2){
    if(a<12)printf("No");
    else printf("Yes");
  }
  if(a%4==3){
    if(a<5)printf("No");
    else printf("Yes");
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdint>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <climits>
#include <numeric>
#include <algorithm>
#include <cassert>

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

using namespace std;

template<class T, class U>
istream& operator>>(istream& is, pair<T, U>& pair)
{
    is >> pair.first >> pair.second;
    return is;
}

template<class T>
istream& operator>>(istream& is, T& collection)
{
    for(auto& item : collection) is >> item;
    return is;
}

struct tower_t {
    int height = 0;
    unordered_set<int> next;
};

void solution()
{
    int64_t x;
    cin >> x;
    for(int64_t a = -1000; a <= 1000; ++a){
        for(int64_t b = -1000; b <= 1000; ++b){
            if(a*a*a*a*a - b*b*b*b*b == x){
                cout << a << ' ' << b << '\n';
                return;
            }
        }
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solution();
    return 0;
}


Measured memory_bytes: 3648
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cctype>
#include <cmath>
using namespace std;
#define I inline
#define R register
#define inf 1073742823
#define FOR(i,begin,end) for(R int i=begin;i<=end;++i)
#define ROF(i,begin,end) for(R int i=begin;i>=end;--i)
signed main(){
    int n;
    cin>>n;
    int z;
    int flag=1;
    FOR(i,1,n){
        cin>>z;
        if((z&1)==0){
            if(z%3==0||z%5==0)continue;
            else flag=0;
        }
    }
    if(flag)cout<<"APPROVED";
    else cout<<"DENIED";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 1000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;



int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	ll a,b,k;
	cin >> a >> b >> k;
	if(a>= k){
		cout << a-k << " " << b << endl;
	}else if(a+b>=k){
		cout << 0 << " " << b-(k-a) << endl;
	}else{
		cout << 0 <<" "<< 0 << endl;
	}
	return 0;
} 






Measured memory_bytes: 3588
import java.util.Arrays;

public class Main {

  private static void solve() {
    int n = ni();
    long[][] p = new long[n][2];
    for (int i = 0; i < n; i++) {
      p[i][0] = ni();
      p[i][1] = ni();
    }

    Arrays.sort(p, (o1, o2) -> Double.compare(Math.atan2(o1[1], o1[0]), Math.atan2(o2[1], o2[0])));

    long ret = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        long xs = 0;
        long ys = 0;
        for (int k = i; k <= i + j; k++) {
          xs += p[k % n][0];
          ys += p[k % n][1];

        }
        ret = Math.max(ret, xs * xs + ys * ys);
      }
    }

    System.out.println(Math.sqrt(ret));
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



Measured memory_bytes: 29524
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
#include <cmath>
#include <cstdio>
#include <complex>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

int main() {
	ll n, a, mi = 1e10, ma = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		mi = min(mi, a);
		ma = max(ma, a);
	}
	cout << ma - mi << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int N,K,i;
  char S[10];

  scanf("%d",&N);
  scanf("%s",&S);
  scanf("%d",&K);

  for(i=0;i<N;i++)
  {
    if(S[i]!=S[K-1])
      S[i]='*';
  }

  printf("%s",S);

  return 0;
}


Measured memory_bytes: 128
class StringDSL
  attr_reader :str
  def initialize(str)
    @str = str
  end

  def print(a, b)
    puts str[a..b]
  end

  def replace(a, b, rstr)
    str[a..b] = rstr
  end

  def reverse(a, b)
    str[a..b] = str[a..b].reverse
  end
end

$stdin = DATA if $stdin.eof?

sd = StringDSL.new(gets.chomp)

gets

ARGF.each do |line|
  op, a, b, c = line.chomp.split
  a, b = [a, b].map(&:to_i)

  if c
    sd.instance_eval("#{op}(#{a},#{b},'#{c}')")
  else
    sd.instance_eval("#{op}(#{a},#{b})")
  end
end

Measured memory_bytes: 6252
#include <stdio.h>
#include <stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)

//block linked list
#define Bsize 700 /*2sqrt(n)*/
typedef struct block{
	int cnt;
	ll a[Bsize+1];
	struct block*pre;
	struct block*nxt;
}block;
void Bpush(block*b,ll x){
	//リストにxを追加する
	if((*b).nxt&&(*(*b).nxt).a[0]<x){
		//次へ
		Bpush((*b).nxt,x);
		return;
	}
	int i=(*b).cnt;
	for(;i>0&&(*b).a[i-1]>x;i--)(*b).a[i]=(*b).a[i-1];
	(*b).a[i]=x;
	(*b).cnt++;
	if((*b).cnt>=Bsize){
		//分割
		block*nn=(block*)malloc(sizeof(block));
		(*nn).cnt=Bsize-Bsize/2;
		rep(i,0,Bsize-Bsize/2)(*nn).a[i]=(*b).a[i+Bsize/2];
		(*nn).pre=b;
		(*nn).nxt=(*b).nxt;
		if((*b).nxt)(*(*b).nxt).pre=nn;
		(*b).cnt=Bsize/2;
		(*b).nxt=nn;
	}
}
void con(block*p,block*q){
	//qをpにマージしてqを消す
	rep(i,0,(*q).cnt)(*p).a[(*p).cnt+i]=(*q).a[i];
	(*p).cnt+=(*q).cnt;
	(*p).nxt=(*q).nxt;
	if((*q).nxt)(*(*q).nxt).pre=p;
	free(q);
}
void Bdel(block*b,int idx){
	//idx番目を削除する(必ずidx個以上ある)
	for(;idx<(*b).cnt-1;idx++)(*b).a[idx]=(*b).a[idx+1];
	(*b).cnt--;
	
	if((*b).cnt==0&&(*b).pre){
		(*(*b).pre).nxt=(*b).nxt;
		if((*b).nxt)(*(*b).nxt).pre=(*b).pre;
		free(b);
	}else if((*b).pre&&(*(*b).pre).cnt+(*b).cnt<Bsize/4)con((*b).pre,b);
	else if((*b).nxt&&(*(*b).nxt).cnt+(*b).cnt<Bsize/4)con(b,(*b).nxt);
}

ll Bans(block*b,int k,int flag){
	//リストのk番目を返す
	//リストにk個未満しかなければ適当に返す
	//flagがtrueなら削除する
	if((*b).cnt<=k){
		if((*b).nxt)return Bans((*b).nxt,k-(*b).cnt,flag);
		else return -1;//<-例外
	}
	ll ans=(*b).a[k];
	if(flag)Bdel(b,k);
	return ans;
}
int Bfind(block*b,ll k,int flag){
	//リストにkが存在すれか答える
	//flagがtrueなら削除する
	if((*b).cnt==0||(*b).a[(*b).cnt-1]<k){
		if((*b).nxt)return Bfind((*b).nxt,k,flag);
		else return 0;
	}
	int i=0;
	for(;(*b).a[i]<k;i++);
	if((*b).a[i]!=k)return 0;
	if(flag)Bdel(b,i);
	return 1;
}
#undef Bsize


block*b;
int main(){
	b=calloc(1,sizeof(block));
	int q;
	scanf("%d",&q);
	int cnt=0;
	while(q--){
		int t,x;
		scanf("%d%d",&t,&x);
		if(t==0){
			if(!Bfind(b,x,0)){
				Bpush(b,x);
				cnt++;
			}
			printf("%d\n",cnt);
		}
		else printf("%d\n",Bfind(b,x,0));
	}
}



Measured memory_bytes: 4896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    ll n,m;cin>>n>>m;
    vector<int> v(n+1,0);
    rep(i,m){
        ll a,b;cin>>a>>b;
        if(a==1)v[b]++;
        if(b==n)v[a]++;
    }

    rep(i,n){
        if(v[i]>=2){
            cout<<"POSSIBLE"<<endl;
            return 0;
        }
    }
    cout<<"IMPOSSIBLE"<<endl;
}





Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#define MaxSize 100000

using namespace std;

typedef struct Task{
    char name[100];
    int time;
};

Task tasks[MaxSize];

int head,tail;

void enqueue(Task task)
{
    tasks[tail]=task;
    tail = (tail+1)%MaxSize;
}

Task dequeue()
{
    Task temp = tasks[head];
    head = (head+1)%MaxSize;
    return temp;
}



int main()
{
    int sum=0;
    int quantum,n;
    scanf("%d %d",&n,&quantum);

    for(int i=0;i<n;i++)
    {
        scanf("%s",tasks[i].name);
        scanf("%d",&tasks[i].time);
    }
    head = 0;
    tail = n;
    while(head!=tail)
    {
        Task t = dequeue();

        int c = min(t.time,quantum);
        sum+=c;
        t.time -= c;
        if(t.time<=0)
            printf("%s %d\n",t.name,sum);
        else
            enqueue(t);


        // not good
        /*
        int dif = t.time - quantum;
        if(dif<=0)
        {
            sum+=t.time;
            printf("%s %d\n",t.name,sum);
        }
        else
        {
            sum+=quantum;
            t.time = dif;
            enqueue(t);
        }
        */
    }


    return 0;
}



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

int main() {
	int A, B; cin >> A >> B;
	if(A==B) cout << "Draw" << endl;
	else{
	    if(A<B){
	        if(A==1) cout << "Alice" << endl;
	        else cout << "Bob" << endl;
	    }
	    else{
	        if(B==1) cout << "Bob" << endl;
	        else cout << "Alice" << endl;
	    }
	}
	return 0;
}


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

using namespace std;

vector<string> split(const string &s, char delim) {
  vector<string> elems;
  string item;
  for (char ch: s) {
    if (ch == delim) {
      if (!item.empty()) {
        elems.push_back(item);
      }
      item.clear();
    }
    else {
      item += ch;
    }
  }
  if (!item.empty()) {
    elems.push_back(item);
  }
  return elems;
}

string to_str_with_zero(int i, int w) {
  ostringstream sout;
  sout << std::setfill('0') << std::setw(w) << i;
  string s = sout.str();
  return s;
}

int letter_to_int(char c) {
  return tolower(c) - 'a';
}

int compare_array(vector<int> a1, vector<int>a2) {
  if (a1.size() != a2.size()) {
    return a1.size() - a2.size();
  }
  for (int i=0; i<a1.size(); i++) {
    if (a1.at(i) != a2.at(i)) {
      return a1.at(i) - a2.at(i);
    }
  }
  return 0;
}

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

char int_to_char(int a) {
  if (a == -1) {
    return 'z';
  }
  else {
    return 'a' + a;
  }
}

long nCr(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

int divide_count(int a, int divider) {
  int r = 0;
  while(a % divider == 0) {
    a /= divider;
    r++;
  }
  return r;
}

bool is_prime(int a) {
  int i = 2;
  while(i * i <= a) {
    if(a % i == 0) {
      return false;
    }
    i++;
  }
  return true;
}

vector<vector<int>> all_comb(int n, int k) {
  vector<vector<int>> combs(nCr(n, k), vector<int>(k));
  for(int i=0; i<k; i++) {
    combs[0][i] = i;
    combs[1][i] = i;
  }
  
  for(long i=1; i<nCr(n, k); i++) {
    int p = 1;
    while(combs[i][k - p] == n - p) {
      p++;
      if(p > k) {
        break;
      }
    }
    combs[i][k - p]++;
    int q = combs[i][k - p];
    for(int j=1; j<p; j++) {
      combs[i][k - p + j] = q + j;
    }

    if(i < nCr(n, k) - 1) {
      for(int j=0; j<k; j++) {
        combs[i + 1][j] = combs[i][j];
      }
    }
  }

  return combs;
}

int main() {
  std::cout << std::setprecision(9);
  long n, d;
  cin >> n >> d;

  int ans = 0;
  for(int i=0; i<n; i++) {
    long x, y;
    cin >> x >> y;
    if (x * x + y * y <= d * d) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3624
N = gets.chomp.to_i
a = N.times.map{gets.split.map(&:to_i)}

comb = [*(0..(N-1))].permutation.to_a
route_sum = 0
comb.each do |route|
  (0..(N-2)).each do |i|
    route_sum += ((a[route[i]][0].to_f - a[route[i+1]][0])**2 + (a[route[i]][1].to_f - a[route[i+1]][1])**2)**(0.5)
  end
end
puts route_sum / comb.length

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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m,r;
    cin >> n >> m >> r;
    vector<vector<int>> st(n);
    for(int i = 0; i < m; i++) {
        int l,r;
        cin >> l >> r;
        st[l-1].emplace_back(r-1);
    }
    for(int i = 0; i < n; i++) {
        sort(st[i].begin(),st[i].end());
    }

    for(int i = 0; i < r; i++) {
        int p,q;
        cin >> p >> q;
        int cnt=0;
        for(int j = p-1; j < q; j++) {
            int add=lower_bound(st[j].begin(),st[j].end(),q) - st[j].begin();
            cnt+=add;
        }
        cout << cnt << "\n";
    }

    return 0;
}

Measured memory_bytes: 4448
/*
 * author: calgagi
 *         Calvin Gagliano 
 */
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define ar array
#define f first
#define s second
#define dd long double

int main() {
    ios_base::sync_with_stdio(false);  
    cin.tie(NULL);
    srand(chrono::steady_clock::now().time_since_epoch().count()); 
    // freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); 
    
    int n;
    cin >> n;
    vector<ll> A(n);
    for (auto& i : A) {
        cin >> i;
    }

    map<ll,ll> past;
    ll ans = 0;
    for (int j = 0; j < n; j++) {
        ll search = (j+1) - A[j], x = A[j]+(j+1);
        ans += past[search];
        past[x]++;
    }

    cout << ans << endl;

    return 0;
}


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

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    ll N,P,end;
    cin >> N >> P;
    ll B[1000000];
    ll A[1000000];
    Fill(A,(ll)0);
    Fill(B,(ll)0);
    end = 1;
    int C = 0;
    for(ll i = 2;i*i <= P;i++){
        if(P % i == 0){
            while(P % i == 0){
                A[C]++;
                P /= i;
            }
            B[C] = i;
            C++;
        }
    }
    if(P != 1){
        B[C] = P;
        A[C] = 1;
    }
    ll ans = 1;
    int ts;
    for(ll i = 0;i <= C;i++){
        ts = A[i] / N;
        if(ts != 0)
            ans *= pow(B[i],ts);
    }
        
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 15872
#include<iostream>
#include<algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <sstream>

using namespace std;
typedef long long ll;
ll d[12];

int main() {
	cin.sync_with_stdio(0); cin.tie(0); cout.tie(NULL);

	ll n; cin >> n;
	d[1] = 26;
	ll c = 26 * 26;
	for (int i = 2; i <= 11; i++) {
		d[i] = c;
		c *= (ll)26;
	}
	int cnt = -1;
	ll sum = 0;

	for (int i = 1; i <= 11; i++) {
		if (n > d[i]) {
			n -= d[i];
		}
		else {
			cnt = i - 1; break;
		}
	}

	string s = "";
	for (int i = 0; i < cnt + 1; i++) {
		s = s + 'a';
	}
	int t = 0;
	while (1) {
		if (cnt == 0) {
			s[s.size() - 1] = (char)('a' + n - 1);
			break;
		}
		while (n > d[cnt]) {
			s[t] += 1;
			n -= d[cnt];
		}
		t += 1;
		cnt -= 1;
	}

	cout << s << '\n';

	


}


Measured memory_bytes: 3092
# -*- coding: utf-8 -*-
from bisect import bisect_left
from fractions import gcd
def inpl(): return list(map(int, input().split()))

N, S = inpl()

X = [abs(x - S) for x in inpl()]
if N == 1:
    print(X[0])
else:
    ans = gcd(X[0], X[1])
    for x in X[1:]:
        ans = gcd(ans, x)
    print(ans)

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

#if ((_WIN32 || __WIN32__) && __cplusplus < 201103L)
#define lld I64d
#else
#define lld lld
#endif

//{{{
using namespace std;
typedef long long LL;
typedef vector<int> VI;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
// clang-format off
#define debug(args...) {vector<string> _v = split(#args, ','); err(_v.begin(), args); cerr<<endl;}
vector<string> split(const string& s, char c) {vector<string> v; stringstream ss(s); string x; while
(getline(ss, x, c)) v.push_back(x); return v;} void err(vector<string>::iterator) {}
template<typename T, typename... Args> void err(vector<string>::iterator it, T a, Args... args)
{cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; err(++it, args...);}
// clang-format on
//}}}

const int N = 1e5 + 10;
const int mod = 1e9 + 7;
int n, k;
LL a[N];
LL dp[N];
LL s[N];

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
// freopen("out", "w", stdout);
#endif

    while (cin >> n >> k)
    {
        for (int i = 1; i <= n; i++) cin >> a[i];

        dp[0] = 1;
        for (int i = 0; i <= k; i++) s[i] = 1;

        for (int i = 1; i <= n; i++)
        {
            for (int j = 0; j <= k; j++)
            {
                dp[j] = s[j];
                if (j - a[i] > 0) dp[j] -= s[j - a[i] - 1];
                dp[j] = (dp[j] + mod) % mod;
            }

            s[0] = dp[0];
            for (int j = 1; j <= k; j++) s[j] = (s[j - 1] + dp[j]) % mod;
        }

        cout << dp[k] << endl;
    }

    return 0;
}


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

vector<int> parents;

int find_root(int now){
    if(parents[now] == now){
        return now;
    }else{
        return parents[now] = find_root(parents[now]);
    }
}

int main(){
    int N, M;
    cin >> N >> M;
    parents.resize(N + M);
    for(int i = 0; i < N + M; i++){
        parents[i] = i;
    }
    for(int i = 0; i < N; i++){
        int K;
        cin >> K;
        for(int j = 0; j < K; j++){
            int L;
            cin >> L;
            parents[find_root(i)] = find_root(N + L - 1);
        }
    }
    for(int i = 1; i < N; i++){
        if(find_root(0) != find_root(i)){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>
#include <set>

#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define NL << endl

using namespace std;
using ll = long long;
using ull = unsigned long long;


int main() {

	string s;
	int k;

	cin >> s >> k;

	vector<string> subs;

	for(int i = 0; i < s.size(); i++) {
		for(int j = 1; j <= 5; j++) {
			if (i + j > s.size()) break;
			subs.push_back(s.substr(i, j));
		}
	}

	sort(subs.begin(), subs.end());

	subs.erase(unique(subs.begin(), subs.end()), subs.end());

	cout << subs[k - 1] NL;


	return 0;

}

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

using namespace std;

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

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

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

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

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

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

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

int main() {
    string s;
    cin >> s;
    cout << s.substr(0, s.size() - 8) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < 30; i++) {
    for (int j = 0; j < 20; j++) {
      if (i * 4 + j * 7 == N) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
/*+lmake
 * STD = c++14
 * DEFINE += WAAUTOMATON
 */
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#ifdef WAAUTOMATON
     #define debug(args...)            {dbg,args; cerr<<endl;}
#else
    #define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;
#define MAXN 500
int a[MAXN*MAXN+10],d[MAXN+10];
void solve(long long N, vector<long long> x){
	for(int i=0; i<N; ++i) {
		a[x[i]]=i+1;
		d[i+1]=i;
	}	
	sort(d+1,d+1+N,[&](int a,int b){return x[a]<x[b];});
	int p=1;
	for(int i=1; i<=N; ++i) {
		int now=d[i];
		for(int j=1; j<=now; ++j) {
			while(a[p]>0) ++p;
			if (p>x[now]) throw now;
			a[p]=now+1;
		}
	}
	//puts("Yes");
	while(a[p]>0) ++p;
	for(int i=1; i<=N; ++i) {
		int now=d[i];
		if (p<x[now]) throw -now;
		for(int j=now+1; j<N; ++j) {
			a[p]=now+1;
			while(a[p]>0) ++p;
		}
	}
	puts("Yes");
	for(int i=1; i<=N*N; ++i) {
		printf("%d ",a[i]);
	}
	puts("");
}

int main(){	
#ifdef WAAUTOMATON
	freopen("in.txt","r",stdin);
#endif
	long long N;
	scanf("%lld",&N);
	vector<long long> x(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&x[i]);
	}
	try {
	solve(N, x);
	}catch(int x)
	{
		debug(x);
		puts("No");
	}
	return 0;
}



Measured memory_bytes: 2176
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define REV(x) reverse(ALL(x))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ld = long double;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using Pll_ll = pair<ll, ll>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;
const double EPS = 1E-10;

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


int main(){
    int X, Y, Z, K; cin >> X >> Y >> Z >> K;
    VLL A(X), B(Y), C(Z);
    REP(i, X) cin >> A[i];
    REP(i, Y) cin >> B[i];
    REP(i, Z) cin >> C[i];
    VLL AB;
    RSORT(A); RSORT(B); RSORT(C);
    REP(i, min(K, X)){
        REP(j, min(K, Y))
            AB.PB(A[i]+B[j]);
    }
    RSORT(AB);
    VLL ANS;
    REP(i, min(K, int(AB.size()))){
        REP(j, min(K, Z))
            ANS.PB(AB[i]+C[j]);
    }
    RSORT(ANS);
    REP(i, K)
        cout << ANS[i] << "\n";
    return 0;
}


Measured memory_bytes: 43368
def judge(bit, arr):
    for x, y in arr:
        if bit >> x-1 & 1 != y:
            return False
    return True

N = int(input())

testimony = [[] for _ in range(N)]
for i in range(N):
    num = int(input())
    for j in range(num):
        person, state = map(int, input().split())
        testimony[i].append([person, state])

ans = 0
for bit in range(2**N):
    flag = True
    for i in range(N):
        if bit >> i & 1 == 1:
            flag = judge(bit, testimony[i])
            if flag != True:
                break
    
    if flag:
        ans = max(ans, bin(bit).count('1'))

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define sp(x) fixed << setprecision(x)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
 
}



void solve()
{
	int x = 1;
	int n; cin >> n;
	while(x <= n) x *= 2;
	cout << x / 2; 
}

 
int main()
{
	// freopen("crosses.in", "r", stdin);
	// freopen("crosses.out", "w", stdout);
    Red;
  	int T = 1;
  	// cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

Measured memory_bytes: 3680
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let h: usize = iterator.next().unwrap().parse().unwrap();
    let w: usize = iterator.next().unwrap().parse().unwrap();
    let mut map: Vec<Vec<char>> = vec![vec!['.'; w + 2]; h + 2];
    for i in 0..h {
        let line: Vec<char> = iterator.next().unwrap().chars().collect();
        for j in 0..w {
            map[i + 1][j + 1] = line[j];
        }
    }

    let mut possible: bool = true;
    for i in 1..(h + 1) {
        for j in 1..(w + 1) {
            if map[i][j] != '#' {
                continue;
            }
            if i == 1 && j == 1 {
                if map[i][j + 1] == '#' && map[i + 1][j] == '#' {
                    possible = false;
                    break;
                } else {
                    continue;
                }
            }
            if i == h && j == w {
                if map[i][j - 1] == '#' && map[i - 1][j] == '#' {
                    possible = false;
                    break;
                } else {
                    continue;
                }
            }

            if map[i][j + 1] == '#' && map[i + 1][j] == '#' {
                possible = false;
                break;
            }
            if map[i][j - 1] == '#' && map[i - 1][j] == '#' {
                possible = false;
                break;
            }
        }
    }

    return if possible {
        String::from("Possible")
    } else {
        String::from("Impossible")
    };
}


Measured memory_bytes: 4352
mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))

a.sort()

if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            if a[i] != i + 1:
                print(0)
                exit()
        else:
            if a[i] != i:
                print(0)
                exit()
    print(pow(2, n//2, mod))

else:
    for i in range(n):
        if i % 2 == 0:
            if a[i] != i:
                print(0)
                exit()
        else:
            if a[i] != i + 1:
                print(0)
                exit()
    print(pow(2, n//2, mod))

Measured memory_bytes: 84524
#include <iostream>
#include <vector>

#define MOD 1000000007

typedef long long ll;

using namespace std;

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

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

    ll J = 0;
    ll ans = 0;
    for (int i = N - 2; i >= 0; --i) {
        J += A[i + 1];
        J = J % MOD;
        ans += A[i] * J;
        ans = ans % MOD;
    }

    cout << ans <<endl;

    return 0;
}

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

using namespace std;

const long long INF = 1e18;
const int N = 1e5;
const int MOD = 1e9 + 7;

const double PI = acos(-1);



int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    cout << a[2] - a[0];
}

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

int ans = 0;
vector<int> L;

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

    int tmp, i=0;
    while (cin >> tmp){
        L.push_back(tmp);
        i++;
        if(i >= N){
            break;
        }
    }

    sort(L.begin(), L.end());

    for(int i=0; i<N; i++){
        for(int j=i+1; j<N; j++){
            int tmp = L[i] + L[j];
            int div = lower_bound(L.begin(), L.end(), tmp) - L.begin();
            ans += div - j - 1;
        }
    }

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

Measured memory_bytes: 256
n=int(input())
l=[]
for i in range(n):
    l.append(input())
    
x=set(l)
x=list(x)
c=0
if len(x)!=n:
    print('No')
else:
    for i in range(n-1):
        if l[i][-1]==l[i+1][0]:
            c+=1
    if c==n-1:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 3064
N, M, X = map(int, input().split())
A = [int(_) for _ in input().split()]
cnt0 = 0
cntN = 0

for i in range(X):
    if i in A:
        cnt0 += 1

for i in range(X, N):
    if i in A:
        cntN += 1

print(min(cnt0, cntN))

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

    char x, y;
    cin >> x >> y;
    if(x < y) cout << "<" << endl;
    else if(x > y) cout << ">" << endl;
    else cout << "=" << endl;

    return 0;
}

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

const int MAXN = 100010;
typedef long long LL;
void bye() { std::cout << -1 << std::endl; exit(0); }
int head[MAXN], nxt[MAXN << 1], to[MAXN << 1], tot;
void addedge(int b, int e) {
	nxt[++tot] = head[b]; to[head[b] = tot] = e;
	nxt[++tot] = head[e]; to[head[e] = tot] = b;
}
template<class T> T absx(T x) { return x < 0 ? -x : x; }
int n, m; LL ans;
int ins[MAXN], st[MAXN], top, L;
int dfs(int u, int fa = 0) {
	int res = 1;
	for (int i = head[u]; i; i = nxt[i])
		if (to[i] != fa && !ins[to[i]])
			res -= dfs(to[i], u);
	if (fa) ans += absx(res);
	return res;
}
int findcir(int u, int fa = 0) {
	if (ins[u]) {
		int t; L = top;
		do t = st[top--]; while (t != u);
		return true;
	}
	ins[u] = true; st[++top] = u;
	for (int i = head[u]; i; i = nxt[i])
		if (to[i] != fa)
			if (findcir(to[i], u))
				return true;
	ins[u] = false; --top;
	return false;
}
int tl[MAXN];
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n >> m;
	for (int i = 1, t1, t2; i <= m; ++i) {
		std::cin >> t1 >> t2;
		addedge(t1, t2);
	}
	if (m == n - 1) {
		if (dfs(1)) bye();
		std::cout << ans << std::endl;
		return 0;
	}
	findcir(1);
	for (int i = 1; i <= top; ++i) ins[st[i]] = false;
	for (int i = top + 1; i <= L; ++i)
		tl[i - top] = dfs(st[i]);
	L -= top;
	for (int i = 1; i <= L; ++i) tl[i] -= tl[i - 1];
	int v = tl[L] >> 1;
	for (int i = 1; i <= L; ++i) if (i & 1 ^ 1) tl[i] = -tl[i];
	if (L & 1) { if (tl[L] & 1) bye(); }
	else if (tl[L]) bye();
	if (~L & 1) std::nth_element(tl + 1, tl + L / 2, tl + 1 + L), v = tl[L + 1 >> 1];
	for (int i = 1; i <= L; ++i) ans += absx(v - tl[i]);
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <cmath>

using namespace std;

const int len = 200010;
int a[len],n,k;

int main() {
	cin >> n;
	long long sum = 0;
	for (int i=1;i<=n;i++) {
		cin >> a[i];
		sum += a[i];
	}
	long long mn = 1e18;
	long long s = 0;
    if  (n == 2) {
    	cout << abs(a[1]-a[2]) << endl;
	}
	else {
		for (int i=1;i<n;i++) {
			s += a[i];
			sum -= a[i];
			mn = min(mn,abs(s-sum));
		}
		cout << mn << endl;
    }
	return 0;
} 

Measured memory_bytes: 1024
while str = gets do
  num = str.chomp.to_i
  break if num == 0
  n2 = 0
  n5 = 0
  (1..num).each do |n|
    nn = n
    while nn % 2 == 0
      n2 += 1
      nn /= 2
    end
    nn = n
    while nn % 5 == 0
      n5 += 1
      nn /= 5
    end
  end
  puts [n2, n5].min
end

Measured memory_bytes: 8656
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var nr = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            Console.WriteLine(nr[0] >= 10 ? nr[1] : (nr[1] + (100 * (10 - nr[0]))));
        }
    }
}


Measured memory_bytes: 13396
use std::collections::HashSet;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn make_hash_set(a: Vec<i32>) -> HashSet<i32> {
    let mut hash_set: HashSet<i32> = HashSet::new();
    let length: usize = a.len();
    let hash_length: usize = 2usize.pow(length as u32);
    for i in 0..hash_length {
        let mut sum: i32 = 0;
        for j in 0..length {
            if (1 & i >> j) == 1 {
                sum += a[j];
            }
        }
        hash_set.insert(sum);
    }
    hash_set
}

fn binary_search_recrusive(array: Vec<i32>, key: i32, low: i32, high: i32) -> i32 {
    let mid = (low + high) / 2;

    if low > high {
        -1
    } else if array[mid as usize] == key {
        mid
    } else if key < array[mid as usize] {
        binary_search_recrusive(array, key, low, mid - 1)
    } else {
        binary_search_recrusive(array, key, mid + 1, high)
    }
}

fn binary_search(array: Vec<i32>, key: i32) -> i32 {
    let len = array.len() as i32;
    binary_search_recrusive(array, key, 0, len - 1)
}

fn main() {
    let n: usize = read();

    let a: Vec<i32> = (0..n).map(|_| read::<i32>()).collect();

    let hash_set: HashSet<i32> = make_hash_set(a.clone());
    let mut a_unique: Vec<i32> = hash_set.iter().map(|&v| v).collect();
    a_unique.sort();

    let q: usize = read();

    for _i in 0..q {
        let m: i32 = read();
        let result = binary_search(a_unique.clone(), m);
        if result == -1 {
            println!("no");
        } else {
            println!("yes");
        }
    }
}



Measured memory_bytes: 5056
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    string s;
    cin >> s;
    int cnt = 0;
    rep(i,3){
        if(s[i] == 'o') cnt++;
    }
    cout << 700 + 100*cnt << endl;
    return 0;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll i,j,k,n,a=2,b=1,x,y,z;
int main()
{
  cin>>n;
  if(n==0)return cout<<a,0;
  if(n==1)return cout<<b,0;
  for(i=2;i<=n;i++,swap(a,b))a+=b;
  cout<<b;
}

Measured memory_bytes: 256
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if a+b<=9:
        print(a+b)
    else:
        print('error')
if __name__ == '__main__':
    do()

Measured memory_bytes: 3060
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Threading.Tasks;

class Program
{
	//Main
	static void Main(string[] args)
	{
		//読み込む
		string[] S = Console.ReadLine().Split(' ');
		int N = int.Parse(S[0]);
		int K = int.Parse(S[1]);
		int[] pn = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

		//ソート
		Array.Sort(pn);

		//K番目まで加算
		int ans = 0;
		for(int i=0; i<K; i++){
			ans += pn[i];
		}


		Console.WriteLine(ans);
	}
}



Measured memory_bytes: 19716
ca = ord('a')
def convert(s, d):
    res = []
    for c in s:
        if c not in ' .':
            c = chr(((ord(c) - ca + d) % 26) + ca)
        res.append(c)
    return "".join(res)
for line in open(0).readlines():
    s = line.strip()
    for d in range(26):
        s0 = convert(s, d)
        if "the" in s0 or "this" in s0 or "that" in s0:
            print(s0)
            break



Measured memory_bytes: 5564
#include <stdio.h>

int main()
{
	int n, m, i;
	int a, b, t;
	int buf[31];

	scanf("%d", &n);
	for (i = 1; i <= n; i++) {
		buf[i] = i;
	}
	scanf("%d", &m);
	for (i = 0; i < m; i++) {
		scanf("%d,%d", &a, &b);
		t = buf[a];
		buf[a] = buf[b];
		buf[b] = t;
	}
	for (i = 1; i <= n; i++) {
		printf("%d\n", buf[i]);
	}
	return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int32 w;
    cin >> w;
    for(int32 i = 0; i < s.size(); i += w){
        cout << s[i];
    }
    cout << endl;
    return 0;
}

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

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

// type
using ll = int_fast64_t;
using ull = uint_fast64_t;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
//using pair<T1, T2> = p12;

//container
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
#define ALL(v) v.begin(),v.end()

//repetition
#define REP(n) for(ll i=0; i<(n); i++)
#define REPj(n) for(ll j=0; j<(n); j++)
#define REPinit(i,a,n) for(ll i=(a); i<(n); i++)
#define REPinitj(j,a,n) for(ll j=(a); j<(n); j++)

//algorithm
#define SORT(c) sort((c).begin(),(c).end())
#define CONTAINER_ALL(a) a.begin(),a.end()

//constant

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//Optimizer
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


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

    int D;
    cin >> D;

    std::ostringstream os;
    REPinit(i, 0, 25 - D) os << " Eve";
    
    cout << ("Christmas" + os.str()) << endl;
    
    return 0;
}


Measured memory_bytes: 3588
n,k=map(int,input().split())
a=list(map(int,input().split()))
ichi=a.index(1) #1の位置(index番号)

ans=float("inf")
#1を含むKの位置をずらしていって最小になるとこを探す…
#端に行き渡らせるまでに、左右それぞれ何回かかるかの式求める。
import math
for i in range(k):
  if ichi-i<0 or ichi+k-i>n: #この条件は合ってるっぽい
    #print(i,"アウト")
    continue
  left=math.ceil((ichi-i)/(k-1)) #左端までかかる回数 これは正しいはず、
  right=math.ceil((n-ichi-(k-i))/(k-1)) #右端までかかる回数
  #print(ichi-i,left,right)
  ans=min(ans,1+left+right)
print(ans)


Measured memory_bytes: 14004
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>

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

int main() {
  ll N, num = 0;
  cin >> N;
  int t[6] = {357, 375, 537, 573, 735, 753};
  int d[3] = {3, 5, 7};
  vector<ll> a;

  rep(i, 3){
    a.push_back(d[i]);
  }
  
  // 3, 5, 7を含む数を列挙して行く
  int s = 0, g = a.size(), zero = 1; 
  while(num <= N){
    for(int j = s; j < g; j++){
      for(int n_357: d){
        num = a[j]*10 + n_357;
        a.push_back(num);
        if (num >= N) break;
      }
      if (num >= N) break;
    }
    s = g;
    g = a.size();
    zero++;
  }
  
  int ans=0;
  int flag[3] = {0, 0, 0};
  // このうち，3, 5, 7の3つの数字が入っているものを数える
  for(int i: a){
    if (N < i) break;
    flag[0] = 0; flag[1] = 0; flag[2] = 0;
    string s = to_string(i);
    for(char c: s){
      if(c == '3') flag[0] = 1;
      if(c == '5') flag[1] = 1;
      if(c == '7') flag[2] = 1;
    }
    if (flag[0] &  flag[1] & flag[2]) ans++;
  }
  cout << ans << endl;

}


Measured memory_bytes: 640