constant: value_print: <%= value.sub(/\b10\^/, '1e').sub(/\b2\^/, '1<<').gsub(',', "'") %> max: const int <%= name.upcase %>_MAX = <%= value_print %>; mod: const int MOD = <%= value_print %>; declaration: type: __key: [item] number: int decimal: double string: string char: string delim_block: | <% unless delim.empty? -%> char delim; <% end -%> horizontal_type: | <% case container when :single if vars.map(&:item).uniq.size == 1 %>multi<% else %>single<% end when :harray if item == :char %>single<% else %>array<% end when :varray %>array<% else # :matrix, :vmatrix, :hmatrix if item == :char %>array<% elsif root_container == :varray_matrix %>jagged_array<% else %>matrix<% end end -%> vertical_type: | <% if components %>combi<% else case container when :single if vars.map(&:item).uniq.size == 1 %>single<% else %>multi<% end when :harray %>single<% else # :varray. :matrix, :vmatrix, :hmatrix %>multi<% end end -%> decl_line: __key: [horizontal_type] single: <%= type %> <%= v %>; multi: <%= type %> <%= vs.join(', ') %>; array: vector<<%= type %>> <%= v %>; jagged_array: vector>> <%= v %>; matrix: vector>> <%= v %>; decl_block: __key: [vertical_type] single: <%= decl_line %> multi: | <% vars.each do |var| -%> <%= var.decl_line %> <% end -%> combi: <% components.each do |cmp| %><%= cmp.decl_block %><% end %> decl: <%= decl_block %><%= delim_block %> alloc_line: __key: [horizontal_type] single: '' multi: '' array: <%= v %> = vector<<%= type %>>(<%= sz %>); jagged_array: <%= v %> = vector>>(<%= sz1 %>); matrix: <%= v %> = vector>>(<%= sz1 %>, vector<<%= type %>>(<%= sz2 %>)); alloc: __key: [vertical_type] single: <%= alloc_line %> multi: | <% vars.each do |var| -%> <%= var.alloc_line %> <% end -%> combi: <% components.each do |cmp| %><%= cmp.alloc %><% end %> decl_alloc_line: __key: [horizontal_type] single: <%= type %> <%= v %>; multi: <%= type %> <%= vs.join(', ') %>; array: vector<<%= type %>> <%= v %>(<%= sz %>); jagged_array: vector>> <%= v %>(<%= sz1 %>); matrix: vector>> <%= v %>(<%= sz1 %>, vector<<%= type %>>(<%= sz2 %>)); decl_alloc_block: __key: [vertical_type] single: <%= decl_alloc_line %> multi: | <% vars.each do |var| -%> <%= var.decl_alloc_line %> <% end -%> combi: <% components.each do |cmp| %><%= cmp.decl_alloc_block %><% end %> decl_alloc: <%= decl_alloc_block %><%= delim_block %> input: dim_type: '<%= size.size - (item == :char ? 1 : 0) %>_dim' item_address: __key: [dim_type] 0_dim: <%= v %> 1_dim: <%= v %>[i] 2_dim: <%= v %>[i][j] sep: <% if delim.empty? %> >> <% else %> >> delim >> <% end %> line_address: <%= vars.map { |var| var.item_address }.join(sep) %> input_type: <% if components %><%= container.to_s %><% else %>plain<% end %> sz2_body: <%= sz2.split('_')[0] %> main: __key: [input_type, dim_type] plain: 0_dim: cin >> <%= line_address %>; 1_dim: REP(i, <%= sz1 %>) cin >> <%= line_address %>; 2_dim: REP(i, <%= sz1 %>) REP(j, <%= sz2 %>) cin >> <%= line_address %>; varray_matrix: 1_dim: | REP(i, <%= sz1 %>) { cin >> <%= components[0].line_address %>; cin >> <%= components[1].line_address %>; } 2_dim: | REP(i, <%= sz1 %>) { cin >> <%= components[0].line_address %>; <%= vs[-1] %>[i].resize(<%= sz2_body %>[i]); REP(j, <%= sz2_body %>[i]) cin >> <%= components[1].line_address %>; } matrix_varray: 1_dim: | REP(i, <%= sz1 %>) { cin >> <%= components[0].line_address %>; cin >> <%= components[1].line_address %>; } 2_dim: | REP(i, <%= sz1 %>) { REP(j, <%= sz2_body %>) cin >> <%= components[0].line_address %>; cin >> <%= components[1].line_address %>; }