{"embedding":[0.005074049346148968,0.009537653997540474,0.041949313133955,-0.03512213006615639,0.025335585698485374,0.049029380083084106,-0.010556507855653763,-0.011149541474878788,-0.023771801963448524,-0.028985243290662766,0.018073173239827156,0.002005645539611578,-0.08943267166614532,0.019486891105771065,-0.03384742885828018,0.04238501936197281,0.05436171591281891,-0.009036933071911335,-0.017506245523691177,0.03226084262132645,-0.02372061088681221,0.009110591374337673,0.006214842200279236,0.0181816928088665,0.044553134590387344,-0.008603908121585846,0.05086655914783478,-0.0010696141980588436,-0.028691474348306656,-0.02446608431637287,0.0408913753926754,0.03143398463726044,0.011532830074429512,-0.015980251133441925,0.017765942960977554,0.018158061429858208,0.0002585257461760193,0.0373658612370491,-0.0394730307161808,-0.014255444519221783,-0.007989946752786636,-0.012361972592771053,-0.058801621198654175,0.0157405324280262,-0.005065421108156443,-0.019528701901435852,-0.041905369609594345,-0.007217839825898409,-0.04557623714208603,-0.022496363148093224,-0.05035702511668205,0.028534915298223495,-0.02448849380016327,0.02515551634132862,0.025611575692892075,0.06651724874973297,-0.004801365081220865,-0.03422396257519722,0.025434767827391624,-0.030659114941954613,0.0030761868692934513,0.03300819545984268,0.005297111347317696,0.015487393364310265,0.03487829864025116,-0.001227630884386599,0.023992547765374184,0.045306526124477386,-0.08307523280382156,-0.016769301146268845,-0.05948804318904877,0.021278638392686844,-0.03454593941569328,-0.006571545265614986,-0.010721635073423386,-0.02114330418407917,0.01129255909472704,0.0015937360003590584,0.05147199332714081,-0.03851466625928879,0.03503083065152168,0.04485340788960457,-0.0025843032635748386,-0.010191877372562885,-0.017443927004933357,-0.007381870411336422,-0.04164735972881317,-0.0073098111897706985,-0.03340975567698479,0.055036477744579315,-0.02435699664056301,-0.020612869411706924,0.002529294928535819,-0.0001704384631011635,0.023505091667175293,-0.05376302823424339,-0.012177357450127602,-0.02467951364815235,0.019751140847802162,-0.020195377990603447,-0.0634978637099266,-0.02734389714896679,0.008969733491539955,-0.03210797533392906,-0.09379503130912781,-0.026936490088701248,-0.01766909286379814,0.008268374018371105,0.005080995615571737,0.016168517991900444,-0.012244232930243015,0.014866377227008343,0.0015305045526474714,-0.044038526713848114,-0.04973730817437172,0.053557343780994415,-0.007426327094435692,0.026120522990822792,-0.020123030990362167,0.04556654766201973,0.046203333884477615,0.05069444328546524,0.015964584425091743,0.07795455306768417,0.05153732746839523,0.009588347747921944,0.04431503638625145,0.037021733820438385,-0.05976220220327377,-0.04428468272089958,0.03691466525197029,0.012471510097384453,-0.016539277508854866,0.02742071822285652,-0.02132735587656498,-0.03136153146624565,-0.016430368646979332,0.022381329908967018,0.02024007961153984,0.008659160695970058,0.006002101581543684,0.0056893364526331425,0.050702039152383804,-0.015992477536201477,0.03341091424226761,-0.028754495084285736,0.02301192842423916,-0.04071974381804466,-0.019466456025838852,0.0123030049726367,-0.02119654230773449,0.03539130836725235,0.02042573131620884,-0.04888155683875084,-0.03565099462866783,0.009353116154670715,0.055335015058517456,0.11312087625265121,-0.04631711170077324,-0.013118996284902096,0.060973599553108215,0.03447962552309036,-0.006267490331083536,0.05899006873369217,-0.034551870077848434,0.0070062847808003426,0.012699838727712631,-0.0036716251634061337,-0.0030172509141266346,-0.009721186012029648,0.011344047263264656,-0.03652644157409668,0.05782134830951691,-0.0206733550876379,0.005153349135071039,-0.043296705931425095,0.03682754188776016,0.024514446035027504,0.03782864287495613,-0.02587384171783924,-0.049236733466386795,0.07909923046827316,-0.03163186460733414,0.013925394043326378,0.004578844644129276,0.017173031345009804,0.13670527935028076,0.019194765016436577,0.03691805154085159,0.0015993710840120912,-0.02924755960702896,-0.02847687527537346,0.02017403021454811,-0.0011141157010570168,0.03862364962697029,-0.05702665448188782,-0.06261705607175827,0.03446408361196518,-0.01918005757033825,0.046703238040208817,-0.027250012382864952,0.013725744560360909,-0.0036322560627013445,-0.001249091699719429,0.01560881081968546,0.009947956539690495,0.009033901616930962,-0.04114693030714989,-0.031974226236343384,0.03780448064208031,0.033727604895830154,-0.04030199721455574,-0.01846117526292801,-0.023674707859754562,0.049203060567379,0.07240109890699387,0.0020210836082696915,0.010749629698693752,0.033805105835199356,-0.0767105370759964,0.02561815455555916,-0.0036232632119208574,-0.06887997686862946,-0.007132839411497116,0.006595632992684841,0.12165893614292145,0.05503307655453682,-0.036719247698783875,-0.04387523978948593,0.005082175601273775,-0.04174794629216194,-0.005086184479296207,0.009536653757095337,0.02318541519343853,-0.0726877972483635,0.016369812190532684,0.018248960375785828,0.020273976027965546,0.059203486889600754,-0.03515717014670372,-0.05770468711853027,0.0492815263569355,-0.014487522654235363,0.007734105456620455,-0.013101506978273392,-0.03202410414814949,0.0025983143132179976,-0.019348816946148872,-0.0018700392683967948,-0.01018381118774414,-0.005517180543392897,0.001367122633382678,0.058864716440439224,-0.04734304919838905,0.0021813104394823313,-0.012743709608912468,-0.021991631016135216,-0.03339320793747902,0.07322035729885101,0.012900828383862972,-0.018787991255521774,0.012551437132060528,0.03384291008114815,-0.04001091048121452,-0.01632041297852993,-0.0705985277891159,-0.051681529730558395,0.013451728969812393,0.010305339470505714,0.027780234813690186,0.03545259311795235,0.01650342158973217,-0.03959333151578903,-0.025093749165534973,0.012417810037732124,-0.004262390546500683,0.03474424406886101,-0.010340251959860325,-0.022192034870386124,-0.05199463292956352,0.04759408161044121,0.05953773111104965,-0.026526516303420067,-0.07002133131027222,0.03739886358380318,-0.01108704786747694,-0.029202494770288467,-0.040473002940416336,-0.018155094236135483,-0.01290599163621664,0.001111215795390308,0.047774165868759155,-0.0722145289182663,-0.029464665800333023,-0.020317094400525093,0.06291516125202179,-0.036342915147542953,0.033688854426145554,0.05985547602176666,-0.03543965891003609,0.055570874363183975,0.04158371314406395,0.02635570615530014,0.04747321829199791,-0.02149411104619503,-0.026095539331436157,-0.04262379929423332,-0.015971126034855843,-0.23093286156654358,-0.014273745939135551,-0.05103981867432594,-0.03421461582183838,0.046511467546224594,-0.019525501877069473,0.015594510361552238,-0.0003162137290928513,-1.7409860220141127e-06,-0.02833443693816662,-0.0006855108076706529,-0.0276236142963171,-0.04134576767683029,0.044509634375572205,0.048300761729478836,-0.005612480919808149,0.036265239119529724,0.0010140894446521997,0.022605253383517265,0.04937029257416725,-0.005572374910116196,-0.09841307997703552,-0.03503686189651489,-0.0021899633575230837,-0.0292297825217247,-0.00774334417656064,-0.04211874678730965,-0.0011068634921684861,-0.08049678802490234,-0.022911550477147102,-0.02605666033923626,0.010005868040025234,-0.009849580004811287,-0.019565969705581665,0.03152543306350708,0.00298778573051095,0.005815834738314152,-0.040881816297769547,0.003110045799985528,0.013031871989369392,-0.029911091551184654,-0.02515101246535778,-0.016131967306137085,0.013307297602295876,0.0269802063703537,0.09090081602334976,-0.033076900988817215,-0.035869576036930084,-0.04842023551464081,0.032812342047691345,-0.0275429654866457,-0.04320289194583893,0.011405367404222488,0.01339921448379755,-0.06570666283369064,-0.01546355988830328,-0.026738913729786873,0.022813037037849426,-0.03841668739914894,0.030809585005044937,-0.026000678539276123,-0.038166262209415436,-0.03738026320934296,-0.034692998975515366,0.0029337690211832523,-0.04932732880115509,-0.05736129730939865,-0.054193366318941116,0.057694412767887115,0.07522642612457275,-0.01901501789689064,0.01921243779361248,-0.04388253018260002,-0.0759679451584816,0.037945300340652466,0.014338943175971508,0.015445101074874401,-0.004785108845680952,0.017598431557416916,0.010144048370420933,-0.07909294962882996,-0.09403026849031448,0.009743624366819859,-0.009619493037462234,-0.011012611910700798,-0.008453317917883396,-0.016930555924773216,-0.009214724414050579,-0.04118552431464195,-0.02204195410013199,0.06840720772743225,-0.03290046378970146,0.007850187830626965,0.001209395588375628,0.05221915617585182,0.044189050793647766,0.02216232381761074,0.028795398771762848,0.030028754845261574,-0.013836442492902279,0.006056527607142925,-0.047901004552841187,-9.741193207446486e-05,-0.049508433789014816,-0.04081400856375694,-0.004633352626115084,-0.04621784761548042,0.021502899006009102,0.05091029405593872,-0.041237689554691315,-0.0007849945104680955,-0.026946263387799263,0.006033213809132576,-0.028650246560573578,0.041621193289756775,-0.025268610566854477,0.00818353146314621,0.04462077468633652,-0.008561945520341396,-0.021087398752570152,-0.009431122802197933,-0.00785690639168024,-0.002131236018612981,-0.006992435548454523,-0.06509926170110703,0.0020127608440816402,-0.019536172971129417,0.013275149278342724,-0.0028335198294371367,0.03059341199696064,0.02281924895942211,0.04168389365077019,0.001953767379745841,-0.02690436691045761,0.02649610862135887,-0.0010194135829806328,-0.014893033541738987,-0.0071116844192147255,-0.04977061599493027,-0.007833453826606274,0.057485129684209824,-0.020005375146865845,-0.005643952172249556,0.035509031265974045,-0.015437399968504906,0.02890418842434883,-0.04521700739860535,-0.003051596228033304,-0.03152739629149437,0.04993441700935364,0.013803603127598763,0.013656143099069595,-0.0029611983336508274,-0.020520325750112534,-0.010333414189517498,-0.016672881320118904,0.052011020481586456,-0.031097380444407463,-0.013150202110409737,-0.07199636846780777,0.03955903649330139,0.032415155321359634,-0.03468574583530426,0.01084747351706028,-0.06240522861480713,0.06526438891887665,-0.03058786131441593,-0.020305655896663666,-0.018507372587919235,0.05927829071879387,0.04904238507151604,-0.013395760208368301,-0.018906602635979652,0.005918459966778755,-0.03286875784397125,0.02390483021736145,0.012803640216588974,0.007231438998132944,-0.01021695788949728,-0.035151973366737366,0.03657640144228935,-0.036073192954063416,-0.003667077049612999,0.02372843585908413,0.006298911292105913,0.01884332112967968,-0.0060156574472785,-0.05096060037612915,-0.048258427530527115,-0.0163682010024786,-0.05339863896369934,-0.03473615273833275,0.04109674319624901,-0.024753354489803314,-0.018035339191555977,-0.035223960876464844,0.012468120083212852,0.06483647972345352,0.009235929697751999,0.035018566995859146,-0.05313196778297424,0.025563983246684074,-0.004790289793163538,0.05664905160665512,0.010523670352995396,-0.043417297303676605,-0.0048981886357069016,0.0012177301105111837,0.04926520958542824,0.004849187098443508,0.009629854932427406,-0.049279749393463135,-0.02072024904191494,-0.0126247713342309,0.0033385562710464,0.012081452645361423,-0.0037638433277606964,-0.020501846447587013,0.04689488559961319,0.011751892976462841,0.0030928237829357386,0.005697179585695267,0.002020235639065504,-0.05973130092024803,-0.004055436234921217,0.03164355456829071,0.03751873970031738,0.025145273655653,0.009681213647127151,-0.054163940250873566,0.06642289459705353,0.005421102978289127,0.016153274103999138,0.04447772726416588,0.04497064650058746,-0.034366708248853683,-0.039423342794179916,-0.030345747247338295,-0.009585094638168812,0.044988252222537994,-0.02811790630221367,0.06246872991323471,-0.029929108917713165,-0.029240082949399948,0.030134834349155426,0.0098011689260602,0.034361131489276886,-0.08556528389453888,-0.027507737278938293,0.03402086719870567,-0.0008856940548866987,0.033693827688694,-0.015765583142638206,-0.06901979446411133,0.03198248893022537,0.02254864014685154,-0.05981047451496124,-0.040445368736982346,0.007231115363538265,0.023047422990202904,-0.032326631247997284,0.048985566943883896,-0.012209979817271233,0.012545997276902199,0.028655868023633957,0.027545718476176262,0.007838987745344639,0.012457638047635555,0.05768987163901329,0.0031705547589808702,-0.01615956611931324,-0.07111196219921112,-0.031015029177069664,0.054821792989969254,0.02603556215763092,-0.03208072856068611,-0.01668788492679596,-0.014749791473150253,0.042825885117053986,-0.02972390502691269,-0.023034943267703056,0.04762497916817665,0.04055190086364746,0.004446486011147499,0.0636412501335144,-0.025358853861689568,0.004590896423906088,0.026656966656446457,-0.044941600412130356,0.047555167227983475,-0.012584124691784382,0.046539079397916794,-0.052475862205028534,0.028326798230409622,-0.0349942222237587,0.03326418623328209,0.015046798624098301,0.06881918013095856,0.033037275075912476,0.016864636912941933,-0.03572676703333855,0.04324786365032196,0.05442039668560028,-0.014443113468587399,-0.01864912174642086,0.04964970052242279,0.005945497192442417,-0.048408377915620804,-0.011045818217098713,0.00894911214709282,-0.01215660572052002,-0.06158210337162018,0.02576962485909462,0.009706984274089336,-0.030025405809283257,0.003353527747094631,0.013162428513169289,-0.05554751306772232,0.034682732075452805,0.0030286479741334915,-0.028072260320186615,-0.024494986981153488,0.06837551295757294,-0.01184004358947277,-0.013022487983107567,0.044180016964673996,-0.028170812875032425,-0.05955934897065163,0.010808607563376427,0.04318344220519066,0.045685745775699615,0.0028327463660389185,0.0075827836990356445,0.017450589686632156,-0.01847272366285324,-0.04666480794548988,0.01101324986666441,-0.05798627808690071,0.04118860512971878,0.04038115590810776,-0.011981995776295662,0.05550418049097061,0.07983724027872086,0.06284309923648834,-0.032668840140104294,0.0027723696548491716,0.026445353403687477,0.035672031342983246,-0.013082696124911308,0.0268871933221817,0.012131932191550732,0.037697434425354004,0.0158625990152359,-0.0132726626470685,-0.008482960984110832,-0.021725403144955635,0.09095535427331924,0.028808042407035828,-0.006293791811913252,0.018846610561013222,0.008586082607507706,0.02351255528628826,0.0731562003493309,-0.029648354277014732,-0.07325234264135361,-0.012805338948965073,0.03003810904920101,-0.03746030852198601,-0.023343300446867943,0.03434556722640991,0.0015953847905620933,-0.0005231922259554267,-0.05190211534500122,0.033680569380521774,-0.023723404854536057,0.0013804510235786438,0.029763123020529747,0.013947669416666031,-0.00024011495406739414,0.013935237191617489,0.05325339362025261,0.009702826850116253,-0.011925752274692059,-0.03096574731171131,-0.05784614011645317,-0.07209217548370361,-0.0029849845450371504,-0.0090767377987504,-0.016025889664888382,-0.05463837459683418,-0.0443960539996624,0.02005850151181221,-0.0060607329942286015,0.022811271250247955,-0.011531156487762928,0.022913049906492233,0.041043054312467575,0.09583079814910889,0.01836431212723255,0.03702791780233383,-0.012030083686113358,0.012749671936035156,-0.04448113590478897,0.025294942781329155,-0.012599305249750614,0.05155971273779869,0.02353058010339737,-0.0036566329654306173,-0.03591341897845268,-0.008804713375866413,-0.009449874982237816,0.01400851272046566,-0.062427159398794174,-0.011783924885094166,-0.015941856428980827,0.012285957112908363,0.02557465247809887,-0.026964625343680382,-0.006912711076438427,-0.03491835296154022,0.0073104435577988625,0.05485294386744499,-0.017356937751173973,0.01434020884335041,-0.03481157496571541,0.001387491705827415,0.04479976370930672,0.03959757462143898,-0.05153723061084747,0.03416811302304268,-0.029707545414566994,0.02662280760705471,-0.053825005888938904,0.004005757626146078,-0.019409174099564552,-0.04405469819903374,0.0037604777608066797,-0.02572263777256012,0.01067583542317152,-0.005888040643185377,0.006227483972907066,0.003926889970898628,-0.05445624515414238,-0.016863705590367317,0.0026415816973894835,0.020951377227902412,-0.04371378943324089,0.04050396382808685,-0.02890286222100258,0.026408517733216286,-0.00015145701763685793,-0.026192914694547653,-0.017365451902151108,-0.032944440841674805,-0.007961324416100979,-0.0604255311191082,-0.012066785246133804,0.02361355535686016,0.018499042838811874,0.04507732391357422],"mdx_file":"2416a2a2-3b84-4a4f-9706-27ec64420715.mdx","tinygrad_starter_code":"ZnJvbSB0aW55Z3JhZC50ZW5zb3IgaW1wb3J0IFRlbnNvcgoKZGVmIG1hdHJpeF9kb3RfdmVjdG9yX3RnKGE6VGVuc29yLCBiOlRlbnNvcikgLT4gVGVuc29yOgogICAgIiIiCiAgICBDb21wdXRlIHRoZSBwcm9kdWN0IG9mIG1hdHJpeCBgYWAgYW5kIHZlY3RvciBgYmAgdXNpbmcgdGlueWdyYWQuCiAgICBXaWxsIGJlIHRpbnlncmFkIFRlbnNvcnMuCiAgICBSZXR1cm5zIGEgMS1EIFRlbnNvciBvZiBsZW5ndGggbSwgb3IgVGVuc29yKC0xKSBpZiBkaW1lbnNpb25zIG1pc21hdGNoLgogICAgIiIiCiAgICBwYXNzCg==","last_updated":"2026-03-27T14:02:29.183Z","test_cases":[{"test":"print(matrix_dot_vector([[1, 2, 3], [2, 4, 5], [6, 8, 9]], [1, 2, 3]))","expected_output":"[14, 25, 49]"},{"test":"print(matrix_dot_vector([[1, 2], [2, 4], [6, 8], [12, 4]], [1, 2, 3]))","expected_output":"-1"}],"pytorch_difficulty":"easy","likes":"0","video":"https://youtu.be/DNoLs5tTGAw?si=vpkPobZMA8YY10WY","cuda_test_cases":[{"test":"#include <iostream>\n#include <vector>\n\nstd::vector<float> matrix_dot_vector(const std::vector<std::vector<float>>& matrix, const std::vector<float>& vec);\n\nint main() {\n    std::vector<std::vector<float>> matrix = {{1, 2, 3}, {2, 4, 5}, {6, 8, 9}};\n    std::vector<float> vec = {1, 2, 3};\n    auto result = matrix_dot_vector(matrix, vec);\n    std::cout << \"[\";\n    for (int i = 0; i < result.size(); i++) {\n        std::cout << result[i];\n        if (i < result.size() - 1) std::cout << \", \";\n    }\n    std::cout << \"]\" << std::endl;\n    return 0;\n}","expected_output":"[14, 25, 49]"},{"test":"#include <iostream>\n#include <vector>\n\nstd::vector<float> matrix_dot_vector(const std::vector<std::vector<float>>& matrix, const std::vector<float>& vec);\n\nint main() {\n    std::vector<std::vector<float>> matrix = {{1, 2}, {2, 4}, {6, 8}, {12, 4}};\n    std::vector<float> vec = {1, 2, 3};\n    auto result = matrix_dot_vector(matrix, vec);\n    std::cout << result[0] << std::endl;\n    return 0;\n}","expected_output":"-1"},{"test":"#include <iostream>\n#include <vector>\n\nstd::vector<float> matrix_dot_vector(const std::vector<std::vector<float>>& matrix, const std::vector<float>& vec);\n\nint main() {\n    std::vector<std::vector<float>> matrix = {{1.5f, 2.5f}, {3.0f, 4.0f}};\n    std::vector<float> vec = {2, 1};\n    auto result = matrix_dot_vector(matrix, vec);\n    std::cout << \"[\" << result[0] << \", \" << result[1] << \"]\" << std::endl;\n    return 0;\n}","expected_output":"[5.5, 10]"}],"example":{"input":"a = [[1, 2], [2, 4]], b = [1, 2]","output":"[5, 10]","reasoning":"Row 1: (1 * 1) + (2 * 2) = 1 + 4 = 5; Row 2: (2 * 1) + (4 * 2) = 2 + 8 = 10"},"pytorch_starter_code":"aW1wb3J0IHRvcmNoCgpkZWYgbWF0cml4X2RvdF92ZWN0b3IoYSwgYikgLT4gdG9yY2guVGVuc29yOgogICAgIiIiCiAgICBDb21wdXRlIHRoZSBwcm9kdWN0IG9mIG1hdHJpeCBgYWAgYW5kIHZlY3RvciBgYmAgdXNpbmcgUHlUb3JjaC4KICAgIElucHV0cyBjYW4gYmUgUHl0aG9uIGxpc3RzLCBOdW1QeSBhcnJheXMsIG9yIHRvcmNoIFRlbnNvcnMuCiAgICBSZXR1cm5zIGEgMS1EIHRlbnNvciBvZiBsZW5ndGggbSwgb3IgdGVuc29yKC0xKSBpZiBkaW1lbnNpb25zIG1pc21hdGNoLgogICAgIiIiCiAgICBhX3QgPSB0b3JjaC5hc190ZW5zb3IoYSwgZHR5cGU9dG9yY2guZmxvYXQpCiAgICBiX3QgPSB0b3JjaC5hc190ZW5zb3IoYiwgZHR5cGU9dG9yY2guZmxvYXQpCiAgICAjIERpbWVuc2lvbiBtaXNtYXRjaCBjaGVjawogICAgaWYgYV90LnNpemUoMSkgIT0gYl90LnNpemUoMCk6CiAgICAgICAgcmV0dXJuIHRvcmNoLnRlbnNvcigtMSkKICAgICMgWW91ciBpbXBsZW1lbnRhdGlvbiBoZXJlCiAgICBwYXNzCg==","learn_section":"CiMjIE1hdHJpeC1WZWN0b3IgRG90IFByb2R1Y3QKCkNvbnNpZGVyIGEgbWF0cml4ICRBJCBhbmQgYSB2ZWN0b3IgJHYkOgoKKipNYXRyaXggJEEkIChuIHggbSk6KioKJCQKQSA9IFxiZWdpbntwbWF0cml4fQphX3sxMX0gJiBhX3sxMn0gJiBcY2RvdHMgJiBhX3sxbX0gXFwKYV97MjF9ICYgYV97MjJ9ICYgXGNkb3RzICYgYV97Mm19IFxcClx2ZG90cyAmIFx2ZG90cyAmIFxkZG90cyAmIFx2ZG90cyBcXAphX3tuMX0gJiBhX3tuMn0gJiBcY2RvdHMgJiBhX3tubX0KXGVuZHtwbWF0cml4fQokJAoKKipWZWN0b3IgJHYkIChsZW5ndGggbSk6KioKJCQKdiA9IFxiZWdpbntwbWF0cml4fQp2XzEgXFwKdl8yIFxcClx2ZG90cyBcXAp2X20KXGVuZHtwbWF0cml4fQokJAoKVGhlIGRvdCBwcm9kdWN0ICRBIFxjZG90IHYkIHByb2R1Y2VzIGEgbmV3IHZlY3RvciBvZiBsZW5ndGggJG4kOgokJApBIFxjZG90IHYgPSBcYmVnaW57cG1hdHJpeH0KYV97MTF9dl8xICsgYV97MTJ9dl8yICsgXGNkb3RzICsgYV97MW19dl9tIFxcCmFfezIxfXZfMSArIGFfezIyfXZfMiArIFxjZG90cyArIGFfezJtfXZfbSBcXApcdmRvdHMgXFwKYV97bjF9dl8xICsgYV97bjJ9dl8yICsgXGNkb3RzICsgYV97bm19dl9tClxlbmR7cG1hdHJpeH0KJCQKCiMjIyBLZXkgUmVxdWlyZW1lbnQ6ClRoZSBudW1iZXIgb2YgY29sdW1ucyBpbiB0aGUgbWF0cml4ICgkbSQpIG11c3QgZXF1YWwgdGhlIGxlbmd0aCBvZiB0aGUgdmVjdG9yICgkbSQpLiBJZiBub3QsIHRoZSBvcGVyYXRpb24gaXMgdW5kZWZpbmVkLCBhbmQgdGhlIGZ1bmN0aW9uIHNob3VsZCByZXR1cm4gLTEu","cuda_starter_code":"I2luY2x1ZGUgPGN1ZGFfcnVudGltZS5oPgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDx2ZWN0b3I+CgpfX2dsb2JhbF9fIHZvaWQgbWF0cml4X3ZlY3Rvcl9kb3Rfa2VybmVsKAogICAgY29uc3QgZmxvYXQqIG1hdHJpeCwKICAgIGNvbnN0IGZsb2F0KiB2ZWN0b3IsCiAgICBmbG9hdCogcmVzdWx0LAogICAgaW50IHJvd3MsCiAgICBpbnQgY29scwopIHsKICAgIC8vIEltcGxlbWVudCB0aGUga2VybmVsIHRvIGNvbXB1dGUgbWF0cml4LXZlY3RvciBkb3QgcHJvZHVjdAogICAgLy8gRWFjaCB0aHJlYWQgY29tcHV0ZXMgb25lIGVsZW1lbnQgb2YgdGhlIHJlc3VsdCB2ZWN0b3IKfQoKc3RkOjp2ZWN0b3I8ZmxvYXQ+IG1hdHJpeF9kb3RfdmVjdG9yKGNvbnN0IHN0ZDo6dmVjdG9yPHN0ZDo6dmVjdG9yPGZsb2F0Pj4mIG1hdHJpeCwgY29uc3Qgc3RkOjp2ZWN0b3I8ZmxvYXQ+JiB2ZWMpIHsKICAgIC8vIFJldHVybiBlbXB0eSB2ZWN0b3IgaWYgZGltZW5zaW9ucyBkb24ndCBtYXRjaAogICAgLy8gMS4gQWxsb2NhdGUgZGV2aWNlIG1lbW9yeQogICAgLy8gMi4gQ29weSBkYXRhIHRvIGRldmljZQogICAgLy8gMy4gTGF1bmNoIGtlcm5lbAogICAgLy8gNC4gQ29weSByZXN1bHQgYmFjawogICAgLy8gNS4gRnJlZSBtZW1vcnkgYW5kIHJldHVybiByZXN1bHQKICAgIHJldHVybiB7fTsKfQ==","contributor":[{"profile_link":"https://github.com/moe18","name":"Moe Chabot"}],"tinygrad_test_cases":[{"test":"from tinygrad.tensor import Tensor\nres = matrix_dot_vector_tg(\n    Tensor([[1,2,3],[2,4,5],[6,8,9]]),\n    Tensor([1,2,3])\n)\nprint(res.numpy().tolist())","expected_output":"[14.0, 25.0, 49.0]"},{"test":"from tinygrad.tensor import Tensor\nres = matrix_dot_vector_tg(\n    Tensor([[1,2,3],[2,4,5]]),\n    Tensor([1,2])\n)\nprint(res.item())","expected_output":"-1"},{"test":"from tinygrad.tensor import Tensor\nres = matrix_dot_vector_tg(\n    Tensor([[1, 2], [2, 4]]),\n    Tensor([1, 2])\n)\nprint(res.numpy().tolist())","expected_output":"[5.0, 10.0]"}],"description":"V3JpdGUgYSBQeXRob24gZnVuY3Rpb24gdGhhdCBjb21wdXRlcyB0aGUgZG90IHByb2R1Y3Qgb2YgYSBtYXRyaXggYW5kIGEgdmVjdG9yLiBUaGUgZnVuY3Rpb24gc2hvdWxkIHJldHVybiBhIGxpc3QgcmVwcmVzZW50aW5nIHRoZSByZXN1bHRpbmcgdmVjdG9yIGlmIHRoZSBvcGVyYXRpb24gaXMgdmFsaWQsIG9yIC0xIGlmIHRoZSBtYXRyaXggYW5kIHZlY3RvciBkaW1lbnNpb25zIGFyZSBpbmNvbXBhdGlibGUuIEEgbWF0cml4IChhIGxpc3Qgb2YgbGlzdHMpIGNhbiBiZSBkb3R0ZWQgd2l0aCBhIHZlY3RvciAoYSBsaXN0KSBvbmx5IGlmIHRoZSBudW1iZXIgb2YgY29sdW1ucyBpbiB0aGUgbWF0cml4IGVxdWFscyB0aGUgbGVuZ3RoIG9mIHRoZSB2ZWN0b3IuIEZvciBleGFtcGxlLCBhbiBuIHggbSBtYXRyaXggcmVxdWlyZXMgYSB2ZWN0b3Igb2YgbGVuZ3RoIG0u","id":"1","tinygrad_difficulty":"easy","playground":{"dependencies":{},"enabled":true,"type":"react","settings":{"editorHeight":600,"showPreview":true,"theme":"dark","showEditor":false,"editorWidthPercentage":35,"showConsole":false},"files":{"/App.js":{"active":true,"code":"import React, { useState, useMemo } from 'react';\n\n// ============================================\n// Inline SVG Icons (replaces lucide-react)\n// ============================================\nconst Icons = {\n  Grid3X3: ({ size = 24, color = 'currentColor' }) => (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n      <rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><path d=\"M3 9h18\"/><path d=\"M3 15h18\"/><path d=\"M9 3v18\"/><path d=\"M15 3v18\"/>\n    </svg>\n  ),\n  ArrowRight: ({ size = 24, color = 'currentColor' }) => (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n      <path d=\"M5 12h14\"/><path d=\"m12 5 7 7-7 7\"/>\n    </svg>\n  ),\n  X: ({ size = 24, color = 'currentColor' }) => (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n      <path d=\"M18 6 6 18\"/><path d=\"m6 6 12 12\"/>\n    </svg>\n  ),\n  Check: ({ size = 24, color = 'currentColor' }) => (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n      <polyline points=\"20 6 9 17 4 12\"/>\n    </svg>\n  ),\n  AlertCircle: ({ size = 24, color = 'currentColor' }) => (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n      <circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"/><line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"/>\n    </svg>\n  ),\n  Play: ({ size = 24, color = 'currentColor' }) => (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n      <polygon points=\"5 3 19 12 5 21 5 3\"/>\n    </svg>\n  ),\n  RotateCcw: ({ size = 24, color = 'currentColor' }) => (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n      <path d=\"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8\"/><path d=\"M3 3v5h5\"/>\n    </svg>\n  ),\n  ChevronDown: ({ size = 24, color = 'currentColor' }) => (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n      <polyline points=\"6 9 12 15 18 9\"/>\n    </svg>\n  ),\n  ChevronUp: ({ size = 24, color = 'currentColor' }) => (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n      <polyline points=\"18 15 12 9 6 15\"/>\n    </svg>\n  ),\n};\n\n// ============================================\n// Design Tokens\n// ============================================\nconst theme = {\n  colors: {\n    primary: '#6366f1',\n    primaryHover: '#4f46e5',\n    secondary: '#ffffff',\n    background: '#000000',\n    surface: '#0a0a0a',\n    surfaceAlt: '#111111',\n    border: '#1f1f1f',\n    borderLight: '#2a2a2a',\n    text: '#ffffff',\n    textSecondary: '#a1a1aa',\n    textMuted: '#71717a',\n    success: '#22c55e',\n    error: '#ef4444',\n    highlight: '#6366f1',\n  },\n  font: \"'JetBrains Mono', monospace\",\n};\n\n// ============================================\n// Card Component\n// ============================================\nfunction Card({ children, className = '' }) {\n  return (\n    <div\n      style={{\n        background: theme.colors.surface,\n        border: `1px solid ${theme.colors.border}`,\n        borderRadius: '12px',\n        padding: '24px',\n      }}\n      className={className}\n    >\n      {children}\n    </div>\n  );\n}\n\n// ============================================\n// Matrix Cell\n// ============================================\nfunction MatrixCell({ value, onChange, highlighted, highlightColor, editable = true }) {\n  return (\n    <input\n      type=\"number\"\n      value={value}\n      onChange={(e) => onChange(parseFloat(e.target.value) || 0)}\n      disabled={!editable}\n      style={{\n        width: '48px',\n        height: '48px',\n        background: highlighted ? `${highlightColor}20` : theme.colors.surfaceAlt,\n        border: `2px solid ${highlighted ? highlightColor : theme.colors.border}`,\n        borderRadius: '8px',\n        color: highlighted ? highlightColor : theme.colors.text,\n        fontFamily: theme.font,\n        fontSize: '16px',\n        fontWeight: '600',\n        textAlign: 'center',\n        outline: 'none',\n        transition: 'all 0.2s ease',\n      }}\n    />\n  );\n}\n\n// ============================================\n// Vector Cell\n// ============================================\nfunction VectorCell({ value, onChange, highlighted, highlightColor, editable = true }) {\n  return (\n    <input\n      type=\"number\"\n      value={value}\n      onChange={(e) => onChange(parseFloat(e.target.value) || 0)}\n      disabled={!editable}\n      style={{\n        width: '48px',\n        height: '48px',\n        background: highlighted ? `${highlightColor}20` : theme.colors.surfaceAlt,\n        border: `2px solid ${highlighted ? highlightColor : theme.colors.border}`,\n        borderRadius: '8px',\n        color: highlighted ? highlightColor : theme.colors.text,\n        fontFamily: theme.font,\n        fontSize: '16px',\n        fontWeight: '600',\n        textAlign: 'center',\n        outline: 'none',\n        transition: 'all 0.2s ease',\n      }}\n    />\n  );\n}\n\n// ============================================\n// Result Bar\n// ============================================\nfunction ResultBar({ value, maxValue, index, highlighted }) {\n  const percentage = Math.min(Math.abs(value) / maxValue * 100, 100);\n  const isNegative = value < 0;\n  \n  return (\n    <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>\n      <div\n        style={{\n          width: '36px',\n          height: '36px',\n          borderRadius: '8px',\n          background: highlighted ? theme.colors.primary : theme.colors.surfaceAlt,\n          border: `1px solid ${highlighted ? theme.colors.primary : theme.colors.border}`,\n          display: 'flex',\n          alignItems: 'center',\n          justifyContent: 'center',\n          fontFamily: theme.font,\n          fontSize: '14px',\n          fontWeight: '600',\n          color: highlighted ? theme.colors.secondary : theme.colors.textSecondary,\n        }}\n      >\n        {index + 1}\n      </div>\n      <div style={{ flex: 1 }}>\n        <div\n          style={{\n            height: '24px',\n            background: theme.colors.surfaceAlt,\n            borderRadius: '6px',\n            overflow: 'hidden',\n            position: 'relative',\n          }}\n        >\n          <div\n            style={{\n              position: 'absolute',\n              left: isNegative ? 'auto' : '0',\n              right: isNegative ? '50%' : 'auto',\n              width: `${percentage / 2}%`,\n              height: '100%',\n              background: highlighted \n                ? `linear-gradient(90deg, ${theme.colors.primary}, ${theme.colors.primaryHover})`\n                : theme.colors.borderLight,\n              borderRadius: '6px',\n              transition: 'width 0.3s ease',\n            }}\n          />\n          <div\n            style={{\n              position: 'absolute',\n              left: '50%',\n              top: '0',\n              bottom: '0',\n              width: '1px',\n              background: theme.colors.border,\n            }}\n          />\n        </div>\n      </div>\n      <div\n        style={{\n          minWidth: '60px',\n          textAlign: 'right',\n          fontFamily: theme.font,\n          fontSize: '16px',\n          fontWeight: '700',\n          color: highlighted ? theme.colors.primary : theme.colors.text,\n        }}\n      >\n        {value.toFixed(1)}\n      </div>\n    </div>\n  );\n}\n\n// ============================================\n// Calculation Step\n// ============================================\nfunction CalculationStep({ row, vector, rowIndex, isActive }) {\n  const products = row.map((val, i) => val * vector[i]);\n  const sum = products.reduce((a, b) => a + b, 0);\n  \n  if (!isActive) return null;\n  \n  return (\n    <div\n      style={{\n        background: theme.colors.surfaceAlt,\n        border: `1px solid ${theme.colors.primary}40`,\n        borderRadius: '8px',\n        padding: '16px',\n        marginTop: '16px',\n      }}\n    >\n      <div style={{ \n        fontSize: '12px', \n        color: theme.colors.textMuted, \n        marginBottom: '12px',\n        fontFamily: theme.font,\n        textTransform: 'uppercase',\n        letterSpacing: '0.5px',\n      }}>\n        Row {rowIndex + 1} Calculation\n      </div>\n      \n      <div style={{ \n        display: 'flex', \n        flexWrap: 'wrap',\n        alignItems: 'center', \n        gap: '8px',\n        fontFamily: theme.font,\n        fontSize: '14px',\n      }}>\n        {row.map((val, i) => (\n          <React.Fragment key={i}>\n            {i > 0 && <span style={{ color: theme.colors.textMuted }}>+</span>}\n            <span style={{ color: theme.colors.textSecondary }}>\n              (<span style={{ color: theme.colors.primary }}>{val}</span>\n              <span style={{ color: theme.colors.textMuted }}> × </span>\n              <span style={{ color: theme.colors.success }}>{vector[i]}</span>)\n            </span>\n          </React.Fragment>\n        ))}\n        <span style={{ color: theme.colors.textMuted }}>=</span>\n        {products.map((p, i) => (\n          <React.Fragment key={i}>\n            {i > 0 && <span style={{ color: theme.colors.textMuted }}>+</span>}\n            <span style={{ color: theme.colors.textSecondary }}>{p}</span>\n          </React.Fragment>\n        ))}\n        <span style={{ color: theme.colors.textMuted }}>=</span>\n        <span style={{ \n          color: theme.colors.text, \n          fontWeight: '700',\n          background: theme.colors.primary + '20',\n          padding: '2px 8px',\n          borderRadius: '4px',\n        }}>\n          {sum}\n        </span>\n      </div>\n    </div>\n  );\n}\n\n// ============================================\n// Main Component\n// ============================================\nexport default function MatrixVectorDot() {\n  const [matrix, setMatrix] = useState([\n    [1, 2, 3],\n    [4, 5, 6],\n    [7, 8, 9],\n  ]);\n  const [vector, setVector] = useState([1, 2, 3]);\n  const [activeRow, setActiveRow] = useState(null);\n  const [isAnimating, setIsAnimating] = useState(false);\n  const [showSteps, setShowSteps] = useState(false);\n  \n  const rows = matrix.length;\n  const cols = matrix[0].length;\n  const vectorLen = vector.length;\n  const isValid = cols === vectorLen;\n  \n  const result = useMemo(() => {\n    if (!isValid) return null;\n    return matrix.map(row => \n      row.reduce((sum, val, i) => sum + val * vector[i], 0)\n    );\n  }, [matrix, vector, isValid]);\n  \n  const maxResult = result ? Math.max(...result.map(Math.abs), 1) : 1;\n  \n  const updateMatrix = (rowIdx, colIdx, value) => {\n    const newMatrix = matrix.map((row, r) =>\n      row.map((cell, c) => (r === rowIdx && c === colIdx ? value : cell))\n    );\n    setMatrix(newMatrix);\n  };\n  \n  const updateVector = (idx, value) => {\n    const newVector = vector.map((v, i) => (i === idx ? value : v));\n    setVector(newVector);\n  };\n  \n  const addRow = () => setMatrix([...matrix, Array(cols).fill(0)]);\n  const removeRow = () => rows > 1 && setMatrix(matrix.slice(0, -1));\n  const addCol = () => {\n    setMatrix(matrix.map(row => [...row, 0]));\n    setVector([...vector, 0]);\n  };\n  const removeCol = () => {\n    if (cols > 1) {\n      setMatrix(matrix.map(row => row.slice(0, -1)));\n      setVector(vector.slice(0, -1));\n    }\n  };\n  \n  const animate = async () => {\n    setIsAnimating(true);\n    setShowSteps(true);\n    for (let i = 0; i < rows; i++) {\n      setActiveRow(i);\n      await new Promise(r => setTimeout(r, 800));\n    }\n    setActiveRow(null);\n    setIsAnimating(false);\n  };\n  \n  const reset = () => {\n    setMatrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]]);\n    setVector([1, 2, 3]);\n    setActiveRow(null);\n    setShowSteps(false);\n  };\n\n  return (\n    <div\n      style={{\n        minHeight: '100vh',\n        background: theme.colors.background,\n        color: theme.colors.text,\n        fontFamily: theme.font,\n        padding: '32px',\n      }}\n    >\n      <div style={{ maxWidth: '720px', margin: '0 auto' }}>\n        {/* Header */}\n        <div style={{ marginBottom: '32px' }}>\n          <div style={{ display: 'flex', alignItems: 'center', gap: '12px', marginBottom: '8px' }}>\n            <Icons.Grid3X3 size={24} color={theme.colors.primary} />\n            <h1 style={{ fontSize: '24px', fontWeight: '600', margin: 0 }}>\n              Matrix-Vector Dot Product\n            </h1>\n          </div>\n          <p style={{ color: theme.colors.textSecondary, fontSize: '14px', margin: 0 }}>\n            Each row of the matrix is dotted with the vector to produce a result\n          </p>\n        </div>\n        \n        {/* Dimension Controls */}\n        <Card>\n          <div style={{ \n            display: 'flex', \n            justifyContent: 'space-between', \n            alignItems: 'center',\n            marginBottom: '24px',\n          }}>\n            <div style={{ fontSize: '12px', color: theme.colors.textMuted, textTransform: 'uppercase', letterSpacing: '0.5px' }}>\n              Dimensions\n            </div>\n            <div style={{ display: 'flex', gap: '8px' }}>\n              <div style={{ \n                padding: '6px 12px', \n                background: theme.colors.surfaceAlt, \n                borderRadius: '6px',\n                fontSize: '13px',\n                color: theme.colors.textSecondary,\n              }}>\n                Matrix: {rows} × {cols}\n              </div>\n              <div style={{ \n                padding: '6px 12px', \n                background: theme.colors.surfaceAlt, \n                borderRadius: '6px',\n                fontSize: '13px',\n                color: theme.colors.textSecondary,\n              }}>\n                Vector: {vectorLen}\n              </div>\n            </div>\n          </div>\n          \n          <div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap' }}>\n            {[\n              { label: '+ Row', action: addRow },\n              { label: '- Row', action: removeRow },\n              { label: '+ Col', action: addCol },\n              { label: '- Col', action: removeCol },\n            ].map(({ label, action }) => (\n              <button\n                key={label}\n                onClick={action}\n                style={{\n                  padding: '8px 16px',\n                  background: theme.colors.surfaceAlt,\n                  border: `1px solid ${theme.colors.border}`,\n                  borderRadius: '6px',\n                  color: theme.colors.textSecondary,\n                  fontFamily: theme.font,\n                  fontSize: '13px',\n                  cursor: 'pointer',\n                  transition: 'all 0.2s',\n                }}\n                onMouseEnter={(e) => {\n                  e.target.style.background = theme.colors.borderLight;\n                  e.target.style.color = theme.colors.text;\n                }}\n                onMouseLeave={(e) => {\n                  e.target.style.background = theme.colors.surfaceAlt;\n                  e.target.style.color = theme.colors.textSecondary;\n                }}\n              >\n                {label}\n              </button>\n            ))}\n          </div>\n        </Card>\n        \n        {/* Main Visualization */}\n        <Card style={{ marginTop: '16px' }}>\n          {/* Validity Status */}\n          <div\n            style={{\n              display: 'flex',\n              alignItems: 'center',\n              gap: '8px',\n              padding: '12px 16px',\n              background: isValid ? `${theme.colors.success}10` : `${theme.colors.error}10`,\n              border: `1px solid ${isValid ? theme.colors.success : theme.colors.error}30`,\n              borderRadius: '8px',\n              marginBottom: '24px',\n            }}\n          >\n            {isValid ? (\n              <Icons.Check size={16} color={theme.colors.success} />\n            ) : (\n              <Icons.AlertCircle size={16} color={theme.colors.error} />\n            )}\n            <span style={{ \n              fontSize: '13px', \n              color: isValid ? theme.colors.success : theme.colors.error \n            }}>\n              {isValid \n                ? `Valid: ${cols} columns = ${vectorLen} vector length`\n                : `Invalid: ${cols} columns ≠ ${vectorLen} vector length`\n              }\n            </span>\n          </div>\n          \n          {/* Matrix × Vector = Result */}\n          <div style={{ \n            display: 'flex', \n            alignItems: 'center', \n            gap: '24px',\n            flexWrap: 'wrap',\n            justifyContent: 'center',\n          }}>\n            {/* Matrix */}\n            <div>\n              <div style={{ \n                fontSize: '11px', \n                color: theme.colors.textMuted, \n                marginBottom: '8px',\n                textTransform: 'uppercase',\n                letterSpacing: '0.5px',\n              }}>\n                Matrix A\n              </div>\n              <div\n                style={{\n                  display: 'inline-flex',\n                  flexDirection: 'column',\n                  gap: '8px',\n                  padding: '12px',\n                  background: theme.colors.surfaceAlt,\n                  borderRadius: '8px',\n                  border: `1px solid ${theme.colors.border}`,\n                }}\n              >\n                {matrix.map((row, rowIdx) => (\n                  <div key={rowIdx} style={{ display: 'flex', gap: '8px' }}>\n                    {row.map((cell, colIdx) => (\n                      <MatrixCell\n                        key={colIdx}\n                        value={cell}\n                        onChange={(v) => updateMatrix(rowIdx, colIdx, v)}\n                        highlighted={activeRow === rowIdx}\n                        highlightColor={theme.colors.primary}\n                      />\n                    ))}\n                  </div>\n                ))}\n              </div>\n            </div>\n            \n            {/* Multiply Icon */}\n            <Icons.X size={20} color={theme.colors.textMuted} />\n            \n            {/* Vector */}\n            <div>\n              <div style={{ \n                fontSize: '11px', \n                color: theme.colors.textMuted, \n                marginBottom: '8px',\n                textTransform: 'uppercase',\n                letterSpacing: '0.5px',\n              }}>\n                Vector b\n              </div>\n              <div\n                style={{\n                  display: 'inline-flex',\n                  flexDirection: 'column',\n                  gap: '8px',\n                  padding: '12px',\n                  background: theme.colors.surfaceAlt,\n                  borderRadius: '8px',\n                  border: `1px solid ${theme.colors.border}`,\n                }}\n              >\n                {vector.map((val, idx) => (\n                  <VectorCell\n                    key={idx}\n                    value={val}\n                    onChange={(v) => updateVector(idx, v)}\n                    highlighted={activeRow !== null}\n                    highlightColor={theme.colors.success}\n                  />\n                ))}\n              </div>\n            </div>\n            \n            {/* Equals */}\n            <Icons.ArrowRight size={20} color={theme.colors.textMuted} />\n            \n            {/* Result */}\n            <div>\n              <div style={{ \n                fontSize: '11px', \n                color: theme.colors.textMuted, \n                marginBottom: '8px',\n                textTransform: 'uppercase',\n                letterSpacing: '0.5px',\n              }}>\n                Result\n              </div>\n              <div\n                style={{\n                  display: 'inline-flex',\n                  flexDirection: 'column',\n                  gap: '8px',\n                  padding: '12px',\n                  background: theme.colors.surfaceAlt,\n                  borderRadius: '8px',\n                  border: `1px solid ${theme.colors.border}`,\n                  minWidth: '60px',\n                }}\n              >\n                {isValid && result ? (\n                  result.map((val, idx) => (\n                    <div\n                      key={idx}\n                      style={{\n                        height: '48px',\n                        padding: '0 12px',\n                        display: 'flex',\n                        alignItems: 'center',\n                        justifyContent: 'center',\n                        background: activeRow === idx ? `${theme.colors.primary}20` : 'transparent',\n                        border: `2px solid ${activeRow === idx ? theme.colors.primary : 'transparent'}`,\n                        borderRadius: '8px',\n                        fontWeight: '700',\n                        fontSize: '16px',\n                        color: activeRow === idx ? theme.colors.primary : theme.colors.text,\n                        transition: 'all 0.2s',\n                      }}\n                    >\n                      {val}\n                    </div>\n                  ))\n                ) : (\n                  <div\n                    style={{\n                      height: '48px',\n                      padding: '0 12px',\n                      display: 'flex',\n                      alignItems: 'center',\n                      justifyContent: 'center',\n                      color: theme.colors.error,\n                      fontWeight: '700',\n                      fontSize: '16px',\n                    }}\n                  >\n                    -1\n                  </div>\n                )}\n              </div>\n            </div>\n          </div>\n          \n          {/* Calculation Steps */}\n          {showSteps && isValid && (\n            <div style={{ marginTop: '24px' }}>\n              {matrix.map((row, idx) => (\n                <CalculationStep\n                  key={idx}\n                  row={row}\n                  vector={vector}\n                  rowIndex={idx}\n                  isActive={activeRow === null || activeRow === idx}\n                />\n              ))}\n            </div>\n          )}\n          \n          {/* Controls - moved here, closer to animation */}\n          <div style={{ display: 'flex', gap: '12px', marginTop: '24px' }}>\n            <button\n              onClick={animate}\n              disabled={!isValid || isAnimating}\n              style={{\n                flex: 1,\n                display: 'flex',\n                alignItems: 'center',\n                justifyContent: 'center',\n                gap: '8px',\n                padding: '14px 24px',\n                background: isValid ? theme.colors.primary : theme.colors.surfaceAlt,\n                border: 'none',\n                borderRadius: '8px',\n                color: isValid ? theme.colors.secondary : theme.colors.textMuted,\n                fontFamily: theme.font,\n                fontSize: '14px',\n                fontWeight: '600',\n                cursor: isValid ? 'pointer' : 'not-allowed',\n                opacity: isAnimating ? 0.7 : 1,\n                transition: 'all 0.2s',\n              }}\n            >\n              <Icons.Play size={16} />\n              {isAnimating ? 'Animating...' : 'Animate Steps'}\n            </button>\n            \n            <button\n              onClick={() => setShowSteps(!showSteps)}\n              disabled={!isValid}\n              style={{\n                display: 'flex',\n                alignItems: 'center',\n                justifyContent: 'center',\n                gap: '8px',\n                padding: '14px 24px',\n                background: theme.colors.surfaceAlt,\n                border: `1px solid ${theme.colors.border}`,\n                borderRadius: '8px',\n                color: theme.colors.textSecondary,\n                fontFamily: theme.font,\n                fontSize: '14px',\n                fontWeight: '500',\n                cursor: isValid ? 'pointer' : 'not-allowed',\n              }}\n            >\n              {showSteps ? <Icons.ChevronUp size={16} /> : <Icons.ChevronDown size={16} />}\n              {showSteps ? 'Hide' : 'Show'} Math\n            </button>\n            \n            <button\n              onClick={reset}\n              style={{\n                display: 'flex',\n                alignItems: 'center',\n                justifyContent: 'center',\n                gap: '8px',\n                padding: '14px 24px',\n                background: theme.colors.surfaceAlt,\n                border: `1px solid ${theme.colors.border}`,\n                borderRadius: '8px',\n                color: theme.colors.textSecondary,\n                fontFamily: theme.font,\n                fontSize: '14px',\n                fontWeight: '500',\n                cursor: 'pointer',\n              }}\n            >\n              <Icons.RotateCcw size={16} />\n              Reset\n            </button>\n          </div>\n        </Card>\n        \n        {/* Result Bars */}\n        {isValid && result && (\n          <Card style={{ marginTop: '16px' }}>\n            <div style={{ \n              fontSize: '11px', \n              color: theme.colors.textMuted, \n              marginBottom: '16px',\n              textTransform: 'uppercase',\n              letterSpacing: '0.5px',\n            }}>\n              Result Visualization\n            </div>\n            <div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>\n              {result.map((val, idx) => (\n                <ResultBar\n                  key={idx}\n                  value={val}\n                  maxValue={maxResult}\n                  index={idx}\n                  highlighted={activeRow === idx || activeRow === null}\n                />\n              ))}\n            </div>\n          </Card>\n        )}\n        \n        {/* Code Output */}\n        <Card style={{ marginTop: '16px' }}>\n          <div style={{ \n            fontSize: '11px', \n            color: theme.colors.textMuted, \n            marginBottom: '12px',\n            textTransform: 'uppercase',\n            letterSpacing: '0.5px',\n          }}>\n            Python Output\n          </div>\n          <pre\n            style={{\n              margin: 0,\n              padding: '16px',\n              background: theme.colors.background,\n              borderRadius: '8px',\n              fontSize: '13px',\n              overflow: 'auto',\n            }}\n          >\n            <code>\n              <span style={{ color: theme.colors.textMuted }}># Input</span>\n              {'\\n'}\n              <span style={{ color: theme.colors.primary }}>matrix_dot_vector</span>\n              <span style={{ color: theme.colors.text }}>(</span>\n              {'\\n'}\n              <span style={{ color: theme.colors.textSecondary }}>    {JSON.stringify(matrix)},</span>\n              {'\\n'}\n              <span style={{ color: theme.colors.success }}>    {JSON.stringify(vector)}</span>\n              {'\\n'}\n              <span style={{ color: theme.colors.text }}>)</span>\n              {'\\n\\n'}\n              <span style={{ color: theme.colors.textMuted }}># Output</span>\n              {'\\n'}\n              <span style={{ color: theme.colors.text }}>\n                {isValid ? JSON.stringify(result) : '-1'}\n              </span>\n            </code>\n          </pre>\n        </Card>\n      </div>\n    </div>\n  );\n}"}}},"difficulty":"easy","cuda_difficulty":"medium","dislikes":"0","category":"Linear Algebra","starter_code":"def matrix_dot_vector(a: list[list[int|float]], b: list[int|float]) -> list[int|float]:\n\t# Return a list where each element is the dot product of a row of 'a' with 'b'.\n\t# If the number of columns in 'a' does not match the length of 'b', return -1.\n\tpass","title":"Matrix-Vector Dot Product","createdAt":"July 22, 2026 at 9:04:06 AM UTUTC-4","pytorch_test_cases":[{"test":"import torch\nres = matrix_dot_vector(\n    torch.tensor([[1,2,3],[2,4,5],[6,8,9]], dtype=torch.float),\n    torch.tensor([1,2,3], dtype=torch.float)\n)\nprint(res.numpy().tolist())","expected_output":"[14.0, 25.0, 49.0]"},{"test":"import torch\nres = matrix_dot_vector(\n    torch.tensor([[1,2,3],[2,4,5]], dtype=torch.float),\n    torch.tensor([1,2], dtype=torch.float)\n)\nprint(res.item())","expected_output":"-1"}]}