akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;
#define int LL

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && (ch != '-')) ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

int const MAXN = 2e5 + 5, mod = 1e9 + 7;
struct Edges { int to, next; } e[MAXN * 2];
int head[MAXN], tot;
int f[MAXN];
int frac[MAXN], invfrac[MAXN];
int size[MAXN];
int Ans[MAXN];
int n;

inline int qpow(int a, int k) {
  int re = 1;
  for (; k; k >>= 1, a = a * a % mod)
    if (k & 1) re = re * a % mod;
  return re;
}
inline int C(int n, int m) { return frac[n] * invfrac[m] % mod * invfrac[n - m] % mod; }

inline void addedge(int from, int to) {
  e[++tot] = (Edges){to, head[from]};
  head[from] = tot;
  e[++tot] = (Edges){from, head[to]};
  head[to] = tot;
}

void Dfs(int now, int fa) {
  size[now] = 1;
  for (RI i = head[now]; i; i = e[i].next)
    if (e[i].to != fa)
      Dfs(e[i].to, now), size[now] += size[e[i].to];
}
void Get(int now, int fa) {
  int res = size[now] - 1;
  f[now] = 1;
  for (RI i = head[now]; i; i = e[i].next)
    if (e[i].to != fa) {
      Get(e[i].to, now);
      f[now] = f[now] * f[e[i].to] % mod * C(res, size[e[i].to]) % mod;
      res -= size[e[i].to];
    }
}
void Solve(int now, int fa) {
  Ans[now] = f[now];
  for (RI i = head[now]; i; i = e[i].next) {
    if (e[i].to != fa) {
      int cur = f[now], curs = f[e[i].to];
      f[now] = f[now] * qpow(f[e[i].to], mod - 2) % mod * qpow(C(n - 1, size[e[i].to]), mod - 2) % mod;
      f[e[i].to] = f[e[i].to] * f[now] % mod * C(n - 1, n - size[e[i].to]) % mod;
      Solve(e[i].to, now);
      f[now] = cur, f[e[i].to] = curs;
    }
  }
}

signed main() {

#ifdef LOCAL
  FILEIO("a");
#endif

  read(n);
  frac[0] = 1;
  for (RI i = 1; i <= n; ++i) frac[i] = frac[i - 1] * i % mod;
  invfrac[n] = qpow(frac[n], mod - 2);
  for (RI i = n; i; --i) invfrac[i - 1] = invfrac[i] * i % mod;
  for (RI i = 1, x, y; i < n; ++i)
    read(x), read(y), addedge(x, y);
  Dfs(1, 0);
  Get(1, 0);
  Solve(1, 0);
  for (RI i = 1; i <= n; ++i)
    cout << Ans[i] << endl;

  cerr << (double)(clock()) / CLOCKS_PER_SEC * 1000 << "ms" << endl;

  return 0;
}

// created by Daniel yuan

Measured memory_bytes: 19200
// Problem : C - A x B + C
// Contest : AtCoder - AtCoder Beginner Contest 179
// URL : https://atcoder.jp/contests/abc179/tasks/abc179_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize("O3")  
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
typedef long long ll;
#define F first
#define pii pair<int,int>
#define S second
#define endl "\n"
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define mem(z,i) memset(z,i,sizeof(z))
#define eps 1e-7
#define I (int)
#define mod 1000000007
#define pb push_back
const long long INF = 1000000000000000000LL;
//const int WASTE=∞
const int N=1e5+5;
signed main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
  	// cout<<fixed;
  	// cout.precision(10);
   	// ofstream cout (".out");
    // ifstream cin  (".in");
	int n,ans=0;
	cin>>n;
	for(int x=1;x<=n;x++){
		ans+=max(0,(n-1)/x);
	}
   	cout<<ans;
   	
   	
   	
   	
   	
   	
   	
   	
   	
   	
  	return 0;
}



Measured memory_bytes: 3604
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<cstdlib>
#define cmax(a,b) (a<(b)?a=(b),1:0)
#define cmin(a,b) (a>(b)?a=(b),1:0)
#define dmin(a,b) ((a)<(b)?(a):(b))
#define dmax(a,b) ((a)>(b)?(a):(b))
#define regsiter register
#define CL fclose(stdin),fclose(stdout)
namespace io
{
	int F()
	{
		int n=0,F=1;
		char ch;
		while((ch=getchar())!='-'&&(ch<'0'||ch>'9'));
		ch=='-'?F=0:n=ch-'0';
		while((ch=getchar())>='0'&&ch<='9')n=(n<<1)+(n<<3)+ch-'0';
		return F?n:-n;
	}
	long long G()
	{
		long long n=0,F=1;
		char ch;
		while((ch=getchar())!='-'&&(ch<'0'||ch>'9'));
		ch=='-'?F=0:n=ch-'0';
		while((ch=getchar())>='0'&&ch<='9')n=(n<<1)+(n<<3)+ch-'0';
		return F?n:-n;
	}
}
int d[15][15];
int li[222][222];
int dis[222]; 
int main()
{
	int a=io::F(),b=io::F();
	for(register int i=1;i<=a;++i)
		for(register int j=1;j<=b;++j)
			d[i][j]=io::F();
	int po=202;
	for(register int i=1;i<=po;++i)
		for(register int j=1;j<=po;++j)
			li[i][j]=-3;
	int pe=0;
	for(register int i=1;i<=100;++i)li[i][i+1]=-1,++pe;
	for(register int i=202;i>102;--i)li[i][i-1]=-2,++pe;
	int s=1,t=102;
	for(register int i=0;i<=100;++i)
		for(register int j=0;j<=100;++j)
		{
			int max=0;
			for(register int x=1;x<=a;++x)
				for(register int y=1;y<=b;++y)
					cmax(max,d[x][y]-i*x-j*y);
			li[s+i][t+j]=max;
			++pe;
		}
	for(register int x=1;x<=a;++x)
		for(register int y=1;y<=b;++y)
		{
			memset(dis,63,sizeof(dis));
			dis[1]=0;
			for(register int i=1;i<=100;++i)dis[i+1]=dis[i]+x;
			for(register int i=1;i<=101;++i)
				for(register int j=102;j<=202;++j)
					if(li[i][j]!=-3)cmin(dis[j],dis[i]+li[i][j]);
			for(register int i=202;i>t;--i)
				cmin(dis[i-1],dis[i]+y);
			if(dis[t]!=d[x][y])
			{
				puts("Impossible");
				return 0;
			}
		}
	puts("Possible");
	printf("%d %d\n",po,pe);
	for(register int i=1;i<=po;++i)
		for(register int j=1;j<=po;++j)
		{
			if(li[i][j]==-1)printf("%d %d X\n",i,j);
				else if(li[i][j]==-2)printf("%d %d Y\n",i,j);
						else if(li[i][j]!=-3)printf("%d %d %d\n",i,j,li[i][j]);
		}
	printf("%d %d\n",s,t);
	return 0;
}




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

using namespace std;

#define MAX 100005
#define NIL -1

struct Node { int p, l, r; };

Node T[MAX];
int n, D[MAX];

void print(int u){
    int i, c;
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].p << ", ";
    cout << "depth = " << D[u] << ", ";

    if(T[u].p == NIL){
        cout << "root, ";
    }else if (T[u].l == NIL)
    {
        cout << "leaf, ";
    }else
    {
        cout << "internal node, ";
    }
    
    int cnt = 0;

    cout << "[";

    c = T[u].l;
    while (c != NIL)
    {
        if(cnt) cout << ", ";
        cout << c;
        c = T[c].r;
        cnt++;
    }
    cout << "]" << endl;    
}

int rec(int u, int p){
    D[u] = p;
    if(T[u].r != NIL) rec(T[u].r, p);
    if(T[u].l != NIL) rec(T[u].l, p+1);
}

int main(){
    int i, j, d, v, c, l, r;
    cin >> n;
    for ( i = 0; i < n; i++)
    {
        T[i].p = T[i].l = T[i].r = NIL;
    }
    
    for ( i = 0; i < n; i++)
    {
        cin >> v >> d;
        for ( j = 0; j < d; j++)
        {
            cin >> c;
            if(j == 0) T[v].l = c;
            else T[l].r = c;
            l = c;
            T[c].p = v;
        }
    }
    for ( i = 0; i < n; i++)
    {
        if (T[i].p == NIL)
        {
            r = i;
        }
        
    }
    
    rec(r, 0);

    for ( i = 0; i < n; i++)
    {
        print(i);
    }
    
    return 0;
}


Measured memory_bytes: 7740
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
int main(){
    //freopen("in","r",stdin);
    //freopen("out","w",stdout);
    fast;
    int x,y;
    set<int> s1,s2,s3;
    s1.insert(1);
    s1.insert(3);
    s1.insert(5);
    s1.insert(7);
    s1.insert(8);
    s1.insert(10);
    s1.insert(12);
    s2.insert(4);
    s2.insert(6);
    s2.insert(9);
    s2.insert(11);
    s3.insert(2);
    cin >> x >> y;
    cout << ( (s1.count(x) && s1.count(y)) or (s2.count(x) && s2.count(y)) or (s3.count(x) && s3.count(y))?"Yes":"No") << '\n';
    return 0;
}   

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
#include <chrono>
#include <fstream>
using namespace std;

#pragma region

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

using ll = long long;
using P = pair<int, int>;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

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

template<class T>
void print(const vector<T> &v, const string &delimiter = " ") { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

#pragma endregion


int main() {
    string s, t;
    cin >> s >> t;
    int ans = 1000;
    int ls = s.size(), lt = t.size();
    rep(i, ls - lt + 1) {
        int diff = 0;
        rep(j, lt) if (s[i + j] != t[j]) diff++;
        chmin(ans, diff);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){

    int M, K;
    cin >> M >> K;
    if(K >= (1 << M)){
        cout << -1 << endl;
        return 0;
    }
    if(M == 1 && K == 1){
        cout << -1 << endl;
        return 0;
    }
    set<int>S;
    for(int i = 1;K;i+=i){
        if(K & i){
            K -= i;
            S.insert(i);
        }
    }
    vector<int>A, B;
    for(int i = 0; i < (1 << M); i++){
        if(S.find(i) != S.end())A.push_back(i);
        else B.push_back(i);
    }
    vector<int>ans;
    int flg = 1;
    for(int i = 0; i < A.size(); i++){
        if(flg)flg = 0;
        else cout << " ";
        cout << A[i];
    }
    for(int i = 0; i < B.size(); i++){
        if(flg)flg = 0;
        else cout << " ";
        cout << B[i];
    }
    reverse(A.begin(), A.end());
    reverse(B.begin(), B.end());
    for(int i = 0; i < A.size(); i++){
        if(flg)flg = 0;
        else cout << " ";
        cout << A[i];
    }
    for(int i = 0; i < B.size(); i++){
        if(flg)flg = 0;
        else cout << " ";
        cout << B[i];
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 2424
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        Arrays.sort(array);
        int ans = 0;
        for (int i = 0; i < n - 2; i++) {
            int a = array[i];
            for (int j = i + 1; j < n - 1; j++) {
                int b = array[j];
                for (int k = j + 1; k < n; k++) {
                    int c = array[k];
                    if (c >= a + b) {
                        break;
                    } else if (c < a + b) {
                        ans++;
                    }
                }
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 40200
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecb vector<bool>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}

int main()
{
	int n, ans = 0;
	str s;
	cin>>n>>s;
	int left = 0, right = s.size()-1;
	while (left<right && right >= 0 && left < s.size()) {
		if (s[left]=='W') {
			while (s[right]=='W' && right >= 0) {
				right--;
			}
			// cout << "left = "<< left << " right = " << right << endl;
			if (left<right) {
				ans++;
			}
			right--;
		}
		left++;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3748
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int sum = 0;
			int n = sc.nextInt();

			for(int a = 0; a <= 9; a++) {
				for(int b = 0; b <= 9; b++) {
					for(int c = 0; c <= 9; c++) {
						for(int d = 0; d <= 9; d++) {
							if((a+b+c+d) == n){
								sum++;
							}
						}
					}
				}
			}
			System.out.printf("%d", sum);
			System.out.println();
		}
	}
}


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

int main() {

int n,r;
cin >> n>>r ;

if(n<10)
{ n=10-n;
  r=r+(n*100);};
cout << r << endl;



}
/*vector <int> a(3);
for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }*/

Measured memory_bytes: 256
while True:
    line=input().rstrip().split()
    h=int(line[0])
    w=int(line[1])
    if h==0 and w==0:
        break
    else:
        for i in range(h):
            for j in range(w):
                if i==0:
                    print("#",end='')
                elif j==0 or j==w-1:
                    print("#",end='')
                elif i==h-1:
                    print("#",end='')
                else:
                    print(".",end='')
            print()
        print()


Measured memory_bytes: 7000
class BinaryTree {
  constructor() {
    this.root = null;
    BinaryTree.Node = BinaryTree.Node || class Node {
      constructor(key, parent = null, left = null, right = null) {
        this.key = key;
        this.parent = parent;
        this.left = left;
        this.right = right;
      }

      getChildrenNumber() {return Number(this.left !== null) + Number(this.right !== null);}

      isLeftChild() {return this.parent ? this.parent.left === this : null;}

      getLeftOrRight() {return this.isLeftChild() ? 'left' : 'right';}

      getSuccessor() {
        let n;
        if (this.right !== null) {
          n = this.right;
          while (n.left !== null) n = n.left;
        } else {
          n = this.parent;
          while (!n.isLeftChild && n.parent != null) n = n.parent;
        }
        return n;
      }
    };
  }

  insert(key) {
    if (this.root === null) {
      this.root = new BinaryTree.Node(key);
      return;
    }
    let x = this.root, y;
    let newNode = new BinaryTree.Node(key);
    while (x !== null) {
      y = x;
      x = x[key < x.key ? 'left' : 'right'];
    }
    newNode.parent = y;
    y[key < y.key ? 'left' : 'right'] = newNode;
  }

  find(key, n = this.root) {
    if (n === null || n.key === key) return n;
    return this.find(key, n[key < n.key ? 'left' : 'right']);
  }

  delete(key) {
    const n = this.find(key);
    const leftOrRight = n.getLeftOrRight();
    switch (n.getChildrenNumber()) {
    case 0:
      n.parent[leftOrRight] = null;
      break;
    case 1:
      n.parent[leftOrRight] = n.left || n.right;
      n.parent[leftOrRight].parent = n.parent;
      break;
    default:
      const skey = n.getSuccessor().key;
      this.delete(skey);
      n.key = skey;
    }
  }

  printByIneorder() {
    let str = '';
    const innerFunc = (n) => {
      if (n === null) return;
      innerFunc(n.left);
      str += ` ${n.key}`;
      innerFunc(n.right);
    }
    innerFunc(this.root);
    console.log(str);
  }

  printByPreorder() {
    let str = '';
    const innerFunc = (n) => {
      if (n === null) return;
      str += ` ${n.key}`;
      innerFunc(n.left);
      innerFunc(n.right);
    }
    innerFunc(this.root);
    console.log(str);
  }

  print() {
    this.printByIneorder();
    this.printByPreorder();
  }
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());

  const tree = new BinaryTree();
  lines.forEach(function(cmd) {
    switch (cmd.charAt(0)) {
    case 'i': tree.insert(Number(cmd.split(' ')[1])); break;
    case 'f': console.log(tree.find(Number(cmd.split(' ')[1])) ? 'yes' : 'no'); break;
    case 'd': tree.delete(Number(cmd.split(' ')[1])); break;
    default: tree.print();
    }
  });
})();



Measured memory_bytes: 203400
#include <iostream>
#include <vector>
#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
#define NIL -1
//#define INFTY 1000000000000000000

int main(){
    vector<string> s(3);
    vector<LL> idx(3, 0);
    LL turn=0;

    cin >> s[0];
    cin >> s[1];
    cin >> s[2];

    while(true){
        if(idx[turn]==s[turn].size()){
            break;
        }
        if(s[turn][idx[turn]]=='a'){
            idx[turn]++;
            turn=0;
        }else if(s[turn][idx[turn]]=='b'){
            idx[turn]++;
            turn=1;            
        }else{
            idx[turn]++;
            turn=2;            
        }
    }

    if(turn==0){
        cout << 'A' << endl;
    }else if(turn==1){
        cout << 'B' << endl;
    }else{
        cout << 'C' << endl;
    }

    return 0;
}


Measured memory_bytes: 3568
N, M = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(N)]
cd = [tuple(map(int, input().split())) for _ in range(M)]

for i in range(N):
    ans = float('Inf')
    for j in range(M):
        dist = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if dist < ans:
            ans = dist
            output = j
    print(output + 1)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> button(N);
    rep(i,N){
        cin >> button[i];
        button[i]--;
    }
    vector<bool> light(N,false);
    int count = 0;
    int next = 0;
    rep(i,100005){
        if (light[next]){
            cout << -1 << endl;
            break;
        }
        else{
            light[next] = true;
            next = button[next];
            count++;
        }
        if (next == 1){
            cout << count << endl;
            break;
        }
    }
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)

ll solve() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) return 0;
    // a > b > c
    if (a < b) swap(a, b);
    if (b < c) swap(b, c);
    if (a < b) swap(a, b);
    return (ll)b * c; 
}

int main() {
    out(solve());
}


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

long n, k, a, d;

int main(){
    cin >> n >> k;
    for (int i = 1; i <= n; i++)a += !(i % k), d += (k % 2 == 0 && i % (k / 2) == 0 && i % k != 0);
    cout << a * a * a + d * d * d << endl;
}

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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

const int MAXN = 100005; // 素数を探す範囲
bool _is_prime[MAXN];     // 添え字に対応する値の素数判定を格納
vector<int> P;      // 素数を格納する

void eratosthenes(const int N)
{
  for (int i = 0; i <= N; i++) {
    _is_prime[i] = true; // trueで初期化.
  }
  _is_prime[0]=_is_prime[1]=false;
  for (int i = 2; i <= N; i++) {
    if (_is_prime[i]) {
      for (int j = 2 * i; j <= N; j += i) {
        _is_prime[j] = false; // iの倍数を篩にかける
      }
      P.emplace_back(i);
    }
  }
}



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  eratosthenes(100000);
  int q; cin>>q;
  vi l(q),r(q);
  rep(i,q) cin>>l[i]>>r[i];
  vi s(MAXN);
  for(int i=3; i<=100000; i+=2){
    s[i]=s[i-2];
    int j=(i+1)/2;
    if(_is_prime[i]&&_is_prime[j]){
      // cout<<i<<endl;
      s[i]++;
    }
  }
  rep(i,q){
    int ans=s[r[i]];
    if(l[i]>=3) ans-=s[l[i]-2];
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 2048
from collections import defaultdict
S = input()
T = input()
s = defaultdict(int)
t = defaultdict(int)
for c in S:
    s[c] += 1
for c in T:
    t[c] += 1
sv = sorted(s.values())
tv = sorted(t.values())
if sv == tv:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 4144
A = []
B = []
for i in range(3):
    a, b = [int(n) for n in input().split()]
    A.append(a)
    B.append(b)

counter = [0] * 4

for i in range(3):
    counter[A[i] - 1] += 1
    counter[B[i] - 1] += 1

oddscounter = 0

for i in range(4):
    if counter[i] % 2 == 1:
        oddscounter += 1

answer = "YES"
if oddscounter >= 3:
    answer = "NO"
else:
    answer = "YES"

print(answer)


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string N; cin >> N;
    int ok=0;
    for (int i=0;i<3;++i) if (N[i]=='7') ok=1;
    cout << (ok?"Yes":"No") << '\n';
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  string A, B, C;
  cin >> A >> B >> C;
  int count = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] == B[i] && B[i] == C[i])
      continue;
    else if (A[i] != B[i] && B[i] != C[i] && C[i] != A[i])
      count += 2;
    else
      count++;
  }
  cout << count << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
using namespace std;
int inf = 1000000000;

int main(void) {

  int n, t;
  cin >> n >> t;
  vector<int> a(n);
  for(int i=0; i<n; i++) cin >> a[i];

  long long int x = 0;
  for(int i=1; i<n; i++){
    if( a[i] - a[i-1] > t ) x += t;
    else x += a[i] - a[i-1];
  }
  x += t;
  cout << x << endl;


  return 0;
}

// EOF


Measured memory_bytes: 1024
N, M = map(int, input().split())
cards = sorted(list(map(int, input().split())))
op = sorted([tuple(map(int, input().split())) for _ in range(M)], key = lambda x: x[1], reverse=True)

cursor = 0
for b, c in op:
    for i in range(b):
        if  cursor < N and cards[cursor] < c:
            cards[cursor] = c
            cursor += 1
        else:
            break
print(sum(cards))


Measured memory_bytes: 22884
use std::io;

#[allow(unused_macros)]
macro_rules! read {
    ($t: ty) => {
        {
            let mut input = String::new();
            io::stdin().read_line(&mut input).expect("could not read input");
            input.trim().parse::<$t>().unwrap()
        };
    };
    ($($t: ty),*) => {
        {
            let mut input = String::new();
            io::stdin().read_line(&mut input).expect("could not read input");
            let mut iter = input.trim().split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()), *)
        };
    }
}
#[allow(unused_macros)]
macro_rules! read_vec {
    ($t: ty) => {
        {
            let mut input = String::new();
            io::stdin().read_line(&mut input).expect("could not read input");
            let iter = input.trim().split_whitespace();
            iter.map(|x| x.parse::<$t>().unwrap()).collect::<Vec<$t>>()
        };
    }
}
#[allow(unused_macros)]
macro_rules! read_chars {
    () => {
        {
            let mut input = String::new();
            io::stdin().read_line(&mut input).expect("could not read input");
            input.trim().chars().collect::<Vec<char>>()
        };
    }
}

#[allow(dead_code)]
static M: u64 = 1000000007;

fn main() {
    let a = read!(i32);
    let b = read!(i32);
    let c = read!(i32);
    let x = read!(i32);

    println!("{}", count(a, b, c, x));
}

fn count(a: i32, b: i32, c: i32, x: i32) -> i32 {
    if x < 0 {
        return 0;
    }

    if a < 0 || b < 0 || c < 0 {
        return 0;
    }

    if x == 0 {
        return 1;
    }

    return count(a-1, b, c, x-500)
        + count(0, b-1, c, x-100)
        + count(0, 0, c-1, x-50);
}

Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in)) {
			String S = sc.next();
			int count = 0;
			char target = '0';
			for(char c : S.toCharArray()) {
				if(c == target) {
					count++;
				}
			}
			System.out.println(Math.min(count, S.length() - count) * 2);
		} // Scanner Close
    }
}

Measured memory_bytes: 28408
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int main() {
    int n, x;
    cin >> n >> x;
    VL w(n), v(n);
    REP(i,n){
        w[i] = in();
        v[i] = in();
    }
    VL dp(x + 1);
    REP(i,n){
        FORR(j,x-w[i],0){
            dp[j + w[i]] = max(dp[j + w[i]], dp[j] + v[i]);
        }
    }
    cout << dp[x] << endl;
    return 0;
}


Measured memory_bytes: 1152
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    T,X = map(float, lines.pop(0).split(' '))
    print('{:.10f}'.format(T/X))
#
# main
#

# 1. use list instead of stdin

# contents = '''\
# 99 1\
# '''
# lines = contents.split('\n')

# 2. use stdin

lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Measured memory_bytes: 2940
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
   
//#include <x86intrin.h>
#include <bits/stdc++.h>   
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair                                     
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, m;
ll t[4 * N], add[4 * N];
vector <pii> g[N];

inline void push (int v, int tl, int tr) {
   if (!add[v]) return;
   t[v] += add[v];
   if (tl != tr) {
      add[v + v] += add[v];
      add[v + v + 1] += add[v];
   }
   add[v] = 0;
}

void upd (int l, int r, ll val, int v = 1, int tl = 0, int tr = n) {
   push (v, tl, tr);
   if (tl > r || tr < l) return;
   if (l <= tl && tr <= r) {
      add[v] = val;
      push (v, tl, tr);
      return;
   }
   int tm = tl + tr >> 1;
   upd (l, r, val, v + v, tl, tm);
   upd (l, r, val, v + v + 1, tm + 1, tr);
   t[v] = min (t[v + v], t[v + v + 1]);
}

ll get (int l, int r, int v = 1, int tl = 0, int tr = n) {
   push (v, tl, tr);
   if (tl > r || tr < l) return inf;
   if (l <= tl && tr <= r) return t[v];
   int tm = tl + tr >> 1;
   return min (get (l, r, v + v, tl, tm), get (l, r, v + v + 1, tm + 1, tr));
}

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     

inline void Solve () {
   cin >> n >> m;
   ll sum = 0;
   for (int i = 1, l, r, a; i <= m; i ++) cin >> l >> r >> a, g[r + 1].pb ({l, a}), sum += a;
   for (int i = 1; i < 4 * N; i ++) t[i] = inf;
   upd (0, 0, -inf);
   for (int i = 1; i <= n + 1; i ++) {
      for (auto it : g[i])
         upd (0, it.F - 1, it.S);
      upd (i, i, t[1] - inf);
   }   
   cout << sum - t[1];
}

main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}
                          

Measured memory_bytes: 28160
import java.util.Scanner;

public class Main { 
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int X = sc.nextInt();
    int Y = sc.nextInt();
    int min =1000000000;
    for (int i =0; i<=Math.max(X,Y) * 2; i+=2) {
      int ans = i * C + Math.max(0,(X - i/2)) * A + Math.max(0,Y - i/2) * B;
      min = Math.min(ans,min);
    }
    System.out.println(min);
  }
}    

Measured memory_bytes: 35680
#include<iostream>
#include<vector>
#include<map>
using namespace std;
vector<int> binext(long long a){
    vector<int> ans;
    for(int i = 0;i<22;i++){
        ans.push_back(a%2);
        a/=2;
    }
    return ans;
}
int main(){
    long n;
    cin >> n;
    long long h;
    vector<int> binsum;
    map<long,long> mp;
    for(int i = 0;i<22;i++){
        mp[i] = 0;
    }
    long wall = 0;
    long rightwall = 0;
    long temwall;
    vector<int> bintem;
    long ans = 0;
    bool fl = false;
    for(int i = 0;i<22;i++){
        binsum.push_back(0);
    }
    for(long i = 1;i<=n;i++){
        cin >> h;
        bintem = binext(h);
        for(int j = 0;j<22;j++){
            binsum[j]+=bintem[j];
        }
        temwall = wall;
        for(int j = 0;j<22;j++){
            if(bintem[j]==1 && binsum[j]>=2){
                fl = true;
                temwall = max(temwall,mp[j]);
            }
        }
        for(int j = 0;j<22;j++){
            if(bintem[j]==1){
                mp[j] = i;
            }
        }
        if(fl){
            ans+=(((i-wall)*(i-wall-1)/2)-max(long(0),(rightwall-wall)*(rightwall-wall-1)/2));
            rightwall = i;
            fl = false;
            wall = temwall;
        }
    }
    ans+=(((n+1-wall)*(n-wall)/2)-max(long(0),(rightwall-wall)*(rightwall-wall-1)/2));
    cout << ans << endl;
}
/*int main(){
    int n;
    cin >> n;
    vector<int> binsum;
    long h;
    for(int i = 0;i<n;i++){
        cin >> h;
        binsum = binext(h);
        for(int j = 0;j<10;j++){
            cout << binsum[j];
        }
        cout << endl;
    }
}*/

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

int main(){
    int x,a,b;
    cin>>x>>a>>b;
    if(abs(x-a)>abs(x-b))cout<<"B"<<endl;
    else cout<<"A"<<endl;
    return 0;
}

Measured memory_bytes: 3596
while True:
    n, x = map(int, input().split())
    count = 0
    if n == 0 and x == 0:
        break
    else:
        for i in range(1, n):
            a = i
            for j in range(2, n+1):
                b = j
                c = x - (a+b)
                if a<b and b<c and c<=n:
                    count += 1
                else:
                    continue
        print(count)


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

ll gcd(ll a,ll b){
	if(a<b){
		swap(a,b);
	}

	while(ll r=(a%b)){
		a = b;
		b = r;
	}
	return b;
}

ll lcm(ll a,ll b){
	return a*b/gcd(a,b);
}

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

	ll N=in(),M=in();
	vector<ll> A=vecin<ll>(N);
	for(auto& x:A) x/=2;
	while(A[0]%2==0){
		REP(i,N){
			if(A[i]%2){
				out(0);
				return 0;
			}
			A[i]/=2;
		}
		M/=2;
	}
	REP(i,N){
		if(A[i]%2==0){
			out(0);
			return 0;
		}
	}
	ll num=A[0];
	for(int i=1;i<N;i++){
		num = lcm(A[i],num);
	}
	
	auto V=M/num;
	out((V+1)/2);
	return 0;
}

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

long long times(long long curr, long long tot)
{
	int cnt = 0;
	do
	{
		curr <<= 1;
		cnt++;
	}while (curr < tot);
	return cnt;

}
int main()
{
	double ans = 0;
	long long n, k;
	cin >> n >> k;
	for (long long i = 1; i <= n; i++)
	{
		double q = 1 / (double)n, p;
		if (i >= k)p = 1;
		else p = 1 / (double)(1 << times(i, k));
		ans += p * q;
	}
	printf("%.12lf",ans);
	return 0;
}


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

using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);

    int N; cin >> N;
    set <string> s;
    for (int i = 0; i < N; i++)
    {
        string ss;
        cin >> ss;
        s.insert(ss);
    }
    cout << s.size() << "\n";
}

Measured memory_bytes: 19128
#include<iostream>

using namespace std;
#define Max 110000
struct task{
    char name[20];
    int time;
};
task tasks[Max];
int head=0,tail=0;
bool IsEmpty(){
    return head==tail;
}
bool IsFull(){
    return head==(tail+1)%100;
}
void push(task t){
    tasks[tail]=t;
    tail++;
    if (tail==Max)tail=0;
}
task pop(){
    task temp;
    temp=tasks[head];
    head=(head+1)%Max;
    return temp;
}
int main()
{
    int n,slice;
    cin>>n>>slice;
    task temp;
    for(int i=0;i<n;i++){
        cin>>temp.name>>temp.time;
        push(temp);
    }
    int PreTime=0;
    while(!IsEmpty()){
        temp=pop();
        if(temp.time>slice){
            temp.time-=slice;
            push(temp);
            PreTime+=slice;
        }
        else {
            PreTime+=temp.time;
            cout<<temp.name<<" "<<PreTime<<endl;

        }

    }
    return 0;
}



Measured memory_bytes: 5572
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

int main() {
	string s;
	cin >> s;

	int n = s.size();
	vector<int> v(n + 2);

	REP(i, n) {
		v[i] = s[n - i - 1] - '0';
	}

	int list[10] = { 0,1,2,3,4,5,4,3,2,1 };

	int dp[2];

	int cnt = 0;
	REP(i, n + 1) {
		if (9 < v[i]) {
			v[i + 1]++;
			v[i] -= 10;
		}


		cnt += list[v[i]];
		if (5 < v[i] || (v[i] == 5 && 5 <= v[i + 1])) {
			v[i + 1]++;
		}
	}
	cout << cnt;



	return 0;
}

Measured memory_bytes: 5252
#include<bits/stdc++.h>
using namespace std;
 
#define int             long long
#define ld              long double
#define fi              first
#define se              second
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define fo(i,n)         for(i=0; i<n; i++)
#define fo1(i,n)        for(i=1; i<=n; i++)
#define Fo(i,k,n)       for(i=k; k<=n?i<=n:i>=n; k<=n?i++:i--)
#define all(x)          x.begin(), x.end()
#define rall(x)         x.rbegin(), x.rend()
#define sortall(x)      sort(all(x))
#define sortrall(x)     sort(rall(x))
#define clr(x)          memset(x, 0, sizeof(x))
#define tr(it, a)       for(auto it = a.begin(); it != a.end(); it++)
#define pii             pair<int, int>
#define mk(arr,n,type)  type *arr = new type[n];
#define vi              vector<int>
#define si              set<int>
#define usi             unordered_set<int>
#define mii             map<int, int>
#define umii            unordered_map<int, int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int, vi, greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define trailzrobits(x) __builtin_ctzll(x)
#define leadzrobits(x)  __builtin_clzll(x)
#define paritybits(x)   __builtin_parityll(x)
#define gcd             __gcd
#define lcm(x, y)       (x * y) / gcd(x, y)
#define mod             1000000007
#define endl            '\n'
#define PI              3.1415926535897932384626
#define inf             1e18
#define sp(x,y)         fixed<<setprecision(y)<<x
void __print(int32_t x) {cout<<x;}
void __print(int x) {cout<<x;}
void __print(ld x) {cout<<x;}
void __print(double x){cout<<x;}
void __print(float x){cout<<x;}
void __print(bool x) {cout<<(x?"true":"false");}
void __print(char x){cout <<'\''<<x<<'\'';}
void __print(const char *x){cout <<'\"' <<x<<'\"';}
void __print(const string &x) {cout<<'\"'<<x<<'\"';}
template<typename T,typename V>     void __print(const pair<T,V> &x) {cout<<'{';__print(x.first);cout<<',';__print(x.second);cout<<'}';}
template<typename T>                void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}void _print() {cout << "]\n";}
template <typename T,typename... V> void _print(T t, V... v) {__print(t);if(sizeof...(v))cout<<", ";_print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_print(x)
#else 
#define dbg(x...)
#endif
int power(int base, int exp){ int res = 1; base %= mod; while(exp > 0){ if(exp & 1) res = (res * base) % mod; base = (base * base) % mod; exp = exp >> 1; } return res; }
int inv(int x){ return power(x, mod - 2) % mod; }
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




const int N = 1e6 + 6, M = N;
int i, j;

void solve(){
    
    int n; cin>>n;
    string s;
    
    while(n>0){
        n--;
        s+=char('a'+n%26);
        n=n/26;
    }
    reverse(all(s));
    cout<<s<<endl;
    
    
}




int32_t main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int t = 1;
    // cin >> t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
using namespace std;
int main()
{
	int H, W, i, j;
	while(1){
		cin >> H >> W;
		if(W == 0 & H == 0)
			break;
		
		for( i = 0; i < H; i++){
			for( j = 0; j < W; j++){
				if((i + j) % 2 == 0){
					cout << "#";
				}else{
					cout << ".";
				}
			}
				cout << endl;
			}
			cout << endl;
		}
	return 0;
}
				

Measured memory_bytes: 1152
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,k = iim()
ans = 0
for i in range(1,min(k,n+1)):
    num = i
    cnt = 0
    while num<k:
        cnt += 1
        num *= 2
#    print(0.5**cnt)
    ans += 0.5**cnt

ans += max(n-k+1,0)
print(ans/n)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int inf = 100100;

int main() {
  ll n;
  cin >> n;
  map<string,ll> m;
  for(ll i=0;i<n;i++){
    string s;
    cin >> s;
    sort(s.begin(),s.end());
    m[s]++;
  }
  
  ll cnt=0;
  for(auto x : m){
    auto value = x.second;
    if(value != 0){
	  cnt += value*(value-1)/2;
    }
  }
  
  cout << cnt << endl;
  return(0);
}

Measured memory_bytes: 11388
#include <iostream>
#include <algorithm> 
#include <cstring>
#include <cmath>
#include <queue>
using namespace std;

using ll = long long;

int n;
bool check(int arr1[], int arr2[]) {
	for (int i = 0; i < n; i++) 
		if (arr1[i] != arr2[i])
			return false;
	return true;
}

int main() {
	cin >> n;
	int a[10], b[10];
	int tmp[10];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++)
		cin >> b[i];
	for (int i = 0; i < n; i++)
		tmp[i] = a[i];
	sort(tmp, tmp + n);
	int cnt = 0;
	do {
		cnt++;
		if (check(tmp, a)) {
			break;
		}
	} while (next_permutation(tmp, tmp + n));
	int cnt2 = 0;
	for (int i = 0; i < n; i++)
		tmp[i] = b[i];
	sort(tmp, tmp + n);
	do {
		cnt2++;
		if (check(tmp, b)) {
			break;
		}
	} while (next_permutation(tmp, tmp + n));
	cout << abs(cnt - cnt2);
	return 0;
}


Measured memory_bytes: 256
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
x, y = M()
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
# c = [2]
if (x in a and y in a) or (x in b and y in b) or x==y:
    print('Yes')
else:
    print('No')

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

using namespace std;

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

using _loop_int = 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 CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int n;
int h[125252];
int ans[125252];

int main(){
    scanf("%d",&n);
    REP(i,n)scanf("%d",h+i);
    int po =0;
    FORR(i,0,n-1){
        if(h[i]>=h[i+1])ans[i]=ans[i+1]+1;
        CHMAX(po, ans[i]);
    }
    cout<<po<<endl;
    return 0;
}


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

Measured memory_bytes: 3084
def main():
    n, m, x, y = map(int, input().split())
    dx = map(int, input().split())
    dy = map(int, input().split())

    max_x = max(list(dx))
    min_y = min(list(dy))

    z = x + 1
    while z <= y:
        if z > max_x and z <= min_y:
            # print("No War", z)
            print("No War")
            exit()
        z += 1
    print("War")


def main2():
    n, m, x, y = map(int, input().split())
    dx = map(int, input().split())
    dy = map(int, input().split())

    dx = list(dx)
    dy = list(dy)

    dx.append(x)
    dy.append(y)

    if max(dx) < min(dy):
        print("No War")
    else:
        print("War")


if __name__ == '__main__':
    main2()


Measured memory_bytes: 3064
N = int(input())
counter = 0

def dfs(cur, use):
  global counter

  if cur > N:
    return

  if use == 0b111:
    counter += 1

  dfs(cur * 10 + 7, use | 0b001)
  dfs(cur * 10 + 5, use | 0b010)
  dfs(cur * 10 + 3, use | 0b100)

dfs(0, 0b000)
print(counter)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
int main()
{
    int r,g,b;
    while(~scanf("%d%d%d",&r,&g,&b))
    {
        if((r*100+g*10+b)%4==0) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 256