{"problem":{"name":"L. Basketball","description":{"content":"The most important part of playing basketball in the yard is to choose two equally strong teams. Otherwise, the game could be ruined because the stronger team could win easily. However, sometimes the","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":65536},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10074L"},"statements":[{"statement_type":"Markdown","content":"The most important part of playing basketball in the yard is to choose two equally strong teams. Otherwise, the game could be ruined because the stronger team could win easily.\n\nHowever, sometimes the number of players in the team is not so important. Especially, if tall guys are playing with small kids.\n\nThere are two teams: Reds and Blues. For each player in the teams we know his skills.\n\nWe are interested in how many ways we can choose some players from Reds and some players from Blues, so that the created teams are equally strong. The strength of the team is the sum of the skills of its individual players.\n\nThe first line of each test case contains the number of players in Reds n and the number of players in Blues m (1 ≤ n, m) (n + m ≤ 17).\n\nThe second line of each test case contains the skills of players in Reds from 1 through n.\n\nThe third line of each test case contains the skills of players in Blues from 1 through m.\n\nSkills are integers in the interval [1;100000000].\n\nOutput the number of ways of choosing two equally strong teams.\n\n## Input\n\nThe first line of each test case contains the number of players in Reds n and the number of players in Blues m (1 ≤ n, m) (n + m ≤ 17).The second line of each test case contains the skills of players in Reds from 1 through n.The third line of each test case contains the skills of players in Blues from 1 through m.Skills are integers in the interval [1;100000000].\n\n## Output\n\nOutput the number of ways of choosing two equally strong teams.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n, m \\in \\mathbb{Z}^+ $ denote the number of players in Reds and Blues, respectively.  \nLet $ R = (r_1, r_2, \\dots, r_n) \\in \\mathbb{Z}^n $ be the skill values of Reds players.  \nLet $ B = (b_1, b_2, \\dots, b_m) \\in \\mathbb{Z}^m $ be the skill values of Blues players.  \n\n**Constraints**  \n1. $ 1 \\leq n, m $ and $ n + m \\leq 17 $  \n2. $ 1 \\leq r_i, b_j \\leq 10^8 $ for all $ i \\in \\{1,\\dots,n\\}, j \\in \\{1,\\dots,m\\} $  \n\n**Objective**  \nCount the number of pairs of subsets $ (S \\subseteq R, T \\subseteq B) $, where $ S \\neq \\emptyset $ or $ T \\neq \\emptyset $, such that:  \n$$\n\\sum_{r_i \\in S} r_i = \\sum_{b_j \\in T} b_j\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10074L","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}