From ee089db748cad7d11c05403e042559ca7ffef8b8 Mon Sep 17 00:00:00 2001 From: Anthony Bullard Date: Sat, 4 Jan 2025 06:36:28 -0600 Subject: [PATCH 1/3] Remove superfluous println --- crates/compiler/fmt/src/def.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/compiler/fmt/src/def.rs b/crates/compiler/fmt/src/def.rs index 00886a5c25..6fe4d60d63 100644 --- a/crates/compiler/fmt/src/def.rs +++ b/crates/compiler/fmt/src/def.rs @@ -431,8 +431,6 @@ impl<'a> Formattable for TypeDef<'a> { fn format_with_options(&self, buf: &mut Buf, _parens: Parens, newlines: Newlines, indent: u16) { use roc_parse::ast::TypeDef::*; - println!("WTF???"); - match self { Alias { header, ann } => { header.format(buf, indent); From 4980cd86c3b115f6c5372682287af9fcd1a56855 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Thu, 2 Jan 2025 22:45:50 +0100 Subject: [PATCH 2/3] linker/macho: remove redundant checks for compressed sections --- crates/linker/src/macho.rs | 49 ++++++++++---------------------------- 1 file changed, 13 insertions(+), 36 deletions(-) diff --git a/crates/linker/src/macho.rs b/crates/linker/src/macho.rs index 227c222310..3bbb1c02bd 100644 --- a/crates/linker/src/macho.rs +++ b/crates/linker/src/macho.rs @@ -3,9 +3,8 @@ use iced_x86::{Decoder, DecoderOptions, Instruction, OpCodeOperandKind, OpKind}; use memmap2::MmapMut; use object::macho; use object::{ - CompressedFileRange, CompressionFormat, LittleEndian as LE, Object, ObjectSection, - ObjectSymbol, RelocationFlags, RelocationKind, RelocationTarget, Section, SectionIndex, - SectionKind, Symbol, SymbolIndex, SymbolSection, + LittleEndian as LE, Object, ObjectSection, ObjectSymbol, RelocationFlags, RelocationKind, + RelocationTarget, Section, SectionIndex, SectionKind, Symbol, SymbolIndex, SymbolSection, }; use roc_collections::all::MutMap; use roc_error_macros::internal_error; @@ -187,29 +186,17 @@ impl<'a> Surgeries<'a> { } fn append_text_section(&mut self, object_bytes: &[u8], sec: &Section, verbose: bool) { - let (file_offset, compressed) = match sec.compressed_file_range() { - Ok(CompressedFileRange { - format: CompressionFormat::None, - offset, - .. - }) => (offset, false), - Ok(range) => (range.offset, true), - Err(err) => { - internal_error!( - "Issues dealing with section compression for {:+x?}: {}", - sec, - err - ); - } + let file_offset = if let Some((file_offset, _)) = sec.file_range() { + file_offset + } else { + internal_error!("Could not get file range for {sec:+x?}"); }; - let data = match sec.uncompressed_data() { + let data = match sec.data() { Ok(data) => data, - Err(err) => { - internal_error!("Failed to load text section, {:+x?}: {}", sec, err); - } + Err(err) => internal_error!("Failed to load text section, {:+x?}: {err}", sec), }; - let mut decoder = Decoder::with_ip(64, &data, sec.address(), DecoderOptions::NONE); + let mut decoder = Decoder::with_ip(64, data, sec.address(), DecoderOptions::NONE); let mut inst = Instruction::default(); while decoder.can_decode() { @@ -225,10 +212,6 @@ impl<'a> Surgeries<'a> { Ok(OpKind::NearBranch16 | OpKind::NearBranch32 | OpKind::NearBranch64) => { let target = inst.near_branch_target(); if let Some(func_name) = self.app_func_addresses.get(&target) { - if compressed { - internal_error!("Surgical linking does not work with compressed text sections: {:+x?}", sec); - } - if verbose { println!( "Found branch from {:+x} to {:+x}({})", @@ -343,16 +326,10 @@ pub(crate) fn preprocess_macho_le( let (plt_address, plt_offset) = match exec_obj.section_by_name(plt_section_name) { Some(section) => { - let file_offset = match section.compressed_file_range() { - Ok( - range @ CompressedFileRange { - format: CompressionFormat::None, - .. - }, - ) => range.offset, - _ => { - internal_error!("Surgical linking does not work with compressed plt section"); - } + let file_offset = if let Some((file_offset, _)) = section.file_range() { + file_offset + } else { + internal_error!("Could not get file range for {section:+x?}"); }; (section.address(), file_offset) } From 07f930ca68b7cbd03dd1284c03d89ada237ffefc Mon Sep 17 00:00:00 2001 From: Brendan Hansknecht Date: Sat, 4 Jan 2025 08:58:36 -0800 Subject: [PATCH 3/3] update benchmark platform to PI --- crates/cli/tests/benchmarks/AStar.roc | 128 ++++++------ crates/cli/tests/benchmarks/Base64.roc | 56 ++--- crates/cli/tests/benchmarks/Base64/Decode.roc | 88 ++++---- crates/cli/tests/benchmarks/Base64/Encode.roc | 135 ++++++------ crates/cli/tests/benchmarks/Issue2279Help.roc | 4 +- crates/cli/tests/benchmarks/Quicksort.roc | 78 +++---- crates/cli/tests/benchmarks/cFold.roc | 130 ++++++------ crates/cli/tests/benchmarks/closure.roc | 52 ++--- crates/cli/tests/benchmarks/deriv.roc | 194 +++++++++--------- crates/cli/tests/benchmarks/issue2279.roc | 10 +- crates/cli/tests/benchmarks/nQueens.roc | 62 +++--- crates/cli/tests/benchmarks/platform/Host.roc | 9 + .../benchmarks/platform/PlatformTasks.roc | 9 - crates/cli/tests/benchmarks/platform/app.roc | 5 +- crates/cli/tests/benchmarks/platform/host.zig | 62 +----- crates/cli/tests/benchmarks/platform/main.roc | 8 +- crates/cli/tests/benchmarks/quicksortApp.roc | 34 +-- crates/cli/tests/benchmarks/rBTreeCk.roc | 138 ++++++------- crates/cli/tests/benchmarks/rBTreeInsert.roc | 102 ++++----- crates/cli/tests/benchmarks/testAStar.roc | 26 +-- crates/cli/tests/benchmarks/testBase64.roc | 28 ++- 21 files changed, 660 insertions(+), 698 deletions(-) create mode 100644 crates/cli/tests/benchmarks/platform/Host.roc delete mode 100644 crates/cli/tests/benchmarks/platform/PlatformTasks.roc diff --git a/crates/cli/tests/benchmarks/AStar.roc b/crates/cli/tests/benchmarks/AStar.roc index 29b8a9d974..8783c03af8 100644 --- a/crates/cli/tests/benchmarks/AStar.roc +++ b/crates/cli/tests/benchmarks/AStar.roc @@ -1,107 +1,107 @@ -module [findPath, Model, initialModel, cheapestOpen, reconstructPath] +module [find_path, Model, initial_model, cheapest_open, reconstruct_path] import Quicksort -findPath = \costFn, moveFn, start, end -> - astar costFn moveFn end (initialModel start) +find_path = \cost_fn, move_fn, start, end -> + astar(cost_fn, move_fn, end, initial_model(start)) Model position : { evaluated : Set position, - openSet : Set position, + open_set : Set position, costs : Dict position F64, - cameFrom : Dict position position, + came_from : Dict position position, } where position implements Hash & Eq -initialModel : position -> Model position where position implements Hash & Eq -initialModel = \start -> { - evaluated: Set.empty {}, - openSet: Set.single start, - costs: Dict.single start 0, - cameFrom: Dict.empty {}, +initial_model : position -> Model position where position implements Hash & Eq +initial_model = \start -> { + evaluated: Set.empty({}), + open_set: Set.single(start), + costs: Dict.single(start, 0), + came_from: Dict.empty({}), } -cheapestOpen : (position -> F64), Model position -> Result position {} where position implements Hash & Eq -cheapestOpen = \costFn, model -> - model.openSet +cheapest_open : (position -> F64), Model position -> Result position {} where position implements Hash & Eq +cheapest_open = \cost_fn, model -> + model.open_set |> Set.toList - |> List.keepOks - (\position -> - when Dict.get model.costs position is - Err _ -> Err {} - Ok cost -> Ok { cost: cost + costFn position, position } - ) - |> Quicksort.sortBy .cost + |> List.keepOks( + \position -> + when Dict.get(model.costs, position) is + Err(_) -> Err({}) + Ok(cost) -> Ok({ cost: cost + cost_fn(position), position }), + ) + |> Quicksort.sort_by(.cost) |> List.first - |> Result.map .position - |> Result.mapErr (\_ -> {}) + |> Result.map(.position) + |> Result.mapErr(\_ -> {}) -reconstructPath : Dict position position, position -> List position where position implements Hash & Eq -reconstructPath = \cameFrom, goal -> - when Dict.get cameFrom goal is - Err _ -> [] - Ok next -> List.append (reconstructPath cameFrom next) goal +reconstruct_path : Dict position position, position -> List position where position implements Hash & Eq +reconstruct_path = \came_from, goal -> + when Dict.get(came_from, goal) is + Err(_) -> [] + Ok(next) -> List.append(reconstruct_path(came_from, next), goal) -updateCost : position, position, Model position -> Model position where position implements Hash & Eq -updateCost = \current, neighbor, model -> - newCameFrom = - Dict.insert model.cameFrom neighbor current +update_cost : position, position, Model position -> Model position where position implements Hash & Eq +update_cost = \current, neighbor, model -> + new_came_from = + Dict.insert(model.came_from, neighbor, current) - newCosts = - Dict.insert model.costs neighbor distanceTo + new_costs = + Dict.insert(model.costs, neighbor, distance_to) - distanceTo = - reconstructPath newCameFrom neighbor + distance_to = + reconstruct_path(new_came_from, neighbor) |> List.len |> Num.toFrac - newModel = + new_model = { model & - costs: newCosts, - cameFrom: newCameFrom, + costs: new_costs, + came_from: new_came_from, } - when Dict.get model.costs neighbor is - Err _ -> - newModel + when Dict.get(model.costs, neighbor) is + Err(_) -> + new_model - Ok previousDistance -> - if distanceTo < previousDistance then - newModel + Ok(previous_distance) -> + if distance_to < previous_distance then + new_model else model astar : (position, position -> F64), (position -> Set position), position, Model position -> Result (List position) {} where position implements Hash & Eq -astar = \costFn, moveFn, goal, model -> - when cheapestOpen (\source -> costFn source goal) model is - Err {} -> Err {} - Ok current -> +astar = \cost_fn, move_fn, goal, model -> + when cheapest_open(\source -> cost_fn(source, goal), model) is + Err({}) -> Err({}) + Ok(current) -> if current == goal then - Ok (reconstructPath model.cameFrom goal) + Ok(reconstruct_path(model.came_from, goal)) else - modelPopped = + model_popped = { model & - openSet: Set.remove model.openSet current, - evaluated: Set.insert model.evaluated current, + open_set: Set.remove(model.open_set, current), + evaluated: Set.insert(model.evaluated, current), } neighbors = - moveFn current + move_fn(current) - newNeighbors = - Set.difference neighbors modelPopped.evaluated + new_neighbors = + Set.difference(neighbors, model_popped.evaluated) - modelWithNeighbors : Model position - modelWithNeighbors = - modelPopped - |> &openSet (Set.union modelPopped.openSet newNeighbors) + model_with_neighbors : Model position + model_with_neighbors = + model_popped + |> &open_set(Set.union(model_popped.open_set, new_neighbors)) walker : Model position, position -> Model position - walker = \amodel, n -> updateCost current n amodel + walker = \amodel, n -> update_cost(current, n, amodel) - modelWithCosts = - Set.walk newNeighbors modelWithNeighbors walker + model_with_costs = + Set.walk(new_neighbors, model_with_neighbors, walker) - astar costFn moveFn goal modelWithCosts + astar(cost_fn, move_fn, goal, model_with_costs) # takeStep = \moveFn, _goal, model, current -> # modelPopped = diff --git a/crates/cli/tests/benchmarks/Base64.roc b/crates/cli/tests/benchmarks/Base64.roc index bdf23ea2ec..65a7ecb9c6 100644 --- a/crates/cli/tests/benchmarks/Base64.roc +++ b/crates/cli/tests/benchmarks/Base64.roc @@ -1,38 +1,38 @@ -module [fromBytes, fromStr, toBytes, toStr] +module [from_bytes, from_str, to_bytes, to_str] import Base64.Decode import Base64.Encode # base 64 encoding from a sequence of bytes -fromBytes : List U8 -> Result Str [InvalidInput] -fromBytes = \bytes -> - when Base64.Decode.fromBytes bytes is - Ok v -> - Ok v +from_bytes : List U8 -> Result Str [InvalidInput] +from_bytes = \bytes -> + when Base64.Decode.from_bytes(bytes) is + Ok(v) -> + Ok(v) - Err _ -> - Err InvalidInput + Err(_) -> + Err(InvalidInput) # base 64 encoding from a string -fromStr : Str -> Result Str [InvalidInput] -fromStr = \str -> - fromBytes (Str.toUtf8 str) +from_str : Str -> Result Str [InvalidInput] +from_str = \str -> + from_bytes(Str.toUtf8(str)) # base64-encode bytes to the original -toBytes : Str -> Result (List U8) [InvalidInput] -toBytes = \str -> - Ok (Base64.Encode.toBytes str) - -toStr : Str -> Result Str [InvalidInput] -toStr = \str -> - when toBytes str is - Ok bytes -> - when Str.fromUtf8 bytes is - Ok v -> - Ok v - - Err _ -> - Err InvalidInput - - Err _ -> - Err InvalidInput +to_bytes : Str -> Result (List U8) [InvalidInput] +to_bytes = \str -> + Ok(Base64.Encode.to_bytes(str)) + +to_str : Str -> Result Str [InvalidInput] +to_str = \str -> + when to_bytes(str) is + Ok(bytes) -> + when Str.fromUtf8(bytes) is + Ok(v) -> + Ok(v) + + Err(_) -> + Err(InvalidInput) + + Err(_) -> + Err(InvalidInput) diff --git a/crates/cli/tests/benchmarks/Base64/Decode.roc b/crates/cli/tests/benchmarks/Base64/Decode.roc index 4b32bff95a..e85d08728a 100644 --- a/crates/cli/tests/benchmarks/Base64/Decode.roc +++ b/crates/cli/tests/benchmarks/Base64/Decode.roc @@ -1,86 +1,86 @@ -module [fromBytes] +module [from_bytes] import Bytes.Decode exposing [ByteDecoder, DecodeProblem] -fromBytes : List U8 -> Result Str DecodeProblem -fromBytes = \bytes -> - Bytes.Decode.decode bytes (decodeBase64 (List.len bytes)) +from_bytes : List U8 -> Result Str DecodeProblem +from_bytes = \bytes -> + Bytes.Decode.decode(bytes, decode_base64(List.len(bytes))) -decodeBase64 : U64 -> ByteDecoder Str -decodeBase64 = \width -> Bytes.Decode.loop loopHelp { remaining: width, string: "" } +decode_base64 : U64 -> ByteDecoder Str +decode_base64 = \width -> Bytes.Decode.loop(loop_help, { remaining: width, string: "" }) -loopHelp : { remaining : U64, string : Str } -> ByteDecoder (Bytes.Decode.Step { remaining : U64, string : Str } Str) -loopHelp = \{ remaining, string } -> +loop_help : { remaining : U64, string : Str } -> ByteDecoder (Bytes.Decode.Step { remaining : U64, string : Str } Str) +loop_help = \{ remaining, string } -> if remaining >= 3 then - Bytes.Decode.map3 Bytes.Decode.u8 Bytes.Decode.u8 Bytes.Decode.u8 \x, y, z -> + Bytes.Decode.map3(Bytes.Decode.u8, Bytes.Decode.u8, Bytes.Decode.u8, \x, y, z -> a : U32 - a = Num.intCast x + a = Num.intCast(x) b : U32 - b = Num.intCast y + b = Num.intCast(y) c : U32 - c = Num.intCast z - combined = Num.bitwiseOr (Num.bitwiseOr (Num.shiftLeftBy a 16) (Num.shiftLeftBy b 8)) c + c = Num.intCast(z) + combined = Num.bitwiseOr(Num.bitwiseOr(Num.shiftLeftBy(a, 16), Num.shiftLeftBy(b, 8)), c) - Loop { + Loop({ remaining: remaining - 3, - string: Str.concat string (bitsToChars combined 0), - } + string: Str.concat(string, bits_to_chars(combined, 0)), + })) else if remaining == 0 then - Bytes.Decode.succeed (Done string) + Bytes.Decode.succeed(Done(string)) else if remaining == 2 then - Bytes.Decode.map2 Bytes.Decode.u8 Bytes.Decode.u8 \x, y -> + Bytes.Decode.map2(Bytes.Decode.u8, Bytes.Decode.u8, \x, y -> a : U32 - a = Num.intCast x + a = Num.intCast(x) b : U32 - b = Num.intCast y - combined = Num.bitwiseOr (Num.shiftLeftBy a 16) (Num.shiftLeftBy b 8) + b = Num.intCast(y) + combined = Num.bitwiseOr(Num.shiftLeftBy(a, 16), Num.shiftLeftBy(b, 8)) - Done (Str.concat string (bitsToChars combined 1)) + Done(Str.concat(string, bits_to_chars(combined, 1)))) else # remaining = 1 - Bytes.Decode.map Bytes.Decode.u8 \x -> + Bytes.Decode.map(Bytes.Decode.u8, \x -> a : U32 - a = Num.intCast x + a = Num.intCast(x) - Done (Str.concat string (bitsToChars (Num.shiftLeftBy a 16) 2)) + Done(Str.concat(string, bits_to_chars(Num.shiftLeftBy(a, 16), 2)))) -bitsToChars : U32, Int * -> Str -bitsToChars = \bits, missing -> - when Str.fromUtf8 (bitsToCharsHelp bits missing) is - Ok str -> str - Err _ -> "" +bits_to_chars : U32, Int * -> Str +bits_to_chars = \bits, missing -> + when Str.fromUtf8(bits_to_chars_help(bits, missing)) is + Ok(str) -> str + Err(_) -> "" # Mask that can be used to get the lowest 6 bits of a binary number -lowest6BitsMask : Int * -lowest6BitsMask = 63 +lowest6_bits_mask : Int * +lowest6_bits_mask = 63 -bitsToCharsHelp : U32, Int * -> List U8 -bitsToCharsHelp = \bits, missing -> +bits_to_chars_help : U32, Int * -> List U8 +bits_to_chars_help = \bits, missing -> # The input is 24 bits, which we have to partition into 4 6-bit segments. We achieve this by # shifting to the right by (a multiple of) 6 to remove unwanted bits on the right, then `Num.bitwiseAnd` # with `0b111111` (which is 2^6 - 1 or 63) (so, 6 1s) to remove unwanted bits on the left. # any 6-bit number is a valid base64 digit, so this is actually safe p = - Num.shiftRightZfBy bits 18 + Num.shiftRightZfBy(bits, 18) |> Num.intCast - |> unsafeToChar + |> unsafe_to_char q = - Num.bitwiseAnd (Num.shiftRightZfBy bits 12) lowest6BitsMask + Num.bitwiseAnd(Num.shiftRightZfBy(bits, 12), lowest6_bits_mask) |> Num.intCast - |> unsafeToChar + |> unsafe_to_char r = - Num.bitwiseAnd (Num.shiftRightZfBy bits 6) lowest6BitsMask + Num.bitwiseAnd(Num.shiftRightZfBy(bits, 6), lowest6_bits_mask) |> Num.intCast - |> unsafeToChar + |> unsafe_to_char s = - Num.bitwiseAnd bits lowest6BitsMask + Num.bitwiseAnd(bits, lowest6_bits_mask) |> Num.intCast - |> unsafeToChar + |> unsafe_to_char equals : U8 equals = 61 @@ -94,8 +94,8 @@ bitsToCharsHelp = \bits, missing -> [] # Base64 index to character/digit -unsafeToChar : U8 -> U8 -unsafeToChar = \n -> +unsafe_to_char : U8 -> U8 +unsafe_to_char = \n -> if n <= 25 then # uppercase characters 65 + n diff --git a/crates/cli/tests/benchmarks/Base64/Encode.roc b/crates/cli/tests/benchmarks/Base64/Encode.roc index 66e195509b..4916512203 100644 --- a/crates/cli/tests/benchmarks/Base64/Encode.roc +++ b/crates/cli/tests/benchmarks/Base64/Encode.roc @@ -1,22 +1,22 @@ -module [toBytes] +module [to_bytes] import Bytes.Encode exposing [ByteEncoder] InvalidChar : U8 # State : [None, One U8, Two U8, Three U8] -toBytes : Str -> List U8 -toBytes = \str -> +to_bytes : Str -> List U8 +to_bytes = \str -> str |> Str.toUtf8 - |> encodeChunks + |> encode_chunks |> Bytes.Encode.sequence |> Bytes.Encode.encode -encodeChunks : List U8 -> List ByteEncoder -encodeChunks = \bytes -> - List.walk bytes { output: [], accum: None } folder - |> encodeResidual +encode_chunks : List U8 -> List ByteEncoder +encode_chunks = \bytes -> + List.walk(bytes, { output: [], accum: None }, folder) + |> encode_residual coerce : U64, a -> a coerce = \_, x -> x @@ -24,113 +24,114 @@ coerce = \_, x -> x # folder : { output : List ByteEncoder, accum : State }, U8 -> { output : List ByteEncoder, accum : State } folder = \{ output, accum }, char -> when accum is - Unreachable n -> coerce n { output, accum: Unreachable n } - None -> { output, accum: One char } - One a -> { output, accum: Two a char } - Two a b -> { output, accum: Three a b char } - Three a b c -> - when encodeCharacters a b c char is - Ok encoder -> + Unreachable(n) -> coerce(n, { output, accum: Unreachable(n) }) + None -> { output, accum: One(char) } + One(a) -> { output, accum: Two(a, char) } + Two(a, b) -> { output, accum: Three(a, b, char) } + Three(a, b, c) -> + when encode_characters(a, b, c, char) is + Ok(encoder) -> { - output: List.append output encoder, + output: List.append(output, encoder), accum: None, } - Err _ -> + Err(_) -> { output, accum: None } # SGVs bG8g V29y bGQ= # encodeResidual : { output : List ByteEncoder, accum : State } -> List ByteEncoder -encodeResidual = \{ output, accum } -> +encode_residual = \{ output, accum } -> when accum is - Unreachable _ -> output + Unreachable(_) -> output None -> output - One _ -> output - Two a b -> - when encodeCharacters a b equals equals is - Ok encoder -> List.append output encoder - Err _ -> output + One(_) -> output + Two(a, b) -> + when encode_characters(a, b, equals, equals) is + Ok(encoder) -> List.append(output, encoder) + Err(_) -> output - Three a b c -> - when encodeCharacters a b c equals is - Ok encoder -> List.append output encoder - Err _ -> output + Three(a, b, c) -> + when encode_characters(a, b, c, equals) is + Ok(encoder) -> List.append(output, encoder) + Err(_) -> output equals : U8 equals = 61 # Convert 4 characters to 24 bits (as an ByteEncoder) -encodeCharacters : U8, U8, U8, U8 -> Result ByteEncoder InvalidChar -encodeCharacters = \a, b, c, d -> - if !(isValidChar a) then - Err a - else if !(isValidChar b) then - Err b +encode_characters : U8, U8, U8, U8 -> Result ByteEncoder InvalidChar +encode_characters = \a, b, c, d -> + if !(is_valid_char(a)) then + Err(a) + else if !(is_valid_char(b)) then + Err(b) else # `=` is the padding character, and must be special-cased # only the `c` and `d` char are allowed to be padding - n1 = unsafeConvertChar a - n2 = unsafeConvertChar b + n1 = unsafe_convert_char(a) + n2 = unsafe_convert_char(b) x : U32 - x = Num.intCast n1 + x = Num.intCast(n1) y : U32 - y = Num.intCast n2 + y = Num.intCast(n2) if d == equals then if c == equals then - n = Num.bitwiseOr (Num.shiftLeftBy x 18) (Num.shiftLeftBy y 12) + n = Num.bitwiseOr(Num.shiftLeftBy(x, 18), Num.shiftLeftBy(y, 12)) # masking higher bits is not needed, Encode.unsignedInt8 ignores higher bits b1 : U8 - b1 = Num.intCast (Num.shiftRightBy n 16) + b1 = Num.intCast(Num.shiftRightBy(n, 16)) - Ok (Bytes.Encode.u8 b1) - else if !(isValidChar c) then - Err c + Ok(Bytes.Encode.u8(b1)) + else if !(is_valid_char(c)) then + Err(c) else - n3 = unsafeConvertChar c + n3 = unsafe_convert_char(c) z : U32 - z = Num.intCast n3 + z = Num.intCast(n3) - n = Num.bitwiseOr (Num.bitwiseOr (Num.shiftLeftBy x 18) (Num.shiftLeftBy y 12)) (Num.shiftLeftBy z 6) + n = Num.bitwiseOr(Num.bitwiseOr(Num.shiftLeftBy(x, 18), Num.shiftLeftBy(y, 12)), Num.shiftLeftBy(z, 6)) combined : U16 - combined = Num.intCast (Num.shiftRightBy n 8) + combined = Num.intCast(Num.shiftRightBy(n, 8)) - Ok (Bytes.Encode.u16 BE combined) - else if !(isValidChar d) then - Err d + Ok(Bytes.Encode.u16(BE, combined)) + else if !(is_valid_char(d)) then + Err(d) else - n3 = unsafeConvertChar c - n4 = unsafeConvertChar d + n3 = unsafe_convert_char(c) + n4 = unsafe_convert_char(d) z : U32 - z = Num.intCast n3 + z = Num.intCast(n3) w : U32 - w = Num.intCast n4 + w = Num.intCast(n4) n = - Num.bitwiseOr - (Num.bitwiseOr (Num.shiftLeftBy x 18) (Num.shiftLeftBy y 12)) - (Num.bitwiseOr (Num.shiftLeftBy z 6) w) + Num.bitwiseOr( + Num.bitwiseOr(Num.shiftLeftBy(x, 18), Num.shiftLeftBy(y, 12)), + Num.bitwiseOr(Num.shiftLeftBy(z, 6), w), + ) b3 : U8 - b3 = Num.intCast n + b3 = Num.intCast(n) combined : U16 - combined = Num.intCast (Num.shiftRightBy n 8) + combined = Num.intCast(Num.shiftRightBy(n, 8)) - Ok (Bytes.Encode.sequence [Bytes.Encode.u16 BE combined, Bytes.Encode.u8 b3]) + Ok(Bytes.Encode.sequence([Bytes.Encode.u16(BE, combined), Bytes.Encode.u8(b3)])) # is the character a base64 digit? # The base16 digits are: A-Z, a-z, 0-1, '+' and '/' -isValidChar : U8 -> Bool -isValidChar = \c -> - if isAlphaNum c then +is_valid_char : U8 -> Bool +is_valid_char = \c -> + if is_alpha_num(c) then Bool.true else when c is @@ -145,14 +146,14 @@ isValidChar = \c -> _ -> Bool.false -isAlphaNum : U8 -> Bool -isAlphaNum = \key -> +is_alpha_num : U8 -> Bool +is_alpha_num = \key -> (key >= 48 && key <= 57) || (key >= 64 && key <= 90) || (key >= 97 && key <= 122) # Convert a base64 character/digit to its index # See also [Wikipedia](https://en.wikipedia.org/wiki/Base64#Base64_table) -unsafeConvertChar : U8 -> U8 -unsafeConvertChar = \key -> +unsafe_convert_char : U8 -> U8 +unsafe_convert_char = \key -> if key >= 65 && key <= 90 then # A-Z key - 65 diff --git a/crates/cli/tests/benchmarks/Issue2279Help.roc b/crates/cli/tests/benchmarks/Issue2279Help.roc index 3f33b2ac86..7e6c53d6bd 100644 --- a/crates/cli/tests/benchmarks/Issue2279Help.roc +++ b/crates/cli/tests/benchmarks/Issue2279Help.roc @@ -1,5 +1,5 @@ -module [text, asText] +module [text, as_text] text = "Hello, world!" -asText = Num.toStr +as_text = Num.toStr diff --git a/crates/cli/tests/benchmarks/Quicksort.roc b/crates/cli/tests/benchmarks/Quicksort.roc index 5f36d00f92..681bb02863 100644 --- a/crates/cli/tests/benchmarks/Quicksort.roc +++ b/crates/cli/tests/benchmarks/Quicksort.roc @@ -1,75 +1,75 @@ -module [sortBy, sortWith, show] +module [sort_by, sort_with, show] show : List I64 -> Str show = \list -> - if List.isEmpty list then + if List.isEmpty(list) then "[]" else content = list - |> List.map Num.toStr - |> Str.joinWith ", " + |> List.map(Num.toStr) + |> Str.joinWith(", ") "[$(content)]" -sortBy : List a, (a -> Num *) -> List a -sortBy = \list, toComparable -> - sortWith list (\x, y -> Num.compare (toComparable x) (toComparable y)) +sort_by : List a, (a -> Num *) -> List a +sort_by = \list, to_comparable -> + sort_with(list, \x, y -> Num.compare(to_comparable(x), to_comparable(y))) Order a : a, a -> [LT, GT, EQ] -sortWith : List a, (a, a -> [LT, GT, EQ]) -> List a -sortWith = \list, order -> - n = List.len list +sort_with : List a, (a, a -> [LT, GT, EQ]) -> List a +sort_with = \list, order -> + n = List.len(list) - quicksortHelp list order 0 (n - 1) + quicksort_help(list, order, 0, (n - 1)) -quicksortHelp : List a, Order a, U64, U64 -> List a -quicksortHelp = \list, order, low, high -> +quicksort_help : List a, Order a, U64, U64 -> List a +quicksort_help = \list, order, low, high -> if low < high then - when partition low high list order is - Pair partitionIndex partitioned -> + when partition(low, high, list, order) is + Pair(partition_index, partitioned) -> partitioned - |> quicksortHelp order low (Num.subSaturated partitionIndex 1) - |> quicksortHelp order (partitionIndex + 1) high + |> quicksort_help(order, low, Num.subSaturated(partition_index, 1)) + |> quicksort_help(order, (partition_index + 1), high) else list partition : U64, U64, List a, Order a -> [Pair U64 (List a)] -partition = \low, high, initialList, order -> - when List.get initialList high is - Ok pivot -> - when partitionHelp low low initialList order high pivot is - Pair newI newList -> - Pair newI (swap newI high newList) +partition = \low, high, initial_list, order -> + when List.get(initial_list, high) is + Ok(pivot) -> + when partition_help(low, low, initial_list, order, high, pivot) is + Pair(new_i, new_list) -> + Pair(new_i, swap(new_i, high, new_list)) - Err _ -> - Pair low initialList + Err(_) -> + Pair(low, initial_list) -partitionHelp : U64, U64, List c, Order c, U64, c -> [Pair U64 (List c)] -partitionHelp = \i, j, list, order, high, pivot -> +partition_help : U64, U64, List c, Order c, U64, c -> [Pair U64 (List c)] +partition_help = \i, j, list, order, high, pivot -> if j < high then - when List.get list j is - Ok value -> - when order value pivot is + when List.get(list, j) is + Ok(value) -> + when order(value, pivot) is LT | EQ -> - partitionHelp (i + 1) (j + 1) (swap i j list) order high pivot + partition_help((i + 1), (j + 1), swap(i, j, list), order, high, pivot) GT -> - partitionHelp i (j + 1) list order high pivot + partition_help(i, (j + 1), list, order, high, pivot) - Err _ -> - Pair i list + Err(_) -> + Pair(i, list) else - Pair i list + Pair(i, list) swap : U64, U64, List a -> List a swap = \i, j, list -> - when Pair (List.get list i) (List.get list j) is - Pair (Ok atI) (Ok atJ) -> + when Pair(List.get(list, i), List.get(list, j)) is + Pair(Ok(at_i), Ok(at_j)) -> list - |> List.set i atJ - |> List.set j atI + |> List.set(i, at_j) + |> List.set(j, at_i) _ -> [] diff --git a/crates/cli/tests/benchmarks/cFold.roc b/crates/cli/tests/benchmarks/cFold.roc index 685827a07c..5bfe918807 100644 --- a/crates/cli/tests/benchmarks/cFold.roc +++ b/crates/cli/tests/benchmarks/cFold.roc @@ -1,31 +1,31 @@ -app [main] { pf: platform "platform/main.roc" } +app [main!] { pf: platform "platform/main.roc" } -import pf.PlatformTasks +import pf.Host # adapted from https://github.com/koka-lang/koka/blob/master/test/bench/haskell/cfold.hs -main : Task {} [] -main = - { value, isError } = PlatformTasks.getInt! - inputResult = - if isError then - Err GetIntError +main! : {} => {} +main! = \{} -> + { value, is_error } = Host.get_int!({}) + input_result = + if is_error then + Err(GetIntError) else - Ok value + Ok(value) - when inputResult is - Ok n -> - e = mkExpr n 1 # original koka n = 20 (set `ulimit -s unlimited` to avoid stack overflow for n = 20) - unoptimized = eval e - optimized = eval (constFolding (reassoc e)) + when input_result is + Ok(n) -> + e = mk_expr(n, 1) # original koka n = 20 (set `ulimit -s unlimited` to avoid stack overflow for n = 20) + unoptimized = eval(e) + optimized = eval(const_folding(reassoc(e))) unoptimized |> Num.toStr - |> Str.concat " & " - |> Str.concat (Num.toStr optimized) - |> PlatformTasks.putLine + |> Str.concat(" & ") + |> Str.concat(Num.toStr(optimized)) + |> Host.put_line! - Err GetIntError -> - PlatformTasks.putLine "Error: Failed to get Integer from stdin." + Err(GetIntError) -> + Host.put_line!("Error: Failed to get Integer from stdin.") Expr : [ Add Expr Expr, @@ -34,97 +34,97 @@ Expr : [ Var I64, ] -mkExpr : I64, I64 -> Expr -mkExpr = \n, v -> +mk_expr : I64, I64 -> Expr +mk_expr = \n, v -> when n is 0 -> - if v == 0 then Var 1 else Val v + if v == 0 then Var(1) else Val(v) _ -> - Add (mkExpr (n - 1) (v + 1)) (mkExpr (n - 1) (max (v - 1) 0)) + Add(mk_expr((n - 1), (v + 1)), mk_expr((n - 1), max((v - 1), 0))) max : I64, I64 -> I64 max = \a, b -> if a > b then a else b -appendAdd : Expr, Expr -> Expr -appendAdd = \e1, e2 -> +append_add : Expr, Expr -> Expr +append_add = \e1, e2 -> when e1 is - Add a1 a2 -> - Add a1 (appendAdd a2 e2) + Add(a1, a2) -> + Add(a1, append_add(a2, e2)) _ -> - Add e1 e2 + Add(e1, e2) -appendMul : Expr, Expr -> Expr -appendMul = \e1, e2 -> +append_mul : Expr, Expr -> Expr +append_mul = \e1, e2 -> when e1 is - Mul a1 a2 -> - Mul a1 (appendMul a2 e2) + Mul(a1, a2) -> + Mul(a1, append_mul(a2, e2)) _ -> - Mul e1 e2 + Mul(e1, e2) eval : Expr -> I64 eval = \e -> when e is - Var _ -> + Var(_) -> 0 - Val v -> + Val(v) -> v - Add l r -> - eval l + eval r + Add(l, r) -> + eval(l) + eval(r) - Mul l r -> - eval l * eval r + Mul(l, r) -> + eval(l) * eval(r) reassoc : Expr -> Expr reassoc = \e -> when e is - Add e1 e2 -> - x1 = reassoc e1 - x2 = reassoc e2 + Add(e1, e2) -> + x1 = reassoc(e1) + x2 = reassoc(e2) - appendAdd x1 x2 + append_add(x1, x2) - Mul e1 e2 -> - x1 = reassoc e1 - x2 = reassoc e2 + Mul(e1, e2) -> + x1 = reassoc(e1) + x2 = reassoc(e2) - appendMul x1 x2 + append_mul(x1, x2) _ -> e -constFolding : Expr -> Expr -constFolding = \e -> +const_folding : Expr -> Expr +const_folding = \e -> when e is - Add e1 e2 -> - x1 = constFolding e1 - x2 = constFolding e2 + Add(e1, e2) -> + x1 = const_folding(e1) + x2 = const_folding(e2) when x1 is - Val a -> + Val(a) -> when x2 is - Val b -> Val (a + b) - Add (Val b) x | Add x (Val b) -> Add (Val (a + b)) x - _ -> Add x1 x2 + Val(b) -> Val((a + b)) + Add(Val(b), x) | Add(x, Val(b)) -> Add(Val((a + b)), x) + _ -> Add(x1, x2) - _ -> Add x1 x2 + _ -> Add(x1, x2) - Mul e1 e2 -> - x1 = constFolding e1 - x2 = constFolding e2 + Mul(e1, e2) -> + x1 = const_folding(e1) + x2 = const_folding(e2) when x1 is - Val a -> + Val(a) -> when x2 is - Val b -> Val (a * b) - Mul (Val b) x | Mul x (Val b) -> Mul (Val (a * b)) x - _ -> Mul x1 x2 + Val(b) -> Val((a * b)) + Mul(Val(b), x) | Mul(x, Val(b)) -> Mul(Val((a * b)), x) + _ -> Mul(x1, x2) - _ -> Mul x1 x2 + _ -> Mul(x1, x2) _ -> e diff --git a/crates/cli/tests/benchmarks/closure.roc b/crates/cli/tests/benchmarks/closure.roc index d6cda3f73f..c7d96bf4f7 100644 --- a/crates/cli/tests/benchmarks/closure.roc +++ b/crates/cli/tests/benchmarks/closure.roc @@ -1,48 +1,50 @@ -app [main] { pf: platform "platform/main.roc" } - -main : Task {} [] -main = - closure1 {} - |> Task.await (\_ -> closure2 {}) - |> Task.await (\_ -> closure3 {}) - |> Task.await (\_ -> closure4 {}) +app [main!] { pf: platform "platform/main.roc" } + +main! : {} => {} +main! = \{} -> + closure1({}) + |> Result.try(closure2) + |> Result.try(closure3) + |> Result.try(closure4) + |> Result.withDefault({}) + # --- -closure1 : {} -> Task {} [] +closure1 : {} -> Result {} [] closure1 = \_ -> - Task.ok (foo toUnitBorrowed "a long string such that it's malloced") - |> Task.map \_ -> {} + Ok(foo(to_unit_borrowed, "a long string such that it's malloced")) + |> Result.map(\_ -> {}) -toUnitBorrowed = \x -> Str.countUtf8Bytes x +to_unit_borrowed = \x -> Str.countUtf8Bytes(x) -foo = \f, x -> f x +foo = \f, x -> f(x) # --- -closure2 : {} -> Task {} [] +closure2 : {} -> Result {} [] closure2 = \_ -> x : Str x = "a long string such that it's malloced" - Task.ok {} - |> Task.map (\_ -> x) - |> Task.map toUnit + Ok({}) + |> Result.map(\_ -> x) + |> Result.map(to_unit) -toUnit = \_ -> {} +to_unit = \_ -> {} # # --- -closure3 : {} -> Task {} [] +closure3 : {} -> Result {} [] closure3 = \_ -> x : Str x = "a long string such that it's malloced" - Task.ok {} - |> Task.await (\_ -> Task.ok x |> Task.map (\_ -> {})) + Ok({}) + |> Result.try(\_ -> Ok(x) |> Result.map(\_ -> {})) # # --- -closure4 : {} -> Task {} [] +closure4 : {} -> Result {} [] closure4 = \_ -> x : Str x = "a long string such that it's malloced" - Task.ok {} - |> Task.await (\_ -> Task.ok x) - |> Task.map (\_ -> {}) + Ok({}) + |> Result.try(\_ -> Ok(x)) + |> Result.map(\_ -> {}) diff --git a/crates/cli/tests/benchmarks/deriv.roc b/crates/cli/tests/benchmarks/deriv.roc index 25806ac9d6..be43ef8670 100644 --- a/crates/cli/tests/benchmarks/deriv.roc +++ b/crates/cli/tests/benchmarks/deriv.roc @@ -1,51 +1,49 @@ -app [main] { pf: platform "platform/main.roc" } +app [main!] { pf: platform "platform/main.roc" } -import pf.PlatformTasks +import pf.Host # based on: https://github.com/koka-lang/koka/blob/master/test/bench/haskell/deriv.hs -IO a : Task a [] - -main : Task {} [] -main = - { value, isError } = PlatformTasks.getInt! - inputResult = - if isError then - Err GetIntError +main! : {} => {} +main! = \{} -> + { value, is_error } = Host.get_int!({}) + input_result = + if is_error then + Err(GetIntError) else - Ok value + Ok(value) - when inputResult is - Ok n -> + when input_result is + Ok(n) -> x : Expr - x = Var "x" + x = Var("x") f : Expr - f = pow x x + f = pow(x, x) - nest deriv n f # original koka n = 10 - |> Task.map \_ -> {} + _ = nest!(deriv!, n, f) # original koka n = 10 + {} - Err GetIntError -> - PlatformTasks.putLine "Error: Failed to get Integer from stdin." + Err(GetIntError) -> + Host.put_line!("Error: Failed to get Integer from stdin.") -nestHelp : I64, (I64, Expr -> IO Expr), I64, Expr -> IO Expr -nestHelp = \s, f, m, x -> +nest_help! : I64, (I64, Expr => Expr), I64, Expr => Expr +nest_help! = \s, f!, m, x -> when m is - 0 -> Task.ok x + 0 -> x _ -> - w = f! (s - m) x - nestHelp s f (m - 1) w + w = f!((s - m), x) + nest_help!(s, f!, (m - 1), w) -nest : (I64, Expr -> IO Expr), I64, Expr -> IO Expr -nest = \f, n, e -> nestHelp n f n e +nest! : (I64, Expr => Expr), I64, Expr => Expr +nest! = \f!, n, e -> nest_help!(n, f!, n, e) Expr : [Val I64, Var Str, Add Expr Expr, Mul Expr Expr, Pow Expr Expr, Ln Expr] divmod : I64, I64 -> Result { div : I64, mod : I64 } [DivByZero] divmod = \l, r -> - when Pair (Num.divTruncChecked l r) (Num.remChecked l r) is - Pair (Ok div) (Ok mod) -> Ok { div, mod } - _ -> Err DivByZero + when Pair(Num.divTruncChecked(l, r), Num.remChecked(l, r)) is + Pair(Ok(div), Ok(mod)) -> Ok({ div, mod }) + _ -> Err(DivByZero) pown : I64, I64 -> I64 pown = \a, n -> @@ -53,119 +51,119 @@ pown = \a, n -> 0 -> 1 1 -> a _ -> - when divmod n 2 is - Ok { div, mod } -> - b = pown a div + when divmod(n, 2) is + Ok({ div, mod }) -> + b = pown(a, div) b * b * (if mod == 0 then 1 else a) - Err DivByZero -> + Err(DivByZero) -> -1 add : Expr, Expr -> Expr add = \a, b -> - when Pair a b is - Pair (Val n) (Val m) -> - Val (n + m) + when Pair(a, b) is + Pair(Val(n), Val(m)) -> + Val((n + m)) - Pair (Val 0) f -> + Pair(Val(0), f) -> f - Pair f (Val 0) -> + Pair(f, Val(0)) -> f - Pair f (Val n) -> - add (Val n) f + Pair(f, Val(n)) -> + add(Val(n), f) - Pair (Val n) (Add (Val m) f) -> - add (Val (n + m)) f + Pair(Val(n), Add(Val(m), f)) -> + add(Val((n + m)), f) - Pair f (Add (Val n) g) -> - add (Val n) (add f g) + Pair(f, Add(Val(n), g)) -> + add(Val(n), add(f, g)) - Pair (Add f g) h -> - add f (add g h) + Pair(Add(f, g), h) -> + add(f, add(g, h)) - Pair f g -> - Add f g + Pair(f, g) -> + Add(f, g) mul : Expr, Expr -> Expr mul = \a, b -> - when Pair a b is - Pair (Val n) (Val m) -> - Val (n * m) + when Pair(a, b) is + Pair(Val(n), Val(m)) -> + Val((n * m)) - Pair (Val 0) _ -> - Val 0 + Pair(Val(0), _) -> + Val(0) - Pair _ (Val 0) -> - Val 0 + Pair(_, Val(0)) -> + Val(0) - Pair (Val 1) f -> + Pair(Val(1), f) -> f - Pair f (Val 1) -> + Pair(f, Val(1)) -> f - Pair f (Val n) -> - mul (Val n) f + Pair(f, Val(n)) -> + mul(Val(n), f) - Pair (Val n) (Mul (Val m) f) -> - mul (Val (n * m)) f + Pair(Val(n), Mul(Val(m), f)) -> + mul(Val((n * m)), f) - Pair f (Mul (Val n) g) -> - mul (Val n) (mul f g) + Pair(f, Mul(Val(n), g)) -> + mul(Val(n), mul(f, g)) - Pair (Mul f g) h -> - mul f (mul g h) + Pair(Mul(f, g), h) -> + mul(f, mul(g, h)) - Pair f g -> - Mul f g + Pair(f, g) -> + Mul(f, g) pow : Expr, Expr -> Expr pow = \a, b -> - when Pair a b is - Pair (Val m) (Val n) -> Val (pown m n) - Pair _ (Val 0) -> Val 1 - Pair f (Val 1) -> f - Pair (Val 0) _ -> Val 0 - Pair f g -> Pow f g + when Pair(a, b) is + Pair(Val(m), Val(n)) -> Val(pown(m, n)) + Pair(_, Val(0)) -> Val(1) + Pair(f, Val(1)) -> f + Pair(Val(0), _) -> Val(0) + Pair(f, g) -> Pow(f, g) ln : Expr -> Expr ln = \f -> when f is - Val 1 -> Val 0 - _ -> Ln f + Val(1) -> Val(0) + _ -> Ln(f) d : Str, Expr -> Expr d = \x, expr -> when expr is - Val _ -> Val 0 - Var y -> if x == y then Val 1 else Val 0 - Add f g -> add (d x f) (d x g) - Mul f g -> add (mul f (d x g)) (mul g (d x f)) - Pow f g -> - mul (pow f g) (add (mul (mul g (d x f)) (pow f (Val (-1)))) (mul (ln f) (d x g))) + Val(_) -> Val(0) + Var(y) -> if x == y then Val(1) else Val(0) + Add(f, g) -> add(d(x, f), d(x, g)) + Mul(f, g) -> add(mul(f, d(x, g)), mul(g, d(x, f))) + Pow(f, g) -> + mul(pow(f, g), add(mul(mul(g, d(x, f)), pow(f, Val(-1))), mul(ln(f), d(x, g)))) - Ln f -> - mul (d x f) (pow f (Val (-1))) + Ln(f) -> + mul(d(x, f), pow(f, Val(-1))) count : Expr -> I64 count = \expr -> when expr is - Val _ -> 1 - Var _ -> 1 - Add f g -> count f + count g - Mul f g -> count f + count g - Pow f g -> count f + count g - Ln f -> count f - -deriv : I64, Expr -> IO Expr -deriv = \i, f -> - fprime = d "x" f + Val(_) -> 1 + Var(_) -> 1 + Add(f, g) -> count(f) + count(g) + Mul(f, g) -> count(f) + count(g) + Pow(f, g) -> count(f) + count(g) + Ln(f) -> count(f) + +deriv! : I64, Expr => Expr +deriv! = \i, f -> + fprime = d("x", f) line = - Num.toStr (i + 1) - |> Str.concat " count: " - |> Str.concat (Num.toStr (count fprime)) - PlatformTasks.putLine! line - Task.ok fprime + Num.toStr((i + 1)) + |> Str.concat(" count: ") + |> Str.concat(Num.toStr(count(fprime))) + Host.put_line!(line) + fprime diff --git a/crates/cli/tests/benchmarks/issue2279.roc b/crates/cli/tests/benchmarks/issue2279.roc index 1ec76f507a..4e2792cdd9 100644 --- a/crates/cli/tests/benchmarks/issue2279.roc +++ b/crates/cli/tests/benchmarks/issue2279.roc @@ -1,13 +1,13 @@ -app [main] { pf: platform "platform/main.roc" } +app [main!] { pf: platform "platform/main.roc" } import Issue2279Help -import pf.PlatformTasks +import pf.Host -main = +main! = \{} -> text = if Bool.true then Issue2279Help.text else - Issue2279Help.asText 42 + Issue2279Help.as_text(42) - PlatformTasks.putLine text + Host.put_line!(text) diff --git a/crates/cli/tests/benchmarks/nQueens.roc b/crates/cli/tests/benchmarks/nQueens.roc index 09eb39fab6..51098b25d6 100644 --- a/crates/cli/tests/benchmarks/nQueens.roc +++ b/crates/cli/tests/benchmarks/nQueens.roc @@ -1,66 +1,66 @@ -app [main] { pf: platform "platform/main.roc" } +app [main!] { pf: platform "platform/main.roc" } -import pf.PlatformTasks +import pf.Host -main : Task {} [] -main = - { value, isError } = PlatformTasks.getInt! - inputResult = - if isError then - Err GetIntError +main! : {} => {} +main! = \{} -> + { value, is_error } = Host.get_int!({}) + input_result = + if is_error then + Err(GetIntError) else - Ok value + Ok(value) - when inputResult is - Ok n -> - queens n # original koka 13 + when input_result is + Ok(n) -> + queens(n) # original koka 13 |> Num.toStr - |> PlatformTasks.putLine + |> Host.put_line! - Err GetIntError -> - PlatformTasks.putLine "Error: Failed to get Integer from stdin." + Err(GetIntError) -> + Host.put_line!("Error: Failed to get Integer from stdin.") ConsList a : [Nil, Cons a (ConsList a)] -queens = \n -> length (findSolutions n n) +queens = \n -> length(find_solutions(n, n)) -findSolutions = \n, k -> +find_solutions = \n, k -> if k <= 0 then # should we use U64 as input type here instead? - Cons Nil Nil + Cons(Nil, Nil) else - extend n Nil (findSolutions n (k - 1)) + extend(n, Nil, find_solutions(n, (k - 1))) extend = \n, acc, solutions -> when solutions is Nil -> acc - Cons soln rest -> extend n (appendSafe n soln acc) rest + Cons(soln, rest) -> extend(n, append_safe(n, soln, acc), rest) -appendSafe : I64, ConsList I64, ConsList (ConsList I64) -> ConsList (ConsList I64) -appendSafe = \k, soln, solns -> +append_safe : I64, ConsList I64, ConsList (ConsList I64) -> ConsList (ConsList I64) +append_safe = \k, soln, solns -> if k <= 0 then solns - else if safe k 1 soln then - appendSafe (k - 1) soln (Cons (Cons k soln) solns) + else if safe(k, 1, soln) then + append_safe((k - 1), soln, Cons(Cons(k, soln), solns)) else - appendSafe (k - 1) soln solns + append_safe((k - 1), soln, solns) safe : I64, I64, ConsList I64 -> Bool safe = \queen, diagonal, xs -> when xs is Nil -> Bool.true - Cons q t -> + Cons(q, t) -> if queen != q && queen != q + diagonal && queen != q - diagonal then - safe queen (diagonal + 1) t + safe(queen, (diagonal + 1), t) else Bool.false length : ConsList a -> I64 length = \xs -> - lengthHelp xs 0 + length_help(xs, 0) -lengthHelp : ConsList a, I64 -> I64 -lengthHelp = \foobar, acc -> +length_help : ConsList a, I64 -> I64 +length_help = \foobar, acc -> when foobar is - Cons _ lrest -> lengthHelp lrest (1 + acc) + Cons(_, lrest) -> length_help(lrest, (1 + acc)) Nil -> acc diff --git a/crates/cli/tests/benchmarks/platform/Host.roc b/crates/cli/tests/benchmarks/platform/Host.roc new file mode 100644 index 0000000000..25019c7c90 --- /dev/null +++ b/crates/cli/tests/benchmarks/platform/Host.roc @@ -0,0 +1,9 @@ +hosted Host + exposes [put_line!, put_int!, get_int!] + imports [] + +put_line! : Str => {} + +put_int! : I64 => {} + +get_int! : {} => { value : I64, is_error : Bool } diff --git a/crates/cli/tests/benchmarks/platform/PlatformTasks.roc b/crates/cli/tests/benchmarks/platform/PlatformTasks.roc deleted file mode 100644 index 81b7acf111..0000000000 --- a/crates/cli/tests/benchmarks/platform/PlatformTasks.roc +++ /dev/null @@ -1,9 +0,0 @@ -hosted PlatformTasks - exposes [putLine, putInt, getInt] - imports [] - -putLine : Str -> Task {} * - -putInt : I64 -> Task {} * - -getInt : Task { value : I64, isError : Bool } * diff --git a/crates/cli/tests/benchmarks/platform/app.roc b/crates/cli/tests/benchmarks/platform/app.roc index c92d6efd81..26e5c73437 100644 --- a/crates/cli/tests/benchmarks/platform/app.roc +++ b/crates/cli/tests/benchmarks/platform/app.roc @@ -1,3 +1,4 @@ -app [main] { pf: platform "main.roc" } +app [main!] { pf: platform "main.roc" } -main = Task.ok {} +main! : {} => {} +main! = \{} -> {} diff --git a/crates/cli/tests/benchmarks/platform/host.zig b/crates/cli/tests/benchmarks/platform/host.zig index b37056f903..ff9cbe8f10 100644 --- a/crates/cli/tests/benchmarks/platform/host.zig +++ b/crates/cli/tests/benchmarks/platform/host.zig @@ -10,11 +10,7 @@ const maxInt = std.math.maxInt; const mem = std.mem; const Allocator = mem.Allocator; -extern fn roc__mainForHost_1_exposed_generic([*]u8) void; -extern fn roc__mainForHost_1_exposed_size() i64; -extern fn roc__mainForHost_0_caller(*const u8, [*]u8, [*]u8) void; -extern fn roc__mainForHost_0_size() i64; -extern fn roc__mainForHost_0_result_size() i64; +extern fn roc__main_for_host_1_exposed() void; const Align = 2 * @alignOf(usize); extern fn malloc(size: usize) callconv(.C) ?*align(Align) anyopaque; @@ -112,48 +108,12 @@ comptime { const Unit = extern struct {}; pub export fn main() u8 { - // The size might be zero; if so, make it at least 8 so that we don't have a nullptr - const size = @max(@as(usize, @intCast(roc__mainForHost_1_exposed_size())), 8); - const raw_output = roc_alloc(@as(usize, @intCast(size)), @alignOf(u64)) orelse { - std.log.err("Memory allocation failed", .{}); - return 1; - }; - const output = @as([*]u8, @ptrCast(raw_output)); - - defer { - roc_dealloc(raw_output, @alignOf(u64)); - } - - roc__mainForHost_1_exposed_generic(output); - - const closure_data_pointer = @as([*]u8, @ptrCast(output)); - - call_the_closure(closure_data_pointer); + roc__main_for_host_1_exposed(); return 0; } -fn call_the_closure(closure_data_pointer: [*]u8) void { - const allocator = std.heap.page_allocator; - - // The size might be zero; if so, make it at least 8 so that we don't have a nullptr - const size = @max(roc__mainForHost_0_result_size(), 8); - const raw_output = allocator.alignedAlloc(u8, @alignOf(u64), @as(usize, @intCast(size))) catch unreachable; - const output = @as([*]u8, @ptrCast(raw_output)); - - defer { - allocator.free(raw_output); - } - - const flags: u8 = 0; - - roc__mainForHost_0_caller(&flags, closure_data_pointer, output); - - // The closure returns result, nothing interesting to do with it - return; -} - -pub export fn roc_fx_putInt(int: i64) i64 { +pub export fn roc_fx_put_int(int: i64) i64 { const stdout = std.io.getStdOut().writer(); stdout.print("{d}", .{int}) catch unreachable; @@ -163,7 +123,7 @@ pub export fn roc_fx_putInt(int: i64) i64 { return 0; } -export fn roc_fx_putLine(rocPath: *str.RocStr) callconv(.C) void { +export fn roc_fx_put_line(rocPath: *str.RocStr) callconv(.C) void { const stdout = std.io.getStdOut().writer(); for (rocPath.asSlice()) |char| { @@ -180,14 +140,14 @@ const GetInt = extern struct { comptime { if (@sizeOf(usize) == 8) { - @export(roc_fx_getInt_64bit, .{ .name = "roc_fx_getInt" }); + @export(roc_fx_get_int_64bit, .{ .name = "roc_fx_get_int" }); } else { - @export(roc_fx_getInt_32bit, .{ .name = "roc_fx_getInt" }); + @export(roc_fx_get_int_32bit, .{ .name = "roc_fx_get_int" }); } } -fn roc_fx_getInt_64bit() callconv(.C) GetInt { - if (roc_fx_getInt_help()) |value| { +fn roc_fx_get_int_64bit() callconv(.C) GetInt { + if (roc_fx_get_int_help()) |value| { const get_int = GetInt{ .is_error = false, .value = value }; return get_int; } else |err| switch (err) { @@ -202,8 +162,8 @@ fn roc_fx_getInt_64bit() callconv(.C) GetInt { return 0; } -fn roc_fx_getInt_32bit(output: *GetInt) callconv(.C) void { - if (roc_fx_getInt_help()) |value| { +fn roc_fx_get_int_32bit(output: *GetInt) callconv(.C) void { + if (roc_fx_get_int_help()) |value| { const get_int = GetInt{ .is_error = false, .value = value }; output.* = get_int; } else |err| switch (err) { @@ -218,7 +178,7 @@ fn roc_fx_getInt_32bit(output: *GetInt) callconv(.C) void { return; } -fn roc_fx_getInt_help() !i64 { +fn roc_fx_get_int_help() !i64 { const stdout = std.io.getStdOut().writer(); stdout.print("Please enter an integer\n", .{}) catch unreachable; diff --git a/crates/cli/tests/benchmarks/platform/main.roc b/crates/cli/tests/benchmarks/platform/main.roc index a4ac08d384..53f8267272 100644 --- a/crates/cli/tests/benchmarks/platform/main.roc +++ b/crates/cli/tests/benchmarks/platform/main.roc @@ -1,9 +1,9 @@ platform "benchmarks" - requires {} { main : Task {} [] } + requires {} { main! : {} => {} } exposes [] packages {} imports [] - provides [mainForHost] + provides [main_for_host!] -mainForHost : Task {} [] -mainForHost = main +main_for_host! : {} => {} +main_for_host! = \{} -> main! {} diff --git a/crates/cli/tests/benchmarks/quicksortApp.roc b/crates/cli/tests/benchmarks/quicksortApp.roc index b94b73ad10..dc4c94d78a 100644 --- a/crates/cli/tests/benchmarks/quicksortApp.roc +++ b/crates/cli/tests/benchmarks/quicksortApp.roc @@ -1,20 +1,20 @@ -app [main] { pf: platform "platform/main.roc" } +app [main!] { pf: platform "platform/main.roc" } -import pf.PlatformTasks +import pf.Host import Quicksort -main : Task.Task {} [] -main = - { value, isError } = PlatformTasks.getInt! - inputResult = - if isError then - Err GetIntError +main! : {} => {} +main! = \{} -> + { value, is_error } = Host.get_int! {} + input_result = + if is_error then + Err(GetIntError) else - Ok value + Ok(value) - when inputResult is - Ok n -> - unsortedList = + when input_result is + Ok(n) -> + unsorted_list = if n == 0 then # small unsorted list of 20 elements (0-9) [2, 4, 4, 0, 3, 8, 3, 6, 4, 9, 4, 6, 3, 5, 2, 2, 3, 1, 1, 3] @@ -22,13 +22,13 @@ main = # big unsorted list of 10000 elements (0-5000) [4281, 4149, 4579, 3763, 4892, 3305, 740, 1003, 3748, 4353, 1027, 2205, 4096, 4047, 1883, 3757, 3813, 2757, 2241, 1417, 2054, 1819, 680, 3645, 1979, 3897, 2180, 4072, 3688, 3440, 1107, 3511, 133, 4586, 3432, 3279, 2743, 1489, 4058, 2880, 141, 3039, 3270, 1518, 3879, 3241, 577, 981, 233, 2238, 1571, 1056, 721, 2856, 2309, 1274, 969, 1132, 1492, 2659, 106, 1145, 2328, 3854, 998, 2594, 1359, 1172, 3952, 4137, 3539, 3558, 3947, 1705, 1726, 1292, 1669, 2636, 661, 1079, 4190, 4398, 3954, 2016, 4704, 2748, 2273, 261, 321, 1278, 917, 713, 1241, 1827, 1402, 2956, 4481, 3126, 250, 3932, 727, 2689, 2566, 4584, 1718, 1634, 3977, 3045, 3360, 1072, 982, 2277, 4175, 707, 1192, 3124, 2408, 2734, 4173, 4491, 3060, 1095, 845, 4405, 4617, 2762, 1431, 2720, 4510, 1516, 1770, 1010, 499, 2346, 4191, 2684, 3979, 1794, 2796, 1973, 407, 2764, 1975, 3629, 3945, 4635, 2157, 497, 1720, 583, 520, 2036, 3638, 561, 2168, 2301, 4432, 4086, 1465, 1560, 90, 4092, 2882, 3496, 3609, 4961, 507, 106, 242, 1752, 2154, 4410, 4066, 2333, 1570, 621, 1622, 1915, 517, 4424, 2901, 4704, 394, 1066, 4001, 4645, 624, 3833, 165, 2312, 3795, 3707, 557, 4567, 1897, 4894, 4840, 2805, 655, 1514, 2376, 3504, 1029, 4207, 3054, 4802, 4253, 2339, 2278, 3180, 2426, 861, 1582, 1373, 131, 4390, 4168, 4749, 1948, 2489, 586, 614, 2833, 840, 4136, 2443, 4112, 1850, 2207, 4087, 162, 1030, 1983, 2464, 2840, 4644, 2613, 1305, 4340, 3742, 1422, 1703, 1184, 2389, 997, 413, 3787, 199, 1727, 780, 1055, 879, 3400, 4592, 2140, 4564, 3466, 4630, 2127, 197, 4719, 4045, 2818, 2817, 2207, 507, 3047, 3619, 2327, 4196, 1659, 1603, 2104, 1649, 3893, 1615, 2905, 2216, 224, 2140, 4018, 2590, 3647, 3456, 2173, 1573, 4315, 2389, 2787, 137, 4287, 792, 4260, 1363, 3609, 3610, 2550, 2788, 1020, 4347, 2513, 4633, 3633, 3875, 4670, 503, 1698, 4651, 4725, 3394, 1085, 1275, 407, 4394, 132, 2102, 1239, 2186, 588, 1212, 4641, 4371, 4448, 1910, 3735, 4489, 2793, 2422, 2177, 3639, 2284, 3887, 2759, 4667, 2735, 976, 2055, 2791, 2593, 1406, 2439, 1010, 1160, 14, 3388, 3788, 3982, 3907, 3423, 996, 2863, 2370, 2846, 2297, 18, 1961, 1495, 290, 2390, 4248, 3001, 2365, 513, 2494, 1963, 3833, 3284, 375, 4760, 2711, 1436, 195, 1891, 3935, 4384, 1943, 3347, 126, 1582, 3977, 1398, 2483, 528, 230, 1896, 1421, 1843, 4487, 2893, 4240, 3157, 4135, 2887, 113, 1307, 1960, 593, 2435, 4358, 102, 4780, 537, 1394, 1901, 4554, 2099, 2599, 4467, 4145, 192, 1759, 4141, 4102, 3631, 3425, 467, 3017, 1210, 1108, 1243, 3980, 2772, 1525, 2382, 2795, 4731, 2688, 2303, 1511, 3260, 4863, 4792, 3306, 432, 3068, 1586, 3358, 1327, 3136, 3715, 1515, 4144, 4902, 3557, 3891, 1116, 172, 4655, 2079, 1759, 366, 1223, 2066, 155, 1343, 1106, 1016, 3055, 810, 1430, 4618, 1031, 4488, 2571, 240, 4196, 1896, 2887, 4930, 3694, 2395, 1156, 2889, 4749, 4109, 112, 1578, 450, 1422, 1505, 2266, 3756, 3597, 2655, 3748, 3371, 1659, 1867, 139, 879, 469, 1601, 2566, 3471, 1905, 4403, 2714, 1657, 3867, 563, 1820, 4992, 3084, 4559, 2727, 493, 1045, 4884, 1304, 4596, 4843, 978, 3010, 2282, 3267, 1995, 3942, 4235, 2676, 528, 417, 1860, 4944, 2352, 2603, 496, 2395, 4391, 1183, 4271, 3431, 3219, 3728, 873, 4956, 4460, 3638, 1935, 511, 1820, 1753, 2536, 131, 2253, 736, 1438, 2762, 4677, 4836, 8, 4524, 4711, 1575, 334, 3860, 4697, 4237, 3095, 4017, 3574, 2925, 2398, 4938, 2612, 408, 2086, 1938, 1349, 3405, 2827, 4158, 2071, 858, 377, 1043, 776, 4126, 3981, 81, 4471, 916, 52, 427, 8, 4922, 310, 43, 4770, 800, 3928, 1616, 848, 2818, 1300, 4847, 2744, 2528, 3825, 3582, 4781, 2911, 4309, 1188, 2451, 447, 2057, 966, 1159, 2683, 2542, 4010, 367, 252, 1199, 3765, 3974, 1794, 3464, 55, 501, 3389, 745, 763, 3937, 1077, 624, 2896, 3609, 4555, 3830, 3731, 1240, 1844, 4091, 3081, 587, 424, 3000, 1682, 2332, 3235, 3995, 3520, 3567, 2748, 501, 4661, 594, 385, 3271, 3980, 401, 2904, 1184, 1240, 3933, 825, 4068, 1561, 4387, 2776, 2581, 3117, 2219, 3224, 980, 2160, 1941, 2588, 3254, 4410, 261, 414, 802, 1536, 4245, 2935, 1059, 4098, 2750, 4707, 224, 1867, 740, 593, 2448, 408, 2244, 3719, 4149, 1952, 1509, 893, 558, 2409, 409, 4287, 4817, 3790, 2356, 3100, 4204, 416, 2778, 3876, 894, 1115, 4071, 630, 386, 1346, 41, 4039, 2816, 3001, 500, 1557, 15, 775, 42, 3161, 1449, 2916, 2333, 4947, 3883, 4744, 2792, 2434, 1929, 3599, 831, 4511, 813, 927, 4273, 4285, 496, 4068, 2450, 3893, 4982, 173, 667, 3347, 370, 2424, 3855, 538, 2692, 3084, 456, 107, 4433, 4088, 1181, 1755, 4761, 4932, 3014, 221, 1925, 1649, 2944, 1646, 3994, 1389, 4617, 4609, 3952, 2870, 3535, 4859, 4733, 3696, 3549, 1038, 716, 3474, 2122, 4629, 3495, 992, 4594, 4766, 2389, 4901, 4041, 2453, 894, 2077, 874, 188, 2405, 543, 991, 3601, 3121, 329, 402, 2948, 4382, 3203, 3387, 2098, 3473, 3986, 516, 3243, 2341, 490, 4828, 861, 4527, 2197, 3777, 4860, 1031, 1546, 751, 4670, 826, 4832, 2813, 3820, 4927, 3628, 2082, 4043, 3990, 2929, 1545, 4235, 3792, 4680, 131, 4097, 2694, 652, 4785, 4419, 3044, 3127, 470, 3, 1198, 3754, 2969, 503, 3957, 582, 4109, 1982, 4487, 4330, 1452, 2202, 3601, 3797, 4331, 3630, 471, 1655, 1435, 3624, 394, 4306, 207, 1488, 126, 367, 4870, 3969, 3448, 4265, 3475, 1058, 2437, 267, 591, 4352, 4363, 1096, 3807, 2547, 4328, 2811, 4251, 3241, 3518, 1377, 4983, 1353, 1900, 676, 1969, 1213, 190, 1700, 4020, 2219, 4822, 4659, 1324, 4961, 4675, 2317, 467, 835, 179, 1129, 1093, 852, 1360, 3585, 1999, 742, 3284, 3485, 3383, 4864, 4474, 3600, 653, 1333, 767, 4075, 2345, 4888, 1263, 4482, 2638, 4430, 1173, 4543, 2068, 1466, 4302, 3583, 345, 2633, 2515, 2630, 3717, 693, 1906, 2944, 510, 4609, 4064, 3643, 4010, 657, 3435, 2258, 630, 3037, 3199, 3904, 1139, 1446, 1776, 492, 2942, 188, 2935, 1247, 2000, 4413, 1036, 3485, 4691, 606, 1678, 541, 4380, 2673, 3241, 4403, 1896, 1202, 3323, 2433, 2982, 647, 1564, 3543, 1916, 483, 4040, 2974, 4234, 4025, 3208, 2109, 1055, 2989, 4210, 1944, 3504, 465, 1687, 1569, 2783, 97, 65, 4948, 3311, 1885, 2228, 3961, 4695, 4268, 4063, 166, 3998, 2070, 3547, 2148, 2995, 2451, 2833, 4243, 438, 951, 23, 2913, 1301, 2593, 4557, 2278, 4460, 1142, 3740, 2562, 3369, 2601, 3222, 2230, 2475, 4720, 4568, 572, 2737, 4157, 685, 1934, 3377, 4864, 1586, 3916, 2828, 1462, 2539, 4147, 3028, 4734, 3198, 4312, 234, 3578, 1409, 3776, 291, 1168, 1437, 1454, 3965, 4735, 2310, 3865, 4361, 4374, 3684, 1920, 3844, 3982, 1316, 3922, 2116, 641, 4220, 684, 4937, 313, 2456, 65, 4674, 4960, 2432, 4547, 4090, 624, 210, 3766, 3452, 2226, 1189, 605, 4665, 1528, 1553, 1532, 1669, 4051, 2136, 2392, 4053, 2251, 1601, 992, 3924, 2205, 444, 3260, 417, 922, 2362, 3285, 3414, 2350, 4612, 806, 2803, 1990, 2229, 4273, 3311, 379, 2451, 3479, 1900, 4704, 744, 3895, 1795, 817, 3163, 1770, 1677, 4136, 3643, 2368, 2223, 923, 1526, 3917, 2906, 4849, 4457, 4614, 482, 1340, 4931, 1243, 595, 1297, 720, 3060, 2013, 3678, 1163, 2373, 2067, 4725, 2306, 1205, 4180, 4280, 4069, 600, 648, 3515, 762, 778, 1094, 2792, 2495, 1410, 1023, 1627, 3494, 3172, 2991, 2502, 2014, 4077, 3158, 706, 3970, 1436, 4509, 3981, 1207, 1725, 1552, 738, 3873, 4389, 4788, 448, 784, 729, 355, 3491, 308, 328, 4536, 3921, 871, 330, 3655, 4562, 2544, 1274, 3874, 3156, 3979, 1462, 3874, 4016, 4828, 1497, 2818, 4819, 4440, 4833, 2974, 4997, 232, 4843, 4631, 3602, 3109, 1249, 1565, 4556, 3899, 4216, 791, 2908, 2877, 3838, 3102, 3187, 1579, 472, 1916, 3707, 4749, 2701, 2184, 3172, 3743, 4503, 4928, 79, 4743, 1840, 4946, 2584, 1103, 4328, 1819, 4892, 1850, 749, 1717, 3878, 3507, 957, 1469, 57, 3449, 3451, 2988, 4790, 440, 2495, 770, 3417, 4243, 4273, 4189, 757, 2809, 2711, 444, 23, 3318, 3323, 2848, 316, 2036, 44, 2443, 1718, 2042, 1755, 1361, 1049, 2577, 2771, 4908, 3446, 2370, 2802, 3208, 1352, 1932, 2292, 439, 546, 2160, 4736, 4236, 625, 302, 2662, 1115, 3377, 1892, 4705, 1164, 1657, 4675, 2581, 3397, 2128, 744, 4944, 3110, 1673, 672, 4960, 3888, 1621, 3368, 4293, 3066, 3140, 1191, 1965, 2444, 4717, 218, 1385, 1668, 1207, 2764, 588, 2350, 964, 3098, 4045, 764, 3454, 4673, 1115, 3129, 3415, 4340, 1040, 2705, 924, 2776, 1, 3048, 2226, 2977, 3184, 222, 258, 4304, 453, 2176, 4623, 4166, 1949, 3002, 3917, 2304, 4147, 473, 4184, 441, 4788, 4072, 4982, 1434, 1227, 3484, 2237, 2781, 4271, 4578, 1609, 3531, 482, 2884, 1737, 1193, 4598, 2875, 2117, 1684, 2827, 4542, 3435, 908, 4076, 145, 4829, 1008, 445, 3505, 3711, 3246, 3289, 1011, 3018, 2962, 3631, 3019, 120, 4109, 2033, 2615, 4078, 3339, 1183, 3553, 969, 2093, 1306, 1102, 4674, 4567, 3871, 208, 4076, 2969, 2475, 2923, 960, 1618, 1666, 4600, 4468, 290, 4774, 4164, 2037, 2039, 187, 248, 4995, 1048, 1934, 4592, 2120, 3030, 4183, 4832, 1816, 1653, 839, 1832, 16, 2201, 2838, 323, 3270, 2133, 1722, 3816, 3469, 2197, 4336, 3734, 2088, 4666, 2299, 4975, 2704, 3493, 3574, 1152, 853, 1294, 95, 3057, 3010, 1821, 2855, 909, 4879, 620, 4944, 3780, 2516, 4279, 4588, 1714, 2439, 3161, 320, 1382, 1444, 4825, 4228, 3487, 2604, 2232, 1539, 201, 3867, 2869, 411, 46, 3228, 247, 3911, 3511, 351, 2769, 1322, 4826, 2203, 890, 3788, 2824, 3837, 1896, 1967, 3239, 2078, 2617, 3591, 4943, 2532, 2276, 3184, 3456, 312, 2519, 1270, 3996, 2548, 908, 333, 1845, 1167, 369, 1957, 4307, 1501, 1971, 3247, 4857, 3054, 807, 3738, 3072, 4964, 4901, 3514, 2858, 3055, 4569, 3854, 1774, 1876, 770, 2121, 2326, 1937, 2661, 163, 201, 2200, 4013, 3648, 1735, 2438, 3907, 3636, 4299, 3736, 21, 4253, 2514, 186, 466, 2205, 4728, 1035, 1754, 2873, 3581, 3441, 3539, 2999, 4225, 1547, 1689, 2009, 1691, 3751, 3759, 3438, 4774, 867, 1777, 2616, 7, 756, 3411, 1973, 2544, 1132, 2400, 1380, 2520, 2538, 423, 702, 3146, 2029, 3476, 4848, 1003, 3617, 1455, 666, 134, 1296, 813, 1842, 723, 2874, 160, 4041, 1240, 1907, 1634, 725, 1881, 3700, 1238, 1639, 3915, 4499, 2692, 940, 3218, 1931, 3801, 1719, 764, 4816, 1876, 4402, 3599, 890, 198, 940, 1534, 599, 3052, 1232, 910, 3055, 2397, 2772, 1996, 250, 3285, 3573, 2523, 3802, 828, 4554, 4330, 1176, 1222, 4915, 1798, 1580, 4738, 4551, 3322, 1683, 4755, 2995, 4512, 1820, 3685, 224, 4170, 1802, 2824, 2628, 4285, 4236, 4198, 3336, 2651, 10, 2809, 4060, 3718, 831, 2947, 3734, 928, 3624, 849, 2567, 2310, 4474, 4721, 2904, 1491, 4365, 4447, 2052, 4744, 3973, 2650, 3480, 876, 2463, 1084, 3942, 691, 1073, 4757, 229, 1497, 2229, 1669, 674, 256, 2206, 3311, 2800, 592, 2838, 1042, 2123, 602, 434, 552, 2776, 4179, 2976, 4592, 686, 2805, 4840, 484, 4134, 789, 2790, 73, 3113, 4158, 1956, 1377, 1199, 4901, 4755, 1026, 2821, 2649, 3301, 2651, 1398, 330, 1482, 4844, 687, 1116, 4131, 659, 3150, 4282, 475, 2162, 2084, 4439, 3145, 145, 4693, 2926, 3200, 4720, 4341, 4980, 4850, 3961, 3565, 4604, 466, 4441, 832, 2084, 4875, 739, 2790, 523, 3983, 4160, 630, 4038, 1891, 2324, 667, 420, 1361, 2710, 1205, 412, 2410, 2888, 4873, 2372, 612, 1923, 2857, 2725, 4823, 1042, 1721, 2140, 4529, 2801, 3637, 1995, 1503, 4956, 1766, 3910, 1474, 644, 1410, 4705, 3892, 617, 532, 3475, 3111, 646, 4344, 4830, 571, 3380, 862, 4291, 4558, 2115, 861, 1151, 3521, 4244, 2037, 2272, 39, 1371, 1355, 4179, 3072, 442, 4189, 3669, 93, 3968, 3759, 1213, 4340, 1154, 2941, 1192, 3821, 1289, 2307, 559, 424, 3911, 3161, 1996, 4525, 3811, 2902, 3669, 1219, 770, 2820, 1780, 1950, 4995, 345, 3772, 307, 1887, 1452, 3359, 835, 4830, 3846, 2849, 2132, 4070, 1971, 1797, 2890, 3468, 1600, 3872, 937, 4282, 1998, 3550, 908, 4867, 2377, 3462, 2349, 4434, 3216, 1461, 2681, 1775, 4752, 1439, 3203, 4235, 4147, 4750, 4041, 2051, 10, 2780, 2054, 3566, 4111, 2698, 3520, 3816, 2589, 4700, 2338, 1973, 2444, 1465, 1741, 712, 3457, 4272, 4895, 1409, 4963, 2163, 3369, 4570, 1976, 4879, 1459, 2809, 477, 4946, 3800, 3455, 4720, 434, 2919, 4824, 3688, 3555, 2618, 3615, 385, 4330, 4140, 1552, 737, 4288, 4000, 4086, 186, 1673, 2449, 3272, 3262, 1682, 14, 3119, 1206, 2461, 1625, 4644, 2637, 224, 2300, 1708, 2596, 3650, 1312, 775, 4863, 1556, 3868, 1180, 1061, 836, 4295, 2343, 2063, 2186, 3632, 674, 169, 2082, 3316, 2149, 2812, 1032, 2852, 114, 2735, 4646, 58, 744, 3299, 3623, 3607, 3923, 2972, 3414, 3583, 765, 3515, 2965, 295, 4348, 4470, 647, 4716, 2449, 3788, 643, 4188, 3504, 2477, 3341, 1219, 3362, 3267, 3859, 4867, 356, 576, 914, 4799, 2016, 464, 326, 1346, 170, 3880, 4708, 3797, 3992, 2334, 1675, 2084, 481, 421, 1967, 3402, 2183, 766, 2457, 1001, 2993, 3087, 2149, 1252, 3249, 108, 1506, 4488, 2467, 4145, 4475, 3194, 3128, 829, 2059, 3855, 3016, 4874, 1767, 4926, 4170, 119, 3115, 3378, 1256, 1436, 1124, 2819, 592, 522, 3965, 1341, 543, 4912, 2172, 2042, 4834, 4408, 4710, 1863, 4139, 1023, 3996, 2430, 3018, 1574, 2133, 2783, 3716, 1290, 4735, 2425, 4100, 4572, 596, 3189, 2472, 2581, 1409, 2491, 394, 1688, 4597, 2323, 3615, 218, 391, 3287, 2251, 2159, 448, 1178, 925, 228, 3149, 129, 4113, 4031, 2203, 3489, 2631, 268, 2556, 1934, 4581, 712, 4455, 2137, 2474, 3369, 2065, 4924, 3954, 3654, 4730, 3018, 2201, 3975, 1824, 1174, 3195, 1826, 3162, 3273, 1324, 2747, 3767, 619, 714, 3690, 4744, 4198, 597, 604, 1481, 2615, 658, 701, 3166, 4601, 2613, 2864, 3198, 2340, 593, 697, 2345, 4135, 503, 4291, 1559, 3834, 2900, 601, 3722, 613, 313, 896, 1389, 210, 896, 1019, 1174, 1272, 4386, 1672, 2158, 58, 3045, 1933, 2193, 3534, 1660, 2259, 3120, 4678, 1699, 857, 2200, 4399, 2460, 4972, 2731, 166, 3209, 1124, 3143, 249, 2763, 3986, 4186, 1018, 875, 2707, 294, 4042, 1571, 2964, 1407, 780, 4172, 1436, 4576, 543, 2045, 4535, 774, 1744, 4726, 2401, 2392, 1832, 4104, 2271, 4690, 477, 1582, 433, 4457, 2891, 3310, 1586, 4998, 228, 4771, 2426, 3411, 3969, 1677, 610, 4306, 1486, 2107, 341, 2435, 2791, 2670, 4437, 543, 3487, 3252, 3308, 653, 2615, 1414, 247, 2325, 4668, 166, 4087, 4913, 395, 1459, 3842, 4085, 4738, 4150, 4796, 3732, 409, 109, 2460, 3631, 3196, 4989, 4543, 115, 2910, 1277, 3398, 2277, 2748, 3873, 4529, 4035, 2397, 1047, 290, 4040, 2444, 4099, 4129, 344, 3112, 2617, 2039, 1399, 2786, 3335, 258, 1057, 2648, 2521, 4177, 2132, 4976, 2691, 4035, 3683, 1648, 4866, 336, 4792, 2064, 681, 4395, 3937, 1383, 179, 3190, 4743, 3518, 190, 3276, 3536, 4118, 998, 2950, 315, 3981, 1849, 655, 4864, 2239, 667, 1854, 505, 672, 2905, 3005, 2902, 848, 2674, 1363, 2172, 1997, 164, 183, 943, 619, 496, 86, 4457, 1680, 15, 13, 2785, 4164, 2774, 2497, 1415, 1930, 1784, 4144, 2684, 1093, 1712, 959, 3937, 4338, 1185, 4047, 3026, 788, 3554, 856, 2842, 4365, 1365, 3869, 601, 4791, 872, 4103, 2249, 3718, 4285, 2845, 108, 673, 833, 4721, 863, 793, 3078, 4059, 2608, 1448, 4657, 4414, 1090, 1232, 4575, 4572, 4087, 2080, 4579, 301, 4170, 3781, 186, 3661, 3120, 3710, 1090, 4137, 2690, 1002, 1378, 3566, 4420, 1529, 4317, 147, 2660, 4156, 3361, 2691, 4853, 2907, 1066, 1353, 3779, 1257, 3063, 3499, 1749, 719, 3958, 3278, 1047, 646, 2964, 405, 483, 2180, 4509, 2785, 1833, 4437, 3314, 4822, 1122, 1222, 2021, 1598, 4674, 1441, 288, 1657, 2195, 3179, 4479, 3943, 144, 2018, 2633, 4544, 2660, 3875, 3266, 4555, 2934, 3211, 3275, 3769, 1122, 1680, 2140, 2433, 979, 92, 1207, 4971, 583, 964, 3770, 1427, 4636, 1320, 3383, 639, 3218, 438, 1905, 4190, 3919, 1235, 381, 4334, 4223, 4435, 901, 1383, 333, 3596, 2853, 2455, 812, 4043, 2766, 717, 213, 416, 4165, 1130, 1416, 2119, 929, 519, 8, 4904, 4318, 732, 3043, 1728, 3011, 786, 4442, 1085, 2812, 873, 2545, 0, 4085, 4022, 3708, 633, 414, 2440, 1506, 1065, 4450, 4968, 3964, 2380, 3439, 469, 1505, 1001, 1138, 2042, 4548, 826, 298, 2688, 1860, 4108, 3749, 2870, 4513, 1655, 4236, 3919, 4107, 2159, 2809, 4569, 753, 2943, 4429, 4401, 4903, 1727, 28, 4438, 3322, 3042, 4108, 2398, 1697, 2448, 1057, 3503, 1125, 3337, 477, 2051, 986, 4733, 4114, 3420, 48, 1215, 2541, 4511, 1560, 4966, 1588, 2444, 1061, 4625, 4125, 4792, 1184, 4061, 1296, 4415, 3554, 2496, 1860, 267, 916, 3203, 1612, 2416, 4188, 665, 3186, 305, 1590, 4456, 3020, 3224, 3352, 1270, 1526, 3658, 3837, 3119, 2982, 2003, 3052, 1934, 3280, 4316, 1643, 3127, 4071, 493, 3411, 3367, 718, 712, 527, 1844, 4150, 4344, 3559, 4891, 3679, 3341, 1934, 4526, 4279, 2921, 1827, 3431, 2588, 4870, 3826, 2388, 1028, 361, 2999, 2922, 2094, 4244, 139, 4082, 2190, 2652, 1028, 4033, 4299, 280, 178, 4238, 3511, 1381, 1374, 3551, 3766, 4112, 4130, 3104, 2021, 542, 599, 1814, 4610, 2997, 331, 3988, 4890, 2068, 4253, 3929, 2127, 1849, 2185, 4164, 2904, 3439, 4543, 4256, 4934, 4869, 4192, 1043, 799, 4027, 4173, 3357, 4348, 2056, 4101, 2143, 3038, 2384, 1281, 4937, 200, 2489, 1413, 4841, 3930, 3444, 4835, 833, 1938, 4381, 766, 4436, 3167, 2287, 3828, 4270, 2539, 2365, 2508, 3965, 4631, 3099, 2806, 4160, 1234, 1811, 427, 820, 1093, 2433, 4020, 2786, 535, 566, 556, 4616, 4227, 893, 277, 3345, 2043, 3202, 1756, 2757, 2485, 2876, 719, 365, 789, 1865, 1740, 58, 684, 2535, 3405, 3233, 787, 4600, 2421, 1935, 3757, 1462, 4891, 3377, 3338, 4793, 931, 1931, 1105, 1413, 3060, 1602, 531, 1095, 375, 372, 1809, 1276, 2307, 3231, 1493, 344, 3842, 2380, 2042, 3500, 4944, 1290, 1009, 3114, 2857, 937, 4159, 3801, 4189, 4252, 978, 428, 2146, 1386, 182, 558, 2147, 4472, 3930, 3932, 4225, 2803, 4052, 2102, 3013, 267, 901, 1181, 4125, 2851, 4699, 28, 3887, 553, 3347, 2091, 2564, 1176, 3894, 1551, 3435, 1722, 4968, 4875, 3005, 4179, 2207, 2281, 3621, 1336, 2068, 84, 3681, 3086, 4740, 3802, 2458, 4982, 1095, 4132, 4280, 3031, 4305, 1142, 512, 4683, 1554, 3895, 1477, 498, 1242, 4849, 3286, 1396, 3081, 1204, 975, 2235, 2340, 2545, 746, 75, 763, 2986, 1127, 403, 560, 83, 2602, 3947, 485, 4218, 3570, 311, 420, 3835, 2016, 2726, 2372, 1879, 1714, 1202, 3171, 2427, 1227, 3891, 2887, 3736, 2324, 1641, 4637, 4550, 1356, 817, 1207, 789, 4859, 4249, 1438, 4504, 3388, 2365, 3958, 3082, 283, 94, 4211, 2433, 2134, 2256, 1406, 1137, 150, 2519, 2215, 1393, 3664, 4962, 4491, 4873, 282, 4187, 2245, 1296, 3150, 1359, 4711, 4, 4986, 4376, 1933, 549, 3639, 3690, 2302, 4220, 2204, 21, 4578, 1827, 2654, 833, 465, 1340, 303, 4747, 3926, 4667, 69, 4510, 2911, 4950, 3194, 4501, 3167, 923, 2779, 4962, 316, 2158, 1576, 528, 2863, 835, 453, 4153, 3682, 4604, 279, 3484, 797, 1075, 4679, 461, 3688, 3821, 1589, 3247, 589, 1433, 1053, 4798, 2262, 1252, 745, 3621, 814, 997, 1658, 585, 2823, 2677, 3168, 1806, 3065, 3228, 1779, 4536, 4985, 659, 1323, 2465, 4608, 963, 845, 4132, 4142, 2232, 3475, 650, 4563, 1772, 2816, 4082, 4732, 60, 4223, 4211, 4238, 2573, 2569, 737, 178, 3722, 2675, 2632, 4457, 1870, 2275, 1915, 865, 4310, 3789, 1225, 4035, 1217, 4180, 3858, 2130, 1957, 2226, 452, 1307, 917, 713, 4780, 1161, 4473, 393, 829, 1855, 4188, 3483, 4258, 1210, 4033, 3714, 3888, 3897, 4081, 2573, 4360, 960, 4116, 2805, 2854, 4939, 426, 4636, 2845, 4617, 4297, 4341, 1481, 1134, 2437, 2880, 1104, 694, 3780, 4247, 4179, 4870, 2589, 4813, 4651, 1298, 3268, 1018, 657, 2514, 3414, 845, 603, 2546, 1548, 1817, 3770, 844, 2303, 4894, 1581, 4758, 290, 3948, 3456, 2670, 3584, 4368, 706, 1762, 561, 1730, 4119, 4831, 1684, 4001, 1232, 794, 3548, 2316, 765, 1309, 1671, 2616, 1978, 1261, 2111, 570, 23, 210, 2020, 2259, 1078, 1930, 160, 1885, 3150, 511, 144, 4710, 3274, 4083, 4744, 2621, 615, 2967, 1974, 4789, 1044, 672, 283, 3747, 2104, 163, 2959, 1853, 1649, 4748, 1999, 3346, 1339, 2609, 4163, 4669, 4514, 4991, 4621, 1751, 2345, 2265, 3182, 628, 2759, 3863, 2615, 1767, 2935, 1311, 800, 3241, 3998, 3740, 1481, 66, 2898, 4816, 1176, 1462, 2096, 1065, 302, 59, 63, 4819, 2476, 2387, 2607, 3751, 3089, 2947, 4332, 2265, 3890, 2041, 67, 90, 3051, 3009, 4818, 3734, 3008, 1228, 2036, 2741, 3020, 481, 2609, 1641, 4509, 3847, 3822, 1501, 2265, 3800, 2127, 3822, 270, 3206, 927, 90, 3112, 3427, 2096, 1855, 3829, 4611, 1058, 870, 3113, 1028, 798, 4890, 2958, 4104, 2574, 4894, 2454, 4271, 4728, 1253, 1230, 359, 1095, 1297, 2153, 1004, 383, 2781, 2733, 2319, 3984, 3581, 337, 1103, 1911, 1253, 4525, 527, 3394, 1785, 2506, 1539, 1449, 3729, 2402, 1064, 3705, 4892, 4521, 2836, 3505, 3806, 4918, 459, 1495, 3599, 2139, 3809, 1373, 3871, 1919, 3702, 3097, 1211, 1887, 3487, 1286, 3467, 3142, 2636, 1319, 4275, 3138, 756, 4254, 1752, 1608, 4401, 829, 57, 4105, 4566, 135, 4106, 846, 4560, 4673, 4659, 52, 3188, 4244, 4053, 815, 2640, 112, 2280, 3000, 1838, 3639, 2581, 4828, 218, 374, 4038, 1241, 3499, 2158, 3540, 1951, 4771, 131, 3189, 1341, 4741, 4690, 3817, 1552, 2086, 2351, 1451, 1861, 1639, 836, 881, 1385, 14, 1481, 3476, 4453, 3713, 4419, 1995, 4432, 3933, 2167, 734, 1848, 1040, 225, 1488, 1707, 2, 1347, 1341, 2519, 87, 88, 3706, 1880, 2256, 33, 2289, 2942, 3924, 1321, 21, 3769, 3912, 3953, 3425, 4693, 163, 2861, 4181, 1918, 3838, 4871, 2532, 2235, 226, 2219, 4503, 4273, 3782, 4358, 1951, 4361, 2410, 4951, 4377, 2912, 2063, 260, 4937, 1140, 603, 1292, 1330, 3068, 4365, 363, 424, 2708, 291, 3102, 3857, 4466, 3747, 4476, 1544, 293, 1013, 387, 1142, 3991, 2793, 4335, 2122, 289, 3397, 1722, 961, 2172, 4921, 2191, 2301, 3566, 4118, 1498, 1035, 2410, 3879, 2613, 675, 348, 4728, 1150, 1723, 4122, 236, 3486, 3306, 3026, 1049, 2766, 582, 1034, 1514, 840, 2317, 4649, 3800, 4575, 2363, 2059, 2226, 2550, 109, 3517, 2474, 3835, 4790, 4665, 3450, 3113, 2911, 1274, 2086, 4997, 4145, 3349, 1284, 3109, 4474, 2385, 3716, 3594, 3228, 786, 1578, 4239, 2035, 2381, 2447, 4433, 4161, 749, 455, 1320, 343, 1227, 3263, 3308, 1739, 910, 2148, 3094, 4190, 3752, 2966, 3170, 100, 2063, 4427, 3092, 3553, 2156, 4876, 2690, 4148, 4794, 2999, 921, 4758, 3498, 119, 4431, 1373, 2311, 3320, 3801, 2102, 888, 1800, 4792, 4403, 794, 664, 1703, 4190, 1673, 4827, 3331, 4359, 3843, 2091, 4935, 1691, 4164, 3736, 1067, 1412, 2192, 2441, 993, 2410, 3892, 4322, 1768, 2554, 1517, 198, 585, 18, 2312, 3513, 4572, 253, 3077, 4655, 2776, 1869, 719, 4484, 318, 2119, 3315, 1825, 4639, 1419, 3410, 4547, 3713, 2801, 4241, 1079, 2440, 4985, 4035, 285, 1024, 488, 3046, 2216, 1782, 4521, 204, 71, 4435, 4202, 214, 3166, 1885, 3467, 2997, 433, 3705, 230, 2486, 2652, 3802, 2552, 801, 4835, 4055, 1252, 3653, 3586, 1079, 2474, 1473, 3170, 2868, 872, 3832, 4600, 1873, 2454, 1024, 2988, 4640, 3016, 2003, 3122, 434, 3207, 4173, 3078, 4822, 1787, 3109, 4302, 4286, 1542, 4455, 3286, 2360, 3340, 1605, 3196, 2927, 63, 165, 1659, 252, 828, 3844, 3134, 2907, 3043, 4389, 3915, 2876, 1581, 1384, 2097, 3746, 4788, 4533, 1998, 3945, 1152, 449, 4479, 2896, 2604, 330, 3460, 4743, 2939, 3668, 4762, 4924, 3843, 3198, 138, 2740, 4389, 4432, 1226, 4685, 1914, 2818, 3514, 2613, 1389, 4971, 523, 190, 3365, 1581, 2881, 1496, 4997, 530, 243, 4823, 2188, 2995, 3679, 615, 1558, 3394, 3649, 102, 2823, 849, 4905, 4605, 3137, 2944, 3796, 4154, 1945, 1734, 2830, 2496, 2410, 741, 150, 3602, 1605, 3330, 4904, 3214, 4181, 2082, 3408, 3305, 4255, 2608, 2121, 1180, 3495, 42, 2012, 3516, 1143, 4904, 3505, 4714, 3037, 255, 3984, 1279, 2083, 3934, 4372, 2172, 4196, 1207, 339, 2467, 2205, 4089, 3789, 3887, 3402, 3881, 2546, 2132, 4635, 3569, 3082, 1323, 4763, 824, 628, 4253, 1791, 3744, 3302, 3074, 3350, 1994, 3086, 260, 1098, 2633, 799, 4808, 4419, 334, 3884, 2767, 3681, 4939, 465, 1791, 4214, 148, 1674, 3905, 4072, 4337, 717, 726, 3989, 2816, 625, 4911, 1463, 2830, 4210, 4909, 2550, 2155, 1581, 993, 3728, 4693, 370, 4989, 223, 4136, 1160, 4339, 2693, 3075, 1071, 4358, 2647, 3148, 4649, 4513, 1265, 3939, 3646, 4659, 2926, 1088, 4221, 2628, 744, 4574, 4347, 4239, 2228, 2234, 2897, 1140, 3273, 2629, 616, 1422, 1445, 2548, 104, 2711, 2339, 3861, 826, 2622, 3041, 1195, 1602, 4566, 4780, 1304, 2718, 3972, 32, 4140, 3108, 341, 4285, 1365, 2246, 821, 3118, 3870, 1290, 1407, 3457, 1086, 2415, 2634, 4370, 3196, 181, 4192, 6, 1960, 4244, 1957, 595, 1684, 3267, 4396, 1526, 1579, 2437, 1509, 400, 2432, 1074, 2092, 2441, 229, 1606, 1822, 2384, 1510, 4921, 3583, 3862, 4081, 1113, 2367, 105, 4072, 1064, 2072, 2797, 3705, 3351, 1444, 4913, 4757, 4559, 757, 4167, 198, 3736, 4580, 4124, 1111, 4575, 4135, 1857, 3280, 1078, 4269, 423, 3107, 3773, 905, 3074, 2804, 2551, 2572, 3859, 2437, 1328, 1338, 3276, 2349, 4462, 1007, 1819, 3847, 4720, 3077, 2085, 38, 68, 4117, 1411, 2495, 98, 3819, 2619, 1544, 2908, 2811, 1240, 2075, 4228, 518, 806, 3722, 4286, 3039, 3989, 4695, 3899, 4683, 4528, 594, 4761, 752, 800, 4070, 63, 3577, 4086, 1886, 1367, 3256, 99, 1024, 762, 4021, 581, 1744, 2024, 4842, 3200, 3255, 2777, 829, 2524, 2587, 2354, 1506, 224, 1677, 88, 3306, 4582, 470, 2997, 2632, 3862, 2743, 2692, 4571, 2414, 1815, 654, 4387, 2367, 4666, 1640, 3251, 2550, 442, 1440, 1138, 3562, 2363, 3573, 131, 2508, 2276, 991, 1340, 686, 3266, 1538, 491, 2199, 2729, 2843, 249, 4163, 3714, 377, 4539, 4381, 1678, 1871, 1856, 1086, 2347, 1811, 4552, 2802, 3865, 4272, 4960, 2091, 2482, 3890, 1233, 2742, 134, 3301, 2754, 4374, 4176, 2805, 218, 495, 3130, 2889, 1972, 2668, 2436, 839, 2317, 941, 1230, 1309, 4118, 1921, 1556, 3664, 1844, 596, 1791, 3706, 1949, 1658, 4501, 2779, 4255, 2787, 3714, 3309, 3478, 860, 1894, 2324, 660, 3633, 2079, 659, 186, 909, 1000, 317, 392, 3779, 2710, 1609, 4514, 1410, 3321, 1232, 218, 1649, 1314, 324, 2661, 396, 736, 4007, 2544, 3026, 3382, 3923, 4223, 4553, 3045, 945, 1459, 4189, 1608, 1122, 574, 920, 2039, 4058, 2464, 4074, 4093, 310, 1682, 2503, 2960, 566, 4729, 1480, 3270, 357, 58, 3374, 3036, 3333, 821, 3462, 3443, 1415, 3967, 3793, 745, 3359, 894, 4308, 2100, 4701, 2670, 3667, 2736, 2835, 1660, 2755, 368, 2968, 1872, 4315, 2504, 1681, 3688, 878, 415, 3089, 1860, 2191, 4922, 818, 525, 1943, 4214, 1308, 1401, 4893, 2459, 1176, 2365, 2987, 980, 4515, 2718, 4421, 1216, 2459, 1992, 4982, 3582, 1969, 1372, 4283, 4824, 4142, 820, 2895, 2601, 3261, 4060, 2493, 3268, 1184, 1618, 766, 3678, 135, 3016, 3763, 438, 2127, 2270, 1254, 4129, 84, 3175, 298, 2473, 2766, 1040, 244, 242, 2339, 1984, 3900, 4950, 261, 4625, 2174, 4011, 418, 4636, 391, 4405, 2464, 3734, 1385, 2628, 3979, 1463, 19, 1316, 4524, 453, 3443, 93, 1798, 1555, 2133, 2591, 1094, 3512, 331, 1497, 3906, 4080, 3643, 2296, 4069, 3662, 3288, 2495, 1404, 2890, 4265, 1739, 740, 3281, 1477, 2981, 4261, 3177, 447, 2231, 2435, 2379, 42, 1903, 3718, 513, 1444, 779, 708, 3737, 2397, 1841, 4847, 2250, 4312, 4115, 4319, 4457, 1244, 2044, 4594, 1958, 258, 2414, 1308, 31, 4846, 4539, 324, 1167, 4073, 1362, 3209, 4703, 1255, 575, 354, 1951, 3452, 831, 3948, 3464, 4311, 4653, 1987, 4624, 953, 993, 949, 4178, 1296, 3863, 2705, 2066, 2702, 313, 4355, 351, 1407, 2772, 1991, 2640, 968, 3672, 4233, 187, 2687, 73, 406, 513, 1384, 309, 4239, 4542, 2524, 3196, 1950, 4627, 3253, 641, 2394, 842, 2808, 4831, 4647, 381, 3671, 667, 424, 571, 619, 4815, 3068, 2690, 3984, 2479, 1268, 2128, 3331, 3825, 4595, 807, 376, 1757, 1131, 883, 3861, 4361, 4950, 4270, 1602, 3162, 1793, 2187, 2150, 1776, 4769, 2580, 3677, 2980, 1320, 3573, 4496, 4839, 4202, 2313, 2041, 1227, 3071, 4110, 532, 3861, 388, 3687, 2102, 2869, 3600, 1447, 1272, 4372, 3851, 1850, 4928, 3808, 4074, 3003, 1224, 541, 3323, 3370, 4420, 1760, 161, 3133, 4654, 3154, 1179, 2089, 74, 1399, 3331, 3450, 3683, 3254, 1017, 1386, 4010, 81, 4215, 4881, 3132, 4283, 2980, 109, 3784, 2042, 2240, 2868, 124, 3021, 8, 4578, 863, 265, 3412, 3501, 928, 836, 175, 3229, 1366, 1720, 4179, 3854, 2632, 2663, 2900, 3858, 2694, 4116, 2485, 1481, 1779, 2539, 943, 807, 1496, 3670, 4705, 1700, 592, 1933, 180, 4716, 3236, 1332, 1359, 858, 2155, 4587, 4327, 3897, 4718, 3906, 4900, 3178, 2603, 2137, 1478, 4453, 4142, 3359, 2497, 4972, 1854, 1929, 1969, 1325, 3503, 176, 3398, 1740, 2567, 147, 391, 3762, 2557, 4957, 4638, 251, 2897, 3165, 507, 2062, 2904, 4156, 3717, 3223, 3143, 4701, 1789, 3205, 2688, 973, 3495, 2638, 3003, 4371, 4457, 4481, 4546, 505, 1432, 1171, 4641, 1859, 2234, 3384, 1719, 2932, 3087, 4153, 1596, 224, 1568, 4192, 3708, 4949, 2739, 149, 106, 3739, 3182, 3682, 51, 2409, 3891, 1890, 1948, 3705, 784, 354, 456, 1989, 2885, 4830, 2674, 4783, 2717, 335, 3495, 3425, 4217, 444, 790, 1912, 4043, 645, 2713, 4688, 4774, 887, 126, 4560, 4218, 1059, 1674, 4238, 2718, 162, 1814, 892, 4297, 4253, 4500, 996, 1227, 4801, 2862, 1723, 3398, 3443, 54, 1655, 2016, 3079, 3412, 2399, 479, 4144, 36, 3119, 2269, 3960, 1801, 2726, 766, 3105, 3795, 540, 423, 2656, 3552, 1708, 722, 4275, 347, 1232, 1901, 4341, 1360, 1045, 4670, 1906, 4109, 3952, 4078, 865, 3438, 2860, 1607, 186, 514, 3656, 2520, 1680, 4414, 4614, 4117, 1804, 1858, 3613, 4863, 3363, 3576, 1367, 897, 1931, 949, 4701, 4601, 764, 3517, 2338, 1573, 3554, 4393, 4552, 2438, 4181, 551, 2115, 890, 362, 3771, 2195, 1757, 4247, 4787, 557, 4465, 4134, 2704, 2656, 4228, 3758, 1960, 3087, 1970, 4052, 2723, 3321, 2185, 1069, 3802, 3492, 3652, 2566, 2710, 3449, 2227, 308, 1014, 889, 1740, 3667, 1020, 4190, 1359, 658, 3422, 4067, 2280, 659, 4816, 314, 268, 1878, 3742, 1651, 4025, 4844, 1491, 3329, 3340, 2742, 3028, 1760, 4123, 2537, 1878, 3331, 449, 3430, 4031, 1012, 1691, 3324, 2859, 3554, 3745, 1434, 1345, 3053, 1983, 1202, 2791, 4137, 95, 991, 165, 1751, 3568, 2485, 475, 3831, 3175, 4882, 3159, 629, 1965, 1199, 1217, 2538, 916, 1150, 1663, 1094, 690, 3561, 4980, 1555, 997, 563, 4943, 4839, 3615, 4441, 3288, 1634, 4320, 4618, 2952, 1346, 40, 1219, 2474, 2853, 4762, 591, 972, 2563, 3383, 1522, 1051, 3833, 3491, 844, 2622, 4282, 2878, 4411, 3556, 3263, 3429, 1426, 2763, 4631, 4687, 630, 752, 1823, 1016, 4114, 3155, 3524, 1857, 735, 538, 226, 3958, 488, 3794, 730, 1467, 4327, 4494, 200, 622, 3035, 4786, 2592, 2724, 4860, 797, 500, 3508, 1012, 1764, 166, 4178, 3422, 1995, 4290, 3630, 3825, 3454, 3225, 4548, 3445, 2567, 4834, 1215, 3884, 368, 4876, 4356, 2063, 4032, 1, 496, 3074, 4871, 4703, 3560, 954, 932, 82, 3628, 475, 3915, 2700, 2268, 1458, 4327, 3365, 2557, 1170, 3284, 541, 4590, 3276, 326, 1375, 1816, 4114, 3069, 3223, 4634, 476, 1470, 1538, 1626, 1624, 468, 2987, 3251, 3093, 562, 2870, 2010, 2097, 3147, 4738, 3792, 358, 1994, 845, 2554, 425, 3420, 4979, 3131, 1802, 919, 1532, 770, 4811, 4025, 1869, 663, 3909, 2544, 4643, 1998, 64, 4990, 3615, 4085, 2125, 929, 1949, 2028, 4337, 1932, 2690, 666, 1799, 584, 4602, 1444, 4007, 1063, 2459, 2105, 1475, 2220, 4257, 3128, 1276, 990, 659, 385, 1143, 1444, 2553, 673, 3783, 812, 4135, 4291, 3535, 3788, 2736, 3405, 249, 1081, 519, 2699, 4818, 2472, 4746, 1991, 3982, 4715, 2762, 3868, 1793, 3363, 1995, 1746, 3892, 1378, 1755, 3272, 2598, 1958, 295, 3169, 3193, 3302, 1191, 2548, 421, 4620, 3079, 3804, 106, 1722, 1460, 404, 476, 4923, 66, 4327, 1201, 2284, 1167, 4200, 4949, 1302, 3315, 992, 4312, 4835, 4916, 3600, 549, 2133, 55, 4078, 3062, 3633, 58, 839, 1100, 3388, 3694, 3007, 1129, 4679, 3745, 4746, 164, 199, 1528, 1098, 117, 3426, 3895, 3880, 1581, 773, 2260, 2081, 4563, 255, 3112, 1793, 561, 2161, 4728, 4928, 846, 1077, 4671, 4348, 413, 1459, 1781, 3051, 3057, 847, 331, 1660, 123, 2945, 1965, 980, 4853, 294, 1271, 3068, 398, 3272, 1251, 3595, 916, 2532, 2991, 667, 2537, 3977, 2978, 4634, 1645, 3381, 1397, 3087, 3116, 1105, 3427, 4799, 142, 3490, 4602, 349, 1257, 488, 3091, 2258, 223, 1505, 1881, 3444, 3403, 3327, 3586, 1202, 1847, 3116, 1297, 2285, 4287, 185, 756, 4939, 4802, 3685, 4646, 1123, 3666, 177, 886, 1148, 4627, 4200, 4617, 1645, 3818, 4556, 991, 1434, 2577, 3177, 3926, 3110, 2353, 4258, 4261, 3154, 1348, 1450, 1876, 1634, 362, 3839, 3622, 1818, 2566, 4680, 4471, 164, 1339, 3770, 4233, 2296, 1857, 4293, 4710, 1771, 1600, 974, 2342, 1280, 1839, 3068, 1679, 3845, 2653, 3048, 1621, 3282, 1169, 4805, 2175, 3851, 127, 1207, 4414, 1793, 3907, 751, 194, 263, 3127, 3731, 72, 9, 1444, 2884, 3639, 4444, 3021, 4549, 899, 3216, 3344, 2609, 2306, 2164, 3121, 3213, 2375, 2128, 1299, 271, 4975, 2541, 3553, 671, 384, 510, 954, 4247, 2670, 2771, 104, 2552, 1029, 4799, 4048, 559, 4702, 956, 4229, 91, 2149, 3302, 2684, 1920, 523, 1831, 1877, 4523, 2958, 2739, 2160, 1828, 2677, 1586, 2180, 3892, 1595, 4260, 4008, 4264, 3943, 260, 1322, 502, 2729, 4002, 1481, 119, 4338, 3146, 109, 1414, 3901, 369, 1938, 2660, 1172, 1938, 2091, 3088, 4504, 2311, 3943, 2109, 4803, 3092, 2853, 411, 2672, 2485, 1833, 757, 554, 4912, 1642, 948, 1975, 2065, 1620, 4827, 4028, 1823, 3776, 2694, 2293, 395, 1612, 4950, 4952, 4982, 2592, 1489, 3656, 3068, 27, 4957, 2073, 1346, 4753, 2286, 3224, 2146, 370, 292, 1182, 1551, 402, 4870, 1063, 1387, 2063, 4629, 1840, 196, 4332, 2496, 1830, 540, 147, 219, 2457, 923, 755, 102, 4733, 3289, 587, 810, 2088, 3113, 493, 934, 1008, 3836, 2827, 4764, 3095, 1329, 2356, 3619, 784, 135, 2980, 1004, 4722, 4568, 4471, 4187, 418, 492, 4838, 3731, 2442, 3410, 2295, 2516, 2269, 3263, 4575, 3195, 3540, 1482, 1021, 3777, 795, 2002, 889, 742, 3831, 1438, 1073, 3934, 4554, 4865, 4144, 3396, 151, 2695, 4436, 268, 4554, 71, 1438, 1712, 4603, 2831, 4261, 4472, 3234, 1275, 2251, 650, 3407, 640, 3140, 1497, 3230, 4831, 1356, 2183, 4958, 930, 2185, 2578, 935, 3865, 4846, 772, 3225, 3672, 2593, 4589, 1976, 4259, 2439, 2921, 1338, 918, 560, 39, 2312, 2105, 972, 4567, 2384, 3560, 2990, 3194, 1741, 70, 700, 181, 2999, 4095, 1642, 2307, 4035, 3351, 4676, 2809, 734, 1191, 366, 1547, 3419, 167, 1214, 846, 1906, 385, 2202, 1586, 3467, 4389, 3776, 913, 4760, 1132, 3334, 3423, 4948, 2638, 1082, 2689, 2262, 4684, 2967, 292, 2070, 1059, 3508, 1061, 2189, 4530, 852, 26, 230, 2667, 1263, 3651, 1058, 65, 1693, 1243, 2844, 164, 2989, 47, 3180, 2770, 3490, 4822, 3884, 306, 4574, 407, 4669, 1784, 1739, 4751, 2073, 2740, 1275, 309, 2310, 2928, 4132, 2214, 1662, 3128, 3402, 1406, 2927, 2638, 1320, 1043, 4526, 3883, 4345, 4257, 4263, 1941, 2991, 178, 2520, 4227, 4068, 4446, 3634, 4106, 709, 1094, 3058, 2650, 3687, 1007, 4837, 3630, 4999, 4642, 2827, 514, 4300, 4267, 4884, 1737, 3614, 4249, 4112, 3486, 3399, 1395, 434, 934, 4978, 834, 337, 4459, 4410, 4627, 4741, 2955, 525, 4883, 745, 2826, 1815, 4838, 3190, 576, 3952, 4733, 1932, 1552, 1315, 4412, 1262, 720, 3781, 333, 2992, 4261, 2539, 3548, 3285, 4621, 3589, 1792, 1567, 4942, 2038, 3497, 817, 4322, 1091, 669, 478, 2614, 3234, 3338, 4085, 4434, 4249, 2693, 4579, 2833, 3803, 2236, 2225, 2300, 2049, 4447, 3511, 164, 4849, 4528, 1869, 3741, 650, 4041, 1411, 2382, 2527, 980, 4243, 2574, 806, 3111, 596, 2960, 1062, 4292, 3821, 844, 2694, 2771, 2098, 2435, 953, 2770, 2318, 2151, 3816, 3643, 1536, 2839, 1855, 1914, 946, 2291, 1254, 996, 4041, 3904, 1800, 3345, 4649, 1061, 4659, 3117, 820, 702, 4122, 3727, 3869, 644, 2258, 2887, 4471, 4674, 930, 1719, 3349, 3833, 932, 2914, 3198, 1554, 3698, 698, 4175, 4580, 3245, 3055, 506, 672, 1129, 4028, 4448, 259, 1064, 251, 322, 1724, 3707, 1008, 1877, 3575, 4494, 1063, 324, 2663, 3856, 905, 2144, 273, 3906, 2790, 35, 3765, 653, 818, 1217, 2378, 478, 4928, 2288, 3180, 4372, 1209, 4738, 4479, 489, 2036, 1747, 1776, 775, 2309, 4608, 3041, 1572, 2923, 1624, 1904, 1878, 1153, 657, 2232, 1928, 2125, 4822, 3504, 2042, 3558, 1349, 2498, 3717, 4525, 878, 4357, 1777, 1400, 3111, 2179, 4243, 2495, 1070, 1284, 2498, 812, 875, 120, 1573, 4038, 4583, 3193, 990, 2522, 3127, 2089, 2588, 1721, 4945, 1615, 3699, 2088, 1677, 1336, 3719, 3240, 2663, 4439, 316, 3843, 211, 3767, 912, 1474, 1076, 3243, 1738, 2191, 2317, 1416, 3401, 3514, 1486, 3791, 3712, 1107, 553, 1749, 2090, 2271, 3948, 2175, 4712, 1112, 3250, 941, 174, 2299, 4849, 1354, 4217, 861, 1801, 3084, 2189, 2196, 3448, 291, 4205, 988, 20, 1797, 4161, 1446, 2347, 1631, 1869, 2225, 3698, 881, 4104, 3866, 1177, 3083, 3243, 3160, 2665, 301, 863, 3440, 2124, 3151, 831, 1182, 1310, 1925, 2635, 2144, 3511, 1623, 3511, 786, 547, 1236, 473, 3844, 4262, 3349, 4740, 914, 4747, 100, 3617, 2622, 2432, 3499, 878, 3988, 1013, 1274, 1138, 4549, 4706, 471, 1226, 3226, 1382, 2749, 2729, 4438, 4536, 2133, 2659, 1375, 4493, 3596, 3082, 389, 1844, 4697, 4435, 4498, 4205, 4008, 3247, 4822, 1925, 3081, 4331, 1949, 521, 165, 666, 1981, 1980, 2183, 4274, 2398, 4060, 4838, 4394, 1179, 1679, 892, 2016, 2755, 4796, 110, 262, 1784, 4096, 4436, 2345, 3308, 3379, 3340, 3521, 2237, 2716, 4266, 4849, 3304, 4198, 4169, 2162, 1477, 4679, 3473, 4447, 2162, 3269, 112, 3120, 2655, 1283, 1330, 2021, 956, 2805, 1420, 3571, 4038, 4978, 1300, 1382, 1498, 3894, 4421, 3644, 4219, 4360, 4149, 3703, 2979, 1164, 1062, 3182, 2467, 1171, 3386, 4093, 413, 1018, 594, 431, 2187, 1125, 3272, 2160, 2524, 852, 4586, 235, 1869, 3164, 1247, 2657, 3220, 987, 3450, 4669, 2302, 2424, 151, 2865, 4729, 467, 4848, 4615, 358, 3704, 96, 2700, 3132, 3339, 3814, 878, 3951, 438, 4946, 304, 510, 1716, 2395, 1228, 205, 771, 159, 1731, 3135, 337, 4796, 837, 2151, 4102, 2255, 1565, 1569, 3787, 1576, 3981, 2628, 977, 4656, 4462, 4611, 2206, 1161, 2176, 1960, 2826, 4590, 4274, 1810, 2464, 401, 4024, 4718, 3173, 594, 998, 173, 3970, 2133, 3136, 676, 2902, 4838, 2490, 2527, 2959, 2199, 1220, 3090, 4171, 4283, 356, 4457, 3367, 4602, 1701, 742, 3512, 1025, 1595, 3822, 2846, 2748, 3979, 55, 3928, 2625, 1847, 878, 1265, 3248, 2972, 1382, 2627, 501, 3660, 4987, 1422, 2924, 1489, 2617, 332, 2473, 1332, 2125, 1856, 162, 3498, 3358, 901, 4243, 1572, 1127, 3609, 101, 388, 562, 2954, 4718, 1740, 1752, 2855, 233, 4226, 703, 2157, 2189, 2702, 1913, 1796, 3212, 2868, 3, 4135, 6, 3131, 4076, 3000, 3267, 4033, 4283, 4413, 1612, 1598, 814, 4767, 3588, 4134, 812, 75, 274, 2758, 4981, 2129, 166, 316, 3207, 4044, 990, 761, 2557, 4785, 2666, 3211, 1450, 2491, 3354, 2307, 4251, 1666, 1891, 2128, 2908, 2424, 932, 3336, 2358, 2619, 4375, 1566, 3974, 1252, 208, 1113, 1375, 775, 2988, 3462, 1933, 1084, 195, 3280, 3403, 1887, 1201, 3470, 340, 408, 4421, 1349, 1462, 214, 4664, 3537, 999, 3935, 2784, 4605, 4685, 4997, 2768, 3118, 4448, 149, 2098, 4658, 502, 848, 1500, 839, 1724, 1693, 726, 4083, 2417, 729, 4957, 4462, 1526, 1563, 1821, 2752, 2644, 2651, 2221, 3398, 4854, 3489, 3867, 1874, 841, 4196, 2898, 406, 686, 3933, 309, 2411, 4309, 2112, 992, 2599, 4529, 162, 4964, 1844, 4043, 3360, 3152, 955, 1017, 3123, 3215, 2094, 3990, 3928, 1791, 4937, 1441, 1575, 3987, 1097, 1609, 2744, 1788, 1043, 2857, 4790, 4576, 3446, 1875, 3908, 632, 4073, 2373, 121, 1119, 3010, 2231, 3096, 107, 1532, 2660, 4567, 1968, 360, 1513, 1163, 1824, 3306, 647, 4026, 2527, 1229, 3744, 2654, 4739, 1102, 2273, 2030, 678, 807, 1883, 1832, 990, 3932, 3028, 4979, 4394, 1268, 1495, 3185, 2222, 4631, 2697, 3274, 830, 793, 3555, 1413, 1492, 3851, 1866, 160, 1876, 643, 751, 3935, 1541, 4925, 2153, 2199, 1537, 3004, 1673, 67, 4282, 1271, 2518, 2838, 4185, 1997, 3521, 1158, 4580, 992, 1333, 1875, 1095, 3117, 2949, 3977, 3454, 2374, 647, 4472, 2984, 4135, 975, 2823, 1647, 1940, 4738, 4994, 1122, 1555, 4691, 2245, 1866, 559, 2654, 2372, 4669, 4605, 2805, 1619, 710, 493, 1276, 4894, 2097, 1095, 2317, 4049, 880, 3946, 4718, 4297, 4675, 772, 1739, 4487, 887, 4400, 4850, 2525, 3973, 4477, 4386, 1976, 1224, 61, 4361, 2142, 1072, 1509, 3363, 4686, 4980, 1119, 2198, 4649, 2176, 2632, 1511, 2741, 963, 4106, 277, 1392, 4883, 1832, 3582, 1666, 4077, 923, 4194, 3347, 2715, 1040, 1536, 4398, 3671, 1171, 3112, 4614, 4127, 3931, 2154, 1013, 2118, 2905, 3381, 2708, 1824, 4663, 2046, 4050, 4469, 2854, 3189, 2219, 311, 1342, 1016, 3268, 3199, 4290, 2054, 4721, 3731, 1863, 3915, 167, 2858, 1282, 2194, 207, 4876, 2158, 2550, 4346, 1561, 484, 4693, 990, 292, 108, 3642, 4805, 3187, 1735, 2153, 1635, 3389, 1996, 2972, 1346, 1840, 1078, 4579, 2380, 3432, 3520, 3753, 337, 2241, 1855, 3131, 1664, 4101, 2494, 226, 4762, 4693, 3234, 4902, 4568, 1028, 4699, 3843, 1625, 2466, 4104, 3594, 3337, 3385, 1291, 4438, 4423, 1992, 1791, 2821, 3753, 655, 3957, 1968, 526, 3353, 2597, 319, 1526, 4431, 4005, 4483, 3931, 2261, 1482, 4166, 3766, 4781, 3837, 2427, 3191, 3570, 4371, 835, 1140, 3825, 4037, 1887, 2322, 4062, 2241, 2146, 4876, 3243, 2612, 2238, 868, 2068, 491, 318, 1766, 2344, 4593, 4782, 1979, 741, 1806, 2487, 1559, 786, 2490, 2426, 1283, 1273, 4533, 425, 1835, 2637, 3558, 3779, 4042, 3441, 1145, 3464, 3016, 3842, 2694, 2186, 3463, 1338, 2665, 4181, 4470, 3116, 237, 2591, 1410, 2789, 2569, 1932, 3113, 1056, 4001, 4245, 3045, 4149, 3832, 1265, 1778, 3439, 2459, 3689, 4343, 3544, 1697, 1851, 2458, 602, 4854, 4615, 393, 2983, 2317, 4002, 4779, 4811, 1011, 3785, 4316, 3773, 1206, 3143, 369, 1279, 125, 1226, 2734, 3250, 1361, 1861, 4843, 165, 2071, 481, 4000, 2951, 386, 2630, 2756, 4787, 1611, 834, 1403, 1885, 4023, 4858, 1855, 3558, 3518, 954, 1082, 4203, 4471, 4000, 1307, 4117, 4659, 133, 3108, 170, 1828, 309, 1306, 4511, 802, 1989, 2885, 963, 2067, 117, 1722, 42, 991, 3567, 92, 3713, 3642, 1615, 1382, 1671, 3405, 1214, 4327, 711, 4431, 4022, 2412, 2662, 3072, 205, 4801, 1627, 471, 3998, 1206, 4986, 2488, 2592, 796, 1106, 2416, 1381, 3482, 4934, 4815, 2591, 4230, 4864, 2147, 1276, 638, 908, 4099, 3389, 3227, 3225, 2523, 4155, 2561, 1119, 3121, 1107, 3292, 4595, 3722, 4094, 2940, 3275, 2145, 2387, 2970, 4838, 1168, 2872, 1692, 3758, 2106, 177, 4222, 4839, 2646, 3693, 82, 4746, 4165, 4527, 4888, 1796, 1303, 4119, 3320, 4121, 201, 2531, 1083, 473, 703, 1460, 3572, 257, 712, 3842, 240, 1675, 582, 3830, 4888, 1474, 4197, 3479, 4115, 832, 211, 1625, 1575, 2064, 3373, 3614, 39, 939, 2082, 1612, 3535, 4061, 1989, 1259, 352, 4924, 1773, 1664, 2298, 4226, 1870, 677, 2944, 199, 617, 73, 1510, 2363, 3986, 1349, 1098, 4238, 1225, 4968, 1385, 3293, 4877, 857, 3858, 2685, 1190, 2704, 2483, 2762, 1741, 1757, 271, 113, 3828, 1752, 2585, 4261, 4636, 1846, 1451, 2239, 588, 3487, 3247, 4210, 2888, 2568, 3132, 2108, 2508, 4085, 4607, 4250, 4782, 508, 4165, 2377, 3984, 4536, 4926, 4243, 1564, 3399, 3245, 1595, 3302, 553, 2894, 1627, 4951, 2918, 1539, 3392, 459, 1744, 2789, 4006, 802, 2676, 3453, 3567, 1894, 194, 547, 2089, 668, 2960, 4436, 4010, 4914, 3710, 545, 4904, 1751, 4096, 4690, 1681, 2229, 1388, 3669, 4937, 3877, 170, 3122, 1497, 4621, 332, 569, 1715, 731, 3518, 4744, 1193, 1675, 1450, 1518, 188, 1583, 3528, 2902, 2026, 4299, 3239, 1907, 4297, 4358, 2379, 942, 4936, 875, 1513, 4606, 4594, 93, 634, 3094, 2415, 3922, 4782, 4773, 3527, 3401, 4575, 162, 4145, 1205, 1575, 858, 4197, 1253, 2795, 3166, 1173, 2042, 1683, 4203, 1182, 1609, 2657, 831, 2754, 2555, 2318, 35, 4454, 4421, 2513, 2723, 42, 3766, 1407, 3735, 1982, 4364, 1406, 399, 4302, 3794, 3583, 1908, 2162, 4748, 1266, 3419, 1798, 295, 1689, 2889, 3434, 1833, 80, 66, 4148, 4218, 1948, 4487, 1659, 2052, 1944, 2412, 370, 4522, 35, 3828, 908, 4486, 3774, 3744, 3881, 1243, 888, 3988, 3764, 2684, 4748, 4339, 4136, 3617, 168, 4414, 1843, 1174, 2252, 605, 1362, 2529, 2093, 2104, 4318, 1346, 729, 4894, 2509, 3770, 4261, 2537, 1867, 2972, 173, 4284, 2787, 3314, 2938, 823, 1428, 3463, 3945, 4054, 451, 3530, 238, 4863, 1582, 3684, 3695, 1506, 3919, 1105, 2821, 4287, 2495, 1547, 4449, 4616, 3082, 1503, 1573, 4914, 418, 2076, 4059, 2331, 3495, 2047, 4484, 1759, 2065, 339, 3559, 2465, 1131, 4314, 1535, 3902, 4616, 4482, 1663, 1647, 4679, 3806, 874, 835, 2890, 4538, 2554, 3027, 364, 1163, 1520, 498, 39, 2191, 1748, 1444, 2270, 1817, 3534, 412, 1087, 3491, 4339, 2273, 3717, 2996, 345, 1417, 735, 3731, 527, 3741, 3739, 2976, 1511, 4757, 3544, 2792, 4910, 1308, 3028, 3101, 3400, 2336, 4293, 3461, 3243, 986, 2340, 2095, 4531, 2157, 1980, 1578, 3018, 1856, 2886, 3884, 3685, 2584, 3556, 4529, 4872, 183, 2467, 12, 2462, 4658, 906, 1944, 4557, 1184, 2759, 2521, 734, 498, 3038, 957, 3763, 540, 2129, 1039, 1534, 717, 1894, 2119, 1155, 4317, 2448, 2516, 4032, 4393, 3331, 3212, 3713, 2840, 4612, 3776, 4309, 4626, 4082, 1501, 3168, 3213, 205, 1476, 4030, 2432, 2507, 4294, 3473, 3289, 3747, 532, 2950, 3881, 4856, 2458, 2646, 3253, 2718, 1973, 4660, 997, 2223, 1591, 597, 3421, 3584, 2946, 3202, 3192, 3133, 2665, 4747, 2637, 400, 635, 920, 3463, 2909, 1739, 1634, 655, 2284, 4281, 1899, 644, 2738, 1264, 1240, 2217, 2145, 1312, 2114, 4407, 3144, 266, 1935, 3758, 2389, 4865, 3650, 3217, 3837, 1074, 2131, 194, 413, 4626, 4091, 445, 1918, 4161, 1990, 2158, 2689, 4431, 3923, 2806, 4595, 3285, 404, 2971, 1440, 3587, 2620, 2623, 1631, 694, 3604, 3311, 2657, 3605, 4308, 118, 1284, 3820, 89, 3984, 3935, 2376, 633, 1113, 3293, 4858, 3798, 2931, 3859, 693, 4920, 4922, 2075, 1852, 4430, 1567, 3905, 4834, 11, 1951, 3168, 1720, 2367, 131, 1560, 2566, 1022, 2145, 3048, 3305, 1857, 323, 1503, 2677, 2065, 2045, 3638, 4019, 1054, 2359, 1416, 2848, 1579, 4857, 1591, 3278, 4818, 323, 1188, 3150, 804, 2056, 778, 1257, 3886, 2213, 4728, 4908, 2362, 4918, 4525, 2759, 4495, 4218, 458, 2174, 1110, 3421, 2766, 4787, 2677, 3059, 4663, 1867, 4965, 4146, 4981, 3292, 281, 847, 4020, 3009, 1770, 3787, 4981, 4269, 3511, 3871, 3720, 4726, 3534, 3008, 1360, 1516, 305, 2292, 1121, 2822, 4712, 3612, 4700, 2425, 3494, 3841, 2117, 3894, 2728, 4274, 3508, 2361, 8, 286, 2528, 4989, 1434, 388, 1427, 259, 319, 2580, 4506, 2501, 2426, 2527, 2780, 2707, 3999, 608, 920, 247, 1756, 1062, 1227, 2812, 72, 2224, 4719, 151, 488, 4136, 1235, 1688, 4479, 3779, 2252, 3751, 2145, 679, 3486, 4584, 2476, 2337, 4906, 3525, 4648, 2630, 4370, 1363, 4070, 2833, 455, 936, 2677, 3350, 56, 1655, 1113, 956, 1679, 2170, 961, 555, 1332, 3495, 3136, 429, 3776, 3972, 1432, 1612, 1925, 4161, 4817, 999, 2842, 3170, 1979, 4662, 2473, 2190, 3551, 892, 4894, 1989, 3243, 841, 2604, 3506, 3874, 3169, 3269, 907, 3965, 3975, 1568, 149, 1983, 512, 1343, 265, 3290, 1276, 2191, 4768, 3049, 1269, 907, 4981, 1179, 2282, 3472, 3199, 4993, 34, 935, 4432, 866, 2624, 3280, 2972, 2373, 2465, 2729, 3030, 4870, 346, 4683, 4684, 2862, 214, 1867, 2367, 3841, 3805, 2590, 1394, 4983, 3653, 3210, 2787, 4258, 226, 2966, 4553, 2810, 2463, 1655, 135, 4135, 496, 4851, 2147, 1371, 656, 4500, 3348, 4658, 1189, 430, 2047, 4550, 946, 4233, 1789, 1023, 1137, 2788, 686, 1425, 4380, 3652, 616, 4357, 1950, 2032, 3237, 3181, 600, 1742, 3142, 1922, 1174, 4722, 995, 708, 2599, 2411, 1271, 2319, 2183, 2934, 2169, 3938, 4112, 1702, 3579, 2048, 2244, 2433, 2083, 1356, 3535, 3887, 4565, 986, 1128, 1769, 885, 3688, 47, 764, 3549, 2944, 419, 3862, 4456, 780, 3155, 820, 113, 2931, 161, 1053, 4023, 839, 4964, 3644, 2282, 2809, 1500, 3956, 39, 1012, 39, 1115, 3989, 4061, 2230, 88, 142, 558, 2636, 1947, 4496, 1353, 4774, 4410, 1308, 4198, 2513, 1307, 319, 2903, 2263, 1228, 2420, 4303, 2409, 4173, 38, 3673, 4514, 1388, 4751, 3979, 2259, 2762, 1436, 1261, 3772, 1977, 3808, 1138, 2524, 29, 163, 4859, 4811, 4014, 811, 3539, 4707, 4343, 4823, 2346, 808, 4856, 4826, 3150, 3367, 2758, 4405, 3445, 4537, 1178, 1399, 653, 850, 879, 4301, 493, 270, 4962, 2027, 3759, 2352, 1685, 1440, 3800, 4155, 2576, 3444, 3497, 4751, 3798, 4768, 3533, 2852, 1074, 4492, 1106, 3830, 2164, 2818, 2355, 3372, 3948, 2124, 4496, 1158, 1356, 2984, 4503, 4760, 378, 3519, 3352, 2034, 3751, 907, 2375, 371, 2888, 4148, 3848, 4634, 2428, 3861, 51, 3850, 1565, 4764, 4032, 3755, 4494, 437, 2320, 1433, 483, 1814, 40, 4420, 1624, 4983, 840, 3421, 2121, 3348, 2138, 3257, 346, 1151, 1293, 4574, 1528, 4791, 4425, 2534, 3838, 1920, 988, 4391, 4614, 2179, 1064, 258, 1641, 295, 1840, 648, 3297, 3246, 365, 2637, 1973, 2299, 2275, 450, 732, 1978, 1917, 4963, 4983, 1142, 4622, 3520, 3775, 709, 1198, 4471, 1623, 4149, 4097, 1951, 4374, 353, 919, 1560, 1151, 2303, 4775, 4631, 3859, 2405, 1743, 1358, 62, 4245, 3164, 855, 1539, 2789, 3891, 1415, 167, 359, 4220, 967, 4400, 4319, 616, 4810, 498, 905, 2228, 1440, 4435, 3932, 445, 2083, 1446, 3374, 1545, 1172, 208, 3211, 3324, 2807, 1148, 2776, 3348, 4362, 4829, 3358, 1170, 3575, 3143, 1021, 425, 3608, 1696, 348, 3289, 4177, 4265, 3649, 1681, 4944, 15, 2954, 1336, 3720, 1235, 4285, 2919, 2079, 1270, 896, 2266, 4140, 1282, 2752, 1746, 3303, 650, 4929, 4309, 4299, 4038, 3849, 3540, 2521, 1894, 1461, 289, 2547, 2387, 3306, 4451, 2927, 1629, 2122, 3308, 1885, 2058, 4899, 2216, 2282, 4456, 1571, 4408, 1936, 1714, 4794, 1090, 3569, 3628, 3718, 2630, 2194, 3432, 2989, 1653, 4948, 1833, 1485, 3063, 2749, 3572, 2932, 3693, 791, 4106, 1547, 1899, 2078, 4004, 997, 1127, 4039, 3612, 1250, 1603, 554, 3259, 2916, 1666, 886, 1501, 2, 4618, 3790, 4967, 226, 4069, 572, 153, 4984, 1645, 2133, 2527, 4056, 820, 3228, 1453, 4967, 1852, 2491, 473, 4737, 3235, 1736, 544, 4440, 4817, 229, 3678, 2664, 2923, 1745, 2594, 4986, 1316, 3746, 1220, 256, 2820, 4255, 2541, 2957, 3494, 3348, 1562, 3588, 3407, 4961, 1942, 2330, 390, 4414, 1050, 1870, 4987, 4089, 4044, 4936, 668, 867, 163, 1388, 224, 1804, 1634, 4886, 2195, 354, 4088, 638, 1201, 3339, 591, 336, 1712, 3150, 373, 2497, 2301, 2790, 3429, 581, 279, 1252, 3013, 892, 4297, 350, 1007, 718, 754, 83, 4910, 2797, 2695, 4482, 1354, 2908, 3269, 4320, 1434, 4843, 2871, 1004, 2937, 716, 4889, 3723, 2711, 2036, 3178, 4883, 1232, 2831, 2713, 1683, 3679, 4171, 163, 4179, 248, 2311, 3073, 4816, 920, 4321, 428, 772, 2173, 3775, 2058, 4258, 1990, 4001, 113, 2382, 275, 4487, 250, 915, 1956, 2633, 1355, 1335, 2000, 4616, 3293, 1868, 2313, 2819, 1472, 3889, 2068, 2934, 3493, 2496, 426, 4566, 1270, 2525, 4575, 79, 1237, 1345, 3934, 3878, 767, 1758, 92, 2779, 1477, 1946, 4517, 2611, 3170, 3664, 2063, 1621, 2547, 4544, 1785, 1067, 2806, 358, 3330, 1879, 1104, 4455, 2749, 2586, 2044, 1468, 1197, 1462, 1804, 4810, 2392, 4072, 4525, 1714, 2456, 2999, 2637, 3402, 2677, 1472, 28, 4215, 901, 4847, 3361, 957, 422, 2909, 3156, 4340, 4808, 1330, 814, 1865, 4992, 71, 1156, 809, 748, 4408, 2089, 3036, 1519, 4454, 927, 3219, 1040, 3893, 1885, 3149, 3264, 4296, 3112, 679, 3044, 3377, 3751, 937, 2884, 2021, 2260, 2404, 2261, 1956, 767, 688, 29, 541, 4799, 1140, 2154, 3141, 3011, 1629, 3420, 3252, 2898, 3964, 295, 813, 2125, 4404, 2848, 4179, 2038, 3387, 2224, 4298, 3329, 2071, 374, 397, 4497, 2453, 4182, 845, 2364, 3961, 3064, 571, 3397, 0, 1519, 1111, 2265, 4056, 4935, 515, 4177, 3122, 621, 1926, 4031, 3481, 3541, 3503, 3745, 3352, 819, 1914, 1735, 2560, 4055, 2457, 4481, 1594, 187, 4112, 3442, 1982, 3553, 2463, 651, 1372, 429, 957, 1888, 3971, 2717, 4187, 1789, 1502, 482, 4344, 3468, 560, 2461, 1089, 545, 2995, 2131, 2926, 2763, 3386, 1313, 3739, 3192, 2447, 2509, 4256, 1826, 749, 66, 3634, 2750, 1486, 552, 2545, 1190, 1186, 4306, 3405, 557, 2027, 334, 4257, 2336, 2131, 1485, 2871, 1998, 2954, 2520, 3123, 1071, 409, 1393, 3007, 2556, 2943, 2859, 1576, 3214, 986, 3061, 1034, 1402, 2827, 2470, 433, 4428, 3208, 2523, 4429, 1608, 2169, 210, 1259, 4269, 1252, 2234, 2302, 453, 2372, 712, 3341, 4843, 4430, 4678, 460, 1200, 1205, 652, 2789, 2561, 2351, 4917, 4411, 2449, 1840, 3768, 1313, 2248, 3771, 2169, 147, 3447, 307, 2202, 779, 4048, 2711, 4845, 1521, 22, 2198, 4842, 3352, 396, 502, 2650, 249, 4859, 229, 1790, 2019, 1465, 3294, 881, 1856, 4847, 3438, 2794, 2262, 3305, 2930, 2377, 4462, 3267, 2471, 1559, 2817, 4006, 544, 2133, 3678, 4468, 2613, 125, 1688, 802, 2138, 4216, 824, 2087, 2294, 4597, 4898, 3428, 4975, 1611, 230, 1969, 1029, 2469, 180, 2087, 1986, 1006, 3634, 1792, 2875, 3237, 4997, 3243, 3228, 1026, 1986, 2391, 851, 2148, 3528, 3380, 430, 3931, 2980, 538, 4861, 2089, 2918, 1275, 521, 3005, 247, 596, 742, 4939, 4792, 1910, 2692, 4939, 3993, 4600, 1359, 3049, 258, 4340, 134, 4356, 1855, 941, 1991, 816, 2048, 2310, 3591, 565, 3768, 843, 4882, 145, 4554, 3390, 730, 4974, 770, 2214, 4250, 1991, 3719, 2010, 3257, 37, 2859, 207, 2098, 2732, 1526, 1955, 4494, 50, 2596, 4023, 4362, 1432, 4662, 908, 4015, 1186, 2205, 850, 4232, 4398, 4301, 4131, 2079, 70, 2394, 36, 4099, 4862, 416, 333, 2110, 4521, 4375, 1575, 4040, 11, 1921, 1870, 2515, 954, 2861, 1949, 4871, 2673, 1955, 60, 1286, 4746, 652, 1039, 1280, 1953, 4870, 4213, 3476, 3236, 2736, 4708, 3641, 4065, 4166, 4631, 2351, 3225, 1176, 1381, 761, 3130, 829, 172, 1383, 2965, 4141, 2499, 2996, 497, 919, 2427, 2863, 3881, 3415, 78, 3621, 2088, 1158, 3266, 1063, 373, 4707, 3063, 3330, 4471, 3490, 4771, 2405, 4767, 4238, 2347, 1562, 1652, 1398, 585, 4340, 2743, 2106, 4104, 4312, 3647, 4381, 3313, 3412, 3094, 4438, 2922, 1021, 460, 2087, 474, 1785, 1524, 2137, 2609, 3273, 4233, 3665, 3929, 1543, 3541, 1571, 4174, 519, 3437, 567, 365, 914, 2454, 2770, 2351, 3449, 3862, 4216, 4239, 4176, 859, 3093, 2349, 1880, 4325, 571, 2705, 69, 3423, 964, 495, 670, 1636, 683, 2069, 3722, 3663, 3406, 2820, 3060, 2089, 4488, 3537, 3797, 545, 1630, 867, 1431, 1738, 1417, 2298, 1045, 2784, 3567, 4523, 3292, 3447, 1405, 3079, 4700, 4765, 3183, 1554, 3964, 3207, 2531, 4635, 1826, 3022, 2615, 1587, 3588, 580, 4300, 2073, 1130, 441, 4808, 3306, 1271, 1984, 3431, 3340, 4609, 3312, 1152, 126, 4432, 929, 4753, 4415, 1069, 4690, 151, 1570, 4687, 3921, 1088, 4495, 2772, 4136, 364, 1785, 993, 53, 3313, 2254, 3461, 1672, 2404, 750, 2329, 2080, 1246, 4389, 496, 4979, 4857, 1775, 1395, 4240, 1461, 548, 4143, 4838, 3895, 905, 3160, 4999, 3143, 3866, 4893, 1162, 3741, 4494, 3379, 3486, 4976, 186, 2319, 498, 1484, 507, 1115, 457, 522, 2798, 2302, 1840, 2680, 645, 3681, 4372, 763, 1329, 4656, 1053, 3541, 1970, 3015, 1769, 1583, 4294, 2256, 954, 4986, 170, 2396, 1159, 2097, 2879, 691, 3792, 2679, 2337, 4008, 4024, 2040, 674, 1576, 2195, 1869, 1305, 2217, 1920, 138, 678, 389, 2212, 3152, 2915, 910, 2080, 3932, 3131, 3463, 4182, 2464, 4623, 1512, 3670, 1576, 629, 2441, 3551, 2706, 1384, 3257, 3610, 450, 2672, 4573, 491, 1551, 2888, 4370, 1851, 3631, 4041, 2654, 547, 2370, 3045, 1859, 3539, 1678, 447, 3445, 1439, 2830, 52, 1538, 1087, 2482, 3930, 2730, 3721, 568, 2780, 1866, 4338, 3893, 3481, 3785, 2259, 3194, 3049, 757, 1410, 1853, 4921, 724, 933, 1741, 3725, 1014, 4558, 89, 2767, 1976, 7, 1106, 2946, 2611, 2427, 1417, 2633, 672, 3009, 3052, 246, 2770, 1555, 2970, 1219, 4624, 4866, 4050, 1156, 714, 1624, 3336, 106, 1880, 3602, 4814, 2410, 443, 2940, 3424, 1866, 800, 1709, 2111, 8, 4567, 2563, 4921, 1971, 1908, 2382, 1711, 156, 3642, 1647, 731, 1162, 670, 3015, 3797, 2287, 2824, 1810, 4874, 3193, 2147, 4534, 986, 3036, 3361, 718, 3988, 2868, 2546, 824, 3978, 461, 2254, 4122, 1912, 975, 2792, 4521, 2417, 2535, 2887, 3957, 4788, 2786, 1153, 4063, 4730, 4928, 710, 2962, 1655, 4930, 3521, 4446, 502, 2153, 3243, 1790, 1428, 612, 3122, 2221, 2197, 3706, 4323, 683, 3727, 1981, 2015, 1909, 2309, 1989, 2804, 4681, 4623, 4195, 793, 554, 2391, 3740, 4788, 1780, 1323, 4580, 3128, 4572, 3814, 3690, 1731, 3313, 4011, 1808, 3393, 4002, 4597, 4360, 3521, 3948, 3414, 2037, 2810, 2827, 414, 1693, 4452, 607, 1941, 1545, 4395, 2801, 361, 4890, 3384, 416, 1513, 4639, 4473, 408, 2792, 973, 2955, 4419, 2791, 3878, 2366, 3294, 4735, 2267, 2037, 3963, 4018, 3158, 2251, 3131, 3504, 2564, 4003, 1679, 4630, 4559, 4176, 4996, 1132, 4537, 3583, 1253, 3959, 2245, 1240, 2784, 1615, 3763, 1503, 2245, 3850, 2035, 4988, 4438, 331, 1098, 2410, 1825, 628, 2288, 4928, 3246, 2323, 2317, 208, 2919, 1601, 535, 4812, 2513, 237, 3210, 1499, 3687, 3860, 1544, 4041, 1117, 2719, 2566, 2396, 3423, 2634, 2852, 1705, 2397, 47, 3799, 4277, 4163, 2372, 1916, 4412, 1156, 1246, 3699, 274, 4598, 1915, 3560, 2542, 4802, 2711, 288, 2135, 2222, 4492, 1912, 418, 1525, 3298, 4993, 1517, 3873, 1551, 1017, 877, 1033, 4471, 1051, 2454, 2534, 3151, 2857, 3097, 1103, 2999, 301, 1686, 1630, 4862, 1205, 4509, 716, 1849, 4338, 2240, 3436, 4917, 3512, 140, 929, 1837, 895, 2651, 1741, 899, 1251, 2871, 2901, 311, 135, 3715, 2427, 3976, 3413, 4922, 681, 1902, 1165, 2705, 3843, 257, 2506, 3428, 2198, 3593, 3198, 3165, 4914, 1244, 4812, 3753, 4839, 1799, 3321, 2504, 4618, 1570, 3208, 4683, 913, 2327, 4528, 4977, 1198, 1293, 882, 3453, 2564, 868, 2377, 2605, 427, 4532, 690, 420, 351, 762, 1550, 1420, 1888, 781, 1387, 86, 4336, 3461, 2029, 646, 2054, 3051, 624, 2102, 3223, 2826, 4280, 4159, 3647, 1045, 4363, 249, 4335, 984, 3938, 1417, 4787, 322, 3957, 3248, 1716, 1511, 4461, 2471, 29, 2761, 2856, 4090, 1525, 4004, 4057, 3538, 532, 1660, 4643, 4727, 1019, 4004, 687, 2561, 508, 3710, 4317, 4252, 4302, 3978, 2162, 964, 4709, 138, 329, 3695, 4640, 4031, 979, 3000, 3530, 1749, 4177, 2045, 4409, 3337, 1626, 2157, 4432, 3492, 3724, 3454, 223, 3050, 763, 561, 3706, 16, 2696, 1942, 923, 2839, 3625, 4465, 826, 2600, 2185, 874, 705, 397, 1547, 1931, 2375, 3224, 3358, 2990, 281, 645, 3657, 2011, 4842, 613, 2969, 1522, 595, 3562, 1649, 4093, 36, 2965, 941, 982, 818, 1946, 4686, 193, 3532, 2196, 1307, 3647, 3659, 2587, 3753, 1905, 3026, 4681, 1064, 1173, 4899, 54, 1089, 4753, 3587, 2032, 4250, 2825, 2782, 4400, 1069, 1266, 2841, 1165, 1574, 4457, 1335, 4009, 3184, 4577, 4475, 1612, 2796, 4026, 3230, 4443, 4228, 4210, 4307, 2594, 3293, 392, 3372, 3962, 2974, 1685, 1525, 3057, 682, 3347, 227, 1317, 650, 662, 2210, 2519, 2920, 1537, 1757, 3865, 1708, 2828, 2206, 4637, 1738, 3913, 2077, 4022, 4002, 2020, 1313, 1330, 3297, 190, 3917, 2569, 1790, 87, 541, 4180, 1084, 3309, 19, 3481, 3867, 4834, 3051, 3926, 1749, 2750, 2389, 1886, 1503, 3984, 3310, 2409, 370, 3936, 2, 4733, 4643, 614, 2558, 2561, 3213, 3240, 19, 3879, 605, 2754, 4734, 1117, 438, 2304, 3501, 1161, 1420, 2764, 1040, 1072, 572, 1442, 4810, 1816, 2683, 4483, 4045, 3914, 2172, 1204, 703, 4033, 1542, 712, 1358, 3385, 2334, 4282, 1084, 3512, 4293, 4376, 4244, 2877, 1599, 4911, 4581, 619, 3648, 2722, 2128, 4923, 865, 2676, 2936, 4262, 2347, 3463, 921, 4151, 2028, 2242, 697, 4879, 2686, 4313, 1591, 1740, 3793, 1932, 1351, 2407, 1705, 3041, 2220, 4904, 422, 4289, 2284, 4027, 1866, 1504, 2850, 718, 799, 186, 322, 1135, 1050, 3627, 2676, 3726, 1378, 4792, 4121, 325, 2088, 270, 4065, 1142, 3611, 4756, 2756, 1919, 601, 1944, 4218, 4731, 2085, 2518, 3104, 4032, 4426, 1614, 615, 274, 4382, 4577, 3982, 3239, 2463, 1345, 348, 1800, 43, 4798, 1503, 2533, 3155, 4915, 131, 4853, 2765, 2811, 1853, 2868, 3054, 2418, 4778, 736, 4262, 812, 2555, 4076, 3617, 4734, 532, 2110, 3532, 2943, 1395, 4100, 76, 4297, 4664, 29, 3270, 4632, 4192, 4640, 3706, 1014, 21, 4050, 3054, 1842, 1054, 570, 4259, 429, 1728, 4847, 596, 1370, 2800, 1058, 3259, 4215, 4230, 63, 2031, 3646, 3146, 1795, 4796, 218, 1452, 4021, 117, 2418, 4389, 1142, 4998, 750, 3101, 2362, 227, 753, 721, 4065, 2148, 3628, 2712, 2374, 4797, 1474, 3976, 3615, 513, 3783, 4926, 1847, 4635, 4495, 2176, 2734, 3619, 4239, 3065, 4135, 1444, 4518, 4709, 4039, 1972, 25, 704, 2535, 3024, 660, 142, 3563, 1197, 4732, 2689, 2861, 1851, 3809, 3385, 4099, 2285, 4892, 2210, 4698, 3616, 1456, 1443, 670, 3010, 1816, 1825, 2089, 1157, 413, 4957, 2539, 4394, 476, 1168, 2746, 763, 1483, 3370, 1478, 1974, 1178, 248, 562, 75, 2981, 178, 1382, 4542, 4427, 2014, 942, 408, 2177, 2005, 4939, 1048, 3729, 4481, 1159, 1380, 4377, 2239, 3447, 2724, 4739, 4201, 2932, 852, 4816, 965, 2719, 2505, 4029, 1572, 257, 4552, 4493, 3920, 2576, 2998, 4811, 1216, 3499, 106, 900, 3830, 4893, 2819, 1273, 4666, 991, 2994, 3400, 649, 4820, 167, 4248, 2546, 4791, 162, 3339, 4028, 321, 2922, 3603, 1778, 3395, 650, 1540, 3721, 4113, 3079, 2478, 291, 3551, 190, 113, 30, 4734, 467, 946, 3566, 2543, 879, 2636, 4392, 2695, 27, 1726, 4444, 3083, 4901, 1105, 1402, 322, 2147, 1886, 1775, 172, 873, 13, 4580, 2017, 3561, 3050, 1334, 4608, 4311, 1994, 236, 4235, 59, 4156, 3831, 933, 3495, 256, 4756, 3021, 757, 290, 970, 2614, 3228, 3925, 3884, 3925, 4312, 816, 2075] - sort unsortedList + sort(unsorted_list) |> Quicksort.show - |> PlatformTasks.putLine + |> Host.put_line! - Err GetIntError -> - PlatformTasks.putLine "Error: Failed to get Integer from stdin." + Err(GetIntError) -> + Host.put_line!("Error: Failed to get Integer from stdin.") sort : List I64 -> List I64 sort = \list -> - Quicksort.sortWith list (\x, y -> Num.compare x y) + Quicksort.sort_with(list, \x, y -> Num.compare(x, y)) diff --git a/crates/cli/tests/benchmarks/rBTreeCk.roc b/crates/cli/tests/benchmarks/rBTreeCk.roc index 8a8076690d..a8e7f14c64 100644 --- a/crates/cli/tests/benchmarks/rBTreeCk.roc +++ b/crates/cli/tests/benchmarks/rBTreeCk.roc @@ -1,6 +1,6 @@ -app [main] { pf: platform "platform/main.roc" } +app [main!] { pf: platform "platform/main.roc" } -import pf.PlatformTasks +import pf.Host Color : [Red, Black] @@ -10,75 +10,75 @@ Map : Tree I64 Bool ConsList a : [Nil, Cons a (ConsList a)] -makeMap : I64, I64 -> ConsList Map -makeMap = \freq, n -> - makeMapHelp freq n Leaf Nil +make_map : I64, I64 -> ConsList Map +make_map = \freq, n -> + make_map_help(freq, n, Leaf, Nil) -makeMapHelp : I64, I64, Map, ConsList Map -> ConsList Map -makeMapHelp = \freq, n, m, acc -> +make_map_help : I64, I64, Map, ConsList Map -> ConsList Map +make_map_help = \freq, n, m, acc -> when n is - 0 -> Cons m acc + 0 -> Cons(m, acc) _ -> - powerOf10 = + power_of10 = n % 10 == 0 - m1 = insert m n powerOf10 + m1 = insert(m, n, power_of10) - isFrequency = + is_frequency = n % freq == 0 - x = (if isFrequency then Cons m1 acc else acc) + x = (if is_frequency then Cons(m1, acc) else acc) - makeMapHelp freq (n - 1) m1 x + make_map_help(freq, (n - 1), m1, x) fold : (a, b, omega -> omega), Tree a b, omega -> omega fold = \f, tree, b -> when tree is Leaf -> b - Node _ l k v r -> fold f r (f k v (fold f l b)) - -main : Task {} [] -main = - { value, isError } = PlatformTasks.getInt! - inputResult = - if isError then - Err GetIntError + Node(_, l, k, v, r) -> fold(f, r, f(k, v, fold(f, l, b))) + +main! : {} => {} +main! = \{} -> + { value, is_error } = Host.get_int!({}) + input_result = + if is_error then + Err(GetIntError) else - Ok value + Ok(value) - when inputResult is - Ok n -> + when input_result is + Ok(n) -> # original koka n = 4_200_000 ms : ConsList Map - ms = makeMap 5 n + ms = make_map(5, n) when ms is - Cons head _ -> - val = fold (\_, v, r -> if v then r + 1 else r) head 0 + Cons(head, _) -> + val = fold(\_, v, r -> if v then r + 1 else r, head, 0) val |> Num.toStr - |> PlatformTasks.putLine + |> Host.put_line! Nil -> - PlatformTasks.putLine "fail" + Host.put_line!("fail") - Err GetIntError -> - PlatformTasks.putLine "Error: Failed to get Integer from stdin." + Err(GetIntError) -> + Host.put_line!("Error: Failed to get Integer from stdin.") insert : Tree (Num k) v, Num k, v -> Tree (Num k) v -insert = \t, k, v -> if isRed t then setBlack (ins t k v) else ins t k v +insert = \t, k, v -> if is_red(t) then set_black(ins(t, k, v)) else ins(t, k, v) -setBlack : Tree a b -> Tree a b -setBlack = \tree -> +set_black : Tree a b -> Tree a b +set_black = \tree -> when tree is - Node _ l k v r -> Node Black l k v r + Node(_, l, k, v, r) -> Node(Black, l, k, v, r) _ -> tree -isRed : Tree a b -> Bool -isRed = \tree -> +is_red : Tree a b -> Bool +is_red = \tree -> when tree is - Node Red _ _ _ _ -> Bool.true + Node(Red, _, _, _, _) -> Bool.true _ -> Bool.false lt = \x, y -> x < y @@ -86,43 +86,43 @@ lt = \x, y -> x < y ins : Tree (Num k) v, Num k, v -> Tree (Num k) v ins = \tree, kx, vx -> when tree is - Leaf -> Node Red Leaf kx vx Leaf - Node Red a ky vy b -> - if lt kx ky then - Node Red (ins a kx vx) ky vy b - else if lt ky kx then - Node Red a ky vy (ins b kx vx) + Leaf -> Node(Red, Leaf, kx, vx, Leaf) + Node(Red, a, ky, vy, b) -> + if lt(kx, ky) then + Node(Red, ins(a, kx, vx), ky, vy, b) + else if lt(ky, kx) then + Node(Red, a, ky, vy, ins(b, kx, vx)) else - Node Red a ky vy (ins b kx vx) + Node(Red, a, ky, vy, ins(b, kx, vx)) - Node Black a ky vy b -> - if lt kx ky then - if isRed a then - balance1 (Node Black Leaf ky vy b) (ins a kx vx) + Node(Black, a, ky, vy, b) -> + if lt(kx, ky) then + if is_red(a) then + balance1(Node(Black, Leaf, ky, vy, b), ins(a, kx, vx)) else - Node Black (ins a kx vx) ky vy b - else if lt ky kx then - if isRed b then - balance2 (Node Black a ky vy Leaf) (ins b kx vx) + Node(Black, ins(a, kx, vx), ky, vy, b) + else if lt(ky, kx) then + if is_red(b) then + balance2(Node(Black, a, ky, vy, Leaf), ins(b, kx, vx)) else - Node Black a ky vy (ins b kx vx) + Node(Black, a, ky, vy, ins(b, kx, vx)) else - Node Black a kx vx b + Node(Black, a, kx, vx, b) balance1 : Tree a b, Tree a b -> Tree a b balance1 = \tree1, tree2 -> when tree1 is Leaf -> Leaf - Node _ _ kv vv t -> + Node(_, _, kv, vv, t) -> when tree2 is - Node _ (Node Red l kx vx r1) ky vy r2 -> - Node Red (Node Black l kx vx r1) ky vy (Node Black r2 kv vv t) + Node(_, Node(Red, l, kx, vx, r1), ky, vy, r2) -> + Node(Red, Node(Black, l, kx, vx, r1), ky, vy, Node(Black, r2, kv, vv, t)) - Node _ l1 ky vy (Node Red l2 kx vx r) -> - Node Red (Node Black l1 ky vy l2) kx vx (Node Black r kv vv t) + Node(_, l1, ky, vy, Node(Red, l2, kx, vx, r)) -> + Node(Red, Node(Black, l1, ky, vy, l2), kx, vx, Node(Black, r, kv, vv, t)) - Node _ l ky vy r -> - Node Black (Node Red l ky vy r) kv vv t + Node(_, l, ky, vy, r) -> + Node(Black, Node(Red, l, ky, vy, r), kv, vv, t) Leaf -> Leaf @@ -130,16 +130,16 @@ balance2 : Tree a b, Tree a b -> Tree a b balance2 = \tree1, tree2 -> when tree1 is Leaf -> Leaf - Node _ t kv vv _ -> + Node(_, t, kv, vv, _) -> when tree2 is - Node _ (Node Red l kx1 vx1 r1) ky vy r2 -> - Node Red (Node Black t kv vv l) kx1 vx1 (Node Black r1 ky vy r2) + Node(_, Node(Red, l, kx1, vx1, r1), ky, vy, r2) -> + Node(Red, Node(Black, t, kv, vv, l), kx1, vx1, Node(Black, r1, ky, vy, r2)) - Node _ l1 ky vy (Node Red l2 kx2 vx2 r2) -> - Node Red (Node Black t kv vv l1) ky vy (Node Black l2 kx2 vx2 r2) + Node(_, l1, ky, vy, Node(Red, l2, kx2, vx2, r2)) -> + Node(Red, Node(Black, t, kv, vv, l1), ky, vy, Node(Black, l2, kx2, vx2, r2)) - Node _ l ky vy r -> - Node Black t kv vv (Node Red l ky vy r) + Node(_, l, ky, vy, r) -> + Node(Black, t, kv, vv, Node(Red, l, ky, vy, r)) Leaf -> Leaf diff --git a/crates/cli/tests/benchmarks/rBTreeInsert.roc b/crates/cli/tests/benchmarks/rBTreeInsert.roc index e419d8ff94..29b8215507 100644 --- a/crates/cli/tests/benchmarks/rBTreeInsert.roc +++ b/crates/cli/tests/benchmarks/rBTreeInsert.roc @@ -1,45 +1,45 @@ -app [main] { pf: platform "platform/main.roc" } +app [main!] { pf: platform "platform/main.roc" } -import pf.PlatformTasks +import pf.Host -main : Task {} [] -main = +main! : {} => {} +main! = \{} -> tree : RedBlackTree I64 {} - tree = insert 0 {} Empty + tree = insert(0, {}, Empty) tree |> show - |> PlatformTasks.putLine + |> Host.put_line! show : RedBlackTree I64 {} -> Str -show = \tree -> showRBTree tree Num.toStr (\{} -> "{}") +show = \tree -> show_rb_tree(tree, Num.toStr, \{} -> "{}") -showRBTree : RedBlackTree k v, (k -> Str), (v -> Str) -> Str -showRBTree = \tree, showKey, showValue -> +show_rb_tree : RedBlackTree k v, (k -> Str), (v -> Str) -> Str +show_rb_tree = \tree, show_key, show_value -> when tree is Empty -> "Empty" - Node color key value left right -> - sColor = showColor color - sKey = showKey key - sValue = showValue value - sL = nodeInParens left showKey showValue - sR = nodeInParens right showKey showValue + Node(color, key, value, left, right) -> + s_color = show_color(color) + s_key = show_key(key) + s_value = show_value(value) + s_l = node_in_parens(left, show_key, show_value) + s_r = node_in_parens(right, show_key, show_value) - "Node $(sColor) $(sKey) $(sValue) $(sL) $(sR)" + "Node $(s_color) $(s_key) $(s_value) $(s_l) $(s_r)" -nodeInParens : RedBlackTree k v, (k -> Str), (v -> Str) -> Str -nodeInParens = \tree, showKey, showValue -> +node_in_parens : RedBlackTree k v, (k -> Str), (v -> Str) -> Str +node_in_parens = \tree, show_key, show_value -> when tree is Empty -> - showRBTree tree showKey showValue + show_rb_tree(tree, show_key, show_value) - Node _ _ _ _ _ -> - inner = showRBTree tree showKey showValue + Node(_, _, _, _, _) -> + inner = show_rb_tree(tree, show_key, show_value) "($(inner))" -showColor : NodeColor -> Str -showColor = \color -> +show_color : NodeColor -> Str +show_color = \color -> when color is Red -> "Red" Black -> "Black" @@ -52,49 +52,51 @@ Key k : Num k insert : Key k, v, RedBlackTree (Key k) v -> RedBlackTree (Key k) v insert = \key, value, dict -> - when insertHelp key value dict is - Node Red k v l r -> Node Black k v l r + when insert_help(key, value, dict) is + Node(Red, k, v, l, r) -> Node(Black, k, v, l, r) x -> x -insertHelp : Key k, v, RedBlackTree (Key k) v -> RedBlackTree (Key k) v -insertHelp = \key, value, dict -> +insert_help : Key k, v, RedBlackTree (Key k) v -> RedBlackTree (Key k) v +insert_help = \key, value, dict -> when dict is Empty -> # New nodes are always red. If it violates the rules, it will be fixed # when balancing. - Node Red key value Empty Empty + Node(Red, key, value, Empty, Empty) - Node nColor nKey nValue nLeft nRight -> - when Num.compare key nKey is - LT -> balance nColor nKey nValue (insertHelp key value nLeft) nRight - EQ -> Node nColor nKey value nLeft nRight - GT -> balance nColor nKey nValue nLeft (insertHelp key value nRight) + Node(n_color, n_key, n_value, n_left, n_right) -> + when Num.compare(key, n_key) is + LT -> balance(n_color, n_key, n_value, insert_help(key, value, n_left), n_right) + EQ -> Node(n_color, n_key, value, n_left, n_right) + GT -> balance(n_color, n_key, n_value, n_left, insert_help(key, value, n_right)) balance : NodeColor, k, v, RedBlackTree k v, RedBlackTree k v -> RedBlackTree k v balance = \color, key, value, left, right -> when right is - Node Red rK rV rLeft rRight -> + Node(Red, r_k, r_v, r_left, r_right) -> when left is - Node Red lK lV lLeft lRight -> - Node - Red - key - value - (Node Black lK lV lLeft lRight) - (Node Black rK rV rLeft rRight) + Node(Red, l_k, l_v, l_left, l_right) -> + Node( + Red, + key, + value, + Node(Black, l_k, l_v, l_left, l_right), + Node(Black, r_k, r_v, r_left, r_right), + ) _ -> - Node color rK rV (Node Red key value left rLeft) rRight + Node(color, r_k, r_v, Node(Red, key, value, left, r_left), r_right) _ -> when left is - Node Red lK lV (Node Red llK llV llLeft llRight) lRight -> - Node - Red - lK - lV - (Node Black llK llV llLeft llRight) - (Node Black key value lRight right) + Node(Red, l_k, l_v, Node(Red, ll_k, ll_v, ll_left, ll_right), l_right) -> + Node( + Red, + l_k, + l_v, + Node(Black, ll_k, ll_v, ll_left, ll_right), + Node(Black, key, value, l_right, right), + ) _ -> - Node color key value left right + Node(color, key, value, left, right) diff --git a/crates/cli/tests/benchmarks/testAStar.roc b/crates/cli/tests/benchmarks/testAStar.roc index 555787fe0a..734caf31e5 100644 --- a/crates/cli/tests/benchmarks/testAStar.roc +++ b/crates/cli/tests/benchmarks/testAStar.roc @@ -1,13 +1,13 @@ -app [main] { pf: platform "platform/main.roc" } +app [main!] { pf: platform "platform/main.roc" } -import pf.PlatformTasks +import pf.Host import AStar -main = - PlatformTasks.putLine! (showBool test1) +main! = \{} -> + Host.put_line!(show_bool(test1)) -showBool : Bool -> Str -showBool = \b -> +show_bool : Bool -> Str +show_bool = \b -> if b then @@ -24,14 +24,14 @@ example1 = step : I64 -> Set I64 step = \n -> when n is - 1 -> Set.fromList [2, 3] - 2 -> Set.fromList [4] - 3 -> Set.fromList [4] - _ -> Set.fromList [] + 1 -> Set.fromList([2, 3]) + 2 -> Set.fromList([4]) + 3 -> Set.fromList([4]) + _ -> Set.fromList([]) cost : I64, I64 -> F64 cost = \_, _ -> 1 - when AStar.findPath cost step 1 4 is - Ok path -> path - Err _ -> [] + when AStar.find_path(cost, step, 1, 4) is + Ok(path) -> path + Err(_) -> [] diff --git a/crates/cli/tests/benchmarks/testBase64.roc b/crates/cli/tests/benchmarks/testBase64.roc index c93ed7748d..44d255f423 100644 --- a/crates/cli/tests/benchmarks/testBase64.roc +++ b/crates/cli/tests/benchmarks/testBase64.roc @@ -1,17 +1,15 @@ -app [main] { pf: platform "platform/main.roc" } +app [main!] { pf: platform "platform/main.roc" } import Base64 -import pf.PlatformTasks - -IO a : Task a [] - -main : IO {} -main = - when Base64.fromBytes (Str.toUtf8 "Hello World") is - Err _ -> PlatformTasks.putLine "sadness" - Ok encoded -> - PlatformTasks.putLine! (Str.concat "encoded: " encoded) - - when Base64.toStr encoded is - Ok decoded -> PlatformTasks.putLine (Str.concat "decoded: " decoded) - Err _ -> PlatformTasks.putLine "sadness" +import pf.Host + +main! : {} => {} +main! = \{} -> + when Base64.from_bytes(Str.toUtf8("Hello World")) is + Err(_) -> Host.put_line!("sadness") + Ok(encoded) -> + Host.put_line!(Str.concat("encoded: ", encoded)) + + when Base64.to_str(encoded) is + Ok(decoded) -> Host.put_line!(Str.concat("decoded: ", decoded)) + Err(_) -> Host.put_line!("sadness")