{"raw_statement":[{"iden":"statement","content":"The complete problemset is available on http://maratona.ime.usp.br/primfase19/provas/competicao/maratona_en.pdf\n\n"},{"iden":"examples","content":"Input5 6 7\n2 2 O\n3 2 N\n4 2 N\n4 5 N\n2 6 O\n5 5 L\n2 4 O\nOutput4\nInput2 2 3\n1 1 L\n1 2 O\n2 2 N\nOutput0\nInput2 2 3\n1 1 L\n1 2 O\n2 1 N\nOutput1\n"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ t \\in \\mathbb{Z} $ be the number of test cases.  \nLet $ T = \\{(n_k, A_k) \\mid k \\in \\{1, \\dots, t\\}\\} $ be the set of test cases, where for each $ k $:  \n- $ n_k \\in \\mathbb{Z} $ denotes the length of the sequence.  \n- $ A_k = (a_{k,1}, a_{k,2}, \\dots, a_{k,n_k}) $ is a sequence of integers.  \n\n**Constraints**  \n1. $ 1 \\le t \\le 1000 $  \n2. For each $ k \\in \\{1, \\dots, t\\} $:  \n   - $ 1 \\le n_k \\le 50 $  \n   - $ 1 \\le a_{k,i} \\le 100 $ for all $ i \\in \\{1, \\dots, n_k\\} $  \n\n**Objective**  \nFor each test case $ k \\in \\{1, \\dots, t\\} $, compute the alternating sum:  \n$$\nS_k = \\sum_{i=1}^{n_k} (-1)^{i-1} a_{k,i}\n$$","simple_statement":"You are given n marbles in a row, each with a color from 1 to 20. You can swap adjacent marbles. Find the minimum number of swaps needed so that all marbles of the same color are together in one contiguous group.","has_page_source":false}