From 01cbcac8ef6a3c6f8fca64252ea8250c120e10c8 Mon Sep 17 00:00:00 2001 From: jackfiled Date: Sat, 9 Mar 2024 20:11:27 +0800 Subject: [PATCH] init: repo --- .editorconfig | 210 ++++++++++++ .gitignore | 491 ++++++++++++++++++++++++++++ Canon.Console/Canon.Console.csproj | 16 + Canon.Console/Program.cs | 35 ++ Canon.Core/Canon.Core.csproj | 13 + Canon.Core/Compiler.cs | 16 + Canon.sln | 34 ++ open_set/00_main.pas | 7 + open_set/01_var_defn2.pas | 10 + open_set/02_var_defn3.pas | 10 + open_set/03_arr_defn2.pas | 6 + open_set/04_const_var_defn2.pas | 7 + open_set/05_const_var_defn3.pas | 8 + open_set/06_func_defn.pas | 17 + open_set/07_var_defn_func.pas | 13 + open_set/08_add2.pas | 8 + open_set/09_addc.pas | 6 + open_set/10_sub2.pas | 9 + open_set/11_subc.pas | 7 + open_set/12_mul.pas | 8 + open_set/13_mulc.pas | 6 + open_set/14_div.pas | 10 + open_set/15_divc.pas | 7 + open_set/16_mod.pas | 7 + open_set/17_rem.pas | 7 + open_set/18_if_test3.pas | 19 ++ open_set/19_if_test4.pas | 20 ++ open_set/20_if_test5.pas | 20 ++ open_set/21_while_if_test2.pas | 25 ++ open_set/22_arr_expr_len.pas | 18 + open_set/23_op_priority1.pas | 10 + open_set/24_op_priority2.pas | 10 + open_set/25_op_priority3.pas | 7 + open_set/26_op_priority4.pas | 17 + open_set/27_op_priority5.pas | 16 + open_set/28_unary_op.pas | 6 + open_set/29_unary_op2.pas | 16 + open_set/30_logi_assign.pas | 15 + open_set/31_comment1.pas | 15 + open_set/32_assign_complex_expr.pas | 13 + open_set/33_if_complex_expr.pas | 18 + open_set/34_short_circuit.pas | 39 +++ open_set/35_short_circuit3.pas | 78 +++++ open_set/36_scope.pas | 28 ++ open_set/37_sort_test1.pas | 39 +++ open_set/38_sort_test4.pas | 46 +++ open_set/39_sort_test6.pas | 45 +++ open_set/40_percolation.pas | 80 +++++ open_set/41_big_int_mul.pas | 77 +++++ open_set/42_color.pas | 77 +++++ open_set/43_exgcd.pas | 36 ++ open_set/44_reverse_output.pas | 25 ++ open_set/45_dijkstra.pas | 74 +++++ open_set/46_full_conn.pas | 39 +++ open_set/47_hanoi.pas | 30 ++ open_set/48_n_queens.pas | 62 ++++ open_set/49_substr.pas | 79 +++++ open_set/50_side_effect.pas | 42 +++ open_set/51_var_name.pas | 14 + open_set/52_chaos_token.pas | 75 +++++ open_set/53_skip_spaces.pas | 23 ++ open_set/54_long_array.pas | 60 ++++ open_set/55_long_array2.pas | 30 ++ open_set/56_long_code2.pas | 409 +++++++++++++++++++++++ open_set/57_many_params.pas | 119 +++++++ open_set/58_many_params2.pas | 44 +++ open_set/59_many_globals.pas | 89 +++++ open_set/60_many_locals.pas | 97 ++++++ open_set/61_many_locals2.pas | 73 +++++ open_set/62_register_alloc.pas | 138 ++++++++ open_set/63_nested_calls.pas | 93 ++++++ open_set/64_nested_loops.pas | 107 ++++++ open_set/65_float.pas | 75 +++++ open_set/66_matrix_add.pas | 56 ++++ open_set/67_matrix_sub.pas | 60 ++++ open_set/68_matrix_mul.pas | 56 ++++ open_set/69_matrix_tran.pas | 59 ++++ scripts/build.sh | 3 + scripts/integration_test.py | 109 ++++++ 79 files changed, 3898 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 Canon.Console/Canon.Console.csproj create mode 100644 Canon.Console/Program.cs create mode 100644 Canon.Core/Canon.Core.csproj create mode 100644 Canon.Core/Compiler.cs create mode 100644 Canon.sln create mode 100644 open_set/00_main.pas create mode 100644 open_set/01_var_defn2.pas create mode 100644 open_set/02_var_defn3.pas create mode 100644 open_set/03_arr_defn2.pas create mode 100644 open_set/04_const_var_defn2.pas create mode 100644 open_set/05_const_var_defn3.pas create mode 100644 open_set/06_func_defn.pas create mode 100644 open_set/07_var_defn_func.pas create mode 100644 open_set/08_add2.pas create mode 100644 open_set/09_addc.pas create mode 100644 open_set/10_sub2.pas create mode 100644 open_set/11_subc.pas create mode 100644 open_set/12_mul.pas create mode 100644 open_set/13_mulc.pas create mode 100644 open_set/14_div.pas create mode 100644 open_set/15_divc.pas create mode 100644 open_set/16_mod.pas create mode 100644 open_set/17_rem.pas create mode 100644 open_set/18_if_test3.pas create mode 100644 open_set/19_if_test4.pas create mode 100644 open_set/20_if_test5.pas create mode 100644 open_set/21_while_if_test2.pas create mode 100644 open_set/22_arr_expr_len.pas create mode 100644 open_set/23_op_priority1.pas create mode 100644 open_set/24_op_priority2.pas create mode 100644 open_set/25_op_priority3.pas create mode 100644 open_set/26_op_priority4.pas create mode 100644 open_set/27_op_priority5.pas create mode 100644 open_set/28_unary_op.pas create mode 100644 open_set/29_unary_op2.pas create mode 100644 open_set/30_logi_assign.pas create mode 100644 open_set/31_comment1.pas create mode 100644 open_set/32_assign_complex_expr.pas create mode 100644 open_set/33_if_complex_expr.pas create mode 100644 open_set/34_short_circuit.pas create mode 100644 open_set/35_short_circuit3.pas create mode 100644 open_set/36_scope.pas create mode 100644 open_set/37_sort_test1.pas create mode 100644 open_set/38_sort_test4.pas create mode 100644 open_set/39_sort_test6.pas create mode 100644 open_set/40_percolation.pas create mode 100644 open_set/41_big_int_mul.pas create mode 100644 open_set/42_color.pas create mode 100644 open_set/43_exgcd.pas create mode 100644 open_set/44_reverse_output.pas create mode 100644 open_set/45_dijkstra.pas create mode 100644 open_set/46_full_conn.pas create mode 100644 open_set/47_hanoi.pas create mode 100644 open_set/48_n_queens.pas create mode 100644 open_set/49_substr.pas create mode 100644 open_set/50_side_effect.pas create mode 100644 open_set/51_var_name.pas create mode 100644 open_set/52_chaos_token.pas create mode 100644 open_set/53_skip_spaces.pas create mode 100644 open_set/54_long_array.pas create mode 100644 open_set/55_long_array2.pas create mode 100644 open_set/56_long_code2.pas create mode 100644 open_set/57_many_params.pas create mode 100644 open_set/58_many_params2.pas create mode 100644 open_set/59_many_globals.pas create mode 100644 open_set/60_many_locals.pas create mode 100644 open_set/61_many_locals2.pas create mode 100644 open_set/62_register_alloc.pas create mode 100644 open_set/63_nested_calls.pas create mode 100644 open_set/64_nested_loops.pas create mode 100644 open_set/65_float.pas create mode 100644 open_set/66_matrix_add.pas create mode 100644 open_set/67_matrix_sub.pas create mode 100644 open_set/68_matrix_mul.pas create mode 100644 open_set/69_matrix_tran.pas create mode 100644 scripts/build.sh create mode 100644 scripts/integration_test.py diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d3ccc72 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,210 @@ +# editorconfig.org + +# top-most EditorConfig file +root = true + +# Default settings: +# A newline ending every file +# Use 4 spaces as indentation +[*] +insert_final_newline = true +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[project.json] +indent_size = 2 + +# C# and Visual Basic files +[*.{cs,vb}] +charset = utf-8-bom + +# Analyzers +dotnet_analyzer_diagnostic.category-Security.severity = error +dotnet_code_quality.ca1802.api_surface = private, internal + +# Miscellaneous style rules +dotnet_sort_system_directives_first = true +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion + +# avoid this. unless absolutely necessary +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_event = false:suggestion + +# name all constant fields using PascalCase +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style +dotnet_naming_symbols.constant_fields.applicable_kinds = field +dotnet_naming_symbols.constant_fields.required_modifiers = const +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +# static fields should have s_ prefix +dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion +dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields +dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style +dotnet_naming_symbols.static_fields.applicable_kinds = field +dotnet_naming_symbols.static_fields.required_modifiers = static +dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected +dotnet_naming_style.static_prefix_style.required_prefix = s_ +dotnet_naming_style.static_prefix_style.capitalization = camel_case + +# internal and private fields should be _camelCase +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal +dotnet_naming_style.camel_case_underscore_style.required_prefix = _ +dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case + +# Code quality +dotnet_style_readonly_field = true:suggestion +dotnet_code_quality_unused_parameters = non_public:suggestion + +# Expression-level preferences +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_auto_properties = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:refactoring +dotnet_style_prefer_conditional_expression_over_return = true:refactoring + +# CA2208: Instantiate argument exceptions correctly +dotnet_diagnostic.CA2208.severity = error + +# C# files +[*.cs] +# New line preferences +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_switch_labels = true +csharp_indent_labels = one_less_than_current + +# Modifier preferences +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion + +# Code style defaults +csharp_using_directive_placement = outside_namespace:suggestion +csharp_prefer_braces = true:refactoring +csharp_preserve_single_line_blocks = true:none +csharp_preserve_single_line_statements = false:none +csharp_prefer_static_local_function = true:suggestion +csharp_prefer_simple_using_statement = false:none +csharp_style_prefer_switch_expression = true:suggestion + +# Expression-bodied members +csharp_style_expression_bodied_methods = true:refactoring +csharp_style_expression_bodied_constructors = true:refactoring +csharp_style_expression_bodied_operators = true:refactoring +csharp_style_expression_bodied_properties = true:refactoring +csharp_style_expression_bodied_indexers = true:refactoring +csharp_style_expression_bodied_accessors = true:refactoring +csharp_style_expression_bodied_lambdas = true:refactoring +csharp_style_expression_bodied_local_functions = true:refactoring + +# Pattern matching +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion + +# Expression-level preferences +csharp_prefer_simple_default_expression = true:suggestion + +# Null checking preferences +csharp_style_throw_expression = true:suggestion +csharp_style_conditional_delegate_call = true:suggestion + +# Other features +csharp_style_prefer_index_operator = false:none +csharp_style_prefer_range_operator = false:none +csharp_style_pattern_local_over_anonymous_function = false:none + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = do_not_ignore +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# Namespace preference +csharp_style_namespace_declarations = file_scoped:suggestion + +# Types: use keywords instead of BCL types, and permit var only when the type is clear +csharp_style_var_for_built_in_types = false:suggestion +csharp_style_var_when_type_is_apparent = false:none +csharp_style_var_elsewhere = false:suggestion + +# Visual Basic files +[*.vb] +# Modifier preferences +visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion + +# C++ Files +[*.{cpp,h,in}] +curly_bracket_next_line = true +indent_brace_style = Allman + +# Xml project files +[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}] +indent_size = 2 + +# Xml build files +[*.builds] +indent_size = 2 + +# Xml files +[*.{xml,stylecop,resx,ruleset}] +indent_size = 2 + +# Xml config files +[*.{props,targets,config,nuspec}] +indent_size = 2 + +# Shell scripts +[*.sh] +end_of_line = lf + +[*.{cmd, bat}] +end_of_line = crlf + +# Markdown files +[*.md] +# Double trailing spaces can be used for BR tags, and other instances are enforced by Markdownlint +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b3b092f --- /dev/null +++ b/.gitignore @@ -0,0 +1,491 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from `dotnet new gitignore` + +# dotenv files +.env + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml +.idea + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Vim temporary swap files +*.swp + +# Database Source File +*.db + +# Integration Generated File +open_set/** +!*.pas diff --git a/Canon.Console/Canon.Console.csproj b/Canon.Console/Canon.Console.csproj new file mode 100644 index 0000000..b6bc82e --- /dev/null +++ b/Canon.Console/Canon.Console.csproj @@ -0,0 +1,16 @@ + + + + Exe + net8.0 + enable + enable + true + true + + + + + + + diff --git a/Canon.Console/Program.cs b/Canon.Console/Program.cs new file mode 100644 index 0000000..50711a7 --- /dev/null +++ b/Canon.Console/Program.cs @@ -0,0 +1,35 @@ +using Canon.Core; + +if (args.Length < 2) +{ + Console.WriteLine("Please provide pascal file name with option '-i' at least!"); + return; +} + +Dictionary options = new(); + +for (int i = 0; i < args.Length; i += 2) +{ + options.Add(args[i], args[i + 1]); +} + +if (!options.TryGetValue("-i", out string? value)) +{ + Console.WriteLine("Please provide pascal file name with option '-i' at least!"); + return; +} + +FileInfo sourceFile = new(value); +if (!sourceFile.Exists) +{ + Console.WriteLine("Target source file doesn't exist!"); + return; +} + +Compiler compiler = new(); +using StreamReader source = sourceFile.OpenText(); +FileInfo outputFile = new(Path.Combine(sourceFile.DirectoryName!, + Path.GetFileNameWithoutExtension(sourceFile.Name)) + ".c"); +await using StreamWriter writer = outputFile.CreateText(); + +await writer.WriteAsync(compiler.Compile(await source.ReadToEndAsync())); diff --git a/Canon.Core/Canon.Core.csproj b/Canon.Core/Canon.Core.csproj new file mode 100644 index 0000000..77c284c --- /dev/null +++ b/Canon.Core/Canon.Core.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + diff --git a/Canon.Core/Compiler.cs b/Canon.Core/Compiler.cs new file mode 100644 index 0000000..a6c39e1 --- /dev/null +++ b/Canon.Core/Compiler.cs @@ -0,0 +1,16 @@ +namespace Canon.Core; + +public class Compiler +{ + public string Compile(string _) + { + return """ + #include + int main() + { + printf("%d", 3); + return 0; + } + """; + } +} \ No newline at end of file diff --git a/Canon.sln b/Canon.sln new file mode 100644 index 0000000..258ed3b --- /dev/null +++ b/Canon.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Canon.Core", "Canon.Core\Canon.Core.csproj", "{63EC6CDA-0BF2-4DC6-BEC1-5A3083130E89}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Canon.Console", "Canon.Console\Canon.Console.csproj", "{3D1C0BA2-57F2-41B2-B024-7A0E54A91DA0}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{CA16F23D-8355-4956-B929-082F92CE0C21}" + ProjectSection(SolutionItems) = preProject + scripts\build.sh = scripts\build.sh + scripts\integration_test.py = scripts\integration_test.py + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {63EC6CDA-0BF2-4DC6-BEC1-5A3083130E89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {63EC6CDA-0BF2-4DC6-BEC1-5A3083130E89}.Debug|Any CPU.Build.0 = Debug|Any CPU + {63EC6CDA-0BF2-4DC6-BEC1-5A3083130E89}.Release|Any CPU.ActiveCfg = Release|Any CPU + {63EC6CDA-0BF2-4DC6-BEC1-5A3083130E89}.Release|Any CPU.Build.0 = Release|Any CPU + {3D1C0BA2-57F2-41B2-B024-7A0E54A91DA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3D1C0BA2-57F2-41B2-B024-7A0E54A91DA0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3D1C0BA2-57F2-41B2-B024-7A0E54A91DA0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3D1C0BA2-57F2-41B2-B024-7A0E54A91DA0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/open_set/00_main.pas b/open_set/00_main.pas new file mode 100644 index 0000000..9719850 --- /dev/null +++ b/open_set/00_main.pas @@ -0,0 +1,7 @@ +program main; +var + a: integer; +begin + a := 3; + write(a); +end. diff --git a/open_set/01_var_defn2.pas b/open_set/01_var_defn2.pas new file mode 100644 index 0000000..30cf5f6 --- /dev/null +++ b/open_set/01_var_defn2.pas @@ -0,0 +1,10 @@ +{test domain of global var define and local define} +program main; +var + a, b: integer; +begin + a := 3; + b := 5; + a := 5; + write(a + b); +end. diff --git a/open_set/02_var_defn3.pas b/open_set/02_var_defn3.pas new file mode 100644 index 0000000..e522b78 --- /dev/null +++ b/open_set/02_var_defn3.pas @@ -0,0 +1,10 @@ +{ test local var define } +program main; +var + a, b0, c: integer; +begin + a := 1; + b0 := 2; + c := 3; + write(b0+c); +end. diff --git a/open_set/03_arr_defn2.pas b/open_set/03_arr_defn2.pas new file mode 100644 index 0000000..015c5b6 --- /dev/null +++ b/open_set/03_arr_defn2.pas @@ -0,0 +1,6 @@ +program main; +var + a: array [0..9, 0..9] of integer; +begin + write(0); +end. diff --git a/open_set/04_const_var_defn2.pas b/open_set/04_const_var_defn2.pas new file mode 100644 index 0000000..953247b --- /dev/null +++ b/open_set/04_const_var_defn2.pas @@ -0,0 +1,7 @@ +program main; +const + a = 10; + b = 5; +begin + write(b); +end. diff --git a/open_set/05_const_var_defn3.pas b/open_set/05_const_var_defn3.pas new file mode 100644 index 0000000..f6f5d70 --- /dev/null +++ b/open_set/05_const_var_defn3.pas @@ -0,0 +1,8 @@ +// test const local var define +program main; +const + a = 10; + b = 5; +begin + write(b); +end. diff --git a/open_set/06_func_defn.pas b/open_set/06_func_defn.pas new file mode 100644 index 0000000..2983fda --- /dev/null +++ b/open_set/06_func_defn.pas @@ -0,0 +1,17 @@ +program main; +var + a: integer; + b: integer; + +function func(p: integer): integer; +begin + p := p - 1; + func := p; +end; + +begin + a := 10; + b := func(a); + + write(b); +end. diff --git a/open_set/07_var_defn_func.pas b/open_set/07_var_defn_func.pas new file mode 100644 index 0000000..3f77f2e --- /dev/null +++ b/open_set/07_var_defn_func.pas @@ -0,0 +1,13 @@ +program main; +var + a: integer; + +function defn: integer; +begin + defn := 4; +end; + +begin + a := defn; + write(a); +end. diff --git a/open_set/08_add2.pas b/open_set/08_add2.pas new file mode 100644 index 0000000..174d288 --- /dev/null +++ b/open_set/08_add2.pas @@ -0,0 +1,8 @@ +program main; +var + a, b: integer; +begin + a := 10; + b := -1; + write(a + b); +end. diff --git a/open_set/09_addc.pas b/open_set/09_addc.pas new file mode 100644 index 0000000..f872a09 --- /dev/null +++ b/open_set/09_addc.pas @@ -0,0 +1,6 @@ +program main; +const + a = 10; +begin + write(a + 5); +end. diff --git a/open_set/10_sub2.pas b/open_set/10_sub2.pas new file mode 100644 index 0000000..b107e98 --- /dev/null +++ b/open_set/10_sub2.pas @@ -0,0 +1,9 @@ +program main; +const + a = 10; +var + b: integer; +begin + b := 2; + write(b - a); +end. diff --git a/open_set/11_subc.pas b/open_set/11_subc.pas new file mode 100644 index 0000000..77d97d8 --- /dev/null +++ b/open_set/11_subc.pas @@ -0,0 +1,7 @@ +program main; +var + a: integer; +begin + a := 10; + write(a - 2); +end. diff --git a/open_set/12_mul.pas b/open_set/12_mul.pas new file mode 100644 index 0000000..565a156 --- /dev/null +++ b/open_set/12_mul.pas @@ -0,0 +1,8 @@ +program main; +var + a, b: integer; +begin + a := 10; + b := 5; + write(a * b); +end. diff --git a/open_set/13_mulc.pas b/open_set/13_mulc.pas new file mode 100644 index 0000000..09cf197 --- /dev/null +++ b/open_set/13_mulc.pas @@ -0,0 +1,6 @@ +program main; +const + a = 5; +begin + write(a*5); +end. diff --git a/open_set/14_div.pas b/open_set/14_div.pas new file mode 100644 index 0000000..1b95cd9 --- /dev/null +++ b/open_set/14_div.pas @@ -0,0 +1,10 @@ +program main; +var + a, b: integer; + c: real; +begin + a := 10; + b := 5; + c := a / b; + write(c); +end. diff --git a/open_set/15_divc.pas b/open_set/15_divc.pas new file mode 100644 index 0000000..bc28877 --- /dev/null +++ b/open_set/15_divc.pas @@ -0,0 +1,7 @@ +{ test divc} +program main; +const + a = 10; +begin + write(a div 5); +end. diff --git a/open_set/16_mod.pas b/open_set/16_mod.pas new file mode 100644 index 0000000..9e8f5af --- /dev/null +++ b/open_set/16_mod.pas @@ -0,0 +1,7 @@ +program main; +var + a: integer; +begin + a := 10; + write(a / 3); +end. diff --git a/open_set/17_rem.pas b/open_set/17_rem.pas new file mode 100644 index 0000000..6882555 --- /dev/null +++ b/open_set/17_rem.pas @@ -0,0 +1,7 @@ +program main; +var + a: integer; +begin + a := 10; + write(a mod 3); +end. diff --git a/open_set/18_if_test3.pas b/open_set/18_if_test3.pas new file mode 100644 index 0000000..98282f0 --- /dev/null +++ b/open_set/18_if_test3.pas @@ -0,0 +1,19 @@ +program main; +function ififElse: integer; +var + a: integer; + b: integer; +begin + a := 5; + b := 10; + if (a = 5) then + if (b = 10) then + a := 25 + else + a := a + 15; + ififElse := a; +end; + +begin + write(ififElse); +end. diff --git a/open_set/19_if_test4.pas b/open_set/19_if_test4.pas new file mode 100644 index 0000000..828bd10 --- /dev/null +++ b/open_set/19_if_test4.pas @@ -0,0 +1,20 @@ +program main; +function if_ifElse_: integer; +var + a, b: integer; +begin + a := 5; + b := 10; + if (a = 5) then + begin + if (b = 10) then + a := 25 + else + a := a + 15; + end; + if_ifElse_ := a; +end; + +begin + write(if_ifElse_); +end. diff --git a/open_set/20_if_test5.pas b/open_set/20_if_test5.pas new file mode 100644 index 0000000..16b4a17 --- /dev/null +++ b/open_set/20_if_test5.pas @@ -0,0 +1,20 @@ +program main; + +function if_if_Else: integer; +var a,b: integer; +begin + a := 5; + b := 10; + if (a = 5) then + begin + if (b = 10) then + a := 25; + end + else + a := a + 15; + if_if_Else := a; +end; + +begin + write(if_if_Else); +end. diff --git a/open_set/21_while_if_test2.pas b/open_set/21_while_if_test2.pas new file mode 100644 index 0000000..ee6246e --- /dev/null +++ b/open_set/21_while_if_test2.pas @@ -0,0 +1,25 @@ +program main; +var ret: integer; + +function ifWhile: integer; +var a,b: integer; +begin + a := 0; + b := 1; + if (a = 5) then + begin + for b := 1 to 3 do + begin + end; + b := b + 25; + ifWhile := b; + end + else + for a := 0 to 4 do + b := b * 2; + ifWhile := b; +end; + +begin + write(ifWhile()); +end. \ No newline at end of file diff --git a/open_set/22_arr_expr_len.pas b/open_set/22_arr_expr_len.pas new file mode 100644 index 0000000..5dee3f6 --- /dev/null +++ b/open_set/22_arr_expr_len.pas @@ -0,0 +1,18 @@ +program main; +var +arr: array[0..5] of integer; +sum, i: integer; +begin + arr[0] := 1; + arr[1] := 2; + arr[2] := 33; + arr[3] := 4; + arr[4] := 5; + arr[5] := 6; + sum := 0; + for i := 0 to 5 do + begin + sum := sum + arr[i]; + end; + write(sum); +end. \ No newline at end of file diff --git a/open_set/23_op_priority1.pas b/open_set/23_op_priority1.pas new file mode 100644 index 0000000..595e116 --- /dev/null +++ b/open_set/23_op_priority1.pas @@ -0,0 +1,10 @@ +{ test the priority of add and mul } +program main; +var a,b,c,d: integer; +begin + a := 10; + b := 4; + c := 2; + d := 2; + write(c + a * b - d); +end. diff --git a/open_set/24_op_priority2.pas b/open_set/24_op_priority2.pas new file mode 100644 index 0000000..4b2afa8 --- /dev/null +++ b/open_set/24_op_priority2.pas @@ -0,0 +1,10 @@ +{ test the priority of add and mul } +program main; +var a,b,c,d: integer; +begin + a := 10; + b := 4; + c := 2; + d := 2; + write((c + a) * (b - d)); +end. diff --git a/open_set/25_op_priority3.pas b/open_set/25_op_priority3.pas new file mode 100644 index 0000000..464f149 --- /dev/null +++ b/open_set/25_op_priority3.pas @@ -0,0 +1,7 @@ +program main; +var a,b: integer; +begin + a := 10; + b := 30; + write(a - (-5) + b + (-5)); +end. diff --git a/open_set/26_op_priority4.pas b/open_set/26_op_priority4.pas new file mode 100644 index 0000000..3a01807 --- /dev/null +++ b/open_set/26_op_priority4.pas @@ -0,0 +1,17 @@ +program main; +var a,b,c,d,e: integer; +flag:boolean; +begin + read(a); + read(b); + read(c); + read(d); + read(e); + flag := false; + if ((a - b * c <> d - a / c) or (a * b / c = e + d) or (a + b + c = d + e)) then + begin + flag := true; + end; + if flag then + write(1); +end. \ No newline at end of file diff --git a/open_set/27_op_priority5.pas b/open_set/27_op_priority5.pas new file mode 100644 index 0000000..f02a28a --- /dev/null +++ b/open_set/27_op_priority5.pas @@ -0,0 +1,16 @@ +program main; +var a,b,c,d,e: integer; flag: boolean; +begin + a := 1; + b := 0; + c := 1; + d := 2; + e := 4; + flag := false; + if ((a * b / c = e + d) and (a * (a + b) + c <= d + e) or (a - (b * c) = d - a / c)) then + begin + flag := true; + end; + if (flag) then + write(1); +end. \ No newline at end of file diff --git a/open_set/28_unary_op.pas b/open_set/28_unary_op.pas new file mode 100644 index 0000000..3d5c631 --- /dev/null +++ b/open_set/28_unary_op.pas @@ -0,0 +1,6 @@ +program main; +var a: integer; +begin + a := 60; + write(not a); +end. diff --git a/open_set/29_unary_op2.pas b/open_set/29_unary_op2.pas new file mode 100644 index 0000000..86a7de3 --- /dev/null +++ b/open_set/29_unary_op2.pas @@ -0,0 +1,16 @@ +program main; +var a,b: integer; +begin + a := 56; + b := 4; + a := a - - 4 + +b; + if (- not not not a <> 65) then + begin + a := - - -1; + end + else + begin + a := 0 + +b; + end; + write(a); +end. diff --git a/open_set/30_logi_assign.pas b/open_set/30_logi_assign.pas new file mode 100644 index 0000000..91a6547 --- /dev/null +++ b/open_set/30_logi_assign.pas @@ -0,0 +1,15 @@ +program main; +var a, b, c: integer; +begin + read(a); + read(b); + if ((a = b) and (a <> 3)) then + begin + c := 1; + end + else + begin + c := 0; + end; + write(c); +end. diff --git a/open_set/31_comment1.pas b/open_set/31_comment1.pas new file mode 100644 index 0000000..4cf3f17 --- /dev/null +++ b/open_set/31_comment1.pas @@ -0,0 +1,15 @@ +{ test comment } +program main; +var a: integer; +begin + a := 5; + { + int b = 4; + a = b + a; + (*/* + b = 1; + // b = 2; + *) + } + write(a); +end. \ No newline at end of file diff --git a/open_set/32_assign_complex_expr.pas b/open_set/32_assign_complex_expr.pas new file mode 100644 index 0000000..786e809 --- /dev/null +++ b/open_set/32_assign_complex_expr.pas @@ -0,0 +1,13 @@ +program main; +var a, b, c, d, e: integer; +begin + a := 5; + b := 5; + c := 1; + d := -2; + e := (d * 1 div 2) + (a - b) - -(c + 3) mod 2; + write(e); + e := ((d mod 2 + 67) + -(a - b) - -((c + 2) mod 2)); + e := e + 3; + write(e); +end. diff --git a/open_set/33_if_complex_expr.pas b/open_set/33_if_complex_expr.pas new file mode 100644 index 0000000..39e1910 --- /dev/null +++ b/open_set/33_if_complex_expr.pas @@ -0,0 +1,18 @@ +program main; +var a,b,c,d,e: integer; +begin + a := 5; + b := 5; + c := 1; + d := -2; + e := 2; + if ((d * 1 div 2) < 0) or ((a - b) <> 0) and ((c + 3) mod 2 <> 0) then + begin + write(e); + end; + if ((d mod 2 + 67) < 0) or ((a - b) <> 0) and ((c + 2) mod 2 <> 0) then + begin + e := 4; + write(e); + end; +end. diff --git a/open_set/34_short_circuit.pas b/open_set/34_short_circuit.pas new file mode 100644 index 0000000..d96cfb7 --- /dev/null +++ b/open_set/34_short_circuit.pas @@ -0,0 +1,39 @@ +program main; +var g, i: integer; + +function func(n: integer): integer; +begin + g := g + n; + write(g); + func := g; +end; + +begin + i := 11; + if (i > 10) and (func(i) <> 0) then + i := 1 + else + i := 0; + write(i); + i := 10; + if (i > 11) and (func(i) <> 0) then + i := 1 + else + i := 0; + write(i); + i := 100; + if (i <= 99) or (func(i) <> 0) then + i := 1 + else + i := 0; + write(i); + i := 99; + if (i <= 100) or (func(i) <> 0) then + i := 1 + else + i := 0; + if (func(99) = 0) and (func(100) <> 0) then + i := 1 + else + i := 0; +end. diff --git a/open_set/35_short_circuit3.pas b/open_set/35_short_circuit3.pas new file mode 100644 index 0000000..61def54 --- /dev/null +++ b/open_set/35_short_circuit3.pas @@ -0,0 +1,78 @@ +program main; +const +AA='A';BB='B';CC='C';DD='D';E='E';F='F';G='G';H='H';I='I';J='J';K='K'; +c=1; +var +a, b, d: integer; +i0,i1,i2,i3,i4: integer; + +function set_a(val: integer): integer; +begin + a := val; + set_a := val; +end; + +function set_b(val: integer): integer; +begin + b := val; + set_b := val; +end; + +function set_d(val: integer): integer; +begin + d := val; + set_d := val; +end; + +begin + a := 2; + b := 3; + if (set_a(0) <> 0) and (set_b(1) <> 0) then + ; + write(a); + write(b); + + a := 2; + b := 3; + if (set_a(0) <> 0) and (set_b(1) <> 0) then + ; + write(a); + write(b); + + d := 2; + if (c >= 1) and (set_d(3) <> 0) then + ; + write(d); + if (c <= 1) or (set_d(4) <> 0) then + ; + write(d); + + if (16 >= (3 - (2 + 1))) then + write(AA); + if (25 - 7) <> (36 - 6 * 3) then + write(BB); + if (1 <> (7 mod 2)) then + write(CC); + if 3 <= 4 then + write(DD); + if 0 <> 0 then + write(E); + if 1 <> 0 then + write(F); + + i0 := 0; + i1 := 1; + i2 := 2; + i3 := 3; + i4 := 4; + if (i0 <> 0) or (i1 <> 0) then + write(G); + if (i0 >= i1) or (i1 <= i0) then + write(H); + if (i2 >= i1) and (i4 <> i3) then + write(I); + if (i0 = 0) and (i3 < i3) or (i4 >= i4) then + write(J); + if (i0 = 0) or (i3 < i3) and (i4 >= i4) then + write(K); +end. \ No newline at end of file diff --git a/open_set/36_scope.pas b/open_set/36_scope.pas new file mode 100644 index 0000000..928eaf4 --- /dev/null +++ b/open_set/36_scope.pas @@ -0,0 +1,28 @@ +program main; +var a, sum, i: integer; + +function func: integer; +var b,a: integer; +begin + b := 7; + a := 1; + if (a = b) then + begin + a := a + 1; + func := 1; + end + else + func := 0; +end; + +begin + a := 7; + sum := 0; + for i := 0 to 99 do + begin + if (func() = 1) then + sum := sum + 1; + end; + write(a); + write(sum); +end. diff --git a/open_set/37_sort_test1.pas b/open_set/37_sort_test1.pas new file mode 100644 index 0000000..22c76af --- /dev/null +++ b/open_set/37_sort_test1.pas @@ -0,0 +1,39 @@ +program main; +var i,n: integer; +arr:array[0..9] of integer; + +function bubblesort:integer; +var i,j,tmp:integer; +begin + for i := 0 to n - 2 do + begin + for j := 0 to (n - 2 - i) do + begin + if arr[j] > arr[j + 1] then + begin + tmp := arr[j + 1]; + arr[j + 1] := arr[j]; + arr[j] := tmp; + end; + end; + end; + bubblesort := 0; +end; + +begin + n := 10; + arr[0] := 4; + arr[1] := 3; + arr[2] := 9; + arr[3] := 2; + arr[4] := 0; + arr[5] := 1; + arr[6] := 6; + arr[7] := 5; + arr[8] := 7; + arr[9] := 8; + for i := bubblesort to n - 1 do + begin + write(arr[i]); + end; +end. diff --git a/open_set/38_sort_test4.pas b/open_set/38_sort_test4.pas new file mode 100644 index 0000000..00d280b --- /dev/null +++ b/open_set/38_sort_test4.pas @@ -0,0 +1,46 @@ +program SelectSort; + +var + n, i: integer; + arr: array[0..9] of integer; + +procedure selectsort; +var i,j,min,tmp: integer; +begin + for i := 0 to n - 2 do + begin + min := i; + for j := i + 1 to n - 1 do + begin + if arr[min] > arr[j] then + min := j; + end; + if min <> i then + begin + tmp := arr[min]; + arr[min] := arr[i]; + arr[i] := tmp; + end; + end; +end; + +begin + n := 10; + arr[0] := 4; + arr[1] := 3; + arr[2] := 9; + arr[3] := 2; + arr[4] := 0; + arr[5] := 1; + arr[6] := 6; + arr[7] := 5; + arr[8] := 7; + arr[9] := 8; + + selectsort; + + for i := 0 to n - 1 do + begin + write(arr[i]); + end; +end. diff --git a/open_set/39_sort_test6.pas b/open_set/39_sort_test6.pas new file mode 100644 index 0000000..60a9b6b --- /dev/null +++ b/open_set/39_sort_test6.pas @@ -0,0 +1,45 @@ +program CountingSort; + +var + n, i: integer; + ini_arr, sorted_arr: array[0..9] of integer; + +procedure countingsort; +var +i, j, k, jj: integer; +count_arr: array[0..9] of integer; +begin + for k := 0 to n - 1 do + count_arr[k] := 0; + for i := 0 to n - 1 do + count_arr[ini_arr[i]] := count_arr[ini_arr[i]] + 1; + for k := 1 to n - 1 do + count_arr[k] := count_arr[k] + count_arr[k - 1]; + for j := 0 to n - 1 do + begin + jj := n - j; + count_arr[ini_arr[jj - 1]] := count_arr[ini_arr[jj - 1]] - 1; + sorted_arr[count_arr[ini_arr[jj - 1]]] := ini_arr[jj - 1]; + end; +end; + +begin + n := 10; + ini_arr[0] := 4; + ini_arr[1] := 3; + ini_arr[2] := 9; + ini_arr[3] := 2; + ini_arr[4] := 0; + ini_arr[5] := 1; + ini_arr[6] := 6; + ini_arr[7] := 5; + ini_arr[8] := 7; + ini_arr[9] := 8; + + countingsort; + + for i := 0 to n - 1 do + begin + write(sorted_arr[i]); + end; +end. diff --git a/open_set/40_percolation.pas b/open_set/40_percolation.pas new file mode 100644 index 0000000..d4d3e28 --- /dev/null +++ b/open_set/40_percolation.pas @@ -0,0 +1,80 @@ +program main; +var +arr: array[0..109] of integer; +n: integer; +m, a, b, k, loc, i: integer; +flag: boolean; + +procedure init(n: integer); +var i: integer; +begin + for i := 1 to n * n + 1 do + arr[i] := -1; +end; + +function findfa(a: integer):integer; +begin + if arr[a] = a then + findfa := a + else + begin + arr[a] := findfa(arr[a]); + findfa := arr[a]; + end; +end; + +procedure mmerge(a, b: integer); +var m, n: integer; +begin + m := findfa(a); + n := findfa(b); + if m <> n then + arr[m] := n; +end; + +begin + n := 4; + m := 10; + flag := false; + init(n); + k := n * n + 1; + + for i := 0 to m - 1 do + begin + read(a); + read(b); + if flag = false then + begin + loc := n * (a - 1) + b; + arr[loc] := loc; + if a = 1 then + begin + arr[0] := 0; + mmerge(loc, 0); + end; + if a = n then + begin + arr[k] := k; + mmerge(loc, k); + end; + + if (b < n) and (arr[loc + 1] <> -1) then + mmerge(loc, loc + 1); + if (b > 1) and (arr[loc - 1] <> -1) then + mmerge(loc, loc - 1); + if (a < n) and (arr[loc + n] <> -1) then + mmerge(loc, loc + n); + if (a > 1) and (arr[loc - n] <> -1) then + mmerge(loc, loc - n); + + if (arr[0] <> -1) and (arr[k] <> -1) and (findfa(0) = findfa(k)) then + begin + flag := true; + write(i + 1); + end; + end; + end; + + if flag = false then + write(-1); +end. diff --git a/open_set/41_big_int_mul.pas b/open_set/41_big_int_mul.pas new file mode 100644 index 0000000..7d82f3b --- /dev/null +++ b/open_set/41_big_int_mul.pas @@ -0,0 +1,77 @@ +program main; +const len = 20; +var +i,j,t,n,temp: integer; +len1,len2:integer; +mult1, mult2: array [0..19] of integer; +c1,c2: array [0..24] of integer; +result: array[0..39] of integer; + +begin + len1 := len; + len2 := len; + for i := 0 to 8 do + mult1[i] := i + 1; + mult1[9] := 0; + for i := 10 to 18 do + mult1[i] := i - 9; + mult1[19] := 0; + + mult2[0] := 2; + mult2[1] := 3; + mult2[2] := 4; + mult2[3] := 2; + mult2[4] := 5; + mult2[5] := 7; + mult2[6] := 9; + mult2[7] := 9; + mult2[8] := 0; + mult2[9] := 1; + mult2[10] := 9; + mult2[11] := 8; + mult2[12] := 7; + mult2[13] := 6; + mult2[14] := 4; + mult2[15] := 3; + mult2[16] := 2; + mult2[17] := 1; + mult2[18] := 2; + mult2[19] := 2; + + for i := 0 to len1 - 1 do + c1[i] := mult1[i]; + for i := 0 to len2 - 1 do + c2[i] := mult2[i]; + n := len1 + len2 - 1; + + for i := 0 to n do + result[i] := 0; + + temp := 0; + + for i := 0 to len2 - 1 do + begin + t := c2[len2 - 1 - i]; + for j := 0 to len1 - 1 do + begin + temp := result[n] + t * c1[len1 - 1 - j]; + if temp >= 10 then + begin + result[n] := temp; + result[n - 1] :=result[n - 1] + temp div 10; + end + else + begin + result[n] := temp; + end; + n := n - 1; + end; + n := n + len1 - 1; + end; + + if result[0] <> 0 then + write(result[0]); + + for i := 1 to (len1 + len2 - 1) do + write(result[i]); +end. \ No newline at end of file diff --git a/open_set/42_color.pas b/open_set/42_color.pas new file mode 100644 index 0000000..f0c42f4 --- /dev/null +++ b/open_set/42_color.pas @@ -0,0 +1,77 @@ +program main; +const + modn = 1000000007; + +var + dp: array[0..17, 0..17, 0..17, 0..17, 0..17, 0..6] of integer; + list: array[0..199] of integer; + cns: array[1..19] of integer; + n: integer; + i, j, k, l, m, h: integer; + ans: integer; + +function equal(a, b: integer): integer; +begin + if a = b then + equal := 1 + else + equal := 0; +end; + +function dfs(a, b, c, d, e, last: integer): integer; +var anss:integer; +begin + if dp[a, b, c, d, e, last] <> -1 then + dfs := dp[a, b, c, d, e, last]; + if a + b + c + d + e = 0 then + dfs := 1 + else + begin + anss := 0; + + if a <> 0 then + anss := (anss + (a - equal(last, 2)) * dfs(a - 1, b, c, d, e, 1)) mod modn; + if b <> 0 then + anss := (anss + (b - equal(last, 3)) * dfs(a + 1, b - 1, c, d, e, 2)) mod modn; + if c <> 0 then + anss := (anss + (c - equal(last, 4)) * dfs(a, b + 1, c - 1, d, e, 3)) mod modn; + if d <> 0 then + anss := (anss + (d - equal(last, 5)) * dfs(a, b, c + 1, d - 1, e, 4)) mod modn; + if e <> 0 then + anss := (anss + e * dfs(a, b, c, d + 1, e - 1, 5)) mod modn; + dp[a, b, c, d, e, last] := anss mod modn; + dfs := dp[a, b, c, d, e, last]; + end; +end; + +begin + read(n); + + for i := 0 to 17 do + begin + for j := 0 to 17 do + begin + for k := 0 to 17 do + begin + for l := 0 to 17 do + begin + for m := 0 to 17 do + begin + for h := 0 to 6 do + dp[i, j, k, l, m, h] := -1; + end; + end; + end; + end; + end; + + for i := 0 to n - 1 do + begin + read(list[i]); + cns[list[i]] := cns[list[i]] + 1; + end; + + ans := dfs(cns[1], cns[2], cns[3], cns[4], cns[5], 0); + + write(ans); +end. diff --git a/open_set/43_exgcd.pas b/open_set/43_exgcd.pas new file mode 100644 index 0000000..f683c34 --- /dev/null +++ b/open_set/43_exgcd.pas @@ -0,0 +1,36 @@ +program main; + +var + x, y: array[0..0] of integer; + a, b: integer; + +function exgcd(a, b: integer; var x, y: integer): integer; +var + t, r: integer; +begin + if b = 0 then + begin + x := 1; + y := 0; + exgcd := a; + end + else + begin + r := exgcd(b, a mod b, x, y); + t := x; + x := y; + y := (t - (a div b) * y); + exgcd := r; + end; +end; + + +begin + a := 7; + b := 15; + x[0] := 1; + y[0] := 1; + exgcd(a, b, x[0], y[0]); + x[0] := ((x[0] mod b) + b) mod b; + write(x[0]); +end. diff --git a/open_set/44_reverse_output.pas b/open_set/44_reverse_output.pas new file mode 100644 index 0000000..bf7b687 --- /dev/null +++ b/open_set/44_reverse_output.pas @@ -0,0 +1,25 @@ +program main; +var + i: integer; + +procedure reverse(n: integer); +var + next: integer; +begin + if n <= 1 then + begin + read(next); + write(next); + end + else + begin + read(next); + reverse(n - 1); + write(next); + end; +end; + +begin + i := 200; + reverse(i); +end. diff --git a/open_set/45_dijkstra.pas b/open_set/45_dijkstra.pas new file mode 100644 index 0000000..15976e0 --- /dev/null +++ b/open_set/45_dijkstra.pas @@ -0,0 +1,74 @@ +program main; + +const + INF = 32767; + +var + e: array[0..15, 0..15] of integer; + dis, book: array[0..15] of integer; + m, n: integer; + u, v, i, j: integer; + +procedure Dijkstra(); +var + i, min_num, min_index, k, j: integer; +begin + for i := 1 to n do + begin + dis[i] := e[1, i]; + book[i] := 0; + end; + book[1] := 1; + + for i := 1 to n - 1 do + begin + min_num := INF; + min_index := 0; + for k := 1 to n do + begin + if (min_num > dis[k]) and (book[k] = 0) then + begin + min_num := dis[k]; + min_index := k; + end; + end; + book[min_index] := 1; + for j := 1 to n do + begin + if e[min_index, j] < INF then + begin + if dis[j] > dis[min_index] + e[min_index, j] then + dis[j] := dis[min_index] + e[min_index, j]; + end; + end; + end; +end; + +begin + read(n); + read(m); + + for i := 1 to n do + begin + for j := 1 to n do + begin + if i = j then + e[i, j] := 0 + else + e[i, j] := INF; + end; + end; + + for i := 1 to m do + begin + read(u); + read(v); + read(e[u, v]); + end; + + Dijkstra(); + + for i := 1 to n do + write(dis[i]); + read(e[0,0]); +end. diff --git a/open_set/46_full_conn.pas b/open_set/46_full_conn.pas new file mode 100644 index 0000000..8de511e --- /dev/null +++ b/open_set/46_full_conn.pas @@ -0,0 +1,39 @@ +program main; +const DOG = 'd'; CAT = 'c'; +var N, k, i, j: integer; +a: array[0..4, 0..4] of integer; + +function relu_reg(n: integer): integer; +begin + if n > 127 then + relu_reg := 127; + if n < 0 then + relu_reg := 0; +end; + +function model: integer; +begin + if (+relu_reg(+a[0][0] * 85 + a[0][1] * 23 + a[0][2] * -82 + a[0][3] * -103 + a[0][4] * -123 + a[1][0] * 64 + a[1][1] * -120 + a[1][2] * 50 + a[1][3] * -59 + a[1][4] * 47 + a[2][0] * -111 + a[2][1] * -67 + a[2][2] * -106 + a[2][3] * -75 + a[2][4] * -102 + a[3][0] * 34 + a[3][1] * -39 + a[3][2] * 65 + a[3][3] * 47 + a[3][4] * 113 + a[4][0] * 110 + a[4][1] * 47 + a[4][2] * -4 + a[4][3] * 80 + a[4][4] * 46) * 39 + relu_reg(+a[0][0] * -106 + a[0][1] * 126 + a[0][2] * -18 + a[0][3] * -31 + a[0][4] * -8 + a[1][0] * 47 + a[1][1] * -4 + a[1][2] * 67 + a[1][3] * -94 + a[1][4] * -121 + a[2][0] * 7 + a[2][1] * -21 + a[2][2] * -60 + a[2][3] * -43 + a[2][4] * 105 + a[3][0] * -42 + a[3][1] * 87 + a[3][2] * 29 + a[3][3] * -106 + a[3][4] * -31 + a[4][0] * -110 + a[4][1] * -100 + a[4][2] * -22 + a[4][3] * -75 + a[4][4] * -125) * 77 + relu_reg(+a[0][0] * 26 + a[0][1] * 76 + a[0][2] * -70 + a[0][3] * 29 + a[0][4] * -95 + a[1][0] * 96 + a[1][1] * 52 + a[1][2] * -68 + a[1][3] * -5 + a[1][4] * 34 + a[2][0] * -34 + a[2][1] * 102 + a[2][2] * 6 + a[2][3] * -38 + a[2][4] * 27 + a[3][0] * 110 + a[3][1] * 116 + a[3][2] * 39 + a[3][3] * -63 + a[3][4] * -99 + a[4][0] * 65 + a[4][1] * 120 + a[4][2] * -39 + a[4][3] * -6 + a[4][4] * 94) * 127 + relu_reg(+a[0][0] * -23 + a[0][1] * -63 + a[0][2] * 49 + a[0][3] * 50 + a[0][4] * 72 + a[1][0] * 85 + a[1][1] * -30 + a[1][2] * 12 + a[1][3] * 125 + a[1][4] * -117 + a[2][0] * -65 + a[2][1] * -67 + a[2][2] * 125 + a[2][3] * 110 + a[2][4] * -31 + a[3][0] * -123 + a[3][1] * 83 + a[3][2] * 122 + a[3][3] * 11 + a[3][4] * -23 + a[4][0] * -47 + a[4][1] * -32 + a[4][2] * -117 + a[4][3] * 95 + a[4][4] * 118) * -106 + relu_reg(+a[0][0] * 8 + a[0][1] * 82 + a[0][2] * -104 + a[0][3] * 101 + a[0][4] * -116 + a[1][0] * -63 + a[1][1] * -16 + a[1][2] * -70 + a[1][3] * 125 + a[1][4] * 75 + a[2][0] * 66 + a[2][1] * -96 + a[2][2] * -101 + a[2][3] * -114 + a[2][4] * 59 + a[3][0] * 12 + a[3][1] * 5 + a[3][2] * -95 + a[3][3] * 116 + a[3][4] * -93 + a[4][0] * 15 + a[4][1] * 79 + a[4][2] * 3 + a[4][3] * 49 + a[4][4] * -124) * -3 + relu_reg(+a[0][0] * 81 + a[0][1] * 68 + a[0][2] * -102 + a[0][3] * -74 + a[0][4] * 121 + a[1][0] * -15 + a[1][1] * 55 + a[1][2] * 101 + a[1][3] * -13 + a[1][4] * -62 + a[2][0] * 64 + a[2][1] * 114 + a[2][2] * 38 + a[2][3] * -21 + a[2][4] * 112 + a[3][0] * 114 + a[3][1] * 112 + a[3][2] * -10 + a[3][3] * -16 + a[3][4] * -50 + a[4][0] * -112 + a[4][1] * -116 + a[4][2] * -54 + a[4][3] * 82 + a[4][4] * -72) * 32 + relu_reg(+a[0][0] * 15 + a[0][1] * -77 + a[0][2] * 66 + a[0][3] * -90 + a[0][4] * -6 + a[1][0] * -30 + a[1][1] * -8 + a[1][2] * 81 + a[1][3] * 2 + a[1][4] * -110 + a[2][0] * -95 + a[2][1] * 59 + a[2][2] * 52 + a[2][3] * 15 + a[2][4] * 55 + a[3][0] * -33 + a[3][1] * 14 + a[3][2] * 58 + a[3][3] * 67 + a[3][4] * 86 + a[4][0] * -79 + a[4][1] * 48 + a[4][2] * -13 + a[4][3] * -15 + a[4][4] * 66) * -95 + relu_reg(+a[0][0] * 33 + a[0][1] * 82 + a[0][2] * 67 + a[0][3] * 30 + a[0][4] * -2 + a[1][0] * 65 + a[1][1] * 120 + a[1][2] * -13 + a[1][3] * 18 + a[1][4] * 5 + a[2][0] * 104 + a[2][1] * -119 + a[2][2] * -7 + a[2][3] * 71 + a[2][4] * 107 + a[3][0] * 24 + a[3][1] * 82 + a[3][2] * -96 + a[3][3] * -104 + a[3][4] * -121 + a[4][0] * 65 + a[4][1] * 97 + a[4][2] * 83 + a[4][3] * 46 + a[4][4] * -84) * -50 + relu_reg(+a[0][0] * -29 + a[0][1] * 7 + a[0][2] * -70 + a[0][3] * 38 + a[0][4] * -90 + a[1][0] * -15 + a[1][1] * -32 + a[1][2] * 37 + a[1][3] * 36 + a[1][4] * -62 + a[2][0] * -125 + a[2][1] * -46 + a[2][2] * -70 + a[2][3] * 37 + a[2][4] * -73 + a[3][0] * -34 + a[3][1] * -87 + a[3][2] * -75 + a[3][3] * 71 + a[3][4] * -77 + a[4][0] * 53 + a[4][1] * 37 + a[4][2] * -103 + a[4][3] * -13 + a[4][4] * -114) * -23 + relu_reg(+a[0][0] * 67 + a[0][1] * 42 + a[0][2] * 41 + a[0][3] * -123 + a[0][4] * -92 + a[1][0] * 10 + a[1][1] * -77 + a[1][2] * 75 + a[1][3] * 96 + a[1][4] * -51 + a[2][0] * 109 + a[2][1] * -74 + a[2][2] * -7 + a[2][3] * -122 + a[2][4] * 67 + a[3][0] * 47 + a[3][1] * 22 + a[3][2] * -68 + a[3][3] * 38 + a[3][4] * 29 + a[4][0] * 115 + a[4][1] * -121 + a[4][2] * 36 + a[4][3] * -49 + a[4][4] * 85) * 46 > 0) then + model := 1 + else + model := 0; +end; + +begin + read(N); + for k := 0 to N - 1 do + begin + for i := 0 to 4 do + begin + for j := 0 to 4 do + begin + read(a[i, j]); + end; + end; + + if model <> 0 then + write(CAT) + else + write(DOG); + end; +end. diff --git a/open_set/47_hanoi.pas b/open_set/47_hanoi.pas new file mode 100644 index 0000000..dfbdff3 --- /dev/null +++ b/open_set/47_hanoi.pas @@ -0,0 +1,30 @@ +program Hanoi; +const split = ','; +var + n, t, i: integer; + +procedure move(x, y: integer); +begin + write(x,y,split); +end; + +procedure hanoi(n, one, two, three: integer); +begin + if n = 1 then + move(one, three) + else + begin + hanoi(n - 1, one, three, two); + move(one, three); + hanoi(n - 1, two, one, three); + end; +end; + +begin + read(n); + for i := 1 to n do + begin + read(t); + hanoi(t, 1, 2, 3); + end; +end. diff --git a/open_set/48_n_queens.pas b/open_set/48_n_queens.pas new file mode 100644 index 0000000..a2faf2c --- /dev/null +++ b/open_set/48_n_queens.pas @@ -0,0 +1,62 @@ +program NQueens; +const +newline = ','; +blank = ' '; + +var + ans: array[1..50] of integer; + sum, n: integer; + row: array[1..50] of integer; + line1: array[1..50] of integer; + line2: array[1..100] of integer; + k, i: integer; + +procedure printans; +var + i: integer; +begin + sum := sum + 1; + for i := 1 to n do + begin + write(ans[i]); + if i = n then + write(newline) + else + write(blank); + end; +end; + +procedure f(step: integer); +var + i: integer; +begin + for i := 1 to n do + begin + if (row[i] <> 1) and (line1[step + i] = 0) and (line2[n + step - i] = 0) then + begin + ans[step] := i; + if step = n then + printans; + row[i] := 1; + line1[step + i] := 1; + line2[n + step - i] := 1; + f(step + 1); + row[i] := 0; + line1[step + i] := 0; + line2[n + step - i] := 0; + end; + end; +end; + + +begin + sum := 0; + read(k); + for i := 1 to k do + begin + read(n); + f(1); + end; + + write(sum); +end. diff --git a/open_set/49_substr.pas b/open_set/49_substr.pas new file mode 100644 index 0000000..63b63f9 --- /dev/null +++ b/open_set/49_substr.pas @@ -0,0 +1,79 @@ +program substr; +var +A: array [0..14] of integer; +B: array [0..12] of integer; + +function MAX(a, b: integer): integer; +begin + if a >= b then + MAX := a + else + MAX := b; +end; + +function max_sum_nonadjacent(n: integer): integer; +var +i: integer; +temp: array [0..15] of integer; +begin + temp[0] := A[0]; + temp[1] := MAX(A[0], A[1]); + for i := 2 to n - 1 do + temp[i] := MAX(temp[i - 2] + A[i], temp[i - 1]); + max_sum_nonadjacent := temp[n - 1] +end; + +function longest_common_subseq(len1, len2: integer): integer; +var i, j: integer; +p: array[0..15, 0..15] of integer; +begin + for i := 0 to 15 do + p[i, 0] := 0; + for j := 0 to 15 do + p[0, j] := 0; + for i := 1 to len1 do + begin + for j := 1 to len2 do + begin + if A[i - 1] = B[j - 1] then + p[i, j] := p[i - 1, j - 1] + 1 + else + p[i, j] := MAX(p[i - 1, j], p[i, j - 1]); + end; + end; + longest_common_subseq := p[len1, len2]; +end; + +begin + A[0] := 8; + A[1] := 7; + A[2] := 4; + A[3] := 1; + A[4] := 2; + A[5] := 7; + A[6] := 0; + A[7] := 1; + A[8] := 9; + A[9] := 3; + A[10] := 4; + A[11] := 8; + A[12] := 3; + A[13] := 7; + A[14] := 0; + B[0] := 3; + B[1] := 9; + B[2] := 7; + B[3] := 1; + B[4] := 4; + B[5] := 2; + B[6] := 4; + B[7] := 3; + B[8] := 6; + B[9] := 8; + B[10] := 0; + B[11] := 1; + B[12] := 5; + + write(max_sum_nonadjacent(15)); + write(longest_common_subseq(15, 13)); +end. diff --git a/open_set/50_side_effect.pas b/open_set/50_side_effect.pas new file mode 100644 index 0000000..8baf7c2 --- /dev/null +++ b/open_set/50_side_effect.pas @@ -0,0 +1,42 @@ +program main; +const split = ','; +var + a, b, k, i: integer; + +function inc_a: integer; +var + temp_b: integer; +begin + temp_b := a; + temp_b := temp_b + 1; + a := temp_b; + inc_a := a; +end; + + +begin + a := -1; + b := 1; + k := 5; + + for i := 0 to k do + begin + if (inc_a <> 0) and (inc_a <> 0) and (inc_a <> 0) then + begin + write(a, b, split); + end; + + if (inc_a < 14) or ((inc_a <> 0) and ((inc_a - inc_a + 1) <> 0)) then + begin + write(a, split); + b := b * 2; + end + else + begin + inc_a; + end; + end; + + write(a,b,split); + write(a); +end. diff --git a/open_set/51_var_name.pas b/open_set/51_var_name.pas new file mode 100644 index 0000000..16c30e2 --- /dev/null +++ b/open_set/51_var_name.pas @@ -0,0 +1,14 @@ +program main; +const u5X8l2s8I2w6D3f2a8C6d7l0H9b6q7K4p8Z6y8O5z2G5s6V8n1d7v8C3g9S9H4k8l8F9x1Q1k2p9Y1w9G5S2h2L6a0X5n5W5e = 'a'; +var +U01t9EaA7ZoJ5E8dZfRbP7iKfrW9bLXtxnMDh1QsZnB3S4v0wNvKxvFea8m7uNTjA2U6l5kPzFe8q2CfP0XNq6Pv2r6sX1vG7i2V0KcJ8I0v4Z0r8pY8gE3s5g8b9M5: integer; +l7J9H5Q3iD7yL0O3bT8oF6uJ2eZ4rN6wV0zA7nU8Y4fM1E2W3uK4R8sZ6c1qX8pG8m4a6S9f2N7xX4m7R3D7m9R3I5n1J2: real; +T2e5I2v7T2o9P9n9h7Q1s7b8g7S6k0x7Z7Y1W4Q0f5G2q7j6c2N7S9t8i5e7z5b9H4x7e6q1W1J1T7k6u7i4K2l4v8o7M6j7: boolean; + +begin + U01t9EaA7ZoJ5E8dZfRbP7iKfrW9bLXtxnMDh1QsZnB3S4v0wNvKxvFea8m7uNTjA2U6l5kPzFe8q2CfP0XNq6Pv2r6sX1vG7i2V0KcJ8I0v4Z0r8pY8gE3s5g8b9M5 := 0; + l7J9H5Q3iD7yL0O3bT8oF6uJ2eZ4rN6wV0zA7nU8Y4fM1E2W3uK4R8sZ6c1qX8pG8m4a6S9f2N7xX4m7R3D7m9R3I5n1J2 := 0.0; + T2e5I2v7T2o9P9n9h7Q1s7b8g7S6k0x7Z7Y1W4Q0f5G2q7j6c2N7S9t8i5e7z5b9H4x7e6q1W1J1T7k6u7i4K2l4v8o7M6j7 := false; + if T2e5I2v7T2o9P9n9h7Q1s7b8g7S6k0x7Z7Y1W4Q0f5G2q7j6c2N7S9t8i5e7z5b9H4x7e6q1W1J1T7k6u7i4K2l4v8o7M6j7 = false then + write(U01t9EaA7ZoJ5E8dZfRbP7iKfrW9bLXtxnMDh1QsZnB3S4v0wNvKxvFea8m7uNTjA2U6l5kPzFe8q2CfP0XNq6Pv2r6sX1vG7i2V0KcJ8I0v4Z0r8pY8gE3s5g8b9M5, l7J9H5Q3iD7yL0O3bT8oF6uJ2eZ4rN6wV0zA7nU8Y4fM1E2W3uK4R8sZ6c1qX8pG8m4a6S9f2N7xX4m7R3D7m9R3I5n1J2, u5X8l2s8I2w6D3f2a8C6d7l0H9b6q7K4p8Z6y8O5z2G5s6V8n1d7v8C3g9S9H4k8l8F9x1Q1k2p9Y1w9G5S2h2L6a0X5n5W5e); +end. \ No newline at end of file diff --git a/open_set/52_chaos_token.pas b/open_set/52_chaos_token.pas new file mode 100644 index 0000000..6a47aee --- /dev/null +++ b/open_set/52_chaos_token.pas @@ -0,0 +1,75 @@ +program CountingSort; + +var + n: integer; + + + i, tmp: + + integer; + iniArr, sortedArr: array[0..9] of + + integer; + +function countingSort +(n: integer): integer; +var + countArr: array[0..9] of integer; + i, j, k, jj: + integer +; +begin + for k := 0 + to 9 do + begin + countArr[k + ] := 0; + end; + for i := 0 to n - 1 do + begin + countArr[ + + + iniArr[i]] := + countArr[iniArr[i]] + + 1; + end; + for k := 1 to 9 do + begin + countArr + + [k] := + + countArr[k] + countArr[k - 1]; end; + for jj := 0 to n-1 do + begin j:=n-jj;countArr[iniArr[j - 1]] := countArr[iniArr[j - 1]] - 1; sortedArr[countArr[iniArr[j - 1]]] := iniArr[j - 1]; + end; + countingSort := 0; +end; + +begin + n := 10; + iniArr[0] := 4; + iniArr[1] := 3; + iniArr[2] := 9; + iniArr[3 + ] := 2; + iniArr[4] := 0; + iniArr[ + 5] := 1; + iniArr[6] := 6; + iniArr[ 7] := 5; + iniArr[8] := + 7; + iniArr[9] := 8; + + countingSort( + n); + + for i := 0 to n - 1 do + begin + tmp := sortedArr[i]; + write(tmp); + + end; +end. diff --git a/open_set/53_skip_spaces.pas b/open_set/53_skip_spaces.pas new file mode 100644 index 0000000..77d88a8 --- /dev/null +++ b/open_set/53_skip_spaces.pas @@ -0,0 +1,23 @@ +program main; +// ??? // ???? +// ????? +{dfdafa} +var +i,j,sum,t: integer; +arr: array[0..99] of integer; +begin + t := 5; + i := 0; + sum := 0; + for j := 0 to t - 1 do + begin + i := i + 1; + arr[j] := i; + end; + + for j := 0 to i - 1 do + begin + sum := sum + arr[j]; + end; + write(sum mod 79); +end. \ No newline at end of file diff --git a/open_set/54_long_array.pas b/open_set/54_long_array.pas new file mode 100644 index 0000000..4bf163f --- /dev/null +++ b/open_set/54_long_array.pas @@ -0,0 +1,60 @@ +program long_array; + +function long_array(k: integer): integer; +var + a1, a2, a3: array[0..149] of integer; + i, j, ans: integer; +begin + for i := 0 to 149 do + a1[i] := (i * i) mod 10; + + for i := 0 to 149 do + a2[i] := (a1[i] * a1[i]) mod 10; + + for i := 0 to 149 do + a3[i] := (a2[i] * a2[i]) mod 100 + a1[i]; + + ans := 0; + + for i := 0 to 149 do + begin + if i < 10 then + begin + ans := (ans + a3[i]) mod 1333; + write(ans); + end; + + if i < 20 then + begin + for j := (150 div 2) to 149 do + ans := ans + a3[i] - a1[j]; + write(ans); + end; + + if i < 30 then + begin + for j := 150 div 2 to 149 do + begin + if j > 2233 then + begin + ans := ans + a2[i] - a1[j]; + end + else + begin + ans := (ans + a1[i] + a3[j]) mod 13333; + end; + end; + write(ans); + end + else + begin + ans := (ans + a3[i] * k) mod 99988; + end; + end; + + long_array := ans; +end; + +begin + write(long_array(9)); +end. diff --git a/open_set/55_long_array2.pas b/open_set/55_long_array2.pas new file mode 100644 index 0000000..88cc7a8 --- /dev/null +++ b/open_set/55_long_array2.pas @@ -0,0 +1,30 @@ +program Arrays; + +var + a: array[0..4095] of integer; + b: array[0..3, 0..1023] of integer; + c: array[0..1023, 0..3] of integer; + +function f1: integer; +begin + a[5] := 4000; + a[4000] := 3; + a[4095] := 7; + c[0, a[4095]] := a[2216] + 9; + f1 := a[a[5]]; +end; + +begin + b[1][0] := 1; + b[2][0] := 2; + b[2][1] := 3; + b[3][0] := 4; + b[3][1] := 5; + b[3][2] := 6; + c[0][0] := 1; + c[0][1] := 2; + c[1][0] := 3; + c[1][1] := 4; + write(f1); + write(c[2][0]); +end. diff --git a/open_set/56_long_code2.pas b/open_set/56_long_code2.pas new file mode 100644 index 0000000..18593c4 --- /dev/null +++ b/open_set/56_long_code2.pas @@ -0,0 +1,409 @@ +program main; +var + a: array[0..4, 0..19999] of integer; + ans: integer; +begin + a[4, 19999] := 1; + ans := + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1] + a[2 * 2, 20000 - 1]; + write(ans); +end. \ No newline at end of file diff --git a/open_set/57_many_params.pas b/open_set/57_many_params.pas new file mode 100644 index 0000000..c78c2fb --- /dev/null +++ b/open_set/57_many_params.pas @@ -0,0 +1,119 @@ +program main; +var +arr: array [0..31, 0..1] of integer; +i: integer; + +function param32_rec(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16, + a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30, + a31,a32: integer): integer; +begin + if a1 = 0 then + param32_rec := a2 + else + param32_rec := param32_rec(a1 - 1, (a2 + a3) mod 998244353, a4, a5, a6, a7, a8, a9, + a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, + a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, + a32, 0); +end; + +function param32_arr: integer; +var sum: integer; +begin + sum := arr[0][0] + arr[0][1]; + sum := sum + arr[1][0] + arr[1][1]; + sum := sum + arr[2][0] + arr[2][1]; + sum := sum + arr[3][0] + arr[3][1]; + sum := sum + arr[4][0] + arr[4][1]; + sum := sum + arr[5][0] + arr[5][1]; + sum := sum + arr[6][0] + arr[6][1]; + sum := sum + arr[7][0] + arr[7][1]; + sum := sum + arr[8][0] + arr[8][1]; + sum := sum + arr[9][0] + arr[9][1]; + sum := sum + arr[10][0] + arr[10][1]; + sum := sum + arr[11][0] + arr[11][1]; + sum := sum + arr[12][0] + arr[12][1]; + sum := sum + arr[13][0] + arr[13][1]; + sum := sum + arr[14][0] + arr[14][1]; + sum := sum + arr[15][0] + arr[15][1]; + sum := sum + arr[16][0] + arr[16][1]; + sum := sum + arr[17][0] + arr[17][1]; + sum := sum + arr[18][0] + arr[18][1]; + sum := sum + arr[19][0] + arr[19][1]; + sum := sum + arr[20][0] + arr[20][1]; + sum := sum + arr[21][0] + arr[21][1]; + sum := sum + arr[22][0] + arr[22][1]; + sum := sum + arr[23][0] + arr[23][1]; + sum := sum + arr[24][0] + arr[24][1]; + sum := sum + arr[25][0] + arr[25][1]; + sum := sum + arr[26][0] + arr[26][1]; + sum := sum + arr[27][0] + arr[27][1]; + sum := sum + arr[28][0] + arr[28][1]; + sum := sum + arr[29][0] + arr[29][1]; + sum := sum + arr[30][0] + arr[30][1]; + sum := sum + arr[31][0] + arr[31][1]; + param32_arr := sum; +end; + +function param16(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16: integer): integer; +var arr2: array[0..15] of integer; +begin + arr2[0] := a1; + arr2[1] := a2; + arr2[2] := a3; + arr2[3] := a4; + arr2[4] := a5; + arr2[5] := a6; + arr2[6] := a7; + arr2[7] := a8; + arr2[8] := a9; + arr2[9] := a10; + arr2[10] := a11; + arr2[11] := a12; + arr2[12] := a13; + arr2[13] := a14; + arr2[14] := a15; + arr2[15] := a16; + param16 := param32_rec(arr2[0], arr2[1], arr2[2], arr2[3], arr2[4], arr2[5], arr2[6], + arr2[7], arr2[8], arr2[9], arr2[10], arr2[11], arr2[12], arr2[13], + arr2[14], arr2[15], a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, + a11, a12, a13, a14, a15, a16); +end; + +function getint(var index: integer): integer; +var input: array[0..15] of integer; +begin + input[0] := 17; + input[1] := 13; + input[2] := 80; + input[3] := 55; + input[4] := 81; + input[5] := 91; + input[6] := 95; + input[7] := 58; + input[8] := 13; + input[9] := 5; + input[10] := 63; + input[11] := 19; + input[12] := 54; + input[13] := 45; + input[14] := 67; + input[15] := 63; + index := index + 1; + getint := input[index - 1]; +end; + +begin + i := 0; + arr[0, 0] := param16(getint(i), getint(i), getint(i), getint(i), getint(i), + getint(i), getint(i), getint(i), getint(i), getint(i), + getint(i), getint(i), getint(i), getint(i), getint(i), + getint(i)); + arr[0, 1] := 8848; + for i := 1 to 31 do + begin + arr[i, 0] := arr[i - 1, 1] - 1; + arr[i, 1] := arr[i - 1, 0] - 2; + end; + write(param32_arr); +end. + diff --git a/open_set/58_many_params2.pas b/open_set/58_many_params2.pas new file mode 100644 index 0000000..c755a25 --- /dev/null +++ b/open_set/58_many_params2.pas @@ -0,0 +1,44 @@ +program main; +var ret: integer; +a: array[0..60, 0..66] of integer; +b: array[0..52, 0..58] of integer; + +function func(aa: integer; c: integer; e, f: integer; h, i: integer): integer; +var + index: integer; +begin + index := 0; + while (index < 10) do + begin + write(b[aa, index]); + index := index + 1; + end; + + write(a[17, c]); + + while (i < 10) do + begin + b[6, i] := h * 128875 mod 3724; + i := i + 1; + h := h + 7; + end; + + func := e + f; +end; + + +begin + a[17, 1] := 6; + a[17, 3] := 7; + a[17, 4] := 4; + a[17, 7] := 9; + a[17, 11] := 11; + + b[6, 1] := 1; + b[6, 2] := 2; + b[6, 3] := 3; + b[6, 9] := 9; + + ret := func(a[17, 1], a[17, 3],b[6, 3], b[6, 0], b[34, 4], b[51, 18]) * 3; + write(ret); +end. diff --git a/open_set/59_many_globals.pas b/open_set/59_many_globals.pas new file mode 100644 index 0000000..12c8ebf --- /dev/null +++ b/open_set/59_many_globals.pas @@ -0,0 +1,89 @@ +program main; +var +a0,a1,a2,a3,a4,a5,a6,a7,a8,a9:integer; +a10,a11,a12,a13,a14,a15,a16,a17,a18,a19:integer; +a20,a21,a22,a23,a24,a25,a26,a27,a28,a29:integer; +a30,a31,a32,a33,a34,a35,a36,a37,a38,a39:integer; + +function testParam8(a0,a1,a2,a3,a4,a5,a6,a7: integer): integer; +begin + testParam8 := a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7; +end; + +function testParam16(a0,a1,a2,a3,a4,a5,a6,a7 + ,a8,a9,a10,a11,a12,a13,a14,a15: integer):integer; +begin + testParam16 := a0 + a1 + a2 - a3 - a4 - a5 - a6 - a7 + + a8 + a9 + a10 + a11 + a12 + a13 + a14 + a15; +end; + +function testParam32(a0,a1,a2,a3,a4,a5,a6,a7 + ,a8,a9,a10,a11,a12,a13,a14,a15, + a16,a17,a18,a19,a20,a21,a22,a23, + a24,a25,a26,a27,a28,a29,a30,a31: integer):integer; +begin + testParam32 := a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7 + + a8 + a9 + a10 + a11 + a12 + a13 + a14 + a15 + + a16 + a17 - a18 - a19 - a20 - a21 - a22 + a23 + + a24 + a25 + a26 + a27 + a28 + a29 + a30 + a31; +end; + +begin + a0 := 0; + a1 := 1; + a2 := 2; + a3 := 3; + a4 := 4; + a5 := 5; + a6 := 6; + a7 := 7; + a8 := 8; + a9 := 9; + a10 := 0; + a11 := 1; + a12 := 2; + a13 := 3; + a14 := 4; + a15 := 5; + a16 := 6; + a17 := 7; + a18 := 8; + a19 := 9; + a20 := 0; + a21 := 1; + a22 := 2; + a23 := 3; + a24 := 4; + a25 := 5; + a26 := 6; + a27 := 7; + a28 := 8; + a29 := 9; + a30 := 0; + a31 := 1; + + a32 := 4; + a33 := 5; + a34 := 6; + a35 := 7; + a36 := 8; + a37 := 9; + a38 := 0; + a39 := 1; + a0 := testParam8(a0, a1, a2, a3, a4, a5, a6, a7); + write(a0); + a0 := testParam16(a32, a33, a34, a35, + a36, a37, a38, a39, + a8, a9, a10, a11, + a12, a13, a14, a15); + write(a0); + a0 := testParam32(a0, a1, a2, a3, + a4, a5, a6, a7, + a8, a9, a10, a11, + a12, a13, a14, a15, + a16, a17, a18, a19, + a20, a21, a22, a23, + a24, a25, a26, a27, + a28, a29, a30, a31); + write(a0); +end. diff --git a/open_set/60_many_locals.pas b/open_set/60_many_locals.pas new file mode 100644 index 0000000..60f8681 --- /dev/null +++ b/open_set/60_many_locals.pas @@ -0,0 +1,97 @@ +program main; +var + a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x:integer; + sum,sum1,sum2,sum3:integer; + +function foo:integer; +var +arr: array[0..15] of integer; +a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p: integer; +sum1,sum2:integer; +begin + arr[0] := 0; + arr[1] := 1; + arr[2] := 2; + arr[3] := 3; + arr[4] := 0; + arr[5] := 1; + arr[6] := 2; + arr[7] := 3; + arr[8] := 0; + arr[9] := 1; + arr[10] := 2; + arr[11] := 3; + arr[12] := 0; + arr[13] := 1; + arr[14] := 2; + arr[15] := 3; + a := 3; + b := 7; + c := 5; + d := 6; + e := 1; + f := 0; + g := 3; + h := 5; + i := 4; + j := 2; + k := 7; + l := 9; + m := 8; + n := 1; + o := 4; + p := 6; + sum1 := a + b + c + d + e + f + g + h; + sum2 := i + j + k + l + m + n + o + p; + + foo := sum1 + sum2 + arr[a]; +end; + +begin + a := 3; + b := 7; + c := 5; + d := 6; + e := 1; + f := 0; + g := 3; + h := 5; + i := 4; + j := 2; + k := 7; + l := 9; + m := 8; + n := 1; + o := 4; + p := 6; + sum1 := a + b + c + d + e + f + g + h; + sum2 := i + j + k + l + m + n + o + p; + + sum1 := sum1 + foo(); + + q := 4; + r := 7; + s := 2; + t := 5; + u := 8; + v := 0; + w := 6; + x := 3; + + sum2 := sum2 + foo(); + + a := i; + b := j; + c := k; + d := l; + e := m; + f := n; + g := o; + h := p; + + sum3 := q + r + s + t + u + v + w + x; + + sum := sum1 + sum2 + sum3; + + write(sum); +end. \ No newline at end of file diff --git a/open_set/61_many_locals2.pas b/open_set/61_many_locals2.pas new file mode 100644 index 0000000..19994cb --- /dev/null +++ b/open_set/61_many_locals2.pas @@ -0,0 +1,73 @@ +program main; +var n,ret:integer; +b:integer; +a0,a1,a2,a3,a4,a5,a6,a7,a8,a9:integer; +a10,a11,a12,a13,a14,a15,a16,a17,a18,a19:integer; +a20,a21,a22,a23,a24,a25,a26,a27,a28,a29:integer; +begin + b := 5; + ret := 0; + a0 := 0; + a1 := a0 + 1; + a2 := a1 + 1; + a3 := a2 + 1; + a4 := a3 + 1; + a5 := a4 + 1; + a6 := a5 + 1; + a7 := a6 + 1; + a8 := a7 + 1; + a9 := a8 + 1; + a10 := a9 + 1; + a11 := a10 + 1; + a12 := a11 + 1; + a13 := a12 + 1; + a14 := a13 + 1; + a15 := a14 + 1; + a16 := a15 + 1; + a17 := a16 + 1; + a18 := a17 + 1; + a19 := a18 + 1; + a20 := a19 + 1; + a21 := a20 + 1; + a22 := a21 + 1; + a23 := a22 + 1; + a24 := a23 + 1; + a25 := a24 + 1; + a26 := a25 + 1; + a27 := a26 + 1; + a28 := a27 + 1; + a29 := a28 + 1; + write(a0); + write(a1); + write(a2); + write(a3); + write(a4); + write(a5); + write(a6); + write(a7); + write(a8); + write(a9); + write(a10); + write(a11); + write(a12); + write(a13); + write(a14); + write(a15); + write(a16); + write(a17); + write(a18); + write(a19); + write(a20); + write(a21); + write(a22); + write(a23); + write(a24); + write(a25); + write(a26); + write(a27); + write(a28); + write(a29); + write(b); + ret := a25; + write(ret); +end. \ No newline at end of file diff --git a/open_set/62_register_alloc.pas b/open_set/62_register_alloc.pas new file mode 100644 index 0000000..8228ee6 --- /dev/null +++ b/open_set/62_register_alloc.pas @@ -0,0 +1,138 @@ +program main; +var +a0,a1,a2,a3,a4,a5,a6,a7,a8,a9:integer; +a10,a11,a12,a13,a14,a15,a16,a17,a18,a19:integer; +a20,a21,a22,a23,a24,a25,a26,a27,a28,a29:integer; +a30,a31,a32:integer; +a,b:integer; + + +function func(a,b:integer):integer; +var + i:integer; + c1,c2,c3,c4:integer; + d1,d2,d3,d4:integer; + e1,e2,e3,e4:integer; + f1,f2,f3,f4:integer; + g1,g2,g3,g4:integer; + h1,h2,h3,h4:integer; + i1,i2,i3,i4:integer; + j1,j2,j3,j4:integer; + k1,k2,k3,k4:integer; +begin + c1 := 1; + c2 := 2; + c3 := 3; + c4 := 4; + d1 := 1 + c1 + a1; + d2 := 2 + c2 + a2; + d3 := 3 + c3 + a3; + d4 := 4 + c4 + a4; + e1 := 1 + d1 + a5; + e2 := 2 + d2 + a6; + e3 := 3 + d3 + a7; + e4 := 4 + d4 + a8; + f1 := 1 + e1 + a9; + f2 := 2 + e2 + a10; + f3 := 3 + e3 + a11; + f4 := 4 + e4 + a12; + g1 := 1 + f1 + a13; + g2 := 2 + f2 + a14; + g3 := 3 + f3 + a15; + g4 := 4 + f4 + a16; + h1 := 1 + g1 + a17; + h2 := 2 + g2 + a18; + h3 := 3 + g3 + a19; + h4 := 4 + g4 + a20; + i1 := 1 + h1 + a21; + i2 := 2 + h2 + a22; + i3 := 3 + h3 + a23; + i4 := 4 + h4 + a24; + j1 := 1 + i1 + a25; + j2 := 2 + i2 + a26; + j3 := 3 + i3 + a27; + j4 := 4 + i4 + a28; + k1 := 1 + j1 + a29; + k2 := 2 + j2 + a30; + k3 := 3 + j3 + a31; + k4 := 4 + j4 + a32; + + i := a - b + 10; + k1 := 1 + j1 + a29; + k2 := 2 + j2 + a30; + k3 := 3 + j3 + a31; + k4 := 4 + j4 + a32; + j1 := 1 + i1 + a25; + j2 := 2 + i2 + a26; + j3 := 3 + i3 + a27; + j4 := 4 + i4 + a28; + i1 := 1 + h1 + a21; + i2 := 2 + h2 + a22; + i3 := 3 + h3 + a23; + i4 := 4 + h4 + a24; + h1 := 1 + g1 + a17; + h2 := 2 + g2 + a18; + h3 := 3 + g3 + a19; + h4 := 4 + g4 + a20; + g1 := 1 + f1 + a13; + g2 := 2 + f2 + a14; + g3 := 3 + f3 + a15; + g4 := 4 + f4 + a16; + f1 := 1 + e1 + a9; + f2 := 2 + e2 + a10; + f3 := 3 + e3 + a11; + f4 := 4 + e4 + a12; + e1 := 1 + d1 + a5; + e2 := 2 + d2 + a6; + e3 := 3 + d3 + a7; + e4 := 4 + d4 + a8; + d1 := 1 + c1 + a1; + d2 := 2 + c2 + a2; + d3 := 3 + c3 + a3; + d4 := 4 + c4 + a4; + d1 := 1 + c1 + a1; + d2 := 2 + c2 + a2; + d3 := 3 + c3 + a3; + d4 := 4 + c4 + a4; + func := i + c1 + c2 + c3 + c4 - d1 - d2 - d3 - d4 + e1 + e2 + e3 + e4 - f1 - f2 - f3 - f4 + g1 + g2 + g3 + g4 - h1 - h2 - h3 - h4 + i1 + i2 + i3 + i4 - j1 - j2 - j3 - j4 + k1 + k2 + k3 + k4 + a1 - a2 + a3 - a4 + a5 - a6 + a7 - a8 + a9 - a10 + a11 - a12 + a13 - a14 + a15 - a16 + a17 - a18 + a19 - a20 + a21 - a22 + a23 - a24 + a25 - a26 + a27 - a28 + a29 - a30 + a31 - a32; +end; + +begin +a0 := 0; + a1 := 1; + a2 := 2; + a3 := 3; + a4 := 4; + a5 := 5; + a6 := 6; + a7 := 7; + a8 := 8; + a9 := 9; + a10 := 10; + a11 := 11; + a12 := 12; + a13 := 13; + a14 := 14; + a15 := 15; + a16 := 16; + a17 := 1; + a18 := 2; + a19 := 3; + a20 := 4; + a21 := 5; + a22 := 6; + a23 := 7; + a24 := 8; + a25 := 9; + a26 := 10; + a27 := 11; + a28 := 12; + a29 := 13; + a30 := 14; + a31 := 15; + a32 := 16; + a := 1; + b := a + 2 * 9; + a := func(a,b); + write(a); +end. diff --git a/open_set/63_nested_calls.pas b/open_set/63_nested_calls.pas new file mode 100644 index 0000000..12018d3 --- /dev/null +++ b/open_set/63_nested_calls.pas @@ -0,0 +1,93 @@ +program main; +var i, i1, i2, i3, i4, a: integer; +arr: array [0..9] of integer; + +function func1(x, y, z: integer): integer; +begin + if z = 0 then + func1 := x * y + else + func1 := func1(x, y - z, 0); +end; + +function func2(x, y: integer): integer; +begin + if y <> 0 then + func2 := func2(x mod y, 0) + else + func2 := x; +end; + +function func3(x, y: integer): integer; +begin + if y = 0 then + func3 := x + 1 + else + func3 := func3(x + y, 0); +end; + +function func4(x, y, z: integer): integer; +begin + if x <> 0 then + func4 := y + else + func4 := z; +end; + +function func5(x: integer): integer; +begin + func5 := -x; +end; + +function func6(x, y: integer): integer; +begin + if (x <> 0) and (y <> 0) then + func6 := 1 + else + func6 := 0; +end; + +function func7(x: integer): integer; +begin + if x = 0 then + func7 := 1 + else + func7 := 0; +end; + +begin + i1 := 1; + i2 := 2; + i3 := 3; + i4 := 4; + for i := 0 to 9 do + arr[i] := i + 1; + a := func1( + // this + func2( + // is + func1( + // comment + func3(func4(func5(func3(func2(func6(func7(i1), func5(i2)), i3), + // this + i4)), + // is + arr[0], + // function + func1(func2(func3(func4(func5(arr[1]), + // call + func6(arr[2], func7(arr[3])), + func2(arr[4], func7(arr[5]))), + arr[6]), + arr[7]), + func3(arr[8], func7(arr[9])), i1)), + func2(i2, func3(func7(i3), i4))), + arr[0], arr[1]), + arr[2]), + arr[3], + func3(func2(func1(func2(func3(arr[4], func5(arr[5])), func5(arr[6])), + arr[7], func7(arr[8])), + func5(arr[9])), + i1)); + write(a); +end. diff --git a/open_set/64_nested_loops.pas b/open_set/64_nested_loops.pas new file mode 100644 index 0000000..4330853 --- /dev/null +++ b/open_set/64_nested_loops.pas @@ -0,0 +1,107 @@ +program main; +var +arr1: array[0..9,0..1,0..2,0..3,0..4,0..5,0..1] of integer; +arr2: array[0..9,0..1,0..2,0..1,0..3,0..7,0..6] of integer; +x,y,h,i,j,k,l,m,n,ret:integer; + +procedure loop1(x,y:integer); +var +a,b,c,d,e,f,g:integer; +begin +for a := 0 to x-1 do + begin + for b := 0 to 1 do + begin + for c := 0 to 2 do + begin + for d := 0 to 3 do + begin + for e := 0 to 4 do + begin + for f := 0 to 5 do + begin + for g := 0 to 1 do + begin + arr1[a][b][c][d][e][f][g] := a + b + c + d + e + f + g + x + y; + end; + end; + end; + end; + end; + end; + end; +end; + +procedure loop2; +var +a,b,c,d,e,f,g:integer; +begin +for a := 0 to 9 do + begin + for b := 0 to 1 do + begin + for c := 0 to 2 do + begin + for d := 0 to 1 do + begin + for e := 0 to 3 do + begin + for f := 0 to 7 do + begin + for g := 0 to 6 do + begin + arr2[a][b][c][d][e][f][g] := a + b + d + g; + end; + end; + end; + end; + end; + end; + end; +end; + +function loop3(h,i,j,k,l,m,n: integer):integer; +var ans,a,b,c,d,e,f,g: integer; +begin +ans := 0; + for a := 0 to h-1 do + begin + for b := 0 to i-1 do + begin + for c := 0 to j-1 do + begin + for d := 0 to k-1 do + begin + for e := 0 to l-1 do + begin + for f := 0 to m-1 do + begin + for g := 0 to n-1 do + begin + ans := (ans mod 817) + arr1[a][b][c][d][e][f][g] + arr2[a][b][c][d][e][f][g]; + end; + end; + end; + end; + end; + end; + end; + loop3 := ans; +end; + +begin + ret := 0; + x := 1; + y := 2; + h := 3; + i := 4; + j := 5; + k := 6; + l := 7; + m := 8; + n := 9; + loop1(x,y); + loop2(); + ret := loop3(h,i,j,k,l,m,n); + write(ret); +end. \ No newline at end of file diff --git a/open_set/65_float.pas b/open_set/65_float.pas new file mode 100644 index 0000000..d324c14 --- /dev/null +++ b/open_set/65_float.pas @@ -0,0 +1,75 @@ +program main; +const +RADIUS = 5.5; PI = 03.141595653589793; EPS = 0.000001; +EVAL1 = 95.033188; +CONV1 = 233; +MAX = 1000000000; +TWO = 2.9; THREE = 3; FIVE = 5; +e = 'e'; o = 'o'; + +var p:integer; +arr: array[0..9] of real; +input, area, area_trunc: real; + +function float_abs(x: real):real; +begin + if x < 0 then + float_abs := -x + else + float_abs := x; +end; + +function circle_area(radius: integer):real; +begin + circle_area := PI * radius *radius + (radius * radius) * PI / 2; +end; + +function float_eq(a,b: real):integer; +begin + if float_abs(a - b) < EPS then + float_eq := 1 + else + float_eq := 0 +end; + +procedure error; +begin + write(e); +end; + +procedure ok; +begin + write(o); +end; + +procedure assert(cond: integer); +begin + if cond = 0 then + error + else + ok; +end; + +begin + assert(float_eq(circle_area(5), circle_area(FIVE))); + if 1.5 <> 0.0 then + ok; + if (not (3.3 = 0.0)) then + ok; + if (0.0 <> 0.0) and (3 <> 0.0) then + error; + if (0 <> 0.0) or (0.3 <> 0.0) then + ok; + + p := 0; + arr[0] := 1.0; + arr[1] := 2.0; + input := 0.520; + area := PI * input; + area_trunc := circle_area(0); + arr[p] := arr[p] + input; + + write(area); + write(area_trunc); + write(arr[0]); +end. diff --git a/open_set/66_matrix_add.pas b/open_set/66_matrix_add.pas new file mode 100644 index 0000000..2bb7ca9 --- /dev/null +++ b/open_set/66_matrix_add.pas @@ -0,0 +1,56 @@ +program ArrayAddition; + +var + M, L, N: integer; + a0, a1, a2, b0, b1, b2, c0, c1, c2: array[0..2] of integer; + i, x: integer; + +function add: integer; +var + i: integer; +begin + for i := 0 to M - 1 do + begin + c0[i] := a0[i] + b0[i]; + c1[i] := a1[i] + b1[i]; + c2[i] := a2[i] + b2[i]; + end; + + add := 0; +end; + +begin + N := 3; + M := 3; + L := 3; + + for i := 0 to M - 1 do + begin + a0[i] := i; + a1[i] := i; + a2[i] := i; + b0[i] := i; + b1[i] := i; + b2[i] := i; + end; + + add; + + for i := 0 to N - 1 do + begin + x := c0[i]; + write(x); + end; + + for i := 0 to N - 1 do + begin + x := c1[i]; + write(x); + end; + + for i := 0 to N - 1 do + begin + x := c2[i]; + write(x); + end; +end. diff --git a/open_set/67_matrix_sub.pas b/open_set/67_matrix_sub.pas new file mode 100644 index 0000000..ed4a89f --- /dev/null +++ b/open_set/67_matrix_sub.pas @@ -0,0 +1,60 @@ +program Subtraction; +var + N, M, L, i, x: integer; + a0: array [0..2] of integer; + a1: array [0..2] of integer; + a2: array [0..2] of integer; + b0: array [0..2] of integer; + b1: array [0..2] of integer; + b2: array [0..2] of integer; + c0: array [0..5] of integer; + c1: array [0..2] of integer; + c2: array [0..2] of integer; + +function sub: integer; +begin + for i := 0 to 2 do + begin + c0[i] := a0[i] - b0[i]; + c1[i] := a1[i] - b1[i]; + c2[i] := a2[i] - b2[i]; + end; + + sub := 0; +end; + +begin + N := 3; + M := 3; + L := 3; + + for i := 0 to 2 do + begin + a0[i] := i; + a1[i] := i; + a2[i] := i; + b0[i] := i; + b1[i] := i; + b2[i] := i; + end; + + sub; + + for i := 0 to 2 do + begin + x := c0[i]; + write(x); + end; + + for i := 0 to 2 do + begin + x := c1[i]; + write(x); + end; + + for i := 0 to 2 do + begin + x := c2[i]; + write(x); + end; +end. diff --git a/open_set/68_matrix_mul.pas b/open_set/68_matrix_mul.pas new file mode 100644 index 0000000..70bc06e --- /dev/null +++ b/open_set/68_matrix_mul.pas @@ -0,0 +1,56 @@ +program MatrixMultiplication; + +var + M, N, L: integer; +i, x: integer; + a0, a1, a2, b0, b1, b2, c0, c1, c2: array[0..2] of integer; + + +function MultiplyMatrices: integer; +var + i: integer; +begin + for i := 0 to M - 1 do + begin + c0[i] := a0[0] * b0[i] + a0[1] * b1[i] + a0[2] * b2[i]; + c1[i] := a1[0] * b0[i] + a1[1] * b1[i] + a1[2] * b2[i]; + c2[i] := a2[0] * b0[i] + a2[1] * b1[i] + a2[2] * b2[i]; + end; + MultiplyMatrices := 0; +end; + +begin + N := 3; + M := 3; + L := 3; + + for i := 0 to M - 1 do + begin + a0[i] := i; + a1[i] := i; + a2[i] := i; + b0[i] := i; + b1[i] := i; + b2[i] := i; + end; + + MultiplyMatrices; + + for i := 0 to N - 1 do + begin + x := c0[i]; + write(x); + end; + + for i := 0 to N - 1 do + begin + x := c1[i]; + write(x); + end; + + for i := 0 to N - 1 do + begin + x := c2[i]; + write(x); + end; +end. diff --git a/open_set/69_matrix_tran.pas b/open_set/69_matrix_tran.pas new file mode 100644 index 0000000..be60ce2 --- /dev/null +++ b/open_set/69_matrix_tran.pas @@ -0,0 +1,59 @@ +program main; + +var + M, L, N: integer; + a0, a1, a2, b0, b1, b2, c0, c1, c2: array[0..2] of integer; + i, x: integer; + +function tran: integer; +var + i: integer; +begin + for i := 0 to M-1 do + begin + c1[2] := a2[1]; + c2[1] := a1[2]; + c0[1] := a1[0]; + c0[2] := a2[0]; + c1[0] := a0[1]; + c2[0] := a0[2]; + c1[1] := a1[1]; + c2[2] := a2[2]; + c0[0] := a0[0]; + end; + + tran := 0; +end; + +begin + N := 3; + M := 3; + L := 3; + + for i := 0 to M-1 do + begin + a0[i] := i; + a1[i] := i; + a2[i] := i; + b0[i] := i; + b1[i] := i; + b2[i] := i; + end; + + tran; + + for i := 0 to N-1 do + begin + write(c0[i]); + end; + + for i := 0 to N-1 do + begin + write(c1[i]); + end; + + for i := 0 to N-1 do + begin + write(c2[i]); + end; +end. diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100644 index 0000000..c5093e0 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,3 @@ +sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories +apk add clang build-base zlib-dev +dotnet publish diff --git a/scripts/integration_test.py b/scripts/integration_test.py new file mode 100644 index 0000000..bd25f78 --- /dev/null +++ b/scripts/integration_test.py @@ -0,0 +1,109 @@ +import os +import sys +from pathlib import Path + + +def get_test_pas_files(): + open_set_dir = Path("open_set") + + for file in open_set_dir.iterdir(): + if file.suffix == ".pas": + yield file + + +def delete_generated_files(): + print("Info: deleting generated files...") + open_set_dir = Path("open_set") + + for file in open_set_dir.iterdir(): + if file.suffix == ".out": + os.system("rm " + str(file.resolve())) + if file.suffix == ".c": + os.system("rm " + str(file.resolve())) + if file.suffix == ".c_result": + os.system("rm " + str(file.resolve())) + if file.suffix == ".pas_result": + os.system("rm " + str(file.resolve())) + + +def compile_files(): + binary_files = [] + + for file in get_test_pas_files(): + print("Info: compile ", file) + if not (Path("open_set") / file.stem).exists(): + os.system("fpc " + str(file)) + os.system("./pacss -i " + str(file)) + c_file = "./open_set/" + file.stem + ".c" + c_binary = "open_set/" + file.stem + ".out" + os.system("gcc " + c_file + " -o " + c_binary) + + pascal_binary = "./open_set/" + file.stem + input_file = Path("open_set") / (file.stem + ".in") + if input_file.exists(): + pascal_binary = "cat " + str(input_file) + " | " + pascal_binary + c_binary = "cat " + str(input_file) + " | " + c_binary + + binary_files.append((file.stem, pascal_binary, c_binary)) + + return binary_files + + +def run_binary(): + binary_files = compile_files() + for pair in binary_files: + print("Info: run " + pair[0]) + + pascal_result = "open_set/" + pair[0] + ".pas_result" + c_result = "open_set/" + pair[0] + ".c_result" + + os.system(pair[1] + " > " + pascal_result) + os.system(pair[2] + " > " + c_result) + + +def check_result(): + tests = [] + for file in Path("open_set").iterdir(): + if file.suffix != ".pas_result": + continue + tests.append(file.stem) + tests = sorted(tests) + + pass_result = 0 + for test in tests: + print("------Test " + test + "------") + pascal_result = "open_set/" + test + ".pas_result" + c_result = "open_set/" + test + ".c_result" + + with open(pascal_result) as pascal: + with open(c_result) as c: + pascal_result = pascal.readlines() + c_result = c.readlines() + + flag = True + if len(pascal_result) != len(c_result): + flag = False + + for j in range(0, len(pascal_result)): + if not flag: + break + + flag = c_result[j] == pascal_result[j] + + if flag: + print("test " + test + " passed!") + pass_result += 1 + else: + print("test " + test + " failed!") + print("Pascal: ", pascal_result) + print("C: ", c_result) + + print(str(pass_result) + "/" + str(len(tests)) + " tests passed!") + + +if __name__ == "__main__": + if sys.argv[1] == "run": + delete_generated_files() + run_binary() + elif sys.argv[1] == "test": + check_result()