import json

S, P, D, U = "SAME", "PART_OF", "DIFFERENT", "UNSURE"
H, M, L = "high", "medium", "low"
N = None

V = [
("d0004", P, 0, M, "Taman Sri Dengkil is an estate inside the Dengkil locality row; no candidate names the estate itself.", False),
("d0010", S, 0, H, "Exact estate name, 169 m, median within 6%; C lists only the houses.", False),
("d0016", D, N, H, "Jana Permai vs Jana Jaya 3: different estate suffix.", False),
("d0022", D, N, H, "R is in Larut Matang, Perak; every candidate is in Selangor or Johor.", False),
("d0028", S, 0, H, "Exact name with Sungai Pelek locality; identical median RM499,000.", False),
("d0034", D, N, M, "R is Bandar Puchong Utama shop-offices; candidates are the industrial park and residential rows.", False),
("d0040", D, N, H, "R is Lembah Bujang phase 2 resales; C is the separate 2027 new launch Lembah Bujang Saujana.", False),
("d0046", S, 0, M, "Both are SS 8 PJ locality rows; R covers serviced apartments only, C terrace houses.", False),
("d0052", D, N, M, "R's Taman Bestari is in Terengganu; candidates are Selangor/Johor namesakes, price match is coincidence.", False),
("d0058", S, 2, M, "Both are Olak Lempit locality rows; C's median is dragged down by land lots.", False),
("d0064", D, N, M, "R is the old Taman Chengal in Temerloh town; C is a 2025 Bera estate 21 km away.", True),
("d0070", D, N, H, "Desa Cempaka is in Negeri Sembilan; candidates are Taman Cempaka rows in Selangor.", False),
("d0076", D, N, H, "Road-named scheme; Reko Mutiara and Sri Reko are different estates at under half the price.", False),
("d0082", S, 0, M, "R covers the apartment units of Taman Impian Senai; C row is the estate (terraces), 116 m.", False),
("d0088", S, 0, M, "Exact name in Johor, 129 m; Kluang price 0.67x fits far better than the JB namesake.", False),
("d0094", S, 1, H, "Persanda service apartments are in Seksyen 13 Shah Alam; unit sizes and prices match listings.", True),
("d0100", D, N, L, "C 'Bercham' looks like a 2026 new-launch condo listing, not the landed Taman Seri Bercham.", False),
("d0106", S, 0, M, "Exact name unique to Kajang; median 1.67x higher, probably unit mix or period.", False),
("d0112", S, 2, H, "Trehaus Condo Villas: 78 m, median identical, psf within 6%.", False),
("d0118", S, 0, L, "No R location; Bukit Mertajam's Taman Belimbing fits price (1.32x), Seri Kembangan's does not.", False),
("d0124", S, 0, H, "Same condo: 61 m, identical psf and median.", False),
("d0130", D, N, H, "'Intan Aman' names a different estate from Taman Aman.", False),
("d0136", S, 0, H, "Exact building name in KL, 56 m.", False),
("d0142", D, N, H, "Paya Rumput Permai differs from the Utama, Berlian and Abadi estates.", False),
("d0148", D, N, H, "Taman Mantin is not Taman Sri Mawar, Mantin.", False),
("d0154", D, N, M, "R is shop lots; C Bandar Puteri Bangi row is residential (terrace, land).", False),
("d0160", D, N, H, "R is in Pendang, Kedah; candidates are Johor/Selangor namesakes.", False),
("d0166", S, 1, M, "Both are Sungai Ara locality rows; R covers the flats only.", False),
("d0172", D, N, H, "Rambai Villa differs from Bukit Rambai, Seri Rambai and Muar's Taman Rambai.", False),
("d0178", S, 0, H, "Pangsapuri Sentral Butterworth: ~750 sf units near RM250k match R; C's price fields look wrong.", True),
("d0184", S, 0, H, "Exact condominium name in KL, 13 m.", False),
("d0190", S, 0, H, "Same serviced residence: 9 m, identical psf, median within 1%.", False),
("d0196", S, 0, H, "Exact condominium name in Penang (Bayan Lepas), 62 m.", False),
("d0202", P, 0, M, "R is the Serada locality (mukim); Taman Serada Indah 2 is an estate within it.", False),
("d0208", S, 0, H, "Exact Kampung Baru Kangkar Pulai, 421 m, price 0.79x.", False),
("d0214", P, 3, L, "R's shops likely the commercial units of the Pandan Utama shop-apartment; 3.4 km offset, no C price.", False),
("d0220", S, 0, M, "Taman Minang, Batu 9 Cheras, 130 m; C[1] condo row shares the name; R covers the houses.", False),
("d0226", S, 1, H, "Alias Jesselton Hill = Jesselton Hills, Alma, 86 m; price 0.77x.", False),
("d0232", D, N, H, "Bukit Jana Indah is not Taman Jana Jaya 3.", False),
("d0238", U, 0, L, "Only Selangor namesake is Klang's, 12 km from R's name geocode; C has no usable price.", False),
("d0244", S, 0, H, "Exact name including phase 2, Batu Pahat, 86 m.", False),
("d0250", S, 0, H, "Same condo: 81 m, psf 678 vs 682.", False),
("d0256", D, N, L, "Generic name, no R location; R's geocode lies 200+ km from every candidate.", False),
("d0262", P, 0, M, "'Tambahan' is the extension of Kampung Melayu Rasa.", False),
("d0268", P, 0, M, "R is phase 2 of Taman Semenyih Indah.", False),
("d0274", D, N, M, "R is shop lots; Taman Bukit Pasir candidates are residential.", False),
("d0280", D, N, H, "Jerai Sejahtera differs from Taman Jerai Jaya.", False),
("d0286", S, 0, H, "Same condo: 9 m, identical median.", False),
("d0292", S, 0, H, "Exact name and locality Batang Berjuntai, 2 km (road-level point).", False),
("d0298", S, 3, H, "Tanming/Taming spelling variants; identical median RM452,500, Kajang.", False),
("d0304", P, 0, L, "C 'Sungai Long' seems a locality row (its dup 'Sg Long Residence' is a condo); R estate inside.", False),
("d0310", S, 0, H, "Exact Taman Desa Permai, Meru (Klang), 160 m, price 1.01x.", False),
("d0316", D, N, H, "Lembah Bujang Utama differs from Lembah Bujang Saujana and the Penang estates.", False),
("d0322", S, 0, H, "Exact name, Banting, identical median RM320,000; C point offset.", False),
("d0328", D, N, H, "Desa Lang Damai differs from Desa Lang Indah and Lang Residences.", False),
("d0334", S, 0, H, "Same PJ Section 19 locality; price 1.04x; distance is section-geocoding noise.", False),
("d0340", S, 2, H, "Bestari Jaya is Batang Berjuntai's new name; exact estate, price 0.82x; C point misplaced.", False),
("d0346", S, 0, H, "Exact Taman Kulai Besar, 159 m; C[1] duplicates it.", False),
("d0352", S, 0, H, "Identical median RM752,500; Bagan Lalang is a Butterworth locality, C point misplaced.", False),
("d0358", D, N, H, "Tun Tuah differs from Tuah Perdana and Taman Tuah.", False),
("d0364", D, N, H, "R's Taman Kristal is in Pahang; candidates are in other states.", False),
("d0370", D, N, H, "R is Ampang's Desa Permai apartments; candidates are Kapar, Klang, Cheras and Taman Desa namesakes.", False),
("d0376", S, 0, H, "Exact name and locality Tanjong Karang, 510 m.", False),
("d0382", D, N, M, "Jalan Sengkang is in Tangkak district; C's Taman Permatang Jaya is Gelang Patah, 149 km.", True),
("d0388", S, 0, H, "Taman Sentosa, Bukit Mertajam (SPT), 114 m, price 1.15x.", False),
("d0394", S, 0, H, "Exact name, Penang, 491 m, price 1.18x.", False),
("d0400", D, N, L, "Generic name, no R location; R's geocode lies 100+ km from every candidate.", False),
("d0406", S, 0, M, "R is Kapar's Taman Dagang = C[0]'s dup 'Taman Dagang, Klang'; C[0] itself is Ampang's estate.", False),
("d0412", D, N, H, "Sungai Rambai Jaya differs from the Setia, Damai, Ria and Desa estates.", False),
("d0418", U, 2, L, "Generic name, no R location; psf fits Pangsapuri Saujana Gombak but names differ.", False),
("d0424", D, N, H, "Road-named scheme; Taman Khalidi Bharu is a different estate at 0.4x price.", False),
("d0430", D, N, H, "Bukit Cheng differs from Taman Cheng Setia.", False),
("d0436", S, 2, H, "Exact name, apartments in Kinrara Industrial Park; psf 229 vs 247.", False),
("d0442", D, N, H, "Aman Mulia differs from Sri Mulia, Jeram Mulia and Taman Mulia.", False),
("d0448", S, 0, H, "3 Elements SOHO units: 65 m, psf 476 vs 451, price 1.10x.", False),
("d0454", S, 0, M, "Exact name, 126 m; price 1.64x as C mixes flats; dup 'Kajang Impiana' is another building.", False),
("d0460", P, 0, M, "C is a 2027 new-launch flat phase within R's landed Taman Tuah Perdana, Jasin.", False),
("d0466", S, 0, H, "Exact name with Sepang locality, 44 m, price 0.79x.", False),
("d0472", D, N, M, "R is the Pertam Jaya apartment block; C is a new terrace phase.", False),
("d0478", D, N, H, "R is industrial-park shops; candidates are Bukit Serdang residential rows.", False),
("d0484", S, 0, M, "Exact industrial estate name, 61 m; C's 'Flat' type and RM38k median look wrong.", False),
("d0490", S, 0, H, "Bandar Sejahtera, Pokok Sena township, 867 m; C[1] is its phase 1.", False),
("d0496", P, 0, M, "R is phase 7 of Taman Tangkak Jaya; newer phase priced higher.", False),
("d0502", S, 0, H, "Same building: 23 m, psf 770 vs 766.", False),
("d0508", S, 0, M, "R covers apartment units of Taman Anggerik Perdana; C row is the estate (terraces), 68 m.", False),
("d0514", S, 0, H, "Taman Intan, Ledang (Tangkak), 1.5 km, price 1.10x.", False),
("d0520", D, N, H, "R is in Kedah; Serai 3 is in Kuala Selangor.", False),
("d0526", S, 0, H, "Bandar Bukit Mahkota township, 557 m, price 0.95x; dup PR1MA residence is a building within.", False),
("d0532", S, 0, H, "Taman Sri Emas 3, Muar; III = 3.", False),
("d0538", P, 0, M, "R is phase 1 of Desa Impian 2, an extension of Taman Desa Impian, Alma.", False),
("d0544", S, 0, H, "Exact name, identical median RM465,000; C point offset.", False),
("d0550", D, N, H, "No Taman Kawan among candidates.", False),
("d0556", S, 0, H, "Exact name, George Town, 40 m.", False),
("d0562", D, N, H, "Maju Rapat differs from Taman Rapat Mutiara.", False),
("d0568", P, 1, M, "R is the Strand Garden Office tower of The Strand, Kota Damansara; C[0] is its residences.", False),
("d0574", S, 0, H, "The Troika, 379 m, psf 1025 vs 984.", False),
("d0580", S, 0, H, "Taman Taming Jaya, 346 m; C includes the flats (dup 'Flat Taming Jaya').", False),
("d0586", D, N, H, "R is in Perak; Bistari/Bestari candidates are in other states.", False),
("d0592", D, N, H, "TTDI Jaya (Shah Alam U2) is not Taman Tun Dr Ismail, KL.", False),
("d0598", S, 0, H, "Both Pulau Indah locality rows, price 1.04x.", False),
("d0604", D, N, H, "Setia Senai differs from Senai, Impian Senai and Senai Utama.", False),
("d0610", S, 0, H, "Taman Sri Bakri, Muar; price 0.92x.", False),
("d0616", P, 2, M, "R covers all Lip Sin flats; C[2] is blocks 1, 3 & 5 (psf 406 vs 414).", False),
("d0622", S, 0, H, "The Andes @ Bukit Jalil, 43 m, median ~identical.", False),
("d0628", S, 0, L, "No R location; Muar's Taman Mas Indah 1.3 km from name geocode, price 1.50x.", False),
("d0634", S, 0, H, "Exact name, 53 m; C includes apartments, psf 380 vs 402.", False),
("d0640", P, 3, M, "Cassia is a precinct of Taman Pulai Mutiara 2 (price ~identical).", False),
("d0646", S, 0, H, "Shangri La Residence, JB, 713 m, price 0.88x.", False),
("d0652", D, N, L, "Generic name, no R location; R's geocode lies ~190-300 km from every candidate.", False),
("d0658", D, N, H, "Sebatu Indah differs from Taman Sebatu Perdana.", False),
("d0664", D, N, M, "R is Klang town shops; candidates are residential estates and apartments.", False),
("d0670", D, N, H, "Desa Nyu differs from Taman Nyu Indah 2.", False),
("d0676", D, N, H, "R is TR-area (north-west Johor) shops; candidates are residential namesakes in Kluang, Selangor, Penang.", False),
("d0682", D, N, H, "R is an industrial estate; candidates are Kulai residential tamans.", False),
("d0688", S, 0, M, "R covers Mutiara Ville's serviced-apartment units; C psf lower, likely its condo blocks.", False),
("d0694", S, 1, H, "Alias Santuary Villa = Sanctuary Villa @ Permatang Sanctuary, 454 m, price 1.11x.", False),
("d0700", D, N, M, "R is shop lots; C Taman Indah Murni row is a 1985 flat block.", False),
("d0706", S, 2, M, "Flats; psf 280 vs 285 at Pangsapuri Cheras Utama; R location from name only.", False),
("d0712", S, 0, M, "Mayang Court, Jalan Mayang KLCC (40 units); PJ namesake psf far off; C prices thin.", True),
("d0718", P, 0, M, "R is phase 2 of Taman Rimba Jaya, Pontian; 296 m, price 1.03x.", False),
("d0724", P, 0, M, "R is the Setongkol locality; Taman Setongkol Maju is a new estate within it.", False),
("d0730", P, 0, M, "R is the Sanctuary Village precinct of Taman Santuari.", False),
("d0736", S, 0, H, "Oakleaf Park, 54 m, identical median.", False),
("d0742", U, 0, L, "Banting's Taman Seri Mulia fits price (0.82x), but R's name geocode is 57 km away.", False),
("d0748", S, 0, M, "Taman Utama, Segamat (Sungai Segamat), 873 m; C's 2026 tag likely a newer phase.", False),
("d0754", S, 0, M, "Taman Vanilla, Teluk Kumbar, 121 m; C typed apartment, R landed.", False),
("d0760", D, N, H, "Houses along Jalan Union vs the Union Flat block.", False),
("d0766", D, N, H, "Wira Mas differs from Seri Naga, Mutiara Naga and Taman Wira.", False),
("d0772", U, 0, L, "Exact name, Selangor, but R landed median is 0.58x the C estate's.", False),
("d0778", S, 0, H, "Mak Mandin Jaya apartments, identical psf 399.", False),
("d0784", S, 0, H, "AraGreens, 65 m, identical psf and median.", False),
("d0790", D, N, M, "R is Section 2's landed houses; C[0] is the Section 2 apartment block.", False),
("d0796", S, 0, M, "Taman Sentul Jaya, 330 m; R covers the houses, C median diluted by flats.", False),
("d0802", S, 2, M, "Kampung Sri Tanjung lies in mukim Dengkil (verified); Taman Sri Tanjung is a different estate.", True),
("d0808", D, N, M, "R flats psf 560 vs Taman Panchor Flat psf 166; different building.", False),
("d0814", D, N, H, "R is in Labis; Taman Impian Indah candidates are Pontian, Penang, Cheras.", False),
("d0820", P, 0, M, "Pangsapuri Larkin Indah has ground-floor shops; R covers those shop units.", True),
("d0826", S, 0, L, "Exact name, Selangor, 199 m; price 0.40x but C is land-dominated.", False),
("d0832", U, 0, L, "Johor has Taman Emas in Kluang and Tangkak, both price-consistent; R has no district.", False),
("d0838", P, 0, M, "Desa Keramat (AU2C) is a sub-section of the Taman Keramat area.", False),
("d0844", D, N, H, "Green Lane Heights apartment block vs Taman Green Lane terrace estate.", False),
("d0850", S, 0, M, "R = Taman Sri Raya, Batu 9 Cheras (C[0]'s dup, 54 m); C[0]'s Senggarang label is another estate.", True),
("d0856", S, 0, H, "Kampung Kenangan, Balakong, 83 m.", False),
("d0862", D, N, H, "Kemuning Jaya differs from the other Kemuning estates.", False),
("d0868", P, 0, M, "R is phase 2 of Taman Pulai Perdana, Skudai.", False),
("d0874", S, 0, M, "Taman Sri Kemuning, Shah Alam, 523 m; no C price.", False),
("d0880", D, N, H, "Taman Kerian differs from Taman Kerian Sentosa.", False),
("d0886", S, 0, M, "Exact name and locality Jeram; R's RM80k median looks like old or low-cost sales.", False),
("d0892", D, N, H, "Ativo Plaza is the 2013 shop-office block; Ativo Suites is the separate 2021 serviced residence.", True),
("d0898", D, N, H, "Betik Manis differs from Taman Betik Indah.", False),
("d0904", D, N, M, "R is shop lots; Taman Rengit Ria row is residential.", False),
("d0910", S, 0, M, "Only Johor namesake (Simpang Renggam), price 1.03x; dup 'Taman Sri Mawar, Klang' is another estate.", False),
("d0916", D, N, M, "R is in Kapar, Klang; candidates are Semenyih, Kluang and Penang namesakes.", False),
("d0922", D, N, M, "R is in Sepang; candidates are Banting, Klang, Johor namesakes; price 1.64x.", False),
("d0928", S, 1, H, "Taman Kristal, Gurney: identical median RM330,000, psf 450 vs 471; C[0] same building.", False),
("d0934", D, N, L, "Kepayang Residence is GUH's terrace phases of Taman Bukit Kepayang; C is the Fasa H semi-Ds.", True),
("d0940", S, 0, M, "Taman Medan Putra, Telok Panglima Garang, 922 m, price 0.84x.", False),
("d0946", S, 0, H, "De Kiara, 144 m, identical psf.", False),
("d0952", S, 1, M, "Alias The Gardens @ Polo Park; R strata units = its condo row; psf gap unexplained.", False),
("d0958", U, 0, L, "Several Taman Damai Jaya (Batu 9 Cheras, Batu Caves); R has no location, prices ~1.3x.", False),
("d0964", S, 0, H, "PJ Section 20 locality, price 0.94x; dup 'Seksyen 20, Shah Alam' is a different place.", False),
("d0970", D, N, H, "Lapangan Harmoni 2 differs from Lapangan Indah and Bandar Baru Lapangan.", False),
("d0976", D, N, H, "Kampung Baru Pekan Nenas vs Taman Pekan Nenas: different settlements.", False),
("d0982", D, N, M, "R is industrial units; Taman Sri Muda rows are residential.", False),
("d0988", P, 1, M, "Taman Seri Indah lies in the Bestari Jaya locality row (844 m).", False),
("d0994", S, 0, L, "Semenyih's Taman Seri Impian, price 0.87x; R's name geocode 7 km off; Kapar namesake has own row.", False),
("d1000", S, 0, L, "Kluang's Taman Intan fits (205 m, 1.09x); other Johor Taman Intan exist.", False),
("d1006", S, 0, H, "Taman Bertam Saujana, Kepala Batas, 103 m.", False),
("d1012", D, N, H, "Lapangan Harmoni differs from Lapangan Indah and Bandar Baru Lapangan.", False),
("d1018", S, 0, H, "Taman Bukit Tropika, Ulu Tiram, 204 m, price 1.27x.", False),
("d1024", U, 0, L, "Name matches Benut's Taman Sungai Murni, but R geocode 30 km off and price 0.43x.", False),
("d1030", D, N, H, "Road-named shop scheme; candidates are residential.", False),
("d1036", S, 0, H, "Green Park Residence, Seri Kembangan, 111 m (dup confirms).", False),
("d1042", D, N, L, "Unnamed lot subdivision; Bidor Gardens is a separate 2026 new launch 3 km away.", False),
("d1048", D, N, H, "Taman Melati (Sungai Petani) differs from Melati Indah; other namesakes are far.", False),
("d1054", S, 0, L, "Taman Bukit Permai spans Ampang/Cheras (verified); median 2.6x C's, likely bungalow-heavy.", True),
("d1060", S, 0, M, "Bandar Baru Salak (Tinggi) township, 824 m; no C price.", False),
("d1066", D, N, H, "Landed 'Gardens Park' vs Garden Park condo 42 km away and other names.", False),
("d1072", S, 0, M, "Ampang's Taman Dagang, 340 m; R covers houses, C mixes flats; Klang namesake has own row.", False),
("d1078", P, 0, M, "R is phases 2 & 3 of Taman Selesa, Sungai Mati (Tangkak).", False),
("d1084", D, N, H, "No Taman Impian among Simpang Renggam candidates.", False),
("d1090", U, 0, L, "Many Selangor Taman Desa Permai; Meru's has its own R row; price 0.83x.", False),
("d1096", S, 0, H, "Taman Century, Batu Uban, 181 m, price 1.43x.", False),
("d1102", D, N, H, "Kampung Baru Simpang Renggam vs Taman estates.", False),
("d1108", P, 0, M, "C is Taman Teja 3, a phase of R's Taman Teja, Changlun.", False),
("d1114", P, 0, M, "R's shops are the commercial part of mixed Taman Masai Utama (C lists shoplots).", False),
("d1120", D, N, M, "R is USJ 8 shops; C 'USJ 8' is a residential apartment row.", False),
("d1126", S, 0, H, "Taman Salak Mulia, Sepang, 780 m.", False),
("d1132", D, N, H, "Puchong Prima blocks vs Anggerik apartments elsewhere.", False),
("d1138", S, 0, M, "Kulim's Taman Seri Aman, Kedah, 2.6 km; C tagged 2026 new launch.", False),
("d1144", S, 0, M, "Taman Greenview, Green Lane, 259 m; price 1.70x (R likely semi-D heavy).", False),
("d1150", D, N, H, "RPA Gurun (Taman Sri Jerai) differs from Taman Jerai Jaya.", False),
("d1156", P, 0, M, "Indah Court is a flat block inside the PJS 11 locality row.", False),
("d1162", P, 0, L, "Taman Gemilang is in Jitra (verified); R is its phase 2; C's 'Pendang' label looks wrong.", True),
("d1168", D, N, H, "R is in Bekok; Taman Sri Mahkota candidates are Benut and Manjung.", False),
("d1174", S, 2, M, "Sri Manja Square is Taman Sri Manja's shop-office row, 84 m.", False),
("d1180", S, 0, H, "Kampung Plentong Baru, 232 m (dup confirms).", False),
("d1186", D, N, H, "Tekkah Damai differs from Desa Tekkah Sentosa.", False),
("d1192", D, N, L, "R is Titiwangsa's landed locality; C rows are condos and a lake-park row without data.", False),
("d1198", D, N, H, "Green Lane Heights flat block vs Taman Green Lane terrace estate.", False),
("d1204", S, 0, M, "Taman Harmoni II, Skudai: exact name, price 0.93x; R's name geocode 29 km off.", False),
("d1210", D, N, M, "No Taman Idaman among candidates; Taman Tropika's equal price is coincidence.", False),
("d1216", S, 0, H, "Taman Batu Bukit, Tanjung Tokong, 145 m, price 0.75x.", False),
("d1222", P, 0, M, "A land lot inside the Pulau Indah locality row.", False),
("d1228", S, 0, H, "Bandar Tenggara township; price 1.31x.", False),
("d1234", D, N, H, "R is in Melaka; Taman Rambai Utama candidate is in Muar, Johor.", False),
("d1240", S, 0, M, "Taman Segamat Jaya, 26 m; R covers the flats only.", False),
("d1246", S, 0, H, "Serene Mont Kiara, 99 m, price 1.07x.", False),
("d1252", S, 0, H, "Taman Intan 7, Kapar: exact name/phase, price 1.33x; C point offset.", False),
("d1258", D, N, L, "C 'Bercham' looks like a 2026 new-launch condo listing, not landed Taman Bercham Maju.", False),
("d1264", S, 0, L, "Same-named flats, 113 m; psf 238 vs 206 and price 1.73x suggest different blocks.", False),
("d1270", S, 0, H, "Taman Ehsan, Kepong, price 1.07x.", False),
("d1276", D, N, H, "Desa Jana differs from Taman Jana Jaya 3.", False),
("d1282", D, N, L, "Jalan York road scheme vs Medan York cul-de-sac; neighbours with similar bungalow prices.", False),
("d1288", P, 0, M, "C is Taman Kota Ria 5, a phase of R's Kota Ria, Kuantan.", False),
("d1294", S, 0, H, "Imperial Lexis, 27 m.", False),
("d1300", S, 0, M, "Taman Cempaka Perdana, Seremban; exact name in Negeri Sembilan, no C price.", False),
("d1306", U, 0, L, "Taman Wira exists in Labis and Bukit Gambir (both TR areas); prices fit both.", True),
("d1312", D, N, L, "R is Danau Desa's landed enclave; candidates are condos and Danau Villa.", False),
("d1318", D, N, M, "R is shop lots; Taman Subang Mewah row is residential.", False),
("d1324", S, 0, M, "Exact name, identical median RM390,000; C's condo type likely wrong.", False),
("d1330", P, 0, M, "Taman Seri Kelanang lies in the Kelanang locality row (Banting), price 1.03x.", False),
("d1336", D, N, H, "Sri Maju Jaya shops vs residential Taman Maju Jaya namesakes.", False),
("d1342", U, 0, L, "No R location; price matches Muar's, but R's name geocode lies in the north.", False),
("d1348", S, 0, M, "Taman Permata Impian, Kulai, 58 m; R covers the low-cost flats only.", False),
("d1354", D, N, H, "Sikamat (Seremban) is not Sekamat (Kajang).", False),
("d1360", S, 0, H, "The Pearl KLCC, 12 m, psf 814 vs 875.", False),
("d1366", D, N, H, "Limbongan Indah shops vs different Limbongan estates; Limbungan Indah is in Penang.", False),
("d1372", D, N, M, "Saujana Sutera is an older S2 Heights precinct; C is the newer Sutera @ S2 Heights Aman.", True),
("d1378", D, N, M, "Bandar Jaya Labis differs from low-cost Taman Labis Jaya (price 3.2x).", False),
("d1384", S, 0, H, "Taman Mutiara Bukit Raja 2: exact name, price 1.02x; C's condo type likely wrong.", False),
("d1390", S, 2, L, "Only Penang 'Pangsapuri Melur' (Bagan Jermal); R prices run 12-40% higher.", True),
("d1396", D, N, H, "Sijangkang Damai differs from the Jaya, Permai, Indah and Desa estates.", False),
("d1402", D, N, H, "RIBJ low-cost houses vs Tebrau condos and Taman Sri Tebrau.", False),
("d1408", P, 0, M, "R is phase 2 of Goodyear Court 3; psf 358 vs 359.", False),
]

inp = '/var/www/html/peta/storage/app/propertylab-catalogue-match/review/r2_batch_04_in.jsonl'
out = '/var/www/html/peta/storage/app/propertylab-catalogue-match/review/r2_batch_04_out.jsonl'

vd = {}
for row in V:
    cid = row[0]
    assert cid not in vd, f"duplicate verdict {cid}"
    vd[cid] = row

cases = []
with open(inp) as f:
    for line in f:
        d = json.loads(line)
        cases.append(d)

errors = []
ids = [c['case'] for c in cases]
missing = [c for c in ids if c not in vd]
extra = [c for c in vd if c not in ids]
if missing: errors.append(f"missing: {missing}")
if extra: errors.append(f"extra: {extra}")

lines = []
for c in cases:
    cid = c['case']
    if cid not in vd: continue
    _, verdict, cand, conf, reason, web = vd[cid]
    ks = [x['k'] for x in c['catalogue_candidates']]
    if verdict == D and cand is not None: errors.append(f"{cid}: DIFFERENT with cand")
    if verdict in (S, P) and cand is None: errors.append(f"{cid}: {verdict} without cand")
    if cand is not None and cand not in ks: errors.append(f"{cid}: cand {cand} not in {ks}")
    if len(reason.split()) > 20: errors.append(f"{cid}: reason {len(reason.split())} words")
    if verdict not in (S, P, D, U): errors.append(f"{cid}: bad verdict")
    if conf not in (H, M, L): errors.append(f"{cid}: bad conf")
    lines.append(json.dumps({"case": cid, "verdict": verdict, "cand": cand, "confidence": conf, "reason": reason, "web": web}, ensure_ascii=False))

if errors:
    print("ERRORS:"); print("\n".join(errors))
else:
    with open(out, 'w') as f:
        f.write("\n".join(lines) + "\n")
    print(f"wrote {len(lines)} lines")
