Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
// ABC 157-E
// 2020.3.1 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)

int in() {   // 非負整数の入力
	int n = 0; int c;
	c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

void ins(char *s) { // 文字列の入力　スペース以下の文字で入力終了
	do *s = gc();
	while (*s++ > ' ');
	*(s-1) = 0;
}

void out(int n) { // 非負整数の表示（出力）
	int i; char b[30];

	if (!n) pc('0');
	else {
		//		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(b[i]);
	}
	pc('\n');
}

#define MAX 500005
char S[MAX];
int a[26][MAX], sz[26];

// 見つからなければ、一つ大きい要素を返す。つまり、 >= x
int lower_bound(int id, int x) {
	int m, l = 0, r = sz[id];
    while (l < r) {
        m = (l+r) >> 1;
        if (a[id][m] < x) l = m + 1; else r = m;
    }
	return l;
}

void erase(int id, int x) {
	if (a[id][sz[id]-1] == x) sz[id]--;
	else {
		int l = lower_bound(id, x);
		memmove(a[id]+l, a[id]+l+1, (--sz[id]-l)*sizeof(int));
	}
}

void update(int id, int x) {
	if (sz[id] == 0 || a[id][sz[id]-1] < x) {
		a[id][sz[id]++] = x;
	} else {
		int l = lower_bound(id, x);
		memmove(a[id]+l+1, a[id]+l, (sz[id]++ -l)*sizeof(int));
		a[id][l] = x;
	}
}

int main()
{
	int i, id, l, r, N, Q;

	N = in(), ins(S);
	for (i = 0; i < N; ++i) {
		id = S[i] - 'a';
		a[id][sz[id]++] = i;
	}

	Q = in(); while (Q--) {
		id = (gc() == '1'), gc();
		if (id) {
			l = in()-1;
			int c = gc(); gc();
			if (S[l] != c) {
				erase(S[l]-'a', l);
				S[l] = c;
				update(c-'a', l);
			}
		} else {
			l = in()-1, r = in()-1;
			int ans = 0;
			for (i = 0; i < 26; ++i) {
				if (sz[i] && a[i][sz[i]-1] >= l) {
					int t = a[i][lower_bound(i, l)];
					ans += (t <= r);
				}
			}
			out(ans);
		}
	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	in
	.type	in, @function
in:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
.L2:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	andl	$15, %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	cmpl	$47, -4(%rbp)
	jg	.L2
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	in, .-in
	.globl	ins
	.type	ins, @function
ins:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
.L5:
	call	getchar_unlocked@PLT
	movl	%eax, %edx
	movq	-8(%rbp), %rax
	movb	%dl, (%rax)
	movq	-8(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -8(%rbp)
	movzbl	(%rax), %eax
	cmpb	$32, %al
	jg	.L5
	movq	-8(%rbp), %rax
	subq	$1, %rax
	movb	$0, (%rax)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	ins, .-ins
	.globl	out
	.type	out, @function
out:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movl	%edi, -68(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	cmpl	$0, -68(%rbp)
	jne	.L7
	movl	$48, %edi
	call	putchar_unlocked@PLT
	jmp	.L8
.L7:
	movl	$0, -52(%rbp)
	jmp	.L9
.L10:
	movl	-68(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	%ecx, %eax
	leal	48(%rax), %ecx
	movl	-52(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -52(%rbp)
	movl	%ecx, %edx
	cltq
	movb	%dl, -48(%rbp,%rax)
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -68(%rbp)
.L9:
	cmpl	$0, -68(%rbp)
	jne	.L10
	jmp	.L11
.L12:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-48(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar_unlocked@PLT
.L11:
	movl	-52(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -52(%rbp)
	testl	%eax, %eax
	jne	.L12
.L8:
	movl	$10, %edi
	call	putchar_unlocked@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	out, .-out
	.globl	S
	.bss
	.align 32
	.type	S, @object
	.size	S, 500005
S:
	.zero	500005
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 52000520
a:
	.zero	52000520
	.globl	sz
	.align 32
	.type	sz, @object
	.size	sz, 104
sz:
	.zero	104
	.text
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$0, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	jmp	.L15
.L17:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L16
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
	jmp	.L15
.L16:
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L15:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L17
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	lower_bound, .-lower_bound
	.globl	erase
	.type	erase, @function
erase:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -24(%rbp)
	jne	.L20
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L22
.L20:
	movl	-24(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	lower_bound
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$2000020, %rax, %rax
	leaq	a(%rip), %rcx
	addq	%rax, %rcx
	movl	-4(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rax, %rcx
	movl	-20(%rbp), %eax
	cltq
	imulq	$2000020, %rax, %rax
	leaq	a(%rip), %rsi
	addq	%rax, %rsi
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	memmove@PLT
.L22:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	erase, .-erase
	.globl	update
	.type	update, @function
update:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L24
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L25
.L24:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	sz(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L26
.L25:
	movl	-24(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	lower_bound
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	sz(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	subl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$2000020, %rax, %rax
	leaq	a(%rip), %rcx
	addq	%rax, %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rcx
	movl	-20(%rbp), %eax
	cltq
	imulq	$2000020, %rax, %rax
	leaq	a(%rip), %rsi
	addq	%rax, %rsi
	movl	-4(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	memmove@PLT
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	nop
.L26:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	update, .-update
	.globl	main
	.type	main, @function
main:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	$0, %eax
	call	in
	movl	%eax, -24(%rbp)
	leaq	S(%rip), %rax
	movq	%rax, %rdi
	call	ins
	movl	$0, -36(%rbp)
	jmp	.L28
.L29:
	movl	-36(%rbp), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	sz(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-36(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -36(%rbp)
.L28:
	movl	-36(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jl	.L29
	movl	$0, %eax
	call	in
	movl	%eax, -32(%rbp)
	jmp	.L30
.L35:
	call	getchar_unlocked@PLT
	cmpl	$49, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, -20(%rbp)
	call	getchar_unlocked@PLT
	cmpl	$0, -20(%rbp)
	je	.L31
	movl	$0, %eax
	call	in
	subl	$1, %eax
	movl	%eax, -16(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	call	getchar_unlocked@PLT
	movl	-16(%rbp), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	cmpl	%eax, -4(%rbp)
	je	.L30
	movl	-16(%rbp), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	leal	-97(%rax), %edx
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	erase
	movl	-4(%rbp), %eax
	movl	%eax, %ecx
	movl	-16(%rbp), %eax
	cltq
	leaq	S(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	movl	-4(%rbp), %eax
	leal	-97(%rax), %edx
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	update
	jmp	.L30
.L31:
	movl	$0, %eax
	call	in
	subl	$1, %eax
	movl	%eax, -16(%rbp)
	movl	$0, %eax
	call	in
	subl	$1, %eax
	movl	%eax, -12(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L32
.L34:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L33
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -16(%rbp)
	jg	.L33
	movl	-16(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	lower_bound
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	setle	%al
	movzbl	%al, %eax
	addl	%eax, -28(%rbp)
.L33:
	addl	$1, -36(%rbp)
.L32:
	cmpl	$25, -36(%rbp)
	jle	.L34
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	out
.L30:
	movl	-32(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -32(%rbp)
	testl	%eax, %eax
	jne	.L35
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	in
	.type	in, @function
in:
.LFB51:
	.cfi_startproc
	endbr64
	movq	stdin(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	8(%rdi), %rax
	movq	16(%rdi), %rcx
	cmpq	%rcx, %rax
	jnb	.L11
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L3:
	xorl	%r12d, %r12d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L1
.L5:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L7:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rcx, %rdx
	jb	.L4
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L1
	movq	stdin(%rip), %rdi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L1:
	movl	%r12d, %eax
	popq	%r12
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L3
	.cfi_endproc
.LFE51:
	.size	in, .-in
	.p2align 4
	.globl	ins
	.type	ins, @function
ins:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L13:
	leaq	1(%rax), %rdx
	addq	$1, %rbx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
	movb	%al, -1(%rbx)
	cmpb	$32, %al
	jle	.L15
.L16:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jb	.L13
	call	__uflow@PLT
	addq	$1, %rbx
	movb	%al, -1(%rbx)
	cmpb	$32, %al
	jg	.L16
.L15:
	movb	$0, -1(%rbx)
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE52:
	.size	ins, .-ins
	.p2align 4
	.globl	out
	.type	out, @function
out:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%edi, %edx
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$56, %rsp
	.cfi_def_cfa_offset 80
	movq	stdout(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movq	48(%rdi), %rcx
	movq	40(%rdi), %rax
	testl	%edx, %edx
	jne	.L28
	cmpq	%rcx, %rax
	jnb	.L33
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	$48, (%rax)
.L21:
	movq	stdout(%rip), %rdi
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jnb	.L34
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	$10, (%rax)
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L28:
	.cfi_restore_state
	xorl	%ecx, %ecx
	movq	%rsp, %rbx
	.p2align 4,,10
	.p2align 3
.L19:
	movslq	%edx, %rax
	movl	%edx, %esi
	movslq	%ecx, %r8
	imulq	$1717986919, %rax, %rax
	sarl	$31, %esi
	sarq	$34, %rax
	subl	%esi, %eax
	leal	(%rax,%rax,4), %esi
	addl	%esi, %esi
	subl	%esi, %edx
	addl	$48, %edx
	movb	%dl, (%rbx,%rcx)
	movl	%eax, %edx
	movq	%rcx, %rax
	addq	$1, %rcx
	testl	%edx, %edx
	jne	.L19
	leaq	-1(%rsp,%r8), %rbp
	addq	%r8, %rbx
	subq	%rax, %rbp
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L36:
	movq	stdout(%rip), %rdi
.L24:
	movzbl	(%rbx), %esi
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jnb	.L35
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	%sil, (%rax)
.L23:
	subq	$1, %rbx
	cmpq	%rbx, %rbp
	jne	.L36
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L35:
	call	__overflow@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L33:
	movl	$48, %esi
	call	__overflow@PLT
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L34:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	movl	$10, %esi
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	__overflow@PLT
.L32:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.size	out, .-out
	.p2align 4
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.LFB54:
	.cfi_startproc
	endbr64
	movslq	%edi, %rdi
	leaq	sz(%rip), %rax
	xorl	%r8d, %r8d
	movl	(%rax,%rdi,4), %ecx
	leaq	a(%rip), %r9
	imulq	$500005, %rdi, %rdi
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L40:
	leal	(%rcx,%r8), %eax
	sarl	%eax
	movslq	%eax, %rdx
	addq	%rdi, %rdx
	cmpl	%esi, (%r9,%rdx,4)
	jl	.L42
	movl	%eax, %ecx
.L39:
	cmpl	%r8d, %ecx
	jg	.L40
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L42:
	leal	1(%rax), %r8d
	jmp	.L39
	.cfi_endproc
.LFE54:
	.size	lower_bound, .-lower_bound
	.p2align 4
	.globl	erase
	.type	erase, @function
erase:
.LFB55:
	.cfi_startproc
	endbr64
	movslq	%edi, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	sz(%rip), %rbx
	xorl	%r8d, %r8d
	movl	(%rbx,%rdi,4), %ecx
	imulq	$500005, %rdi, %r10
	leaq	a(%rip), %r9
	leal	-1(%rcx), %r11d
	movslq	%r11d, %rax
	addq	%r10, %rax
	cmpl	%esi, (%r9,%rax,4)
	jne	.L46
	jmp	.L53
	.p2align 4,,10
	.p2align 3
.L47:
	leal	(%rcx,%r8), %eax
	sarl	%eax
	movslq	%eax, %rdx
	addq	%r10, %rdx
	cmpl	(%r9,%rdx,4), %esi
	jg	.L54
	movl	%eax, %ecx
.L46:
	cmpl	%r8d, %ecx
	jg	.L47
	movl	%r11d, (%rbx,%rdi,4)
	imulq	$2000020, %rdi, %rdi
	leal	1(%r8), %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	cltq
	subl	%r8d, %r11d
	salq	$2, %rax
	movslq	%r11d, %rdx
	addq	%rdi, %r9
	salq	$2, %rdx
	leaq	(%r9,%rax), %rsi
	leaq	-4(%r9,%rax), %rdi
	jmp	memmove@PLT
	.p2align 4,,10
	.p2align 3
.L54:
	.cfi_restore_state
	leal	1(%rax), %r8d
	jmp	.L46
	.p2align 4,,10
	.p2align 3
.L53:
	movl	%r11d, (%rbx,%rdi,4)
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE55:
	.size	erase, .-erase
	.p2align 4
	.globl	update
	.type	update, @function
update:
.LFB56:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	sz(%rip), %r9
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	a(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movslq	%edi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movslq	(%r9,%rbx,4), %rdi
	testl	%edi, %edi
	je	.L56
	imulq	$500005, %rbx, %r8
	leal	-1(%rdi), %eax
	cltq
	addq	%r8, %rax
	cmpl	%esi, (%r12,%rax,4)
	jl	.L56
	movl	%edi, %ecx
	xorl	%esi, %esi
	jmp	.L59
	.p2align 4,,10
	.p2align 3
.L60:
	leal	(%rcx,%rsi), %eax
	sarl	%eax
	movslq	%eax, %rdx
	addq	%r8, %rdx
	cmpl	(%r12,%rdx,4), %ebp
	jg	.L67
	movl	%eax, %ecx
.L59:
	cmpl	%esi, %ecx
	jg	.L60
	leal	1(%rdi), %eax
	movslq	%esi, %r13
	subl	%esi, %edi
	movl	%eax, (%r9,%rbx,4)
	imulq	$2000020, %rbx, %rax
	leaq	0(,%r13,4), %rcx
	movslq	%edi, %rdx
	imulq	$500005, %rbx, %rbx
	salq	$2, %rdx
	addq	%r12, %rax
	addq	%r13, %rbx
	leaq	(%rax,%rcx), %rsi
	leaq	4(%rax,%rcx), %rdi
	call	memmove@PLT
	movl	%ebp, (%r12,%rbx,4)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L56:
	.cfi_restore_state
	leal	1(%rdi), %eax
	movl	%eax, (%r9,%rbx,4)
	imulq	$500005, %rbx, %rbx
	addq	%rdi, %rbx
	movl	%ebp, (%r12,%rbx,4)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L67:
	.cfi_restore_state
	leal	1(%rax), %esi
	jmp	.L59
	.cfi_endproc
.LFE56:
	.size	update, .-update
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB57:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	S(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	in
	movq	%rbp, %rdi
	movl	%eax, %ebx
	call	ins
	movslq	%ebx, %r9
	xorl	%edx, %edx
	leaq	sz(%rip), %rsi
	leaq	a(%rip), %r8
	testl	%ebx, %ebx
	jle	.L73
	.p2align 4,,10
	.p2align 3
.L72:
	movsbl	0(%rbp,%rdx), %eax
	subl	$97, %eax
	cltq
	movslq	(%rsi,%rax,4), %rcx
	leal	1(%rcx), %edi
	movl	%edi, (%rsi,%rax,4)
	imulq	$500005, %rax, %rax
	addq	%rcx, %rax
	movl	%edx, (%r8,%rax,4)
	addq	$1, %rdx
	cmpq	%rdx, %r9
	jne	.L72
.L73:
	xorl	%eax, %eax
	leaq	sz(%rip), %r14
	leaq	a(%rip), %r13
	call	in
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L119
	.p2align 4,,10
	.p2align 3
.L107:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
	movq	%rdi, %r8
	cmpq	%rdx, %rcx
	jnb	.L122
	leaq	1(%rcx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rcx), %r12d
.L75:
	cmpq	%rax, %rdx
	jbe	.L123
	addq	$1, %rax
	movq	%rax, 8(%rdi)
.L77:
	cmpl	$49, %r12d
	jne	.L78
	cmpq	%rdx, %rax
	jnb	.L124
	leaq	1(%rax), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%rax), %eax
.L80:
	xorl	%r12d, %r12d
	jmp	.L84
	.p2align 4,,10
	.p2align 3
.L81:
	leaq	1(%rcx), %rsi
	movq	%rsi, 8(%r8)
	movzbl	(%rcx), %eax
	cmpl	$47, %eax
	jle	.L83
.L82:
	movq	%rsi, %rcx
.L84:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rdx, %rcx
	jb	.L81
	movq	%r8, %rdi
	call	__uflow@PLT
	movq	stdin(%rip), %r8
	movq	8(%r8), %rsi
	movq	16(%r8), %rdx
	cmpl	$47, %eax
	jg	.L82
	.p2align 4,,10
	.p2align 3
.L83:
	subl	$1, %r12d
	cmpq	%rsi, %rdx
	jbe	.L125
	leaq	1(%rsi), %rax
	movq	%rax, 8(%r8)
	movzbl	(%rsi), %r15d
.L86:
	cmpq	%rdx, %rax
	jnb	.L126
	addq	$1, %rax
	movq	%rax, 8(%r8)
.L88:
	movslq	%r12d, %rdx
	movsbl	0(%rbp,%rdx), %eax
	movq	%rdx, 8(%rsp)
	cmpl	%r15d, %eax
	je	.L89
	leal	-97(%rax), %edi
	movl	%r12d, %esi
	call	erase
	movq	8(%rsp), %rdx
	leal	-97(%r15), %edi
	movl	%r12d, %esi
	movb	%r15b, 0(%rbp,%rdx)
	call	update
.L89:
	subl	$1, %ebx
	jne	.L107
.L119:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L78:
	.cfi_restore_state
	cmpq	%rdx, %rax
	jnb	.L127
	leaq	1(%rax), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%rax), %eax
.L91:
	xorl	%r12d, %r12d
	jmp	.L95
	.p2align 4,,10
	.p2align 3
.L92:
	leaq	1(%rcx), %rsi
	movq	%rsi, 8(%rdi)
	movzbl	(%rcx), %eax
	cmpl	$47, %eax
	jle	.L94
.L93:
	movq	%rsi, %rcx
.L95:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rdx, %rcx
	jb	.L92
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rsi
	movq	16(%rdi), %rdx
	cmpl	$47, %eax
	jg	.L93
	.p2align 4,,10
	.p2align 3
.L94:
	subl	$1, %r12d
	cmpq	%rsi, %rdx
	jbe	.L128
	leaq	1(%rsi), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%rsi), %eax
.L97:
	xorl	%r15d, %r15d
	jmp	.L101
	.p2align 4,,10
	.p2align 3
.L98:
	leaq	1(%rcx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rcx), %eax
	cmpl	$47, %eax
	jle	.L100
.L99:
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
.L101:
	leal	(%r15,%r15,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r15d
	cmpq	%rdx, %rcx
	jb	.L98
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L100
	movq	stdin(%rip), %rdi
	jmp	.L99
	.p2align 4,,10
	.p2align 3
.L100:
	xorl	%esi, %esi
	xorl	%r10d, %r10d
	jmp	.L106
	.p2align 4,,10
	.p2align 3
.L102:
	addq	$1, %rsi
	cmpq	$26, %rsi
	je	.L129
.L106:
	movl	(%r14,%rsi,4), %edx
	movslq	%esi, %r9
	testl	%edx, %edx
	je	.L102
	movslq	%esi, %rax
	leal	-1(%rdx), %ecx
	imulq	$500005, %rax, %rax
	movslq	%ecx, %rcx
	addq	%rcx, %rax
	cmpl	%r12d, 0(%r13,%rax,4)
	jl	.L102
	imulq	$500005, %r9, %r8
	xorl	%edi, %edi
	jmp	.L104
	.p2align 4,,10
	.p2align 3
.L105:
	leal	(%rdx,%rdi), %eax
	sarl	%eax
	movslq	%eax, %rcx
	addq	%r8, %rcx
	cmpl	0(%r13,%rcx,4), %r12d
	jg	.L130
	movl	%eax, %edx
.L104:
	cmpl	%edi, %edx
	jg	.L105
	imulq	$500005, %r9, %r9
	movslq	%edi, %rdi
	xorl	%eax, %eax
	addq	%rdi, %r9
	cmpl	%r15d, 0(%r13,%r9,4)
	setl	%al
	addq	$1, %rsi
	addl	%eax, %r10d
	cmpq	$26, %rsi
	jne	.L106
	.p2align 4,,10
	.p2align 3
.L129:
	movl	%r10d, %edi
	call	out
	jmp	.L89
	.p2align 4,,10
	.p2align 3
.L130:
	leal	1(%rax), %edi
	jmp	.L104
.L123:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	movq	16(%rdi), %rdx
	movq	%rdi, %r8
	jmp	.L77
.L122:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movl	%eax, %r12d
	movq	16(%rdi), %rdx
	movq	8(%rdi), %rax
	movq	%rdi, %r8
	jmp	.L75
.L124:
	call	__uflow@PLT
	movq	stdin(%rip), %r8
	movq	8(%r8), %rcx
	movq	16(%r8), %rdx
	jmp	.L80
.L126:
	movq	%r8, %rdi
	call	__uflow@PLT
	jmp	.L88
.L125:
	movq	%r8, %rdi
	call	__uflow@PLT
	movq	stdin(%rip), %r8
	movl	%eax, %r15d
	movq	16(%r8), %rdx
	movq	8(%r8), %rax
	jmp	.L86
.L128:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
	jmp	.L97
.L127:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
	jmp	.L91
	.cfi_endproc
.LFE57:
	.size	main, .-main
	.globl	sz
	.bss
	.align 32
	.type	sz, @object
	.size	sz, 104
sz:
	.zero	104
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 52000520
a:
	.zero	52000520
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 500005
S:
	.zero	500005
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	in
	.type	in, @function
in:
.LFB51:
	.cfi_startproc
	endbr64
	movq	stdin(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movq	8(%rdi), %rax
	movq	16(%rdi), %rcx
	cmpq	%rcx, %rax
	jnb	.L11
	leaq	1(%rax), %rdx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
.L3:
	xorl	%r12d, %r12d
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	1(%rdx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rdx), %eax
	cmpl	$47, %eax
	jle	.L1
.L5:
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
.L7:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rcx, %rdx
	jb	.L4
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L1
	movq	stdin(%rip), %rdi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L1:
	movl	%r12d, %eax
	popq	%r12
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rdx
	movq	16(%rdi), %rcx
	jmp	.L3
	.cfi_endproc
.LFE51:
	.size	in, .-in
	.p2align 4
	.globl	ins
	.type	ins, @function
ins:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movq	%rdi, %rbx
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L13:
	leaq	1(%rax), %rdx
	addq	$1, %rbx
	movq	%rdx, 8(%rdi)
	movzbl	(%rax), %eax
	movb	%al, -1(%rbx)
	cmpb	$32, %al
	jle	.L15
.L16:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	cmpq	16(%rdi), %rax
	jb	.L13
	call	__uflow@PLT
	addq	$1, %rbx
	movb	%al, -1(%rbx)
	cmpb	$32, %al
	jg	.L16
.L15:
	movb	$0, -1(%rbx)
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE52:
	.size	ins, .-ins
	.p2align 4
	.globl	out
	.type	out, @function
out:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%edi, %edx
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	subq	$56, %rsp
	.cfi_def_cfa_offset 80
	movq	stdout(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movq	48(%rdi), %rcx
	movq	40(%rdi), %rax
	testl	%edx, %edx
	jne	.L28
	cmpq	%rcx, %rax
	jnb	.L33
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	$48, (%rax)
.L21:
	movq	stdout(%rip), %rdi
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jnb	.L34
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	$10, (%rax)
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L28:
	.cfi_restore_state
	xorl	%ecx, %ecx
	movq	%rsp, %rbx
	.p2align 4,,10
	.p2align 3
.L19:
	movslq	%edx, %rax
	movl	%edx, %esi
	movslq	%ecx, %r8
	imulq	$1717986919, %rax, %rax
	sarl	$31, %esi
	sarq	$34, %rax
	subl	%esi, %eax
	leal	(%rax,%rax,4), %esi
	addl	%esi, %esi
	subl	%esi, %edx
	addl	$48, %edx
	movb	%dl, (%rbx,%rcx)
	movl	%eax, %edx
	movq	%rcx, %rax
	addq	$1, %rcx
	testl	%edx, %edx
	jne	.L19
	leaq	-1(%rsp,%r8), %rbp
	addq	%r8, %rbx
	subq	%rax, %rbp
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L36:
	movq	stdout(%rip), %rdi
.L24:
	movzbl	(%rbx), %esi
	movq	40(%rdi), %rax
	cmpq	48(%rdi), %rax
	jnb	.L35
	leaq	1(%rax), %rdx
	movq	%rdx, 40(%rdi)
	movb	%sil, (%rax)
.L23:
	subq	$1, %rbx
	cmpq	%rbx, %rbp
	jne	.L36
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L35:
	call	__overflow@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L33:
	movl	$48, %esi
	call	__overflow@PLT
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L34:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	movl	$10, %esi
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	jmp	__overflow@PLT
.L32:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.size	out, .-out
	.p2align 4
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.LFB54:
	.cfi_startproc
	endbr64
	movslq	%edi, %rdi
	leaq	sz(%rip), %rax
	xorl	%r8d, %r8d
	movl	(%rax,%rdi,4), %ecx
	leaq	a(%rip), %r9
	imulq	$500005, %rdi, %rdi
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L40:
	leal	(%rcx,%r8), %eax
	sarl	%eax
	movslq	%eax, %rdx
	addq	%rdi, %rdx
	cmpl	%esi, (%r9,%rdx,4)
	jl	.L42
	movl	%eax, %ecx
.L39:
	cmpl	%r8d, %ecx
	jg	.L40
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L42:
	leal	1(%rax), %r8d
	jmp	.L39
	.cfi_endproc
.LFE54:
	.size	lower_bound, .-lower_bound
	.p2align 4
	.globl	erase
	.type	erase, @function
erase:
.LFB55:
	.cfi_startproc
	endbr64
	movslq	%edi, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	leaq	sz(%rip), %rbx
	xorl	%r8d, %r8d
	movl	(%rbx,%rdi,4), %ecx
	imulq	$500005, %rdi, %r10
	leaq	a(%rip), %r9
	leal	-1(%rcx), %r11d
	movslq	%r11d, %rax
	addq	%r10, %rax
	cmpl	%esi, (%r9,%rax,4)
	jne	.L46
	jmp	.L53
	.p2align 4,,10
	.p2align 3
.L47:
	leal	(%rcx,%r8), %eax
	sarl	%eax
	movslq	%eax, %rdx
	addq	%r10, %rdx
	cmpl	(%r9,%rdx,4), %esi
	jg	.L54
	movl	%eax, %ecx
.L46:
	cmpl	%r8d, %ecx
	jg	.L47
	movl	%r11d, (%rbx,%rdi,4)
	imulq	$2000020, %rdi, %rdi
	leal	1(%r8), %eax
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	cltq
	subl	%r8d, %r11d
	salq	$2, %rax
	movslq	%r11d, %rdx
	addq	%rdi, %r9
	salq	$2, %rdx
	leaq	(%r9,%rax), %rsi
	leaq	-4(%r9,%rax), %rdi
	jmp	memmove@PLT
	.p2align 4,,10
	.p2align 3
.L54:
	.cfi_restore_state
	leal	1(%rax), %r8d
	jmp	.L46
	.p2align 4,,10
	.p2align 3
.L53:
	movl	%r11d, (%rbx,%rdi,4)
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE55:
	.size	erase, .-erase
	.p2align 4
	.globl	update
	.type	update, @function
update:
.LFB56:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	sz(%rip), %r9
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	a(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movslq	%edi, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movslq	(%r9,%rbx,4), %rdi
	testl	%edi, %edi
	je	.L56
	imulq	$500005, %rbx, %r8
	leal	-1(%rdi), %eax
	cltq
	addq	%r8, %rax
	cmpl	%esi, (%r12,%rax,4)
	jl	.L56
	movl	%edi, %ecx
	xorl	%esi, %esi
	jmp	.L59
	.p2align 4,,10
	.p2align 3
.L60:
	leal	(%rcx,%rsi), %eax
	sarl	%eax
	movslq	%eax, %rdx
	addq	%r8, %rdx
	cmpl	(%r12,%rdx,4), %ebp
	jg	.L67
	movl	%eax, %ecx
.L59:
	cmpl	%esi, %ecx
	jg	.L60
	leal	1(%rdi), %eax
	movslq	%esi, %r13
	subl	%esi, %edi
	movl	%eax, (%r9,%rbx,4)
	imulq	$2000020, %rbx, %rax
	leaq	0(,%r13,4), %rcx
	movslq	%edi, %rdx
	imulq	$500005, %rbx, %rbx
	salq	$2, %rdx
	addq	%r12, %rax
	addq	%r13, %rbx
	leaq	(%rax,%rcx), %rsi
	leaq	4(%rax,%rcx), %rdi
	call	memmove@PLT
	movl	%ebp, (%r12,%rbx,4)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L56:
	.cfi_restore_state
	leal	1(%rdi), %eax
	movl	%eax, (%r9,%rbx,4)
	imulq	$500005, %rbx, %rbx
	addq	%rdi, %rbx
	movl	%ebp, (%r12,%rbx,4)
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L67:
	.cfi_restore_state
	leal	1(%rax), %esi
	jmp	.L59
	.cfi_endproc
.LFE56:
	.size	update, .-update
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB57:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	S(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	call	in
	movq	%rbp, %rdi
	movl	%eax, %ebx
	call	ins
	movslq	%ebx, %r9
	xorl	%edx, %edx
	leaq	sz(%rip), %rsi
	leaq	a(%rip), %r8
	testl	%ebx, %ebx
	jle	.L73
	.p2align 4,,10
	.p2align 3
.L72:
	movsbl	0(%rbp,%rdx), %eax
	subl	$97, %eax
	cltq
	movslq	(%rsi,%rax,4), %rcx
	leal	1(%rcx), %edi
	movl	%edi, (%rsi,%rax,4)
	imulq	$500005, %rax, %rax
	addq	%rcx, %rax
	movl	%edx, (%r8,%rax,4)
	addq	$1, %rdx
	cmpq	%rdx, %r9
	jne	.L72
.L73:
	xorl	%eax, %eax
	leaq	sz(%rip), %r14
	leaq	a(%rip), %r13
	call	in
	movl	%eax, %ebx
	testl	%eax, %eax
	je	.L119
	.p2align 4,,10
	.p2align 3
.L107:
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
	movq	%rdi, %r8
	cmpq	%rdx, %rcx
	jnb	.L122
	leaq	1(%rcx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rcx), %r12d
.L75:
	cmpq	%rax, %rdx
	jbe	.L123
	addq	$1, %rax
	movq	%rax, 8(%rdi)
.L77:
	cmpl	$49, %r12d
	jne	.L78
	cmpq	%rdx, %rax
	jnb	.L124
	leaq	1(%rax), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%rax), %eax
.L80:
	xorl	%r12d, %r12d
	jmp	.L84
	.p2align 4,,10
	.p2align 3
.L81:
	leaq	1(%rcx), %rsi
	movq	%rsi, 8(%r8)
	movzbl	(%rcx), %eax
	cmpl	$47, %eax
	jle	.L83
.L82:
	movq	%rsi, %rcx
.L84:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rdx, %rcx
	jb	.L81
	movq	%r8, %rdi
	call	__uflow@PLT
	movq	stdin(%rip), %r8
	movq	8(%r8), %rsi
	movq	16(%r8), %rdx
	cmpl	$47, %eax
	jg	.L82
	.p2align 4,,10
	.p2align 3
.L83:
	subl	$1, %r12d
	cmpq	%rsi, %rdx
	jbe	.L125
	leaq	1(%rsi), %rax
	movq	%rax, 8(%r8)
	movzbl	(%rsi), %r15d
.L86:
	cmpq	%rdx, %rax
	jnb	.L126
	addq	$1, %rax
	movq	%rax, 8(%r8)
.L88:
	movslq	%r12d, %rdx
	movsbl	0(%rbp,%rdx), %eax
	movq	%rdx, 8(%rsp)
	cmpl	%r15d, %eax
	je	.L89
	leal	-97(%rax), %edi
	movl	%r12d, %esi
	call	erase
	movq	8(%rsp), %rdx
	leal	-97(%r15), %edi
	movl	%r12d, %esi
	movb	%r15b, 0(%rbp,%rdx)
	call	update
.L89:
	subl	$1, %ebx
	jne	.L107
.L119:
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L78:
	.cfi_restore_state
	cmpq	%rdx, %rax
	jnb	.L127
	leaq	1(%rax), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%rax), %eax
.L91:
	xorl	%r12d, %r12d
	jmp	.L95
	.p2align 4,,10
	.p2align 3
.L92:
	leaq	1(%rcx), %rsi
	movq	%rsi, 8(%rdi)
	movzbl	(%rcx), %eax
	cmpl	$47, %eax
	jle	.L94
.L93:
	movq	%rsi, %rcx
.L95:
	leal	(%r12,%r12,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r12d
	cmpq	%rdx, %rcx
	jb	.L92
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rsi
	movq	16(%rdi), %rdx
	cmpl	$47, %eax
	jg	.L93
	.p2align 4,,10
	.p2align 3
.L94:
	subl	$1, %r12d
	cmpq	%rsi, %rdx
	jbe	.L128
	leaq	1(%rsi), %rcx
	movq	%rcx, 8(%rdi)
	movzbl	(%rsi), %eax
.L97:
	xorl	%r15d, %r15d
	jmp	.L101
	.p2align 4,,10
	.p2align 3
.L98:
	leaq	1(%rcx), %rax
	movq	%rax, 8(%rdi)
	movzbl	(%rcx), %eax
	cmpl	$47, %eax
	jle	.L100
.L99:
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
.L101:
	leal	(%r15,%r15,4), %esi
	andl	$15, %eax
	leal	(%rax,%rsi,2), %r15d
	cmpq	%rdx, %rcx
	jb	.L98
	call	__uflow@PLT
	cmpl	$47, %eax
	jle	.L100
	movq	stdin(%rip), %rdi
	jmp	.L99
	.p2align 4,,10
	.p2align 3
.L100:
	xorl	%esi, %esi
	xorl	%r10d, %r10d
	jmp	.L106
	.p2align 4,,10
	.p2align 3
.L102:
	addq	$1, %rsi
	cmpq	$26, %rsi
	je	.L129
.L106:
	movl	(%r14,%rsi,4), %edx
	movslq	%esi, %r9
	testl	%edx, %edx
	je	.L102
	movslq	%esi, %rax
	leal	-1(%rdx), %ecx
	imulq	$500005, %rax, %rax
	movslq	%ecx, %rcx
	addq	%rcx, %rax
	cmpl	%r12d, 0(%r13,%rax,4)
	jl	.L102
	imulq	$500005, %r9, %r8
	xorl	%edi, %edi
	jmp	.L104
	.p2align 4,,10
	.p2align 3
.L105:
	leal	(%rdx,%rdi), %eax
	sarl	%eax
	movslq	%eax, %rcx
	addq	%r8, %rcx
	cmpl	0(%r13,%rcx,4), %r12d
	jg	.L130
	movl	%eax, %edx
.L104:
	cmpl	%edi, %edx
	jg	.L105
	imulq	$500005, %r9, %r9
	movslq	%edi, %rdi
	xorl	%eax, %eax
	addq	%rdi, %r9
	cmpl	%r15d, 0(%r13,%r9,4)
	setl	%al
	addq	$1, %rsi
	addl	%eax, %r10d
	cmpq	$26, %rsi
	jne	.L106
	.p2align 4,,10
	.p2align 3
.L129:
	movl	%r10d, %edi
	call	out
	jmp	.L89
	.p2align 4,,10
	.p2align 3
.L130:
	leal	1(%rax), %edi
	jmp	.L104
.L123:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rax
	movq	16(%rdi), %rdx
	movq	%rdi, %r8
	jmp	.L77
.L122:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movl	%eax, %r12d
	movq	16(%rdi), %rdx
	movq	8(%rdi), %rax
	movq	%rdi, %r8
	jmp	.L75
.L124:
	call	__uflow@PLT
	movq	stdin(%rip), %r8
	movq	8(%r8), %rcx
	movq	16(%r8), %rdx
	jmp	.L80
.L126:
	movq	%r8, %rdi
	call	__uflow@PLT
	jmp	.L88
.L125:
	movq	%r8, %rdi
	call	__uflow@PLT
	movq	stdin(%rip), %r8
	movl	%eax, %r15d
	movq	16(%r8), %rdx
	movq	8(%r8), %rax
	jmp	.L86
.L128:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
	jmp	.L97
.L127:
	call	__uflow@PLT
	movq	stdin(%rip), %rdi
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rdx
	jmp	.L91
	.cfi_endproc
.LFE57:
	.size	main, .-main
	.globl	sz
	.bss
	.align 32
	.type	sz, @object
	.size	sz, 104
sz:
	.zero	104
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 52000520
a:
	.zero	52000520
	.globl	S
	.align 32
	.type	S, @object
	.size	S, 500005
S:
	.zero	500005
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

// ABC 157-E
// 2020.3.1 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)

int in() {   // 非負整数の入力
	int n = 0; int c;
	c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

void ins(char *s) { // 文字列の入力　スペース以下の文字で入力終了
	do *s = gc();
	while (*s++ > ' ');
	*(s-1) = 0;
}

void out(int n) { // 非負整数の表示（出力）
	int i; char b[30];

	if (!n) pc('0');
	else {
		//		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(b[i]);
	}
	pc('\n');
}

#define MAX 500005
char S[MAX];
int a[26][MAX], sz[26];

// 見つからなければ、一つ大きい要素を返す。つまり、 >= x
int lower_bound(int id, int x) {
	int m, l = 0, r = sz[id];
    while (l < r) {
        m = (l+r) >> 1;
        if (a[id][m] < x) l = m + 1; else r = m;
    }
	return l;
}

void erase(int id, int x) {
	if (a[id][sz[id]-1] == x) sz[id]--;
	else {
		int l = lower_bound(id, x);
		memmove(a[id]+l, a[id]+l+1, (--sz[id]-l)*sizeof(int));
	}
}

void update(int id, int x) {
	if (sz[id] == 0 || a[id][sz[id]-1] < x) {
		a[id][sz[id]++] = x;
	} else {
		int l = lower_bound(id, x);
		memmove(a[id]+l+1, a[id]+l, (sz[id]++ -l)*sizeof(int));
		a[id][l] = x;
	}
}

int main()
{
	int i, id, l, r, N, Q;

	N = in(), ins(S);
	for (i = 0; i < N; ++i) {
		id = S[i] - 'a';
		a[id][sz[id]++] = i;
	}

	Q = in(); while (Q--) {
		id = (gc() == '1'), gc();
		if (id) {
			l = in()-1;
			int c = gc(); gc();
			if (S[l] != c) {
				erase(S[l]-'a', l);
				S[l] = c;
				update(c-'a', l);
			}
		} else {
			l = in()-1, r = in()-1;
			int ans = 0;
			for (i = 0; i < 26; ++i) {
				if (sz[i] && a[i][sz[i]-1] >= l) {
					int t = a[i][lower_bound(i, l)];
					ans += (t <= r);
				}
			}
			out(ans);
		}
	}
	return 0;
}

7
abcdbbd
6
2 3 6
1 5 y
2 1 1
1 4 a
1 7 d
2 1 7
 7
abccbbd
6
2 3 6
1 5 y
2 1 1
1 4 a
1 7 d
2 0 7
 7
abdcbbd
6
2 3 6
1 5 z
2 1 1
1 4 a
1 7 d
2 0 7
 7
abcdbbd
6
2 3 0
1 5 z
2 1 1
1 4 a
1 7 d
2 1 7
 7
abccbbd
6
2 3 5
1 5 z
2 1 1
1 5 a
1 7 d
2 0 7
 7
abcdbbd
6
2 3 0
1 5 z
2 1 1
1 7 a
1 7 d
2 2 7
 7
abcdbbd
6
2 3 6
1 5 y
2 2 1
1 4 a
1 7 d
2 1 7
 7
abcdbbd
6
2 0 6
1 5 y
2 1 1
1 4 a
1 7 d
2 0 7
 7
abdcbbd
6
2 3 6
1 4 z
2 1 1
1 4 a
1 7 d
2 0 7
 7
abcdbbd
6
2 3 0
1 5 z
2 1 1
1 7 a
1 7 d
2 2 0

3
1
5
 2
1
5
 3
1
4
 0
1
5
 2
1
4
 0
1
4
 3
0
5
 4
1
5
 3
1
3
 0
1
0

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
// ABC 157-E
// 2020.3.1 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)

int in() {   // 非負整数の入力
	int n = 0; int c;
	c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

void ins(char *s) { // 文字列の入力　スペース以下の文字で入力終了
	do *s = gc();
	while (*s++ > ' ');
	*(s-1) = 0;
}

void out(int n) { // 非負整数の表示（出力）
	int i; char b[30];

	if (!n) pc('0');
	else {
		//		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(b[i]);
	}
	pc('\n');
}

#define MAX 500005
char S[MAX];
int a[26][MAX], sz[26];

// 見つからなければ、一つ大きい要素を返す。つまり、 >= x
int lower_bound(int id, int x) {
	int m, l = 0, r = sz[id];
    while (l < r) {
        m = (l+r) >> 1;
        if (a[id][m] < x) l = m + 1; else r = m;
    }
	return l;
}

void erase(int id, int x) {
	if (a[id][sz[id]-1] == x) sz[id]--;
	else {
		int l = lower_bound(id, x);
		memmove(a[id]+l, a[id]+l+1, (--sz[id]-l)*sizeof(int));
	}
}

void update(int id, int x) {
	if (sz[id] == 0 || a[id][sz[id]-1] < x) {
		a[id][sz[id]++] = x;
	} else {
		int l = lower_bound(id, x);
		memmove(a[id]+l+1, a[id]+l, (sz[id]++ -l)*sizeof(int));
		a[id][l] = x;
	}
}

int main()
{
	int i, id, l, r, N, Q;

	N = in(), ins(S);
	for (i = 0; i < N; ++i) {
		id = S[i] - 'a';
		a[id][sz[id]++] = i;
	}

	Q = in(); while (Q--) {
		id = (gc() == '1'), gc();
		if (id) {
			l = in()-1;
			int c = gc(); gc();
			if (S[l] != c) {
				erase(S[l]-'a', l);
				S[l] = c;
				update(c-'a', l);
			}
		} else {
			l = in()-1, r = in()-1;
			int ans = 0;
			for (i = 0; i < 26; ++i) {
				if (sz[i] && a[i][sz[i]-1] >= l) {
					int t = a[i][lower_bound(i, l)];
					ans += (t <= r);
				}
			}
			out(ans);
		}
	}
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	in
	.type	in, @function
in:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
.L2:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	andl	$15, %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	cmpl	$47, -4(%rbp)
	jg	.L2
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	in, .-in
	.globl	ins
	.type	ins, @function
ins:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
.L5:
	call	getchar_unlocked@PLT
	movl	%eax, %edx
	movq	-8(%rbp), %rax
	movb	%dl, (%rax)
	movq	-8(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -8(%rbp)
	movzbl	(%rax), %eax
	cmpb	$32, %al
	jg	.L5
	movq	-8(%rbp), %rax
	subq	$1, %rax
	movb	$0, (%rax)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	ins, .-ins
	.globl	out
	.type	out, @function
out:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movl	%edi, -68(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	cmpl	$0, -68(%rbp)
	jne	.L7
	movl	$48, %edi
	call	putchar_unlocked@PLT
	jmp	.L8
.L7:
	movl	$0, -52(%rbp)
	jmp	.L9
.L10:
	movl	-68(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	%ecx, %eax
	leal	48(%rax), %ecx
	movl	-52(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -52(%rbp)
	movl	%ecx, %edx
	cltq
	movb	%dl, -48(%rbp,%rax)
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -68(%rbp)
.L9:
	cmpl	$0, -68(%rbp)
	jne	.L10
	jmp	.L11
.L12:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-48(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar_unlocked@PLT
.L11:
	movl	-52(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -52(%rbp)
	testl	%eax, %eax
	jne	.L12
.L8:
	movl	$10, %edi
	call	putchar_unlocked@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	out, .-out
	.globl	S
	.bss
	.align 32
	.type	S, @object
	.size	S, 500005
S:
	.zero	500005
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 52000520
a:
	.zero	52000520
	.globl	sz
	.align 32
	.type	sz, @object
	.size	sz, 104
sz:
	.zero	104
	.text
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$0, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	jmp	.L15
.L17:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L16
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
	jmp	.L15
.L16:
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L15:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L17
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	lower_bound, .-lower_bound
	.globl	erase
	.type	erase, @function
erase:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -24(%rbp)
	jne	.L20
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L22
.L20:
	movl	-24(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	lower_bound
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$2000020, %rax, %rax
	leaq	a(%rip), %rcx
	addq	%rax, %rcx
	movl	-4(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rax, %rcx
	movl	-20(%rbp), %eax
	cltq
	imulq	$2000020, %rax, %rax
	leaq	a(%rip), %rsi
	addq	%rax, %rsi
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	memmove@PLT
.L22:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	erase, .-erase
	.globl	update
	.type	update, @function
update:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L24
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L25
.L24:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	sz(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L26
.L25:
	movl	-24(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	lower_bound
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	sz(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	subl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$2000020, %rax, %rax
	leaq	a(%rip), %rcx
	addq	%rax, %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rcx
	movl	-20(%rbp), %eax
	cltq
	imulq	$2000020, %rax, %rax
	leaq	a(%rip), %rsi
	addq	%rax, %rsi
	movl	-4(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	memmove@PLT
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	nop
.L26:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	update, .-update
	.globl	main
	.type	main, @function
main:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	$0, %eax
	call	in
	movl	%eax, -24(%rbp)
	leaq	S(%rip), %rax
	movq	%rax, %rdi
	call	ins
	movl	$0, -36(%rbp)
	jmp	.L28
.L29:
	movl	-36(%rbp), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	sz(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-36(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -36(%rbp)
.L28:
	movl	-36(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jl	.L29
	movl	$0, %eax
	call	in
	movl	%eax, -32(%rbp)
	jmp	.L30
.L35:
	call	getchar_unlocked@PLT
	cmpl	$49, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, -20(%rbp)
	call	getchar_unlocked@PLT
	cmpl	$0, -20(%rbp)
	je	.L31
	movl	$0, %eax
	call	in
	subl	$1, %eax
	movl	%eax, -16(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	call	getchar_unlocked@PLT
	movl	-16(%rbp), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	cmpl	%eax, -4(%rbp)
	je	.L30
	movl	-16(%rbp), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	leal	-97(%rax), %edx
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	erase
	movl	-4(%rbp), %eax
	movl	%eax, %ecx
	movl	-16(%rbp), %eax
	cltq
	leaq	S(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	movl	-4(%rbp), %eax
	leal	-97(%rax), %edx
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	update
	jmp	.L30
.L31:
	movl	$0, %eax
	call	in
	subl	$1, %eax
	movl	%eax, -16(%rbp)
	movl	$0, %eax
	call	in
	subl	$1, %eax
	movl	%eax, -12(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L32
.L34:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L33
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -16(%rbp)
	jg	.L33
	movl	-16(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	lower_bound
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	setle	%al
	movzbl	%al, %eax
	addl	%eax, -28(%rbp)
.L33:
	addl	$1, -36(%rbp)
.L32:
	cmpl	$25, -36(%rbp)
	jle	.L34
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	out
.L30:
	movl	-32(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -32(%rbp)
	testl	%eax, %eax
	jne	.L35
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	in
	.type	in, @function
in:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
.L2:
	movl	-8(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movl	-4(%rbp), %eax
	andl	$15, %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	cmpl	$47, -4(%rbp)
	jg	.L2
	movl	-8(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	in, .-in
	.globl	ins
	.type	ins, @function
ins:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
.L5:
	call	getchar_unlocked@PLT
	movl	%eax, %edx
	movq	-8(%rbp), %rax
	movb	%dl, (%rax)
	movq	-8(%rbp), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, -8(%rbp)
	movzbl	(%rax), %eax
	cmpb	$32, %al
	jg	.L5
	movq	-8(%rbp), %rax
	subq	$1, %rax
	movb	$0, (%rax)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	ins, .-ins
	.globl	out
	.type	out, @function
out:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movl	%edi, -68(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	cmpl	$0, -68(%rbp)
	jne	.L7
	movl	$48, %edi
	call	putchar_unlocked@PLT
	jmp	.L8
.L7:
	movl	$0, -52(%rbp)
	jmp	.L9
.L10:
	movl	-68(%rbp), %edx
	movslq	%edx, %rax
	imulq	$1717986919, %rax, %rax
	shrq	$32, %rax
	sarl	$2, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	movl	%eax, %ecx
	movl	%ecx, %eax
	sall	$2, %eax
	addl	%ecx, %eax
	addl	%eax, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	%ecx, %eax
	leal	48(%rax), %ecx
	movl	-52(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -52(%rbp)
	movl	%ecx, %edx
	cltq
	movb	%dl, -48(%rbp,%rax)
	movl	-68(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1717986919, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$2, %edx
	sarl	$31, %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -68(%rbp)
.L9:
	cmpl	$0, -68(%rbp)
	jne	.L10
	jmp	.L11
.L12:
	movl	-52(%rbp), %eax
	cltq
	movzbl	-48(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar_unlocked@PLT
.L11:
	movl	-52(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -52(%rbp)
	testl	%eax, %eax
	jne	.L12
.L8:
	movl	$10, %edi
	call	putchar_unlocked@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	out, .-out
	.globl	S
	.bss
	.align 32
	.type	S, @object
	.size	S, 500005
S:
	.zero	500005
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 52000520
a:
	.zero	52000520
	.globl	sz
	.align 32
	.type	sz, @object
	.size	sz, 104
sz:
	.zero	104
	.text
	.globl	lower_bound
	.type	lower_bound, @function
lower_bound:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$0, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	jmp	.L15
.L17:
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L16
	movl	-4(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
	jmp	.L15
.L16:
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L15:
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L17
	movl	-12(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	lower_bound, .-lower_bound
	.globl	erase
	.type	erase, @function
erase:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -24(%rbp)
	jne	.L20
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L22
.L20:
	movl	-24(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	lower_bound
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	-1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$2000020, %rax, %rax
	leaq	a(%rip), %rcx
	addq	%rax, %rcx
	movl	-4(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rax, %rcx
	movl	-20(%rbp), %eax
	cltq
	imulq	$2000020, %rax, %rax
	leaq	a(%rip), %rsi
	addq	%rax, %rsi
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	memmove@PLT
.L22:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	erase, .-erase
	.globl	update
	.type	update, @function
update:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L24
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L25
.L24:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	sz(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L26
.L25:
	movl	-24(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	lower_bound
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	sz(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	subl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$2000020, %rax, %rax
	leaq	a(%rip), %rcx
	addq	%rax, %rcx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rcx
	movl	-20(%rbp), %eax
	cltq
	imulq	$2000020, %rax, %rax
	leaq	a(%rip), %rsi
	addq	%rax, %rsi
	movl	-4(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	memmove@PLT
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	nop
.L26:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	update, .-update
	.globl	main
	.type	main, @function
main:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	$0, %eax
	call	in
	movl	%eax, -24(%rbp)
	leaq	S(%rip), %rax
	movq	%rax, %rdi
	call	ins
	movl	$0, -36(%rbp)
	jmp	.L28
.L29:
	movl	-36(%rbp), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	subl	$97, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-20(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	sz(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-36(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -36(%rbp)
.L28:
	movl	-36(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jl	.L29
	movl	$0, %eax
	call	in
	movl	%eax, -32(%rbp)
	jmp	.L30
.L35:
	call	getchar_unlocked@PLT
	cmpl	$49, %eax
	sete	%al
	movzbl	%al, %eax
	movl	%eax, -20(%rbp)
	call	getchar_unlocked@PLT
	cmpl	$0, -20(%rbp)
	je	.L31
	movl	$0, %eax
	call	in
	subl	$1, %eax
	movl	%eax, -16(%rbp)
	call	getchar_unlocked@PLT
	movl	%eax, -4(%rbp)
	call	getchar_unlocked@PLT
	movl	-16(%rbp), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	cmpl	%eax, -4(%rbp)
	je	.L30
	movl	-16(%rbp), %eax
	cltq
	leaq	S(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	leal	-97(%rax), %edx
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	erase
	movl	-4(%rbp), %eax
	movl	%eax, %ecx
	movl	-16(%rbp), %eax
	cltq
	leaq	S(%rip), %rdx
	movb	%cl, (%rax,%rdx)
	movl	-4(%rbp), %eax
	leal	-97(%rax), %edx
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	update
	jmp	.L30
.L31:
	movl	$0, %eax
	call	in
	subl	$1, %eax
	movl	%eax, -16(%rbp)
	movl	$0, %eax
	call	in
	subl	$1, %eax
	movl	%eax, -12(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L32
.L34:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L33
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	sz(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -16(%rbp)
	jg	.L33
	movl	-16(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	lower_bound
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$500005, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -8(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	setle	%al
	movzbl	%al, %eax
	addl	%eax, -28(%rbp)
.L33:
	addl	$1, -36(%rbp)
.L32:
	cmpl	$25, -36(%rbp)
	jle	.L34
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	out
.L30:
	movl	-32(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -32(%rbp)
	testl	%eax, %eax
	jne	.L35
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
