at_coder_friends 0.6.8 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +1 -0
  3. data/.github/workflows/codeql-analysis.yml +70 -0
  4. data/.github/workflows/ruby.yml +38 -0
  5. data/.gitignore +3 -0
  6. data/.rubocop.yml +8 -1
  7. data/CHANGELOG.md +23 -4
  8. data/Gemfile.lock +43 -43
  9. data/README.md +15 -92
  10. data/at_coder_friends.gemspec +4 -3
  11. data/lib/at_coder_friends/cli.rb +13 -28
  12. data/lib/at_coder_friends/config_loader.rb +2 -4
  13. data/lib/at_coder_friends/generator/any_builtin.rb +22 -0
  14. data/lib/at_coder_friends/generator/base.rb +55 -6
  15. data/lib/at_coder_friends/generator/c_builtin.rb +22 -0
  16. data/lib/at_coder_friends/generator/cxx_builtin.rb +9 -241
  17. data/lib/at_coder_friends/generator/fragment.rb +106 -0
  18. data/lib/at_coder_friends/generator/main.rb +20 -14
  19. data/lib/at_coder_friends/generator/ruby_builtin.rb +13 -166
  20. data/lib/at_coder_friends/parser/binary.rb +12 -5
  21. data/lib/at_coder_friends/parser/constraints.rb +8 -8
  22. data/lib/at_coder_friends/parser/input_format.rb +19 -15
  23. data/lib/at_coder_friends/parser/modulo.rb +5 -7
  24. data/lib/at_coder_friends/parser/section_wrapper.rb +3 -5
  25. data/lib/at_coder_friends/parser/sections.rb +2 -2
  26. data/lib/at_coder_friends/path_util.rb +1 -1
  27. data/lib/at_coder_friends/problem.rb +5 -5
  28. data/lib/at_coder_friends/scraping/agent.rb +1 -1
  29. data/lib/at_coder_friends/scraping/authentication.rb +3 -3
  30. data/lib/at_coder_friends/scraping/session.rb +1 -1
  31. data/lib/at_coder_friends/scraping/tasks.rb +6 -8
  32. data/lib/at_coder_friends/test_runner/base.rb +1 -2
  33. data/lib/at_coder_friends/test_runner/judge.rb +3 -3
  34. data/lib/at_coder_friends/version.rb +1 -1
  35. data/lib/at_coder_friends.rb +3 -0
  36. data/templates/any_builtin.md.erb +30 -0
  37. data/templates/any_builtin_fragments.yml +5 -0
  38. data/templates/c_builtin.c.erb +36 -0
  39. data/templates/c_builtin_fragments.yml +127 -0
  40. data/templates/csharp_sample.cs.erb +29 -0
  41. data/templates/csharp_sample_fragments.yml +159 -0
  42. data/templates/java_sample.java.erb +25 -0
  43. data/templates/java_sample_fragments.yml +98 -0
  44. data/templates/ruby_builtin_fragments.yml +93 -0
  45. metadata +26 -6
  46. data/.travis.yml +0 -16
  47. data/docs/CONFIGURATION.md +0 -421
@@ -0,0 +1,36 @@
1
+ // <%= pbm.url %>
2
+
3
+ #include <stdio.h>
4
+
5
+ #define REP(i,n) for(int i=0; i<(int)(n); i++)
6
+ #define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
7
+
8
+ <% gen_consts.each do |line| -%>
9
+ <%= line %>
10
+ <% end -%>
11
+
12
+ <% gen_decls.each do |line| -%>
13
+ <%= line %>
14
+ <% end -%>
15
+
16
+ void solve() {
17
+ <% if (vs = pbm.options.binary_values) -%>
18
+ int cond = 0;
19
+ puts(cond ? "<%= vs[0] %>" : "<%= vs[1] %>");
20
+ <% else -%>
21
+ int ans = 0;
22
+ printf("%d\n", ans);
23
+ <% end -%>
24
+ }
25
+
26
+ void input() {
27
+ <% gen_inputs.each do |line| -%>
28
+ <%= line %>
29
+ <% end -%>
30
+ }
31
+
32
+ int main() {
33
+ input();
34
+ solve();
35
+ return 0;
36
+ }
@@ -0,0 +1,127 @@
1
+ constant:
2
+ value_print: <%= value.sub(/\b10\^/, '(int)1e').sub(/\b2\^/, '1<<').gsub(',', '') %>
3
+ max: '#define <%= name.upcase %>_MAX <%= value_print %>'
4
+ mod: '#define MOD <%= value_print %>'
5
+ cxx_constant:
6
+ value_print: <%= value.sub(/\b10\^/, '1e').sub(/\b2\^/, '1<<').gsub(',', "'") %>
7
+ max: const int <%= name.upcase %>_MAX = <%= value_print %>;
8
+ mod: const int MOD = <%= value_print %>;
9
+ declaration:
10
+ type:
11
+ __key: [item]
12
+ number: int
13
+ decimal: double
14
+ string: char
15
+ char: char
16
+ horizontal_type: |
17
+ <%
18
+ case container
19
+ when :single
20
+ items = vars.map(&:item)
21
+ if items.uniq.size == 1 && items[0] != :string
22
+ %>multi<%
23
+ else
24
+ %>single<%
25
+ end
26
+ when :harray, :varray
27
+ %>array<%
28
+ else # :matrix, :vmatrix, :hmatrix
29
+ %>matrix<%
30
+ end
31
+ -%>
32
+ arr_sz1: <%= sz1.gsub(/([a-z][a-z0-9_]*)/i, '\1_MAX').upcase%>
33
+ arr_sz2: <%= sz2.gsub(/([a-z][a-z0-9_]*)/i, '\1_MAX').upcase%>
34
+ arr_sz: <%= arr_sz1 %>
35
+ null_alloc: <% if item == :char %> + 1<% end %>
36
+ string_alloc: <% if item == :string %>[<%= v.upcase %>_MAX + 1]<% end %>
37
+ line:
38
+ __key: [horizontal_type]
39
+ single: <%= type %> <%= v %><%= string_alloc %>;
40
+ multi: <%= type(vars[0].item) %> <%= vs.join(', ') %>;
41
+ array: <%= type %> <%= v %>[<%= arr_sz %><%= null_alloc %>]<%= string_alloc %>;
42
+ matrix: <%= type %> <%= v %>[<%= arr_sz1 %>][<%= arr_sz2 %><%= null_alloc %>]<%= string_alloc %>;
43
+ vertical_type: |
44
+ <%
45
+ if components
46
+ %>combi<%
47
+ else
48
+ case container
49
+ when :single
50
+ items = vars.map(&:item)
51
+ if items.uniq.size == 1 && items[0] != :string
52
+ %>single<%
53
+ else
54
+ %>multi<%
55
+ end
56
+ when :harray
57
+ %>single<%
58
+ else # :varray. :matrix, :vmatrix, :hmatrix
59
+ %>multi<%
60
+ end
61
+ end
62
+ -%>
63
+ main:
64
+ __key: [vertical_type]
65
+ single: <%= line %>
66
+ multi: |
67
+ <% vars.each do |var| -%>
68
+ <%= var.line %>
69
+ <% end -%>
70
+ combi: <% components.each do |cmp| %><%= cmp.main %><% end %>
71
+ input:
72
+ item_format:
73
+ __key: [item]
74
+ number: '%d'
75
+ decimal: '%lf'
76
+ string: '%s'
77
+ char: '%s'
78
+ line_format: <%= vars.map { |var| var.item_format }.join %>
79
+ address_type: <%= ['single', 'array', 'matrix'][size.size] %>
80
+ item_address:
81
+ __key: [address_type, item]
82
+ single:
83
+ number: '&<%= v %>'
84
+ decimal: '&<%= v %>'
85
+ string: <%= v %>
86
+ array:
87
+ number: <%= v %> + i
88
+ decimal: <%= v %> + i
89
+ string: <%= v %>[i]
90
+ char: <%= v %>
91
+ matrix:
92
+ number: '&<%= v %>[i][j]'
93
+ decimal: '&<%= v %>[i][j]'
94
+ string: <%= v %>[i][j]
95
+ char: <%= v %>[i]
96
+ line_address: <%= vars.map { |var| var.item_address }.join(', ') %>
97
+ input_type: <% if components %><%= container.to_s %><% else %>plain<% end %>
98
+ dim_type: '<%= size.size - (item == :char ? 1 : 0) %>_dim'
99
+ sz2_body: <%= sz2.split('_')[0] %>
100
+ main:
101
+ __key: [input_type, dim_type]
102
+ plain:
103
+ 0_dim: scanf("<%= line_format %>", <%= line_address %>);
104
+ 1_dim: REP(i, <%= sz1 %>) scanf("<%= line_format %>", <%= line_address %>);
105
+ 2_dim: REP(i, <%= sz1 %>) REP(j, <%= sz2 %>) scanf("<%= line_format %>", <%= line_address %>);
106
+ varray_matrix:
107
+ 1_dim: |
108
+ REP(i, <%= sz1 %>) {
109
+ scanf("<%= components[0].line_format %>", <%= components[0].line_address %>);
110
+ scanf("<%= components[1].line_format %>", <%= components[1].line_address %>);
111
+ }
112
+ 2_dim: |
113
+ REP(i, <%= sz1 %>) {
114
+ scanf("<%= components[0].line_format %>", <%= components[0].line_address %>);
115
+ REP(j, <%= sz2_body %>[i]) scanf("<%= components[1].line_format %>", <%= components[1].line_address %>);
116
+ }
117
+ matrix_varray:
118
+ 1_dim: |
119
+ REP(i, <%= sz1 %>) {
120
+ scanf("<%= components[0].line_format %>", <%= components[0].line_address %>);
121
+ scanf("<%= components[1].line_format %>", <%= components[1].line_address %>);
122
+ }
123
+ 2_dim: |
124
+ REP(i, <%= sz1 %>) {
125
+ REP(j, <%= sz2_body %>) scanf("<%= components[0].line_format %>", <%= components[0].line_address %>);
126
+ scanf("<%= components[1].line_format %>", <%= components[1].line_address %>);
127
+ }
@@ -0,0 +1,29 @@
1
+ // <%= pbm.url %>
2
+
3
+ using System;
4
+ using System.Collections;
5
+ using System.Collections.Generic;
6
+ using System.Linq;
7
+ using System.Text;
8
+
9
+ class Program
10
+ {
11
+ static void Main(string[] args)
12
+ {
13
+ <% gen_consts.each do |line| -%>
14
+ <%= line %>
15
+ <% end -%>
16
+
17
+ <% gen_decls.each do |line| -%>
18
+ <%= line %>
19
+ <% end -%>
20
+
21
+ <% if (vs = pbm.options.binary_values) -%>
22
+ bool cond = false;
23
+ Console.WriteLine(cond ? "<%= vs[0] %>" : "<%= vs[1] %>");
24
+ <% else -%>
25
+ int ans = 0;
26
+ Console.WriteLine(ans);
27
+ <% end -%>
28
+ }
29
+ }
@@ -0,0 +1,159 @@
1
+ constant:
2
+ value_print: <%= value.sub(/\b10\^/, '(int)1e').sub(/\b2\^/, '1<<').gsub(',', '_') %>
3
+ max: const int <%= name.upcase %>_MAX = <%= value_print %>;
4
+ mod: const int MOD = <%= value_print %>;
5
+ declaration:
6
+ read: Console.ReadLine()<% delims.each do |d| %>.Replace('<%= d %>', ' ')<% end %>
7
+ multiplicity: |
8
+ <%
9
+ case container
10
+ when :single, :varray
11
+ if vs.size > 1 && item != :char
12
+ %>multi<%
13
+ else
14
+ %>single<%
15
+ end
16
+ when :harray, :matrix
17
+ if item != :char
18
+ %>multi<%
19
+ else
20
+ %>single<%
21
+ end
22
+ else
23
+ %>multi<%
24
+ end
25
+ -%>
26
+ input:
27
+ __key: [item, multiplicity]
28
+ number:
29
+ single: int.Parse(<%= read %>)
30
+ multi: <%= read %>.Split().Select(int.Parse).ToArray()
31
+ decimal:
32
+ single: double.Parse(<%= read %>)
33
+ multi: <%= read %>.Split().Select(double.Parse).ToArray()
34
+ string:
35
+ single: <%= read %>
36
+ multi: <%= read %>.Split()
37
+ char:
38
+ single: <%= read %>
39
+ multi: <%= read %>.Split()
40
+ decl_type: |
41
+ <%
42
+ case container
43
+ when :single
44
+ if vs.size > 1 %>single_n<% else %>single_1<% end
45
+ when :varray
46
+ if vs.size > 1 %>varray_n<% else %>varray_1<% end
47
+ when :varray_matrix
48
+ if item == :char %>varray_matrix_1<% else %>varray_matrix_2<% end
49
+ else
50
+ %><%= container.to_s %><%
51
+ end
52
+ -%>
53
+ type_name:
54
+ __key: [item]
55
+ number: int
56
+ decimal: double
57
+ string: string
58
+ char: string
59
+ dim_type: '<%= size.size - (item == :char ? 1 : 0) %>_dim'
60
+ type_dim:
61
+ __key: [dim_type]
62
+ 0_dim: ''
63
+ 1_dim: '[]'
64
+ 2_dim: '[][]'
65
+ type: <%= type_name %><%= type_dim %>
66
+ line_buf: <%= vs.join() %>
67
+ arr_cnt: <%= vs.size - 1 %>
68
+ main:
69
+ __key: [decl_type]
70
+ single_1: <%= type %> <%= v %> = <%= input %>;
71
+ single_n: |
72
+ <%= type_name %>[] <%= line_buf %> = <%= input %>;
73
+ <% vs.each.with_index do |v, k| -%>
74
+ <%= type %> <%= v %> = <%= line_buf %>[<%= k %>];
75
+ <% end -%>
76
+ harray: <%= type %> <%= v %> = <%= input %>;
77
+ varray_1: <%= type %> <%= v %> = Enumerable.Range(0, <%= sz %>).Select(_ => <%= input %>).ToArray();
78
+ varray_n: |
79
+ <% vs.each do |v| -%>
80
+ <%= type %> <%= v %> = new <%= type_name %>[<%= sz %>];
81
+ <% end -%>
82
+ for (int i = 0; i < <%= sz %>; i++)
83
+ {
84
+ <%= type_name %>[] <%= line_buf %> = <%= input %>;
85
+ <% vs.each.with_index do |v, k| -%>
86
+ <%= v %>[i] = <%= line_buf %>[<%= k %>];
87
+ <% end -%>
88
+ }
89
+ matrix: |
90
+ <%= type %> <%= v %> = Enumerable.Range(0, <%= sz %>).Select(_ =>
91
+ <%= input %>
92
+ ).ToArray();
93
+ varray_matrix_1: |
94
+ <% vs[0..-2].each do |v| -%>
95
+ <%= type_name %>[] <%= v %> = new <%= type_name %>[<%= sz %>];
96
+ <% end -%>
97
+ <%= type_name %>[] <%= vs[-1] %> = new <%= type_name %>[<%= sz %>];
98
+ for (int i = 0; i < <%= sz %>; i++)
99
+ {
100
+ <%= type_name %>[] <%= line_buf %> = <%= input %>;
101
+ <% vs[0..-2].each.with_index do |v, k| -%>
102
+ <%= v %>[i] = <%= line_buf %>[<%= k %>];
103
+ <% end -%>
104
+ <%= vs[-1] %>[i] = <%= line_buf %>.Last();
105
+ }
106
+ varray_matrix_2: |
107
+ <% vs[0..-2].each do |v| -%>
108
+ <%= type_name %>[] <%= v %> = new <%= type_name %>[<%= sz %>];
109
+ <% end -%>
110
+ <%= type_name %>[][] <%= vs[-1] %> = new <%= type_name %>[<%= sz %>][];
111
+ for (int i = 0; i < <%= sz %>; i++)
112
+ {
113
+ <%= type_name %>[] <%= line_buf %> = <%= input %>;
114
+ <% vs[0..-2].each.with_index do |v, k| -%>
115
+ <%= v %>[i] = <%= line_buf %>[<%= k %>];
116
+ <% end -%>
117
+ <%= vs[-1] %>[i] = <%= line_buf %>.Skip(<%= arr_cnt %>).ToArray();
118
+ }
119
+ matrix_varray: |
120
+ <%= type_name %>[][] <%= vs[0] %> = new <%= type_name %>[<%= sz %>][];
121
+ <% vs[1..].each do |v| -%>
122
+ <%= type_name %>[] <%= v %> = new <%= type_name %>[<%= sz %>];
123
+ <% end -%>
124
+ for (int i = 0; i < <%= sz %>; i++)
125
+ {
126
+ <%= type_name %>[] <%= line_buf %> = <%= input %>;
127
+ <%= vs[0] %>[i] = <%= line_buf %>.Take(<%= line_buf %>.Count - <%= arr_cnt %>).ToArray();
128
+ <% vs[1..].each.with_index do |v, k| -%>
129
+ <%= v %>[i] = <%= line_buf %>[<%= line_buf %>.Count - <%= arr_cnt.to_i - k %>];
130
+ <% end -%>
131
+ }
132
+ vmatrix: |
133
+ <% vs.each do |v| -%>
134
+ <%= type %> <%= v %> = new <%= type_name %>[<%= sz1 %>][<%= sz2 %>];
135
+ <% end -%>
136
+ for (int i = 0; i < <%= sz1 %>; i++)
137
+ {
138
+ for (int j = 0; j < <%= sz2 %>; j++)
139
+ {
140
+ <%= type_name %>[] <%= line_buf %> = <%= input %>;
141
+ <% vs.each.with_index do |v, k| -%>
142
+ <%= v %>[i][j] = <%= line_buf %>[<%= k %>];
143
+ <% end -%>
144
+ }
145
+ }
146
+ hmatrix: |
147
+ <% vs.each do |v| -%>
148
+ <%= type %> <%= v %> = new <%= type_name %>[<%= sz1 %>][<%= sz2 %>];
149
+ <% end -%>
150
+ for (int i = 0; i < <%= sz1 %>; i++)
151
+ {
152
+ <%= type_name %>[] <%= line_buf %> = <%= input %>;
153
+ for (int j = 0; j < <%= sz2 %>; j++)
154
+ {
155
+ <% vs.each.with_index do |v, k| -%>
156
+ <%= v %>[i][j] = <%= line_buf %>[j * <%= vs.size %> + <%= k %>];
157
+ <% end -%>
158
+ }
159
+ }
@@ -0,0 +1,25 @@
1
+ // <%= pbm.url %>
2
+
3
+ import java.util.*;
4
+
5
+ public class Main {
6
+
7
+ <% gen_consts.each do |line| -%>
8
+ <%= line %>
9
+ <% end -%>
10
+
11
+ public static void main(String[] args) {
12
+ Scanner sc = new Scanner(System.in);
13
+ <% gen_decls.each do |line| -%>
14
+ <%= line %>
15
+ <% end -%>
16
+
17
+ <% if (vs = pbm.options.binary_values) -%>
18
+ boolean cond = false;
19
+ System.out.println(cond ? "<%= vs[0] %>" : "<%= vs[1] %>");
20
+ <% else -%>
21
+ int ans = 0;
22
+ System.out.println(ans);
23
+ <% end -%>
24
+ }
25
+ }
@@ -0,0 +1,98 @@
1
+ constant:
2
+ value_print: <%= value.sub(/\b10\^/, '(int)1e').sub(/\b2\^/, '1<<').gsub(',', '_') %>
3
+ max: 'public static final int <%= name.upcase %>_MAX = <%= value_print %>;'
4
+ mod: 'public static final int MOD = <%= value_print %>;'
5
+ declaration:
6
+ type_name:
7
+ __key: [item]
8
+ number: int
9
+ decimal: double
10
+ string: String
11
+ char: char
12
+ type_dim: <% if item == :char %>[]<% else %><% end %>
13
+ type: <%= type_name %><%= type_dim %>
14
+ read:
15
+ __key: [item]
16
+ number: sc.nextInt()
17
+ decimal: sc.nextDouble()
18
+ string: sc.next()
19
+ char: sc.next().toCharArray()
20
+ dim_type: '<%= size.size - (item == :char ? 1 : 0) %>_dim'
21
+ decl_line:
22
+ __key: [dim_type]
23
+ 0_dim: <%= type %> <%= v %> = <%= read %>;
24
+ 1_dim: <%= type %>[] <%= v %> = new <%= type_name %>[<%= sz %>]<%= type_dim %>;
25
+ 2_dim: <%= type %>[][] <%= v %> = new <%= type %>[<%= sz1 %>][<%= sz2 %>];
26
+ jagged_array_decl: <%= type_name %>[][] <%= v %> = new <%= type_name %>[<%= sz1 %>][];
27
+ input_line:
28
+ __key: [dim_type]
29
+ 1_dim: <%= v %>[i] = <%= read %>;
30
+ 2_dim: <%= v %>[i][j] = <%= read %>;
31
+ decl_type: <% if components %><%= container.to_s %><% else %>plain<% end %>
32
+ decl_block:
33
+ __key: [decl_type]
34
+ plain: |
35
+ <% vars.each do |var| -%>
36
+ <%= var.decl_line %>
37
+ <% end -%>
38
+ varray_matrix: |
39
+ <%= components[0].decl_block -%>
40
+ <%= components[1].jagged_array_decl %>
41
+ matrix_varray: <% components.each do |cmp| %><%= cmp.decl_block %><% end %>
42
+ input_type: <% if components %><%= container.to_s %><% else %>plain<% end %>
43
+ input_block:
44
+ __key: [input_type, dim_type]
45
+ plain:
46
+ 0_dim: ''
47
+ 1_dim: |
48
+ for (int i = 0; i < <%= sz %>; i++) {
49
+ <% vars.each do |var| -%>
50
+ <%= var.input_line %>
51
+ <% end -%>
52
+ }
53
+ 2_dim: |
54
+ for (int i = 0; i < <%= sz1 %>; i++) {
55
+ for (int j = 0; j < <%= sz2 %>; j++) {
56
+ <% vars.each do |var| -%>
57
+ <%= var.input_line %>
58
+ <% end -%>
59
+ }
60
+ }
61
+ varray_matrix:
62
+ 1_dim: |
63
+ for (int i = 0; i < <%= sz %>; i++) {
64
+ <% components[0].vars.each do |var| -%>
65
+ <%= var.input_line %>
66
+ <% end -%>
67
+ <%= components[1].input_line %>
68
+ }
69
+ 2_dim: |
70
+ for (int i = 0; i < <%= sz1 %>; i++) {
71
+ <% components[0].vars.each do |var| -%>
72
+ <%= var.input_line %>
73
+ <% end -%>
74
+ <% components[1].tap do |cmp| -%>
75
+ <%= cmp.v %>[i] = new <%= cmp.type %>[<%= v %>[i]];
76
+ <% end -%>
77
+ for (int j = 0; j < <%= v %>[i]; j++) {
78
+ <%= components[1].input_line %>
79
+ }
80
+ }
81
+ matrix_varray:
82
+ 1_dim: |
83
+ for (int i = 0; i < <%= sz %>; i++) {
84
+ <%= components[0].input_line %>
85
+ <% components[1].vars.each do |var| -%>
86
+ <%= var.input_line %>
87
+ <% end -%>
88
+ }
89
+ 2_dim: |
90
+ for (int i = 0; i < <%= sz1 %>; i++) {
91
+ for (int j = 0; j < <%= sz2 %>; j++) {
92
+ <%= components[0].input_line %>
93
+ }
94
+ <% components[1].vars.each do |var| -%>
95
+ <%= var.input_line %>
96
+ <% end -%>
97
+ }
98
+ main: <%= decl_block %><%= input_block %>
@@ -0,0 +1,93 @@
1
+ constant:
2
+ value_print: <%= value.gsub('^', '**').gsub(',', '_') %>
3
+ mod: MOD = <%= value_print %>
4
+ declaration:
5
+ read: gets<% delims.each do |d| %>.gsub('<%= d %>', ' ')<% end %>
6
+ multiplicity: |
7
+ <%
8
+ case container
9
+ when :single, :varray
10
+ if vs.size > 1 && item != :char
11
+ %>multi<%
12
+ else
13
+ %>single<%
14
+ end
15
+ when :harray, :matrix
16
+ if item != :char
17
+ %>multi<%
18
+ else
19
+ %>single<%
20
+ end
21
+ else
22
+ %>multi<%
23
+ end
24
+ -%>
25
+ input:
26
+ __key: [item, multiplicity]
27
+ number:
28
+ single: <%= read %>.to_i
29
+ multi: <%= read %>.split.map(&:to_i)
30
+ decimal:
31
+ single: <%= read %>.to_f
32
+ multi: <%= read %>.split.map(&:to_f)
33
+ string:
34
+ single: <%= read %>.chomp
35
+ multi: <%= read %>.chomp.split
36
+ char:
37
+ single: <%= read %>.chomp
38
+ multi: <%= read %>.chomp.split
39
+ decl_type: |
40
+ <%
41
+ case container
42
+ when :varray
43
+ if vs.size > 1 %>varray_n<% else %>varray_1<% end
44
+ else
45
+ %><%= container.to_s %><%
46
+ end
47
+ -%>
48
+ splat: <% unless item == :char %>*<% end %>
49
+ main:
50
+ __key: [decl_type]
51
+ single: <%= vs.join(', ') %> = <%= input %>
52
+ harray: <%= v %>s = <%= input %>
53
+ varray_1: <%= v %>s = Array.new(<%= sz %>) { <%= input %> }
54
+ varray_n: |
55
+ <% vs.each do |v| -%>
56
+ <%= v %>s = Array.new(<%= sz %>)
57
+ <% end -%>
58
+ <%= sz %>.times do |i|
59
+ <%= vs.map { |v| "#{v}s[i]" }.join(', ') %> = <%= input %>
60
+ end
61
+ matrix: <%= v %>ss = Array.new(<%= sz %>) { <%= input %> }
62
+ varray_matrix: |
63
+ <% vs[0..-2].each do |v| -%>
64
+ <%= v %>s = Array.new(<%= sz %>)
65
+ <% end -%>
66
+ <%= vs[-1] %>ss = Array.new(<%= sz %>)
67
+ <%= sz %>.times do |i|
68
+ <%= vs[0..-2].map { |v| "#{v}s[i]" }.join(', ') %>, <%= splat %><%= vs[-1] %>ss[i] = <%= input %>
69
+ end
70
+ matrix_varray: |
71
+ <%= vs[0] %>ss = Array.new(<%= sz %>)
72
+ <% vs[1..].each do |v| -%>
73
+ <%= v %>s = Array.new(<%= sz %>)
74
+ <% end -%>
75
+ <%= sz %>.times do |i|
76
+ <%= splat %><%= vs[0] %>ss[i], <%= vs[1..].map { |v| "#{v}s[i]" }.join(', ') %> = <%= input %>
77
+ end
78
+ vmatrix: |
79
+ <% vs.each do |v| -%>
80
+ <%= v %>ss = Array.new(<%= sz1 %>) { Array.new(<%= sz2 %>) }
81
+ <% end -%>
82
+ <%= sz1 %>.times do |i|
83
+ <%= sz2 %>.times do |j|
84
+ <%= vs.map { |v| "#{v}ss[i][j]" }.join(', ') %> = <%= input %>
85
+ end
86
+ end
87
+ hmatrix: |
88
+ <% vs.each do |v| -%>
89
+ <%= v %>ss = Array.new(<%= sz %>)
90
+ <% end -%>
91
+ <%= sz %>.times do |i|
92
+ <%= vs.map { |v| "#{v}ss[i]" }.join(', ') %> = <%= input %>.each_slice(<%= vs.size %>).to_a.transpose
93
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: at_coder_friends
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nejiko96
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-26 00:00:00.000000000 Z
11
+ date: 2023-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -101,6 +101,9 @@ dependencies:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0.10'
104
+ - - "<"
105
+ - !ruby/object:Gem::Version
106
+ version: '0.18'
104
107
  type: :development
105
108
  prerelease: false
106
109
  version_requirements: !ruby/object:Gem::Requirement
@@ -108,6 +111,9 @@ dependencies:
108
111
  - - "~>"
109
112
  - !ruby/object:Gem::Version
110
113
  version: '0.10'
114
+ - - "<"
115
+ - !ruby/object:Gem::Version
116
+ version: '0.18'
111
117
  - !ruby/object:Gem::Dependency
112
118
  name: webmock
113
119
  requirement: !ruby/object:Gem::Requirement
@@ -135,11 +141,13 @@ executables:
135
141
  extensions: []
136
142
  extra_rdoc_files: []
137
143
  files:
144
+ - ".gitattributes"
145
+ - ".github/workflows/codeql-analysis.yml"
146
+ - ".github/workflows/ruby.yml"
138
147
  - ".gitignore"
139
148
  - ".rspec"
140
149
  - ".rubocop.yml"
141
150
  - ".rubocop_todo.yml"
142
- - ".travis.yml"
143
151
  - CHANGELOG.md
144
152
  - CODE_OF_CONDUCT.md
145
153
  - Gemfile
@@ -151,7 +159,6 @@ files:
151
159
  - bin/console
152
160
  - bin/setup
153
161
  - config/default.yml
154
- - docs/CONFIGURATION.md
155
162
  - exe/at_coder_friends
156
163
  - lib/at_coder_friends.rb
157
164
  - lib/at_coder_friends/cli.rb
@@ -159,8 +166,11 @@ files:
159
166
  - lib/at_coder_friends/context.rb
160
167
  - lib/at_coder_friends/emitter.rb
161
168
  - lib/at_coder_friends/errors.rb
169
+ - lib/at_coder_friends/generator/any_builtin.rb
162
170
  - lib/at_coder_friends/generator/base.rb
171
+ - lib/at_coder_friends/generator/c_builtin.rb
163
172
  - lib/at_coder_friends/generator/cxx_builtin.rb
173
+ - lib/at_coder_friends/generator/fragment.rb
164
174
  - lib/at_coder_friends/generator/main.rb
165
175
  - lib/at_coder_friends/generator/ruby_builtin.rb
166
176
  - lib/at_coder_friends/parser/binary.rb
@@ -188,8 +198,17 @@ files:
188
198
  - lib/at_coder_friends/test_runner/sample.rb
189
199
  - lib/at_coder_friends/verifier.rb
190
200
  - lib/at_coder_friends/version.rb
201
+ - templates/any_builtin.md.erb
202
+ - templates/any_builtin_fragments.yml
203
+ - templates/c_builtin.c.erb
204
+ - templates/c_builtin_fragments.yml
205
+ - templates/csharp_sample.cs.erb
206
+ - templates/csharp_sample_fragments.yml
191
207
  - templates/cxx_builtin.cxx.erb
208
+ - templates/java_sample.java.erb
209
+ - templates/java_sample_fragments.yml
192
210
  - templates/ruby_builtin.rb.erb
211
+ - templates/ruby_builtin_fragments.yml
193
212
  homepage: https://github.com/nejiko96/at_coder_friends
194
213
  licenses:
195
214
  - MIT
@@ -197,6 +216,7 @@ metadata:
197
216
  homepage_uri: https://github.com/nejiko96/at_coder_friends
198
217
  source_code_uri: https://github.com/nejiko96/at_coder_friends
199
218
  changelog_uri: https://github.com/nejiko96/at_coder_friends/blob/master/CHANGELOG.md
219
+ rubygems_mfa_required: 'true'
200
220
  post_install_message:
201
221
  rdoc_options: []
202
222
  require_paths:
@@ -205,14 +225,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
225
  requirements:
206
226
  - - ">="
207
227
  - !ruby/object:Gem::Version
208
- version: 2.5.0
228
+ version: 2.7.0
209
229
  required_rubygems_version: !ruby/object:Gem::Requirement
210
230
  requirements:
211
231
  - - ">="
212
232
  - !ruby/object:Gem::Version
213
233
  version: '0'
214
234
  requirements: []
215
- rubygems_version: 3.2.18
235
+ rubygems_version: 3.4.12
216
236
  signing_key:
217
237
  specification_version: 4
218
238
  summary: AtCoder support tool