jiahuimbzuai/CoQuIR huggingface dataset:
//  [javascript]
'use strict'

const INF = 900719925474099 // Number.MAX_SAFE_INTEGER / 10;

function Main(input){
	let temp = input.trim().split('\n');
	let temp2 = temp[0].split(' ').map((v)=>parseInt(v));
	let n = temp2.shift();
	let w = temp2.shift();
	let wv = new Array(n+10);

	for(let i=0;i<n;i++){
		wv[i] = temp[i+1].split(' ').map((v)=>parseInt(v));
	}

	let dp = [...new Array(n+10)].map(()=>(new Array( n*1000 + 10).fill(INF)));
	
	//初期化
	dp[0][0] = 0;

	//console.log(wv);
	//もらうDP
	for(let i=0;i<n;i++){
		//console.log('-------------------------',i);
		for(let j=0,l=dp[0].length;j<l;j++){
			//入れる
			if(j - wv[i][1] >= 0){
				//console.log("in:",dp[i+1][j], dp[i][j - wv[i][1]] + wv[i][0],wv[i][1],wv[i][0]);
				dp[i+1][j] = Math.min(dp[i+1][j], dp[i][j - wv[i][1]] + wv[i][0]);
			}
			//入れない
			//console.log("out:",dp[i+1][j], dp[i][j],wv[i][1],wv[i][0]);
			dp[i+1][j] = Math.min(dp[i+1][j],dp[i][j]);
		}
	}
	//console.log(dp);
	let max = 0;
	for(let i=dp[n].length-1;i>=1;i--){
		if( dp[n][i] <= w ){
			max = i;
			break;
		}
	}
	console.log(max);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict";
function Main(input) {
    let lines = input.split("\n");
    let nw = lines.shift().split(/\s/).map((v) => v - 0);
    let N = nw[0] - 0, W = nw[1] - 0, V = 100000;
    let weight = new Array(N), value = new Array(N);
    for (let n = 0; n < N; n++) {
        let wv = lines.shift().split(/\s/).map((v) => v - 0);
        weight[n] = wv[0];
        value[n] = wv[1];
    }
    let dp = new Array(N + 1).fill(0).map(() => new Array(V + 1).fill(Number.MAX_SAFE_INTEGER));
    dp[0][0] = 0;
    for (let n = 0; n < N; n++) {
        for (let sum_v = 0; sum_v <= V; ++sum_v) {
            if (sum_v - value[n] >= 0) {
                dp[n + 1][sum_v] = Math.min(dp[n + 1][sum_v], dp[n][sum_v - value[n]] + weight[n]);
            }
            dp[n + 1][sum_v] = Math.min(dp[n + 1][sum_v], dp[n][sum_v]);
        }
    }
    let ans = 0;
    for (let sum_v = 0; sum_v <= V; ++sum_v) {
        if (dp[N][sum_v] <= W) ans = sum_v;
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf8');

// Your code here!
const max = (a)=>{
    let i = a.length;
    let max=-Infinity;
    while (i--) {
        if (a[i] > max)max = a[i];
    }
    return max;
}
const min = (a)=>{
    let i = a.length;
    let max=Infinity;
    while (i--) {
        if (a[i] < max)max = a[i];
    }
    return max;
}
const Main = (p)=>{
	p = p.split("\n");//2 or more
	//let N = parseInt(p[0]);//N
	const N = parseInt(p[0].split(" ")[0]);//N M
	const W = parseInt(p[0].split(" ")[1]);//N M
	//let h = (p[1].split(" ").map(Number));//a1 a2 a3...
	
	let w = new Array(N);
	let v = new Array(N);
	//let c=new Array(N);
    //let z=new Array(N);
    for(let i=0;i<N;i++){
        let h = (p[i+1].split(" ").map(Number));
        w[i]=h[0];
        v[i]=h[1];
    }
    
    const maxv=100000;
	let m = new Array(N+1);
    //console.log(N,W,w,v);return;
    m[0]=new Array(maxv+1).fill(Infinity);
    m[0][0]=0;
    for(let i=0;i<=N;i++){
        m[i+1]=m[i].concat();
        for(let j=0;j<=maxv;j++){
            if(j-v[i]>=0){
                //console.log(m[i][j-w[i]]+v[i],m[i][j])
                m[i+1][j]=Math.min(m[i][j-v[i]]+w[i],m[i][j]);
            }
            
        }
        //console.log(i,m[i])
    }
	//console.log(m[N][maxv-1]);
	let i=maxv;
	while(m[N][i--]>W);//console.log(m[N][i--]);
	console.log(i+1);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [go]
// Package main provides
//
// File:  e.go
// Author: ymiyamoto
//
// Created on Thu Jan 10 21:23:06 2019
//
package main

import (
	"fmt"
	"sort"
)

type item struct {
	w, v int
}

func min(slice ...int) int {
	sort.Ints(slice)
	return slice[0]
}

func main() {
	var N, W int
	fmt.Scan(&N, &W)
	items := make([]item, N)

	for i := range items {
		fmt.Scan(&items[i].w, &items[i].v)
	}

	dp := make([][]int, N+1)
	for i := range dp {
		dp[i] = make([]int, 1e5+1)
		for j := range dp[i] {
			dp[i][j] = 1 << 60
		}
	}
	dp[0][0] = 0

	for i := range items {
		w, v := items[i].w, items[i].v
		for j := range dp[i+1] {
			if j-v >= 0 {
				dp[i+1][j] = min(dp[i][j], dp[i][j-v]+w)
			} else {
				dp[i+1][j] = dp[i][j]
			}
		}
	}
	ans := 0

	for i := range dp[N] {
		if dp[N][i] <= W {
			ans = i
		}
	}
	fmt.Println(ans)
}
//  [go]
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

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

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N, W := sc.nextInt(), sc.nextInt()
	V := int(1e+6)
	w := make([]int, N)
	v := make([]int, N)
	for i := 0; i < N; i++ {
		w[i] = sc.nextInt()
		v[i] = sc.nextInt()
	}
	dp := make([][]int, N+1)
	for i := 0; i <= N; i++ {
		dp[i] = make([]int, V+1)
	}
	dp[0][0] = W + 1
	for i := 1; i <= N; i++ {
		for j := 0; j <= V; j++ {
			if j >= v[i-1] && dp[i-1][j-v[i-1]] >= w[i-1]+1 {
				dp[i][j] = dp[i-1][j-v[i-1]] - w[i-1]
			}
			dp[i][j] = max(dp[i][j], dp[i-1][j])
		}
	}

	for i := V; i >= 0; i-- {
		if dp[N][i] > 0 {
			fmt.Fprintln(wtr, i)
			break
		}
	}
	wtr.Flush()
}
//  [go]
package main

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

var IntMapCapForInt2DMap = 0

type Int2DMap map[ // IntMap は、map[Int][Int]に便利メソッドを追加します.
int]IntMap

type IntMap map[ // IntMap は、map[Int][Int]に便利メソッドを追加します.
int]int

func lib_MaxInt(values ...int) (max int, err error) {
	if len(values) == 0 {
		return 0, errors.New("empty slice is given")
	}
	max = values[0]
	for _, value := range values {
		if max < value {
			max = value
		}
	}
	return
}
func lib_MinInt(values ...int) (min int, err error) {
	if len(values) == 0 {
		return 0, errors.New("empty slice is given")
	}
	min = values[0]
	for _, value := range values {
		if min > value {
			min = value
		}
	}
	return
}
func lib_MustMaxInt(values ...int) (max int) {
	max, err := lib_MaxInt(values...)
	if err != nil {
		panic(err)
	}
	return max
}
func lib_NewInt2DMap(cap, cap2 int) Int2DMap {
	IntMapCapForInt2DMap = cap2
	return make(map[int]IntMap, cap)
}
func lib_NewIntMap(cap int) IntMap {
	return make(map[int]int, cap)
}
func (m Int2DMap) ChMin(key1, key2, value int, values ...int) (replaced bool, valueAlreadyExist bool) {
	min, _ := lib_MinInt(append(values, value)...)
	if v, ok := m.Get(key1, key2); ok {
		if v > min {
			m.Set(key1, key2, min)
			return true, true
		} else {
			return false, true
		}
	}
	m.Set(key1, key2, min)
	return true, false
}
func (m Int2DMap) Get(key1, key2 int) (int, bool) {
	v1, ok := m[key1]
	if !ok {
		return 0, false
	}
	v2, ok := v1[key2]
	if !ok {
		return 0, false
	}
	return v2, true
}
func (m IntMap) Keys() (keys []int) {
	keys = make([]int, 0, len(m))
	for k, _ := range m {
		keys = append(keys, k)
	}
	return
}
func (m Int2DMap) Set(key1, key2, value int) (isNewValue bool) {
	v1, ok := m[key1]
	if !ok {
		m[key1] = lib_NewIntMap(IntMapCapForInt2DMap)
		v1 = m[key1]
	}
	_, ok = v1[key2]
	v1[key2] = value
	return !ok
}
func main() {
	scanner := bufio.NewScanner(os.Stdin)
	const initialBufSize = 4096
	const maxBufSize = 1000000
	scanner.Buffer(make([]byte, initialBufSize), maxBufSize)
	scanner.Split(bufio.ScanWords)
	var N int
	scanner.Scan()
	N, _ = strconv.Atoi(scanner.Text())
	var W int
	scanner.Scan()
	W, _ = strconv.Atoi(scanner.Text())
	w := make([]int, N)
	v := make([]int, N)
	for i := 0; i < N; i++ {
		scanner.Scan()
		w[i], _ = strconv.Atoi(scanner.Text())
		scanner.Scan()
		v[i], _ = strconv.Atoi(scanner.Text())
	}
	fmt.Println(solve(N, W, w, v))
}
func solve(N int, W int, w []int, v []int) int {
	m := lib_NewInt2DMap(N, 1000*N)
	m.Set(0, 0, 0)
	for i, curV := range v {
		curW := w[i]
		for bV, bW := range m[i] {
			m.ChMin(i+1, bV, bW)
			if newW := bW + curW; newW <= W {
				m.ChMin(i+1, bV+curV, newW)
			}
		}
	}
	return lib_MustMaxInt(m[N].Keys()...)
}
//  [ruby]
INF = 10**12
MAXV = 1100 * 100
N, W = gets.split.map(&:to_i)
lists = []
N.times do
  lists << gets.split.map(&:to_i)
end
# p lists
dp = Array.new(MAXV, INF)
dp[0] = 0
N.times do |i|
  (MAXV - 1).downto(lists[i][1]) do |j|
    # dp[j] = [dp[j], dp[j - lists[i][1]] + lists[i][0]].min
    dp[j] = dp[j - lists[i][1]] + lists[i][0] if dp[j] > dp[j - lists[i][1]] + lists[i][0]
  end
end
# binding.pry
(MAXV - 1).downto(0) do |i|
  if dp[i] <= W
    puts i
    exit
  end
end
//  [ruby]
ARG_N, ARG_W = gets.split.map(&:to_i)
ARG_w = Array.new(ARG_N)
ARG_v = Array.new(ARG_N)
ARG_N.times do |i|
  ARG_w[i], ARG_v[i] = gets.split.map(&:to_i)
end

def max a,b
  a > b ? a : b
end

def min a,b
  a > b ? b : a
end

MAX_V = ARG_N*(10**3)
dp = Hash.new(Float::INFINITY)
dp[0] = 0
ARG_N.times do |i|
  w, v = ARG_w[i], ARG_v[i]
  dv = MAX_V
  while v <= dv do
    dw = dp[dv-v]+w
    if dw <= ARG_W
      dp[dv] = min(dw, dp[dv])
    end
    dv-=1
  end
end
puts dp.keys.max
//  [ruby]
n, w_max = gets.split.map(&:to_i)
items = Array.new(n){gets.split.map(&:to_i)}
dp = Array.new(100001, Float::INFINITY)
dp[0] = 0
items.each do |w, v|
  prev = dp.dup
  prev.each_with_index do |pw, pv|
    nw = pw + w
    nv = pv + v
    dp[nv] = nw if nw <= w_max && nw < prev[nv]
  end
end
puts dp.rindex{|v| v != Float::INFINITY}
//  [rust]
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: usize,
        w: usize,
        mut weval: [(usize, usize); n],
    }

    weval.insert(0, (0, 0));
    let mut dp = vec![vec![1_000_000_001; 1_000_001]; n+1];

    dp[0][0] = 0;

    for i in 1..=n {
        for j in 0..1_000_000 {
            if weval[i].1 <= j {
                dp[i][j] = dp[i-1][j].min(dp[i-1][j-weval[i].1] + weval[i].0);
            } else {
                dp[i][j] = dp[i-1][j];
            }
        }
    }

    let mut ans = n;
    let mut count = 0;
    for i in dp[n].iter() {
        if i <= &w {
            ans = count;
        }
        count += 1;
    }

    println!("{}", ans);
}
//  [rust]
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
#![macro_use]

use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::mem::*;
use std::num::*;
use std::slice::*;

fn main() {
    let (r, w, e) = (stdin(), stdout(), stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    // =============================================== //
    let (n, w): (usize, usize) = (io.read(), io.read());

    //dp ： 価値を＿＿にするのに最小の重さ？
    let inf = 5 << 28;
    let mut dp = vec![vec![inf; 1000902]; n + 2];
    dp[0][0] = 0;
    for i in 1..n + 1 {
        let (ww, vv): (usize, usize) = (io.read(), io.read());
        //io.debug2(ww, vv);

        for j in 0..1000099 {
            if j >= vv {
                dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - vv] + ww);
            } else {
                dp[i][j] = dp[i - 1][j];
            }
        }
        //io.debug2(i, &dp[i]);
    }
    let mut ans = 0;
    // for i in 0..1001 {
    //     ans = max(if dp[n][i] == inf { 0 } else { dp[n][i] }, ans);
    // }

    for i in 0..1000001 {
        if dp[n][i] <= w {
            ans = max(ans, i);
        }
    }
    io.writeln(ans);
}

// IO
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug ) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
}
//  [rust]
#![allow(non_snake_case)]

use std::cmp;

#[allow(dead_code)]
pub struct Scanner<'a> {
    _buf: &'a str,
    iter: ::std::str::SplitWhitespace<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    pub fn new(buf: &'a str) -> Self {
        Scanner {
            _buf: buf,
            iter: buf.split_whitespace(),
        }
    }

    pub fn array<T>(&mut self, n: usize) -> Vec<T>
        where T: ::std::str::FromStr,
              T::Err: ::std::fmt::Debug,
    {
        let mut res = Vec::with_capacity(n);
        for _ in 0..n {
            res.push(self.value());
        }
        res
    }

    pub fn value<T>(&mut self) -> T
        where T: ::std::str::FromStr,
              T::Err: ::std::fmt::Debug,
    {
        self.next().parse().unwrap()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.next().chars().collect()
    }

    fn next(&mut self) -> &str {
        self.iter.next().unwrap()
    }
}

const INF: i64 = 1_010_000_000_000_000_000;

struct Solver {
    W: Vec<i64>,
    V: Vec<i64>,
    memo: Vec<Vec<Option<i64>>>,
}

impl Solver {
    fn new(W: Vec<i64>, V: Vec<i64>) -> Self {
        Solver {
            W: W,
            V: V,
            memo: vec![vec![None; 100001]; 101],
        }
    }

    /// i 個までで価値 j を実現する最小の重さ(不可能なら INF)
    fn f(&mut self, i: i64, j: i64) -> i64 {
        if i == 0 && j == 0 { return 0; }
        if i == 0 && j >  0 { return INF; }

        if self.memo[i as usize][j as usize].is_none() {
            let w = self.W[(i-1) as usize];
            let v = self.V[(i-1) as usize];

            let mut res = self.f(i-1,j);
            if v <= j {
                res = cmp::min(res, w + self.f(i-1,j-v));
            }
            self.memo[i as usize][j as usize] = Some(res);
        }
        self.memo[i as usize][j as usize].unwrap()
    }
}

fn main() {
    let mut _input = String::new();
    {
        use ::std::io::Read;
        ::std::io::stdin().read_to_string(&mut _input).unwrap();
    }
    let mut sc = Scanner::new(&_input);

    let N    = sc.value::<i64>();
    let WMAX = sc.value::<i64>();
    let mut W = Vec::with_capacity(N as usize);
    let mut V = Vec::with_capacity(N as usize);
    for _ in 0..N {
        W.push(sc.value::<i64>());
        V.push(sc.value::<i64>());
    }

    let mut sol = Solver::new(W, V);
    let mut ans = 0;
    for j in 0..100001 {
        if sol.f(N,j) <= WMAX {
            ans = j;
        }
    }

    println!("{}", ans);
}
//  [python]
A = input()
B = input()
if A > B:
    print "GREATER"
elif A < B:
    print "LESS"
else:
    print "EQUAL"
//  [python]
a = int(input())
b = int(input())
if a > b:
    print("GREATER")
elif a == b:
    print("EQUAL")
else:
    print("LESS")
//  [python]
A = input()
B = input()
if A == B:
    print("EQUAL")

if len(B) < len(A):
    print("GREATER")
elif len(A) < len(B):
    print("LESS")
else:
    for i in range(0, len(A)):
        if int(B[i]) < int(A[i]):
            print("GREATER")
            break
        elif int(A[i]) < int(B[i]):
            print("LESS")
            break
//  [python]
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy

def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("GREATER")
    elif (x<y): print("LESS")
    else: print("EQUAL")

def ip():
    return int(input())


n = ip()                              #入力整数1つ
#n,m= (int(i) for i in input().split())      #入力整数横2つ
#a,b,c = (int(i) for i in input().split())    #入力整数横3つ
#n,a,b,c= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(h)]
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
m = ip()
ct(n,m)
//  [python]
def f(a, b):
	if len(a) != len(b):
		return 'GREATER' if len(a) > len(b) else 'LESS'
	for u,v in zip(a,b):
		if int(u) < int(v):
			return 'LESS'
		elif int(u) > int(v):
			return 'GREATER'
	return  'EQUAL'

print f(raw_input(), raw_input())
//  [python]
n = int(input())
m = int(input())

if n > m: print('GREATER')
elif n < m: print('LESS')
else: print('EQUAL')
//  [java]
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		// 1行、文字列
		String a = br.readLine();
		String b = br.readLine();

		String ans = "EQUAL";
		
		if(a.length() > b.length()) { System.out.println("GREATER"); return; }
		if(a.length() < b.length()) { System.out.println("LESS"); return; }

		
		for(int i=0; i<a.length(); i++) {
			if (a.charAt(i) > b.charAt(i)) { ans = "GREATER"; break;}
			if (a.charAt(i) < b.charAt(i)) { ans = "LESS"; break;}
		}
		
        System.out.println(ans);
        return;
    }


}
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	String a,b;
	public void solve() {
		a = next();
		b = next();

		if(a.length() > b.length()){
			out.println("GREATER");
		}else if(a.length() < b.length()){
			out.println("LESS");
		}else{

			for(int i = 0;i < a.length();i++){

				if(a.charAt(i) < b.charAt(i)){
					out.println("LESS");
					return;
				}else if (a.charAt(i) > b.charAt(i)){
					out.println("GREATER");
					return;
				}
			}
			out.println("EQUAL");
		}
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}
//  [java]
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

   String nyuA=sc.nextLine();
   String nyuB=sc.nextLine();
 
 //    String[] O=sc.nextLine().split("");
   //  String[] E=sc.nextLine().split("");

//int n=Integer.parseInt(nyuA);

//int A=Integer.parseInt(nyuA);
//int B=Integer.parseInt(nyuB);
BigInteger A = new BigInteger(nyuA);
BigInteger B = new BigInteger(nyuB);


if(A.compareTo(B)>0)
System.out.println("GREATER");
else if(A.compareTo(B)<0)
System.out.println("LESS");
else if(A.compareTo(B)==0)
System.out.println("EQUAL");

//long H=Long.parseLong(t[0]);
//long W=Long.parseLong(t[1]);
//long C=Long.parseLong(t[2]);


	}
}
//  [java]
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自动生成的方法存根
		Scanner sc=new Scanner(System.in);
		String a=sc.nextLine();
		String b=sc.nextLine();
		if(a.length()>b.length()) {
			System.out.println("GREATER");
		}else if(a.length()<b.length()) {
			System.out.println("LESS");
		}else{
			if(a.compareTo(b)>0) {
				System.out.println("GREATER");
			}else if(a.compareTo(b)<0){
				System.out.println("LESS");
			}else {
				System.out.println("EQUAL");
			}
		}
	}

}
//  [cpp]
#include<stdio.h>
#include<string.h>
int main(void)
{
   char s1[200],s2[200];
   scanf("%s%s",s1,s2);
   int l,h,i,j;
   l=strlen(s1);
   h=strlen(s2);
   if(l>h)
      printf("GREATER\n");
   else if(l<h)
      printf("LESS\n");
   else
   {
      j=0;
      for(i=0;i<l;i++)
      {
         if(s1[i]<s2[i])
         {
            j=1;
            printf("LESS\n");
            break;
         }
         else if(s1[i]>s2[i])
         {
            j=1;
            printf("GREATER\n");
            break;
         }
      }
      if(j==0)
         printf("EQUAL\n");
   }
   return 0;
}
//  [cpp]
#include<stdio.h>
#include<string.h>
char s1[1000];
char s2[1000];
int main(){
	scanf("%s%s",s1,s2);
	int flag = 0;
	int sum = 0;
	int t = strlen(s1);
	int T = strlen(s2);
	if(t<T){
		printf("LESS\n");
	}
	else if(t>T){
		printf("GREATER\n");
	}
	else if(t==T){
		for(int i = 0;i<t;i++){
				if(s1[i]>s2[i]){
					printf("GREATER\n");
					flag = 1;
					break;
				}
				else if(s1[i]<s2[i]){
					printf("LESS\n");
					flag = 1;
					break;
				}
				else if(s1[i]==s2[i]){
					sum++;
					if(sum==t){
						printf("EQUAL\n");
						break;
					}
				}
			}		
		}
	}
//  [cpp]
#include <stdio.h>
#include <algorithm>
int main() {
	char IA[101], IB[101];
	scanf("%s %s", IA, IB);
	int lengthA, lengthB;
	for (lengthA = 0; IA[lengthA] != 0x0; lengthA++);
	for (lengthB = 0; IB[lengthB] != 0x0; lengthB++);
	char A[100] = { 0 }, B[100] = { 0 };
	for (int i = 0; i < lengthA; i++)
		A[99 - i] = IA[lengthA - i - 1] - '0';
	for (int i = 0; i < lengthB; i++)
		B[99 - i] = IB[lengthB - i - 1] - '0';
	int i;
	for (i = 0; i < 100 && A[i] == B[i]; i++);
	if (i == 100)
		printf("EQUAL\n");
	else
		printf("%s\n", A[i] > B[i] ? "GREATER" : "LESS");
}
//  [cpp]
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;
const int N = 1e7 + 5;
string a[N], b[N];

int main(){
	string a, b;
	while(cin >> a >> b){
		int len1 = a.length();
		int len2 = b.length();
		if(len1 > len2)
			cout << "GREATER" << endl;
		else if(len1 < len2)
			cout << "LESS" << endl;
		else{
			int x, y;
			for(int i = 0; i < len1; i++){
				if(a[i] > b[i]){
					x = 1;
					break;
				}
				else if(a[i] < b[i]){
					x = 0;
					break;
				}
				else{
					x = 2;
				}
			}
			if(x == 1)
				cout << "GREATER" << endl;
			else if(x == 0)
				cout << "LESS" << endl;
			else
				cout << "EQUAL" << endl;
		}
	}
}
//  [cpp]
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

int compare(string a, string b) {
  int size_a = a.size();
  int size_b = b.size();

  if (size_a < size_b) return -1;
  else if (size_a > size_b) return 1;

  for (int i = 0; i < size_a; i++) {
    if (a[i] < b[i]) return -1;
    else if (a[i] > b[i]) return 1;
  }

  return 0;
}

void solve() {
  string a, b; cin >> a >> b;
  
  int c = compare(a, b);
  if (c == -1) outl("LESS");
  else if (c == 1) outl("GREATER");
  else outl("EQUAL");
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}
//  [cpp]
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
int main(){
  long double a,b;cin>>a>>b;
  if(a>b)cout<<"GREATER";
  else if(a<b)cout<<"LESS";
  else cout<<"EQUAL";
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


int main(){
	/*unsigned long A;
	unsigned long B;*/

	char A[100];
	char B[100];

	scanf("%s %s",A,B);

	if(strlen(A) > strlen(B)){
		printf("GREATER\n");
		return 0;
	}
	else if(strlen(A) < strlen(B)){
		printf("LESS\n");
		return 0;
	}
	else{
		for(int i=0; i<strlen(A); i++){
			if(A[i] > B[i]){
				printf("GREATER\n");
				return 0;
			}
			else if(A[i] < B[i]){
				printf("LESS\n");
				return 0;
			}
		}
		printf("EQUAL\n");
	}

	return 0;
}
//  [c]
#include <stdio.h>
#include<stdlib.h>
#include<string.h>

char A[101],B[101];
void input(){
    scanf("%s",A);
    scanf("%s",B);
    
}

int main(){
    input();
    
    if(strlen(A)>strlen(B)) printf("GREATER\n");
    else if(strlen(A)<strlen(B)) printf("LESS\n");
    else {
        if(strcmp(A,B)>0) printf("GREATER\n");
        else if(strcmp(A,B)<0) printf("LESS\n");
        else printf("EQUAL\n");
    }
    return 0;
}
//  [c]
#include <stdio.h>

int main()
{
  double  a, b;

  scanf("%lf%lf", &a, &b);

  if(a>b)
    printf("GREATER\n");
  else if(a<b)
    printf("LESS\n");
  else
    printf("EQUAL\n");

  return 0;
}
//  [c]
main(){double a,b;scanf("%lf%lf",&a,&b);puts(a-b?a>b?"GREATER":"LESS":"EQUAL");}
//  [c]
#include <stdio.h>
#include <string.h>
int main(void){
    char a[100], b[100];
    scanf("%s%s", a, b);
    int a_keta = strlen(a), b_keta=strlen(b);
    if(a_keta>b_keta){
        puts("GREATER");
        return 0;
    }
    else if(b_keta>a_keta){
        puts("LESS");
        return 0;
    }
    for(int i=0; a[i]||b[i]!='\0'; i++){
        if(a[i]>b[i]){
            puts("GREATER");
            return 0;
        }
        else if(b[i]>a[i]){
            puts("LESS");
            return 0;
        }
    }
    puts("EQUAL");
    return 0;
}
//  [c]
main(){
	double a,b;
	scanf("%lf%lf",&a,&b);
	puts(a-b?a>b?"GREATER":"LESS":"EQUAL");
}
//  [javascript]
function Main(input){
  input = input.split('\n');
  var a = Number(input[0]);
  var b = Number(input[1]);

  if(a > b) {
      console.log('GREATER');
  } else if(b > a) {
    console.log('LESS');
  } else {
    console.log('EQUAL');
  }

}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict";
const Main = (input) =>{
	let xs = input.trim().split('\n');    
    let A = xs[0].trim().split(' ').map(v=>parseInt(v,10));
    //console.log(A);
    let B = xs[1].trim().split(' ').map(v=>parseInt(v,10));
    //console.log(B);
    if(A[0] > B[0]){
      console.log('GREATER');
    }else if(B[0] > A[0]){
      console.log('LESS');
    }else{
      console.log('EQUAL');
    }
  }
Main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [javascript]
'use strict'

function main(s) {

  s = s.split('\n').slice(0, -1);

  const a = s[0];
  const b = s[1];

  let ans = '';

  if (a.length > b.length) {
    ans = 'GREATER';
  } else if (a.length < b.length) {
    ans = 'LESS';
  } else {
    if (a < b) ans = 'LESS';
    if (a > b) ans = 'GREATER';
    if (a === b) ans = 'EQUAL';
  }

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict";
// inputに入力データ全体が入る
const main = (input) => {
  const [a, b] = input.trim().split("\n").map(Number);
  if (a === b) {
    return "EQUAL";
  } else if (a > b) {
    return "GREATER";
  } else {
    return "LESS";
  }
};

// ※この行以降は編集しない (標準入力から一度に読み込みMainを呼び出します)
console.log(main(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [javascript]
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
    const A = BigInt(lines[0]);
    const B = BigInt(lines[1]);
    console.log(A>B?"GREATER":A<B?"LESS":"EQUAL");
    
});
//  [javascript]
const main = stdin => {
  const input = stdin.trim().split('\n')
  const A = BigInt(input[0])
  const B = BigInt(input[1])

  if (A > B) {
    console.log('GREATER')
  } else if (A < B) {
    console.log('LESS')
  } else {
    console.log('EQUAL')
  }
}


// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))
//  [go]
package main

import (
        "fmt"
)

func solution(a, b string) string {
        l := max(len(a), len(b))
        a = helper(a, l)
        b = helper(b, l)
        if a > b {
                return "GREATER"
        }

        if a == b {
                return "EQUAL"
        }
        return "LESS"
}

func max(x, y int) int {
        if x > y {
                return x
        }
        return y
}

func helper(s string, l int) string {
        sl := len(s)
        if sl < l {
                buf := make([]byte, 0, l)
                for i := 0; i < l; i++ {
                        if i < l-sl {
                                buf = append(buf, '0')
                        } else {
                                buf = append(buf, s[i-l+sl])
                        }
                }
                return string(buf)
        }
        return s
}

func main() {
        var a, b string
        fmt.Scan(&a, &b)
        fmt.Println(solution(a, b))
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var a,b string
	fmt.Scan(&a,&b)
	
	if len(a) > len(b) {
		fmt.Println("GREATER")
		return
	}
	if len(a) < len(b) {
		fmt.Println("LESS")
		return
	}
	
	//len(a)==len(b)
	for i := 0; i < len(a); i++ {
		if a[i] > b[i] {
			fmt.Println("GREATER")
			return
		}
		if a[i] < b[i] {
			fmt.Println("LESS")
			return
		}
	}
	fmt.Println("EQUAL")
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"log"
	"math/big"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

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

func main() {
	a := new(big.Int)
	a, ok := a.SetString(input(), 10)
	if !ok {
		log.Fatalln("SetString: error")
	}

	b := new(big.Int)
	b, ok = b.SetString(input(), 10)
	if !ok {
		log.Fatalln("SetString: error")
	}

	result := a.Cmp(b)

	if result == 1 {
		fmt.Println("GREATER")
	} else if result == 0 {
		fmt.Println("EQUAL")
	} else {
		fmt.Println("LESS")
	}
}
//  [go]
package main

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

func main()  {
  sc := bufio.NewScanner(os.Stdin)
  sc.Buffer(make([]byte, 64*1024*1024), 64*1024*1024)
  sc.Scan()
  A := sc.Text()
  sc.Scan()
  B := sc.Text()
  if len(A) > len(B) {
    fmt.Println("GREATER")
    return
  } else if len(A) < len(B) {
    fmt.Println("LESS")
    return
  } else {
    for i := 0; i < len(A) ; i++ {
      if A[i] > B[i] {
        fmt.Println("GREATER")
        return
      } else if A[i] < B[i] {
        fmt.Println("LESS")
        return
      }
    }
    fmt.Println("EQUAL")
    return
  }
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	aorg := nextStr()
	borg := nextStr()

	a := fmt.Sprintf("%0101s", aorg)
	b := fmt.Sprintf("%0101s", borg)

	for i := 0; i < len(a); i++ {
		if a[i] > b[i] {
			fmt.Println("GREATER")
			return
		}
		if a[i] < b[i] {
			fmt.Println("LESS")
			return
		}
	}
	fmt.Println("EQUAL")
}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
//  [go]
package main

import "fmt"

func main() {
	// Code for B - Comparison
	var A, B float64
	fmt.Scanf("%f\n%f", &A, &B)

	if A > B {
		fmt.Println("GREATER")
	} else if A == B {
		fmt.Println("EQUAL")
	} else {
		fmt.Println("LESS")
	}
}
//  [ruby]
a = gets.to_i
b = gets.to_i

if b < a
  puts "GREATER"
elsif a < b
  puts "LESS"
else
  puts "EQUAL"
end
//  [ruby]
a,b = 2.times.map{gets.to_i}

if a>b
  puts 'GREATER'
elsif a<b
  puts 'LESS'
else
  puts 'EQUAL'
end
//  [ruby]
a = gets.to_i
b = gets.to_i
if a == b
  puts "EQUAL"
elsif a > b
  puts "GREATER"
else
  puts "LESS"
end
//  [ruby]
a = gets.to_i
b = gets.to_i
if a == b
  puts :EQUAL
else
  puts a > b ? :GREATER: :LESS
end
//  [ruby]
a=gets.to_i
b=gets.to_i

if a>b
    puts "GREATER"
elsif a<b
    puts "LESS"
else
    puts "EQUAL"
end
//  [ruby]
A = gets.to_i
B = gets.to_i

if A > B
  puts 'GREATER'
elsif A < B
  puts 'LESS'
else
  puts 'EQUAL'
end
//  [rust]
use std::io;

fn main() {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let a = buf.trim().chars().collect::<Vec<char>>();
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let b = buf.trim().chars().collect::<Vec<char>>();
	if a.len() > b.len() {
		println!("GREATER");
	}else if a.len() < b.len() {
		println!("LESS");
	}else{
		for i in 0..a.len() {
			if a[i] > b[i] {
				println!("GREATER");
				break;
			}else if a[i] < b[i] {
				println!("LESS");
				break;
			}else{
				if i == 0 {
					println!("EQUAL");
				}
			}
		}
	}
}
//  [rust]
use std::io::*;
use std::str::FromStr;

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

fn main() {
    let a: String = read();
    let b: String = read();
    let ac: Vec<char> = a.chars().collect();
    let bc: Vec<char> = b.chars().collect();
    let mut done = false;

    if ac.len() > bc.len() {
        println!("GREATER");
        done = true;
    }

    if bc.len() > ac.len() {
        println!("LESS");
        done = true;
    }
    if done {
        return;
    }

    for i in 0..ac.len() {
        let ai = ac[i].to_digit(10).unwrap();
        let bi = bc[i].to_digit(10).unwrap();
        if ai > bi {
            println!("GREATER");
            done = true;
            break;
        }

        if bi > ai {
            println!("LESS");
            done = true;
            break;
        }
    }
    if !done {
        println!("EQUAL")
    }
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        a:chars,
        b:chars,
    }
    if a.len() > b.len(){
        println!("GREATER");
        return;
    }else if a.len() < b.len(){
         println!("LESS");
         return;
    }else{
        for i in 0..a.len(){
            let mut left:usize = a[i] as usize - 48;
            let mut right:usize = b[i] as usize - 48;
            if left > right{
                println!("GREATER");
                return;
            }else if left < right {
                println!("LESS");
                return;
            }
        }
    }
    println!("EQUAL");
}
//  [rust]
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use std::collections::*;
use std::process::exit;
use std::cmp::*;
use itertools::Itertools;
use num::*;


fn main() {
    input! {
    a:String,
    b:String,
  }
    let a=a.chars().map(|a|a.to_digit(10).unwrap()).collect_vec();
    let b=b.chars().map(|a|a.to_digit(10).unwrap()).collect_vec();
    if a.len()==b.len() {
        for i in 0..a.len() {
            if a[i]>b[i] {println!("GREATER");exit(0)}
            if a[i]<b[i] {println!("LESS");exit(0)}
        }
        println!("EQUAL")
    }
    else if a.len()>b.len(){
        println!("GREATER")
    }
    else {
        println!("LESS")
    }
}
//  [swift]
extension String{var c:Int{return self.characters.count}}
let A=readLine()!,B=readLine()!,g="GREATER",l="LESS"
print(A.c>B.c ?g:A.c<B.c ?l:A>B ?g:A<B ?l:"EQUAL")
//  [swift]
extension String{var c:Int{return self.characters.count}}
let A=readLine()!,B=readLine()!
print(A.c>B.c ?"GREATER":A.c<B.c ?"LESS":A>B ?"GREATER":A<B ?"LESS":"EQUAL")
//  [swift]
let A = readLine()!
let B = readLine()!
if A.characters.count > B.characters.count {
    print("GREATER")
} else if A.characters.count < B.characters.count {
    print("LESS")
} else if A > B {
    print("GREATER")
} else if A < B {
    print("LESS")
} else {
    print("EQUAL")
}
//  [swift]
import Foundation

let a = readLine()!
let b = readLine()!
var ans = ""
if a == b {
  ans = "EQUAL"
} else if a.count < b.count {
  ans = "LESS"
} else if a.count > b.count {
  ans = "GREATER"
} else {
  for (i, j) in zip(a, b) {
    if i > j {
      ans = "GREATER"
      break
    } else if i < j {
      ans = "LESS"
      break
    }
  }
}
print(ans)
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};
const main=()=>{
  let [a,b]=tnn(2)
  to(a>b?'GREATER':a<b?'LESS':'EQUAL')
}
main()
//  [typescript]
import * as fs from "fs";
const input = fs.readFileSync("/dev/stdin", "utf-8");

function Main(input: string) {
  const [A, B] = input.split("\n").map((str) => BigInt(Number(str)));
  if (A < B) console.log("LESS");
  else if (A === B) console.log("EQUAL");
  else if (A > B) console.log("GREATER");
}

Main(input);
//  [typescript]
import { readFileSync } from "fs";

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

const main = (input: string[][]) => {
  const A = BigInt(input[0][0]);
  const B = BigInt(input[1][0]);

  if (A === B) {
    return "EQUAL";
  } else if (A > B) {
    return "GREATER";
  } else {
    return "LESS";
  }
};

console.log(main(read()));
//  [python]
import numpy as np

s = str(input())
y, m, d = s.split("/")

y, m, d = int(y), int(m), int(d)

if y < 2019:
  print("Heisei")
elif y==2019 and m<4:
  print("Heisei")
elif y==2019 and m==4 and d <= 30:
  print("Heisei")
else:
  print("TBD")
//  [python]
s = raw_input()
y,m,d = map(int, s.split('/'))

def f(y,m,d):
	if m < 4: return True
	if m == 4 and d <= 30: return True
	return False
print 'Heisei' if f(y,m,d) else 'TBD'
//  [python]
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys  # {{{
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools
# }}}

# pre-defined{{{
sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  # can also use string module
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe
def dump(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' => '+repr(arg) for arg in args), file=sys.stderr)
# }}}

def local_input():# {{{
    from pcm.utils import set_stdin
    import sys
    from pathlib import Path
    parentdir = Path(os.path.dirname(__file__)).parent
    inputfile = parentdir.joinpath('test/sample-1.in')
    if len(sys.argv) == 1:
        set_stdin(inputfile)
# }}}

def solve():
    s = input()
    yyyy = int(s[:4])
    mm = int(s[5:7])
    # print(yyyy, mm)
    if (yyyy>=2019 and mm>=5):
        print("TBD")
    else:
        print("Heisei")
    return 0

if __name__ == "__main__":# {{{
    try:
        local_input()
    except:
        pass
    solve()
# vim: set foldmethod=marker:}}}
//  [java]
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		String TBD = "TBD";
		String HEISEI = "Heisei";

		LocalDate tbdFirstDay = LocalDate.of(2019, 5, 1);

		Scanner sc = new Scanner(System.in);
		String input = sc.nextLine();
		LocalDate dateTime = LocalDate.parse(input, DateTimeFormatter.ofPattern("yyyy/MM/dd"));
		if (dateTime.isBefore(tbdFirstDay)) {
			System.out.println(HEISEI);
		} else {
			System.out.println(TBD);
		}

	}
}
//  [java]
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;

public class Main {
	
	static final private String DATE_FORMAT = "yyyy/MM/dd";

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		LocalDate date = string2LocalDate(s);
		if(date.isAfter(LocalDate.of(2019, 4, 30))) {
			System.out.println("TBD");
		}else {
			System.out.println("Heisei");
		}
		
	}
	
	public static LocalDate string2LocalDate(final String date) {
		  return LocalDate.parse(date, DateTimeFormatter.ofPattern(DATE_FORMAT));
		}
}
//  [java]
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.next();
		
		System.out.println(LocalDate.parse(s, DateTimeFormatter.ofPattern("yyyy/MM/dd", Locale.JAPAN)).compareTo(LocalDate.of(2019, 4, 30)) <= 0 ? "Heisei" : "TBD");
	}
	
}