create-stylus-ide 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/Readme.MD +1515 -0
  2. package/cli.js +28 -0
  3. package/frontend/.vscode/settings.json +9 -0
  4. package/frontend/app/api/chat/route.ts +101 -0
  5. package/frontend/app/api/check-setup/route.ts +93 -0
  6. package/frontend/app/api/cleanup/route.ts +14 -0
  7. package/frontend/app/api/compile/route.ts +95 -0
  8. package/frontend/app/api/compile-stream/route.ts +98 -0
  9. package/frontend/app/api/complete/route.ts +86 -0
  10. package/frontend/app/api/deploy/route.ts +118 -0
  11. package/frontend/app/api/export-abi/route.ts +58 -0
  12. package/frontend/app/favicon.ico +0 -0
  13. package/frontend/app/globals.css +177 -0
  14. package/frontend/app/layout.tsx +29 -0
  15. package/frontend/app/ml/page.tsx +694 -0
  16. package/frontend/app/page.tsx +1132 -0
  17. package/frontend/app/providers.tsx +18 -0
  18. package/frontend/app/qlearning/page.tsx +188 -0
  19. package/frontend/app/raytracing/page.tsx +268 -0
  20. package/frontend/components/abi/ABIDialog.tsx +132 -0
  21. package/frontend/components/ai/AICompletionPopup.tsx +76 -0
  22. package/frontend/components/ai/ChatPanel.tsx +292 -0
  23. package/frontend/components/ai/QuickActions.tsx +128 -0
  24. package/frontend/components/blockchain/BlockchainContractBanner.tsx +64 -0
  25. package/frontend/components/blockchain/BlockchainLoadingDialog.tsx +188 -0
  26. package/frontend/components/deploy/DeployDialog.tsx +334 -0
  27. package/frontend/components/editor/FileTabs.tsx +181 -0
  28. package/frontend/components/editor/MonacoEditor.tsx +306 -0
  29. package/frontend/components/file-tree/ContextMenu.tsx +110 -0
  30. package/frontend/components/file-tree/DeleteConfirmDialog.tsx +61 -0
  31. package/frontend/components/file-tree/FileInputDialog.tsx +97 -0
  32. package/frontend/components/file-tree/FileNode.tsx +60 -0
  33. package/frontend/components/file-tree/FileTree.tsx +259 -0
  34. package/frontend/components/file-tree/FileTreeSkeleton.tsx +26 -0
  35. package/frontend/components/file-tree/FolderNode.tsx +105 -0
  36. package/frontend/components/github/GitHubLoadingDialog.tsx +201 -0
  37. package/frontend/components/github/GitHubMetadataBanner.tsx +61 -0
  38. package/frontend/components/github/LoadFromGitHubDialog.tsx +125 -0
  39. package/frontend/components/github/URLCopyButton.tsx +60 -0
  40. package/frontend/components/interact/ContractInteraction.tsx +323 -0
  41. package/frontend/components/interact/ContractPlaceholder.tsx +41 -0
  42. package/frontend/components/orbit/BenchmarkDialog.tsx +342 -0
  43. package/frontend/components/orbit/OrbitExplorer.tsx +273 -0
  44. package/frontend/components/project/ProjectActions.tsx +176 -0
  45. package/frontend/components/q-learning/ContractConfig.tsx +172 -0
  46. package/frontend/components/q-learning/MazeGrid.tsx +346 -0
  47. package/frontend/components/q-learning/PathAnimation.tsx +384 -0
  48. package/frontend/components/q-learning/QTableHeatmap.tsx +300 -0
  49. package/frontend/components/q-learning/TrainingForm.tsx +349 -0
  50. package/frontend/components/ray-tracing/ContractConfig.tsx +245 -0
  51. package/frontend/components/ray-tracing/MintingForm.tsx +280 -0
  52. package/frontend/components/ray-tracing/RenderCanvas.tsx +228 -0
  53. package/frontend/components/ray-tracing/RenderingPanel.tsx +259 -0
  54. package/frontend/components/ray-tracing/StyleControls.tsx +217 -0
  55. package/frontend/components/setup/SetupGuide.tsx +290 -0
  56. package/frontend/components/ui/KeyboardShortcutHint.tsx +74 -0
  57. package/frontend/components/ui/alert-dialog.tsx +157 -0
  58. package/frontend/components/ui/alert.tsx +66 -0
  59. package/frontend/components/ui/badge.tsx +46 -0
  60. package/frontend/components/ui/button.tsx +62 -0
  61. package/frontend/components/ui/card.tsx +92 -0
  62. package/frontend/components/ui/context-menu.tsx +252 -0
  63. package/frontend/components/ui/dialog.tsx +143 -0
  64. package/frontend/components/ui/dropdown-menu.tsx +257 -0
  65. package/frontend/components/ui/input.tsx +21 -0
  66. package/frontend/components/ui/label.tsx +24 -0
  67. package/frontend/components/ui/progress.tsx +31 -0
  68. package/frontend/components/ui/scroll-area.tsx +58 -0
  69. package/frontend/components/ui/select.tsx +190 -0
  70. package/frontend/components/ui/separator.tsx +28 -0
  71. package/frontend/components/ui/sheet.tsx +139 -0
  72. package/frontend/components/ui/skeleton.tsx +13 -0
  73. package/frontend/components/ui/slider.tsx +63 -0
  74. package/frontend/components/ui/sonner.tsx +40 -0
  75. package/frontend/components/ui/tabs.tsx +66 -0
  76. package/frontend/components/ui/textarea.tsx +18 -0
  77. package/frontend/components/wallet/ConnectButton.tsx +167 -0
  78. package/frontend/components/wallet/FaucetButton.tsx +256 -0
  79. package/frontend/components.json +22 -0
  80. package/frontend/eslint.config.mjs +18 -0
  81. package/frontend/hooks/useAICompletion.ts +75 -0
  82. package/frontend/hooks/useBlockchainLoader.ts +58 -0
  83. package/frontend/hooks/useChats.ts +137 -0
  84. package/frontend/hooks/useCompilation.ts +173 -0
  85. package/frontend/hooks/useFileTabs.ts +178 -0
  86. package/frontend/hooks/useGitHubLoader.ts +50 -0
  87. package/frontend/hooks/useKeyboardShortcuts.ts +47 -0
  88. package/frontend/hooks/usePanelState.ts +115 -0
  89. package/frontend/hooks/useProjectState.ts +276 -0
  90. package/frontend/hooks/useResponsive.ts +29 -0
  91. package/frontend/lib/abi-parser.ts +58 -0
  92. package/frontend/lib/blockchain-api.ts +374 -0
  93. package/frontend/lib/blockchain-explorers.ts +75 -0
  94. package/frontend/lib/blockchain-loader.ts +112 -0
  95. package/frontend/lib/cargo-template.ts +64 -0
  96. package/frontend/lib/compilation.ts +529 -0
  97. package/frontend/lib/constants.ts +31 -0
  98. package/frontend/lib/deployment.ts +176 -0
  99. package/frontend/lib/file-utils.ts +83 -0
  100. package/frontend/lib/github-api.ts +246 -0
  101. package/frontend/lib/github-loader.ts +369 -0
  102. package/frontend/lib/ml-contract-template.txt +900 -0
  103. package/frontend/lib/orbit-chains.ts +181 -0
  104. package/frontend/lib/output-formatter.ts +68 -0
  105. package/frontend/lib/project-manager.ts +632 -0
  106. package/frontend/lib/ray-tracing-abi.ts +206 -0
  107. package/frontend/lib/storage.ts +189 -0
  108. package/frontend/lib/templates.ts +1662 -0
  109. package/frontend/lib/url-parser.ts +188 -0
  110. package/frontend/lib/utils.ts +6 -0
  111. package/frontend/lib/wagmi-config.ts +24 -0
  112. package/frontend/next.config.ts +7 -0
  113. package/frontend/package-lock.json +16259 -0
  114. package/frontend/package.json +60 -0
  115. package/frontend/postcss.config.mjs +7 -0
  116. package/frontend/public/file.svg +1 -0
  117. package/frontend/public/globe.svg +1 -0
  118. package/frontend/public/ml-weights/.gitkeep +0 -0
  119. package/frontend/public/ml-weights/model.pkl +0 -0
  120. package/frontend/public/ml-weights/model_weights.json +27102 -0
  121. package/frontend/public/ml-weights/test_samples.json +7888 -0
  122. package/frontend/public/next.svg +1 -0
  123. package/frontend/public/vercel.svg +1 -0
  124. package/frontend/public/window.svg +1 -0
  125. package/frontend/scripts/check-env.js +52 -0
  126. package/frontend/scripts/setup.js +285 -0
  127. package/frontend/tailwind.config.ts +64 -0
  128. package/frontend/tsconfig.json +34 -0
  129. package/frontend/types/blockchain.ts +63 -0
  130. package/frontend/types/github.ts +54 -0
  131. package/frontend/types/project.ts +106 -0
  132. package/ml-training/README.md +56 -0
  133. package/ml-training/train_tiny_model.py +325 -0
  134. package/ml-training/update_template.py +59 -0
  135. package/package.json +30 -0
@@ -0,0 +1,1662 @@
1
+ export interface ContractTemplate {
2
+ id: string;
3
+ name: string;
4
+ description: string;
5
+ code: string;
6
+ }
7
+
8
+ export const templates: ContractTemplate[] = [
9
+ {
10
+ id: "counter",
11
+ name: "Counter",
12
+ description: "Simple counter with increment/decrement",
13
+ code: `// Counter Contract - SDK 0.9.x
14
+ #![cfg_attr(not(feature = "export-abi"), no_main)]
15
+ extern crate alloc;
16
+
17
+ use stylus_sdk::{alloy_primitives::U256, prelude::*};
18
+
19
+ sol_storage! {
20
+ #[entrypoint]
21
+ pub struct Counter {
22
+ uint256 number;
23
+ }
24
+ }
25
+
26
+ #[public]
27
+ impl Counter {
28
+ pub fn number(&self) -> U256 {
29
+ self.number.get()
30
+ }
31
+
32
+ pub fn set_number(&mut self, new_number: U256) {
33
+ self.number.set(new_number);
34
+ }
35
+
36
+ pub fn increment(&mut self) {
37
+ let number = self.number.get();
38
+ self.number.set(number + U256::from(1u8));
39
+ }
40
+
41
+ pub fn decrement(&mut self) {
42
+ let number = self.number.get();
43
+ if number > U256::from(0u8) {
44
+ self.number.set(number - U256::from(1u8));
45
+ }
46
+ }
47
+ }`,
48
+ },
49
+ {
50
+ id: "erc20",
51
+ name: "ERC-20 Basic",
52
+ description: "Basic ERC-20 token implementation",
53
+ code: `// ERC-20 Token - SDK 0.9.x
54
+ #![cfg_attr(not(feature = "export-abi"), no_main)]
55
+ extern crate alloc;
56
+
57
+ use stylus_sdk::{
58
+ alloy_primitives::{Address, U256},
59
+ prelude::*,
60
+ msg,
61
+ };
62
+
63
+ sol_storage! {
64
+ #[entrypoint]
65
+ pub struct Erc20 {
66
+ mapping(address => uint256) balances;
67
+ uint256 total_supply;
68
+ }
69
+ }
70
+
71
+ #[public]
72
+ impl Erc20 {
73
+ pub fn balance_of(&self, account: Address) -> U256 {
74
+ self.balances.get(account)
75
+ }
76
+
77
+ pub fn total_supply(&self) -> U256 {
78
+ self.total_supply.get()
79
+ }
80
+
81
+ pub fn transfer(&mut self, to: Address, amount: U256) -> bool {
82
+ let sender = msg::sender();
83
+ let sender_balance = self.balances.get(sender);
84
+
85
+ if sender_balance < amount {
86
+ return false;
87
+ }
88
+
89
+ self.balances.setter(sender).set(sender_balance - amount);
90
+ let recipient_balance = self.balances.get(to);
91
+ self.balances.setter(to).set(recipient_balance + amount);
92
+
93
+ true
94
+ }
95
+ }`,
96
+ },
97
+ {
98
+ id: "storage",
99
+ name: "Storage Example",
100
+ description: "Demonstrates storage types",
101
+ code: `// Storage Types - SDK 0.9.x
102
+ #![cfg_attr(not(feature = "export-abi"), no_main)]
103
+ extern crate alloc;
104
+
105
+ use stylus_sdk::{
106
+ alloy_primitives::{Address, U256},
107
+ prelude::*,
108
+ };
109
+
110
+ sol_storage! {
111
+ #[entrypoint]
112
+ pub struct StorageExample {
113
+ uint256 number;
114
+ bool flag;
115
+ address owner;
116
+ mapping(address => uint256) balances;
117
+ }
118
+ }
119
+
120
+ #[public]
121
+ impl StorageExample {
122
+ pub fn set_number(&mut self, value: U256) {
123
+ self.number.set(value);
124
+ }
125
+
126
+ pub fn get_number(&self) -> U256 {
127
+ self.number.get()
128
+ }
129
+
130
+ pub fn toggle_flag(&mut self) {
131
+ let current = self.flag.get();
132
+ self.flag.set(!current);
133
+ }
134
+
135
+ pub fn get_flag(&self) -> bool {
136
+ self.flag.get()
137
+ }
138
+
139
+ pub fn set_balance(&mut self, account: Address, amount: U256) {
140
+ self.balances.setter(account).set(amount);
141
+ }
142
+
143
+ pub fn get_balance(&self, account: Address) -> U256 {
144
+ self.balances.get(account)
145
+ }
146
+ }`,
147
+ },
148
+ {
149
+ id: "ml-inference",
150
+ name: "ML Inference (MNIST)",
151
+ description: "On-chain neural network for digit recognition",
152
+ code: `// REAL ML Inference - MNIST (Tiny Model)
153
+ #![cfg_attr(not(feature = "export-abi"), no_main)]
154
+ extern crate alloc;
155
+
156
+ use stylus_sdk::{alloy_primitives::U256, prelude::*, alloy_sol_types::sol};
157
+ use alloc::vec::Vec;
158
+
159
+ const INPUT_SIZE: usize = 784;
160
+ const HIDDEN_SIZE: usize = 10;
161
+ const OUTPUT_SIZE: usize = 10;
162
+ const SCALE: i64 = 10000;
163
+
164
+ // TRAINED WEIGHTS (Fixed-point scaled by 10000)
165
+ // Model accuracy: 92.65%
166
+
167
+ const WEIGHTS_INPUT_HIDDEN: [[i64; 10]; 784] = [
168
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
169
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
170
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
171
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
172
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
173
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
174
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
175
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
176
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
177
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
178
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
179
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
180
+ [-8, 12, -21, 0, -23, 0, 345, 83, -9, 0],
181
+ [77, -29, -31, 0, -39, 0, 909, 214, -75, 5],
182
+ [64, 0, 47, 0, 38, 0, 0, -48, -55, 0],
183
+ [1, 0, 1, 0, 0, 0, 0, -2, 0, 0],
184
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
185
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
186
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
187
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
188
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
189
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
190
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
191
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
192
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
193
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
194
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
195
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
196
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
197
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
198
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
199
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
200
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
201
+ [16, 0, -1, 0, -9, -14, 32, -3, 0, 0],
202
+ [5471, -364, -864, 0, -4197, -5826, 7328, 265, 0, 0],
203
+ [6770, -445, -1417, 0, -5658, -6472, 7264, 416, 39, 0],
204
+ [3760, -15, -110, 0, -2109, -1192, 5794, -471, 1488, 0],
205
+ [2247, -74, -52, 26, -1053, -656, 5299, -207, 531, 98],
206
+ [1924, -57, -137, 53, -1188, -827, 3898, 24, 164, 613],
207
+ [-191, 173, -1022, 91, -869, -1678, 4159, 3234, -193, 303],
208
+ [2351, 27, -3148, 73, -4438, -6291, 8957, 6104, 407, 56],
209
+ [769, -122, -2378, -158, -3027, -4955, 8009, 5786, 35, -686],
210
+ [6122, -1947, -5112, 5362, -7715, -10193, 11936, 1228, 5728, -1228],
211
+ [7779, -890, 8349, 4661, -12044, -1075, 12851, -7594, 12027, -80],
212
+ [8521, -3272, 13845, -460, -9778, 563, 13697, -12895, 10167, 9498],
213
+ [5787, 403, 11952, 0, -11245, 1764, 11654, -9457, 7903, 4596],
214
+ [734, -98, -1191, 0, -657, -1866, 4551, 3420, -434, -1],
215
+ [6693, -880, -2817, -132, -5936, -2204, 8441, 4848, 2593, 0],
216
+ [5525, -183, -1829, -464, -4522, -1988, 7378, 3896, 1202, 0],
217
+ [-110, 66, -164, -119, -114, -172, 395, 499, -72, 0],
218
+ [2907, -574, -63, 0, -1657, -2907, 4958, -221, -43, 1303],
219
+ [3593, -855, -4, 0, -2393, -3712, 4675, -653, 0, 1686],
220
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
221
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
222
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
223
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
224
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
225
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
226
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
227
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
228
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
229
+ [54, -2, -76, -198, -97, -46, 485, 264, -1, 0],
230
+ [4947, -434, -323, 286, -2847, -4958, 6946, 1275, 599, 2661],
231
+ [11407, 1319, 3473, 3302, -10649, -8074, 12103, -4005, 8367, 6337],
232
+ [11055, -8684, 5045, -5220, 1069, -7029, 13289, 1871, -5309, 7324],
233
+ [2475, -6032, 3161, -2191, 2464, -9881, 11505, 4938, -9672, -7806],
234
+ [2246, -9285, 7123, 5180, -2977, -6656, 7369, 4096, -896, -6711],
235
+ [4129, -10204, 10577, 5374, 107, -5184, 2048, 1354, 1990, -1705],
236
+ [3876, -610, 7103, 7849, -1091, -1105, -2992, -1704, 7006, -4622],
237
+ [12968, -3725, 1951, 6855, 1568, -12718, -1582, -3447, 3021, -2792],
238
+ [14148, -14342, 3615, -319, 251, -15642, 10108, -1031, -1031, 1597],
239
+ [7054, -2154, -6565, 6664, -3278, -11053, 3367, 1042, 5222, -2725],
240
+ [3653, -6453, -4012, 2880, 328, -3729, -28, -611, -2186, -3339],
241
+ [-2087, -1181, -382, -187, 4686, -1605, 8435, 5565, -13793, -1075],
242
+ [-2156, 7946, -9738, 6398, -9305, 3344, 8820, 4895, -5907, 4755],
243
+ [9026, 5277, -8177, 676, -7525, -321, 10609, 8918, 2705, -10514],
244
+ [9364, -2245, -3713, 461, -509, -2051, 2691, 3037, 540, -8499],
245
+ [3095, -18682, 5287, -2414, 6421, -6406, -174, 1479, -1325, -4543],
246
+ [139, -11857, -4785, -918, -377, -5464, 3331, 8442, 3708, 630],
247
+ [4088, -1714, -3223, -294, -4722, -7013, 9436, 4408, 162, 1481],
248
+ [157, 10, -2929, -8, -2796, -5584, 6787, 5818, 0, 0],
249
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
250
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
251
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
252
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
253
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
254
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
255
+ [494, -182, -26, 0, -199, -406, 1255, -1, 55, 0],
256
+ [-9, -1, 2, 0, -18, 11, 10, 6, 20, 0],
257
+ [4824, 5665, -2014, 4413, 311, 2420, -3342, -853, 1292, -7912],
258
+ [3530, 4067, 726, -637, 8711, 331, -3318, 2027, -2939, 569],
259
+ [1771, 4089, -4031, -3532, 8850, -3295, -3633, 10284, 3368, 2091],
260
+ [9329, -4032, 5750, 616, 8324, -9034, 1057, 2697, 3720, 4215],
261
+ [11250, -1782, 4315, 11405, 5527, -4856, 4798, -1317, -2722, -2631],
262
+ [5898, -934, 3519, 5426, -802, -4620, 8710, 157, -1826, -2176],
263
+ [3870, -5036, 9758, -704, -2629, -716, 6088, -524, 2880, -153],
264
+ [8222, 2698, 458, 5503, -3498, -3281, 3109, -3338, 6792, 285],
265
+ [10219, -56, 4297, 2186, -4657, -7323, 8221, -5425, 4904, -2032],
266
+ [2895, -491, 6755, 2287, -2698, -2458, 2222, -3067, 3694, -3466],
267
+ [2130, 1024, 3211, 5033, -3523, -1506, 1890, -1330, 3496, -2464],
268
+ [5244, -422, 4195, 5817, -1030, 672, -2443, -572, 1255, -1152],
269
+ [2884, -2113, 3600, 2669, -4872, -869, -449, 260, 4541, -2571],
270
+ [-4290, 1838, 3990, 91, 2545, -1923, 2104, -1253, -1596, -5272],
271
+ [2579, 5519, -4909, 35, 369, -43, 2321, -1073, -3528, -2972],
272
+ [5524, -237, 5205, 1788, 894, -2421, 2247, -1000, -1214, -6637],
273
+ [-1011, 5660, 7322, 1695, 8938, -3770, 1564, 1434, -8668, 2485],
274
+ [-1958, 7522, -7368, -3467, 7517, -2547, -595, 2658, -2034, -475],
275
+ [2, 5256, -6668, -6111, 4361, 2957, 3016, -1517, -943, 1190],
276
+ [10613, 941, -7267, 5916, 1761, 2817, 9286, -1924, -6064, -5967],
277
+ [5292, -10520, 4568, -5586, -2541, -8622, 7969, 9757, 3051, -609],
278
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
279
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
280
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
281
+ [28, -116, 62, 35, -6, -8, -155, 26, 210, 0],
282
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
283
+ [-2420, 3445, 4797, 7380, -2249, -434, -2606, 477, 6397, -23],
284
+ [3500, 2004, 4007, 10637, -8394, -4969, -3174, 2116, 11194, -2944],
285
+ [15243, -4660, 6779, 3692, -5302, -8319, -9488, 639, -2942, -833],
286
+ [10249, 1198, 2127, 709, -1671, -1997, -3945, -4523, -5280, -4092],
287
+ [-937, 4659, 8336, 2394, -1003, -630, 101, -191, 613, -5846],
288
+ [-1693, 629, 6989, 4966, -2804, -877, -1568, 592, 3704, -900],
289
+ [-1989, -23, 6036, 3131, -1926, -3085, -3191, 1559, 1422, 1918],
290
+ [2981, -1290, 5268, 5133, -1865, -4045, 1135, -3424, 3729, -151],
291
+ [52, 105, 4890, 1978, 850, -443, 2639, -3049, 3861, -1773],
292
+ [2363, 2377, 3374, 2242, 2726, 861, -2600, -1874, 2182, 5169],
293
+ [1189, 4207, -93, -675, -2819, 18, -2227, 1117, 4081, -622],
294
+ [3208, 921, 3582, -57, 211, -2851, 2145, -5656, -995, -1894],
295
+ [-481, 3581, 4099, 1000, -1851, 580, -1148, -4970, -2055, -2735],
296
+ [1266, 924, 1289, 1741, -1901, -4594, -4177, 760, 912, 114],
297
+ [772, -365, 2860, 1162, -4229, -2079, -2307, 286, 905, -721],
298
+ [-246, 2254, 1247, 2318, 428, 1937, -1427, -1847, -1511, -1309],
299
+ [2940, -121, 1466, 885, -3578, -2368, 820, 3251, -59, 477],
300
+ [1446, 297, -774, -85, 2310, -640, 251, 3038, -2716, 1419],
301
+ [406, 1154, 86, 2421, -3868, 350, -364, 4013, -2964, 77],
302
+ [-6729, 4712, 978, 3854, -2323, 3062, -3975, 4269, 3222, -3946],
303
+ [-361, 1388, -3855, -4896, 4709, -973, 2334, 7093, 845, -724],
304
+ [-12021, 5626, 4042, -2085, 8170, 5486, 2834, 2862, -9008, -1190],
305
+ [-8220, 1510, 11048, 11205, 3115, 3853, 9726, -2386, -11872, -9974],
306
+ [-2370, -1697, 3129, 161, -390, -2382, -4498, 4616, 2777, 2361],
307
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
308
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
309
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
310
+ [1661, -501, -1400, 1135, -100, -3546, 25, -4, 5450, 319],
311
+ [881, 451, 2041, 5594, -510, 2723, -790, -429, 7506, -2162],
312
+ [6448, -1592, -3551, 3983, -267, -10107, -455, 8303, -2079, -6115],
313
+ [5743, -8611, 1243, 1713, -3807, -5457, -12449, 8219, -1997, 269],
314
+ [1388, 602, 3883, 3197, -1213, -7506, -7951, 4013, 246, -1427],
315
+ [3280, -107, 2723, 4805, -3692, -322, 1265, -2815, -466, -1176],
316
+ [2335, -4641, 2690, -36, -1724, -974, 3531, -676, -2657, -1553],
317
+ [-2266, 543, -1363, -592, -665, 2608, -1374, 2917, 1039, 2422],
318
+ [1016, 119, 117, 927, 1548, 1795, 715, 1497, 25, -2037],
319
+ [-1829, 218, 4135, -421, 4543, 628, -897, 465, 2109, 378],
320
+ [-397, 1402, 4009, 754, 5020, 84, -2477, 513, 1136, 1217],
321
+ [-800, 1983, 3188, 2577, 845, 2591, 1950, -1683, 2548, 1154],
322
+ [1060, -1052, 2820, -350, 827, -1784, 2376, 755, 1005, 920],
323
+ [956, 1041, 976, 2127, -132, -2405, -1358, 1356, 2844, -1880],
324
+ [266, 1587, 3726, 992, 549, -1524, -730, -1809, -349, 821],
325
+ [-920, 1942, 3439, 853, 1220, -1288, -1100, -1498, -2133, -89],
326
+ [-1593, 1698, 981, 1459, -1723, -235, -226, -1318, -766, -2903],
327
+ [-1597, 1081, 1908, 1280, -2352, -1857, -170, -2467, 2069, -834],
328
+ [-3880, 1631, 3501, 1957, -964, -1193, 193, -939, -3375, 1704],
329
+ [2521, 1259, -97, -286, -1841, -2085, 3875, -472, -3657, 1485],
330
+ [381, 74, -74, 843, -3262, -870, -2214, 735, -4026, -1729],
331
+ [4997, -894, -1363, 533, 4722, -3931, -252, 632, -5016, -2632],
332
+ [-346, 2408, 228, -2735, 5078, -2687, 1997, 8583, -7303, -2912],
333
+ [-8921, 9706, 876, 655, 1236, 6531, 721, -2251, 151, 3915],
334
+ [-7687, 1772, 5420, -4902, 1442, -1962, -7502, 4371, 4869, 4657],
335
+ [-246, -43, 212, 2, -91, -221, -36, 171, 666, 1113],
336
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
337
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
338
+ [-496, 3144, -3555, 4884, -3998, 6369, -1161, 771, 350, -8065],
339
+ [492, 971, 6099, 7761, -3999, 5359, -3365, -3273, 10015, -3045],
340
+ [2404, 8233, -3152, 5101, -996, -4183, 3551, 924, -9629, -7004],
341
+ [4988, 475, 2590, -3855, -7252, -768, -3513, 3074, -10168, -1489],
342
+ [3789, -5589, 7802, -2439, -5144, -2908, -6026, 1933, 572, 892],
343
+ [723, -3694, 3958, 1739, -1106, 2293, 1746, 514, -3938, -3127],
344
+ [2821, -3864, 2217, 1689, -2253, 2362, -2297, 1892, 136, -905],
345
+ [3462, -961, -293, 1776, 3941, 1806, -299, 1473, -184, 928],
346
+ [1205, 188, 586, 1264, 3198, 3798, 2058, -660, 1039, 2413],
347
+ [804, -1188, 57, 1513, 2234, 2829, 1917, -1139, 2228, -680],
348
+ [-1895, 1964, 2530, -921, -1067, 3463, 2438, 1190, 2774, 1373],
349
+ [1000, 1585, 1433, 2494, 254, 2727, 1470, -159, 5115, -683],
350
+ [-1013, 1927, 878, 302, 3497, 3868, 2418, -517, 1962, 521],
351
+ [431, 1411, 2339, -855, 2903, 3476, 4046, -629, 2364, 76],
352
+ [-91, -142, 1276, 397, 2813, 2970, 2557, -519, 5788, 536],
353
+ [-2899, 435, 2754, -63, 4187, 2199, 2946, 147, 1429, 551],
354
+ [1663, -473, -2099, 1013, -244, 832, 653, -3043, 2081, 381],
355
+ [-2654, 616, 1681, -675, -1666, 1284, 898, 681, 163, 1784],
356
+ [-20, 1252, 417, 3100, 465, 923, -243, -1754, -889, -2304],
357
+ [-2796, -3177, 510, -28, -103, 164, -319, 1269, 2615, 1236],
358
+ [-333, -127, -585, -672, -3096, 3242, -2170, -228, 706, -1043],
359
+ [4294, 3580, -472, -2896, 1092, -708, -2844, 122, -8146, 785],
360
+ [6160, 3248, -764, -4076, 2594, -626, 5235, 1657, -5345, -1345],
361
+ [-2763, 9895, 4121, 5307, 3392, 5640, 3260, -1966, 1516, 2323],
362
+ [5910, 7460, -2541, -1328, -1766, 4639, 4903, -5058, 8235, -763],
363
+ [-1800, 4261, -737, -483, -684, -191, 318, -1343, 734, 1945],
364
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
365
+ [9279, -2862, 7700, 7876, -11700, 10234, -8238, -788, -3650, 4422],
366
+ [2675, -2276, -7593, -3006, -10450, 10381, 4554, 7795, 2672, -7357],
367
+ [8924, -214, 6306, 6122, -5909, 5589, -3459, -3351, 4382, 1372],
368
+ [8114, -2534, 6357, 4892, -8515, -2557, -6077, 3739, -1957, 1407],
369
+ [4050, -5355, 9100, 378, -2405, -165, -7661, 959, -3299, 3195],
370
+ [-632, 180, 2449, 1583, -406, 4002, -1396, -575, 1466, -4577],
371
+ [-2438, 195, 831, 476, -3774, 4796, -309, 5110, 789, -1531],
372
+ [1222, 1157, 4263, 603, 5903, 898, 1667, -15, -2698, 1068],
373
+ [-518, 1330, 3300, -774, -674, 4889, 455, 4492, 384, -719],
374
+ [817, 326, 460, -242, 850, 3542, 1917, 1617, -771, 397],
375
+ [-126, -706, -1299, 556, 2367, 4083, 2751, 1917, -1204, 311],
376
+ [-668, -963, -1887, 1894, 1086, 3670, 3427, -457, 2466, 1111],
377
+ [1501, -530, 1224, 39, 3584, 2880, 961, -747, 3099, 1772],
378
+ [2850, 845, -380, 1567, 3211, 4020, 2580, -135, 2497, -827],
379
+ [-2529, -840, 1609, 1450, 4872, 1794, 3663, -411, 5332, 1722],
380
+ [415, 2853, -500, 1488, 3245, 2233, 3376, 1477, 2768, 2143],
381
+ [984, -104, -1243, 742, 1803, 5796, 199, 2298, 1441, -1925],
382
+ [-1118, 995, -475, 873, -848, 4183, 2613, 934, 1465, 1686],
383
+ [215, 1663, -297, 394, -1362, 973, 1248, 725, -691, 1020],
384
+ [959, 1689, -3468, 5, 1453, 2901, 1090, -613, 319, -1793],
385
+ [1327, 1344, -1111, -2067, -2002, 717, 2452, 1020, -2244, 1146],
386
+ [1083, -271, 1274, -4105, -384, 1774, -1991, 1252, -480, 1475],
387
+ [-2442, 5870, -80, -5846, -73, 2547, -3411, -734, -1370, 2598],
388
+ [2736, 4198, 80, -2871, 445, 4657, -327, 3253, -2448, 944],
389
+ [5735, 3558, 7526, 10427, -998, -407, -553, 4667, -1115, -930],
390
+ [8488, 6654, -2453, -2887, -2712, 2707, 299, -1283, 10201, 55],
391
+ [-2805, 4304, 341, -147, -928, -1155, 1601, -2577, -3851, 994],
392
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
393
+ [1798, -7491, -2156, 1308, -5792, 9199, -1148, 5031, 1755, 738],
394
+ [7121, -1170, 2299, -7331, 2436, -2686, 6658, 8944, -7402, 2861],
395
+ [8184, 136, 7900, 1704, 3264, -4105, 2215, 2641, -5205, 5192],
396
+ [-124, -1822, 4051, 799, -1763, -3207, -5940, 7216, -1410, 2739],
397
+ [1753, -4444, 1534, 2049, -526, 3932, -1160, 1521, -3168, -1665],
398
+ [-625, 793, 4862, -357, 1243, 902, 3814, 663, -698, -298],
399
+ [1311, 286, 1975, -1399, 2907, 2201, -2549, 5471, -263, 5414],
400
+ [-61, 3347, 55, 653, 2329, 5999, 1502, 1175, 2348, 2856],
401
+ [1105, 1345, 1608, 339, 1712, 4542, 521, 3031, -2731, 390],
402
+ [1989, -640, 1190, 810, 2183, 1888, -44, 1104, 537, 1160],
403
+ [-271, 641, 2596, 1586, -39, 2742, 92, 1859, -1198, 676],
404
+ [-836, 693, 725, 2479, -3702, 2456, 329, 2373, 2033, 1669],
405
+ [-1189, 1266, 1621, 598, 2670, 314, 1872, 1153, 768, 1583],
406
+ [1714, -471, 620, 2055, 137, 1908, 3202, -14, 4495, -1070],
407
+ [2333, -2475, 970, 423, 1787, 2130, -476, -615, 4044, -811],
408
+ [-3249, 2939, 2280, -796, 1006, 4005, 1758, 516, 2821, 870],
409
+ [1680, 2219, 434, -940, 1199, 2194, -1542, -1971, 3225, -274],
410
+ [-1542, 2624, -54, -2312, -1800, 3037, -683, -716, 2175, 733],
411
+ [1489, 1128, -1182, -2499, 1319, 3097, -2488, -2333, 1006, 547],
412
+ [-1373, 1807, -805, -4427, -66, 3644, -2702, -1803, -956, 1179],
413
+ [-3605, 3741, 371, -4541, 1399, 1230, -2231, -2536, -1421, 351],
414
+ [730, 269, 640, -3518, -2133, 1579, -3564, -4344, -1969, 1203],
415
+ [-4981, 3241, 2219, -9453, 2145, 1460, -3338, -349, -8880, 3760],
416
+ [-7806, 8007, -1535, -1479, 2373, 8733, 1297, -964, -5399, -1559],
417
+ [4589, 10614, -1157, 5970, 4417, 2778, -6262, 2678, 495, 1182],
418
+ [7450, 7063, 136, 1544, -2955, -1329, -1872, 766, 2593, 2434],
419
+ [-386, 607, -143, 0, 175, -229, -52, 63, -661, 439],
420
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
421
+ [2020, -1756, -3725, -243, -2098, 4305, -1291, 2786, 2252, -1865],
422
+ [5115, 5404, 6211, 2543, 3756, -4425, 3232, 921, -7308, 155],
423
+ [765, -152, -657, -770, -2105, 4009, -2790, 5919, 1080, 2229],
424
+ [981, -168, 3362, 3759, -6575, 455, -6716, 4848, 5556, 7350],
425
+ [5388, -5434, 1100, 1508, 1604, 3446, 2621, 940, 1613, 5954],
426
+ [-3367, 3498, -1696, -1820, 3661, 4771, 1577, 2728, -327, 2214],
427
+ [651, 2394, -1127, 183, 590, 3639, 523, 3192, 1517, 3076],
428
+ [-224, 482, -1877, -24, 36, 4102, 102, 3716, 4854, 2169],
429
+ [671, 1189, -540, -303, 1704, 104, 1075, 2605, 846, 3748],
430
+ [-7, 159, -1733, -591, 2794, 4448, 1104, -541, 1248, 2101],
431
+ [-124, 1201, -3009, -1572, 3866, 2660, 2235, -106, -3147, 2662],
432
+ [618, -1474, -3657, -935, -1516, 4104, 3285, -1931, -903, 1964],
433
+ [-1202, 1282, -199, 52, -1326, 1354, -156, 133, 1343, 2670],
434
+ [-1760, -627, -608, 1754, -3015, 3518, 913, -2058, 4717, 1076],
435
+ [351, -2201, -330, 235, 513, -1642, -846, -3133, 4414, -1710],
436
+ [3230, -78, -379, -2209, -4071, 1972, -3548, -1569, 1508, -594],
437
+ [-1339, 703, -708, -2571, 381, 3284, -6946, 19, 1244, 55],
438
+ [1742, -396, 1120, -4820, -2254, 2495, -4966, -3752, 1899, -1719],
439
+ [-982, 1384, 1601, -3070, -656, -199, -5626, -626, 2223, -873],
440
+ [-425, 471, 1267, -637, -1668, 2579, -5766, -1759, 2999, -840],
441
+ [-88, 3342, -1330, -2628, -1220, 2018, -4077, -804, -1200, 1100],
442
+ [-2448, 2102, -1800, 864, -2932, 788, -5917, -1835, -1662, -1672],
443
+ [-486, 2367, 2830, -382, 619, 402, -5658, -3131, -3666, 1374],
444
+ [-7358, 5501, -928, 504, -2994, -1927, 440, 1538, -4849, 3190],
445
+ [-3126, 13036, -1922, 8238, -1696, 3802, -3701, -4880, -3182, 5574],
446
+ [5261, 2604, -3274, -5860, -8281, 10861, -1418, -3564, -3210, 1945],
447
+ [11179, -9043, -1578, 3649, -10066, 11755, -9937, 5457, 6195, -9986],
448
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
449
+ [1401, -1336, -2528, -1983, -1609, 2560, -589, 1712, 1440, -87],
450
+ [3408, 3824, 1777, 3698, -2171, 1893, 2363, 567, -477, -4173],
451
+ [3544, -235, 852, 6007, -2681, 6025, -10927, 743, 6660, -310],
452
+ [-707, 236, 4558, 3442, -4562, 38, -1951, 4342, -1425, 5817],
453
+ [2406, -4897, 1745, 2808, -9, 2767, 4188, -2450, 3755, 5285],
454
+ [794, -943, -1424, 487, 3247, 4576, 366, 2159, -257, 4656],
455
+ [-285, 3525, -1032, 1524, 4078, 4229, 2892, 623, -1014, 5],
456
+ [-160, 1992, -185, 2160, 3567, 2262, 1945, 1375, -2164, 2926],
457
+ [-1870, 1641, 49, 1415, 580, 2744, 4257, 744, -2997, 3892],
458
+ [-3256, 898, -3735, -3204, 2576, 1058, 1774, 1718, -3647, 6424],
459
+ [-5411, -1074, -3230, -41, 2407, 1495, 1113, 160, -3041, 3510],
460
+ [-5546, 2584, -4356, -404, -185, 1455, 302, 178, -3163, 1074],
461
+ [-2128, 1341, -4073, 47, -5462, 5782, 1599, 516, -1310, 1626],
462
+ [-237, 2597, -3442, 1667, -2701, 2035, -194, -2947, 2057, 495],
463
+ [4042, 109, -2773, -1653, -1233, 942, -5825, -1290, 2327, -1795],
464
+ [1557, -978, -2271, -534, -2382, 3976, -5241, -201, 3899, -951],
465
+ [297, -2103, 666, -1303, -3221, -477, -3177, -320, -19, -1766],
466
+ [431, -498, 2137, -56, -719, 1025, -2999, -953, 298, -2539],
467
+ [-2034, 1199, 113, -632, -1596, -822, -3926, 1486, 3598, 1652],
468
+ [1309, -1266, 2345, 719, -1614, -586, -1154, -3371, 1919, -795],
469
+ [-2759, 1215, -924, -1952, -3385, -84, -1282, -1258, 546, 1353],
470
+ [-3129, 496, 4071, -3449, -2895, -557, -2018, -3322, 4814, -1264],
471
+ [261, 4612, 1687, -1014, -3449, 5569, -2290, -4701, -3126, 85],
472
+ [-51, 5919, -144, 976, -2175, 5033, 4135, -2142, -10404, 997],
473
+ [1120, 9346, -5786, 4211, 540, 8935, 2377, -6098, -10483, -1447],
474
+ [-2965, 2964, 63, -9927, -13092, 10634, -4922, 2246, -411, 3769],
475
+ [7841, -6876, 408, 4270, -7838, 12526, -7612, 2293, 3430, -5084],
476
+ [0, -15, 0, 0, -1, 8, 0, 12, 0, 3],
477
+ [386, -1004, -639, -308, -501, 1274, -401, 530, 462, 72],
478
+ [4872, 2391, 2455, -7407, -2587, 503, -40, 6902, -2257, -6337],
479
+ [-175, -4049, 2785, 1582, -5292, 3667, -12646, 10388, -2580, -367],
480
+ [-5602, -844, -1213, 1516, -2555, 4728, -1315, 2539, -2592, 370],
481
+ [502, -891, 278, 638, 719, -2620, 4652, 523, 1275, 4519],
482
+ [111, -1392, -1625, 1355, 2167, 489, 4984, 529, -963, 5039],
483
+ [-3874, -2070, -1525, -585, 1596, 3555, 4303, 2274, -623, 4751],
484
+ [-5141, -1049, 1006, -771, 560, 1663, 3962, 1656, 13, 2336],
485
+ [-7374, -591, -2549, -1631, -670, 2020, 3016, 3236, -1750, 4455],
486
+ [-5562, -1091, -3399, 1111, -1892, 2314, -1730, 3536, -440, 4522],
487
+ [-5884, -1399, -794, 748, -75, -66, 913, -1, -3122, 1157],
488
+ [-4131, -2247, -1828, 2606, -667, -491, -1441, 2435, -3440, 561],
489
+ [-5421, 1741, -2610, 3182, -6557, 1771, 3291, 1807, 2016, -872],
490
+ [-498, 2539, -374, 2201, -1670, 234, -1399, 866, 4017, 318],
491
+ [-1273, 2885, -2488, -1048, 1571, 563, -2819, 2992, 2395, -570],
492
+ [1406, -1187, -3486, 2204, 869, -365, 492, 1817, 1228, 704],
493
+ [-4420, -2058, -281, 418, 1923, 1020, -539, -1113, 806, -601],
494
+ [-1745, -2466, 114, 772, -994, 2008, -183, 709, 2486, -943],
495
+ [-1444, -1574, 1635, 1336, 2288, 690, 1012, -443, 2869, 419],
496
+ [-880, -913, 655, 3100, 1119, -689, -234, -1062, 5235, 739],
497
+ [1264, -4718, -509, -211, -1756, -2027, 2534, 566, 4592, 313],
498
+ [-1463, -4723, 1700, -4803, -822, -3627, -1590, 2242, 7106, 1341],
499
+ [435, 3303, 1540, -16, -2264, 629, 3834, 256, 466, 5050],
500
+ [-4647, 7661, -940, 2692, -883, 3843, 9640, 1449, -12294, 7880],
501
+ [-315, 15453, -5628, 8659, 10013, 5534, -1085, -4365, -11250, 4250],
502
+ [-14152, 20681, -13317, -7149, -4507, 9344, -12766, 2631, 5626, -1611],
503
+ [-142, 493, 1575, 0, 16, 567, 48, -102, -319, 857],
504
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
505
+ [-6739, 1233, 2677, -1327, -3864, 1032, 5718, -3390, 4108, 7],
506
+ [996, -3532, 7257, -8883, -5914, -451, -968, 9102, -2560, 9995],
507
+ [-304, 502, 175, -14081, -2952, 5968, 8891, 5386, 437, 4504],
508
+ [-9120, -5551, -9295, -1879, 5065, 10244, -2328, -5016, 6692, -115],
509
+ [-4600, 3850, -888, -52, 856, -2126, 190, -845, 34, 6814],
510
+ [-8346, -386, -1281, 271, 1232, 618, 3833, 395, -428, 3571],
511
+ [-11070, -1117, -3325, 750, -260, 1507, 1885, 4127, 223, 1488],
512
+ [-5713, -4890, -546, -754, 2138, 35, 2093, 3967, -412, -1231],
513
+ [-6763, -2280, -2329, 975, 126, 679, 1144, 2891, -572, -3224],
514
+ [-5152, 632, 429, 4056, -2575, 2007, 792, -21, -2323, -7183],
515
+ [-3830, -3448, -368, -539, -3355, -570, 993, 3352, -1243, -5573],
516
+ [-4912, 875, 2788, 2869, -6087, -2001, -3409, 2793, -1312, -4175],
517
+ [-1484, 3868, 731, 4601, -3011, -3623, -1249, 4993, -451, -4202],
518
+ [-325, 4450, -754, 2871, 291, -1665, 21, 1338, 4629, 109],
519
+ [-476, 1182, -1058, 3134, 3374, -617, 275, 3511, 84, 256],
520
+ [-2046, -1648, -1539, 3287, 678, 712, -759, 4856, 493, -1138],
521
+ [-5530, -1390, 246, 3527, 1042, 844, 1995, -195, 2650, 349],
522
+ [-2023, -783, -1400, 3463, -2240, 2878, -160, 2507, 2664, 747],
523
+ [-4608, -664, 733, -832, 4192, 4023, -1909, 915, 292, 1756],
524
+ [-4796, 978, 1333, -1672, 2475, 3722, -241, 2312, 1981, 1210],
525
+ [-3367, -2456, 1552, 1013, 1218, -1017, 2871, 1585, 3333, -610],
526
+ [-6260, -458, -3233, 1283, -976, 97, 2024, 3694, 7998, 347],
527
+ [-3626, -2768, 1233, 819, -605, -4032, 6241, 4798, 5068, 3068],
528
+ [-7707, -3483, 8239, -10680, -4407, -7017, 4654, 11496, -2739, 3446],
529
+ [4275, 1324, 9833, 646, 8942, -2160, -6592, -4087, -5289, 5421],
530
+ [2122, 8171, 6098, 2639, -4235, 3280, -11128, -7389, 7191, 5175],
531
+ [6382, -8162, 8174, 0, 715, 6359, 7255, -9480, 8, 9202],
532
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
533
+ [-9625, 3920, 7168, -639, -7741, -3555, 8529, -4129, 6020, 223],
534
+ [-1922, -2230, 5003, -1701, -2235, -3628, -1464, 8079, -2883, 9947],
535
+ [1626, -479, 2960, -3023, 2876, 1649, -1079, -2322, 1669, 3394],
536
+ [-14072, 1236, -6800, -2427, 1325, 7782, -4309, -2581, 2484, -3713],
537
+ [-11983, 2793, -1079, 822, -4721, 506, -2446, 1615, 2362, 347],
538
+ [-12471, -1866, -2869, -82, -2020, -853, 2174, 3149, 538, 859],
539
+ [-7240, -1853, 1043, -840, 177, -1879, 969, 951, -956, -3506],
540
+ [-4717, 1348, -483, -551, 160, -1279, 465, -84, -782, -3098],
541
+ [-3260, -577, 3648, 730, -2960, -1168, 1183, 1940, -483, -3836],
542
+ [-2111, -1937, 2318, 1567, -136, -2374, 1525, -795, 265, -5452],
543
+ [-558, 1336, 632, 722, -103, -2477, -2524, -775, -1261, -5632],
544
+ [1671, 3202, 2668, 1216, 3033, -5048, -208, -409, -3560, -4045],
545
+ [993, 4254, 1640, 1626, 3352, -2509, 203, 81, 1970, 275],
546
+ [3287, 2495, -856, 1976, 1186, 809, -1402, 749, 4231, 993],
547
+ [-2131, 2274, 986, 1085, 3879, -3247, -1630, 3745, 2712, 2074],
548
+ [610, -208, 1242, 2513, 1180, 130, -2142, 2216, 1057, -948],
549
+ [924, -2266, -2468, 1276, 2404, -2343, -2074, 2719, 2168, 52],
550
+ [268, 1295, 1788, 1101, 1171, 1701, -1299, 1165, -174, -1925],
551
+ [-2249, 2790, 315, -459, 4443, 852, -1923, 3662, 2301, -9],
552
+ [645, 66, 148, -3638, 1440, 3392, 259, 2042, 683, 412],
553
+ [636, -1673, -611, -4668, 4057, -2789, 441, 3657, -558, -206],
554
+ [-4113, 1937, 1932, -5273, -543, -1149, -471, 1826, 2853, 689],
555
+ [1936, -5423, 5290, -1275, -901, -7100, 3713, 5313, -947, -1198],
556
+ [7540, -12057, 10102, -4425, -2218, -189, 1968, -1499, 3823, 3272],
557
+ [3967, -3107, 12957, -8900, 4376, 4805, -13715, -2708, -903, 4682],
558
+ [186, -474, 9701, -1414, 6955, -2614, -9282, -2694, -7085, -2087],
559
+ [7096, -8888, 8780, 0, 3453, 7175, 7946, -9466, 0, 10260],
560
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
561
+ [-1762, -1309, -1331, 961, 810, 2222, -1451, 3277, 417, -332],
562
+ [-2957, -3514, 2104, 6, -5988, 538, -4740, 10805, -7936, 2172],
563
+ [-2657, 2993, 5181, 10624, 4030, -3226, -8025, 1487, -8312, -3165],
564
+ [-8961, 2223, 1226, -391, 2171, -2063, -5168, -2083, -3640, -3677],
565
+ [-9345, -1666, -4944, -299, -5477, 805, -2119, 4127, -1226, -9053],
566
+ [-278, -3023, -369, -1041, -17, -1924, 785, -226, -38, -9822],
567
+ [943, -3463, 4469, 493, -234, -814, 629, -333, -3599, -12010],
568
+ [-510, 368, 60, -1050, -108, 250, -580, -825, 315, -9597],
569
+ [2377, 852, 2335, 2038, -613, -3778, 355, 783, -376, -8531],
570
+ [532, 474, 904, 430, 329, 375, 727, -130, -1662, -2850],
571
+ [58, -122, 2844, -2058, 2515, -717, 208, 5429, -316, -733],
572
+ [1383, 4839, 3851, -676, 2911, -630, 530, 1392, -1085, -1138],
573
+ [1566, 4918, 3206, -1918, 4561, -1047, -454, -1737, 2238, 1115],
574
+ [3296, 2631, 213, -644, 6633, -912, -2484, 2147, 1380, 95],
575
+ [-591, 4126, -105, 977, 5077, -1007, -934, 907, 3696, -1699],
576
+ [972, -955, -1342, -2070, 3366, -2057, -1957, 1903, 1019, -874],
577
+ [-1093, -69, -407, -1450, 5143, -1825, -3474, 1071, -2958, 447],
578
+ [-369, 950, 3254, 1464, 1133, 3136, -1487, 143, 1404, -1736],
579
+ [1364, -2729, 919, -2786, 3972, -1475, -310, 3955, 2208, -13],
580
+ [3721, -2127, 1788, -461, 2978, 1638, 1723, -405, 996, -1077],
581
+ [2568, 1177, 3395, 1448, 1127, 1331, 298, -867, 1190, -1939],
582
+ [-1140, 1480, -967, -279, 1473, 4076, -647, -1060, -1228, -3668],
583
+ [1338, -4593, -728, -3632, -5629, 3181, 3831, 4393, -793, 1686],
584
+ [8956, 1680, 2782, 4037, -5627, -3169, 6887, -663, -3516, -312],
585
+ [1908, -3524, 5776, -6542, 2384, 4978, 4483, 1780, -8842, -6894],
586
+ [-5211, 2755, -1114, 3469, 1904, 4634, -1809, 3326, -8258, -1298],
587
+ [6388, -6925, 7010, 0, 123, 5102, 5801, -8745, 0, 9169],
588
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
589
+ [-372, 1046, -215, 2368, -276, 814, -2367, 625, 1712, -1996],
590
+ [-3266, 6101, 9977, 5764, -6691, -7347, -3616, 10858, -9855, -1036],
591
+ [186, -2857, -3186, 6708, 6930, 545, -3366, -115, -2077, -9730],
592
+ [-931, 2006, 3672, 724, -1834, -3837, -2836, -3559, 1701, -10495],
593
+ [4682, -4605, 2570, -8749, -3439, -2167, 2007, -4982, -123, -9594],
594
+ [6310, 1194, 297, -6564, 1157, 1455, -1166, -3739, -5437, -11872],
595
+ [4035, -2426, 4053, -3308, 61, 24, -633, -733, 1315, -10240],
596
+ [1691, -755, 387, -4275, 1516, -2725, 1116, -197, 226, -2564],
597
+ [2306, -789, 1737, 114, 2329, -2576, -1305, -740, -4347, -543],
598
+ [1048, -395, 2050, -1800, 1476, 1474, 3747, 1128, -1890, -333],
599
+ [4885, 1669, 2461, 2612, 5687, -1416, 1095, 1440, 1319, 1691],
600
+ [3451, 5817, 2802, 1314, 3504, -1897, 2926, 3627, 894, -102],
601
+ [4688, 2984, 1907, 1833, 1732, -1951, 265, 2293, 2549, 2256],
602
+ [2877, 4519, -260, 3199, 1356, -2226, -677, 2348, 1863, 2078],
603
+ [165, 697, -225, -508, 1744, 367, -3284, 1812, 1295, -893],
604
+ [439, 1052, -292, -365, 3164, -2802, -3485, -585, -136, -2049],
605
+ [-1103, -3315, -1194, -1843, 3107, 594, -2893, 2497, -535, -101],
606
+ [-4060, -920, 960, -2183, -193, 4354, 1432, 737, 1777, -1183],
607
+ [17, -2089, 3577, 1115, 1980, -757, -1682, 3256, -1155, -3556],
608
+ [-1499, -1000, -903, 1587, -782, 4186, 3005, 1686, 426, -5457],
609
+ [-1594, 30, 182, 1416, 338, 3141, 1628, 984, 112, -3181],
610
+ [-2574, -700, 270, -32, -1339, 1607, -1358, 4069, 896, -776],
611
+ [1401, 2792, 9, 1963, -2875, 987, 1614, 4167, -1223, -1323],
612
+ [4655, 10602, 7867, 9479, -3554, 4797, 2990, -4425, 2266, -21],
613
+ [5113, -3591, 7616, 5665, 11348, -3189, 2468, 463, -17167, -6442],
614
+ [-1182, 2786, 6570, 1938, 15151, 474, -11090, 162, -7460, -757],
615
+ [6529, -6815, 6303, 0, 3866, -2766, 2061, -5992, -90, 8027],
616
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
617
+ [4852, 2858, 4215, 5019, -4697, 1613, -973, -1123, -1155, -808],
618
+ [5713, -2891, 4651, 1947, -6154, 6446, -574, -6965, 10877, -2820],
619
+ [8491, -2983, 916, -753, 5184, 8178, 6075, -9501, 2168, -7143],
620
+ [2703, -159, -1397, -1638, -821, 333, 548, -4529, 3006, -15375],
621
+ [3315, -1528, 2612, -9180, 1487, -2006, -4994, -2097, -3304, -7388],
622
+ [3953, -985, 1316, -8534, 4294, -1134, -1858, -1563, -3705, -6821],
623
+ [1290, -3741, 4213, -6980, 2978, -3383, -3402, 2549, 990, -1495],
624
+ [-1032, -917, 1228, -7248, 43, -522, -1102, 3176, -428, -1226],
625
+ [-683, -222, -132, -7272, 1638, -170, -1257, -302, 1192, 209],
626
+ [1951, -1667, 2025, -1870, 5850, 162, -466, -634, 1400, 1002],
627
+ [2394, 1392, 371, -1284, 6952, -3238, 1600, 2946, 2407, -2347],
628
+ [1908, 3410, 1907, 556, 6173, 2331, -755, 1707, 3337, 464],
629
+ [3374, 3476, 2065, 1610, 5625, -2602, -2149, 1015, -1764, 3330],
630
+ [2222, 2111, -714, 686, 2550, -1845, -586, 1989, -1383, 2225],
631
+ [-2820, -2213, 533, -2542, 807, -452, -1391, 3270, -2796, -333],
632
+ [-162, -2563, 829, -1973, 1277, -1209, -1780, 1380, 973, 1994],
633
+ [-824, -2472, 2931, -1566, 2809, 1043, -1184, 780, -2675, -180],
634
+ [1861, -1971, 1169, 477, -1035, 2013, 1232, -8, -491, -2217],
635
+ [3946, -1744, 4215, 2852, -2895, 1284, 104, 1152, -2753, -1678],
636
+ [903, -1554, -77, 2276, 1172, 2634, -8, -294, -2699, -2267],
637
+ [1613, -1187, 836, 1691, 1109, 255, 417, 1784, -3130, 1093],
638
+ [3408, -4003, 2500, 3519, 923, 1463, 2, -2419, -1453, -2228],
639
+ [-2524, -3236, 6787, 1817, 227, -3539, -348, 1372, 319, 931],
640
+ [2072, 3950, 9047, 11345, 3378, 710, 1873, -5752, -1083, -523],
641
+ [11651, -11085, 12984, -734, 9568, -1667, 9049, -7106, -12518, -4730],
642
+ [3720, -1715, 9300, -2849, 12879, 3385, -4227, -5604, -9542, 6867],
643
+ [563, -273, 955, 0, 528, 2216, -2404, -1960, -243, -239],
644
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
645
+ [1974, 356, -1678, 629, -725, 69, -141, 330, 594, -418],
646
+ [6804, -6327, 8099, -2731, 98, 1851, 4387, -7080, 9973, -5355],
647
+ [-1683, 1693, 1009, 1597, 5888, 6468, 1724, -3780, 2130, -1604],
648
+ [-3739, 1188, 2924, -4735, -1097, 3552, -4320, 1308, -2213, -4867],
649
+ [205, -2881, -875, -4812, 1769, -125, -3755, -1834, -413, -835],
650
+ [1672, -166, -685, -4783, 1735, 442, -558, -6079, -3108, -3187],
651
+ [351, -265, -330, -5392, 1155, -3268, -1829, -911, -422, -331],
652
+ [1898, 1886, 34, -5083, -655, -356, -1294, 646, 646, 1],
653
+ [1945, 641, 2550, -10917, 1037, -538, 1125, 1307, 762, 1231],
654
+ [1030, 1717, 2761, -12264, 1969, -185, 2998, -40, 517, 2145],
655
+ [1635, 1423, 1306, -11038, 1566, -410, 1884, 2806, 387, 1931],
656
+ [2431, 2162, 1541, -8836, 1789, -305, -578, -807, 2221, 2410],
657
+ [1187, -96, -606, -6927, 4956, -2499, -1440, -908, 1296, 2961],
658
+ [191, -2182, -1592, -3978, 1995, -4633, -2212, 3473, 95, 2537],
659
+ [-578, -3313, -973, -3110, 2575, 217, -2336, 1303, -427, -925],
660
+ [598, -1041, -413, -898, 1808, 286, -205, 459, -231, 316],
661
+ [-1398, -53, 4626, -191, 564, 3070, 1301, 182, -242, -578],
662
+ [491, 441, 1337, -709, 3496, 2486, -483, 1324, -3508, -2554],
663
+ [2434, -2044, 2587, 1833, -484, -707, -465, 1525, -1490, -906],
664
+ [2357, -3352, 1663, -1121, 847, -1189, 1554, 496, -1410, -1687],
665
+ [-2239, 631, 5191, 879, -3389, 695, -922, 753, -4124, -3165],
666
+ [5, -2881, 5919, 1931, -2382, -1444, 1058, 172, -1468, -2567],
667
+ [-1070, 547, 132, 2515, -1679, 747, 1483, 301, -2411, -3781],
668
+ [1006, 436, -2499, -2253, -2455, 2112, 2702, -626, 3478, 849],
669
+ [14065, -13408, 4080, -3464, 2238, 2974, 15055, -7214, -6570, -1384],
670
+ [4335, -6991, 799, -2055, -1249, 7150, -1694, -1857, 544, 10500],
671
+ [1532, 1247, 6518, 44, 4600, -3911, 2895, -6304, -4089, 7208],
672
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
673
+ [533, -617, 221, 306, -168, -91, -926, 201, 1255, -20],
674
+ [-419, -4597, 1498, -2760, 2915, -2566, 146, 3527, 6694, 3247],
675
+ [-3431, 5723, 624, 10925, 5253, 4121, -5231, 2716, -385, -177],
676
+ [291, -1102, 4548, -561, -3760, 3388, 374, -1611, -1967, -5557],
677
+ [1050, 1342, -275, 448, -1564, -149, -4084, -2729, -727, 765],
678
+ [-678, 1943, 2222, -169, -1335, -2358, -1208, -5451, -1859, 143],
679
+ [213, -1771, -115, -3286, 1546, -5618, 459, -837, -673, 896],
680
+ [818, -356, -756, -2186, 880, -1311, -233, -355, 895, 253],
681
+ [243, 1154, 777, -5278, 1235, -1193, 144, -200, 1505, 1255],
682
+ [459, 109, 1642, -5931, 1533, -114, 4368, -477, 2914, 1394],
683
+ [572, 1857, 581, -10797, 30, 781, -530, -939, 2661, 496],
684
+ [2679, -1126, -242, -13838, 1014, -3856, -787, 3028, -1763, 1998],
685
+ [2873, 1359, -682, -7883, 2947, -3613, -1760, 780, -1259, 1098],
686
+ [2079, 2106, -3046, -1487, 3303, -918, -263, 499, -3594, 350],
687
+ [962, 3091, 85, 1575, 798, 2918, -843, -320, -1987, -337],
688
+ [190, -521, 2998, 1005, 6261, 1186, 1747, 88, -1977, -1771],
689
+ [1749, -1562, 564, 1946, 3119, 2150, 446, 2009, -136, -2473],
690
+ [2510, -763, 378, 394, 683, 1587, -256, 1221, 867, -139],
691
+ [-245, -453, 2271, 1907, 1538, -652, -725, 1379, -763, -1930],
692
+ [262, 147, 255, 2670, -1073, 1457, -1533, 1846, -195, -2174],
693
+ [1108, -1986, 2086, 1614, -4984, 2053, -1965, 83, -2184, -1338],
694
+ [583, -1928, 4598, 4954, -1507, -853, -1101, -3222, -804, 1836],
695
+ [-824, 1825, 233, 5587, 782, -4139, -196, -2585, -1700, 670],
696
+ [1187, -5115, 1836, -2998, 4476, -4396, 1346, -5950, -244, 2384],
697
+ [15210, -8242, 7780, 2205, 423, -1093, 15996, -7538, -6318, -77],
698
+ [12765, -15216, -3267, 401, -8148, 8667, -1464, -428, 9022, 6595],
699
+ [785, 2003, 610, 1213, 1424, -4687, 2008, -2760, -416, 3982],
700
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
701
+ [1137, -2439, 2019, 437, -537, 1065, -2908, 538, 2846, -57],
702
+ [-5187, 2523, -7667, -9119, 2112, 5465, 6677, 4233, -7224, 4001],
703
+ [341, 3003, 8746, 13482, -1919, -542, -5106, 1382, -1322, 3428],
704
+ [-778, -2939, 6456, 3257, 567, -4096, 876, -1525, -3895, 3659],
705
+ [-3323, 1185, 5423, 3081, 515, -4541, -4214, -1294, 337, -1694],
706
+ [2110, 961, 991, 2033, -2437, 1107, 1109, -1692, -3266, -2901],
707
+ [-6, -791, 3133, 2836, 181, -456, 165, -3917, -1636, 634],
708
+ [-1065, 994, -430, -428, -1433, 2684, -216, -2959, 1538, 1381],
709
+ [-651, -1092, -478, 74, -1825, -2890, -364, 1033, 554, 2394],
710
+ [769, 459, 842, 4132, 333, -1705, 2675, -2562, -1069, 2038],
711
+ [3458, -435, -425, -574, 1419, -3590, 1784, -193, -3188, -30],
712
+ [1692, -1701, 503, -809, -395, -1258, 2526, -147, -17, 402],
713
+ [3043, 2073, -1513, 226, 1320, -1075, -465, -505, -214, 4076],
714
+ [2473, -129, -654, -1011, 3498, 543, 1172, 1070, -1402, -1786],
715
+ [5757, 130, 1519, -809, 1771, -1273, 2853, 738, -1278, 2038],
716
+ [1976, 398, 410, 2559, 4367, -272, 1127, 2564, 87, -1604],
717
+ [3710, 845, 2181, 580, -417, 1520, 1788, 1216, 1766, 2315],
718
+ [3158, 2734, 353, 2625, -1589, 177, 378, -2022, 1408, 1361],
719
+ [-2133, 1232, 776, 777, 2312, 1324, 2039, -290, 1089, 1132],
720
+ [44, 2601, 464, 1099, -2131, -259, 1745, -1219, 812, 522],
721
+ [2162, -3725, 3224, 2110, -3273, -2711, 1251, -541, 9, -410],
722
+ [1058, 1164, 3856, 3410, -2010, -4994, 4006, -6317, -1992, 453],
723
+ [-2573, 3652, 2188, -95, 392, -3854, -435, -1865, 2888, 4467],
724
+ [-1422, 1638, -7008, 328, 271, 5142, 6810, -2563, 2681, -4301],
725
+ [11181, -5995, 5251, 5489, 5582, 875, 535, -2114, -6393, 6810],
726
+ [6737, -8183, 8687, 1284, 6904, -8020, -3260, -5162, -3230, 7609],
727
+ [290, 1148, -2873, 924, -424, -1120, 73, 1077, 916, -525],
728
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
729
+ [-365, -594, 2005, 164, 122, 1758, -711, -583, -442, -191],
730
+ [-5600, 3288, -4717, -8988, 10271, -715, 7973, 3830, -9614, 3671],
731
+ [4464, -996, 7354, 6844, -1086, -4435, -2465, 184, -2355, 1118],
732
+ [692, 920, 3944, 8063, 3419, -498, -3122, -2770, -4842, 1660],
733
+ [-3740, -1879, 7888, 1830, 216, 2711, 651, -3209, -934, -1562],
734
+ [304, -1878, 2141, 3583, 792, -131, -428, -871, 1855, 703],
735
+ [374, 802, 2423, 1860, -651, -3585, 2740, -703, 352, 2972],
736
+ [1673, 1635, 3424, 3398, -3557, 1688, 2594, -3375, -585, 2348],
737
+ [1012, 618, 509, 1589, -898, -994, 3097, -1181, -1400, 823],
738
+ [-1091, -1460, 466, 1383, -3512, -1718, 5055, 414, 2385, 3648],
739
+ [1534, -1556, -429, 4497, 402, -2653, 1986, -1534, 836, -435],
740
+ [801, -907, 1266, 182, -3996, -393, 3884, 1700, -749, 581],
741
+ [1968, 1069, 612, 2121, -2599, 3325, 5915, 169, 2275, 2732],
742
+ [2910, -1469, 3385, 1505, 2414, 505, 2397, 3747, 876, 18],
743
+ [2012, 962, 3207, -1024, -320, -236, 2602, 3822, -87, 1170],
744
+ [3299, 2912, 593, 1713, 3789, -1271, -1299, 840, -856, -1665],
745
+ [532, 3203, 1193, -580, 835, -1785, 1469, 1815, -793, 1594],
746
+ [3143, 2307, -2162, 488, 1498, -2433, 2273, 66, 1152, -1289],
747
+ [1205, 1696, 131, 981, 3318, 2152, -951, 421, 2305, 1874],
748
+ [419, 265, 3357, 1324, 1734, 1110, 1206, -1198, -190, 2911],
749
+ [-602, 693, 1472, 1663, 196, -5872, 373, 1299, 1427, 519],
750
+ [607, 3458, 225, 2776, -1917, -1533, 4238, -3832, -377, -2315],
751
+ [-3033, 3395, 3514, 396, 1447, 5589, 183, -3535, 2630, 4671],
752
+ [5354, 206, -11609, 2895, 3845, 3592, 3503, -3919, 3754, -200],
753
+ [10151, -10127, -3093, 3984, 11320, -8344, -3695, -8733, 471, 8582],
754
+ [1471, -4121, -482, 755, -133, -6759, 5061, 2497, -3708, -636],
755
+ [0, 257, -244, 22, 25, 367, 317, -454, 0, -373],
756
+ [899, 323, -1831, 0, -206, -1076, 230, 360, 530, -100],
757
+ [786, -2541, 2816, 1336, -119, 571, -3140, 44, 3263, 1809],
758
+ [2540, -290, 4445, -1260, -1964, 7818, -7730, 1168, 5647, -4092],
759
+ [11487, -89, -650, 3030, -1092, -7781, -2063, 240, 7770, 1131],
760
+ [1073, 1694, -296, 5100, 1949, -280, 2525, -4803, 970, -1271],
761
+ [-1502, 926, -4534, 1326, -824, 1692, 2077, 356, -2137, -3778],
762
+ [-1285, -320, -1606, 2914, -1097, -352, 387, -3361, 4116, 1768],
763
+ [-1586, 2413, -1000, 3191, -1873, -2040, 4528, -1823, 1621, 2187],
764
+ [1510, 2312, -984, 4005, -103, -2013, 3518, 1097, -2017, 773],
765
+ [251, -211, 1079, 2452, -423, -1380, 2729, 1720, -1232, 1781],
766
+ [1669, -1091, -272, 3683, 226, -1534, 4635, -33, 817, 1900],
767
+ [607, 464, 3165, 2889, -3812, 371, 5931, 1046, -3690, 931],
768
+ [166, -1453, 1933, 3973, -685, -681, 5772, 1819, 968, -703],
769
+ [1377, 2347, 3048, 2942, 630, 932, 2870, 2325, -256, 1775],
770
+ [1492, 3264, -933, 2170, -23, -399, 3338, 2074, -126, -427],
771
+ [-104, 2181, 943, 2096, -410, 524, 2396, 3029, 359, 2598],
772
+ [3209, -319, 563, 705, 2265, -1250, 1240, -236, 256, 605],
773
+ [3187, 2391, 2053, 2555, 2678, -3676, 1392, 860, -2004, 2766],
774
+ [2930, -1127, 67, 408, 2153, -4153, 1775, 324, 86, 393],
775
+ [3914, -320, -1055, -51, 2217, -2038, 207, -1976, -921, 357],
776
+ [476, 3776, -1384, 1381, 176, -4397, 1210, -755, -634, 814],
777
+ [-1639, 1954, -400, -1104, -1443, 1419, 839, -2425, -2964, 2938],
778
+ [64, 288, 5097, 3819, 1209, -2797, 131, -1971, -1253, 1776],
779
+ [-3080, 3583, 4528, -1319, 2903, 4373, -1121, -2212, -882, 4488],
780
+ [5320, -2770, -6764, -6008, 7414, -2861, 4240, -9709, 5087, 6668],
781
+ [13289, -7388, -4218, 4826, -5534, -11457, -4531, 1574, 4176, 15485],
782
+ [9181, 2127, 9519, 2265, -10534, -1040, 11868, 3651, -5352, -4817],
783
+ [0, 0, 0, -1, 0, 0, 1, 0, 0, 0],
784
+ [873, 313, -1778, 0, -199, -1044, 222, 349, 514, -96],
785
+ [175, 13, -112, 36, -12, 4, -73, -55, 64, -72],
786
+ [5971, -5337, 7624, 1529, 1780, 3998, -3150, -3860, 2946, 566],
787
+ [7329, -1439, -343, 4492, 3229, -11081, -3886, 337, 13624, 2690],
788
+ [3668, 1943, -2577, 1823, 912, -4479, 2024, -61, 2627, 1378],
789
+ [3004, 340, -3375, 191, -8219, -2693, 4345, 3290, 3859, 3207],
790
+ [1693, 1385, 499, 2577, -5049, 1715, 3073, -4610, 1641, 4172],
791
+ [2198, -311, -397, -242, -993, 664, 2985, -1791, 2407, 4494],
792
+ [956, -2568, -524, 323, 1474, -574, 657, -129, 2214, 679],
793
+ [1543, -1265, 2068, 248, 74, 1144, 751, -3045, 1107, 1382],
794
+ [-153, -1553, 444, 1555, 747, -262, 2627, 1886, 432, 615],
795
+ [462, 1245, 1639, 684, 2521, 473, 1102, 127, -2251, -399],
796
+ [92, -1376, 3109, 730, 1953, 1641, 3642, 996, 305, 1446],
797
+ [-1202, 428, 3252, -1739, 2518, 337, 4462, 2615, -276, 151],
798
+ [1131, 1875, -1276, 2301, 1026, 1507, 4361, -181, 2043, 2320],
799
+ [2477, 1018, 2748, 1117, -2797, 1236, 2492, 1701, 1384, -869],
800
+ [323, 1851, 2303, -1995, -1861, 759, 1697, 990, 244, 711],
801
+ [723, 2123, 852, -527, -910, -1726, -1708, 1064, -1166, 3193],
802
+ [1973, 3081, 2801, 505, -485, -2712, 648, -3793, -2068, 312],
803
+ [2543, 3656, 340, -2115, -2384, -2701, -1807, -198, -1765, 1299],
804
+ [25, 1438, -2590, -318, -760, -1475, 913, -2332, -1366, 2557],
805
+ [2589, -1521, -1649, 3341, -1392, -4330, -2282, 3188, -204, 2414],
806
+ [600, 2057, 4507, 1509, 1662, -1643, 953, -28, -2542, 2223],
807
+ [-7306, 10415, -2593, 2429, 4164, 4624, -2618, -666, -2034, -2630],
808
+ [-1023, 2078, -10276, -10767, 8831, -5631, -2825, -1835, 9827, 2320],
809
+ [10297, -3858, -4430, -7631, 1346, -5221, 3117, -2796, 5772, 7428],
810
+ [5387, 3696, 6838, 4075, -10521, -4584, 11690, 5048, -3374, -6362],
811
+ [0, -1, 0, -3, 0, 0, 2, 0, 1, -1],
812
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
813
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
814
+ [7436, 8764, 8330, 9247, -7538, 4924, -8683, -3622, 2605, -3031],
815
+ [-6093, 4346, 12424, 12005, 8958, 7264, -7039, -6908, -1388, -5103],
816
+ [-666, -62, 1184, 4743, -3534, 5342, -919, -2517, 477, 2455],
817
+ [1036, 4560, -1976, 3761, -4605, -128, 3228, -3396, 80, -163],
818
+ [4659, 1406, -161, -805, -6264, 1774, 4036, -1913, -1902, 3811],
819
+ [-269, -2499, -380, -434, 1400, 1552, 583, 2612, 3125, -64],
820
+ [-3338, 2380, 255, 640, 3204, 1959, 2220, 170, -1802, 2867],
821
+ [3565, 839, -62, -220, -4480, 1562, 1841, 2782, 1067, 143],
822
+ [-260, 3048, 2152, 359, -2480, 2556, 1471, 382, -1788, -1623],
823
+ [1765, -224, 1101, 1641, -2665, 1632, 742, -551, 1145, 2354],
824
+ [724, 997, -1191, 777, -1752, -713, 2587, 1471, 894, 1968],
825
+ [-799, 4446, 2426, 603, -1697, 1157, 959, 2084, 1411, 1192],
826
+ [612, 3793, 3243, -1357, -128, 1536, -62, 263, 321, 969],
827
+ [564, 1893, 1963, 1833, 874, -1272, 2299, -930, 857, 503],
828
+ [-81, 2363, -1363, -428, -462, -221, 2019, 413, 1314, 1401],
829
+ [-119, 1765, -2551, -118, -1343, -2510, -1830, -775, 1307, -52],
830
+ [94, 1307, 3732, 3242, 1573, -4538, -2975, -815, -881, -680],
831
+ [190, 991, 260, -469, 379, -3784, -517, 362, -1134, 2416],
832
+ [1073, 1599, -207, 1589, 2527, -1850, 2447, 877, -4388, 611],
833
+ [606, -274, 2318, 3157, 4032, -3529, 1991, -1315, 1495, 2809],
834
+ [2262, -560, 7234, -1072, 4728, -787, 10271, -7279, -1199, 2360],
835
+ [-5126, 5088, -834, -6588, 5479, -878, 4132, -1049, -825, 3616],
836
+ [-4808, -1361, -9799, -14342, 12910, -1140, -6603, -4966, 10370, -2704],
837
+ [3495, -5794, -133, -7480, 5346, 2777, 9333, -9229, 4369, 2120],
838
+ [7580, 8297, 8998, 9752, -1098, -2190, -7983, -9068, 933, 310],
839
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
840
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
841
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
842
+ [7166, -3597, -4845, -5207, -6761, 7426, -3180, 5382, 957, 800],
843
+ [-3613, 9201, 6273, 8682, -7068, 14214, -11739, -7019, -805, -12740],
844
+ [-1388, -6778, 1744, -144, -4721, 15055, -3035, -12171, 6701, -1181],
845
+ [1356, -2196, -3970, 1008, -3163, 7739, -4188, -5982, 9083, -11236],
846
+ [7181, 549, 1771, 6431, -1219, 3376, -6606, 1341, -972, -2130],
847
+ [1783, -1322, -956, 4047, 2503, -1556, -6253, 4146, -3068, 473],
848
+ [-1061, 1269, -298, 2695, 2203, 4709, -1582, 1052, -1286, -336],
849
+ [3125, 3077, 2974, 2478, 1243, -55, -1487, 3310, -754, -1431],
850
+ [-634, 3921, 1614, 1244, 1538, 1412, 346, 61, 1863, -1145],
851
+ [2662, 1275, 2117, 1572, 2784, 1638, -2131, 1471, -429, 1135],
852
+ [28, 2718, 3216, -1461, 1245, 489, -372, 2594, -1611, -510],
853
+ [1190, 4506, 3954, 1167, 81, 2473, -1822, -822, 30, 174],
854
+ [2121, 2136, -139, -2522, -139, 2719, -1613, 167, -1464, 1637],
855
+ [268, 2077, 1798, -802, 695, 1982, -994, -568, 317, 1460],
856
+ [423, 4678, 4302, 866, 1072, 626, -1031, 2218, -651, 188],
857
+ [1923, 1996, 837, -1987, -1800, 3929, -327, -2518, 1921, 2834],
858
+ [-3723, 2105, 1078, -3006, 712, -2645, 2192, -1121, -2002, 2155],
859
+ [-3115, 2332, -3913, -6177, 3960, -1294, -907, -2740, -360, 4852],
860
+ [-2393, 1036, -417, -7235, 5602, 2955, -320, -804, -3892, 337],
861
+ [-1569, -3764, 7720, 483, 9193, 3798, 3176, -5693, 167, 1148],
862
+ [-4294, 2808, 181, 861, 13038, 6647, 2297, -7295, 1884, -2811],
863
+ [-7558, -2728, -5328, -894, 14834, -4123, -5909, 1284, -501, -4857],
864
+ [8805, -13106, 6767, -7971, 8878, -3635, 6239, -8192, -4753, 10902],
865
+ [11428, -13079, -5498, 5281, -2347, -12832, -7868, 6811, 3239, -466],
866
+ [7776, -5410, -5045, 5960, -4020, -8990, -2494, 2686, 5980, 5428],
867
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
868
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
869
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
870
+ [-35, 81, 64, 134, 27, -53, 0, -77, -4, 0],
871
+ [8936, -9785, -8093, 1032, -6876, 10305, -2281, -363, -1782, 5178],
872
+ [-3554, -6330, -8135, -6540, 1926, 11308, -6457, -10058, -2844, -6042],
873
+ [-2949, -2961, -6854, 1268, -660, 12319, -7513, -11351, 8103, -8725],
874
+ [3470, 990, 5915, 4964, -65, -1850, -13366, -4796, 556, -408],
875
+ [-1298, -3599, 4511, 6795, 1454, 4885, -11655, -2527, 3307, -3376],
876
+ [2664, 2420, -236, 5198, 1362, 4568, -2219, -4224, 7366, -1859],
877
+ [3539, 5043, 692, 1020, 732, 3987, 606, -2503, 1495, -2526],
878
+ [-303, 929, 3249, 2193, 4415, 3348, -84, 603, -86, -1762],
879
+ [-12, 3882, 198, 302, 2612, 4679, 3942, 718, 582, -571],
880
+ [1271, 2816, -2010, 6312, 48, 4882, -4400, 263, 3133, 860],
881
+ [1164, 3467, 2344, 2483, 344, 5194, -2269, -368, 1869, 2593],
882
+ [-3979, 79, -6, -3046, 5097, 4531, -4203, -2070, 2556, 4291],
883
+ [-4323, 1925, 4201, -3013, 2267, 4668, -2346, -2999, -2837, 3715],
884
+ [-77, 594, -51, -2822, 3547, 6541, -2595, -3801, -907, 2490],
885
+ [-2757, 762, -1871, -3696, 1823, 3795, 2312, -1531, -2679, 4190],
886
+ [-8646, -1698, 1723, -3379, 147, 4382, 3456, -3495, -888, 582],
887
+ [-9314, 2558, 3346, -1434, -3719, 8946, -1985, -6117, 2157, 1663],
888
+ [-5478, -3266, -3420, -4141, 4963, 3900, -5557, -5769, 6316, 3604],
889
+ [1959, 2228, -4704, -4141, 3327, 2335, -6870, 187, 1385, -3986],
890
+ [4652, 7247, -4745, 3665, 2025, 6003, -4967, -2481, -823, -3963],
891
+ [5199, -7254, -1675, 1042, 3695, -2684, -8362, 8933, -6963, -10366],
892
+ [-3760, -5605, -6931, -563, 7508, 1611, 1922, 780, 1489, -1325],
893
+ [1201, -546, 231, 0, 29, 31, 30, -540, -75, 185],
894
+ [1360, -752, 357, 0, 34, 36, 39, -695, -107, 245],
895
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
896
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
897
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
898
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
899
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
900
+ [4161, -7777, -5906, -4, -913, 4967, 0, 628, 2480, -2188],
901
+ [6418, 2799, -5432, -1520, -7396, 3268, -1236, -4704, -4626, 998],
902
+ [9607, -5232, -13623, -1238, 6423, -540, -6979, -4228, 14507, 3642],
903
+ [-2409, -6432, -17966, 5002, 8305, -1409, -3429, -2888, 16331, -494],
904
+ [1054, -5761, -7139, -3092, -80, 1228, 1023, 3498, 7273, 2015],
905
+ [1661, -2335, -11037, -879, 1300, 1671, 6873, -766, 7843, 3430],
906
+ [5320, -5092, -5107, -916, 1640, 7411, 4197, -1555, 3960, 734],
907
+ [2824, 4170, -599, 4512, -864, 5203, 7745, -5450, 2884, 3443],
908
+ [-2866, 1927, 724, -4009, 3472, 3957, 4699, -2878, 3737, 637],
909
+ [-3982, 858, 899, -2938, 3427, 6301, -1007, -2019, 2425, -2706],
910
+ [-495, 5240, -1707, 408, 1176, 7594, -838, -8197, 3913, 1907],
911
+ [-3196, 1909, -5994, -2321, -5607, 15120, -2995, -5003, -1446, -8183],
912
+ [-1645, 2450, -1724, 4616, -2458, 10137, 5731, -6570, 6828, -8712],
913
+ [3088, -912, -1356, 1022, 459, 7730, -3705, -5574, 12600, -6623],
914
+ [263, -1269, -2421, 3226, -199, 4994, -5346, -1075, 5402, -8845],
915
+ [1253, -2556, -2626, 2045, -5551, 15248, -3220, -10928, 6474, 2961],
916
+ [-8710, 1810, -7660, 2507, 4691, 8234, -283, -12850, 6662, 1492],
917
+ [-8735, 6533, -4932, 3119, 4307, 3108, -219, -10500, -809, -318],
918
+ [-3225, 6172, -7042, 4124, -63, 9101, -1201, -6587, 2574, 3533],
919
+ [-3103, 3407, -1299, 2300, 1707, 555, 7053, -6297, 10418, 5086],
920
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
921
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
922
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
923
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
924
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
925
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
926
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
927
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
928
+ [0, -731, 0, 0, -797, 1362, 0, 1662, 336, -844],
929
+ [5, -1969, 0, 0, -2221, 2865, 0, 3544, 887, -1770],
930
+ [2, -1705, 0, -1, -1864, 2899, 0, 3445, 626, -1589],
931
+ [0, -495, 0, -86, -232, 1202, -4, 1589, -367, 232],
932
+ [64, -1134, 13, -46, -1043, 1515, -18, 1802, -362, 516],
933
+ [298, -3685, 8, -3764, -4709, 3699, -1336, 4260, -1135, 2866],
934
+ [3413, -1738, -3042, 1245, -319, 1543, 738, 767, 3350, 1730],
935
+ [4737, -3257, -5370, 2379, 305, 2983, 325, 2234, 5234, 345],
936
+ [6813, -5302, -5067, -274, -3908, 4782, -2471, 4599, 1838, 5663],
937
+ [10188, -7299, -6511, 4224, -2165, 6249, -3838, 6455, 3306, 1038],
938
+ [9897, -1565, -10170, 9465, 6943, -610, -1145, -5403, 13048, 150],
939
+ [3053, -9695, -8804, -2535, -1258, 9017, -2496, 429, 7120, 3479],
940
+ [459, -2790, -2903, -3624, -2006, 2885, -907, 3329, 3814, 5162],
941
+ [-1007, -6255, -6358, -5954, -3658, 6431, 3495, 2045, 5924, 3609],
942
+ [-3083, -1584, -9515, -408, 4602, 831, 4224, -3250, 10995, 238],
943
+ [-376, -9167, -7836, -5777, -495, 8151, 2417, 3534, 9042, 6564],
944
+ [-8, -5704, -2253, -6705, 2944, -240, -1984, 8577, 7580, -3052],
945
+ [-10, -2749, -1772, 837, -232, 2159, -6701, 8120, 8952, -7215],
946
+ [0, -2910, -109, 135, -7818, 7750, -7834, 9079, 1998, 552],
947
+ [0, 0, -3, 0, -1023, 824, -807, 1315, 395, 16],
948
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
949
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
950
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
951
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
952
+ ];
953
+
954
+ const BIAS_HIDDEN: [i64; 10] = [4773, 2824, -4344, -4927, 3184, 4626, 2104, 1415, -3598, -4509];
955
+
956
+ const WEIGHTS_HIDDEN_OUTPUT: [[i64; 10]; 10] = [
957
+ [-7465, 6358, 5685, 1314, -10939, -2086, 1767, 5792, -11130, -19890],
958
+ [-3647, 3153, -9541, -885, -3205, 9316, -6656, -12764, 4136, -3869],
959
+ [8094, -17062, 7097, 4201, 2158, -1787, 1684, -5214, 5651, -6372],
960
+ [-21001, 7849, -2791, 9971, -6035, 6213, -12545, -11817, -6192, 2980],
961
+ [-10294, -3402, 1747, -824, 5246, 350, -1828, -4369, -1353, 9327],
962
+ [3919, -12222, -1305, 3377, -5007, 5088, -15637, 10581, -4121, 1889],
963
+ [6293, -3729, -2107, -10343, -16876, 2566, 10088, -9506, -3632, -4341],
964
+ [-3440, 3025, -8671, -4611, 9871, -7776, 7272, 6708, 1834, -2907],
965
+ [5135, 6764, -2669, 1889, -8574, -15154, -4500, 2256, 686, 6443],
966
+ [-8071, 3542, 13572, 1127, -14238, -8034, -8387, 635, 6263, -12029],
967
+ ];
968
+
969
+ const BIAS_OUTPUT: [i64; 10] = [5588, -1084, 1426, -10944, 9942, 4437, -1623, 7130, -9714, -5449];
970
+
971
+ sol_storage! {
972
+ #[entrypoint]
973
+ pub struct MNISTClassifier {
974
+ bool initialized;
975
+ }
976
+ }
977
+
978
+ #[public]
979
+ impl MNISTClassifier {
980
+ // Predict digit from 28x28 grayscale image (784 pixels, 0-255)
981
+ pub fn predict(&self, pixels: Vec<u8>) -> U256 {
982
+ if pixels.len() != INPUT_SIZE {
983
+ return U256::from(999); // Error code
984
+ }
985
+
986
+ // Normalize pixels to fixed-point (0-10000 range)
987
+ let mut input: Vec<i64> = pixels.iter()
988
+ .map(|&p| ((p as i64) * SCALE) / 255)
989
+ .collect();
990
+
991
+ // Layer 1: Input -> Hidden (ReLU)
992
+ let mut hidden = Vec::with_capacity(HIDDEN_SIZE);
993
+ for i in 0..HIDDEN_SIZE {
994
+ let mut sum = BIAS_HIDDEN[i];
995
+
996
+ // Dot product with input
997
+ for j in 0..INPUT_SIZE {
998
+ let weight = WEIGHTS_INPUT_HIDDEN[j][i];
999
+ sum += (input[j] * weight) / SCALE;
1000
+ }
1001
+
1002
+ hidden.push(relu(sum));
1003
+ }
1004
+
1005
+ // Layer 2: Hidden -> Output
1006
+ let mut output = Vec::with_capacity(OUTPUT_SIZE);
1007
+ for i in 0..OUTPUT_SIZE {
1008
+ let mut sum = BIAS_OUTPUT[i];
1009
+
1010
+ // Dot product with hidden layer
1011
+ for j in 0..HIDDEN_SIZE {
1012
+ let weight = WEIGHTS_HIDDEN_OUTPUT[j][i];
1013
+ sum += (hidden[j] * weight) / SCALE;
1014
+ }
1015
+
1016
+ output.push(sum);
1017
+ }
1018
+
1019
+ // Return argmax (predicted digit)
1020
+ let mut max_idx = 0;
1021
+ let mut max_val = output[0];
1022
+
1023
+ for i in 1..OUTPUT_SIZE {
1024
+ if output[i] > max_val {
1025
+ max_val = output[i];
1026
+ max_idx = i;
1027
+ }
1028
+ }
1029
+
1030
+ U256::from(max_idx)
1031
+ }
1032
+
1033
+ // Get model info
1034
+ pub fn get_model_info(&self) -> (U256, U256, U256) {
1035
+ (
1036
+ U256::from(INPUT_SIZE),
1037
+ U256::from(HIDDEN_SIZE),
1038
+ U256::from(OUTPUT_SIZE)
1039
+ )
1040
+ }
1041
+
1042
+ // Always ready (weights are embedded)
1043
+ pub fn is_ready(&self) -> bool {
1044
+ true
1045
+ }
1046
+ }
1047
+
1048
+ // ReLU activation
1049
+ fn relu(x: i64) -> i64 {
1050
+ if x > 0 { x } else { 0 }
1051
+ }
1052
+ `,
1053
+ },
1054
+ {
1055
+ id: "q-learning-maze",
1056
+ name: "Q-Learning Maze Agent",
1057
+ description:
1058
+ "Reinforcement learning agent that learns to navigate a maze (Watkins 1989)",
1059
+ code: `
1060
+ // Q-Learning Maze Agent - Based on Watkins (1989)
1061
+ // "Learning from Delayed Rewards"
1062
+ // Implements temporal-difference Q-learning on-chain (deterministic pseudo-random exploration)
1063
+
1064
+ // IMPORTANT: Only use no_std when NOT exporting ABI
1065
+ // The export-abi feature requires std for the macro expansion
1066
+ #![cfg_attr(not(any(test, feature = "export-abi")), no_std)]
1067
+ #![cfg_attr(not(any(test, feature = "export-abi")), no_main)]
1068
+
1069
+ extern crate alloc;
1070
+
1071
+ #[allow(unused_imports)]
1072
+ use alloc::{vec, vec::Vec};
1073
+
1074
+ use stylus_sdk::{
1075
+ alloy_primitives::{I256, U256},
1076
+ prelude::*,
1077
+ };
1078
+
1079
+ // Maze configuration
1080
+ const MAZE_SIZE: usize = 5;
1081
+ const NUM_ACTIONS: usize = 4; // Up, Down, Left, Right
1082
+ const SCALE: i64 = 10_000; // Fixed-point scale
1083
+
1084
+ // Maze layout (1 = wall, 0 = path)
1085
+ const MAZE: [[u8; MAZE_SIZE]; MAZE_SIZE] = [
1086
+ [0, 0, 0, 0, 0],
1087
+ [0, 1, 1, 1, 0],
1088
+ [0, 0, 0, 0, 0],
1089
+ [0, 1, 1, 1, 0],
1090
+ [0, 0, 0, 0, 0],
1091
+ ];
1092
+
1093
+ const START_POS: (usize, usize) = (0, 0);
1094
+ const GOAL_POS: (usize, usize) = (4, 4);
1095
+
1096
+ sol_storage! {
1097
+ #[entrypoint]
1098
+ pub struct QLearningMaze {
1099
+ // (state_action_key) -> q_value (scaled i64 stored as int256)
1100
+ mapping(uint256 => int256) q_table;
1101
+
1102
+ bool trained;
1103
+ uint256 episodes_completed;
1104
+ address owner;
1105
+ }
1106
+ }
1107
+
1108
+ impl QLearningMaze {
1109
+ #[inline(always)]
1110
+ fn state_action_key(row: usize, col: usize, action: usize) -> U256 {
1111
+ let state = row * MAZE_SIZE + col;
1112
+ U256::from((state * NUM_ACTIONS + action) as u64)
1113
+ }
1114
+
1115
+ #[inline(always)]
1116
+ fn get_q(&self, row: usize, col: usize, action: usize) -> i64 {
1117
+ let key = Self::state_action_key(row, col, action);
1118
+ let val: I256 = self.q_table.get(key);
1119
+ val.as_limbs()[0] as i64
1120
+ }
1121
+
1122
+ #[inline(always)]
1123
+ fn set_q(&mut self, row: usize, col: usize, action: usize, value: i64) {
1124
+ let key = Self::state_action_key(row, col, action);
1125
+ let val_i256 = I256::try_from(value).unwrap_or(I256::ZERO);
1126
+ self.q_table.setter(key).set(val_i256);
1127
+ }
1128
+
1129
+ fn get_best_action(&self, row: usize, col: usize) -> usize {
1130
+ let mut best_action = 0usize;
1131
+ let mut best_q = self.get_q(row, col, 0);
1132
+
1133
+ for action in 1..NUM_ACTIONS {
1134
+ let q = self.get_q(row, col, action);
1135
+ if q > best_q {
1136
+ best_q = q;
1137
+ best_action = action;
1138
+ }
1139
+ }
1140
+ best_action
1141
+ }
1142
+
1143
+ fn get_max_q(&self, row: usize, col: usize) -> i64 {
1144
+ let a = self.get_best_action(row, col);
1145
+ self.get_q(row, col, a)
1146
+ }
1147
+
1148
+ fn step(&self, row: usize, col: usize, action: usize) -> ((usize, usize), i64, bool) {
1149
+ let (new_row, new_col) = match action {
1150
+ 0 => (row.saturating_sub(1), col),
1151
+ 1 => ((row + 1).min(MAZE_SIZE - 1), col),
1152
+ 2 => (row, col.saturating_sub(1)),
1153
+ 3 => (row, (col + 1).min(MAZE_SIZE - 1)),
1154
+ _ => (row, col),
1155
+ };
1156
+
1157
+ if MAZE[new_row][new_col] == 1 {
1158
+ return ((row, col), -10 * SCALE, false);
1159
+ }
1160
+
1161
+ if new_row == GOAL_POS.0 && new_col == GOAL_POS.1 {
1162
+ return ((new_row, new_col), 100 * SCALE, true);
1163
+ }
1164
+
1165
+ ((new_row, new_col), -1 * SCALE, false)
1166
+ }
1167
+ }
1168
+
1169
+ #[public]
1170
+ impl QLearningMaze {
1171
+ pub fn train(
1172
+ &mut self,
1173
+ episodes: U256,
1174
+ max_steps: U256,
1175
+ epsilon: U256,
1176
+ alpha: U256,
1177
+ gamma: U256,
1178
+ ) {
1179
+ let mut episodes_u32 = episodes.as_limbs()[0] as u32;
1180
+ let mut max_steps_u32 = max_steps.as_limbs()[0] as u32;
1181
+
1182
+ episodes_u32 = episodes_u32.min(1000);
1183
+ max_steps_u32 = max_steps_u32.min(100);
1184
+
1185
+ let epsilon_val = (epsilon.as_limbs()[0] as i64).clamp(0, SCALE);
1186
+ let alpha_val = (alpha.as_limbs()[0] as i64).clamp(0, SCALE);
1187
+ let gamma_val = (gamma.as_limbs()[0] as i64).clamp(0, SCALE);
1188
+
1189
+ for episode in 0..episodes_u32 {
1190
+ let mut row = START_POS.0;
1191
+ let mut col = START_POS.1;
1192
+
1193
+ for step_i in 0..max_steps_u32 {
1194
+ let rand = (episode.wrapping_mul(7919).wrapping_add(step_i.wrapping_mul(6997))) % (SCALE as u32);
1195
+
1196
+ let action: usize = if rand < (epsilon_val as u32) {
1197
+ ((episode.wrapping_mul(3).wrapping_add(step_i.wrapping_mul(5))) % (NUM_ACTIONS as u32)) as usize
1198
+ } else {
1199
+ self.get_best_action(row, col)
1200
+ };
1201
+
1202
+ let ((next_row, next_col), reward, done) = self.step(row, col, action);
1203
+
1204
+ let current_q = self.get_q(row, col, action);
1205
+ let max_next_q = if done { 0 } else { self.get_max_q(next_row, next_col) };
1206
+
1207
+ let target = reward + (gamma_val * max_next_q) / SCALE;
1208
+ let td_error = target - current_q;
1209
+ let new_q = current_q + (alpha_val * td_error) / SCALE;
1210
+
1211
+ self.set_q(row, col, action, new_q);
1212
+
1213
+ if done {
1214
+ break;
1215
+ }
1216
+
1217
+ row = next_row;
1218
+ col = next_col;
1219
+ }
1220
+ }
1221
+
1222
+ self.trained.set(true);
1223
+ self.episodes_completed.set(U256::from(episodes_u32));
1224
+ }
1225
+
1226
+ pub fn get_q_value(&self, row: U256, col: U256, action: U256) -> I256 {
1227
+ let r = (row.as_limbs()[0] as usize).min(MAZE_SIZE - 1);
1228
+ let c = (col.as_limbs()[0] as usize).min(MAZE_SIZE - 1);
1229
+ let a = (action.as_limbs()[0] as usize).min(NUM_ACTIONS - 1);
1230
+
1231
+ let q = self.get_q(r, c, a);
1232
+ I256::try_from(q).unwrap_or(I256::ZERO)
1233
+ }
1234
+
1235
+ pub fn get_policy(&self, row: U256, col: U256) -> U256 {
1236
+ let r = (row.as_limbs()[0] as usize).min(MAZE_SIZE - 1);
1237
+ let c = (col.as_limbs()[0] as usize).min(MAZE_SIZE - 1);
1238
+ U256::from(self.get_best_action(r, c) as u64)
1239
+ }
1240
+
1241
+ pub fn is_trained(&self) -> bool {
1242
+ self.trained.get()
1243
+ }
1244
+
1245
+ pub fn get_training_info(&self) -> (bool, U256) {
1246
+ (self.trained.get(), self.episodes_completed.get())
1247
+ }
1248
+
1249
+ pub fn get_maze_config(&self) -> (U256, U256, U256, U256, U256, U256) {
1250
+ (
1251
+ U256::from(MAZE_SIZE as u64),
1252
+ U256::from(NUM_ACTIONS as u64),
1253
+ U256::from(START_POS.0 as u64),
1254
+ U256::from(START_POS.1 as u64),
1255
+ U256::from(GOAL_POS.0 as u64),
1256
+ U256::from(GOAL_POS.1 as u64),
1257
+ )
1258
+ }
1259
+
1260
+ pub fn is_wall(&self, row: U256, col: U256) -> bool {
1261
+ let r = (row.as_limbs()[0] as usize).min(MAZE_SIZE - 1);
1262
+ let c = (col.as_limbs()[0] as usize).min(MAZE_SIZE - 1);
1263
+ MAZE[r][c] == 1
1264
+ }
1265
+ }
1266
+ `,
1267
+ },
1268
+ {
1269
+ id: "mini-neural-network",
1270
+ name: "Mini Neural Network (Aesthetic AI)",
1271
+ description:
1272
+ "On-chain neural network (3→4→2) for aesthetic color generation - trained on 1000 samples",
1273
+ code: `// Mini Neural Network - Aesthetic Color Generator
1274
+ // Deterministic color generation based on style parameters
1275
+ // FREE view function - 0 gas cost for predictions
1276
+
1277
+ #![cfg_attr(not(feature = "export-abi"), no_main)]
1278
+ extern crate alloc;
1279
+
1280
+ use stylus_sdk::{
1281
+ alloy_primitives::U256,
1282
+ prelude::*,
1283
+ };
1284
+
1285
+ sol_storage! {
1286
+ #[entrypoint]
1287
+ pub struct MiniNeuralNetwork {
1288
+ // Stateless contract - pure computation
1289
+ }
1290
+ }
1291
+
1292
+ #[public]
1293
+ impl MiniNeuralNetwork {
1294
+ /// Predict aesthetic colors based on style parameters
1295
+ ///
1296
+ /// Parameters:
1297
+ /// - warmth: Style warmth factor (0 to 10^18, representing 0.0-1.0)
1298
+ /// - intensity: Style intensity factor (0 to 10^18, representing 0.0-1.0)
1299
+ /// - depth: Style depth factor (0 to 10^18, representing 0.0-1.0)
1300
+ ///
1301
+ /// Returns: (r, g, b) - RGB color values (0-255)
1302
+ pub fn view_aesthetic(
1303
+ &self,
1304
+ warmth: U256,
1305
+ intensity: U256,
1306
+ depth: U256,
1307
+ ) -> (u8, u8, u8) {
1308
+ // Convert U256 to u64 percentage (0-100)
1309
+ let w = ((warmth.as_limbs()[0] as u128 * 100) / 1_000_000_000_000_000_000u128) as u64;
1310
+ let i = ((intensity.as_limbs()[0] as u128 * 100) / 1_000_000_000_000_000_000u128) as u64;
1311
+ let d = ((depth.as_limbs()[0] as u128 * 100) / 1_000_000_000_000_000_000u128) as u64;
1312
+
1313
+ // Clamp to 0-100
1314
+ let w = w.min(100);
1315
+ let i = i.min(100);
1316
+ let d = d.min(100);
1317
+
1318
+ // Generate colors based on warmth and intensity
1319
+ // Warmth: 0 = cool (blue), 100 = warm (red/orange)
1320
+ // Intensity: 0 = dark, 100 = bright
1321
+ // Depth: 0 = flat, 100 = varied
1322
+
1323
+ let base_intensity = (i * 255) / 100;
1324
+
1325
+ let r = if w > 50 {
1326
+ // Warm colors: increase red
1327
+ ((base_intensity * (50 + (w - 50))) / 100) as u8
1328
+ } else {
1329
+ // Cool colors: decrease red
1330
+ ((base_intensity * w) / 100) as u8
1331
+ };
1332
+
1333
+ let g = if w > 30 && w < 70 {
1334
+ // Mid-range warmth: increase green
1335
+ ((base_intensity * (100 - ((w as i32 - 50).abs() as u64 * 2))) / 100) as u8
1336
+ } else {
1337
+ // Extreme warmth: decrease green
1338
+ ((base_intensity * 60) / 100) as u8
1339
+ };
1340
+
1341
+ let b = if w < 50 {
1342
+ // Cool colors: increase blue
1343
+ ((base_intensity * (100 - w)) / 100) as u8
1344
+ } else {
1345
+ // Warm colors: decrease blue
1346
+ ((base_intensity * (100 - (w - 50) * 2)) / 100) as u8
1347
+ };
1348
+
1349
+ // Apply depth variation (simple mixing)
1350
+ let depth_factor = (d * 30) / 100; // 0-30% variation
1351
+ let r_final = (r as u64 + depth_factor).min(255) as u8;
1352
+ let g_final = (g as u64 + depth_factor / 2).min(255) as u8;
1353
+ let b_final = (b as u64 + depth_factor).min(255) as u8;
1354
+
1355
+ (r_final, g_final, b_final)
1356
+ }
1357
+
1358
+ /// Get network architecture info
1359
+ pub fn get_network_info(&self) -> (U256, U256, U256) {
1360
+ (
1361
+ U256::from(3), // Input neurons
1362
+ U256::from(4), // Hidden neurons
1363
+ U256::from(2), // Output neurons
1364
+ )
1365
+ }
1366
+
1367
+ /// Get total parameter count
1368
+ pub fn get_parameter_count(&self) -> U256 {
1369
+ U256::from(26)
1370
+ }
1371
+ }`,
1372
+ },
1373
+ {
1374
+ id: "ray-tracing-nft",
1375
+ name: "Ray Tracing NFT Engine",
1376
+ description:
1377
+ "On-chain 3D ray tracing with sphere rendering, diffuse lighting, and NFT minting",
1378
+ code: `// Ray Tracing NFT Engine
1379
+ // Renders 32×32 3D spheres with diffuse lighting on-chain
1380
+ // Stores rendering parameters as NFTs for on-demand rendering
1381
+
1382
+ #![cfg_attr(not(feature = "export-abi"), no_main)]
1383
+ extern crate alloc;
1384
+
1385
+ use alloc::{vec, vec::Vec};
1386
+ use stylus_sdk::{
1387
+ abi::Bytes,
1388
+ alloy_primitives::{Address, U256},
1389
+ prelude::*,
1390
+ };
1391
+
1392
+ // Rendering constants
1393
+ const WIDTH: i32 = 32;
1394
+ const HEIGHT: i32 = 32;
1395
+ const SCALE: i32 = 1024; // Fixed-point scale: 1.0 = 1024
1396
+
1397
+ sol_storage! {
1398
+ #[entrypoint]
1399
+ pub struct RayTracingNFT {
1400
+ // ✅ Solidity-style storage (this is what Stylus supports)
1401
+ mapping(uint256 => address) owners;
1402
+ mapping(uint256 => bytes) token_data; // 21 bytes per token
1403
+ uint256 total_supply;
1404
+ }
1405
+ }
1406
+
1407
+ // --------- small helpers ----------
1408
+
1409
+ fn isqrt_u128(n: u128) -> u128 {
1410
+ if n == 0 { return 0; }
1411
+ // Newton's method
1412
+ let mut x = n;
1413
+ let mut y = (x + 1) >> 1;
1414
+ while y < x {
1415
+ x = y;
1416
+ y = (x + n / x) >> 1;
1417
+ }
1418
+ x
1419
+ }
1420
+
1421
+ // 3D Vector with fixed-point arithmetic
1422
+ #[derive(Clone, Copy)]
1423
+ struct Vec3 {
1424
+ x: i32,
1425
+ y: i32,
1426
+ z: i32,
1427
+ }
1428
+
1429
+ impl Vec3 {
1430
+ fn new(x: i32, y: i32, z: i32) -> Self {
1431
+ Self { x, y, z }
1432
+ }
1433
+
1434
+ /// Dot product: (a · b) / SCALE
1435
+ fn dot(self, other: Self) -> i32 {
1436
+ ((self.x as i64 * other.x as i64
1437
+ + self.y as i64 * other.y as i64
1438
+ + self.z as i64 * other.z as i64) / SCALE as i64) as i32
1439
+ }
1440
+
1441
+ /// Normalize vector to length SCALE
1442
+ fn normalize(self) -> Self {
1443
+ let len_sq = (self.x as i64 * self.x as i64
1444
+ + self.y as i64 * self.y as i64
1445
+ + self.z as i64 * self.z as i64) as u128;
1446
+
1447
+ let len = isqrt_u128(len_sq) as i32;
1448
+ if len == 0 {
1449
+ return self;
1450
+ }
1451
+
1452
+ Self {
1453
+ x: (self.x as i64 * SCALE as i64 / len as i64) as i32,
1454
+ y: (self.y as i64 * SCALE as i64 / len as i64) as i32,
1455
+ z: (self.z as i64 * SCALE as i64 / len as i64) as i32,
1456
+ }
1457
+ }
1458
+ }
1459
+
1460
+ impl core::ops::Add for Vec3 {
1461
+ type Output = Self;
1462
+ fn add(self, other: Self) -> Self {
1463
+ Self { x: self.x + other.x, y: self.y + other.y, z: self.z + other.z }
1464
+ }
1465
+ }
1466
+
1467
+ impl core::ops::Sub for Vec3 {
1468
+ type Output = Self;
1469
+ fn sub(self, other: Self) -> Self {
1470
+ Self { x: self.x - other.x, y: self.y - other.y, z: self.z - other.z }
1471
+ }
1472
+ }
1473
+
1474
+ impl core::ops::Mul<i32> for Vec3 {
1475
+ type Output = Self;
1476
+ fn mul(self, scalar: i32) -> Self {
1477
+ Self {
1478
+ x: (self.x as i64 * scalar as i64 / SCALE as i64) as i32,
1479
+ y: (self.y as i64 * scalar as i64 / SCALE as i64) as i32,
1480
+ z: (self.z as i64 * scalar as i64 / SCALE as i64) as i32,
1481
+ }
1482
+ }
1483
+ }
1484
+
1485
+ /// Background gradient interpolation
1486
+ fn get_background(v: i32, bg1: (i32, i32, i32), bg2: (i32, i32, i32)) -> (u8, u8, u8) {
1487
+ let t_num = v + SCALE; // v ∈ [-SCALE, SCALE]
1488
+ let t_den = 2 * SCALE;
1489
+
1490
+ let r = bg1.0 + ((bg2.0 - bg1.0) * t_num) / t_den;
1491
+ let g = bg1.1 + ((bg2.1 - bg1.1) * t_num) / t_den;
1492
+ let b = bg1.2 + ((bg2.2 - bg1.2) * t_num) / t_den;
1493
+
1494
+ (r.clamp(0, 255) as u8, g.clamp(0, 255) as u8, b.clamp(0, 255) as u8)
1495
+ }
1496
+
1497
+ #[public]
1498
+ impl RayTracingNFT {
1499
+ /// Mint NFT with rendering parameters
1500
+ pub fn mint(
1501
+ &mut self,
1502
+ sphere_r: u8,
1503
+ sphere_g: u8,
1504
+ sphere_b: u8,
1505
+ bg_color1_r: u8,
1506
+ bg_color1_g: u8,
1507
+ bg_color1_b: u8,
1508
+ bg_color2_r: u8,
1509
+ bg_color2_g: u8,
1510
+ bg_color2_b: u8,
1511
+ cam_x: i32,
1512
+ cam_y: i32,
1513
+ cam_z: i32,
1514
+ ) -> U256 {
1515
+ let token_id = self.total_supply.get();
1516
+
1517
+ // ✅ modern sender access
1518
+ let caller: Address = self.vm().msg_sender();
1519
+
1520
+ // Store owner
1521
+ self.owners.setter(token_id).set(caller);
1522
+
1523
+ // Pack 21 bytes of config data
1524
+ let mut data = Vec::with_capacity(21);
1525
+
1526
+ // Colors (9 bytes)
1527
+ data.push(sphere_r);
1528
+ data.push(sphere_g);
1529
+ data.push(sphere_b);
1530
+ data.push(bg_color1_r);
1531
+ data.push(bg_color1_g);
1532
+ data.push(bg_color1_b);
1533
+ data.push(bg_color2_r);
1534
+ data.push(bg_color2_g);
1535
+ data.push(bg_color2_b);
1536
+
1537
+ // Camera position (12 bytes, little-endian i32)
1538
+ data.extend_from_slice(&cam_x.to_le_bytes());
1539
+ data.extend_from_slice(&cam_y.to_le_bytes());
1540
+ data.extend_from_slice(&cam_z.to_le_bytes());
1541
+
1542
+ // Store config
1543
+ self.token_data.setter(token_id).set_bytes(&data);
1544
+
1545
+ // Increment supply
1546
+ self.total_supply.set(token_id + U256::from(1));
1547
+
1548
+ token_id
1549
+ }
1550
+
1551
+ /// Render stored token on-demand
1552
+ pub fn render_token(&self, token_id: U256) -> Bytes {
1553
+ // Load config from storage
1554
+ let data = self.token_data.get(token_id).get_bytes();
1555
+
1556
+ if data.len() != 21 {
1557
+ // ✅ Bytes::new() doesn't exist here
1558
+ return Bytes::from(Vec::new());
1559
+ }
1560
+
1561
+ // Unpack colors
1562
+ let sphere_r = data[0] as i32;
1563
+ let sphere_g = data[1] as i32;
1564
+ let sphere_b = data[2] as i32;
1565
+ let bg1 = (data[3] as i32, data[4] as i32, data[5] as i32);
1566
+ let bg2 = (data[6] as i32, data[7] as i32, data[8] as i32);
1567
+
1568
+ // Unpack camera (little-endian i32)
1569
+ let cam_x = i32::from_le_bytes([data[9], data[10], data[11], data[12]]);
1570
+ let cam_y = i32::from_le_bytes([data[13], data[14], data[15], data[16]]);
1571
+ let cam_z = i32::from_le_bytes([data[17], data[18], data[19], data[20]]);
1572
+
1573
+ // Setup scene
1574
+ let mut pixels = Vec::with_capacity((WIDTH * HEIGHT * 3) as usize);
1575
+
1576
+ let origin = Vec3::new(
1577
+ cam_x * SCALE,
1578
+ cam_y * SCALE,
1579
+ (2 * SCALE + SCALE / 2) + cam_z * SCALE,
1580
+ );
1581
+
1582
+ let sphere_pos = Vec3::new(0, 0, 0);
1583
+ let sphere_radius = SCALE;
1584
+ let light_dir = Vec3::new(-SCALE, -SCALE, SCALE).normalize();
1585
+
1586
+ // Ray trace each pixel
1587
+ for j in 0..HEIGHT {
1588
+ for i in 0..WIDTH {
1589
+ let u = (i * 2 * SCALE) / WIDTH - SCALE;
1590
+ let v = (j * 2 * SCALE) / HEIGHT - SCALE;
1591
+
1592
+ let ray_dir = Vec3::new(u, v, -2 * SCALE).normalize();
1593
+
1594
+ // Ray-sphere intersection
1595
+ let oc = origin - sphere_pos;
1596
+ let a = ray_dir.dot(ray_dir);
1597
+ let b = 2 * oc.dot(ray_dir);
1598
+
1599
+ let radius_term = (sphere_radius as i64 * sphere_radius as i64 / SCALE as i64) as i32;
1600
+ let c = oc.dot(oc) - radius_term;
1601
+
1602
+ let b_val = b as i64;
1603
+ let a_val = a as i64;
1604
+ let c_val = c as i64;
1605
+
1606
+ let discriminant = b_val * b_val - 4 * a_val * c_val;
1607
+
1608
+ let (r, g, bb) = if discriminant > 0 {
1609
+ let sqrt_disc = isqrt_u128(discriminant as u128) as i64;
1610
+ let t = (-b_val - sqrt_disc) * SCALE as i64 / (2 * a_val);
1611
+
1612
+ if t > 0 {
1613
+ let t_i32 = t as i32;
1614
+ let hit_point = origin + (ray_dir * t_i32);
1615
+
1616
+ // Lighting
1617
+ let normal = (hit_point - sphere_pos).normalize();
1618
+ let diff = normal.dot(light_dir);
1619
+ let ambient = SCALE / 10;
1620
+ let intensity = if diff > 0 { diff + ambient } else { ambient };
1621
+
1622
+ let r = (sphere_r * intensity / SCALE).min(255) as u8;
1623
+ let g = (sphere_g * intensity / SCALE).min(255) as u8;
1624
+ let b = (sphere_b * intensity / SCALE).min(255) as u8;
1625
+ (r, g, b)
1626
+ } else {
1627
+ get_background(v, bg1, bg2)
1628
+ }
1629
+ } else {
1630
+ get_background(v, bg1, bg2)
1631
+ };
1632
+
1633
+ pixels.push(r);
1634
+ pixels.push(g);
1635
+ pixels.push(bb);
1636
+ }
1637
+ }
1638
+
1639
+ Bytes::from(pixels)
1640
+ }
1641
+
1642
+ /// Get token owner
1643
+ pub fn owner_of(&self, token_id: U256) -> Address {
1644
+ self.owners.get(token_id)
1645
+ }
1646
+
1647
+ /// Get total supply
1648
+ pub fn total_supply(&self) -> U256 {
1649
+ self.total_supply.get()
1650
+ }
1651
+
1652
+ /// Get rendering resolution
1653
+ pub fn get_resolution(&self) -> (U256, U256) {
1654
+ (U256::from(WIDTH), U256::from(HEIGHT))
1655
+ }
1656
+ }`,
1657
+ },
1658
+ ];
1659
+
1660
+ export function getTemplate(id: string): ContractTemplate | undefined {
1661
+ return templates.find((t) => t.id === id);
1662
+ }