How did Congress win the Himachal Pradesh Elections with a skinny margin?

The Indian National Congress (INC) has won a comfortable majority in the 2022 Himachal Pradesh assembly election with a 43.90 percent vote share. Congress successfully wrested Himachal Pradesh from the incumbent BJP and won 40 assembly seats in the 68-member Assembly in the hill state of northern India, which maintained its tradition of voting the incumbent Government out of power since 1985.
Interestingly, Despite getting a 43 percent vote share, just 0.9% less than Congress, the BJP could only win 25 seats. Thus, it turned out to be an extremely tough contest. Also, 3 Independent Candidates emerged victorious in the Himachal assembly polls results declared on Dec. 8.
The Congress' fierce campaign with its Top Leaders like Priyanka Gandhi, Rajeev Shukla, Ex-Haryana CM Bhupendra Singh Hooda, Chattisgarh CM Bhupesh Bhagel, and the understanding of Himachal Local Issues and compelling exposure of the ruling BJP's mistakes helped Congress to get an edge over BJP in H.P. Its advocacy to bring back the Old Pension Scheme secured Congress win.
The BJP had given the slogan of "Raj Nahin, riwaz badlega" (Not Govt. trend will change), which decodes to "the convention will change, not the government," but failed to jolt the trend. The People of Himachal Pradesh have not voted any incumbent government - back to power since 1985.
The AAP received just 1.10% of votes in Himachal Pradesh Elections despite having a fierce Campaign like Gujarat But failed badly, with 100% of its Candidates losing the deposits. It showcases that the AAP had no ground in Hill State, and all the hype it created around it turned out to be shallow. Similarly, If looking at AAP Gujarat Campaign, Delhi CM and Party Convenor Arvind Kejriwal had strongly claimed that they would form the Government in Gujarat but got only 5 seats out of 182.
In the end, if looking at both State Gujarat and Himachal Pradesh Election results, these elections have brought up a piece of good news in one way or another for everyone. BJP got a great historic win in Gujarat, and Congress got much-needed relief in the form of a Himachal Pradesh win. At the same time, AAP, just being a new party, bagged the stature of the National Party and made a fine debut with 5 seats in Gujarat.