jiahuimbzuai/CoQuIR huggingface dataset:
//  [cpp]
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <regex>
#include <locale>
using namespace std;

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define all(x) (x).begin(),(x).end()

using ll = long long;

int main () {
  int a, b;
  cin >> a >> b;
  set s1 = {1,3,5,7,8,10,12};
  set s2 = {4,6,9,11};
  
  if (a == 2) {
    if (s1.count(b) > 0 || s2.count(b) > 0) {
      cout << "No" << endl;
    }
  } else if (b == 2) {
    if (a == 1) cout << "No" << endl;
  } else if ((s1.count(a) > 0 && s2.count(b) > 0) ||
             (s1.count(b) > 0 && s2.count(a) > 0)) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}
//  [c]
#include<stdio.h>
int main(){
int x,y;
scanf("%d%d",&x,&y);
if((x>=1 && x<=12)&&(y>x && y<=12))
{
    if(x==2||y==2){
        printf("No\n");
    }
    else if((x==1||x==3||x==5||x==7||x==8||x==10||x==12)&&(y==1||y==3||y==5||y==7||y==8||y==10||y==12))
    {
        printf("Yes\n");
    }
    else if((x==4||x==6||x==9||x==11)&&(y==4||y==6||y==9||y==11))
    {
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }

}
return 0;
}
//  [c]
#include<stdio.h>
#define GROUP_1_MAX 7

typedef struct {
	int iNum;						//番号
	int aiGroup[GROUP_1_MAX];       //整数のグループ

}GROUP_t;

static int judge(int aXY, const GROUP_t* pstGroup);

int main(void) {
	int x, y;
	int GroupNoX, GroupNoY;
	int n;
	int YesNo = 0;

	//x,yを入力
	scanf("%d %d", &x, &y);

	//構造体変数の定義 (空きには-1が入っている)
	const GROUP_t m_Group[3] = {
		{0,{1, 3, 5, 7, 8,10,12}},
		{1,{4, 6, 9,11,-1,-1,-1}},
		{2,{2,-1,-1,-1,-1,-1,-1}}
	};

	//x yの属するグループの比較を行う	
	for (n = 0;n < 3;n++) {
		GroupNoX = judge(x, &m_Group[n]);
		GroupNoY = judge(y, &m_Group[n]);

		if ((GroupNoX == GroupNoY) && (GroupNoX != -1) && (GroupNoY != -1)) {
			YesNo = 1;
			break;
		}
		else {}
	}
	//同じグループに属していた場合Yesを表示
	if (YesNo == 1) {
		printf("Yes\n");
	}//異なるグループに所属していた場合Noを表示
	else if (YesNo == 0) {
		printf("No\n");
	}
	else {}

	return 0;
}
/******
*x,yの値がどの整数のグループに属するかを調べる関数
*[in]aXY			入力値であるxまたはyを入れる
*[in]* pstGroup		x,yと比較したい整数のグループの所属する構造体を入れる
*
*/
int judge(int aXY, const GROUP_t* pstGroup) {
	int i = 0;
	int groupno = -1;
	/*グループ内の数と比較して一致するものがあればグループに割り当てた番号を返す
	そうでないときは一致無し(-1)を返す*/
	for (i = 0; i < GROUP_1_MAX; i++) {
		if (aXY == pstGroup->aiGroup[i]) {
			groupno = pstGroup->iNum;
			break;
		}
		else if (pstGroup->aiGroup[i] == -1)
		{
			break;
		}
		else {
			;
		}
	}
	return(groupno);
}
//  [c]
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

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

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int a, b;
    int t[]={0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
    
    scanf("%d%d", &a, &b);
    
    if (t[a]==t[b]) {
        printf("Yes");
    } else {
        printf("No");
    }
    
    return 0;
}
//  [javascript]
function main(input) {
  input = input.trim();
  const [a,b] = input.split(" ").map(Number);
  const x = [1,3,5,7,8,10,12];
  const y = [4,6,9,11];
  const z = [2];
  if((x.includes(a)&&x.includes(b))||(y.includes(a)&&y.includes(b))||(z.includes(a)&&z.includes(b))){
    console.log("Yes");
  }else{
    console.log("No");
  }
    
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict'

function Main(input) {
  const arr = input.split(' ');
  const x = parseInt(arr[0], 10);
  const y = parseInt(arr[1], 10);
  let g = [];
  const a = [1, 3, 5, 7, 8, 10, 12];
  const b = [4, 6, 9, 11];
  const c = [2];

  if (a.indexOf(x) >= 0) {
    g = a;
  } else if (b.indexOf(x) >= 0) {
    g = b;
  } else if (c.indexOf(x) >= 0) {
    g = c;
  }


  if (g.indexOf(y) >= 0) {
    console.log('Yes');
  } else {
    console.log('No');
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
let l = require("fs").readFileSync("/dev/stdin", "utf8").split(" ");
[x, y] = l.map(i => new Date(2000, Number(i), 0).getDate());
console.log(x == y ? "Yes" : "No");
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	x, y := intScanner(), intScanner()
	g1 := []int{1, 3, 5, 7, 8, 10, 12}
	g2 := []int{4, 6, 9, 11}
	f := false
	for _, v := range g1 {
		for _, w := range g1 {
			if x == v && y == w {
				f = true
			}
		}
	}
	for _, v := range g2 {
		for _, w := range g2 {
			if x == v && y == w {
				f = true
			}
		}
	}
	if f {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main

import (
	"fmt"
)

func isA(a int) bool {
	switch a {
	case 1, 3, 5, 7, 8, 10, 12:
		return true
	}
	return false
}

func isB(a int) bool {
	switch a {
	case 4, 6, 9, 11:
		return true
	}
	return false
}

func isC(a int) bool {
	if a == 2 {
		return true
	}
	return false
}

func main() {
	var x, y int
	fmt.Scan(&x, &y)

	if (isA(x) && isA(y)) ||
		(isB(x) && isB(y)) ||
		(isC(x) && isC(y)) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}
//  [go]
package main

import (
  "fmt"
)

func main() {
  var a, b int
  
  fmt.Scanf("%d %d", &a, &b)
  
  ans := "No"
  switch a {
    case 2: 
      if b == 2 {
        ans = "Yes"
      }
    case 4, 6, 9 ,11: 
      if b == 4 {
        ans = "Yes"
      } 
      if b == 6 {
        ans = "Yes"
      } 
      if b == 9 {
        ans = "Yes"
      } 
      if b == 11 {
        ans = "Yes"
      }
    default:
      if b == 1 {
        ans = "Yes"
      } 
      if b == 3 {
        ans = "Yes"
      } 
      if b == 5 {
        ans = "Yes"
      } 
      if b == 7 {
        ans = "Yes"
      }
      if b == 8 {
        ans = "Yes"
      }
      if b == 10 {
        ans = "Yes"
      }
      if b == 12 {
        ans = "Yes"
      }
  }
  
  fmt.Printf("%s", ans)
}
//  [ruby]
require 'prime'
require 'set'
require 'tsort'
include Math
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end

a =  [ 1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

x,y = gi
if a.include?(x) && a.include?(y) || b.include?(x) && b.include?(y) || c.include?(x) && c.include?(y)
  puts "Yes"
else
  puts "No"
end
//  [ruby]
x, y = gets.split.map(&:to_i)
ary = [4, 6, 9, 11]
ary2 = [1, 3, 5, 7, 8, 10, 12]

if ary.include?(x) && ary.include?(y) || ary2.include?(x) && ary2.include?(y)
  puts "Yes"
else
  puts "No"
end
//  [ruby]
x, y = gets().chomp.split("\s").map{|x| x.to_i}

list = [0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1]

puts list[x] == list[y] ? 'Yes' : 'No'
//  [rust]
use proconio::input;

fn main() {
  let _a : [i128;7] = [1,3,5,7,8,10,12] ;
  let _b : [i128;4] = [4 , 6, 9  , 11];
  let _c : [i128;1] = [ 2 ];
 
let mut _x : i128 ;
let mut _y : i128 ;

    input! {
     
      mut x : i128,
      mut y : i128,

    }
if _a.contains(&x)&&_a.contains(&y){
  println!("Yes");

}else if _b.contains(&x)&&_b.contains(&y){
  println!("Yes");

}else if _c.contains(&x)&&_c.contains(&y){
println!("Yes");
}else {
  println!("No");
}

}
//  [rust]
fn main() {
	proconio::input!{
		x: usize,
		y: usize,
	}

	let g = [1, 3, 1, 2, 1, 2 ,1, 1, 2, 1, 2, 1];
	if g[x-1] == g[y-1] {
		println!("Yes");
	}
	else {
		println!("No");
	}
}
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [x, y] = input[0].map(Number);

  const groups = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]];

  for (const group of groups) {
    if (group.includes(x) && group.includes(y)) {
      return "Yes";
    }
  }

  return "No";
};

console.log(main(read()));
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [x, y] = input[0].map(Number);

  const groupA = [1, 3, 5, 7, 8, 10, 12];
  const groupB = [4, 6, 9, 11];
  const groupC = [2];

  if (
    (groupA.includes(x) && groupA.includes(y)) ||
    (groupB.includes(x) && groupB.includes(y)) ||
    (groupC.includes(x) && groupC.includes(y))
  ) {
    return "Yes";
  } else {
    return "No";
  }
};

console.log(main(read()));
//  [typescript]
import * as fs from 'fs';

const input = fs.readFileSync("/dev/stdin", "utf8").split(" ");
const x = +input[0];
const y = +input[1];

const A = [0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1];

console.log(A[x] == A[y] ? 'Yes' : 'No');
//  [python]
import numpy
n = int(input())
s = input()
a = [0]*n
ans = 10**6
for i in range(n):
    if s[i] == 'W':
        a[i] = 1
res = numpy.cumsum(a)
for i in range(n):
    x = res[i]-str(a[i]).count('1')
    y = n-i-1-(res[n-1]-res[i])
    ans = min(ans,x+y)
print(ans)
//  [python]
from collections import deque

N=int(input())
S=input()

left=deque([0])
right=[0]
for i in range(N):
  if S[i]=='W':plus=1
  else:plus=0
  left.append(left[-1]+plus)
  if S[-i-1]=='E':plus=1
  else:plus=0
  right.append(right[-1]+plus)
  
left.popleft()
right = right[::-1]
right.pop()

print(min([left[i]+right[i] for i in range(N)])-1)
//  [python]
import math
import numpy as np
def main(N, S):
    e_cum_list = []
    w_cum_list = []
    e_sum = 0
    w_sum = 0
    for char in S:
        if char == 'E':
            e_sum +=1
        else:
            w_sum +=1
        e_cum_list.append(e_sum)
        w_cum_list.append(w_sum)

    min_val = 10**6
    for i in range(N):
        
        if i - 1 < 0:
            w_cum = 0
        else:
            w_cum = w_cum_list[i - 1]
        
        e_cum = e_cum_list[-1] - e_cum_list[i]

        ew_sum = e_cum + w_cum
        if ew_sum < min_val:
            min_val = ew_sum

    print(min_val)




if __name__ == "__main__":
    N = int(input())
    S = input()
    
    main(N, S)
//  [java]

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
	// write your code here
        Scanner scanner=new Scanner(System.in);
        final int N=scanner.nextInt();
        final String string=scanner.next();
        String[] strings=string.split("");
        boolean[] booleans=new boolean[N];
        for(int i=0;i<N;i++){
            if(strings[i].equals("E")) booleans[i]=true;
        }
        int temp=0;
        for(int i=0;i<N;i++){
            if(!booleans[i]) temp++;
        }
        int max=temp;
        for(int i=0;i<N;i++){
            if(booleans[N-i-1]){
                temp++;
            }else{
                temp--;
            }
            if(max>temp) max=temp;
        }
        System.out.println(max);
    }
}
//  [java]
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

    static int N;
    static String S;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        S = sc.next();

        solve();
    }

    static void solve() {
        List<String> list = S.chars().mapToObj(c -> String.valueOf((char)c)).collect(Collectors.toList());

        long dp[] = new long[N+10];

        Arrays.fill(dp, S.length()+100);

        // 0番目をリーダーに選んだときは、自分以外のEの数が向きを変える必要がある人数
        dp[0] = S.chars().filter(i -> i == 'E').count() - (list.get(0).equals("E") ? 1 : 0);


        for (int i = 0; i < N-1; i++) {
            String now = list.get(i);
            String next = list.get(i+1);

            if (now.equals("E") && next.equals("E")) {
                dp[i + 1] = dp[i] - 1;
            } else if (now.equals("E") && next.equals("W")) {
                dp[i + 1] = dp[i];
            } else if (now.equals("W") && next.equals("E")) {
                dp[i + 1] = dp[i] + 1 - 1;
            } else {
                dp[i + 1] = dp[i] + 1;
            }

        }

        System.out.println(Arrays.stream(dp).min().orElse(-1));
    }
}
//  [java]
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        int n;
        String s;
        try (Scanner cin = new Scanner(System.in)) {
            n = cin.nextInt();
            s = cin.next();
        }

        long changer = s.subSequence(1, n).chars()
                .filter(c -> c == 'E')
                .count();
        long minChanger = changer;
        for (int i = 1; i < n; i++) {
            if (s.charAt(i - 1) == 'W') changer++;
            if (s.charAt(i) == 'E') changer--;
            minChanger = Math.min(changer, minChanger);
        }

        System.out.println(minChanger);
    }

}
//  [cpp]
#include <vector>
#include <algorithm>
#include <iostream>
#include <chrono>
#include<bitset>
#include<deque>
#include <map>
#include<string>
#define vint vector<int>
#define vint2 vector<vint>
#define vchar vector<char>
#define vchar2 vector<vchar> 
#define vchar3 vector<vchar2> 
#define pr pair<int,int>
#define vpr vector<pr>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
typedef  long long int ll;
using namespace std;
//CHAR_BIT	ビット フィールドではない最小変数のビット数。	8
//SCHAR_MIN	signed char 型変数の最小値。	–128
//SCHAR_MAX	signed char 型変数の最大値。	127
//UCHAR_MAX	unsigned char 型変数の最大値。	255 (0xff)
//CHAR_MIN	char 型変数の最小値。 - 128、 / J オプション使用時は 0
//CHAR_MAX	char 型変数の最大値。	127、 / J オプション使用時は 255
//MB_LEN_MAX	多文字定数の最大バイト数。	5
//SHRT_MIN	short 型変数の最小値。	–32768
//SHRT_MAX	short 型変数の最大値。	32767
//USHRT_MAX	unsigned short 型変数の最大値。	65535 (0xffff)
//INT_MIN	int 型変数の最小値。	–2147483647 – 1
//INT_MAX	int 型変数の最大値。	2147483647
//UINT_MAX	unsigned int 型変数の最大値。	4294967295 (0xffffffff)
//LONG_MIN	long 型変数の最小値。	–2147483647 – 1
//LONG_MAX	long 型変数の最大値。	2147483647
//ULONG_MAX	unsigned long 型変数の最大値。	4294967295 (0xffffffff)


int a[300000];
int main(){
	int n;
	cin >> n;
	//cerr << n << endl;
	string str;
	cin >> str;

	//cerr << str<< endl;
	int tmp=0;
	int ret = 0;
	FOR(i, 0, str.length() - 1){
		if (str[i] == 'W'){ tmp++;  }
		a[i + 1] = tmp;
		cerr << "i:" << i<<"\tc:"<<str[i] << "\ttmp:"<<tmp << endl;
	}
	ret = tmp;
	cerr << ret << endl;
	tmp = 0;
	for (int i = str.length() - 1; i > 0; i--){
		int x=a[i-1];
		if (str[i] == 'E'){ tmp++;  }
		x += tmp;
		ret = min(x, ret);
		cerr << ret << endl;
	}


	cout << ret << endl;
}
//  [cpp]
/**
*   @author Mustafa Khaled.
**/
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll;

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

string to_string(string s){return '"' + s + '"';}string to_string(const char* s){return to_string((string) s);}string to_string(bool b){return (b ? "true" : "false");}template <typename A, typename B>string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v){bool first = true;string res = "{";for (const auto &x : v){if (!first){res += ", ";}first = false;res += to_string(x);}res += "}";return res;}void debug_out(){cerr << endl;}template <typename Head, typename... Tail>void debug_out(Head H, Tail... T){cerr << " " << to_string(H);debug_out(T...);}/*input*/inline void in(const char *t) {}template <typename Head, typename... Tail>inline void in(const char *t,Head &H, Tail&... T){scanf(t,&H);in(t,T...);}
#define D(...)    in(  "%d",__VA_ARGS__);
#define LLD(...)  in("%lld",__VA_ARGS__);

#ifndef ONLINE_JUDGE
    #define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define dbg(...) {}
#endif
/// start driven program
const int OO = 0x3f3f3f3f, N=3e5+7  , MOD= 1000000007;

int beforW[N];
int afterE[N];
char s[N];
int main(){
    int n ; D(n); scanf(" %s",s);
    for ( int i =0;  i<n ; ++i){
        if(s[i]=='W'){
            beforW[i+1]=1;
        }
    }
    for(int i=0 ; i < n ; ++i){
        beforW[i+1]+=beforW[i];
    }


    for ( int i =n-1;  ~i ; --i){
        if(s[i]=='E'){
            afterE[i+1]=1;
        }
    }
    for ( int i =n-1;  ~i ; --i){
        afterE[i+1]+=afterE[i+2];
    }
    int mn =OO , x=0;

    for(int i=0 ; i < n ; ++i){
        x=(beforW[i+1]-(s[i]=='W')) + (afterE[i+1]-(s[i]=='E') );
        dbg(i , x);
        mn = min(mn ,x);
    }

    printf("%d\n" , mn);

}
//  [c]
#include<stdio.h>

int main(){
    int i, j ,k;
    int dpw[310000], dpe[310000];
    char s[310000];
    int east=0, west=0;
    int min = 330000;
    int minw, mine;
    int N;

    scanf("%d", &N);
    for(i=0; i<N; i++){
        scanf("%s", s);
    }

    dpw[0] = 0;
    dpe[0] = 0;

    for(i=1; i<=N; i++){
        if(s[i-1] == 'E'){
            east += 1;
        }else{
            west += 1;
        }
        dpe[i] = east;
        dpw[i] = west;
    }
    dpw[N+1] = dpw[N];
    dpe[N+1] = dpe[N];

    for(i=1; i<=N; i++){
        minw = dpw[i-1];
        mine = dpe[N+1] - dpe[i];
        if(minw+mine < min){
            min = minw + mine;
        }
    }

    printf("%d", min);

    return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <time.h>
typedef long long ll;
typedef long double ld;
#define INF (1LL<<60)
#define MOD1 1000000007
/*swap 交換*/
void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
/*2つのうち大きい数を返す*/
ll max2(ll a,ll b){return a>=b?a:b;}
/*2つのうち小さい数を返す*/
ll min2(ll a,ll b){return a>=b?b:a;}
/*絶対値*/
ll ABS(ll a){return a>=0?a:(-a);}
typedef struct{
    ll aa;
    ll bb;
}frequent;
// 小大
int compare(const void *a, const void *b){return *(ll *)a - *(ll *)b;}

int main(void){
    ll n,i;
    scanf("%lld",&n);
    char s[n+5];
    scanf("%s",s);
    ll w[n],change[n];
    for(i=0;i<n;i++){
        if(i==0){
            w[i]=0;
            if(s[i]=='W') w[i]++;
            continue;
        }
        w[i]=w[i-1];
        if(s[i]=='W') w[i]++;
    }
    for(i=0;i<n;i++){
        if(i==0){
            change[i]=(n-1)-(w[n-1]-w[i]);
            continue;
        }
        if(i==n-1){
            change[i]=w[n-2];
            continue;
        }
        change[i]= w[i-1] + (n-i-1)-(w[n-1]-w[i]) ;
    }
    qsort(change,n,sizeof(ll),compare);
    printf("%lld\n",change[0]);
    return 0;
}
//  [c]
#include <stdio.h>

int main(void){
  long N;
  scanf("%ld",&N);
  char S;
  long sum[N];

  scanf("%c",&S);
  for(int i = 0;i < N;i++){
    sum[i] = 0;
    scanf("%c",&S);
    if(S == 'W'){
      sum[i]++;
    }
    if(i != 0){
      sum[i] += sum[i-1];
    }
  }

  long ans = N;
  //printf("%ld\n",N-1-sum[N-1]+sum[0]);
  //printf("%ld\n",sum[N-2]);
  if(ans > N-1-sum[N-1]+sum[0]){
    ans = N-1-sum[N-1]+sum[0];
  }
  if(ans > sum[N-2]){
    ans = sum[N-2];
  }
  for(int i = 1;i < N-1;i++){
    long counter = 0;
    counter = sum[i-1]+N-i-1-sum[N-1]+sum[i];
    //printf("%ld %ld\n",sum[i-1],N-i-1-sum[N-1]+sum[i]);

    if(ans > counter){
      ans = counter;
    }
  }

  printf("%ld\n",ans);
  return 0;
}
//  [javascript]
'use strict'
function main (input) {
  input = input.split('\n')
  const troops = input[1].split('')
  const n = Number(input[0])
  let countsW = [0]
  for (let i = 1; i <= n; i++) {
    countsW[i] = (troops[i - 1] == 'W') ? countsW[i - 1] + 1 : countsW[i - 1]
  }
  let min, cnt = 0
  for (let i = 0; i < n; i++) {
      cnt = n - (i + 1) - (countsW[n] - countsW[i + 1]) + countsW[i]
    min = (min < cnt) ? min : cnt
  }
  console.log(min)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]
'use strict'

function main(input) {
    input = input.split('\n')
    const troops = input[1].split('')
    const n = Number(input[0])

    let countsW = [0]
    for (let i = 1; i <= n; i++) {
        countsW[i] = (troops[i - 1] == 'W') ? countsW[i - 1] + 1 : countsW[i - 1];
     }

    let min, cnt = 0
    for (let i = 0; i < n; i++) {
        cnt = parseInt(countsW[i]) 
            cnt += n - (i+1) - (countsW[n] - countsW[i + 1]) 

            min = (min < cnt) ? min : cnt
    }

    console.log(min)
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(s){
	s=s.split(/\n/);
	s[0]|=0;
	var arr=[];
	var we=0;
	for(var i=s[0]-1;i>=0;i=(i-1)|0){
		arr[i]=we;
		if(s[1][i]=="W"){we++;}
	}
	
	we=0;
	var a=1<<29;
	for(var i=0;i<s[0];i=(i+1)|0){
		arr[i]+=we;
		if(s[1][i]=="E"){we++;}
		if(a>s[0]-arr[i]-1){a=s[0]-arr[i]-1;}
	}
	console.log(a);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import "fmt"

func main() {
	var (
		n int
		s string
	)
	fmt.Scan(&n, &s)

	sum := make(map[int]int)
	sum[0] = 0
	for i := 1; i < n; i++ {
		if string(s[i]) == "E" {
			sum[0]++
		}
	}
	for i := 1; i < n; i++ {
		sum[i] = sum[i-1]
		if string(s[i]) == "E" {
			sum[i]--
		}
		if string(s[i-1]) == "W" {
			sum[i]++
		}
	}

	min := n
	for _, v := range sum {
		if v < min {
			min = v
		}
	}
	fmt.Println(min)
}
//  [ruby]
EAST = 0
WEST = 1

def build_cumsum(s)
  cumsum = [[0, 0]]
  s.split('').each_with_index do |x, i|
    if x == 'E' then
      cumsum[i + 1] = [cumsum[i][EAST] + 1, cumsum[i][WEST]]
    else
      cumsum[i + 1] = [cumsum[i][EAST], cumsum[i][WEST] + 1]
    end
  end
  return cumsum
end

def diff_cumsum(a, b)
  [b[EAST] - a[EAST], b[WEST] - a[WEST]]
end
  
def main(argv)
  n = gets.chomp.to_i
  s = gets.chomp
  
  cumsum = build_cumsum(s)
  
  m = n + 1
  (0...n).each do |i|
    a = diff_cumsum(cumsum[0], cumsum[i])
    b = diff_cumsum(cumsum[i + 1], cumsum[n])
    m = [m, a[WEST] + b[EAST]].min
  end  
  puts m.to_s
end

if self.to_s == 'main' then
  main(ARGV)
end
//  [ruby]
N = gets.to_i
S = gets.chomp.chars

count_list = Array.new(N + 1)
count_list[0] = { left: 0, right: 0 }
S.each.with_index do |ch, i|
  prev = count_list[i]
  if ch == 'E'
    count_list[i + 1] = { left: prev[:left], right: prev[:right] + 1 }
  else
    count_list[i + 1] = { left: prev[:left] + 1, right: prev[:right] }
  end
end
ans = 10 << 60
N.times do |i|
  first = count_list[1]
  last = count_list[-1]
  current = count_list[i + 1]
  cost = if S[i] == 'E' # ->
    current[:left] + (last[:right] - current[:right])
  else # <-
    (current[:left] - 1) + (last[:right] - current[:right])
  end
  ans = cost if cost < ans
end
puts ans
//  [ruby]
n = gets.to_i
arr = gets.chomp.split('')
w_sum = [0]
e_sum = [0]
arr.each_with_index do |v, i|
  if v == 'W'
    w_sum.push(w_sum[i] + 1)
  else
    w_sum.push(w_sum[i])
  end
end
w_sum.shift
arr.reverse.each do |v, _|
  if v == 'E'
    e_sum.unshift(e_sum[0] + 1)
  else
    e_sum.unshift(e_sum[0])
  end
end
e_sum.pop
min = 300001
(0...n).each do |i|
  min = [min, w_sum[i] + e_sum[i]].min
end
puts min - 1
//  [rust]
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        n: usize,
        s: Chars,
    }

    let mut face = 0;
    for i in 0..n {
        if s[i]=='W' {
            face += 1;
        }
    }

    let mut ans = 0;
    if s[0]=='W' {
        face -= 1;
    }
    ans = face;
    debug!(ans);
    for i in 1..n {
        if s[i-1]=='W' {
            if s[i]=='W' {
                face -= 1;
            }
        } else {
            if s[i]=='E' {
                face += 1;
            } 
        }  
        ans = max(ans, face);
        debug!(face);
    }

    println!("{}", n-ans-1);

}
//  [swift]
readLine()
let S=readLine()!.characters
var a=S.reduce(0){$0+($1<"W" ?1:0)}
print(S.reduce(a){min($0,$1>"E" ? ++a:--a)})
//  [swift]
let R=1..<Int(readLine()!)!,S=readLine()!.characters.map{$0}
var a=R.reduce(0){$0+(S[$1]<"W" ?1:0)},ans=a
R.forEach{a+=(S[$0-1]>"E" ?1:0)-(S[$0]<"W" ?1:0);ans=min(a,ans)}
print(ans)
//  [swift]
readLine();var S=readLine()!.characters,a=S.reduce(0){$0+($1<"W" ?1:0)};print(S.reduce(a){min($0,$1>"E" ? ++a:--a)})
//  [typescript]
function*stdinIter(){const t=require("fs").readFileSync("/dev/stdin","utf-8").trim().split(/\n|\s/);yield*t}function readMany(t,e){const i=e||this.iter||(this.iter=stdinIter()),n=[];for(let e=0;e<t;e+=1)n.push(i.next().value);return n};

(() => {
    const [ n, s ] = readMany(2)

    const west = []
    for (let i = 0; i < n; i += 1) {
        const before = west[i - 1] || 0
        if (s[i] == 'W') {
            west.push(before + 1)
        } else {
            west.push(before)
        }
    }

    const leader = []
    for (let i = 0; i < n; i += 1) {
        const people = (west[i - 1] || 0) + ((n - i - 1) - (west[n - 1] - west[i]))
        leader.push(people)
    }

    let ans = Infinity
    for (let i = 0; i < n; i += 1) {
        if (leader[i] < ans) ans = leader[i]
    }

    console.log(ans)
})()
//  [python]
n = int(input())

from scipy.special import comb


def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

print(num2alpha(n).lower())
//  [python]
import sys
import string

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log  # log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter, defaultdict, deque
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint


def ceil(a, b): return (a + b - 1) // b


inf = float('inf')
mod = 10 ** 9 + 7


def pprint(*A):
    for a in A:     print(*a, sep='\n')


def INT_(n): return int(n) - 1


def MI(): return map(int, input().split())


def MF(): return map(float, input().split())


def MI_(): return map(INT_, input().split())


def LI(): return list(MI())


def LI_(): return [int(x) - 1 for x in input().split()]


def LF(): return list(MF())


def LIN(n: int): return [I() for _ in range(n)]


def LLIN(n: int): return [LI() for _ in range(n)]


def LLIN_(n: int): return [LI_() for _ in range(n)]


def LLI(): return [list(map(int, l.split())) for l in input()]


def I(): return int(input())


def F(): return float(input())


def ST(): return input().replace('\n', '')


def main():
    N = I()
    ans = []
    alpha = string.ascii_lowercase
    while N:
        ans.append(alpha[(N-1)%26])
        if N % 26 == 0:
            N = N // 26 - 1
        else:
            N = N // 26
    ans.reverse()
    answ = ""
    for a in ans:
        answ += a
    print(answ)



if __name__ == '__main__':
    main()
//  [python]
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

n = onem()
ans = ""
while True:
	if n <= 26:
		ans = chr(96+n) + ans
		break
	else:
		po = n % 26
		if po == 0:
			po = 26
		ans = chr(96+po) + ans
		n //= 26
		if po == 26:
			n -= 1
print(ans)
//  [java]
import java.util.*;
import java.util.function.*;
import java.lang.*;
import java.io.*;


public class Main {
    static String dogName(long N){
        if(N==0) return "";
        return dogName((N-1)/26)+((char)((N-1)%26 + 'a'));
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        System.out.println(dogName(N));
        
    }
}
//  [java]
import java.util.Scanner;
/**
 * 解题方法 26 进制
 * k 进制每一位最大只有 k - 1，但是此道题目最大可以是 26，所以每次处理 N - 1
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        long N = scanner.nextLong();
        String ans = "";
        while (N > 0) {
            N--;
            ans = (char)(N % 26 + 97) + ans;
            N /= 26;
        }
        System.out.println(ans);
    }
}
//  [java]
import java.util.*;


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

    long N = Long.parseLong(scanner.nextLine());

    String name = "";

   name = calc(N, name);

   System.out.println(name);
    scanner.close();
    return;
  }

  public static String calc(long N, String name){
    char c = (char) (N % 26 + 'a' - 1);
    if( N%26 == 0){
      c = 'z';
      N -= 26;
    }
    name = String.valueOf(c) + name;
    N = N - N%26;
    if(N / 26 > 0){
      name = calc(N / 26, name);
    }
    return name;
  }
}
//  [cpp]
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define mp make_pair
#define v vector
#define inp_push(no, v) \
    ll no;              \
    cin >> no;          \
    v.push_back(no);
#define pb push_back
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()
#define UN(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
#define N 200005
#define mod 1000000009
#define INF INT64_MAX

//////////////////////////IMPORTANT FUNCTIONS/////////////////////////////////////////////

/* Guidlines berfore submitting solution
1. Check N value before submitting
2. Check all constant kind of values you are using. Might give WA. Think
3. Check mod value
*/

v<ll> fact(N);
v<ll> prime_check(1e7 + 2);
v<ll> primes;

long long powmod(long long x, long long y, long long m)
{
    long long res = 1LL;
    while (y)
    {
        if (y & 1)
            res = (res * x) % m;
        x = (x * x) % m;
        y /= 2;
    }
    return res;
}

void init_fact()
{
    fact[0] = 1;
    for (ll i = 1; i < N; i++)
    {
        fact[i] = (fact[i - 1] * i) % mod;
    }
}

ll C(ll n, ll r)
{
    if (n < r)
        return 0;
    ll temp = fact[n] * powmod(fact[r], mod - 2, mod) % mod;
    temp *= powmod(fact[n - r], mod - 2, mod);
    temp %= mod;
    return temp;
}

void Sieve()
{
    for (ll i = 2; i <= 1e7 + 1; i++)
    {
        if (prime_check[i])
            continue;
        primes.pb(i);
        for (ll j = 2 * i; j <= 1e7 + 1; j += i)
            prime_check[j] = i;
    }
}
ll phi(ll n)
{
    ll i, res = n;
    for (i = 2; i * i <= n; i++)
        if (n % i == 0)
        {
            while (n % i == 0)
                n /= i;
            res -= res / i;
        }
    if (n > 1)
        res -= res / n;
    return res;
}

/////////////////////////////////////START CODE HERE/////////////////////////////////////////////

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // init_fact();
    // Sieve();
    ll n;
    cin >> n;
    string ans;
    string arr;
    for (ll i = 0; i <= 25; i++)
        arr += ('a' + i);
    v<ll> nos;
    while (n > 0)
    {
        ll temp = n % 26;
        if (temp == 0)
            nos.pb(26), n--;
        else
            nos.pb(temp);
        n /= 26;
    }
    for (auto y : nos)
    {
        ll x = y;
        x--;
        ans += arr[x];
    }
    reverse(ans.begin(), ans.end());
    cout << ans << "\n";
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll n;
cin>>n;
ll k=1;
ll a = n;
while(a>0){
a -= pow(26,k);
k++;}
k--;
a = n;
for(ll i=0; i<k-1; i++){
a -= pow(26,i+1);}
ll ab[10000000]={};
ll i=0;
a--;
while(a>0){
ab[i]=a%26;
a=a/26;
i++;}
char aa;
for(ll j=k-1; j>=0; j--){
aa='a'+ab[j];
cout<<aa;}}
//  [c]
#include <stdio.h>
#include <math.h>

int main() {
	long long int n;
	int t;
	char s[15] = {'0'}, al[26] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
	scanf("%lld", &n);
	for (int i = 2; i < 20; i++) {
		if (n <= (long long int)(pow(26, i) - 26) / 25) {
			t = i - 1;
			break;
		}
	}
	if (t >= 2) n = n - (long long int)(pow(26, t) - 26) / 25;
	n--;
	for (int i = 0; i < t; i++) {
		int r = n / (long long int)pow(26, t - 1 - i);
		n = n - (long long int)pow(26, t - 1 - i) * r;
		s[i]=al[r];
	}
	for (int i = 0; i < t; i++)printf("%c", s[i]);
	return 0;
}
//  [c]
#include <stdio.h>
int main()
{
	long long int n,i,x=0;
	char nem[100];
	scanf("%lld",&n);
	while(n!=0){
		n--;
		int b=n%26;
		nem[x]='a'+b;
		n/=26;
		x++;
	}
	for(i=x-1;i>=0;i--){
		printf("%c",nem[i]);
	}
	return 0;
}
//  [c]
#include <stdio.h>

int main(void){

    long long int n;
    scanf("%lld",&n);
    
    int revAns[15];
    int revAnsNum=0;
    long long int keta=1;
    long long int minus=0;
    
    while(((n-minus)/keta)>=0){
    revAns[revAnsNum]=((((n-minus-1)/keta))%26);
    revAnsNum++;
    keta*=26;
    minus+=keta;
    //printf("%d %lld %lld %lld %lld\n",revAnsNum,keta,minus,n,(n-minus)/keta);
    }
    
    //printf("%d ",revAnsNum);
    
    for(int i = revAnsNum-2;i>=0;i--){
        printf("%c",97+revAns[i]);
    }
    
    
    
    /*while(n>0){
    
    i=n%26;
    n/=26;
    printf("%d ",i);
    }*/
 
 

 return 0;
}
//  [javascript]
let n = Number(require('fs').readFileSync('/dev/stdin', 'utf8'))
const alphabetCounts = 26
const chars = new Array(alphabetCounts).fill().map((_, i) => String.fromCharCode(i + 97))
let current = 1
while (true) {
  const currentPow = Math.pow(alphabetCounts, current++)
  if (n <= currentPow) {
    let str = (n - 1).toString(26)
    while (str.length < current - 1) {
      str = '0' + str
    }
    console.log(Array.from(str).map(v => {
      const cc = v.charCodeAt(0)
      return String.fromCharCode(cc <= 57 ? cc + 49 : cc + 10)
    }).join(''))
    break
  }
  n -= currentPow
}
//  [javascript]
const main = input => {
  const num = Number(input);
  const ALPHA = "abcdefghijklmnopqrstuvwxyz".split("");
  const genIndices = (x, arr) => {
    const rem = (x - 1) % 26 + 1;
    const div = (x - rem) / 26;
    if (div === 0) {
      return [rem].concat(arr);
    }
    return genIndices(div, [rem].concat(arr));
  }
  const alphas = genIndices(num, []).map(i => ALPHA[i - 1]);
  console.log(alphas.join(""));
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  input = input.replace(/\n/g, ' ');
  input = input.split(" ");
  var A = Number(input[0]);
  var P = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
  var ans = "";
  var num = [];
  var l = 0;
  while(true){
    num[l] = A%26 - 1;
    if(num[l] == -1)num[l]=25;
    A=(A-num[l]-1)/26;
    if(A == 0){break;}
    l++;
  }
  for(var i=num.length-1;i>=0;i--){
    ans+=P[Number(num[i])];
  }
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"fmt"
	"strings"
)

var LowerAlphabets = [...]string{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
	"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}

func main() {
	var n int
	fmt.Scan(&n)
	var names []string
	for n > 0 {
		names = append([]string{LowerAlphabets[((n - 1) % 26)]}, names...)
		n = (n-1) / 26
	}
	fmt.Println(strings.Join(names, ""))
}
//  [go]
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	var res []byte
	for n > 0 {
		n -= 1
		rem := n % 26
		n /= 26
		res = append(res, byte(rem)+'a')
	}

	Reverse(res)
	fmt.Println(string(res))
}

func Reverse(s []byte) {
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		s[i], s[j] = s[j], s[i]
	}
}
//  [ruby]
require 'bigdecimal'

#n = BigDecimal(gets.to_i)
n = gets.to_i
# puts n / 26
str = ""
alphabet = "abcdefghijklmnopqrstuvwxyz"


class Integer
  def bijective_s(base=nil, offset=nil)
    offset ||= 'A'.ord #65
    base ||= 26
    value = self
    result = []
    while value > 0
      value -= 1
      result << (value%base+offset).chr
      value /= base
    end
    result.reverse.join
  end
end

puts n.bijective_s.downcase
//  [ruby]
#require 'prime'
#require 'openssl'
MOD=10**9+7;  cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def ar2(s1,s2,de=nil) Array.new(s1){Array.new(s2,de)} end
def ar3(s1,s2,s3,de=nil) Array.new(s1){Array.new(s2){Array.new(s3,de)}} end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+).to_i end
def ceil(a,b) (a.to_f/b).ceil end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def pu(h) begin; require './../nemi_lib/debug.rb'; puts_val(h); rescue LoadError; end; end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n=gi
ans=[]
while true
  m=n%26
  ans<<m
  m=26 if m==0
  break if n<=26
  n=(n-m)/26
end
ord=97
pu ans:ans.to_s
puts ans.map{|a| (ord+(a-1)%26).chr}.join.reverse
//  [ruby]
n = gets.to_i

char_map = %w(a b c d e f g h i j k l m n o p q r s t u v w x y z)
ans = ""

while true
  index = n % 26 - 1
  ans += char_map[index]
  break if n <= 26
  n -= 1 if index == - 1
  n /= 26
end

puts ans.reverse
//  [swift]
import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func mainC() {
    var N = readInt()

    var results: [Int] = []

    while N > 0 {
        N -= 1
        results.insert(N % 26, at: 0)
        N /= 26
    }

    let name = results.map { offset in
        return Character(UnicodeScalar(Int(Character("a").unicodeScalars.first!.value) + offset)!)
    }

    print(String(name))
}

mainC()
//  [typescript]
import { readFileSync } from 'fs'
import { reverse } from 'dns'
import { start } from 'repl'

function main(input: string[]) {
  let N = Number(input[0])
 
  // 26
  // 26 * 26 = 676        702
  // 26 * 26 * 26 = 17576 18278
  N--
  let startVal = 0
  let addVal = 26;
  while (1) {
    if (startVal <= N && N < startVal + addVal) {
      N -= startVal
      break;
    }
    startVal += addVal
    addVal *= 26
  }

  let ans = ""
  addVal /= 26
  while (1) {
    let ansOne = Math.floor(N / addVal)
    N -= ansOne * addVal
    ansOne += "a".charCodeAt(0)
    ans += String.fromCharCode(ansOne)
    if (addVal == 1) break
    addVal /= 26
  }
  // 18278 - 702 = 17576

  console.log(ans.toString())
}

let lines: string[] = [];
const reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', function (line: string) {
  lines.push(line);
});
reader.on('close', function () {
  main(lines)
});
//  [typescript]
import * as fs from "fs";
const input = fs.readFileSync("/dev/stdin", "utf8");

const range = (n: number) => Array.from(Array(n), (_, i) => i);

const N = BigInt(input);

const getNo = (n: bigint): string => {
  const alphabets: string[] = Array.from(Array(26), (_, i) => String.fromCharCode("a".charCodeAt(0) + i));

  const getNo = (n: bigint, l: bigint): string => {
    const m = 26n ** l;
    if (n <= m) {
      return range(Number(l)).reduce(
        ({ num, str }, _) => {
          return {
            num: num / 26n,
            str: alphabets[Number(num % 26n)] + str,
          };
        },
        { num: n - 1n, str: "" }
      ).str;
    } else {
      return getNo(n - m, l + 1n);
    }
  };

  return getNo(n, 1n);
};

console.log(getNo(N));
//  [typescript]
import * as fs from "fs";
const input = fs.readFileSync("/dev/stdin", "utf8");

const range = (n: number) => Array.from(Array(n), (_, i) => i);

const N = BigInt(input);

const getNo = (n: bigint): string => {
  const alphabets: string[] = Array.from(Array(26), (_, i) => String.fromCharCode("a".charCodeAt(0) + i));

  const getNo = (n: bigint, l: bigint): string => {
    const m = 26n ** l;
    if (n <= m) {
      return range(Number(l)).reduce(
        ({ num, str }, _) => ({
          num: num / 26n,
          str: alphabets[Number(num % 26n)] + str,
        }),
        { num: n - 1n, str: "" }
      ).str;
    } else {
      return getNo(n - m, l + 1n);
    }
  };

  return getNo(n, 1n);
};

console.log(getNo(N));
//  [python]
N = input()
import numpy as np

N_list = list(N)
N_array = np.array(N_list).astype(int)

if np.sum(N_array) % 9 ==0:
    print('Yes')

else:
    print('No')
//  [python]
#!/usr/bin/env python3

n = str(input())

ans = 0
count = 1
for i in reversed(n):
    ans += int(i)
    ans = ans % 9
    count *= 10
if ans == 0:
    print("Yes")
else:
    print("No")
//  [python]
#codinng:utf-8

N = int(input())
count = 0

while N > 0:
    count += (N % (10 ** 100)) % 9
    N = N // (10 ** 100)

if count % 9 == 0:
    print("Yes")
else:
    print("No")
//  [java]
import java.util.*;
//import java.util.stream.Collectors;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		long sum = 0;
		while(s.length() > 0){
			sum += Integer.parseInt(s.substring(0, 1));
			s = s.substring(1);
		}
		
		System.out.println(sum % 9 == 0 ? "Yes" : "No");
	}
}
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner (System.in);
		
		String n = sc.next();
		String chkNumStr = "";
		int chkNum=0;
		
		
		
		while(n.length() != 0) {
			chkNumStr = n.substring(0, 1);
			chkNum = chkNum + Integer.parseInt(chkNumStr);
			n = n.substring(1, n.length());
		}
		if(chkNum%9 == 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}
//  [java]
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		BigDecimal n = sc.nextBigDecimal();
		if (n == BigDecimal.ZERO) {
			System.out.println("Yes");
			return;
		}

		String nn = String.valueOf(n);

		int count = 0;

		for (int i = 0; i < nn.length(); i++) {
			count += Integer.valueOf(nn.substring(i, i + 1));
			count = count % 9;
		}

		if (count % 9 == 0) {
			System.out.println("Yes");
			return;
		}
		System.out.println("No");

	}
}
//  [cpp]
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

// #include <iomanip>
//  cout << fixed << setprecision(15) << y << endl;

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;
ll getllSubstr(string s,ll start_index,ll length){
    return atoi(s.substr(start_index,length).c_str());
}
ll ltmp;
string stmp;
double dtmp;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    string S;
    cin >> S;

    ll ans = 0;
    rep(si,S.size()){
        ans += getllSubstr(S,si,1);
    }
    if(ans%9==0) cout << "Yes" << endl;
    else cout << "No" << endl;
    

}
//  [cpp]
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cmath>
#include <algorithm>
using namespace std;
using LL = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < n; i++)
const int INF = 1e9;
const int E = numeric_limits<int>::min();

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

    int nnum = 0;
    while(!N.empty()){
        nnum += atoi(N.substr(0, 1).c_str());
        nnum %= 9;
        N = N.substr(1);
    }

    if (nnum == 0){
        puts("Yes");
    }else{
        puts("No");
    }

    return 0;
}
//  [cpp]
#include <iostream>
using namespace std;
bool calc (string n){
    long long int sum =0;
    while(n[0] != '\0'){
            sum+= n[0]- 48;
            n=n.substr(1);
    }
    if (sum%9 == 0){
        return true;
    }
    return false;
}
int main(){
    string n;

    getline(cin, n);

    if (calc(n)==true){
        cout <<"Yes";
    }
    else{
         cout <<"No" ;
    }
   
}
//  [c]
#include <stdio.h>

int main(void){
  int sum = 0;
  char c;
  
  while(c = getchar(), c != EOF && c != '\n'){
    if((sum += (c-'0')) >= 9)
      sum %= 9;
 	 fprintf(stderr, "%d ", sum);
  }
  
  if(sum % 9)
    printf("No\n");
  else
    printf("Yes\n");
  
  return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>

int main()
{
	char *s;
	int buff = 5;
	int ans;
	int ret;

	ans = 0;
	s = malloc((buff + 1) * sizeof(char));
	while ((ret = read(0, s, buff))) {
		if (ret == -1)
			printf("fail\n");
		s[ret] = '\0';
		for (int i = 0; i < ret; i++) {
			if (isdigit(s[i]))
				ans = (ans + (s[i] - '0') % 9) % 9;
		}
		if (strchr(s, '\n'))
			break;
	}
	if (ans % 9 == 0)
		printf("Yes\n");
	else
		printf("No\n");
	return (0);
}
//  [c]
#include<stdio.h>
#include<stdlib.h>

int main(){

int c,ans=0,calc=0;
while (scanf("%1d[^\n]", &c)!=EOF)
{
  calc += c;
  if ((calc%9)!=0)
  {
    ans = 1;
  } else{
    ans = 0;
  }
  
}

ans > 0 ? puts("No") : puts("Yes");

return 0;

}