File size: 134,547 Bytes
78769cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
[
  {
    "id": "environmental_registry_benchmark_001",
    "pergunta": "Quantos imóveis rurais ativos existem no Mato Grosso do Sul?",
    "sql": "SELECT\n\tCOUNT(*) AS total_imoveis\nFROM\n\tanalise_dados.dim_imovel di\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tdi.ind_tipo_imovel = 'IRU'\n\tAND di.ind_status_imovel = 'AT'\n\tAND de.sigla_uf = 'MS';",
    "dificuldade": "fácil",
    "categorias": [
      "imovel",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_002",
    "pergunta": "Quantas unidades de conservação estão cadastradas no bioma Pantanal?",
    "sql": "SELECT\n\tCOUNT(*) AS total_ucs\nFROM\n\tanalise_dados.dim_unidades_conservacao\nWHERE\n\tUPPER(biomaibge) = 'PANTANAL';",
    "dificuldade": "fácil",
    "categorias": [
      "unidade_conservacao",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_003",
    "pergunta": "Qual a classificação de tamanho mais comum dos imóveis rurais no Rio Grande do Sul?",
    "sql": "SELECT\n\tdi.class_tam_imovel,\n\tCOUNT(*) AS total\nFROM\n\tanalise_dados.dim_imovel di\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tdi.ind_tipo_imovel = 'IRU'\n\tAND de.sigla_uf = 'RS'\nGROUP BY\n\tdi.class_tam_imovel\nORDER BY\n\ttotal DESC\nLIMIT\n\t1;",
    "dificuldade": "fácil",
    "categorias": [
      "imovel",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_004",
    "pergunta": "Quais unidades de conservação de proteção integral existem no bioma Amazônia?",
    "sql": "SELECT\n\tuc.nomeuc\n\t-- uc.siglacateg,\n\t-- uc.esferaadm,\n\t-- uc.areahaalb,\n\t-- uc.criacaoano\nFROM\n\tanalise_dados.dim_unidades_conservacao uc\nWHERE\n\tuc.grupouc = 'PI'\n\tAND UPPER(uc.biomaibge) = 'AMAZÔNIA'\nORDER BY\n\tuc.areahaalb DESC;",
    "dificuldade": "fácil",
    "categorias": [
      "unidade_conservacao",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_005",
    "pergunta": "Quais unidades de conservação (código e nome) estão localizadas no bioma Pantanal?",
    "sql": "SELECT\n\tcnuc,\n\tnomeuc\nFROM\n\tanalise_dados.dim_unidades_conservacao\nWHERE\n\tUPPER(biomaibge) = 'PANTANAL';",
    "dificuldade": "fácil",
    "categorias": [
      "unidade_conservacao",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": true,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_006",
    "pergunta": "Qual a quantidade de embargos em 2022?",
    "sql": "SELECT \n    COUNT(*) AS total_embargos\nFROM dim_embargo\nWHERE TO_TIMESTAMP(dat_embarg, 'DD/MM/YY HH24:MI:SS') >= DATE '2022-01-01'\n  AND TO_TIMESTAMP(dat_embarg, 'DD/MM/YY HH24:MI:SS') < DATE '2023-01-01';",
    "dificuldade": "fácil",
    "categorias": [
      "terra_indigena",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_007",
    "pergunta": "Qual a soma total da área de todos os imóveis rurais ativos cadastrados no CAR?",
    "sql": "SELECT\n\tSUM(di.area_imovel) AS area_total_ha\nFROM\n\tanalise_dados.dim_imovel di\nWHERE\n\tdi.ind_tipo_imovel = 'IRU'\n\tAND di.ind_status_imovel = 'AT';",
    "dificuldade": "fácil",
    "categorias": [
      "imovel"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_008",
    "pergunta": "Qual a área total de unidades de conservação de proteção integral no bioma Amazônia?",
    "sql": "SELECT\n\tSUM(duc.areahaalb) AS area_total_ha\nFROM\n\tanalise_dados.dim_unidades_conservacao duc\nWHERE\n\tduc.grupouc = 'PI'\n\tAND duc.biomaibge = 'AMAZÔNIA';",
    "dificuldade": "fácil",
    "categorias": [
      "unidade_conservacao"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_009",
    "pergunta": "Quantos imóveis rurais não possuem coordenadas de centroide cadastradas?",
    "sql": "SELECT\n\tCOUNT(*) AS total_sem_coordenadas\nFROM\n\tanalise_dados.dim_imovel\nWHERE\n\tind_tipo_imovel = 'IRU'\n\tAND (\n\t\tlat_imovel IS NULL\n\t\tOR long_imovel IS NULL\n\t);",
    "dificuldade": "fácil",
    "categorias": [
      "imovel",
      "qualidade_dados"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_010",
    "pergunta": "Quantas parcelas SIGEF foram submetidas mas ainda não possuem data de aprovação preenchida?",
    "sql": "SELECT\n\tCOUNT(*) AS parcelas_sem_aprovacao\nFROM\n\tanalise_dados.dim_sigef\nWHERE\n\tdata_submissao IS NOT NULL\n\tAND data_aprovacao IS NULL;",
    "dificuldade": "fácil",
    "categorias": [
      "sigef",
      "qualidade_dados"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_011",
    "pergunta": "Qual o percentual de imóveis rurais que não possuem módulo fiscal calculado?",
    "sql": "SELECT\n\tROUND(\n\t\t100.0 * COUNT(*) FILTER (\n\t\t\tWHERE\n\t\t\t\tnum_modulo_fiscal IS NULL\n\t\t) / NULLIF(COUNT(*), 0),\n\t\t2\n\t) AS percentual_sem_modulo\nFROM\n\tanalise_dados.dim_imovel\nWHERE\n\tind_tipo_imovel = 'IRU';",
    "dificuldade": "fácil",
    "categorias": [
      "imovel",
      "qualidade_dados"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_012",
    "pergunta": "Quantos registros de desmatamento existem no total e quantos possuem coordenadas de latitude e longitude preenchidas? Me dê o total, com latitude e com longitude.",
    "sql": "SELECT\n\tCOUNT(*) AS total_registros,\n\tCOUNT(latitude_desmatamento) AS com_latitude,\n\tCOUNT(longitude_desmatamento) AS com_longitude\nFROM\n\tanalise_dados.fato_desmatamento;",
    "dificuldade": "fácil",
    "categorias": [
      "desmatamento",
      "qualidade_dados"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_013",
    "pergunta": "Qual a área total da terra indígena Yanomami?",
    "sql": "SELECT\n\tterrai_nom,\n\tarea_ti_total\nFROM\n\tanalise_dados.dim_terra_indigena\nWHERE\n\tterrai_nom ILIKE '%Yanomami%';",
    "dificuldade": "fácil",
    "categorias": [
      "terra_indigena"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_014",
    "pergunta": "Quantas unidades de conservação de proteção integral existem por bioma?",
    "sql": "SELECT\n\tbiomaibge AS bioma,\n\tCOUNT(*) AS total_ucs\nFROM\n\tanalise_dados.dim_unidades_conservacao\nWHERE\n\tgrupouc = 'PI'\nGROUP BY\n\tbiomaibge\nORDER BY\n\ttotal_ucs DESC;",
    "dificuldade": "fácil",
    "categorias": [
      "unidade_conservacao"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_015",
    "pergunta": "Qual a área total de Reservas Extrativistas na Amazônia?",
    "sql": "SELECT\n\tSUM(areahaalb) AS area_total_ha\nFROM\n\tanalise_dados.dim_unidades_conservacao\nWHERE\n\tsiglacateg = 'RESEX'\n\tAND biomaibge = 'AMAZÔNIA';",
    "dificuldade": "fácil",
    "categorias": [
      "unidade_conservacao"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_016",
    "pergunta": "Qual a área total de terras indígenas homologadas comparada com as regularizadas?",
    "sql": "SELECT\n\tfase_ti,\n\t-- COUNT(*) AS total_tis,\n\tSUM(area_ti_total) AS area_total_ha\nFROM\n\tanalise_dados.dim_terra_indigena\nWHERE\n\tfase_ti IN ('Homologada', 'Regularizada')\nGROUP BY\n\tfase_ti\nORDER BY\n\tarea_total_ha DESC;",
    "dificuldade": "fácil",
    "categorias": [
      "terra_indigena"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_017",
    "pergunta": "Quantos Parques Nacionais existem por bioma e qual sua área total?",
    "sql": "SELECT\n\tbiomaibge AS bioma,\n\tCOUNT(*) AS total_parnas,\n\tSUM(areahaalb) AS area_total_ha\nFROM\n\tanalise_dados.dim_unidades_conservacao\nWHERE\n\tsiglacateg = 'PARNA'\nGROUP BY\n\tbiomaibge\nORDER BY\n\tarea_total_ha DESC;",
    "dificuldade": "fácil",
    "categorias": [
      "unidade_conservacao"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_018",
    "pergunta": "Quantos imóveis rurais ativos existem na região Norte do Brasil?",
    "sql": "SELECT\n\tCOUNT(*) AS total_imoveis\nFROM\n\tanalise_dados.dim_imovel i\n\tJOIN analise_dados.dim_estado e ON i.cod_uf = e.cod_uf\nWHERE\n\ti.ind_tipo_imovel = 'IRU'\n\tAND i.ind_status_imovel = 'AT'\n\tAND e.sigla_uf IN ('AC', 'AM', 'AP', 'PA', 'RO', 'RR', 'TO');",
    "dificuldade": "fácil",
    "categorias": [
      "imovel",
      "região"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_019",
    "pergunta": "Qual a área total de Terras Indígenas na região Sudeste?",
    "sql": "SELECT\n\tSUM(fa.superficie) AS area_total_ti_ha\nFROM\n\tanalise_dados.fato_area_indigena fa\nWHERE\n\tfa.uf_sigla IN ('SP', 'MG', 'RJ', 'ES');",
    "dificuldade": "fácil",
    "categorias": [
      "terra_indigena",
      "região"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_020",
    "pergunta": "Qual foi o desmatamento total (em hectares) por ano no bioma Amazônia?",
    "sql": "SELECT\n    fd.ano_desmatamento::int AS ano,\n    SUM(fd.area_desmatada) AS total_desmatado_ha\nFROM analise_dados.fato_desmatamento fd\nWHERE\n    fd.bioma = 'Amazônia'\n    AND fd.ano_desmatamento IS NOT NULL\nGROUP BY\n    fd.ano_desmatamento\nORDER BY\n    ano;",
    "dificuldade": "fácil",
    "categorias": [
      "temporal",
      "desmatamento"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_021",
    "pergunta": "Liste todas as unidades de conservação federais da Região Sul, ordenadas por área do maior para o menor. ",
    "sql": "SELECT\n  uc.nomeuc,\n  -- uc.siglacateg,\n  -- uc.grupouc,\n  uc.areahaalb\n  -- uc.biomaibge\nFROM analise_dados.dim_unidades_conservacao uc\nWHERE uc.esferaadm = 'Federal'\n  AND EXISTS (\n    SELECT 1\n    FROM analise_dados.dim_estado e\n    WHERE e.sigla_uf IN ('PR', 'SC', 'RS')\n      AND ST_Intersects(uc.geo_uc, e.geo_estado)\n  )\nORDER BY uc.areahaalb DESC;",
    "dificuldade": "médio",
    "categorias": [
      "unidade_conservacao",
      "geografico"
    ],
    "order_matters": true,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_022",
    "pergunta": "Qual o estado da Região Nordeste com maior área total desmatada?",
    "sql": "SELECT\n\tde.nome_uf,\n\tSUM(fd.area_desmatada) AS total_desmatado\nFROM\n\tanalise_dados.fato_desmatamento fd\n\tJOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tde.sigla_uf IN (\n\t\t'AL',\n\t\t'BA',\n\t\t'CE',\n\t\t'MA',\n\t\t'PB',\n\t\t'PE',\n\t\t'PI',\n\t\t'RN',\n\t\t'SE'\n\t)\nGROUP BY\n\tde.nome_uf\nORDER BY\n\ttotal_desmatado DESC\nLIMIT\n\t1;",
    "dificuldade": "médio",
    "categorias": [
      "desmatamento",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_023",
    "pergunta": "Qual a soma de área desmatada nos estados do Centro-Oeste em 2022 em hectares?",
    "sql": "SELECT\n\tSUM(fd.area_desmatada) AS total_desmatado_ha\nFROM\n\tanalise_dados.fato_desmatamento fd\n\tJOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tde.sigla_uf IN ('DF', 'GO', 'MS', 'MT')\n\tAND fd.ano_desmatamento = 2022;",
    "dificuldade": "médio",
    "categorias": [
      "desmatamento",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_024",
    "pergunta": "Quais são os municípios do Maranhão com desmatamento registrado no bioma Cerrado?",
    "sql": "SELECT DISTINCT\n\tdm.mun_nome\nFROM\n\tanalise_dados.fato_desmatamento fd\n\tJOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n\tJOIN analise_dados.dim_municipio dm ON di.cod_mun = CAST(dm.cod_mun AS int4)\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tde.sigla_uf = 'MA'\n\tAND UPPER(fd.bioma) = 'CERRADO'\nORDER BY\n\tdm.mun_nome;",
    "dificuldade": "médio",
    "categorias": [
      "desmatamento",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_025",
    "pergunta": "Qual a área média em hectares dos imóveis rurais por estado da Região Nordeste?",
    "sql": "SELECT\n\tde.nome_uf,\n\t-- de.sigla_uf,\n\tAVG(di.area_imovel) AS area_media_ha\n\t-- COUNT(*) AS total_imoveis\nFROM\n\tanalise_dados.dim_imovel di\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tdi.ind_tipo_imovel = 'IRU'\n\tAND de.sigla_uf IN (\n\t\t'AL',\n\t\t'BA',\n\t\t'CE',\n\t\t'MA',\n\t\t'PB',\n\t\t'PE',\n\t\t'PI',\n\t\t'RN',\n\t\t'SE'\n\t)\nGROUP BY\n\tde.nome_uf,\n\tde.sigla_uf\nORDER BY\n\tarea_media_ha DESC;",
    "dificuldade": "médio",
    "categorias": [
      "imovel",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_026",
    "pergunta": "Quais são os 10 municípios do Mato Grosso com maior área desmatada acumulada em hectares?",
    "sql": "SELECT\n\tdm.mun_nome,\n\tSUM(fd.area_desmatada) AS area_desmatada_total_ha\nFROM\n\tanalise_dados.fato_desmatamento fd\n\tJOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n\tJOIN analise_dados.dim_municipio dm ON di.cod_mun = CAST(dm.cod_mun AS int4)\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tde.sigla_uf = 'MT'\nGROUP BY\n\tdm.mun_nome\nORDER BY\n\tarea_desmatada_total_ha DESC\nLIMIT\n\t10;",
    "dificuldade": "médio",
    "categorias": [
      "desmatamento",
      "geografico"
    ],
    "order_matters": true,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_027",
    "pergunta": "Qual a evolução anual do desmatamento no bioma Cerrado nos estados do Centro-Oeste? Dê a área desmatada em hectáres por ano para cada estado.",
    "sql": "SELECT\n\tfd.ano_desmatamento,\n\tde.sigla_uf,\n\tSUM(fd.area_desmatada) AS area_desmatada_ha\nFROM\n\tanalise_dados.fato_desmatamento fd\n\tJOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n\tJOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n\tde.sigla_uf IN ('DF', 'GO', 'MS', 'MT')\n\tAND UPPER(fd.bioma) = 'CERRADO'\nGROUP BY\n\tfd.ano_desmatamento,\n\tde.sigla_uf\nORDER BY\n\tfd.ano_desmatamento,\n\tde.sigla_uf;",
    "dificuldade": "médio",
    "categorias": [
      "desmatamento",
      "geografico",
      "temporal"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_028",
    "pergunta": "Compare a área total de unidades de conservação de uso sustentável vs. proteção integral no bioma Mata Atlântica, agrupado por esfera administrativa. Me dê a esferaadm,  o nome do grupo (Proteção Integral, Uso Sustentável) e a área total.",
    "sql": "SELECT\n\tuc.esferaadm,\n\t-- uc.grupouc,\n\tCASE\n\t\tWHEN uc.grupouc = 'PI' THEN 'Proteção Integral'\n\t\tELSE 'Uso Sustentável'\n\tEND AS grupo_descricao,\n\t-- COUNT(*) AS total_ucs,\n\tSUM(uc.areahaalb) AS area_total_ha\nFROM\n\tanalise_dados.dim_unidades_conservacao uc\nWHERE\n\tUPPER(uc.biomaibge) = 'MATA ATLÂNTICA'\nGROUP BY\n\tuc.esferaadm,\n\tuc.grupouc\nORDER BY\n\tuc.esferaadm,\n\tuc.grupouc;",
    "dificuldade": "médio",
    "categorias": [
      "unidade_conservacao",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": true,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_029",
    "pergunta": "Calcule a área geográfica real em km2 de cada estado do Nordeste usando a sua geometria espacial. Me dê a sigla, nome e área.",
    "sql": "SELECT\n    sigla_uf,\n    nome_uf,\n    ROUND((ST_Area(geo_estado) / 1000000)::numeric, 2) AS area_km2\nFROM dim_estado\nWHERE sigla_uf IN ('AL', 'BA', 'CE', 'MA', 'PB', 'PE', 'PI', 'RN', 'SE')\nORDER BY sigla_uf;",
    "dificuldade": "médio",
    "categorias": [
      "geoespacial",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": true,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_030",
    "pergunta": "Qual a área média em ha dos CARs classificados como Grande no estado de minas?",
    "sql": "SELECT\n\tAVG(i.area_imovel) AS area_media_hectares\nFROM\n\tdim_imovel i\n\tINNER JOIN dim_estado e ON i.cod_uf = e.cod_uf\nWHERE\n\te.cod_uf = 31\n\tAND i.class_tam_imovel = 'Grande'",
    "dificuldade": "médio",
    "categorias": [
      "imovel"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_031",
    "pergunta": "Quais são os 10 municípios com maior número de imóveis rurais cadastrados?",
    "sql": "SELECT \n    m.mun_nome AS municipio,\n    COUNT(*) AS numero_imoveis\nFROM analise_dados.dim_imovel i\nINNER JOIN analise_dados.dim_municipio m ON i.cod_mun = m.cod_mun\nWHERE i.ind_tipo_imovel = 'IRU'\nGROUP BY m.mun_nome\nORDER BY numero_imoveis DESC\nLIMIT 10",
    "dificuldade": "médio",
    "categorias": [
      "imovel"
    ],
    "order_matters": true,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_032",
    "pergunta": "Qual o bioma com maior área desmatada acumulada nos últimos 5 anos (2019 a 2023)?",
    "sql": "SELECT\n    fd.bioma,\n    SUM(fd.area_desmatada) AS area_total_desmatada_ha\nFROM\n    analise_dados.fato_desmatamento fd\nWHERE\n    fd.ano_desmatamento >= 2019\n    AND fd.ano_desmatamento <= 2023\nGROUP BY\n    fd.bioma\nORDER BY\n    area_total_desmatada_ha DESC\nLIMIT\n    1;",
    "dificuldade": "médio",
    "categorias": [
      "desmatamento",
      "temporal"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_033",
    "pergunta": "Quantos eventos de desmatamento foram registrados por ano nos imóveis rurais?",
    "sql": "SELECT\n    fd.ano_desmatamento,\n    COUNT(*) AS total_eventos\nFROM\n    analise_dados.fato_desmatamento fd\n    INNER JOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\nWHERE\n    di.ind_tipo_imovel = 'IRU'\nGROUP BY\n    fd.ano_desmatamento\nORDER BY\n    fd.ano_desmatamento;",
    "dificuldade": "médio",
    "categorias": [
      "desmatamento",
      "temporal"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_034",
    "pergunta": "Qual a distribuição dos índices de similaridade Jaccard entre parcelas SIGEF e imóveis CAR por faixa percentual no Sul do Brasil? Eu quero a faixa percentual, o totals de pares e o jaccard médio.",
    "sql": "SELECT\n    fss.faixa_percent_similaridade AS faixa_percentual,\n    COUNT(*) AS total_pares,\n    ROUND(AVG(fss.indice_jaccard), 4) AS jaccard_medio\nFROM fato_similaridade_sigef fss\nJOIN dim_imovel di ON fss.cod_imovel = di.cod_imovel\nJOIN dim_estado de ON di.cod_uf = de.cod_uf\nWHERE de.sigla_uf IN ('PR', 'SC', 'RS')\nGROUP BY fss.faixa_percent_similaridade\nORDER BY\n    CASE fss.faixa_percent_similaridade\n        WHEN '0-25%' THEN 1\n        WHEN '25-50%' THEN 2\n        WHEN '50-75%' THEN 3\n        WHEN '75-100%' THEN 4\n    END;",
    "dificuldade": "médio",
    "categorias": [
      "sigef"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_035",
    "pergunta": "Quais são os 10 municípios (nome e área) com maior área total de imóveis rurais cadastrados? Maior para menor.",
    "sql": "SELECT\n    dm.mun_nome,\n    SUM(di.area_imovel) AS area_total_ha\nFROM\n    analise_dados.dim_imovel di\n    JOIN analise_dados.dim_municipio dm ON di.cod_mun = CAST(dm.cod_mun AS int4)\nWHERE\n    di.ind_tipo_imovel = 'IRU'\nGROUP BY\n    dm.mun_nome\nORDER BY\n    area_total_ha DESC\nLIMIT\n    10;",
    "dificuldade": "médio",
    "categorias": [
      "imovel"
    ],
    "order_matters": true,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_036",
    "pergunta": "Quantos embargos ambientais foram registrados por motivo de desmatamento ou queimada no ano de 2022?",
    "sql": "SELECT\n    COUNT(id_embargo) AS total_embargos\nFROM\n    analise_dados.dim_embargo\nWHERE\n    sit_desmat = 'D'\n    AND EXTRACT(\n        YEAR\n        FROM\n            TO_DATE (dat_embarg, 'DD/MM/YY HH24:MI:SS')\n    ) = 2022;",
    "dificuldade": "médio",
    "categorias": [
      "embargo",
      "temporal"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_037",
    "pergunta": "Determine a proporção de imóveis rurais classificados como Médios ou Grandes (via CAR) que possuem índice de similaridade de Jaccard no SIGEF entre 0.9 e 1.0.",
    "sql": "WITH total_imoveis AS (\n    SELECT COUNT(DISTINCT cod_imovel) as total_médio_grande\n    FROM analise_dados.dim_imovel\n    WHERE ind_tipo_imovel = 'IRU'\n      AND class_tam_imovel IN ('Médio', 'Grande')\n),\nimoveis_com_alta_similaridade AS (\n    SELECT COUNT(DISTINCT fs.cod_imovel) as com_alta_similaridade\n    FROM analise_dados.fato_similaridade_sigef fs\n    INNER JOIN analise_dados.dim_imovel di ON fs.cod_imovel = di.cod_imovel\n    WHERE di.ind_tipo_imovel = 'IRU'\n      AND di.class_tam_imovel IN ('Médio', 'Grande')\n      AND fs.indice_jaccard BETWEEN 0.9 AND 1.0\n)\nSELECT \n    -- t.total_médio_grande,\n    -- i.com_alta_similaridade,\n    CASE \n        WHEN t.total_médio_grande > 0 \n        THEN ROUND((i.com_alta_similaridade::numeric / t.total_médio_grande) * 100, 2)\n        ELSE 0\n    END as proporcao_percentual\nFROM total_imoveis t\nCROSS JOIN imoveis_com_alta_similaridade i",
    "dificuldade": "médio",
    "categorias": [
      "imovel",
      "sigef"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_038",
    "pergunta": "Qual a proporção de parcelas SIGEF que possuem matrícula registrada versus as que não possuem, por status? Dê os valores absolutos e porcentuais dos dados para melhor visualização.",
    "sql": "SELECT \n    status,\n    COUNT(*) AS total_parcelas,\n    SUM(CASE WHEN registro_matricula = TRUE THEN 1 ELSE 0 END) AS com_matricula,\n    SUM(CASE WHEN registro_matricula = FALSE THEN 1 ELSE 0 END) AS sem_matricula,\n    ROUND(100.0 * SUM(CASE WHEN registro_matricula = TRUE THEN 1 ELSE 0 END) / COUNT(*), 2) AS proporcao_com_matricula_pct,\n    ROUND(100.0 * SUM(CASE WHEN registro_matricula = FALSE THEN 1 ELSE 0 END) / COUNT(*), 2) AS proporcao_sem_matricula_pct\nFROM dim_sigef\nGROUP BY status\nORDER BY status;",
    "dificuldade": "médio",
    "categorias": [
      "sigef",
      "qualidade_dados"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_039",
    "pergunta": "Por estado, quantos imóveis rurais possuem geometria e quantos não possuem? Mostre o percentual de completude.",
    "sql": "SELECT\n    de.sigla_uf,\n    COUNT(*) AS total_imoveis,\n    COUNT(di.geo_imovel) AS com_geometria,\n    COUNT(*) - COUNT(di.geo_imovel) AS sem_geometria,\n    ROUND(\n        100.0 * COUNT(di.geo_imovel) / NULLIF(COUNT(*), 0),\n        2\n    ) AS percentual_completude\nFROM\n    analise_dados.dim_imovel di\n    JOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n    di.ind_tipo_imovel = 'IRU'\nGROUP BY\n    de.sigla_uf\nORDER BY\n    percentual_completude ASC;",
    "dificuldade": "médio",
    "categorias": [
      "imovel",
      "qualidade_dados"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_040",
    "pergunta": "Qual a área total em hectares das unidades de conservação por esfera administrativa, ignorando aquelas que não possuem área oficial preenchida?",
    "sql": "SELECT\n    esferaadm,\n    SUM(areahaalb) AS area_total_ha\nFROM\n    analise_dados.dim_unidades_conservacao\nWHERE\n    areahaalb IS NOT NULL\nGROUP BY\n    esferaadm;",
    "dificuldade": "médio",
    "categorias": [
      "unidade_conservacao",
      "qualidade_dados"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_041",
    "pergunta": "Quais as 10 terras indígenas com o maior número de CARs distintos sobrepostos? Maior para menor.",
    "sql": "SELECT\n  -- ti.terrai_cod,\n  ti.terrai_nom AS nome_terra_indigena,\n  COUNT(DISTINCT f.cod_imovel) AS numero_imoveis_sobrepostos\nFROM fato_sobreposicao_terra_indigena f\nJOIN dim_terra_indigena ti\n  ON f.terrai_cod = ti.terrai_cod\nGROUP BY\n  ti.terrai_cod,\n  ti.terrai_nom\nORDER BY\n  numero_imoveis_sobrepostos DESC,\n  ti.terrai_nom ASC\nLIMIT 10;\n",
    "dificuldade": "médio",
    "categorias": [
      "terra_indigena",
      "sobreposicao"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_042",
    "pergunta": "Qual o ranking dos 10 imóveis com o maior número de embargos distintos associados?",
    "sql": "SELECT fse.cod_imovel,\n       COUNT(DISTINCT fse.id_embargo) AS total_embargos\nFROM analise_dados.fato_sobreposicao_embargo fse\nGROUP BY fse.cod_imovel\nORDER BY total_embargos DESC\nLIMIT 10;",
    "dificuldade": "médio",
    "categorias": [
      "embargo",
      "sobreposicao"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_043",
    "pergunta": "Qual a distribuição de assentamentos por região do Brasil? Coloque os assentamentos sem região em duas categorias: Código de UF inválido e UF não informada",
    "sql": "WITH\n  regiao_map AS (\n    SELECT\n      sigla_uf,\n      CASE\n        WHEN sigla_uf IN ('AC', 'AP', 'AM', 'PA', 'RO', 'RR', 'TO') THEN 'Norte'\n        WHEN sigla_uf IN (\n          'AL',\n          'BA',\n          'CE',\n          'MA',\n          'PB',\n          'PE',\n          'PI',\n          'RN',\n          'SE'\n        ) THEN 'Nordeste'\n        WHEN sigla_uf IN ('DF', 'GO', 'MT', 'MS') THEN 'Centro-Oeste'\n        WHEN sigla_uf IN ('ES', 'MG', 'RJ', 'SP') THEN 'Sudeste'\n        WHEN sigla_uf IN ('PR', 'RS', 'SC') THEN 'Sul'\n      END AS regiao\n    FROM\n      dim_estado\n  )\nSELECT\n  COALESCE(\n    r.regiao,\n    CASE\n      WHEN a.uf IS NULL THEN 'UF não informada'\n      ELSE 'Código de UF inválido'\n    END\n  ) AS regiao,\n  COUNT(*) AS total_assentamentos\nFROM\n  dim_assentamento a\n  LEFT JOIN regiao_map r ON UPPER(a.uf) = r.sigla_uf\nGROUP BY\n  COALESCE(\n    r.regiao,\n    CASE\n      WHEN a.uf IS NULL THEN 'UF não informada'\n      ELSE 'Código de UF inválido'\n    END\n  )\nORDER BY\n  total_assentamentos DESC;",
    "dificuldade": "médio",
    "categorias": [
      "assentamento",
      "região"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_044",
    "pergunta": "Qual a gleba federal com mais imóveis rurais sobrepostos?",
    "sql": "SELECT\n    tu.nome_gleba,\n    -- tu.area_tu,\n    COUNT(DISTINCT ft.cod_imovel) AS total_imoveis\nFROM\n    analise_dados.fato_imovel_terra_uniao ft\n    JOIN analise_dados.dim_terra_uniao tu ON ft.id_tu = tu.id_tu\n    JOIN analise_dados.dim_imovel i ON ft.cod_imovel = i.cod_imovel\nWHERE\n    i.ind_tipo_imovel = 'IRU'\nGROUP BY\n    tu.nome_gleba,\n    tu.area_tu\nORDER BY\n    total_imoveis DESC\nLIMIT\n    1;",
    "dificuldade": "médio",
    "categorias": [
      "terra_uniao",
      "sobreposição"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_045",
    "pergunta": "Quais as 10 unidades de conservação de proteção integral com o maior número de imóveis sobrepostos?",
    "sql": "SELECT\n    duc.nomeuc,\n    -- duc.siglacateg,\n    COUNT(DISTINCT fsuc.cod_imovel) AS total_imoveis_sobrepostos\nFROM\n    analise_dados.fato_sobreposicao_unidades_conservacao fsuc\n    JOIN analise_dados.dim_unidades_conservacao duc ON fsuc.cnuc = duc.cnuc\nWHERE\n    duc.grupouc = 'PI'\nGROUP BY\n    duc.nomeuc,\n    duc.siglacateg\nORDER BY\n    total_imoveis_sobrepostos DESC\nLIMIT\n    10;",
    "dificuldade": "médio",
    "categorias": [
      "unidade_conservacao",
      "sobreposicao"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_046",
    "pergunta": "Quantos imóveis rurais ativos existem em cada estado, mostrando o nome completo do estado? Do maior para menor",
    "sql": "SELECT\n    de.nome_uf,\n    COUNT(di.cod_imovel) AS total_imoveis\nFROM\n    analise_dados.dim_imovel di\n    JOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n    di.ind_tipo_imovel = 'IRU'\n    AND di.ind_status_imovel = 'AT'\nGROUP BY\n    de.nome_uf\nORDER BY\n    total_imoveis DESC;",
    "dificuldade": "médio",
    "categorias": [
      "imovel"
    ],
    "order_matters": true,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_047",
    "pergunta": "Qual a área total desmatada por ano, considerando apenas imóveis rurais no bioma Cerrado?",
    "sql": "SELECT \n    CAST(fd.ano_desmatamento AS INTEGER) as ano,\n    SUM(fd.area_desmatada) as area_total_desmatada_hectares\nFROM analise_dados.fato_desmatamento fd\nINNER JOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\nWHERE fd.bioma = 'Cerrado'\n  AND di.ind_tipo_imovel = 'IRU'\nGROUP BY fd.ano_desmatamento\nORDER BY ano;",
    "dificuldade": "médio",
    "categorias": [
      "desmatamento",
      "temporal"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_048",
    "pergunta": "Quantos embargos por desmatamento estão sobrepostos a imóveis rurais grandes, e qual a área total de sobreposição?",
    "sql": "SELECT\n  COUNT(DISTINCT fse.id_embargo) AS qtd_embargos,\n  SUM(fse.area_embar_car) AS area_total_sobreposicao\nFROM\n  fato_sobreposicao_embargo fse\n  JOIN dim_embargo de ON fse.id_embargo = de.id_embargo\n  JOIN dim_imovel di ON fse.cod_imovel = di.cod_imovel\nWHERE\n  de.sit_desmat = 'D'\n  AND di.class_tam_imovel = 'Grande'\n  AND di.ind_tipo_imovel = 'IRU'",
    "dificuldade": "médio",
    "categorias": [
      "embargo",
      "sobreposicao",
      "imovel"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_049",
    "pergunta": "Quantas parcelas SIGEF vinculadas a CARs foram aprovadas em 2023, agrupadas por natureza e status e agrupados pelos mesmos na mesma ordem?",
    "sql": "SELECT\n    ds.natureza,\n    ds.status,\n    COUNT(DISTINCT ds.parcela_codigo) AS qtd_parcelas\nFROM fato_similaridade_sigef fss\nJOIN dim_sigef ds\n    ON fss.parcela_codigo = ds.parcela_codigo\nWHERE ds.data_aprovacao >= '2023/01/01'\n  AND ds.data_aprovacao <  '2024/01/01'\nGROUP BY ds.natureza, ds.status\nORDER BY ds.natureza, ds.status;",
    "dificuldade": "médio",
    "categorias": [
      "sigef",
      "temporal"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_050",
    "pergunta": "Compare o número de imóveis rurais com desmatamento em 2024 e a soma da área desmatada, agrupados por UF.\n\n",
    "sql": "SELECT\n  de.sigla_uf,\n  COUNT(DISTINCT fd.cod_imovel) AS total_imoveis,\n  SUM(fd.area_desmatada) AS soma_area_desmatada_ha\nFROM\n  analise_dados.fato_desmatamento fd\n  JOIN analise_dados.dim_imovel di\n    ON fd.cod_imovel = di.cod_imovel\n  JOIN analise_dados.dim_estado de\n    ON di.cod_uf = de.cod_uf\nWHERE\n  di.ind_tipo_imovel = 'IRU'\n  AND fd.ano_desmatamento = 2024\nGROUP BY\n  de.sigla_uf\nORDER BY\n  de.sigla_uf;\n",
    "dificuldade": "médio",
    "categorias": [
      "embargo",
      "sobreposicao"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_051",
    "pergunta": "Qual a área total desmatada em Novo Progresso nos últimos 5 anos registrados?",
    "sql": "WITH\n    ultimos_anos AS (\n        SELECT DISTINCT\n            ano_desmatamento\n        FROM\n            analise_dados.fato_desmatamento\n        ORDER BY\n            ano_desmatamento DESC\n        LIMIT\n            5\n    )\nSELECT\n    -- dm.mun_nome,\n    SUM(fd.area_desmatada) AS total_desmatado_ha\nFROM\n    analise_dados.fato_desmatamento fd\n    JOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n    JOIN analise_dados.dim_municipio dm ON di.cod_mun = CAST(dm.cod_mun AS int4)\nWHERE\n    LOWER(dm.mun_nome) = 'novo progresso'\n    AND fd.ano_desmatamento IN (\n        SELECT\n            ano_desmatamento\n        FROM\n            ultimos_anos\n    )\nGROUP BY\n    dm.mun_nome;",
    "dificuldade": "difícil",
    "categorias": [
      "desmatamento",
      "geografico",
      "temporal"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_052",
    "pergunta": "Quantos imóveis rurais grandes existem em cada estado da Região Norte, e qual o percentual em relação ao total de imóveis do estado? Me dê o nome do estado, o total de imóvies e o total e a porcentagem de grandes.",
    "sql": "WITH\n    imoveis_norte AS (\n        SELECT\n            de.sigla_uf,\n            de.nome_uf,\n            COUNT(*) AS total_imoveis,\n            COUNT(*) FILTER (\n                WHERE\n                    di.class_tam_imovel = 'Grande'\n            ) AS grandes\n        FROM\n            analise_dados.dim_imovel di\n            JOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\n        WHERE\n            di.ind_tipo_imovel = 'IRU'\n            AND de.sigla_uf IN ('AC', 'AM', 'AP', 'PA', 'RO', 'RR', 'TO')\n        GROUP BY\n            de.sigla_uf,\n            de.nome_uf\n    )\nSELECT\n    nome_uf,\n    -- sigla_uf,\n    total_imoveis,\n    grandes,\n    ROUND(100.0 * grandes / NULLIF(total_imoveis, 0), 2) AS percent_grandes\nFROM\n    imoveis_norte\nORDER BY\n    percent_grandes DESC;",
    "dificuldade": "difícil",
    "categorias": [
      "imovel",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_053",
    "pergunta": "Quais imóveis rurais ativos possuem sobreposição com terra indígena, mas não com embargo, e cujo percentual de sobreposição com TI é superior a 75%? Me dê o código do imóvel, área do imóvel, porcetangem de sobreposição e nome da TI",
    "sql": "SELECT\n    di.cod_imovel,\n    di.area_imovel,\n    fsti.percent_car_ti,\n    dti.terrai_nom\nFROM\n    analise_dados.dim_imovel di\n    INNER JOIN analise_dados.fato_sobreposicao_terra_indigena fsti ON di.cod_imovel = fsti.cod_imovel\n    INNER JOIN analise_dados.dim_terra_indigena dti ON fsti.terrai_cod = dti.terrai_cod\nWHERE\n    di.ind_tipo_imovel = 'IRU'\n    AND di.ind_status_imovel = 'AT'\n    AND fsti.faixa_percent_sobrep = '75-100%'\n    AND NOT EXISTS (\n        SELECT\n            1\n        FROM\n            analise_dados.fato_sobreposicao_embargo fse\n        WHERE\n            fse.cod_imovel = di.cod_imovel\n    )\nORDER BY\n    fsti.percent_car_ti DESC;",
    "dificuldade": "difícil",
    "categorias": [
      "imovel",
      "terra_indigena",
      "embargo",
      "sobreposicao"
    ],
    "order_matters": false,
    "num_column_matters": true,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_054",
    "pergunta": "Qual o percentual de imóveis rurais ativos por classificação de tamanho em cada estado? Me dê a sigla do estado, a classe, a quantidade de imóveis e o percentual.",
    "sql": "SELECT\n    de.sigla_uf,\n    di.class_tam_imovel,\n    COUNT(*) AS total,\n    ROUND(\n        COUNT(*) * 100.0 / SUM(COUNT(*)) OVER (\n            PARTITION BY\n                de.sigla_uf\n        ),\n        2\n    ) AS percentual\nFROM\n    analise_dados.dim_imovel di\n    INNER JOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\nWHERE\n    di.ind_tipo_imovel = 'IRU'\n    AND di.ind_status_imovel = 'AT'\nGROUP BY\n    de.sigla_uf,\n    di.class_tam_imovel\nORDER BY\n    de.sigla_uf,\n    percentual DESC;",
    "dificuldade": "difícil",
    "categorias": [
      "imovel"
    ],
    "order_matters": false,
    "num_column_matters": true,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_055",
    "pergunta": "Quais são os imóveis rurais que tiveram desmatamento em 2023 no bioma Cerrado e também possuem sobreposição com embargos?",
    "sql": "SELECT di.cod_imovel\nFROM analise_dados.dim_imovel di\nWHERE di.ind_tipo_imovel = 'IRU'\n  AND EXISTS (\n    SELECT 1\n    FROM analise_dados.fato_desmatamento fd\n    WHERE fd.cod_imovel = di.cod_imovel\n      AND fd.ano_desmatamento = 2023.0\n      AND UPPER(fd.bioma) = 'CERRADO'\n  )\n  AND EXISTS (\n    SELECT 1\n    FROM analise_dados.fato_sobreposicao_embargo fse\n    WHERE fse.cod_imovel = di.cod_imovel\n  )\nORDER BY di.cod_imovel;\n",
    "dificuldade": "difícil",
    "categorias": [
      "desmatamento",
      "embargo",
      "sobreposicao"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_056",
    "pergunta": "Qual o ranking dos municípios com maior área desmatada acumulada em imóveis rurais? Me dê o TOP 20 ordenado por ranking (ranking é uma coluna com 1, 2, 3...)",
    "sql": "WITH desmat_mun AS (\n  SELECT di.cod_mun, SUM(fd.area_desmatada) AS area_desmatada_total_ha\n  FROM analise_dados.fato_desmatamento fd\n  INNER JOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n  WHERE di.ind_tipo_imovel = 'IRU'\n  GROUP BY di.cod_mun\n)\nSELECT dm.mun_nome, d.area_desmatada_total_ha,\n       RANK() OVER (ORDER BY d.area_desmatada_total_ha DESC) AS ranking\nFROM desmat_mun d\nINNER JOIN analise_dados.dim_municipio dm ON d.cod_mun = CAST(dm.cod_mun AS int4)\nORDER BY ranking\nLIMIT 20;",
    "dificuldade": "difícil",
    "categorias": [
      "desmatamento",
      "imovel"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_057",
    "pergunta": "Qual o percentual médio de sobreposição de Terras Indígenas nos imóveis rurais que possuem embargo por desmatamento?",
    "sql": "WITH imoveis_com_embargo_desmat AS (\n    SELECT DISTINCT fse.cod_imovel\n    FROM analise_dados.fato_sobreposicao_embargo fse\n    JOIN analise_dados.dim_embargo de ON de.id_embargo = fse.id_embargo\n    WHERE de.sit_desmat = 'D'\n),\npercentual_por_imovel AS (\n    SELECT \n        iced.cod_imovel,\n        COALESCE(SUM(fsti.area_ti_car), 0) / di.area_imovel * 100 AS pct_sobreposicao_ti\n    FROM imoveis_com_embargo_desmat iced\n    JOIN analise_dados.dim_imovel di \n        ON di.cod_imovel = iced.cod_imovel\n        AND di.ind_tipo_imovel = 'IRU'\n        AND di.area_imovel > 0\n    LEFT JOIN analise_dados.fato_sobreposicao_terra_indigena fsti \n        ON fsti.cod_imovel = iced.cod_imovel\n    GROUP BY iced.cod_imovel, di.area_imovel\n)\nSELECT \n    ROUND(AVG(pct_sobreposicao_ti), 4) AS pct_medio_sobreposicao_ti\nFROM percentual_por_imovel;",
    "dificuldade": "difícil",
    "categorias": [
      "sobreposicao",
      "terra_indigena",
      "embargo"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_058",
    "pergunta": "Para o município de Altamira, calcule em hectares a soma da área dos imóveis rurais do CAR e a soma da área das parcelas do SIGEF que intersectam o município, considerando somente a porção da parcela dentro do limite municipal. Retorne o resultado em uma única linha, com uma coluna para `total_car_ha` e outra para `total_sigef_ha`.",
    "sql": "WITH altamira AS (\n  SELECT geo_mun\n  FROM analise_dados.dim_municipio\n  WHERE cod_mun = 1500602\n),\ncar AS (\n  SELECT\n    SUM(di.area_imovel) AS total_car_ha\n  FROM analise_dados.dim_imovel di\n  WHERE di.cod_mun = 1500602\n    AND di.ind_tipo_imovel = 'IRU'\n),\nsigef AS (\n  SELECT\n    SUM(\n      ST_Area(\n        ST_Intersection(ds.geo_parcela, a.geo_mun)\n      ) / 10000.0\n    ) AS total_sigef_ha\n  FROM analise_dados.dim_sigef ds\n  CROSS JOIN altamira a\n  WHERE ST_Intersects(ds.geo_parcela, a.geo_mun)\n)\nSELECT\n  car.total_car_ha,\n  sigef.total_sigef_ha\nFROM car\nCROSS JOIN sigef;",
    "dificuldade": "difícil",
    "categorias": [
      "imovel",
      "sigef"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_059",
    "pergunta": "Entre as parcelas SIGEF registradas e matriculadas que intersectam imóveis rurais (IRU), qual é a diferença percentual entre a soma da área registrada no SIGEF e a soma da área de interseção com esses imóveis? Retorne a área SIGEF registrada total, a área de interseção total, a diferença absoluta e a diferença percentual, em hectares.",
    "sql": "WITH parcelas_base AS (\n  SELECT DISTINCT\n    s.parcela_codigo,\n    s.area_hectares\n  FROM analise_dados.dim_sigef s\n  JOIN analise_dados.fato_similaridade_sigef f\n    ON f.parcela_codigo = s.parcela_codigo\n  JOIN analise_dados.dim_imovel i\n    ON i.cod_imovel = f.cod_imovel\n  WHERE s.status = 'REGISTRADA'\n    AND s.registro_matricula = TRUE\n    AND i.ind_tipo_imovel = 'IRU'\n),\narea_sigef_total AS (\n  SELECT\n    SUM(area_hectares) AS area_sigef_registrada\n  FROM parcelas_base\n),\narea_intersecao_total AS (\n  SELECT\n    SUM(f.area_sigef_car) AS area_intersecao\n  FROM analise_dados.fato_similaridade_sigef f\n  JOIN analise_dados.dim_sigef s\n    ON s.parcela_codigo = f.parcela_codigo\n  JOIN analise_dados.dim_imovel i\n    ON i.cod_imovel = f.cod_imovel\n  WHERE s.status = 'REGISTRADA'\n    AND s.registro_matricula = TRUE\n    AND i.ind_tipo_imovel = 'IRU'\n)\nSELECT\n  ast.area_sigef_registrada,\n  ait.area_intersecao,\n  ABS(ast.area_sigef_registrada - ait.area_intersecao) AS diferenca_absoluta,\n  ROUND(\n    (\n      ABS(ast.area_sigef_registrada - ait.area_intersecao)\n      / NULLIF(ast.area_sigef_registrada, 0) * 100\n    )::numeric,\n    2\n  ) AS diferenca_percentual\nFROM area_sigef_total ast\nCROSS JOIN area_intersecao_total ait;",
    "dificuldade": "difícil",
    "categorias": [
      "sigef",
      "sobreposicao"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_060",
    "pergunta": "Qual a taxa de ocupação de assentamentos (famílias/capacidade) por região? Use outros para assentamentos que estão sem região no BD.",
    "sql": "SELECT\n    regiao,\n    -- SUM(capacidade)       AS capacidade_total,\n    -- SUM(num_famili)        AS familias_total,\n    CASE\n        WHEN SUM(capacidade) = 0 THEN NULL\n        ELSE ROUND(SUM(num_famili)::numeric / SUM(capacidade) * 100, 2)\n    END                    AS taxa_ocupacao_pct\n    -- COUNT(*)               AS qtd_assentamentos\nFROM (\n    SELECT\n        cd_sipra,\n        uf,\n        capacidade,\n        num_famili,\n        CASE\n            WHEN uf IN ('AC','AM','AP','PA','RO','RR','TO')           THEN 'Norte'\n            WHEN uf IN ('AL','BA','CE','MA','PB','PE','PI','RN','SE') THEN 'Nordeste'\n            WHEN uf IN ('DF','GO','MT','MS')                           THEN 'Centro-Oeste'\n            WHEN uf IN ('ES','MG','RJ','SP')                           THEN 'Sudeste'\n            WHEN uf IN ('PR','RS','SC')                                THEN 'Sul'\n            ELSE 'Outros'\n        END AS regiao\n    FROM dim_assentamento\n) AS mapped\nGROUP BY regiao\nORDER BY taxa_ocupacao_pct DESC NULLS LAST;",
    "dificuldade": "difícil",
    "categorias": [
      "assentamento",
      "região"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_061",
    "pergunta": "Ranqueie os estados pela área em hectares total de desmatamento acumulado entre 2015 e 2023, mostrando também o percentual que cada estado representa no total nacional. Ordene pelo ranking",
    "sql": "WITH desmatamento_estado AS (\n    SELECT\n        e.sigla_uf,\n        e.nome_uf,\n        SUM(d.area_desmatada) AS area_total_ha\n    FROM analise_dados.fato_desmatamento d\n    JOIN analise_dados.dim_imovel i ON d.cod_imovel = i.cod_imovel\n    JOIN analise_dados.dim_estado e ON i.cod_uf = e.cod_uf\n    WHERE d.ano_desmatamento >= 2015\n      AND d.ano_desmatamento <= 2023\n    GROUP BY e.sigla_uf, e.nome_uf\n),\ntotal_nacional AS (\n    SELECT SUM(area_total_ha) AS total_geral FROM desmatamento_estado\n)\nSELECT\n    ROW_NUMBER() OVER (ORDER BY de.area_total_ha DESC) AS ranking,\n    -- de.sigla_uf,\n    de.nome_uf,\n    ROUND(de.area_total_ha, 2)::NUMERIC(20,2) AS area_desmatada_ha,\n    ROUND(100.0 * de.area_total_ha / tn.total_geral, 2) AS percentual_do_total\nFROM desmatamento_estado de\nCROSS JOIN total_nacional tn\nORDER BY ranking;",
    "dificuldade": "difícil",
    "categorias": [
      "desmatamento",
      "imovel"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_062",
    "pergunta": "Calcule a evolução anual do desmatamento no bioma Cerrado, incluindo a variação percentual em relação ao ano anterior.",
    "sql": "WITH desmat_anual AS (\n  SELECT\n    CAST(fd.ano_desmatamento AS int) AS ano,\n    SUM(fd.area_desmatada) AS area_total\n  FROM analise_dados.fato_desmatamento fd\n  WHERE fd.bioma = 'Cerrado'\n  GROUP BY CAST(fd.ano_desmatamento AS int)\n)\nSELECT\n  ano,\n  area_total,\n  LAG(area_total) OVER (ORDER BY ano) AS area_ano_anterior,\n  ROUND(\n    (area_total - LAG(area_total) OVER (ORDER BY ano)) * 100.0\n    / NULLIF(LAG(area_total) OVER (ORDER BY ano), 0), 2\n  ) AS variacao_percentual\nFROM desmat_anual\nORDER BY ano;",
    "dificuldade": "difícil",
    "categorias": [
      "desmatamento",
      "temporal"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_063",
    "pergunta": "Para cada bioma presente na tabela de desmatamento, considere apenas os imóveis rurais que possuem ao menos um registro em fato_desmatamento. Some a área desmatada de cada imóvel dentro de cada bioma, calcule o desmatamento médio por imóvel em cada bioma e, em seguida, calcule o desvio dessa média em relação à média nacional de desmatamento por imóvel, onde a média nacional deve ser calculada considerando cada imóvel rural desmatado apenas uma vez no país inteiro. Retorne o nome do bioma, o desmatamento médio por imóvel e o desvio em relação à média nacional, ordenando do maior para o menor desvio positivo.",
    "sql": "WITH media_nacional AS (\n    SELECT \n        SUM(fd.area_desmatada) / COUNT(DISTINCT fd.cod_imovel) AS media_nacional\n    FROM fato_desmatamento fd\n    JOIN dim_imovel di ON fd.cod_imovel = di.cod_imovel\n    WHERE di.ind_tipo_imovel = 'IRU'\n),\nmedia_bioma AS (\n    SELECT \n        fd.bioma,\n        SUM(fd.area_desmatada) / COUNT(DISTINCT fd.cod_imovel) AS media_bioma,\n        COUNT(DISTINCT fd.cod_imovel) AS qtd_imoveis\n    FROM fato_desmatamento fd\n    JOIN dim_imovel di ON fd.cod_imovel = di.cod_imovel\n    WHERE di.ind_tipo_imovel = 'IRU'\n    GROUP BY fd.bioma\n)\nSELECT \n    mb.bioma,\n    mb.media_bioma AS desmatamento_medio_por_imovel,\n    (mb.media_bioma - mn.media_nacional) AS desvio_da_media_nacional\n    -- mn.media_nacional AS media_nacional\nFROM media_bioma mb\nCROSS JOIN media_nacional mn\nORDER BY desvio_da_media_nacional DESC;",
    "dificuldade": "difícil",
    "categorias": [
      "desmatamento"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_064",
    "pergunta": "Para cada estado, qual o percentual de imóveis rurais ativos classificados como Pequeno, Médio e Grande? Apresente como colunas separadas e use os nomes dos estado para cada linha.",
    "sql": "SELECT\n  e.nome_uf AS estado,\n  ROUND(\n    100.0 * COUNT(*) FILTER (\n      WHERE\n        i.class_tam_imovel = 'Pequeno'\n    ) / COUNT(*),\n    2\n  ) AS pct_pequeno,\n  ROUND(\n    100.0 * COUNT(*) FILTER (\n      WHERE\n        i.class_tam_imovel = 'Médio'\n    ) / COUNT(*),\n    2\n  ) AS pct_medio,\n  ROUND(\n    100.0 * COUNT(*) FILTER (\n      WHERE\n        i.class_tam_imovel = 'Grande'\n    ) / COUNT(*),\n    2\n  ) AS pct_grande\n  -- COUNT(*) AS total_imoveis\nFROM\n  dim_imovel i\n  JOIN dim_estado e ON e.cod_uf = i.cod_uf\nWHERE\n  i.ind_tipo_imovel = 'IRU'\n  AND i.ind_status_imovel = 'AT'\nGROUP BY\n  e.nome_uf\nORDER BY\n  e.nome_uf;",
    "dificuldade": "difícil",
    "categorias": [
      "imovel"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_065",
    "pergunta": "Calcule o percentil de cada imóvel rural ativo em termos de área dentro do seu estado da região Sul. Mostre os imóveis que estão acima do percentil 95. Me dê a área em hectares e o percentil em uma escla de 0 a 100.",
    "sql": "WITH imoveis_sul AS (\n    SELECT\n        i.cod_imovel,\n        e.sigla_uf,\n        i.area_imovel,\n        PERCENT_RANK() OVER (PARTITION BY i.cod_uf ORDER BY i.area_imovel) * 100 AS percentil\n    FROM dim_imovel i\n    JOIN dim_estado e ON i.cod_uf = e.cod_uf\n    WHERE i.ind_tipo_imovel = 'IRU'\n      AND i.ind_status_imovel = 'AT'\n      AND e.sigla_uf IN ('PR', 'SC', 'RS')\n)\nSELECT\n    cod_imovel,\n    sigla_uf,\n    ROUND(area_imovel::numeric, 2) AS area_hectares,\n    ROUND(percentil::numeric, 2) AS percentil\nFROM imoveis_sul\nWHERE percentil > 95\nORDER BY sigla_uf, percentil DESC, area_hectares DESC;",
    "dificuldade": "difícil",
    "categorias": [
      "imovel"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_066",
    "pergunta": "Para cada unidade de conservação federal, calcule a quantidade de imóveis sobrepostos e a média do percentual de sobreposição. Exiba apenas UCs com mais de 50 imóveis sobrepostos, ranqueadas pela média de sobreposição. Dê cnuc e o nome da UC também. Ordene pela média e pelo nome, sendo a média do maior para o menor.",
    "sql": "SELECT\n    uc.cnuc,\n    uc.nomeuc,\n    -- uc.siglacateg,\n    -- uc.grupouc,\n    COUNT(DISTINCT fuc.cod_imovel) AS qtd_imoveis_sobrepostos,\n    ROUND(AVG(fuc.percent_car_uc), 2) AS media_percent_sobreposicao\nFROM\n    analise_dados.dim_unidades_conservacao uc\n    JOIN analise_dados.fato_sobreposicao_unidades_conservacao fuc ON uc.cnuc = fuc.cnuc\nWHERE\n    uc.esferaadm = 'Federal'\n    AND uc.siglacateg <> 'APA'\nGROUP BY\n    uc.cnuc,\n    uc.nomeuc,\n    uc.siglacateg,\n    uc.grupouc\nHAVING\n    COUNT(DISTINCT fuc.cod_imovel) > 50\nORDER BY\n    media_percent_sobreposicao DESC,\n    uc.nomeuc;",
    "dificuldade": "difícil",
    "categorias": [
      "unidade_conservacao",
      "sobreposicao"
    ],
    "order_matters": true,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_067",
    "pergunta": "Compare a área declarada no CAR com a área da parcela SIGEF para parcelas com índice de Jaccard abaixo de 0.5. Mostre as 30 maiores discrepâncias absolutas.",
    "sql": "SELECT\n  fs.cod_imovel,\n  fs.parcela_codigo,\n  di.area_imovel AS area_car,\n  ds.area_hectares AS area_sigef,\n  fs.indice_jaccard,\n  ABS(di.area_imovel - ds.area_hectares) AS discrepancia_absoluta\nFROM analise_dados.fato_similaridade_sigef fs\nJOIN analise_dados.dim_imovel di ON fs.cod_imovel = di.cod_imovel\nJOIN analise_dados.dim_sigef ds ON fs.parcela_codigo = ds.parcela_codigo\nWHERE fs.indice_jaccard < 0.5\nORDER BY discrepancia_absoluta DESC\nLIMIT 30;",
    "dificuldade": "difícil",
    "categorias": [
      "sigef",
      "imovel"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_068",
    "pergunta": "Para cada estado, qual o top 3 de municípios em área desmatada acumulada? Apresente sigla do estado, nome do município, área desmatada em hectares e a posição no ranking estadual.",
    "sql": "WITH desmat_mun AS (\n  SELECT\n    de.sigla_uf,\n    dm.mun_nome,\n    SUM(fd.area_desmatada) AS area_desmatada,\n    ROW_NUMBER() OVER (PARTITION BY de.sigla_uf ORDER BY SUM(fd.area_desmatada) DESC) AS rn\n  FROM analise_dados.fato_desmatamento fd\n  JOIN analise_dados.dim_imovel di ON fd.cod_imovel = di.cod_imovel\n  JOIN analise_dados.dim_municipio dm ON CAST(dm.cod_mun AS int4) = di.cod_mun\n  JOIN analise_dados.dim_estado de ON CAST(di.cod_uf AS int4) = de.cod_uf\n  GROUP BY de.sigla_uf, dm.mun_nome\n)\nSELECT\n  sigla_uf,\n  mun_nome,\n  area_desmatada,\n  rn AS posicao_ranking\nFROM desmat_mun\nWHERE rn <= 3\nORDER BY sigla_uf, rn;",
    "dificuldade": "difícil",
    "categorias": [
      "desmatamento",
      "imovel"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_069",
    "pergunta": "Qual o menor e o maior CARs pendente em área por estado da região Nordeste? Mê de o nome do estado, código do CAR, cidade do CAR e o tamnho em km²",
    "sql": "WITH\n  imoveis_nordeste AS (\n    SELECT\n      e.sigla_uf,\n      e.nome_uf,\n      i.cod_imovel,\n      m.mun_nome,\n      i.area_imovel * 0.01 AS area_km2,\n      i.ind_status_imovel,\n      i.ind_tipo_imovel\n    FROM\n      dim_imovel i\n      JOIN dim_estado e ON i.cod_uf = e.cod_uf\n      JOIN dim_municipio m ON i.cod_mun = m.cod_mun\n    WHERE\n      i.ind_status_imovel = 'PE'\n      AND e.sigla_uf IN (\n        'AL',\n        'BA',\n        'CE',\n        'MA',\n        'PB',\n        'PE',\n        'PI',\n        'RN',\n        'SE'\n      )\n  ),\n  rank_areas AS (\n    SELECT\n      *,\n      ROW_NUMBER() OVER (\n        PARTITION BY\n          sigla_uf\n        ORDER BY\n          area_km2 ASC\n      ) AS rn_min,\n      ROW_NUMBER() OVER (\n        PARTITION BY\n          sigla_uf\n        ORDER BY\n          area_km2 DESC\n      ) AS rn_max\n    FROM\n      imoveis_nordeste\n  )\nSELECT\n  nome_uf AS estado,\n  cod_imovel,\n  mun_nome AS cidade,\n  ROUND(area_km2, 2) AS area_km2\nFROM\n  rank_areas\nWHERE\n  rn_min = 1\n  OR rn_max = 1\nORDER BY\n  nome_uf,\n  area_km2",
    "dificuldade": "difícil",
    "categorias": [
      "imovel",
      "geoespacial"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_070",
    "pergunta": "Mostre o acumulado progressivo (running total) da área desmatada por ano no bioma Amazônia, de 2008 a 2023.",
    "sql": "WITH desmat_anual AS (\n  SELECT\n    CAST(fd.ano_desmatamento AS int) AS ano,\n    SUM(fd.area_desmatada) AS area_ano\n  FROM analise_dados.fato_desmatamento fd\n  WHERE fd.bioma = 'Amazônia'\n    AND fd.ano_desmatamento BETWEEN 2008 AND 2023\n  GROUP BY CAST(fd.ano_desmatamento AS int)\n)\nSELECT\n  ano,\n  area_ano,\n  SUM(area_ano) OVER (ORDER BY ano) AS acumulado_progressivo\nFROM desmat_anual\nORDER BY ano;",
    "dificuldade": "difícil",
    "categorias": [
      "desmatamento",
      "temporal"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_071",
    "pergunta": "Identifique os imóveis rurais que aparecem simultaneamente nas tabelas de sobreposição com embargos, terras indígenas e unidades de conservação. Quantos são por estado?",
    "sql": "WITH uc_sem_apa AS (\n  SELECT DISTINCT\n    uc.cod_imovel\n  FROM analise_dados.fato_sobreposicao_unidades_conservacao uc\n  JOIN analise_dados.dim_unidades_conservacao duc\n    ON duc.cnuc = uc.cnuc\n  WHERE COALESCE(UPPER(duc.siglacateg), '') <> 'APA'\n),\ntripla_sobrep AS (\n  SELECT cod_imovel\n  FROM analise_dados.fato_sobreposicao_embargo\n  INTERSECT\n  SELECT cod_imovel\n  FROM analise_dados.fato_sobreposicao_terra_indigena\n  INTERSECT\n  SELECT cod_imovel\n  FROM uc_sem_apa\n)\nSELECT\n  est.sigla_uf,\n  est.nome_uf,\n  COUNT(*) AS qtd_imoveis_tripla_sobrep\nFROM tripla_sobrep t\nJOIN analise_dados.dim_imovel d\n  ON d.cod_imovel = t.cod_imovel\nJOIN analise_dados.dim_estado est\n  ON est.cod_uf = d.cod_uf\nWHERE d.ind_tipo_imovel = 'IRU'\nGROUP BY\n  est.sigla_uf,\n  est.nome_uf\nORDER BY\n  qtd_imoveis_tripla_sobrep DESC;",
    "dificuldade": "difícil",
    "categorias": [
      "sobreposicao",
      "embargo",
      "terra_indigena",
      "unidade_conservacao"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_072",
    "pergunta": "Calcule para cada município do Mato Grosso o total de área desmatada, número de CARs com desmatamento e a área média desmatada por imóvel. Ranqueie pelo total de área desmatada.",
    "sql": "SELECT \n    m.mun_nome AS municipio,\n    SUM(d.area_desmatada) AS area_desmatada_total_ha,\n    COUNT(DISTINCT d.cod_imovel) AS num_imoveis_com_desmatamento,\n    ROUND(SUM(d.area_desmatada) / COUNT(DISTINCT d.cod_imovel), 2) AS area_media_desmatada_por_imovel_ha\nFROM fato_desmatamento d\nJOIN dim_imovel i ON d.cod_imovel = i.cod_imovel\nJOIN dim_municipio m ON i.cod_mun = m.cod_mun\nJOIN dim_estado e ON m.cod_uf = e.cod_uf\nWHERE e.sigla_uf = 'MT'\nGROUP BY m.mun_nome\nORDER BY area_desmatada_total_ha DESC;",
    "dificuldade": "difícil",
    "categorias": [
      "desmatamento",
      "imovel"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_073",
    "pergunta": "Para cada bioma, identifique o ano com maior desmatamento e o ano com menor desmatamento. Mostre os valores correspondentes em ha.",
    "sql": "WITH desmat_bioma_ano AS (\n  SELECT\n    fd.bioma,\n    CAST(fd.ano_desmatamento AS int) AS ano,\n    SUM(fd.area_desmatada) AS area_total\n  FROM analise_dados.fato_desmatamento fd\n  GROUP BY fd.bioma, CAST(fd.ano_desmatamento AS int)\n),\nranked AS (\n  SELECT\n    bioma,\n    ano,\n    area_total,\n    ROW_NUMBER() OVER (PARTITION BY bioma ORDER BY area_total DESC) AS rn_max,\n    ROW_NUMBER() OVER (PARTITION BY bioma ORDER BY area_total ASC) AS rn_min\n  FROM desmat_bioma_ano\n)\nSELECT\n  r1.bioma,\n  r1.ano AS ano_maior_desmat,\n  r1.area_total AS area_maior_desmat,\n  r2.ano AS ano_menor_desmat,\n  r2.area_total AS area_menor_desmat\nFROM ranked r1\nJOIN ranked r2 ON r1.bioma = r2.bioma AND r2.rn_min = 1\nWHERE r1.rn_max = 1\nORDER BY r1.area_total DESC;",
    "dificuldade": "difícil",
    "categorias": [
      "desmatamento",
      "temporal"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_074",
    "pergunta": "Quais imóveis tiveram desmatamento registrado em 3 ou mais anos distintos no menor estado do Nordeste em área? Mostre o código do imóvel, quantidade de anos, lista de anos divida por virgula sem espaço e a área total desmatada em ha.",
    "sql": "SELECT\n    fd.cod_imovel,\n    COUNT(DISTINCT fd.ano_desmatamento) AS quantidade_anos,\n    STRING_AGG(DISTINCT CAST(CAST(ROUND(fd.ano_desmatamento) AS INTEGER) AS VARCHAR), ',' ORDER BY CAST(CAST(ROUND(fd.ano_desmatamento) AS INTEGER) AS VARCHAR)) AS lista_anos,\n    SUM(fd.area_desmatada) AS area_total_desmatada\nFROM fato_desmatamento fd\nJOIN dim_imovel di ON fd.cod_imovel = di.cod_imovel\nWHERE di.cod_uf = 28\nGROUP BY fd.cod_imovel\nHAVING COUNT(DISTINCT fd.ano_desmatamento) >= 3\nORDER BY quantidade_anos DESC, area_total_desmatada DESC",
    "dificuldade": "difícil",
    "categorias": [
      "desmatamento",
      "temporal"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_075",
    "pergunta": "Identifique UCs do bioma Amazônia que foram criadas antes de 2000 e que possuem mais de 100 imóveis sobrepostos. Mostre o nome da uc, o ano de criação, número de imóveis e área total de sobreposição em ha. Ordene pela quantidade de imóveis (maior para menor)",
    "sql": "SELECT\n  uc.nomeuc AS nome_uc,\n  uc.criacaoano AS ano_criacao,\n  COUNT(*) AS numero_imoveis,\n  ROUND(SUM(f.area_uc_car), 2) AS area_total_sobreposicao_ha\nFROM analise_dados.dim_unidades_conservacao uc\nJOIN analise_dados.fato_sobreposicao_unidades_conservacao f\n  ON uc.cnuc = f.cnuc\nWHERE uc.biomaibge = 'AMAZÔNIA'\n  AND uc.siglacateg <> 'APA'\n  AND CAST(uc.criacaoano AS INTEGER) < 2000\nGROUP BY uc.cnuc, uc.nomeuc, uc.criacaoano\nHAVING COUNT(*) > 100\nORDER BY numero_imoveis DESC;\n",
    "dificuldade": "difícil",
    "categorias": [
      "unidade_conservacao",
      "sobreposicao"
    ],
    "order_matters": true,
    "num_column_matters": true,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_076",
    "pergunta": "Me dê a quantidade de embargos por estado em 2023? Use a técnica da maior área para embargos que estão entre estados. Mê de exatamente 2 colunas: nome do estado e quantidade de embargos. Ordene pela quantidade de emb de maneira descendente.",
    "sql": "WITH embargos_2023 AS (\n    -- Filtra embargos do ano de 2023\n    SELECT \n        id_embargo,\n        geo_embargo,\n        ST_Area(geo_embargo) as area_total\n    FROM dim_embargo\n    WHERE SUBSTRING(dat_embarg FROM '\\d{2}/\\d{2}/(\\d{2})') = '23'\n),\ninterseccoes AS (\n    -- Calcula a interseção entre cada embargo e cada estado onde ele cruza a fronteira\n    SELECT \n        e.id_embargo,\n        e.area_total,\n        est.cod_uf,\n        est.sigla_uf,\n        est.nome_uf,\n        ST_Area(ST_Intersection(e.geo_embargo, est.geo_estado)) as area_interseccao\n    FROM embargos_2023 e\n    JOIN dim_estado est\n        ON ST_Intersects(e.geo_embargo, est.geo_estado)\n),\nranking_estado AS (\n    -- Para cada embargo, ranqueia os estados por área de interseção (maior primeiro)\n    SELECT \n        id_embargo,\n        cod_uf,\n        sigla_uf,\n        nome_uf,\n        area_interseccao,\n        area_total,\n        ROW_NUMBER() OVER (PARTITION BY id_embargo ORDER BY area_interseccao DESC) as rn\n    FROM interseccoes\n),\nembargo_estado_maior AS (\n    -- Seleciona o estado com a maior área de interseção para cada embargo\n    SELECT id_embargo, cod_uf, sigla_uf, nome_uf, area_interseccao, area_total\n    FROM ranking_estado\n    WHERE rn = 1\n)\n-- Conta embargos por estado\nSELECT \n    -- sigla_uf,\n    nome_uf,\n    COUNT(*) as qtd_embargos\nFROM embargo_estado_maior\nGROUP BY sigla_uf, nome_uf\nORDER BY qtd_embargos DESC;\n",
    "dificuldade": "difícil",
    "categorias": [
      "terra_indigena",
      "sobreposicao"
    ],
    "order_matters": true,
    "num_column_matters": true,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_077",
    "pergunta": "Para cada gleba federal, identifique quantos dos imóveis rurais sobrepostos tiveram desmatamento registrado entre 2020 e 2023. Mostre o nome da gleba, a situação, o total de imóveis rurais sobrepostos, quantos possuem desmatamento no período, a área total desmatada nesses imóveis e o percentual de imóveis com desmatamento. ",
    "sql": "WITH imoveis_gleba AS (\n    SELECT\n        fitu.id_tu,\n        fitu.cod_imovel\n    FROM analise_dados.fato_imovel_terra_uniao fitu\n    JOIN analise_dados.dim_imovel di\n        ON fitu.cod_imovel = di.cod_imovel\n    WHERE di.ind_tipo_imovel = 'IRU'\n),\ndesmat_por_imovel_gleba AS (\n    SELECT\n        ig.id_tu,\n        ig.cod_imovel,\n        SUM(fd.area_desmatada) AS area_desmatada\n    FROM imoveis_gleba ig\n    JOIN analise_dados.fato_desmatamento fd\n        ON ig.cod_imovel = fd.cod_imovel\n    WHERE fd.ano_desmatamento BETWEEN 2020 AND 2023\n    GROUP BY ig.id_tu, ig.cod_imovel\n)\nSELECT\n    tu.nome_gleba,\n    tu.situacao,\n    COUNT(DISTINCT ig.cod_imovel) AS total_imoveis_sobrepostos,\n    COUNT(DISTINCT dpg.cod_imovel) AS imoveis_com_desmatamento,\n    ROUND(COALESCE(SUM(dpg.area_desmatada), 0)::numeric, 2) AS area_desmatamento_total_ha,\n    ROUND(\n        COUNT(DISTINCT dpg.cod_imovel)::numeric\n        / NULLIF(COUNT(DISTINCT ig.cod_imovel), 0) * 100, 2\n    ) AS pct_imoveis_com_desmatamento\nFROM analise_dados.dim_terra_uniao tu\nJOIN imoveis_gleba ig\n    ON tu.id_tu = ig.id_tu\nLEFT JOIN desmat_por_imovel_gleba dpg\n    ON ig.id_tu = dpg.id_tu\n    AND ig.cod_imovel = dpg.cod_imovel\nGROUP BY tu.id_tu, tu.nome_gleba, tu.situacao\nORDER BY area_desmatamento_total_ha DESC;",
    "dificuldade": "difícil",
    "categorias": [
      "terra_uniao",
      "desmatamento",
      "sobreposicao",
      "temporal"
    ],
    "order_matters": false,
    "num_column_matters": true,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_078",
    "pergunta": "Para cada bioma, calcule a evolução anual do desmatamento em imóveis rurais, exibindo a área desmatada no ano e a variação percentual em relação ao ano anterior.",
    "sql": "WITH\n  desmatamento_por_bioma_ano AS (\n    SELECT\n      fd.bioma,\n      CAST(fd.ano_desmatamento AS INTEGER) AS ano,\n      SUM(fd.area_desmatada) AS area_desmatada_total\n    FROM\n      fato_desmatamento fd\n      JOIN dim_imovel di ON fd.cod_imovel = di.cod_imovel\n    WHERE\n      di.ind_tipo_imovel = 'IRU'\n    GROUP BY\n      fd.bioma,\n      CAST(fd.ano_desmatamento AS INTEGER)\n  ),\n  com_variacao AS (\n    SELECT\n      bioma,\n      ano,\n      area_desmatada_total,\n      ROUND(\n        (\n          (\n            area_desmatada_total - LAG(area_desmatada_total) OVER (\n              PARTITION BY\n                bioma\n              ORDER BY\n                ano\n            )\n          ) * 100.0 / NULLIF(\n            LAG(area_desmatada_total) OVER (\n              PARTITION BY\n                bioma\n              ORDER BY\n                ano\n            ),\n            0\n          )\n        ),\n        2\n      ) AS variacao_percentual\n    FROM\n      desmatamento_por_bioma_ano\n  )\nSELECT\n  bioma,\n  ano,\n  area_desmatada_total,\n  variacao_percentual\nFROM\n  com_variacao\nORDER BY\n  bioma,\n  ano;",
    "dificuldade": "difícil",
    "categorias": [
      "desmatamento",
      "temporal"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_079",
    "pergunta": "Para cada terra indígena na fase 'Homologada', calcule o número de imóveis rurais sobrepostos e a densidade de conflito (área de sobreposição dividida pela área total da TI). Me dê o nome da TI, a área em ha, quantidade de imóveis sobrepostos, área total sobreposta e o cálculo da densidade de conflito bruta.",
    "sql": "SELECT \n    ti.terrai_nom AS nome_ti,\n    ti.area_ti_total AS area_ti_ha,\n    COUNT(*)::integer AS qtd_imoveis_sobrepostos,\n    ROUND(SUM(f.area_ti_car), 2) AS area_total_sobreposta_ha,\n    ROUND((SUM(f.area_ti_car) / ti.area_ti_total)::numeric, 4) AS densidade_conflito_bruta\nFROM fato_sobreposicao_terra_indigena f\nJOIN dim_terra_indigena ti \n    ON f.terrai_cod = ti.terrai_cod\nJOIN dim_imovel im \n    ON f.cod_imovel = im.cod_imovel\nWHERE ti.fase_ti = 'Homologada'\n  AND im.ind_tipo_imovel = 'IRU'\nGROUP BY ti.terrai_cod, ti.terrai_nom, ti.area_ti_total\nORDER BY densidade_conflito_bruta DESC;",
    "dificuldade": "difícil",
    "categorias": [
      "terra_indigena",
      "sobreposicao"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_080",
    "pergunta": "Por estado, qual a taxa de inconsistência entre a classificação de tamanho do imóvel e a classe recalculada a partir de num_modulo_fiscal nos imóveis rurais ativos ? Use a siglas do estado para cada linha.",
    "sql": "WITH base AS (\n    SELECT\n        e.sigla_uf,\n        i.class_tam_imovel,\n        i.num_modulo_fiscal,\n        CASE\n            WHEN i.num_modulo_fiscal <= 4 THEN 'Pequeno'\n            WHEN i.num_modulo_fiscal <= 15 THEN 'Médio'\n            ELSE 'Grande'\n        END AS class_recalculada,\n        CASE\n            WHEN i.class_tam_imovel <>\n                 CASE\n                     WHEN i.num_modulo_fiscal <= 4 THEN 'Pequeno'\n                     WHEN i.num_modulo_fiscal <= 15 THEN 'Médio'\n                     ELSE 'Grande'\n                 END\n            THEN 1\n            ELSE 0\n        END AS inconsistente\n    FROM dim_imovel i\n    JOIN dim_estado e ON i.cod_uf = e.cod_uf\n    WHERE i.ind_tipo_imovel = 'IRU'\n      AND i.ind_status_imovel = 'AT'\n      AND i.num_modulo_fiscal IS NOT NULL\n)\nSELECT\n    sigla_uf,\n    COUNT(*) AS total_imoveis,\n    SUM(inconsistente) AS imoveis_inconsistentes,\n    ROUND(100.0 * SUM(inconsistente) / COUNT(*), 2) AS taxa_inconsistencia_pct\nFROM base\nGROUP BY sigla_uf\nORDER BY taxa_inconsistencia_pct DESC;",
    "dificuldade": "difícil",
    "categorias": [
      "imovel",
      "qualidade_dados"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_081",
    "pergunta": "Entre os estados com pelo menos 50 mil imóveis IRU ativos, qual o ranking por percentual da área total em dupla pressão territorial (imóveis que sobrepõem simultaneamente Terra Indígena e UC não-APA), incluindo percent_rank nacional?",
    "sql": "WITH imoveis_iru_ativos AS (\n    SELECT\n        di.cod_imovel,\n        di.cod_uf,\n        COALESCE(di.area_imovel, 0) AS area_imovel\n    FROM analise_dados.dim_imovel di\n    WHERE di.ind_tipo_imovel = 'IRU'\n      AND di.ind_status_imovel = 'AT'\n),\nestados_elegiveis AS (\n    SELECT\n        iia.cod_uf\n    FROM imoveis_iru_ativos iia\n    GROUP BY iia.cod_uf\n    HAVING COUNT(*) >= 50000\n),\nimoveis_elegiveis AS (\n    SELECT\n        iia.cod_uf,\n        iia.cod_imovel,\n        iia.area_imovel,\n        EXISTS (\n            SELECT 1\n            FROM analise_dados.fato_sobreposicao_terra_indigena fsti\n            WHERE fsti.cod_imovel = iia.cod_imovel\n        )\n        AND EXISTS (\n            SELECT 1\n            FROM analise_dados.fato_sobreposicao_unidades_conservacao fsuc\n            JOIN analise_dados.dim_unidades_conservacao duc\n              ON duc.cnuc = fsuc.cnuc\n            WHERE fsuc.cod_imovel = iia.cod_imovel\n              AND duc.siglacateg <> 'APA'\n        ) AS fl_dupla_pressao\n    FROM imoveis_iru_ativos iia\n    JOIN estados_elegiveis ee\n      ON ee.cod_uf = iia.cod_uf\n),\nmetricas_por_estado AS (\n    SELECT\n        ie.cod_uf,\n        COUNT(*) AS total_imoveis_iru_ativos,\n        SUM(ie.area_imovel) AS area_total_ha,\n        SUM(\n            CASE\n                WHEN ie.fl_dupla_pressao THEN ie.area_imovel\n                ELSE 0\n            END\n        ) AS area_dupla_pressao_ha\n    FROM imoveis_elegiveis ie\n    GROUP BY ie.cod_uf\n),\nranking AS (\n    SELECT\n        mpe.cod_uf,\n        mpe.total_imoveis_iru_ativos,\n        mpe.area_total_ha,\n        mpe.area_dupla_pressao_ha,\n        100.0 * mpe.area_dupla_pressao_ha / NULLIF(mpe.area_total_ha, 0) AS pct_area_dupla_pressao\n    FROM metricas_por_estado mpe\n)\nSELECT\n    de.sigla_uf AS uf,\n    -- de.nome_uf,\n    -- r.total_imoveis_iru_ativos,\n    -- ROUND(r.area_total_ha::numeric, 2) AS area_total_ha,\n    -- ROUND(r.area_dupla_pressao_ha::numeric, 2) AS area_dupla_pressao_ha,\n    ROUND(r.pct_area_dupla_pressao::numeric, 4) AS pct_area_dupla_pressao,\n    -- DENSE_RANK() OVER (ORDER BY r.pct_area_dupla_pressao DESC) AS rank_entre_estados_elegiveis,\n    ROUND(\n        PERCENT_RANK() OVER (ORDER BY r.pct_area_dupla_pressao)::numeric,\n        4\n    ) AS percent_rank_nacional\nFROM ranking r\nJOIN analise_dados.dim_estado de\n  ON de.cod_uf = r.cod_uf\nORDER BY\n    r.pct_area_dupla_pressao DESC,\n    de.sigla_uf;\n",
    "dificuldade": "expert",
    "categorias": [
      "unidade_conservacao",
      "geografico",
      "geoespacial"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_082",
    "pergunta": "Nos 3 anos mais recentes com desmatamento na base, qual a participação de cada situação normalizada de Terra da União na área desmatada, atribuindo cada IRU ativo à situação dominante por área de sobreposição?",
    "sql": "WITH anos_recentes AS (\n    SELECT ano_desmatamento\n    FROM (\n        SELECT DISTINCT fd.ano_desmatamento::int AS ano_desmatamento\n        FROM analise_dados.fato_desmatamento fd\n        ORDER BY 1 DESC\n        LIMIT 3\n    ) x\n),\n\niru_ativos_desmat AS (\n    SELECT\n        fd.cod_imovel,\n        SUM(fd.area_desmatada) AS area_desmatada_3a_ha\n    FROM analise_dados.fato_desmatamento fd\n    JOIN analise_dados.dim_imovel di\n        ON di.cod_imovel = fd.cod_imovel\n    WHERE fd.ano_desmatamento::int IN (SELECT ano_desmatamento FROM anos_recentes)\n      AND di.ind_tipo_imovel = 'IRU'\n      AND di.ind_status_imovel = 'AT'\n    GROUP BY fd.cod_imovel\n),\n\nterra_uniao_normalizada AS (\n    SELECT\n        fitu.cod_imovel,\n        CASE\n            WHEN UPPER(TRIM(COALESCE(dtu.situacao, '-'))) = 'ARREACADADA' THEN 'ARRECADADA'\n            WHEN UPPER(TRIM(COALESCE(dtu.situacao, '-'))) = 'CERTIFICADO' THEN 'CERTIFICADA'\n            ELSE UPPER(TRIM(COALESCE(dtu.situacao, '-')))\n        END AS situacao_normalizada,\n        fitu.area_gleba_car\n    FROM analise_dados.fato_imovel_terra_uniao fitu\n    JOIN analise_dados.dim_terra_uniao dtu\n        ON dtu.id_tu = fitu.id_tu\n),\n\narea_por_situacao_imovel AS (\n    SELECT\n        tun.cod_imovel,\n        tun.situacao_normalizada,\n        SUM(tun.area_gleba_car) AS area_sobreposicao_ha\n    FROM terra_uniao_normalizada tun\n    JOIN iru_ativos_desmat iad\n        ON iad.cod_imovel = tun.cod_imovel\n    GROUP BY\n        tun.cod_imovel,\n        tun.situacao_normalizada\n),\n\nsituacao_dominante AS (\n    SELECT\n        apsi.cod_imovel,\n        apsi.situacao_normalizada,\n        ROW_NUMBER() OVER (\n            PARTITION BY apsi.cod_imovel\n            ORDER BY apsi.area_sobreposicao_ha DESC, apsi.situacao_normalizada\n        ) AS rn\n    FROM area_por_situacao_imovel apsi\n),\n\nbase_atribuida AS (\n    SELECT\n        sd.situacao_normalizada,\n        iad.area_desmatada_3a_ha\n    FROM situacao_dominante sd\n    JOIN iru_ativos_desmat iad\n        ON iad.cod_imovel = sd.cod_imovel\n    WHERE sd.rn = 1\n),\n\nresultado AS (\n    SELECT\n        situacao_normalizada,\n        SUM(area_desmatada_3a_ha) AS area_desmatada_3a_ha\n    FROM base_atribuida\n    GROUP BY situacao_normalizada\n)\n\nSELECT\n    situacao_normalizada,\n    ROUND(area_desmatada_3a_ha::numeric, 2) AS area_desmatada_3a_ha,\n    ROUND(\n        100.0 * area_desmatada_3a_ha\n        / SUM(area_desmatada_3a_ha) OVER (),\n        2\n    ) AS participacao_pct\nFROM resultado\nORDER BY area_desmatada_3a_ha DESC, situacao_normalizada;\n",
    "dificuldade": "expert",
    "categorias": [
      "geoespacial",
      "terra_indigena",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_083",
    "pergunta": "Entre os estados com pelo menos 20 IRU ativos sobrepostos a TI, qual tem a maior fração de imóveis que também registraram desmatamento em algum dos 3 anos mais recentes da base?",
    "sql": "WITH limites AS (\n    SELECT\n        MAX(ano_desmatamento) AS max_ano\n    FROM analise_dados.fato_desmatamento\n),\n\nrecent_desmat AS (\n    SELECT DISTINCT\n        fd.cod_imovel\n    FROM analise_dados.fato_desmatamento fd\n    CROSS JOIN limites l\n    WHERE\n        fd.ano_desmatamento >= l.max_ano - 2\n),\n\nti_imoveis AS (\n    SELECT DISTINCT\n        de.sigla_uf,\n        de.nome_uf,\n        di.cod_imovel,\n        CASE\n            WHEN rd.cod_imovel IS NOT NULL THEN 1\n            ELSE 0\n        END AS desmatou_recente\n    FROM analise_dados.fato_sobreposicao_terra_indigena fti\n    JOIN analise_dados.dim_imovel di\n        ON di.cod_imovel = fti.cod_imovel\n    JOIN analise_dados.dim_estado de\n        ON de.cod_uf = di.cod_uf\n    LEFT JOIN recent_desmat rd\n        ON rd.cod_imovel = di.cod_imovel\n    WHERE\n        di.ind_tipo_imovel = 'IRU'\n        AND di.ind_status_imovel = 'AT'\n)\n\nSELECT\n    -- nome_uf,\n    sigla_uf,\n    COUNT(*) AS qtd_iru_ativos_com_ti,\n    SUM(desmatou_recente) AS qtd_iru_com_ti_e_desmatamento_recente,\n    ROUND((100.0 * SUM(desmatou_recente) / COUNT(*))::numeric, 2) AS percentual\nFROM ti_imoveis\nGROUP BY\n    nome_uf,\n    sigla_uf\nHAVING\n    COUNT(*) >= 20\nORDER BY\n    percentual DESC,\n    qtd_iru_com_ti_e_desmatamento_recente DESC,\n    sigla_uf\nLIMIT 1;",
    "dificuldade": "expert",
    "categorias": [
      "geoespacial",
      "terra_indigena",
      "sobreposicao",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_084",
    "pergunta": "Entre os municípios com pelo menos 100 IRU ativos, qual tem a maior participação da área desmatada acumulada concentrada em IRU ativos que possuem sobreposição com TI?",
    "sql": "WITH imoveis_ti AS (\n    SELECT DISTINCT\n        cod_imovel\n    FROM analise_dados.fato_sobreposicao_terra_indigena\n),\n\ndesmat_por_imovel AS (\n    SELECT\n        cod_imovel,\n        SUM(area_desmatada) AS area_desmatada_total_ha\n    FROM analise_dados.fato_desmatamento\n    GROUP BY\n        cod_imovel\n),\n\nmunicipios_validos AS (\n    SELECT\n        di.cod_mun\n    FROM analise_dados.dim_imovel di\n    WHERE\n        di.ind_tipo_imovel = 'IRU'\n        AND di.ind_status_imovel = 'AT'\n    GROUP BY\n        di.cod_mun\n    HAVING\n        COUNT(*) >= 100\n),\n\nbase AS (\n    SELECT\n        dm.mun_nome,\n        de.sigla_uf,\n        dp.cod_imovel,\n        dp.area_desmatada_total_ha,\n        CASE\n            WHEN iti.cod_imovel IS NOT NULL THEN dp.area_desmatada_total_ha\n            ELSE 0\n        END AS area_desmatada_em_ti_ha\n    FROM desmat_por_imovel dp\n    JOIN analise_dados.dim_imovel di\n        ON di.cod_imovel = dp.cod_imovel\n    JOIN municipios_validos mv\n        ON mv.cod_mun = di.cod_mun\n    JOIN analise_dados.dim_municipio dm\n        ON dm.cod_mun = di.cod_mun\n    JOIN analise_dados.dim_estado de\n        ON de.cod_uf = di.cod_uf\n    LEFT JOIN imoveis_ti iti\n        ON iti.cod_imovel = dp.cod_imovel\n    WHERE\n        di.ind_tipo_imovel = 'IRU'\n        AND di.ind_status_imovel = 'AT'\n)\n\nSELECT\n    mun_nome,\n    -- sigla_uf,\n    ROUND(SUM(area_desmatada_em_ti_ha)::numeric, 2) AS area_desmatada_em_iru_com_ti_ha,\n    ROUND(SUM(area_desmatada_total_ha)::numeric, 2) AS area_desmatada_total_ha,\n    ROUND(\n        100.0 * SUM(area_desmatada_em_ti_ha) / SUM(area_desmatada_total_ha),\n        2\n    ) AS percentual\nFROM base\nGROUP BY\n    mun_nome,\n    sigla_uf\nHAVING\n    SUM(area_desmatada_total_ha) > 0\nORDER BY\n    percentual DESC,\n    area_desmatada_em_iru_com_ti_ha DESC,\n    mun_nome\nLIMIT 1;",
    "dificuldade": "expert",
    "categorias": [
      "geoespacial",
      "terra_indigena",
      "geografico"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_085",
    "pergunta": "Considerando apenas o melhor vínculo CAR de cada parcela SIGEF registrada, qual estado tem o maior gap absoluto entre a média ponderada por área e a média simples do índice de Jaccard?",
    "sql": "WITH melhor_vinculo AS (\n    SELECT\n        fs.parcela_codigo,\n        fs.cod_imovel,\n        fs.indice_jaccard,\n        ds.area_hectares,\n        ROW_NUMBER() OVER (\n            PARTITION BY fs.parcela_codigo\n            ORDER BY\n                fs.indice_jaccard DESC NULLS LAST,\n                fs.area_sigef_car DESC NULLS LAST,\n                fs.cod_imovel\n        ) AS rn\n    FROM analise_dados.fato_similaridade_sigef fs\n    JOIN analise_dados.dim_sigef ds\n        ON ds.parcela_codigo = fs.parcela_codigo\n    WHERE\n        ds.status = 'REGISTRADA'\n        AND fs.indice_jaccard IS NOT NULL\n        AND ds.area_hectares IS NOT NULL\n)\nSELECT\n    -- de.nome_uf,\n    de.sigla_uf,\n    ROUND(AVG(mv.indice_jaccard)::numeric, 6) AS media_simples_jaccard,\n    ROUND(\n        (SUM(mv.indice_jaccard * mv.area_hectares) / NULLIF(SUM(mv.area_hectares), 0))::numeric,\n        6\n    ) AS media_ponderada_jaccard,\n    ROUND(\n        ABS(\n            SUM(mv.indice_jaccard * mv.area_hectares) / NULLIF(SUM(mv.area_hectares), 0)\n            - AVG(mv.indice_jaccard)\n        )::numeric,\n        6\n    ) AS gap_absoluto\nFROM melhor_vinculo mv\nJOIN analise_dados.dim_imovel di\n    ON di.cod_imovel = mv.cod_imovel\nJOIN analise_dados.dim_estado de\n    ON de.cod_uf = di.cod_uf\nWHERE mv.rn = 1\nGROUP BY de.nome_uf, de.sigla_uf\nORDER BY gap_absoluto DESC, de.sigla_uf\nLIMIT 1;\n",
    "dificuldade": "expert",
    "categorias": [
      "terra_indigena",
      "imovel",
      "geoespacial"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_086",
    "pergunta": "Encontre os 20 imóveis IRU ativos mais paradoxais e retorne as colunas:\n- sigla_uf\n- cod_imovel\n- max_pct_uc\n- max_jaccard\n- area_desmat_total_ha\n- mediana_desmatamento_uf\n- score_paradoxo\n\nConsidere apenas sobreposição com Unidade de Conservação não-APA e imóveis com similaridade SIGEF. O desmatamento deve ser o acumulado por imóvel, e o imóvel só deve entrar no resultado se seu desmatamento acumulado estiver acima da mediana do desmatamento acumulado dos imóveis IRU ativos da mesma UF, considerando imóveis sem desmatamento como zero no cálculo da mediana. Calcule o score composto como max_pct_uc * max_jaccard * ln(1 + desmatamento acumulado), ordene do maior para o menor score e limite a 20 resultados.\n",
    "sql": "WITH imoveis_iru_ativos AS (\n  SELECT\n    di.cod_imovel,\n    di.cod_uf\n  FROM analise_dados.dim_imovel di\n  WHERE di.ind_tipo_imovel = 'IRU'\n    AND di.ind_status_imovel = 'AT'\n),\ndesmatamento_acumulado AS (\n  SELECT\n    fd.cod_imovel,\n    SUM(fd.area_desmatada) AS desmatamento_total_ha\n  FROM analise_dados.fato_desmatamento fd\n  JOIN imoveis_iru_ativos i\n    ON i.cod_imovel = fd.cod_imovel\n  GROUP BY fd.cod_imovel\n),\nbase_iru AS (\n  SELECT\n    i.cod_imovel,\n    i.cod_uf,\n    COALESCE(d.desmatamento_total_ha, 0) AS desmatamento_total_ha\n  FROM imoveis_iru_ativos i\n  LEFT JOIN desmatamento_acumulado d\n    ON d.cod_imovel = i.cod_imovel\n),\nmediana_uf AS (\n  SELECT\n    b.cod_uf,\n    PERCENTILE_CONT(0.5) WITHIN GROUP (\n      ORDER BY b.desmatamento_total_ha\n    ) AS mediana_desmatamento_uf\n  FROM base_iru b\n  GROUP BY b.cod_uf\n),\nacima_mediana AS (\n  SELECT\n    b.cod_imovel,\n    b.cod_uf,\n    b.desmatamento_total_ha\n  FROM base_iru b\n  JOIN mediana_uf m\n    ON m.cod_uf = b.cod_uf\n  WHERE b.desmatamento_total_ha > m.mediana_desmatamento_uf\n),\nmax_uc_nao_apa AS (\n  SELECT\n    fsuc.cod_imovel,\n    MAX(fsuc.percent_car_uc) AS max_pct_uc\n  FROM analise_dados.fato_sobreposicao_unidades_conservacao fsuc\n  JOIN analise_dados.dim_unidades_conservacao duc\n    ON duc.cnuc = fsuc.cnuc\n  WHERE COALESCE(UPPER(duc.siglacateg), '') <> 'APA'\n  GROUP BY fsuc.cod_imovel\n),\nmax_sigef AS (\n  SELECT\n    fss.cod_imovel,\n    MAX(fss.indice_jaccard) AS max_jaccard\n  FROM analise_dados.fato_similaridade_sigef fss\n  GROUP BY fss.cod_imovel\n),\ncandidatos AS (\n  SELECT\n    a.cod_imovel,\n    a.cod_uf,\n    a.desmatamento_total_ha,\n    uc.max_pct_uc,\n    sg.max_jaccard\n  FROM acima_mediana a\n  JOIN max_uc_nao_apa uc\n    ON uc.cod_imovel = a.cod_imovel\n  JOIN max_sigef sg\n    ON sg.cod_imovel = a.cod_imovel\n)\nSELECT\n  de.sigla_uf,\n  c.cod_imovel,\n  ROUND(c.max_pct_uc::numeric, 4) AS max_pct_uc,\n  ROUND(c.max_jaccard::numeric, 4) AS max_jaccard,\n  ROUND(c.desmatamento_total_ha::numeric, 2) AS area_desmat_total_ha,\n  ROUND(m.mediana_desmatamento_uf::numeric, 2) AS mediana_desmatamento_uf,\n  ROUND(\n    (\n      c.max_pct_uc * c.max_jaccard * LN(1 + c.desmatamento_total_ha)\n    )::numeric,\n    4\n  ) AS score_paradoxo\nFROM candidatos c\nJOIN mediana_uf m\n  ON m.cod_uf = c.cod_uf\nJOIN analise_dados.dim_estado de\n  ON de.cod_uf = c.cod_uf\nORDER BY\n  score_paradoxo DESC,\n  c.max_pct_uc DESC,\n  c.max_jaccard DESC,\n  c.desmatamento_total_ha DESC\nLIMIT 20;\n",
    "dificuldade": "expert",
    "categorias": [
      "imovel",
      "geoespacial"
    ],
    "order_matters": true,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_087",
    "pergunta": "Considerando apenas os imóveis rurais que possuem pelo menos um embargo, e definindo a severidade de cada imóvel como o maior valor de percent_car_embargos entre todos os seus embargos (MAX(percent_car_embargos) por cod_imovel), calcule, para cada UF, qual percentual da soma da area_imovel pertence aos imóveis que estão no decil superior nacional de severidade (isto é, acima ou igual ao percentil 90 calculado sobre todos os imóveis do Brasil, e não separadamente por estado). Retorne: sigla da UF, quantidade de imóveis com embargo, quantidade de imóveis no decil superior, área total dos imóveis com embargo (area_imovel, em ha), área total dos imóveis no decil superior (area_imovel, em ha) e o percentual dessa área sobre a área total dos imóveis com embargo da UF.",
    "sql": "WITH base AS (\n    SELECT\n        di.cod_imovel,\n        di.cod_uf,\n        di.area_imovel,\n        MAX(fse.percent_car_embargos) AS max_percent_emb\n    FROM analise_dados.dim_imovel di\n    JOIN analise_dados.fato_sobreposicao_embargo fse\n        ON fse.cod_imovel = di.cod_imovel\n    WHERE\n        di.ind_tipo_imovel = 'IRU'\n        AND di.area_imovel IS NOT NULL\n    GROUP BY\n        di.cod_imovel,\n        di.cod_uf,\n        di.area_imovel\n),\nthreshold AS (\n    SELECT\n        PERCENTILE_CONT(0.90) WITHIN GROUP (ORDER BY max_percent_emb) AS p90\n    FROM base\n)\nSELECT\n    de.sigla_uf,\n    -- de.nome_uf,\n    COUNT(*) AS imoveis_com_embargo,\n    COUNT(*) FILTER (WHERE b.max_percent_emb >= t.p90) AS imoveis_top_decile,\n    ROUND(SUM(b.area_imovel), 2) AS area_total_imoveis_embargados_ha,\n    ROUND(SUM(b.area_imovel) FILTER (WHERE b.max_percent_emb >= t.p90), 2) AS area_top_decile_ha,\n    ROUND(\n        100.0 * SUM(b.area_imovel) FILTER (WHERE b.max_percent_emb >= t.p90)\n        / NULLIF(SUM(b.area_imovel), 0),\n        4\n    ) AS pct_area_top_decile\nFROM base b\nCROSS JOIN threshold t\nJOIN analise_dados.dim_estado de\n    ON de.cod_uf = b.cod_uf\nGROUP BY\n    de.sigla_uf,\n    de.nome_uf\nORDER BY\n    pct_area_top_decile DESC,\n    de.sigla_uf;\n",
    "dificuldade": "expert",
    "categorias": [
      "unidade_conservacao",
      "geoespacial"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_088",
    "pergunta": "Quais são as 15 Terras Indígenas regularizadas com maior razão invasão/área (soma de area_ti_car sobre area_ti_total), considerando apenas imóveis IRU ativos?",
    "sql": "SELECT\n  ti.terrai_nom,\n  -- ROUND(ti.area_ti_total::numeric, 2) AS area_ti_total_ha,\n  -- ROUND(SUM(s.area_ti_car), 2) AS area_invasao_hectares,\n  ROUND(\n    SUM(s.area_ti_car) / NULLIF(ti.area_ti_total::numeric, 0),\n    4\n  ) AS razao_invasao_area\nFROM analise_dados.fato_sobreposicao_terra_indigena s\nJOIN analise_dados.dim_terra_indigena ti\n  ON ti.terrai_cod = s.terrai_cod\nJOIN analise_dados.dim_imovel im\n  ON im.cod_imovel = s.cod_imovel\nWHERE ti.fase_ti = 'Regularizada'\n  AND im.ind_tipo_imovel = 'IRU'\n  AND im.ind_status_imovel = 'AT'\n  AND ti.area_ti_total > 0\nGROUP BY\n  ti.terrai_cod,\n  ti.terrai_nom,\n  ti.etnia_nome,\n  ti.area_ti_total\nORDER BY razao_invasao_area DESC\nLIMIT 15;\n",
    "dificuldade": "expert",
    "categorias": [
      "terra_indigena",
      "geoespacial"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_089",
    "pergunta": "Selecione as maiores cidades em área de cada região do Brasil. Em seguida, calcule o baricentro do polígono formado pelos centroides dessas cidades. Por fim, informe o nome da cidade onde esse baricentro está localizado, juntamente com o estado (nome) e a quantidade de CARs.",
    "sql": "WITH municipio_regiao AS (\n    SELECT\n        m.cod_mun,\n        m.mun_nome,\n        m.cod_uf,\n        m.geo_mun,\n        CASE (m.cod_uf / 10)\n            WHEN 1 THEN 'Norte'\n            WHEN 2 THEN 'Nordeste'\n            WHEN 3 THEN 'Sudeste'\n            WHEN 4 THEN 'Sul'\n            WHEN 5 THEN 'Centro-Oeste'\n        END AS regiao,\n        ROW_NUMBER() OVER (\n            PARTITION BY (m.cod_uf / 10)\n            ORDER BY ST_Area(m.geo_mun) DESC\n        ) AS rn\n    FROM analise_dados.dim_municipio m\n    WHERE m.geo_mun IS NOT NULL\n),\n\n-- 1) Maior município de cada região\nmaiores_por_regiao AS (\n    SELECT cod_mun, mun_nome, cod_uf, geo_mun, regiao\n    FROM municipio_regiao\n    WHERE rn = 1\n),\n\n-- 2) Baricentro do polígono formado pelos centroides das 5 cidades\nbaricentro AS (\n    SELECT\n        ST_Centroid(\n            ST_ConvexHull(\n                ST_Collect(ST_Centroid(geo_mun))\n            )\n        ) AS ponto\n    FROM maiores_por_regiao\n),\n\n-- 3) Município que contém o baricentro\ncidade_baricentro AS (\n    SELECT\n        m.cod_mun,\n        m.mun_nome,\n        m.cod_uf\n    FROM analise_dados.dim_municipio m\n    CROSS JOIN baricentro b\n    WHERE ST_Contains(m.geo_mun, b.ponto)\n    LIMIT 1\n)\n\nSELECT\n    cb.mun_nome                AS municipio,\n    de.nome_uf                AS estado,\n    COUNT(di.cod_imovel)       AS qtd_cars\nFROM cidade_baricentro cb\nJOIN analise_dados.dim_estado de\n    ON de.cod_uf = cb.cod_uf\nLEFT JOIN analise_dados.dim_imovel di\n    ON di.cod_mun = cb.cod_mun\nGROUP BY\n    cb.mun_nome,\n    de.nome_uf;",
    "dificuldade": "expert",
    "categorias": [
      "desmatamento",
      "sobreposicao",
      "imovel"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": true
  },
  {
    "id": "environmental_registry_benchmark_090",
    "pergunta": "Para cada ano de desmatamento no bioma Amazônia, calcule o **centroide geográfico ponderado pela área desmatada** — ou seja, a média ponderada das coordenadas `latitude_desmatamento` e `longitude_desmatamento`, usando `area_desmatada` como peso. Em seguida, identifique o **município cujo centroide geométrico é mais próximo** desse ponto ponderado (usando `ST_Distance` entre o centroide do polígono do município e o ponto ponderado, transformando as coordenadas geográficas para o SRID 5880 das geometrias municipais).\n\nPara cada ano, informe:\n- **Ano**\n- **Município mais próximo** ao centroide ponderado\n- **Estado** (nome)\n- **Área total desmatada** no bioma Amazônia naquele ano (hectares, arredondada a 2 casas decimais)\n- **Latitude e longitude do centroide ponderado** (arredondadas a 6 casas decimais)\n- **Análise de migração do centro de gravidade** em relação ao ano anterior, classificada como:\n  - `Início da série` para o primeiro ano\n  - `Centro de gravidade estável em relação ao ano anterior` quando município e estado coincidem com o ano anterior\n  - Direção cardeal ou intercardeal do deslocamento (ex.: `Migrou para nordeste em relação ao ano anterior`, `Migrou para sudoeste em relação ao ano anterior`, etc.), determinada pela variação das coordenadas do centroide ponderado entre anos consecutivos (latitude maior → norte; longitude maior → leste)\n\nOrdene cronologicamente.",
    "sql": "WITH desmatamento_amazonia_ano AS (\n    SELECT\n        CAST(ano_desmatamento AS integer) AS ano,\n        SUM(area_desmatada) AS area_total_desmatada_ha,\n        SUM(latitude_desmatamento * area_desmatada)\n            / NULLIF(SUM(area_desmatada), 0) AS latitude_centroide_ponderado,\n        SUM(longitude_desmatamento * area_desmatada)\n            / NULLIF(SUM(area_desmatada), 0) AS longitude_centroide_ponderado\n    FROM fato_desmatamento\n    WHERE bioma = 'Amazônia'\n      AND area_desmatada IS NOT NULL\n      AND latitude_desmatamento IS NOT NULL\n      AND longitude_desmatamento IS NOT NULL\n    GROUP BY CAST(ano_desmatamento AS integer)\n),\ncentroides_municipios AS (\n    SELECT\n        m.mun_nome,\n        e.nome_uf,\n        ST_Centroid(m.geo_mun) AS centroide_municipio\n    FROM dim_municipio AS m\n    JOIN dim_estado AS e\n      ON e.cod_uf = m.cod_uf\n),\ndistancias AS (\n    SELECT\n        d.ano,\n        d.area_total_desmatada_ha,\n        d.latitude_centroide_ponderado,\n        d.longitude_centroide_ponderado,\n        cm.mun_nome,\n        cm.nome_uf,\n        ROW_NUMBER() OVER (\n            PARTITION BY d.ano\n            ORDER BY ST_Distance(\n                cm.centroide_municipio,\n                ST_Transform(\n                    ST_SetSRID(\n                        ST_MakePoint(\n                            d.longitude_centroide_ponderado,\n                            d.latitude_centroide_ponderado\n                        ),\n                        4674\n                    ),\n                    5880\n                )\n            ) ASC, cm.mun_nome ASC\n        ) AS rn\n    FROM desmatamento_amazonia_ano AS d\n    CROSS JOIN centroides_municipios AS cm\n),\nmais_proximo_por_ano AS (\n    SELECT *\n    FROM distancias\n    WHERE rn = 1\n)\nSELECT\n    ano,\n    mun_nome AS municipio_mais_proximo_ao_centroide_ponderado,\n    nome_uf AS estado,\n    ROUND(area_total_desmatada_ha, 2) AS area_total_desmatada_ha,\n    ROUND(latitude_centroide_ponderado, 6) AS latitude_centroide_ponderado,\n    ROUND(longitude_centroide_ponderado, 6) AS longitude_centroide_ponderado,\n    CASE\n        WHEN LAG(mun_nome) OVER (ORDER BY ano) IS NULL\n            THEN 'Início da série'\n        WHEN mun_nome = LAG(mun_nome) OVER (ORDER BY ano)\n         AND nome_uf = LAG(nome_uf) OVER (ORDER BY ano)\n            THEN 'Centro de gravidade estável em relação ao ano anterior'\n        WHEN latitude_centroide_ponderado > LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n         AND longitude_centroide_ponderado > LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n            THEN 'Migrou para nordeste em relação ao ano anterior'\n        WHEN latitude_centroide_ponderado > LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n         AND longitude_centroide_ponderado < LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n            THEN 'Migrou para noroeste em relação ao ano anterior'\n        WHEN latitude_centroide_ponderado < LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n         AND longitude_centroide_ponderado > LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n            THEN 'Migrou para sudeste em relação ao ano anterior'\n        WHEN latitude_centroide_ponderado < LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n         AND longitude_centroide_ponderado < LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n            THEN 'Migrou para sudoeste em relação ao ano anterior'\n        WHEN latitude_centroide_ponderado = LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n         AND longitude_centroide_ponderado > LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n            THEN 'Migrou para leste em relação ao ano anterior'\n        WHEN latitude_centroide_ponderado = LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n         AND longitude_centroide_ponderado < LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n            THEN 'Migrou para oeste em relação ao ano anterior'\n        WHEN latitude_centroide_ponderado > LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n         AND longitude_centroide_ponderado = LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n            THEN 'Migrou para norte em relação ao ano anterior'\n        WHEN latitude_centroide_ponderado < LAG(latitude_centroide_ponderado) OVER (ORDER BY ano)\n         AND longitude_centroide_ponderado = LAG(longitude_centroide_ponderado) OVER (ORDER BY ano)\n            THEN 'Migrou para sul em relação ao ano anterior'\n        ELSE 'Sem variação identificável'\n    END AS analise_migracao\nFROM mais_proximo_por_ano\nORDER BY ano;",
    "dificuldade": "expert",
    "categorias": [
      "terra_indigena",
      "unidade_conservacao",
      "geoespacial"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_106",
    "pergunta": "Em Ouro Branco, a proporção de imóveis grandes é alta ou baixa?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "municipality_name",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_107",
    "pergunta": "Viçosa ou Triunfo: onde os imóveis ativos ocupam mais área no total?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "municipality_name",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_108",
    "pergunta": "Jussara tem muito CAR com embargo ou é só impressão?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "municipality_name",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_109",
    "pergunta": "Se eu olhar só os imóveis suspensos, Nova Olinda aparece pior que Novo Horizonte?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "municipality_name",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_110",
    "pergunta": "Em Cantagalo, qual é o tamanho do maior imóvel rural?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "municipality_name",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_111",
    "pergunta": "Belém tem mais CAR ativo ou mais CAR pendente?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "municipality_name",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_112",
    "pergunta": "Entre Boa Esperança, Mundo Novo e Santa Cruz, qual município parece mais pressionado por embargo?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "municipality_name",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_113",
    "pergunta": "Estou tentando lembrar se Cachoeira Dourada tinha muito CAR; consegue me passar o total sem abrir os detalhes?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "municipality_name",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_114",
    "pergunta": "Qual Santa Inês fica mais perto de Bom Jardim pelos centroides?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "municipality_name",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_115",
    "pergunta": "São Francisco lidera em área média de imóvel ou não?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "municipality_name",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_116",
    "pergunta": "Me ajuda numa dúvida rápida: Água Branca tem mais CAR ativo ou suspenso?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "municipality_name",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_117",
    "pergunta": "Em Alto Alegre, o volume de imóveis grandes chama atenção?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "municipality_name",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_118",
    "pergunta": "Se eu cruzar Cruzeiro do Sul com Itambé, onde há mais CAR com desmatamento acumulado?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "municipality_name",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_119",
    "pergunta": "Estou montando um recorte do Sul de Minas; quantos CARs entram aí?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "informal_region",
      "geographic_scope"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_120",
    "pergunta": "Para o Vale do Jequitinhonha, eu queria a soma da área dos imóveis ativos por município.",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "informal_region",
      "geographic_scope"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_121",
    "pergunta": "No Vale do Aço, qual cidade carrega mais embargos ligados a imóveis rurais?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "informal_region",
      "geographic_scope"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_122",
    "pergunta": "Me passa a quantidade de CARs da Zona da Mata mineira.",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "informal_region",
      "geographic_scope"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_123",
    "pergunta": "No Triângulo Mineiro, quais municípios mais concentram imóveis grandes?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "informal_region",
      "geographic_scope"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_124",
    "pergunta": "Para o Norte de Minas, o desmatamento de 2024 ficou concentrado em poucos municípios ou espalhado?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "informal_region",
      "geographic_scope"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_125",
    "pergunta": "Queria um total de CARs do Oeste baiano, sem precisar listar município por município.",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "informal_region",
      "geographic_scope"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_126",
    "pergunta": "No Vale do Paraíba, onde os imóveis rurais grandes mais se concentram?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "informal_region",
      "geographic_scope"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_127",
    "pergunta": "Baixada Santista tem muito CAR se sobrepondo entre si?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "informal_region",
      "geographic_scope"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_128",
    "pergunta": "Serra da Mantiqueira me interessa só pela quantidade de imóveis ativos; você consegue fechar esse número?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "informal_region",
      "geographic_scope"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_129",
    "pergunta": "Para o semiárido, eu queria a média de área dos imóveis rurais.",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "informal_region",
      "geographic_scope"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_130",
    "pergunta": "MATOPIBA está puxando mais para cima a quantidade de imóveis ou a área total?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "informal_region",
      "geographic_scope"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_131",
    "pergunta": "Bom Sucesso está pior por quantidade de imóveis ou por área total cadastrada?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "metric_definition",
      "needs_operationalization"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_132",
    "pergunta": "No caso de São Domingos, o que pesa mais: quantidade de imóveis ou área total deles?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "metric_definition",
      "needs_operationalization"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_133",
    "pergunta": "Entre Bonito e Santa Helena, onde a situação fundiária parece mais complicada?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "metric_definition",
      "needs_operationalization"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_134",
    "pergunta": "Em Ouro Branco, o maior CAR é muito fora da curva ou acompanha a média?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "metric_definition",
      "needs_operationalization"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_135",
    "pergunta": "Campo Grande aparece mais por área ou por quantidade de imóveis?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "metric_definition",
      "needs_operationalization"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_136",
    "pergunta": "Em Jussara, os imóveis grandes concentram a maior parte da área?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "metric_definition",
      "needs_operationalization"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_137",
    "pergunta": "Quero saber onde a pressão parece maior entre Bom Jesus, Bom Sucesso e Bom Jardim, mas sem ficar me enchendo de ranking.",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "metric_definition",
      "needs_operationalization"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_138",
    "pergunta": "Se eu tiver que escolher um estado como o mais enrolado fundiariamente, qual sairia?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "metric_definition",
      "needs_operationalization"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_139",
    "pergunta": "Qual município tem mais conflito fundiário?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "metric_definition",
      "needs_operationalization"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_140",
    "pergunta": "O que seria o município mais crítico se eu quiser misturar embargo, desmatamento e sobreposição?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "metric_definition",
      "needs_operationalization"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_141",
    "pergunta": "Sobre a Paquiçamba, eu só queria saber em quais municípios ela cai hoje.",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "entity_type",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_142",
    "pergunta": "Kariri-Xocó já está regularizada ou ainda não?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "entity_type",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_143",
    "pergunta": "PA Bom Jesus está sobrando capacidade ou faltando?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "entity_type",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_144",
    "pergunta": "São José, como terra da União, está regular ou enrolada?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "entity_type",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_145",
    "pergunta": "Qual parque estadual fica na Serra Negra?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "entity_type",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_146",
    "pergunta": "Qual é a distância entre São Paulo e São João dos Pinhais usando os centroides?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "entity_type",
      "homonym"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_147",
    "pergunta": "Ibituru está com quantos CARs ativos hoje?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "typo",
      "near_match"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_148",
    "pergunta": "Paraopebas tem mais embargo ou mais desmatamento em 2024?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "typo",
      "near_match"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_149",
    "pergunta": "Uberlandeia está puxando muita área de imóvel grande?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "typo",
      "near_match"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_150",
    "pergunta": "Na TI Paquiçambaa, quantos CARs ativos se sobrepõem?",
    "sql": "clarification",
    "dificuldade": "fácil",
    "categorias": [
      "typo",
      "near_match"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_151",
    "pergunta": "Na Amazônia, quantas áreas não destinadas existem afinal?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "schema_gap",
      "unsupported_output"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_152",
    "pergunta": "Perto de Belo Horizonte, qual parque estadual aparece primeiro?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "schema_gap",
      "unsupported_output"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_154",
    "pergunta": "Depois que o banco começou a registrar isso, qual TI mais recebeu sobreposição?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "schema_gap",
      "unsupported_output"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_155",
    "pergunta": "Os assentamentos mais recentes estão lotando rápido ou devagar?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "schema_gap",
      "unsupported_output"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_156",
    "pergunta": "APP e Reserva Legal aparecem separadas no banco? Se sim, quantos imóveis estão nas duas ao mesmo tempo?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "schema_gap",
      "unsupported_output"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_157",
    "pergunta": "Me entrega um gráfico da evolução dos embargos por bioma para eu bater o olho.",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "schema_gap",
      "unsupported_output"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_158",
    "pergunta": "Qual terra militar no Mato Grosso encosta em mais imóveis ativos?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "schema_gap",
      "unsupported_output"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_159",
    "pergunta": "Dá para localizar a bacia hidrográfica com mais desmatamento em 2024?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "schema_gap",
      "unsupported_output"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_160",
    "pergunta": "Qual UC estadual mais sofre com sobreposição de CAR? Se o nome oficial estiver diferente, pode usar o popular.",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "schema_gap",
      "unsupported_output"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_161",
    "pergunta": "Terras TI com sobreposição a terras militares, quais são?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "schema_gap",
      "unsupported_output"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_162",
    "pergunta": "Na cidade de Serra Negra, qual é o parque estadual que mais tem sobreposição de CAR?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "schema_gap",
      "unsupported_output"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_163",
    "pergunta": "Dá para me falar o PIB do estado campeão de embargos em 2023 sem sair do banco?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "external_dataset",
      "cross_system"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_164",
    "pergunta": "Qual desses municípios mais embargados tem o pior IDHM?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "external_dataset",
      "cross_system"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_165",
    "pergunta": "Nas áreas com mais sobreposição de CAR, chove mais ou menos que a média do estado?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "external_dataset",
      "cross_system"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_166",
    "pergunta": "Tem como descobrir qual rodovia federal corta mais Terras Indígenas?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "external_dataset",
      "cross_system"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_167",
    "pergunta": "Qual é a qualidade da água do município com mais embargos?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "external_dataset",
      "cross_system"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_168",
    "pergunta": "Entre os municípios com TIs, qual tem mais escolas indígenas dentro do território?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "external_dataset",
      "cross_system"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_169",
    "pergunta": "A precipitação média anual ajuda a explicar as UCs com mais CAR por cima?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "external_dataset",
      "cross_system"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_170",
    "pergunta": "Você consegue cruzar os municípios com mais CAR ativo e dizer qual deles tem a maior população?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "external_dataset",
      "cross_system"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_171",
    "pergunta": "No município com maior estoque de embargos, como está a renda per capita?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "external_dataset",
      "cross_system"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_172",
    "pergunta": "Qual cidade tem mais registro no ANA?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "external_dataset",
      "cross_system"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_173",
    "pergunta": "Qual município tem mais registros de outorga da ANA sobrepostos a imóveis rurais?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "ana",
      "hydrology"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_174",
    "pergunta": "Entre os CARs ativos, quais têm captação de água cadastrada na ANA?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "ana",
      "hydrology"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_175",
    "pergunta": "Na Amazônia Legal, os CARs com mais embargo também estão perto de rios monitorados pela ANA?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "ana",
      "hydrology"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_176",
    "pergunta": "Qual estado concentra mais pontos de monitoramento hidrológico da ANA em imóveis com desmatamento?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "ana",
      "hydrology"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_177",
    "pergunta": "No Vale do São Francisco, qual cidade tem mais outorgas da ANA em área de CAR?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "ana",
      "hydrology"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_178",
    "pergunta": "Entre os imóveis rurais grandes, quais estão mais próximos de reservatórios da ANA?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "ana",
      "hydrology"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_179",
    "pergunta": "Quais CARs têm alerta de desmatamento do DETER/INPE em 2024?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "inpe_ibama_dnit",
      "external_monitoring"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_180",
    "pergunta": "Me mostra os imóveis com mais focos de calor do INPE no último ano.",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "inpe_ibama_dnit",
      "external_monitoring"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_181",
    "pergunta": "Qual estado teve mais queimadas do INPE dentro de imóveis rurais ativos?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "inpe_ibama_dnit",
      "external_monitoring"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_182",
    "pergunta": "Entre os municípios com mais desmatamento em CAR, quais também lideram em focos de calor do INPE?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "inpe_ibama_dnit",
      "external_monitoring"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_183",
    "pergunta": "Tem algum imóvel rural com alerta DETER do INPE e embargo ao mesmo tempo?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "inpe_ibama_dnit",
      "external_monitoring"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_184",
    "pergunta": "Quero comparar os focos de calor do INPE com os embargos do IBAMA por município.",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "inpe_ibama_dnit",
      "external_monitoring"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_185",
    "pergunta": "Qual município tem mais áreas embargadas pelo IBAMA com valor de multa mais alto?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "inpe_ibama_dnit",
      "external_monitoring"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_187",
    "pergunta": "Quais CARs estão a menos de 5 km de rodovias federais do DNIT?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "inpe_ibama_dnit",
      "external_monitoring"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_188",
    "pergunta": "Qual TI cruza mais quilômetros de rodovia do DNIT?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "inpe_ibama_dnit",
      "external_monitoring"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_189",
    "pergunta": "Qual município com muito CAR também tem maior população segundo o IBGE?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "ibge_aneel_inmet_anm_incra_funai_icmbio",
      "external_public_data"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_190",
    "pergunta": "Entre os estados com mais imóveis rurais, qual tem maior PIB do IBGE?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "ibge_aneel_inmet_anm_incra_funai_icmbio",
      "external_public_data"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_191",
    "pergunta": "Qual cidade com mais embargo tem a menor população estimada pelo IBGE?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "ibge_aneel_inmet_anm_incra_funai_icmbio",
      "external_public_data"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_192",
    "pergunta": "Quero o rendimento médio do município com maior área desmatada em CAR.",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "ibge_aneel_inmet_anm_incra_funai_icmbio",
      "external_public_data"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_193",
    "pergunta": "Quais imóveis estão mais perto de usinas hidrelétricas da ANEEL?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "ibge_aneel_inmet_anm_incra_funai_icmbio",
      "external_public_data"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_194",
    "pergunta": "Qual município com mais embargo também tem estação do INMET?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "ibge_aneel_inmet_anm_incra_funai_icmbio",
      "external_public_data"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_195",
    "pergunta": "Qual município tem mais processos minerários da ANM sobre imóveis CAR?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "ibge_aneel_inmet_anm_incra_funai_icmbio",
      "external_public_data"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_198",
    "pergunta": "Qual parque nacional do banco recebe mais visitantes segundo o ICMBio?",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "ibge_aneel_inmet_anm_incra_funai_icmbio",
      "external_public_data"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  },
  {
    "id": "environmental_registry_benchmark_200",
    "pergunta": "Quero o número de UBS do SUS no município com maior estoque de CAR.",
    "sql": "unanswerable",
    "dificuldade": "fácil",
    "categorias": [
      "ibge_aneel_inmet_anm_incra_funai_icmbio",
      "external_public_data"
    ],
    "order_matters": false,
    "num_column_matters": false,
    "num_row_matters": false
  }
]