require 'set'

a = [[{"line_category"=>"Spares", "unit_cost"=>"5478.03", "quantity"=>4.0, "description"=>"Optic, QSFP-DD 4x100G-FR, SMF, MPO, 2 km, Juniper", "in_agile"=>true, "physical_site"=>"SCL120", "shipping_physical_site"=>"SCL120", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"132-014430-001"}}, {"line_category"=>"Freight", "unit_cost"=>"657.360", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"SCL120", "shipping_physical_site"=>"SCL120", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"1432.18", "quantity"=>2.0, "description"=>"CPU, Intel, Cascade Lake, 8259CL, 24C, 210W, B1 Prod", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"202-001193-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"437.91", "quantity"=>3.0, "description"=>"K2V4-N3 - Smart Network card with 2x100Gbs network,  4x25G/2x100G ETH, 2x Gbe MDI, 2x 10G\\1G, 2x SATA and 2x 16 PCIe Gen 3/4 lanes, TPM2.0", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"210-000791-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"121.98", "quantity"=>2.0, "description"=>"Adapter, Storage Card, PCIe, Annapurna, K2C-AB, Low Profile, Single Chip, x16 PCIe ,2 GbE ports on edge connector, FW 3.30.0 Tools 3.30.2 (use with K2X-N/A FW 6.5.7 and above) - To be used on Hornet and Bumblebee servers Only", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"210-000162-016"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"20.81", "quantity"=>2.0, "description"=>"Sunon FAN DC12V DRAF(80*80*56)", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"217-000136-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"9.95", "quantity"=>3.0, "description"=>"Cable, CABLE ASSY, Quanta, S2V, UART3(3*2/4*2,12V,3A), K2T-25 to MB", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"216-000343-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"23.83", "quantity"=>1.0, "description"=>"Optical Module, 10G, SFP+, LR (10km)", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"132-000012-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"22.23", "quantity"=>6.0, "description"=>"Optical Module, 10G, SFP+, SR", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"132-000014-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"148.4", "quantity"=>3.0, "description"=>"Riser, C19, 1u, for Single K2V4 AIO PCIe Gen4 with retimer (BOM change for Astera Lab re-timer circuit), Quanta Design for use on Intel platforms", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"214-000130-002"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"152.900", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"1326.51", "quantity"=>3.0, "description"=>"CPU, Intel, Skylake, 8124M, 3.0GHz, 18C, 240W, H0 - SRD1Y", "in_agile"=>true, "physical_site"=>"CMH56", "shipping_physical_site"=>"CMH56", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"202-000683-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"465.38", "quantity"=>6.0, "description"=>"FG,MB,CANNONBALL,CLX/SKL,2 PCIe Riser, 4 Interposer, Brigade 1,Foxconn", "in_agile"=>true, "physical_site"=>"CMH56", "shipping_physical_site"=>"CMH56", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"205-000788-001"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"203.160", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"CMH56", "shipping_physical_site"=>"CMH56", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"1439.56", "quantity"=>1.0, "description"=>"CPU, Intel, Ice Lake, 8375C, 32C, 300W, D2 prod", "in_agile"=>true, "physical_site"=>"CMH57", "shipping_physical_site"=>"CMH57", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"202-001967-002"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"43.190", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"CMH57", "shipping_physical_site"=>"CMH57", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"42.66", "quantity"=>1.0, "description"=>"Cable, QSFP28 to 4x25G, Direct Attach Copper (DAC) (2.0m)", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"132-000041-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"532.97", "quantity"=>2.0, "description"=>"Lite-On WMW 12V ATSPSU, PS-2322-1ADU-LF X6; changes include a) change AC input fuse to fast-burning fuse; b) add shielding cover on auxiliary power and c) add 1 nF filter capacitor to stabilize MCU supply voltage.", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"204-001395-005"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"236.28", "quantity"=>3.0, "description"=>"PSU, 1200W, Liteon, PS-2122-8L1S, Rev.01, FW rev 00.01.01", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"204-000341-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"207.57", "quantity"=>3.0, "description"=>"Adapter, Lan Card, Annapurna K2T-QB, ASIC, 4x25G + 1XGbE port and additional 2xGbE network ports over edge connector, Full Height Half Length (FHHL), x16 PCIe lanes card (CEM3.0 compliance) FW 3.10.14", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"210-000161-003"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"23.83", "quantity"=>1.0, "description"=>"Optical Module, 10G, SFP+, LR-Lite (1.5km)", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"132-000013-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"73.38", "quantity"=>1.0, "description"=>"RAM, 32GB, 3200MHz, 1.2V, 2Rx4, DDR4, RDIMM, Micron (Z11B), MTA36ASF4G72PZ-3G2E7", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"203-001045-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"73.38", "quantity"=>1.0, "description"=>"RAM, 32GB, RDIMM, 3200MT/s, 1.2V, 2Rx4, DDR4, Samsung (D1y), M393A4K40DB3-CWE", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"203-001023-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"479.11", "quantity"=>2.0, "description"=>"CPU, Intel, Cascade Lake, 4210, 2.2GHz, 10C, 85W, R1", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"202-001201-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"166.36", "quantity"=>2.0, "description"=>"Optical Module, 100G, QSFP28, PSM4 (500m), 4xLC Optical Breakout Pigtail 2.7m, SMF [For Almach Switches]", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"132-000009-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"148.4", "quantity"=>3.0, "description"=>"Riser, C19, 1u, for Single K2V4 AIO PCIe Gen4 with retimer (BOM change for Astera Lab re-timer circuit), Quanta Design for use on Intel platforms", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"214-000130-002"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"130.400", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"3668.78", "quantity"=>2.0, "description"=>"Switch,32x400G, Celestica, CS8260-32X-DC-11 (ROW)  ", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"124-002865-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"1432.18", "quantity"=>2.0, "description"=>"CPU, Intel, Cascade Lake, 8259CL, 24C, 210W, B1 Prod", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"202-001193-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"34.32", "quantity"=>4.0, "description"=>"Cable, SFP+, Active Optical Cable (AOC), 2m", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"132-000069-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"3846.67", "quantity"=>1.0, "description"=>"Switch,32x400G, Accton, AS8060-32X-DC-11 (ROW)  ", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"124-002563-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"117.44", "quantity"=>3.0, "description"=>"USI FUSION PSC BOARD  6623-000060-10", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"504-003743-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"1110.44", "quantity"=>1.0, "description"=>"AS4610-54T-HVDC 48x1G Switch with mounting provisions, (Server Rack Console)", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"124-394611-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"479.11", "quantity"=>2.0, "description"=>"CPU, Intel, Cascade Lake, 4210, 2.2GHz, 10C, 85W, R1", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"202-001201-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"148.4", "quantity"=>3.0, "description"=>"Riser, C19, 1u, for Single K2V4 AIO PCIe Gen4 with retimer (BOM change for Astera Lab re-timer circuit), Quanta Design for use on Intel platforms", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"214-000130-002"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"511.540", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"180.1", "quantity"=>2.0, "description"=>"Retimer A, Astera IC", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"210-000578-001"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"10.80", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"IAD9", "shipping_physical_site"=>"IAD22", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"465.38", "quantity"=>6.0, "description"=>"FG,MB,CANNONBALL,CLX/SKL,2 PCIe Riser, 4 Interposer, Brigade 1,Foxconn", "in_agile"=>true, "physical_site"=>"CMH58", "shipping_physical_site"=>"CMH58", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"205-000788-001"}}, {"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"3396.74", "quantity"=>2.0, "description"=>"Switch, Data, 0, 0, 48, 6, 0, N+1, Port to PSU, JUNIPER QFX5100-48S (3AFO)", "in_agile"=>true, "physical_site"=>"CMH58", "shipping_physical_site"=>"CMH58", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"301-000047-002"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"287.560", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"CMH58", "shipping_physical_site"=>"CMH58", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"465.38", "quantity"=>6.0, "description"=>"FG,MB,CANNONBALL,CLX/SKL,2 PCIe Riser, 4 Interposer, Brigade 1,Foxconn", "in_agile"=>true, "physical_site"=>"CMH57", "shipping_physical_site"=>"CMH57", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"205-000788-001"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"83.760", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"CMH57", "shipping_physical_site"=>"CMH57", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"IPS - Supplies", "unit_cost"=>"259.34", "quantity"=>1.0, "description"=>"MX240 Fan Filter Kit", "in_agile"=>true, "physical_site"=>"GRU1", "shipping_physical_site"=>"GRU1", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"516-000608-001"}}, {"line_category"=>"Freight", "unit_cost"=>"7.780", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"GRU1", "shipping_physical_site"=>"GRU1", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"IPS - Supplies", "unit_cost"=>"259.34", "quantity"=>1.0, "description"=>"MX240 Fan Filter Kit", "in_agile"=>true, "physical_site"=>"GRU2", "shipping_physical_site"=>"GRU2", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"516-000608-001"}}, {"line_category"=>"Freight", "unit_cost"=>"7.780", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"GRU2", "shipping_physical_site"=>"GRU2", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"IPS - Supplies", "unit_cost"=>"259.34", "quantity"=>1.0, "description"=>"MX240 Fan Filter Kit", "in_agile"=>true, "physical_site"=>"GRU4", "shipping_physical_site"=>"GRU4", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"516-000608-001"}}, {"line_category"=>"Freight", "unit_cost"=>"7.780", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"GRU4", "shipping_physical_site"=>"GRU4", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Server", "unit_cost"=>"5587962.0", "quantity"=>1.0, "description"=>"Server, Atlanta18, Quanta", "in_agile"=>true, "physical_site"=>"NRT120", "shipping_physical_site"=>"NRT120", "currency"=>"JPY", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"110-002692-003"}}, {"line_category"=>"Freight", "unit_cost"=>"18719.00", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"NRT120", "shipping_physical_site"=>"NRT120", "currency"=>"JPY", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"176.43", "quantity"=>4500.0, "description"=>"Adapter, LAN Card, PCIe, Annapurna, K2T-QB-1TPM, Full Height, Half Length, dual chip, x16 PCIe, up to 4x25G, 2 GbE network ports on edge connector, Single TPM (FW 3.40.6)", "in_agile"=>true, "physical_site"=>"DUB30", "shipping_physical_site"=>"DUB30", "currency"=>"EUR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"210-000742-008"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"23805.000", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"DUB30", "shipping_physical_site"=>"DUB30", "currency"=>"EUR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"6097.25", "quantity"=>5.0, "description"=>"PDB, Bahubali49, 'Hooter', PVT4-X05, Assembly P/N, Foxconn, 1A62KBU00-600-G", "in_agile"=>true, "physical_site"=>"BOM60", "shipping_physical_site"=>"BOM60", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"261-000298-003"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"914.600", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"BOM60", "shipping_physical_site"=>"BOM60", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"6097.25", "quantity"=>5.0, "description"=>"PDB, Bahubali49, 'Hooter', PVT4-X05, Assembly P/N, Foxconn, 1A62KBU00-600-G", "in_agile"=>true, "physical_site"=>"BOM75", "shipping_physical_site"=>"BOM75", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"261-000298-003"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"914.600", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"BOM75", "shipping_physical_site"=>"BOM75", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"1681.77", "quantity"=>4.0, "description"=>"Cable, SlimSAS to SlimSAS cable R1", "in_agile"=>true, "physical_site"=>"BOM75", "shipping_physical_site"=>"BOM75", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"216-002466-001"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"201.800", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"BOM75", "shipping_physical_site"=>"BOM75", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"44285.22", "quantity"=>5.0, "description"=>"Lite-On WMW 12V ATSPSU, PS-2322-1ADU-LF X6; changes include a) change AC input fuse to fast-burning fuse; b) add shielding cover on auxiliary power and c) add 1 nF filter capacitor to stabilize MCU supply voltage.", "in_agile"=>true, "physical_site"=>"HYD111", "shipping_physical_site"=>"HYD111", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"204-001395-005"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"6642.800", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"HYD111", "shipping_physical_site"=>"HYD111", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"44285.22", "quantity"=>5.0, "description"=>"Lite-On WMW 12V ATSPSU, PS-2322-1ADU-LF X6; changes include a) change AC input fuse to fast-burning fuse; b) add shielding cover on auxiliary power and c) add 1 nF filter capacitor to stabilize MCU supply voltage.", "in_agile"=>true, "physical_site"=>"HYD121", "shipping_physical_site"=>"HYD121", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"204-001395-005"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"6642.800", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"HYD121", "shipping_physical_site"=>"HYD121", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"2506.87", "quantity"=>4.0, "description"=>"Cable, SlimSAS to SlimSAS cable L2", "in_agile"=>true, "physical_site"=>"BOM75", "shipping_physical_site"=>"BOM75", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"216-002469-001"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"300.840", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"BOM75", "shipping_physical_site"=>"BOM75", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"6097.25", "quantity"=>5.0, "description"=>"PDB, Bahubali49, 'Hooter', PVT4-X05, Assembly P/N, Foxconn, 1A62KBU00-600-G", "in_agile"=>true, "physical_site"=>"BOM62", "shipping_physical_site"=>"BOM62", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"261-000298-003"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"914.600", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"BOM62", "shipping_physical_site"=>"BOM62", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"122278.14", "quantity"=>1.0, "description"=>"Bus bar, AR1, 48U, 2 power zones, Delta-made", "in_agile"=>true, "physical_site"=>"BOM62", "shipping_physical_site"=>"BOM62", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"504-001991-001"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"3668.340", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"BOM62", "shipping_physical_site"=>"BOM62", "currency"=>"INR", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"4086.14", "quantity"=>2.0, "description"=>"Switch, Data, 32 Port, DC, N+1 Fan, I2C Accel.,1PPS, K2X-N, Accton, AS8070-32X-DC-11 (ROW)", "in_agile"=>true, "physical_site"=>"KUL64", "shipping_physical_site"=>"KUL64", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"301-000295-002"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"245.160", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"KUL64", "shipping_physical_site"=>"KUL64", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"4086.14", "quantity"=>1.0, "description"=>"Switch, Data, 32 Port, DC, N+1 Fan, I2C Accel.,1PPS, K2X-N, Accton, AS8070-32X-DC-11 (ROW)", "in_agile"=>true, "physical_site"=>"KUL63", "shipping_physical_site"=>"KUL63", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"301-000295-002"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"122.580", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"KUL63", "shipping_physical_site"=>"KUL63", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}],
[{"line_category"=>"Equip < Cap Threshold Direct / Spares", "line_sub_category_id"=>"96", "unit_cost"=>"4086.14", "quantity"=>2.0, "description"=>"Switch, Data, 32 Port, DC, N+1 Fan, I2C Accel.,1PPS, K2X-N, Accton, AS8070-32X-DC-11 (ROW)", "in_agile"=>true, "physical_site"=>"KUL61", "shipping_physical_site"=>"KUL61", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"301-000295-002"}}, {"line_category"=>"Freight", "line_sub_category_id"=>"96", "unit_cost"=>"245.160", "quantity"=>1.0, "description"=>"Freight", "in_agile"=>true, "physical_site"=>"KUL61", "shipping_physical_site"=>"KUL61", "currency"=>"USD", "unit_cost_in_usd"=>"0.0", "demand_identity"=>{"ipn"=>"NA"}}]]

b = a.map {|items| items.map {|item| item["line_category"]}}

puts b.to_set 

Ruby Online Compiler

Write, Run & Share Ruby code online using OneCompiler's Ruby online compiler for free. It's one of the robust, feature-rich online compilers for Ruby language, running on the latest version 2.3.1. Getting started with the OneCompiler's Ruby compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as Ruby and start coding.

Read input from STDIN in Ruby

OneCompiler's Ruby online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample Ruby program which takes name as input and prints hello message with your name.

name = gets.chomp               
print "Hello #{name}.\n" 

About Ruby

Ruby is a general purpose object oriented programming language developed by Yukihiro Matsumoto.

Key features

  • More commonly used in Rails applications.
  • Concise and simple to read and powerful too.
  • Open-source
  • Expressive features and visual appearance
  • Flexible language

Syntax help

Data types

Data typeDescriptionUsage
FixnumRepresents normal numbersx = 10
BignumRepresents big numbersx =9999999999
FloatRepresents decimal numbersx = 3.14
ComplexRepresents imaginary numbersx = 1 + 2i
RationalRepresents fractional numbersx = 1/4
BigDecimalRepresents precision decimal numbersx=1.0
HashRepresents key value pairs{"Website"=>"onecompiler","message" => "Happy learning"}

Variables

In Ruby, there is no need to explicitly declare variables to reserve memory space. When you assign a value to a variable, declaration happens automatically and a prefix is needed to indicate the following variable types.

Variable typeDescription
Local variablesScope is limited to the block of the variable initialization. Variable name must start with either _ or lowercase letter.
Class variablesClass variables belongs to whole class and can be accessible anywhere inside the class. Variable name must start with @@. They must be initialized before use.
Instance variablesInstance variables belongs to a instance of the class. They can be accessed from any instance of the class within a method. Variable name must start @
Global variablesScope is global and hence they can be accessible anywhere in the program. Variable name must start with $

Loops and conditional statements

1. If family:

If, If-else, Nested-Ifs are used when you want to perform a certain set of operations based on conditional expressions.

If

if(conditional-expression)
    #code    
end

If-else

if(conditional-expression)  
    #code if condition is true  
else   
    #code if condition is false  
end 

Nested-If-else

if(condition-expression1)   
    #code if above condition is true  
 elsif(condition-expression2)  
    #code if above condition is true  
elsif(condition-expression3)   
    #code if above condition is true  
...  
else   
    #code if all the conditions are false  
end  

2. Case:

Case is similar to Switch statement, where it is used to execute one set of a statement from multiple conditions.

case expression  
[when expression [, expression ...] [then]  
   # code ]...  
[else  
   # code ]  
end  

3. For:

For loop is used to iterate a set of statements based on a condition.

for variable in expression do   
  # code  
end

4. While:

While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.

while condition do   
 # code 
end  

5. Do-while:

Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.

loop do   
  #code  
  break if conditional-expression  
end