akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    int mod = 1000000007;

    public void Do()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int K = cin.nextInt();

        long[,] DP = new long[N + 1, N + 1];
        DP[0, 0] = 1;
        for (int i = 1; i <= N; i++)
        {
            for (int j = 0; j <= i; j++)
            {
                DP[i, j] = DP[i - 1, j];
                if (j - 1 >= 0)
                {
                    DP[i, j] = (DP[i, j] + DP[i - 1, j - 1]) % mod;
                }
            }
        }

        for (int i = 1; i <= K; i++)
        {
            Console.WriteLine(((DP[K - 1, i - 1] * DP[N - K + 1, i]) % mod));
        }
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}


Measured memory_bytes: 41952
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  char S;
  cin >> N;
  for (int i=0; N > i; i++){
    cin >> S;
    if (S == 'Y'){
      cout << "Four" << endl;
      break;
    }
    else if(N-1 == i){
      cout << "Three" << endl;
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
int main(){
    int n;
    std::vector<int> v;
    std::cin>>n;
    for(int i=0;i<n;i++){
        int x;
        std::cin>>x;
        v.push_back(x);
    }
    int cnt=0;
   for (int i=1;i<n;i++) {
       for(int j=0;j<n;j++){
           std::cout<<v[j];
           if(j!=n-1)std::cout<<" ";
       }
       std::cout<<"\n";
    int tmp=v[i];
    if(v[i-1]>tmp) {
        int  j=i;
        do {
            v[j]=v[j-1];
            j--;
        } while (j>0 && v[j-1]>tmp);
        v[j]=tmp;
       }
       
        
   }
   for(int i=0;i<n;i++){
       std::cout<<v[i];
       if(i!=n-1)std::cout<<" ";
   }
   std::cout<<"\n";
}





Measured memory_bytes: 3168
NM = list(map(int, input().split()))
A = list(map(int, input().split()))

sou_tokuhyousuu = sum(A)
count = 0
for i in A:
    if sou_tokuhyousuu / (4 * NM[1]) <= i:
        count += 1

if NM[1] <= count:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cctype>
using namespace std;
typedef long long lint;
#define cout cerr
#define ni (next_num<int>())
template<class T>inline T next_num(){
	T i=0;char c;
	while(!isdigit(c=getchar())&&c!='-');
	bool flag=c=='-';
	flag?(c=getchar()):0;
	while(i=i*10-'0'+c,isdigit(c=getchar()));
	return flag?-i:i;
}
const int N=1010,O=1000000007;
struct Mat{
	const static int D=3;
	int a[D][D];
	inline friend Mat operator * (const Mat &a,const Mat &b){
		Mat c;
		for(int i=0;i<D;i++){
			for(int j=0;j<D;j++){
				lint tmp=0;
				for(int k=0;k<D;k++){
					tmp+=(lint)a.a[i][k]*b.a[k][j]%O;
				}
				c.a[i][j]=tmp%O;
			}
		}
		return c;
	}
	inline void fpow(Mat &res,int n){
		if(n==0){
			res=(Mat){1,0,0,0,1,0,0,0,1};
			return;
		}
		fpow(res,n>>1);
		res=res*res;
		if(n&1){
			res=res**this;
		}
	}
}trans1={1,2,1,0,1,1,1,2,2},trans2=(Mat){1,2,1,0,1,1,0,0,1};
int main(){
	int n=ni,m=ni,x=0;
	Mat ans,tmp;
	tmp.fpow(ans,0);
	for(int i=1,j;i<=m;i++){
		trans1.fpow(tmp,(j=ni)-x-1);
		ans=trans2*tmp*ans;
		x=j;
	}
	trans1.fpow(tmp,n-x-1);
	ans=tmp*ans;
	printf("%lld\n",((lint)ans.a[0][2]+(ans.a[1][2]<<1)+ans.a[2][2])%O);
	return 0;
}

Measured memory_bytes: 256
s = input()

g = 0;p = 0
total = 0

for i in range(len(s)):
    if s[i] == 'g':
        if p < g:
            p += 1
            total += 1
        else:
            g += 1
    elif s[i] == 'p':
        if p < g:
            p += 1
        else:
            g += 1
            total -= 1

print(total)

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> p(n), idx(n);
    for (int i = 0; i < n; ++i) {
        cin >> p[i];
        idx[p[i] - 1] = i;
    }
    set<int> se;
    se.insert(-1);
    se.insert(idx[n - 1]);
    se.insert(n);
    long long ans = 0;
    for (int i = n - 2; i >= 0; --i) {
        auto itr = se.lower_bound(idx[i]);
        int r1 = *itr;
        ++itr;
        int r2 = itr == se.end() ? n : *itr;
        ----itr;
        int l1 = *itr;
        int l2 = itr == se.begin() ? -1 : *--itr;
        ans += ((r2 - r1) * (long long)(idx[i] - l1) + (l1 - l2) * (long long)(r1 - idx[i])) * (i + 1);
        se.insert(idx[i]);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 5760
n = int(input())
if n==1:
  print(0)
  exit()
def fac(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
su = 0
#print(fac(n))
for j,k in fac(n):
  n = int(0.5*(-1+(1+8*k)**0.5))
  su += n
 # print(k,n)
print(su)

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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

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

#define i5 100002

int main(){
	int n, m, a[i5], b[i5], c[i5];
	ll ans=0;
	cin >> n >> m;
	rep(i, n) cin >> a[i];
	rep(i, m) cin >> b[i] >> c[i];

	priority_queue<pair<int, int>> q;
	rep(i, n){
		q.push(make_pair(a[i], 1));
	}
	rep(i, m){
		q.push(make_pair(c[i], b[i]));
	}

	rep(i, n){
		auto p = q.top();
		q.pop();
		ans += p.first;
		if(p.second > 1){
			--p.second;
			q.push(p);
		}
	}

	cout << ans << endl;

	return 0;
}

// ================================================
//
// AtCoder Beginner Contest 127 解説放送
// https://www.youtube.com/watch?v=SS6kW-d-rJ0
// より
//
// ================================================


Measured memory_bytes: 4596
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    last = A[-1]
    now = 1
    cum = [last]*(N+1)
    for i in range(N-2,-1,-1):
        cum[i] = cum[i+1]+A[i+1]
    if 1<A[0]:
        return -1
    if N == 0:
        return 1
    now -= A[0]
    for i in range(1,N):
        now *= 2
        if now<A[i] or now==0:
            return -1
        now = min(cum[i],now-A[i])
        ans += now+A[i]
    if now*2 < last:
        return -1
    return ans + last
print(solve())


Measured memory_bytes: 20860
#include <bits/stdc++.h>
using namespace std;
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#define int long long
#define pi pair<int,int>
#define ff first
#define ss second
#include "string"

const int M = 1e9 + 7;
int32_t main(){
	boost;
	int n,k;
	cin>>n>>k;
	vector<int>g[n+1];
	for(int i=1,u,v;i<n;i++){
		cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
	}	

	int dp[n+1];
	fill_n(dp,n+1,k);

	function < void(int,int) > dfs = [&](int u,int p) {
		vector<int>ve;
		for(int v:g[u]){
			if(v == p)
				continue;
			ve.push_back(v);
			dp[v]--;
			if(p != 0)
				dp[v]--;
		}

		for(int i=0;i<ve.size();i++)
			dp[ve[i]] -= i;

		for(int v: g[u]){
			if(v == p)
				continue;
			dfs(v,u);
		}
	};

	dfs(1,0);
	int ans = 1;
	for(int i=1;i<=n;i++)
		ans = (ans * (dp[i]>0?dp[i]:0) ) % M;
	cout<<ans<<endl;
}



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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

#define faster ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define read freopen("in.txt", "r", stdin)
#define write freopen("out.txt", "w", stdout)
#define mem(x, n) memset(x, n, sizeof(x))
#define all(x) x.begin(), x.end()
#define endl "\n"

const int limit = 1e5 + 5;

int p[limit];

int get(int u) {
	if (u != p[u]) {
		p[u] = get(p[u]);
	}
	return p[u];
}

void Union(int a, int b) {
	a = get(a), b = get(b);
	if (a == b)
		return;

	p[a] = b;
}

int main() {
	faster;

	for (int i = 0; i < limit; i++) {
		p[i] = i;
	}

	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		Union(a, b);
	}
	int cnt = 0;

	for (int i = 1; i <= n; i++) {
		if (i == p[i]) {
			cnt++;
		}
	}

	cout << cnt-1 << endl;

	return 0;
}

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

int main(){
    int r, c, L[101][101];
    cin >> r >> c;
    
    
    
    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++){
            cin >> L[i][j];
        }
    }
    
    for(int i=0; i<= r; i++){
        L[i][c] =0;
    }
    for(int j=0; j<= c; j++){
        L[r][j] =0;
    }
    
    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++){
            L[i][c]+=L[i][j];
            L[r][j]+=L[i][j];
            L[r][c]+=L[i][j];
        }
    }
    
    for(int i=0;i<=r; i++){
        for(int j=0; j<=c; j++){
            
            if(j){
                cout << " ";
            }
            cout << L[i][j] ;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3116
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans=0
for i in range(N):
	ans+=B[A[i]-1]
	if(i > 0 and A[i]-A[i-1] == 1):
		ans+=C[A[i-1]-1]
print(ans)


Measured memory_bytes: 3060
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    H = len(inputs)
    W = len(inputs[0])
    alter = inputs
    count_dot = 0
    reached_alter = []
    for line in alter:
        a = []
        for mass in line:
            if mass == ".":
                count_dot += 1
            a.append(False)
        reached_alter.append(a)
    queue = deque([[0, 0, 0]])

    min = -1
    while len(queue) > 0:
        [x, y, step_num] = queue.popleft()
        if x == -1 or x == W or y == -1 or y == H:
            continue
        if x == W - 1 and y == H - 1:
            min = step_num
            break
        if alter[y][x] == "#" or reached_alter[y][x]:
            continue
        reached_alter[y][x] = True

        queue.append([x - 1, y, step_num + 1])
        queue.append([x + 1, y, step_num + 1])
        queue.append([x, y - 1, step_num + 1])
        queue.append([x, y + 1, step_num + 1])

    if min == -1:
        return -1
    return count_dot - min - 1


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    [H, W] = string_to_int(input())
    ret = solve(inputs(H))
    print(ret)


Measured memory_bytes: 3316
MOD = 2019  # これなにげに3の倍数だからいつも見たいなMODの演算が通用しない笑
L, R = list(map(int, input().split()))

# このコーナーケースに注意
if (R - L) >= MOD:
    print(0)
    exit()

# Lをなるべく0に近づける
L %= MOD
# RをなるべくLに近づけてみる
R %= MOD
if R <= L:
    R += MOD

# print(L, R)
ans = 2**16
for i in range(L, R):  # i<jが成り立つ範囲に注意
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % MOD)
print(ans)

Measured memory_bytes: 42092
#include <stdio.h>
#include <string.h>
#include <math.h>
#pragma warning(disable : 4996)

int main()
{
    long long a[100000];
    long long p = 1000000000000000000;
    long n;
    scanf("%ld", &n);

    for (int i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
    }

        for (int i = 0; i < n; i++){
            if (a[i] == 0) {
                printf("0");
                return 0;
            }
    }

    long long ans = 1;

    for (int i = 0; i < n; i++) {
        if (a[i] <= p / ans) {
            ans *= a[i];
        }
        else {
            printf("-1");
            return 0;
        }
    }

    printf("%lld", ans);

    return 0;

}

Measured memory_bytes: 2900
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		List<Integer> a = new LinkedList<>();
		for (int i = 1; i <= N; i++) {
			a.add(scanner.nextInt());
		}
		a.sort(Comparator.reverseOrder());
		int A, B;
		A = 0;
		B = 0;
		for (int i = 1; i <= N; i++) {
			if (i % 2 != 0) {
				A += a.get(0);
			} else {
				B += a.get(0);
			}
			a.remove(0);
		}
		System.out.println(A - B);
	}

}


Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve();
        }

        void Solve()
        {
            var t = Console.ReadLine().Split().Select(_x => int.Parse(_x)).ToArray();
            int a = t[0];
            int b = t[1];
            int n = b - a - 1;
            var x = n * (n + 1) / 2 - a;
            Console.WriteLine(x);
        }

    }
}


Measured memory_bytes: 13396
import math
A, B=map(int, input().split())

if B==1:
  print(0)
else:
  if math.ceil(B/A)==1:
    print(1)
  else:
    if (B-A)%(A-1)==0:
      print((B-A)//(A-1)+1)
    else:
      print((B-A)//(A-1)+2)
  

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

#define for_loop_forward(iterator, size) for (int iterator = 0; iterator < size; iterator++)
#define for_loop_backward(iterator,size) for (int iterator = size - 1; iterator >= 0; iterator--) 

typedef unsigned long long int bigint; //big int 

/* 
-------------------------------- 
    declaring dynamic  array: 
    int* ary = new int[size]; 
-------------------------------------- 
 declaring dynamic 2d array: 
    int **ary = new int*[sizeY]; 
    for (int i = 0; i < sizeY; i++) { 
    ary[i] = new int[sizeX]; 

    deleting memory to prevent memory leak 
    for (int i = 0; i < length; ++i) { 
        delete[] grid[i]; 
    } 
    delete[] grid; 
------------------------------------------- 
 */ 

 
int main() 
{ 
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;

  if(a==0){
cout<<"1"<<endl;
  }
  else if(b==0){
cout<<"2"<<endl;
  }else if(c==0){
    cout<<"3"<<endl;
  }else if(d==0){
    cout<<"4"<<endl;
  }else if(e==0){
    cout<<"5"<<endl;
  }else{
    cout<<""<<endl;
  }

     return 0; 

} 

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    string s;
    int n;
    cin>>n>>s;
    int x=0,y=0;
    rep(i,n){
        if(s[i]=='I') y++;
        else y--;
        x=max(x,y);
    }
    cout<<x;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <iomanip>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

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

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n ;
  int ans,M=0,num;
  rep(i,n){
    int a,b;
    cin>>a>>b;
    if(a>M){
      M=a;
      num=b;
    }
  }
  ans=M+num;
  cout << ans <<endl;
}

Measured memory_bytes: 256
gets
arr = Array.new(2000, false)
a = gets.split(" ").map(&:to_i).sort
a.each {|item|
  arr.each_with_index{|i, idx|
    if i and idx - item >= 0
      arr[idx - item] = true
    end
  }
  arr[-item] = true
}
arr.reverse!
gets
m = gets.split(" ").map(&:to_i)
m.each{|i|
  if arr[i - 1]
    puts "yes"
  else
    puts "no"
  end
}

Measured memory_bytes: 6124
#define MOD 1000000007

#include <iostream>
#include <utility>
#include <vector>
using namespace std;

long pow(long a, long b) {
	if (b == 0) return 1;
	long c = pow(a, b / 2);
	if (b % 2) c = a * c % MOD * c % MOD;
	else c = c * c % MOD;
	return c;
}

int main() {
	long N, K;
	cin >> N >> K;
	vector<long> a(2001, 1), b(2001, 1);
	for (int i = 1; i <= 2000; i++) {
		a[i] = a[i - 1] * i % MOD;
		b[i] = pow(a[i], MOD - 2);
	}
	for (long i = 1; i <= K; i++) {
		pair<long, long> c{ N - K + 1, i }, d{ K - 1, i - 1 };
		if (c.first < c.second) cout << 0;
		else {
			long e = a[c.first] * b[c.first - c.second] % MOD * b[c.second] % MOD;
			long f = a[d.first] * b[d.first - d.second] % MOD * b[d.second] % MOD;
			cout << e * f % MOD;
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>

int main(){
  int retval = 2018;
  int L, R; cin >> L >> R;
  for (int i=L;i<=R;i++){
    for (int j=i+1;j<=R;j++){
      retval = min(retval, ((i%2019)*(j%2019))%2019);
      if (retval==0) break;
    }
    if (retval==0) break;
  }
  cout << retval << endl;
  
  // cout << fixed << setprecision(10);
  
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000000
typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<ii,ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
#define getbit(n,i) (((n)&(1<<(i)))!=0)
#define setbit0(n,i) ((n)&(~(1<<(i))))
#define setbit1(n,i) ((n)|(1<<(i)))
#define togglebit(n,i) ((n)^(1<<(i)))
#define lastone(n) ((n)&(-(n)))
#define read freopen("debug\\in.txt","r",stdin)
#define write freopen("debug\\out.txt","w",stdout)
#define fi first
#define se second
#define getI(a) scanf("%d",&a)
#define getII(a,b) scanf("%d%d",&a,&b)
#define PI (acos(-1))
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod (1000000007)
#define asz 500005
#define pb push_back
#define ppf pop_front
#define ppb pop_back
#define pf push_front
ll dp[200][200005];
ll weight[200005];
ll val[200005];   
int main()
{

    ll n,i,j,k,l,W;
    scanf("%lld%lld",&n,&W);
    for(i=1;i<=n;i++){
    	scanf("%lld%lld",&weight[i],&val[i]);
	}
	for(i=0;i<=n;i++){
		for(j=0;j<=W;j++){
			if(j==0)
			dp[i][j]=0;
			else
			dp[i][j]=-1;
		}
	}
	ll sum=0;
	for(i=1;i<=n;i++){
		sum+=weight[i];
		for(j=1;j<=min(sum,W);j++){
			if(j-weight[i]>=0&&dp[i-1][j-weight[i]]!=-1){
				if(dp[i-1][j]!=-1){
					dp[i][j]=max(dp[i-1][j],dp[i-1][j-weight[i]]+val[i]);
				}
				else{
					dp[i][j]=dp[i-1][j-weight[i]]+val[i];
				}
			}
			else{
			   	if(dp[i-1][j]!=-1){
					dp[i][j]=dp[i-1][j];
				}	
			}
		}
	}
	ll maxi=-1;
	for(i=1;i<=n;i++){
		for(j=1;j<=W;j++){
			maxi=max(dp[i][j],maxi);
		}
	}
	printf("%lld",maxi);
    return 0;
}

Measured memory_bytes: 160000
case = "".join([chr(i) for i in range(97, 123)])
def case_26(n):
    ans = ""
    while n >= 26:
        ans += case[n%26]
        n = n//26 - 1
    ans += case[n]
    return ans
n = int(input())
print(case_26(n-1)[::-1])

Measured memory_bytes: 61688
import java.util.*;

public class Main {	
	
	Scanner sc = new Scanner(System.in);
	
	
	void run() {
		int N = sc.nextInt();
		String []in1 = new String[N];
		String []in2 = new String[N];
		for (int i = 0; i < N; i++) {
			String s = sc.next();
			in1[i] = s;
			in2[i] = s;
		}
		bubble(in1, N);
		selection(in2, N);
		System.out.println(match(in1, in2) ? "Stable" : "Not stable");
		
	}
	
	void bubble(String A[], int N) {
		for (int i = 0; i < N; i++) {
			for(int j = N-2; j >= i;j--) {
				if(A[j].charAt(1) > A[j+1].charAt(1)) {
					String t = A[j];
					A[j] = A[j+1];
					A[j+1] = t;
				}
			}
		}
		for (int i = 0; i < N; i++) {
			System.out.print((i == 0 ? "" : " ")+ A[i]);
		}
		System.out.println();
		System.out.println("Stable");
	}
	
	void selection(String A[], int N) {
		for (int i = 0; i < N ; i++) {
			int min = i;
			for(int j = i + 1; j < N; j++) {
				if (A[min].charAt(1) > A[j].charAt(1)) {
					min = j;
				}
			}
			String t = A[i];
			A[i] = A[min];
			A[min] = t;
		}
		for (int i = 0; i < N; i++) {
			System.out.print((i == 0 ? "" : " ") + A[i]);
		}
		System.out.println();
	}
	
	boolean match(String[] s1, String[] s2) {
		for (int i = 0; i < s1.length; i++ ) {
			if(!s1[i].equals(s2[i])) {
				return false;
			}
		}
		return true;
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
	
}


Measured memory_bytes: 26292
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <unordered_map>
using namespace std;

typedef long long llong;
// -2.1e-9 <= int <= 2.1e9

int main()
{
    vector<int> A(3, 0);
    cin >> A[0] >> A[1] >> A[2];
    sort(A.begin(), A.end());
    int cnt = 1;
    for (size_t i=1; i<=2; i++) {
        if (A[i-1] == A[i]) {
            cnt++;
        }
    }
    if (cnt == 2) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


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

int main()
{
  int n; cin>>n;
  vector<int> a(n, 0);
  rep(i, n) cin>>a[i];
  int q; cin>>q;
  vector<int> m(q, 0);
  rep(i, q) cin>>m[i];
  set<int> st;
  rep(bits, 1<<n) {
    int sum = 0;
    rep(i, n) if (bits>>i&1) sum+=a[i];
    st.insert(sum);
  }
  rep(i, q) {
    if (st.count(m[i])) cout << "yes" << endl;
    else cout << "no" << endl;
  }

  return 0;
}



Measured memory_bytes: 3116
(function(input) {
    var p = input.replace(/\n$/, '').split('\n');
    for (var i = 0; i < p.length; i++) {
        var args = p[i].split(' ').map(Number);
        var sum = args.reduce(function(a, b) {
            return a + b;
        });
        console.log(String(sum).length);
    }
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 8964
import math
N,D = map(int,input().split())
X = []
ans = 0
for i in range(N):
    X.append(list(map(int,input().split())))
for i in range(N):
    for j in range(i+1,N):
        distance = 0
        for k in range(D):
            distance += (X[i][k] - X[j][k]) ** 2
        if math.sqrt(distance).is_integer():
            ans += 1
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define M 1000000007
#define MAX_SIZE 200005
using namespace std;

vector<ll> fac(MAX_SIZE); //n!(mod M)
vector<ll> ifac(MAX_SIZE); //k!^{M-2} (mod M)

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1; // n = n/2
    }
    return ans;
}
void init_comb(){
	fac[0] = 1;
	ifac[0] = 1;
	for(ll i = 1; i<MAX_SIZE; i++){
		fac[i] = fac[i-1]*i % M; // n!(mod M)
		ifac[i] = ifac[i-1] * mpow(i, M-2) % M; // k!^{M-2} (mod M)
	}
}
ll combination(ll n,ll m){
	if(m==n || m==0) return 1;
	ll tmp = fac[n] * ifac[m] % M;
	return tmp * ifac[n-m] % M;
}
ll mdev(ll a,ll b){
	return a * mpow(b,M-2) % M;
}

struct Info{
	ll cmb;
	ll t;
	Info(ll cmb=1,ll t=0):cmb(cmb),t(t){}
	Info operator+(Info a){
		ll tmp_cmb = cmb * a.cmb % M;
		return Info(tmp_cmb * combination(t+a.t,t) % M, t+a.t);
	}
	Info operator-(Info a){
		ll tmp_cmb = mdev(cmb,a.cmb);
		return Info(mdev(tmp_cmb,combination(t,t-a.t)), t-a.t);
		// return Info(tmp_cmb, t-a.t);
	}
	Info includeRoot(){
		return Info(cmb,t+1);
	}

};

vector<ll> graph[MAX_SIZE];
Info infov[MAX_SIZE];

Info dfs(ll i,ll parent_i){

	Info info;
	for(int j=0;j<graph[i].size();j++){
		ll child_i = graph[i][j];
		if(child_i==parent_i) continue;
		info = info + dfs(child_i,i).includeRoot();
	}
	infov[i] = info;
	return info;
}

void reverse_dfs(ll i,ll parent_i){
	if(parent_i>=0){
		Info rparent = infov[parent_i] - infov[i].includeRoot();
		infov[i] = infov[i] + rparent.includeRoot();

	}
	for(int j=0;j<graph[i].size();j++){
		ll child_i = graph[i][j];
		if(child_i==parent_i) continue;
		reverse_dfs(child_i,i);
	}
}

int main() {
	init_comb();
    ll N,a,b;
	
	cin >> N;

	for(ll i=0;i<N-1;i++){
		cin >> a >> b;
		a--;
		b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	dfs(0,-1);
	reverse_dfs(0,-1);
	for(int k=0;k<N;k++){
		
		cout << infov[k].cmb << endl;
		// cout<<"----------------------"<<endl;
		// for(int i=0;i<N;i++){
		// 	cout<<" "<<infov[i].cmb<< " " << infov[i].t << endl;
		// }
	}


	


    return 0;
}



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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

const int mod = 1000000007;

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    ll ans = 0;
    ll ma = A[0];
    for (ll a: A) {
        if (a < ma) ans += ma - a;
        chmax(ma, a);
    }

    cout << ans << endl;
}


Measured memory_bytes: 4816
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int t[6];
int p,q,all;
int b[6];
int d[6];
bool flag,flag2;
char res[30001];
char now[30001];
char str[4]={'E','N','S','W'};

bool check(){
	if(d[0]<0 || d[1]<0 || d[2]<0 || d[3]<0 || d[4]<0 || d[5]<0)return false;
	if(d[0]+d[3]>d[1]+d[2]+d[4]+d[5])return false;
	if(d[1]+d[4]>d[0]+d[2]+d[3]+d[5]+1)return false;
	if(d[2]+d[5]>d[0]+d[1]+d[3]+d[4]+1)return false;
	return true;
}

bool check2(){
	for(int i=0;i<q;i++){
		if(res[i]>now[i])return true;
		if(now[i]>res[i])return false;
	}
	return false;
}

void roll(int v){
	if(v==0){
		int sw=d[0];
		d[0]=d[2];
		d[2]=d[3];
		d[3]=d[5];
		d[5]=sw;
	}
	if(v==2){
		int sw=d[0];
		d[0]=d[1];
		d[1]=d[3];
		d[3]=d[4];
		d[4]=sw;
	}
	if(v==1){
		int sw=d[0];
		d[0]=d[4];
		d[4]=d[3];
		d[3]=d[1];
		d[1]=sw;
	}
	if(v==3){
		int sw=d[0];
		d[0]=d[5];
		d[5]=d[3];
		d[3]=d[2];
		d[2]=sw;
	}
}

void dfs(int rest,int power){
	if(flag2)return;
	if(rest==0){
		flag2=true;
		if(!flag){
			flag=true;
			for(int i=0;i<all;i++)res[i]=now[i];
		}else if(check2()){
			for(int i=0;i<all;i++)res[i]=now[i];
		}
	}
	for(int i=0;i<4;i++){
		roll(i);
		d[3]--;
		if(check()){
			now[all-rest]=str[i];
			if(power==0){
				if(str[i]==res[all-rest])dfs(rest-1,0);
				if(str[i]<res[all-rest])dfs(rest-1,1);
			}
			else dfs(rest-1,1);
		}
		d[3]++;
		if(i==0)roll(3);
		if(i==3)roll(0);
		if(i==1)roll(2);
		if(i==2)roll(1);
	}
}

int main(void){
	for(int i=0;i<6;i++)b[i]=i;
	while(1){
		all=0;
		for(int i=0;i<6;i++){
			scanf("%d",&t[i]);
			all+=t[i];
		}
		if(all==0)break;
		flag=false;
		scanf("%d %d",&p,&q);
		do{
			for(int i=0;i<6;i++){
				d[i]=t[b[i]];
			}
			if(check()){
				flag2=false;
				if(!flag)dfs(all,1);
				else dfs(all,0);
			}
		}while(next_permutation(b,b+6));
		if(!flag)printf("impossible\n");
		else{
			for(int i=p-1;i<q;i++){
				printf("%c",res[i]);
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 2944
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) std::memset(arg,n,sizeof(arg))
#define mp std::make_pair
#define pb push_back
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::string str;
const int INF=1e+9;
const ll INFLL=1e+17;
const ll MOD=1e+9+7;
int N,K;
int V[60];
int main(){
  cin>>N>>K;
  rep(i,N) cin>>V[i];
  int min=std::min(N,K);
  int res=-INF;
  rep(l,min+1){
    rep(r,min-l+1){
      vi v;
      int cnt=0,sum=0;
      rep(i,l){
	v.pb(V[i]);
	sum+=V[i];
	if(V[i]<0) cnt++;
      }
      rep(i,r){
	v.pb(V[N-1-i]);
	sum+=V[N-1-i];
	if(V[N-1-i]<0) cnt++;	
      }
      std::sort(v.begin(),v.end());
      int mmin=std::min(cnt,K-l-r);
      rep(i,mmin){
	sum-=v[i];
      }
      res=std::max(res,sum);
    }
  }
  prin(res);
  return 0;
}


Measured memory_bytes: 256
/*-- ILSH  --*/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef double ld;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < ll >
#define vll vector < ll > 
#define dt cout<<"HERE\n";
#define pii pair < ll , ll >
#define pll pair < ll , ll >
#define vpi vector < pii >
#define vpl vector < pll >
#define fi first
#define se second 
#define sz size 
#define len length 
const ll inf=1e18+1e17;
const ll mod =1e9+7;
using cd= complex < double > ;
//const ll mod = 998244353;
ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=(a*a)%mod;b>>=1;}return (res%mod);}
const ll N = 2e5+5;
void solve(){
	int n,m,p;
	cin>>n>>m>>p;
	string s[n];
	for ( int i=0;i<n;i++)
		cin>>s[i];
	int ans=0;
	for ( int i=0;i<(1<<n);i++){
		for ( int j=0;j<(1<<m);j++){
			int cnt=0;
			for ( int k=0;k<n;k++){
				for ( int l=0;l<m;l++){
					if ( ((1<<k)&i)&&(( 1<<l)&j)&&s[k][l]=='#' )
						cnt++;
				}
			}
			if ( cnt==p)
				ans++;
		}
	}
	cout<<ans<<'\n';
}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie( NULL);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen ("INPUT.txt" , "r" , stdin);
		freopen ("OUTPUT.txt", "w" , stdout);
	#endif
	ll t=1;
	//cin>>t;
	for ( ll i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
    	solve();
    }
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	int n,K;cin>>n>>K;
	ll A,B;
	vector<P> a(n);
	for(int i = 0; i < n; i++) {
		cin>>A>>B;
		a[i] = mp(A,B);
	}
	ll ans = 5 * LINF;
	for(int i = 0; i < n; i++) {
		ll x1 = a[i].fs,y1 = a[i].sc;
		for(int j = 0; j < n; j++) {
			ll x2 = a[j].fs,y2 = a[j].sc; 
			for(int k = 0; k < n; k++) {
				ll x3 = a[k].fs,y3 = a[k].sc;
				for(int l = 0; l < n; l++) {
					ll x4 = a[l].fs,y4 = a[l].sc;
					ll x_min = min(x1,min(x2,min(x3,x4)));
					ll x_max = max(x1,max(x2,max(x3,x4)));
					ll y_min = min(y1,min(y2,min(y3,y4)));
					ll y_max = max(y1,max(y2,max(y3,y4)));
					int count = 0;
					for(int m = 0; m < n; m++) {
						if(a[m].fs >= x_min && a[m].fs <= x_max && a[m].sc >= y_min && a[m].sc <= y_max){
							count++;
						}
					}
					if(count >= K){
						// cout << count << endl;
						// cout << x_max << " " << x_min << " " << y_max << " " << y_min << endl;
						ans = min(ans,(abs(x_max - x_min) * abs(y_max - y_min)));
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using ll = long long;
using ull = unsigned long long;

int main(){
    unsigned N, answer = 0;
    ll D;
    scanf("%u %lld", &N, &D);
    for (unsigned i = 0; i < N; i++){
        ll X, Y;
        scanf("%lld %lld", &X, &Y);
        if(X*X + Y*Y <= D*D) answer++;
    }
    printf("%u\n", answer);
	return 0;
}

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

int main()
{
    string s;
    cin>>s;
    int cnt=0;
    for(int i=0;i<3;i++)
    {
        if(cnt>0 && s[i]=='S')
            break;
        if(s[i]=='R')
            cnt++;
    }
    cout<<cnt<<endl;
}



Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main()
{
	int a, b, c, d;
	int p;
	
	cin >> a >> b >> c >> d;
	cin >> p;
	
	int cost_x, cost_y;
	
	cost_x = a * p;
	cost_y = b;
	
	if (p > c){
		cost_y = b + (p - c) * d;
	}
	
	if (cost_x < cost_y){
		cout << cost_x;
	}
	else {
		cout << cost_y;
	}
	cout << endl;
	
	return (0);
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;
const ld PI = acosl(-1);

struct LazySegTree {
    int siz;
    vector<ll> node, lazy;

    LazySegTree(string &S) : siz(1) {
        int N = S.length();
        while (siz < N)
            siz *= 2;

        node.resize(2 * siz - 1);
        lazy.resize(2 * siz - 1);
        for (int i = 0; i < N; ++i) {
            node[i + siz - 1] = (1LL << (S[i] - 'a'));
            if (i + siz - 1 >= 1028000)
                cout << 2 * siz - 1 << endl;
        }
        for (int i = siz - 2; i >= 0; --i)
            node[i] = node[2 * i + 1] | node[2 * i + 2];
    }

    void eval(int k) {
        if (!lazy[k])
            return;
        if (k < siz - 1) {
            lazy[2 * k + 1] = lazy[k];
            lazy[2 * k + 2] = lazy[k];
        }
        node[k] = lazy[k];
        lazy[k] = 0;
    }

    void update(int a, int b, int x, int k = 0, int l = 0, int r = -1) {
        if (r < 0)
            r = siz;

        eval(k);
        if (r <= a || b <= l)
            return;
        if (a <= l && r <= b) {
            lazy[k] = 1LL << x;
            eval(k);
            return;
        }
        update(a, b, x, 2 * k + 1, l, (l + r) / 2);
        update(a, b, x, 2 * k + 2, (l + r) / 2, r);
        node[k] = node[2 * k + 1] | node[2 * k + 2];
    }

    ll query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0)
            r = siz;

        eval(k);
        if (r <= a || b <= l)
            return 0;
        if (a <= l && r <= b)
            return node[k];
        ll vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
        ll vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return (vl | vr);
    }
};

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

    int N, Q;
    string S;
    cin >> N >> S >> Q;
    LazySegTree segtree(S);
    for (int i = 0; i < Q; ++i) {
        int query;
        cin >> query;
        if (query == 1) {
            int a;
            char c;
            cin >> a >> c;
            segtree.update(a - 1, a, c - 'a');
        } else {
            int l, r;
            cin >> l >> r;
            ll res = segtree.query(l - 1, r);
            cout << __builtin_popcountll(res) << '\n';
        }
    }

    return 0;
}


Measured memory_bytes: 20368
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define Rep(i,a,b) for(register int i=(a);i<=int(b);++i)
#define Dep(i,a,b) for(register int i=(a);i>=int(b);--i)
#define rep(i,a,b) for(register int i=(a);i<int(b);++i)
#define mem(x,v) memset(x,v,sizeof(x))
#define gc getchar
#define pc putchar
#define fi first
#define queue QQQ
#define se second
#define debug(x) cout << #x" = " << x << endl;
#define pp(x,y) cout << "pp: " << x << " " << y << endl;
#define rank __RAnK
inline ll read(){
	register ll x=0,f=1;register char c=gc();
	for(;!isdigit(c);c=gc())if(c=='-')f=-1;
	for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c^48);
	return x*f;
}
#define rd read
void write(ll x){if(x<0)x=-x,pc('-');if(x>=10)write(x/10);putchar(x%10+'0');}
void writeln(ll x){write(x);puts("");}
const int maxn = 100005;
multiset<int> s[maxn];
map<pii,int> mp;
pii q[maxn*2];
int front,rear,fa[maxn],n;
inline int find(int x){
	return fa[x] == x?x : fa[x] = find(fa[x]);
}
int main(){
	n = rd();
	Rep(i,1,n) fa[i] = i;
	front = rear = 0;
	Rep(i,1,2*n-2){
		int x,y;
		x = rd(),y = rd();
		s[x] . insert(y);
		s[y] . insert(x);
		mp[make_pair(x,y)]++;
		mp[make_pair(y,x)]++;
		if(mp[make_pair(x,y)]==2) q[rear++] = make_pair(x,y);
	}
	multiset<int>::iterator it;
	while(front < rear){
		int x = q[front].fi,y = q[front].se;front++;
		x = find(x),y = find(y);
		if(x==y) continue;
		s[x] . erase(y);
		s[y] . erase(x);
		if(s[x] . size() < s[y] . size()) swap(x,y);
		for(it = s[y].begin();it != s[y].end();it++){
			int i=*it;
			s[i].erase(y);
			s[i].insert(x);
			++mp[pii(i,x)];
			++mp[pii(x,i)];
			if(mp[pii(x,i)] == 2) q[rear++] = pii(x,i);
			s[x] . insert(i);
		}
		fa[y] = x;
		s[y].clear();
	}
	Rep(i,1,n) if(find(i) != find(1)){
		puts("NO");
		return 0;
	}
	puts("YES");
	return 0;
}


Measured memory_bytes: 57472
#include <bits/stdc++.h>
using namespace std;
const int N=2050,mod=924844033;
int n,m,k,ans,jc[N]= {1},f[N*2][N][2];
bool ed[N],vis[N][2];
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1; i<=n; i++)
		for(int j=0; j<2; j++)
			if(!vis[i][j])
			{
				int cnt=0;
				for(int x=i,y=j; x<=n; x+=k,y^=1)
				{
					cnt++;
					vis[x][y]=true;
				}
				m+=cnt;
				ed[m]=true;
			}
	f[1][0][0]=1;
	for(int i=1; i<=m; i++)
		for(int j=0; j<=n; j++)
		{
			f[i+1][j][0]=f[i][j][0]+f[i][j][1]<mod?f[i][j][0]+f[i][j][1]:f[i][j][0]+f[i][j][1]-mod;
			if(!ed[i])
				f[i+1][j+1][1]=f[i][j][0];
		}
	for(int i=1; i<=n; i++)
		jc[i]=1LL*jc[i-1]*i%mod;
	ans=jc[n];
	for(int i=1; i<=n; i++)
		if(i&1)
			ans=(ans-1LL*(f[m][i][0]+f[m][i][1])%mod*jc[n-i]%mod+mod)%mod;
		else
			ans=(ans+1LL*(f[m][i][0]+f[m][i][1])%mod*jc[n-i]%mod)%mod;
	printf("%d\n",ans);
}

Measured memory_bytes: 65920
#include<iostream>
#include<vector>
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
#include<cmath>
int main()
{
    fastio;
    int n,num;
    cin>>n;
    int count=0;
    for(int i=1;i<=n;i++)
    {
        cin>>num;
        if(i%2!=0){
            if(num%2!=0)
                count++;
        }
    }
    cout<<count<<endl;
    return 0;
}
    




Measured memory_bytes: 3636
/**
2018/12/08/ 未完成
2018/12/11/ 解説AC
再帰関数の書き方。場合分けをしっかり考える
**/
#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};

ll berger[55];  //bn = 2*bn-1 + 3   層の数(パティ+バン)
ll patti[55];   //an = 2*an-1 + 1   パティの数

int N;
ll X;

ll pattiX(int N, ll X){
    
    if(N == 0){
        if(X <= 0) return 0;
        else return 1;
    }
    
    //if(N < 0 || X < 0) return 0;
    //else if(X == 2 + berger[N-1]) return patti[N-1] + 1;
    //else if(X == 3 + 2*berger[N-1]) return 2*patti[N-1] + 1;
    else if(X <= 1 + berger[N-1])return pattiX(N-1, X-1);
    else return patti[N-1] + 1 + pattiX(N-1, X - 2 - berger[N-1]);  //(X <= 2 + 2*berger[N-1])
}


int main(){

    cin >> N >> X;

    berger[0] = 1; patti[0] = 1;
    for(int i = 1; i <= N; i++){
        berger[i] = 2*berger[i-1] + 3;
        patti[i] = 2*patti[i-1] + 1;
    }

    cout << pattiX(N, X) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, a[100005];
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	sort(a + 1, a + 1 + n);
	reverse(a + 1, a + 1 + n);
	int x = n;
	for (int i = 1; i <= n; i++) {
		if (a[i] < i) {
			x = i - 1;
			break;
		}
	}
	int t1 = a[x] - x, t2 = 0;
	for (int i = x + 1; i <= n; i++)
		if (a[i] >= x)
			t2++;
	if (t1 % 2 == 0 && t2 % 2 == 0) puts("Second");
	else puts("First");
	return 0;
}

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

int A;
int B;

int pl;
int mi;
int ba;

int mx;

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

pl=A+B;
mi=A-B;
ba=A*B;
//cout<<pl<<" "<<mi<<" "<<ba;

mx=pl;

if(mx<mi){mx=mi;}

if(mx<ba){mx=ba;}



cout<<mx<<endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
def find_min_fuka_idx(lst, e1, e2):
  ok = -1
  ng = len(lst)
  while abs(ok-ng)>1:
    mid = (ok+ng)//2
    e3 = lst[mid]
    if e1+e2 > e3 and e2+e3>e1 and e3+e1>e2:
      ok = mid
    else:
      ng = mid
  return ng
c = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    c += find_min_fuka_idx(a[j+1:], a[i], a[j])
print(c)
  

Measured memory_bytes: 51804
import java.util.*;
import java.lang.*;

public class Main{

    public static void solve(long a , long b , long c , long k){
        long ans = 0;

        while(k != 0){
            while(k != 0 && a != 0){
            
                ans += 1;
                a--;
                k--;
            }

            while(k != 0 && b != 0){
                b--;
                k--;
            }
            while(k != 0 && c != 0){
                ans -= 1;
                c--;
                k--;
            }
        }

        System.out.println(ans);
    }

    public static void gora(){
        Scanner scn = new Scanner(System.in);

        // long test = scn.nextLong();

        long a = scn.nextLong();

        long b = scn.nextLong();

        long c = scn.nextLong();

        long k = scn.nextLong();

        // long arr[] = new long[n];

        // for(int i = 0 ; i < arr.length ; i++){
        //     arr[i] = scn.nextLong();
        // }

        solve(a, b, c, k);
    }

    public static void main(String args[]){
        gora();
    }
}




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

int main(){
	int n,k;cin>>n>>k;
	vector<int> h(n);
	for(auto&& u:h)cin>>u;
	sort(begin(h),end(h));
	int mn=1e9;
	for(int i=0;i+k-1<n;i++)mn=min(mn,h[i+k-1]-h[i]);
	cout<<mn<<endl;	
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
using namespace std;

typedef long long int lli;

const lli maxn = lli(1e3)+10, MOD = lli(1e9)+7;

lli p[maxn+2];
map<lli, lli> mp;

void init()
{
	for(lli i = 2;i <= maxn;i++)
	{
		if(!p[i])
		{
			for(lli j = i*i;j <= maxn;j += i)
			{
				if(!p[j]) p[j] = i;
			}
		}
	}
}

void solve(lli x)
{
	//cout << x << "\n";
	if(x == 1) return;
	else if(!p[x])
	{
		mp[x]++;
		return;
	}
	else
	{
		lli t = p[x];
		while(x%t == 0)
		{
			x /= t;
			mp[t]++;
		}
		solve(x);
	}
}

int main(void)
{
	lli n;
	init();
	scanf("%lld", &n);
	for(lli i = 1;i <= n;i++)
	{
		//cout << i << "\n";
		solve(i);
	}

	lli res = 1;
	for(auto it: mp)
	{
		res *= it.second+1;
		res %= MOD;
	}
	printf("%lld\n", res);
}

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

int main(){
  int i,j,n,m,a[4][2],h,b;
  while(1){
    cin >> n >> m;
    if(n == 0 && m == 0) break;
    j = 1000;
    for(i=0;i<4;i++){
      a[i][0] = n / j;
      n -= a[i][0] * j;
      a[i][1] = m / j;
      m -= a[i][1] * j;
      j /= 10;
    }
    h = b = 0;
    for(i=0;i<4;i++){
      if(a[i][0] == a[i][1]) h++;
      for(j=0;j<4;j++){
	if(i == j) continue;
	if(a[i][0] == a[j][1]) b++;
      }
    }

    cout << h << " " << b << endl;

  }
  return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

const ll mod = 1000000007LL;

ll n, m;
vector<ll> a;

// 幸福度x以上のつなぎ方が何とおりあるか
ll cnt(ll x) {
	ll cnt = 0;
	for (int i = 0; i < n; ++i) {
		ll b = x - a[i]; // b以上の人数
		auto iter = lower_bound(a.begin(), a.end(), b);
		cnt += n - (iter - a.begin());
	}
	return cnt;
}

signed main() {
	cin >> n >> m;
	a.resize(n);
	for (int i = 0; i < n; ++i) cin >> a[i];
	a.push_back(1000000000000000);
	// 昇順ソート
	sort(a.begin(), a.end());
	// aの累積和
	vector<ll> acc(n + 2, 0);
	for (int i = 1; i < n + 2; ++i)
		acc[i] = acc[i - 1] + a[i - 1];
	// にぶたん
	ll ok = 0, ng = 10000000001;
	while (ng - ok > 1) {
		ll mid = (ok + ng) / 2;
		if (cnt(mid) >= m) ok = mid;
		else ng = mid;
	}
	// 幸福度ok人のペアをすべて加算
	ll del = cnt(ok) - m;
	ll ans = -del * ok;
	for (int i = 0; i < n; ++i) {
		ll b = ok - a[i];
		auto iter = lower_bound(a.begin(), a.end(), b);
		int idx = iter - a.begin();
		ans += (n - idx) * a[i] + acc[n] - acc[idx];
	}
	cout << ans << endl;
	return 0;
}

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

#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
#define endl '\n'
#define eps  1e-9
const double pi=acos(-1);
const int mod=1e9+7;
//____________________
const int N=1e5+5;
int a[N],b[N];
vector<pair<int,int> > ab;
int n,m;

int32_t main()
{ 
  io;
  
  
  cin>>n>>m;
  for(int i=1;i<=n;i++)
  {
    cin>>a[i]>>b[i];
    ab.push_back({a[i],i});
  }

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

  int tot=0,cost=0;

  for(auto it: ab)
  {
    int pos=it.second;
    int need=(m-tot);
    int take=min(b[pos],need);
    cost+=(take*a[pos]);
    tot+=take;
    if(tot>=m)
      break;
  }
  
  cout<<cost;
  
 return 0;
}

Measured memory_bytes: 3568
import fractions
from functools import reduce
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
n=int(input())
a=list(map(int,input().split()))
b=0
l=lcm_list(a)
for i in range(n):
    b+=l//a[i]
print(b%(10**9+7))

Measured memory_bytes: 6116
#include <stdio.h>

int main(void)
{
	// 2????????´??°a, b?????????????????§???a??¨b?????§?°???¢??????????????????????????°???????????????
	
	int a, b;
	scanf("%d%d", &a, &b);

	// a??????b???????????§???????????°
	if (a < b) {
		printf("a < b\n");
	}
	// a??????b??????????°????????????°
	else if (b < a) {
		printf("a > b\n");
	}
	// a??¨b?????????????????°???
	else if (a == b) {
		printf("a == b\n");
	}

	return 0;
}

Measured memory_bytes: 580
import heapq

n, m = map(int, input().split())
a = list(map(lambda x:int(x)*(-1), input().split()))
heapq.heapify(a)
for i in range(m):
    tmp_min=heapq.heappop(a)
    heapq.heappush(a,(-1)*(-1*tmp_min//2))  # 計算誤差の関係で-1を2回かけてます
print(-sum(a))


Measured memory_bytes: 14180
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx")
#include <bits/stdc++.h>

constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	int n, d;
	cin >> n >> d;
	cout << ceil(double(n) / double((1 + 2*d))) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<math.h>
#include <cstdio>
#include<iomanip>
#include <stdio.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,m,n) for(int i=m;i<(int)(n);i++)
const int inf = 10e9 + 7;
using namespace std;
int a[200010];
int b[200010];
signed main() {
	int n;
	cin >> n;
	rep(i, n) {
		cin >> a[i]; b[i] = a[i];
	}
	sort(b, b + n);
	rep(i, n) {
		if (a[i] <= b[n / 2 - 1])cout << b[n / 2] << endl;
		else { cout << b[n / 2 - 1] << endl; }
	}
}

Measured memory_bytes: 5376