Statistics

Problem Statement for "BracketMaze"

Problem Statement

We are given a maze which is a cube of NxNxN cells. We start at (1,1,1) and we move to (N,N,N), in each move visiting one of the three adjacents cells in the positive x, y or z directions. Each cell of the maze contains either a '(', ')' or '.'. A path is the sequence of cells visited during the journey. We intend to find the number of such paths that produce a valid parenthesized expression.


Periods can occur freely in an expression, and must be ignored while checking if an expression is properly paranthesized or not. A paranthesized expression is said to be valid only if it adheres to the following grammar (quotes for clarity):
      <expr> ::= empty-string | "("<expr>")" | <expr>"." | <expr><expr>
e.g., "(())", "....", ".()." and "().(.)" are valid parathesized expressions.
The maze is given in a String[] which, when concantenated, represents the cube encoded in the following manner. The characters of maze correspond to the following cube coordinates, in order:
    (1,1,1), (1,1,2), ..., (1,1,N), (1,2,1), (1,2,2), ..., (1,N,N), (2,1,1), ..., (N,N,N)

Given the String[] maze return an int representing the number of possible paths forming valid parenthesized expressions. If there are more than 1,000,000,000 paths, return -1 instead.

Definition

Class:
BracketMaze
Method:
properPaths
Parameters:
String[], int
Returns:
int
Method signature:
int properPaths(String[] maze, int N)
(be sure your method is public)

Constraints

  • maze will contain between 1 and 50 elements, inclusive.
  • Each element of maze will contain between 1 and 50 characters, inclusive.
  • The maze when concatenated will contain exactly N^3 characters.
  • Each character in maze will be '(', ')', or '.'.
  • N will be between 1 and 13, inclusive.

Examples

  1. {"()()()()"}

    2

    Returns: 2

    There are two paths in this 2x2x2 cube. From the 3 possible moves in the beginning, you cannot go right directly which completes a "()" but all it's neighbours are ')', hence lead to an invalid expression. The other two possible moves lead to unique valid paths.

  2. {")()()()("}

    2

    Returns: 0

  3. { "..........................." }

    3

    Returns: 90

  4. {"..(....)"}

    2

    Returns: 2

  5. { "(.........................)"}

    3

    Returns: 90

  6. {"()(..(()(()())()()(().)))()"}

    3

    Returns: 10

  7. {"(.))(()().)().))(()).()))()()))..).())....())).).(","(.((.).(..)..((.(().).(()..(.)().((.)))())..))()))","(.)())))))..)((().)).)(.))).(()(()..(().)(()))))..",").)).()()..(.).(.)...).).)..).).(.)()..))....)...)",").(().((()..)(()"}

    6

    Returns: 30737

  8. {".((.()(..).))(.)(().).)(()(..))((()...))()()...()(",".)...(..((.((..)().)(..()...)())).(.).)(...)().).)",").((.(((..(((.)((...().)."}

    5

    Returns: 1485

  9. {".).(.)(.)(().()....))..((...))()(().)).().(((.()(.","(.(()(.))((())).)(...((.((().((()((..(((.).().)(..","))(.)...().))).())..).)).()()(..(.(.....)(.()())()",".)())(...(.()..(.)...))(()).)(())))(().(())(..()()",".)(.)()(((()(.))"}

    6

    Returns: 21034

  10. {"..)((.()(.((.))(()(()))(.((..())()())()((()(((...)",".)))().)).(()().)))).....)(..)()))(..).)).()()(...","(..))))())(...)).....)(.()..)()).(((((((((()(.))()","()..(..(......(().()))()...())..)().)(.))....(.(((","())).)).().(((.)()..)(...))(.(...()((().())(((.).)",").((.))(.))(((((..)))....(.(..(((().)(..)))()))())","))))(.))(..(.).(()(....(.(.(.)(.)()().((..)(()(().","(.(())).()(().)(()((.(.((.())))))())(().(..)).))(.","(..((.)()..)..(()...(.))..().((.().())).)..()..))(",".).())..).).)...)(((.)).))).).))))).(..)(.(()..())",".(..())).))))(.()..)()()..(..(.))((().()...)))(..(",".))(.((.)()((.()(..))(.(().(.)))((..)...)(.).((..(","(()((...()).)..(..))(...((().).))(((.)))).(()()(()","(.)..))))()..)().()..))((...((.()(((.))()..)...).)",".(.((....)((())))).())(()())))..().)..)(..())(..)(","()).(.((())).(.)).)).(()..)())()().(.)(())(((..(.(",")(()((.)).))((())).))))).()((.)().()(.)()((().(()(","(..)()()(())..))..((()).().))().)).)(.(..).(((((()",")()..()(...(.(...)...(...(...)))())(.))(.)...((())",")..().)).)).(.(.).((.))).(.(((.))().(())()...).).."}

    10

    Returns: -1

  11. {"(()).)))))(.(..)(..).))((.(..))...()))..(.)).(....",".()((.((..).)(...((.()))).().((())((())...(()())(.","..(...).(.(())))))).))...(((..).((...()())((()(...",").(.()).()(.).).()).)()(((..(.).().((.()).).)....(",".))()(......).()..))).)))..)().(.....)()()(.()((..",")(()).().)(..).()(.))).))().)()).((.)(.)(())))).((","(()))((.(().).)))((().()((().)....()..((.(.())).(.","))(..).)..(())..))).(.)..).((.((.(.((.)(..)()((((.",")()(.)(.)()(().)))).()()..(()(()()...()))..)))()))",").....)())).(()(...)((.)())..(..(.(.)).).).))(()((","(())))..)..))((()((((.).).).)))()(()(((..()(.(()..",".)(.)().)()))()(...)....(...))))(.()(().().((.))))",").(.))))(()..()((.()(.).)()(.()...()((((...)..((()",".()()...().()((()))()())().).)).)(.((.((...)())..(",")))(.()....))).((.(..()(.(.(."}

    9

    Returns: 21839706

  12. {"(...)((((..).())..(.().).(...()))(.)).(.())...())(","))(.(..)).()))"}

    4

    Returns: 356

  13. {".(..)())((()((()).())).))))).(((((.)..().((()(.)..",".)..(()..)).)."}

    4

    Returns: 78

  14. {"((.).()((().)..))()(..)).)(((.))..)(.)()))..)).)((","(()(((((..(()(.).(()))(())(..((((.....)).)..().().",".)..())(..)((()((.((.((.)(..((.()())(.((((((..(..(",")..)(.).)(...)()).(...(()(.())).(.(()(.)()).((..((","(())..))).(..)(..((.).)(.((())).)).)..))..(.))(.(.",".)..).()().)...)......))).()))())..(.)..).().))).(",".).()).)....).((.(.())..)(().(.)()(()()(....()()))",")..().).(.)))()).)(()((.()(...((((()..(..(((.).((.","()((().((((.)).(.(.().....)().)(..(.()((()())()()(","))(.()).).().)))()))((...)()(.())()(..)()(..)))...","(())(.(()(()..(.).))).)(.((((.(...)(.)).(..((.(())","(()).()()())))(()).).).(.)((..(....).))..()(.(((.(",")((...((()(.....)(((((((().)))..())())(..).)..((()",".)(.).(.))..()()))((()())(..)(()).)(((((()..(())).","())((())((.)(.)))(().))...))."}

    9

    Returns: 290347808

  15. {"..)()))).(.(()(((.(.((.)().)(())(().)(.)(.(..()()(","(..(..))()..))"}

    4

    Returns: 152

  16. {"..(.)()...())().).(((..)))((()(...)(.(..).().).(..","((..).(.)())..()(.(.))((.))(.(())..(((...().()(.).",".))()(.)).))((..(.).()))(.).)().))).()(.....)....(",").(.(.()(.).())(.).).().((())())).).).))(((.(..(()",").))(.)()()()).).((.)(..(((.)..())(.()()(...(.(.).","(...)((.)().(()(..)).).(((.).))()....(.(.((.(....)","().())().)((().).(.)).((((.(..).()(..).)..().().(.",".)..))))..))()))).()((())..()..))))().((((.)().((.","(.)(((().)..()((.).(...)((.)..(.(.()(..(....)..)))",".().(..)((()((()..)..)....))(()))(()(.(()..)((().(",").(.).)()))()).()()..(.()(..)((...(()(()()(..)()).",".()))(..(.).)(.)(().)().))..)(.())()(.).)(((.)())(",".((.(.)(().(((.().((.))).)).()(()).((((.((.)).((((","(..))(.)).(.().(.()).((().().)((...(.)..)()))()((.",")())).)))().)(..)((..()))(.)(()(.)..)(().())).))..",".)()().))).()..)).)()))...).)((.)))(.()(....(.(.)(","(().(.).)).(...)))().)))(..())(((...))..(..)()().(",".)).)())((...(..()))).))().((().()()())).)(.(..(((",".)().()((()((.))).)(..()((..(.().().).)..))))(()..",")(.()()())(()(.).((.))))..)).)..)(()()()(.)((()))."}

    10

    Returns: -1

  17. {"())).(())..((.)().(.)..())()(..)....)())(())(....(","())).....((()."}

    4

    Returns: 162

  18. {"...(.).)())..)))..(.)((.)))"}

    3

    Returns: 5

  19. {"()((...()()()).().(....(((."}

    3

    Returns: 8

  20. {"..)(.(.(..)).(...)().))().((((.).)()).(.(((..)))(.",")))..()(..(())(((.).))(.(())()().(()()()))(.)((.).","(().).((..).(())()((((..(......).))).(((.((.(((.(.","((())()())....(..).()().(...)).).(...()()()(.)).).","))((()).).(()())(.).)(...(()()())((.(((.(.)))((.).","..().(..)(.).(.((.)).).((.(.(.(..(.(...)(...(.).)(","..))()((.)))))))((((..)(()((((()().)(..)....()..((",")()...(.(..))..(...)().))...())((.())..(.)((.).)).","(.)(((.)).(..)()(().((.).))).))....)(()))(..(((..)","))((.(.)))(()..(.)))().())(((((()((()).((())))((.)",").)((.)))(.))()(.)).().)..)((((.(())(((()..)(.....",".(())()()(.())))...()()((.(..))...()))((.(((..(()(",")()(((.()))).)(((.()..(.)(.(.)((())()().).)((.....",".....)(((()).)...((..)(()()(.)(...)())(()).().....","().(.).).(.())).)()().))()(()"}

    9

    Returns: 61586518

  21. {"(((....().......)..(.(..)(.(...()(...)(.()).().().",".))((((.())).))(..).(()()(.)..())().))).((()(.(.((",".).(().)(.)(().(.((..)((((.()(.(.))..()..))((.(.)(","))(()).())()(())).(..())()(..((..).)).).)(.()))(()",".).)).(((.).((()"}

    6

    Returns: 49657

  22. {".(...).).))).))))).)(.).).)()(()..)(.(.(((.()..(.(",".()..)).()())."}

    4

    Returns: 74

  23. {"()(.().(())...()..)...()...(..((.)...((...)((())((",".)((.)))))...)"}

    4

    Returns: 317

  24. {"..().()()(.)().))((.).(...)(().(..)))()..(.)().)()",".(.))(.(.().)(.))))(.)).)((.).(())).()(.).(...)..)","((((((((...()..(.)(.)).(.(()())).()(..(..)()...)..",".(.)).(.()).()...(()().))(.()()..)))((.)())).)).((","..()(())()())).)"}

    6

    Returns: 29313

  25. {"((..)(.)))((.)(.))()).())(."}

    3

    Returns: 16

  26. {"((..(())().(()()(.().((.)()"}

    3

    Returns: 9

  27. {".(()(()(..().()()())...)).)((()())...))..))()))..(","()..)(().(().)))()))(())...))).)..)(.)()).)..()())",".()()..(((.(().)).)(..)))((()....))((()(..)..((.))","(.))...))(()..).(..()..(.)(.)((()(.(.)((.(.(....))","((..)).((((((..)).)((())(.))).(.())(.)...)(())()..",")().)()()().(()()))))(.).(....).)(.(.))())(())))(.","))(()(..(..(.)((.)..)()).()(.(((..)((()(()((()((.)","()((..(.((.((.(..).).)()())))(.)....).(.)))..()(.(","))).)((.(.().(.)().()).)))((..)(...)(()((()(()(((.","(()(((().)(.)(...().)(.))(..(..)((.()...(..).(.)(.","....(.()).)()..).(((()())(.(().()(((.)(((.)..((.(.","()..()().(.).).()).().(()))()(.().)..((.(.).(.).()","()))...()().)((.)((())))).().((...).))..().)(.)))(",".)))(.).).(.)().(..)((.)().(.))((.()((.)(..())).)(",").(().)()).(..((......()..((("}

    9

    Returns: 0

  28. {".(.))).)(.()..((()(((...).).()..)(..)(.))().((.())",".(())((..(..).((.).())())(((.((.(().()..).((.....(","....).()()((((.((...)..)).)())..((.))))(.(..).(.)(","()..()(.((.).)((.())..(.).).)()..).)().(.)))))))..","..)...((...))..(.((.()))......(.)(.()).().).()(()(",")..)).(.()(..(.))..)()).)((.)()..((()).()(..).))))","(().(.)(....)).((.())().(.(.())(.)..).())))"}

    7

    Returns: 606432

  29. {".))).((())(()((((....)().()()().().(..().((()).)..",")(.)))))...)(....().((.))))(.().)(((.))((.)().)(..",".)...))(.)(.()..(.(...)()....(().(())..)..())..(()","..)))()(.))(((()().(...)))))(.((()()(.)...)).((((.",".)(()..((.).()((..)).()(..)..).))(....)...)..(((()",".)..(.)(((.(.(..)(.)())).)))).).)...)......(..()((","(.()))).((.(...(.).(.((...((()..).(((.).).)())(())","(.)...))())....)..((.)().)))(..(.((.).((((.)(((.(.","))((.))(...))((.(((()..((.((...(.)..)...(.).))((((",").(.((.))()...((..))...)..(..(.(.).....())).()..((",".)())).(.()."}

    8

    Returns: 1686570

  30. {".)).())....((.)((.(((().(.)"}

    3

    Returns: 11

  31. {".(((.(()...)(.)))(.)).(((()((.(()).))))()..)())...",")()(..)..((..(..)((.)...)).)).)))).)()(().)).)((.(","...)(.).()).(.).(.)).(.).)).)()..()(((.(..().)(.)(","...(..().)())))..))().())..)(.))).))(((..).))))((.","(.....()))(()).)..)().()(()))()..()()).(..)...)((.",".)(.)....))..().(((((((.((.()).)()(.).)().)().(.).",").((((.).).().)(.)()))()).(.(()(.))()(.()((.((().)",".))).()(.(())((.))((..(()(.(())..(.((()..)..).(.))",").()).()(..)(.)).).(((..(.()((((((()..)).().....))",".((.()(..((.))((.)....).)()())())((())...)(())).(.",")(().).(.)(.).())))())(.())).(..))((..)..)()..())(","((()))((.)(.)))).)(.)()().)(...)(..()()(..).)))))(","()(.((.))).(.)()()))))).()..(((()()())))).()())()(","))))).(.)).)))).(.(().(....(().).().)((((..)..))).",")).)()...))(..(...))(.)((..)(.))..(.(..).(.))(....",".).())(..(.))(..))(.((..()((..()).(.)((.()(().).)(","..(.)))).))((.(((((.)())(().).(..).).().(((.(.(.)(",".(..).)(..((..().)..(.(.())().((.))(((.().).(().()",".((...)...)(.)(().))).()).)).)))()(((.)()().()((()",".(((.())).)))))..))).)))).)((.(((..))().((.()(.)))",")..(()))((.).)(..()..)()()(.(..((.)).)(()..(.).(((",")(..(().)....)(.(...()(.).())()))((().).).()().).(","(.)()()().)(.)))()))())(..).(.)))).(().)(..()).((.",".()..)).)(.)).)).(..().).((.()(()((.)(()())).(..()","((.)))((.)))(.()(().)((.)(.(...))(().(..(.(.().)()",")(..)(()(..).).(.(.)))).().(((()(..().)))())).()).",")).)...).)(.).).()).(.)..).()()).()()).))())))()(.","(().(()..))((.).())..(()(.))).)(().(...(.((...)(..","(((.).).)(((.()()).)..)()(..((.()(...))(()(((.()((","(()(.)).)((...)(.)...))(().())....))()).))().()((.",".).(((..()...()..().).(()..))()).(..(.).).()()().(",")()().(....(.)).(((())(....((.().)())(()(()))(....",")))(.(((..(()(()((..)(.(.(.(..((((.)).(()))))()(.(",")(.((.)(.))((((..((.)))()..))((..).)).).((..)..).(",".)(((.)(()).).))))(.)..()))."}

    12

    Returns: -1

  32. {"..(.(().)())(...(.(.)(()())(.))()))(())(((().())()",".(...)))((.((.(((...(.(..(()((.()()()(.)(((.)...()","().....())).).(.)..()(.))"}

    5

    Returns: 1051

  33. {"))..).(."}

    2

    Returns: 0

  34. {"(.)())(."}

    2

    Returns: 1

  35. {"..)((.))).()))((.())(..(()(())).)().))....((()(.()","().)()..(.())(.()(()..).()((()..()).)((()(..)..(((","))()())(((...)).)((.((.))....)(())(.).())))(..).))",".)))()))...)..))(..()()()))..(.().)..)())(.)(((.(.",")(((()()())()))).)()).(..().).)).)(.()()....).).)(",".)()()))..).)..(.)...).)).(.()().)())..)..)().)(()","(())(.()(...(())).))).))((.)((().((.()..)(."}

    7

    Returns: 23763

  36. {"...().)()..).().))..)(.)))())()))))()))))).).(.(.)","...((.)(().).)(.))(..))(.)((.(.).(.))())).).(.(((.",")((.()(.)(..().()(()).()..()..))(..)()))(.)..(.)()",").)().)(()(..((.)...(..((.)))((..)(((((..).).))(()","))))).(((()((.(((.(((())).....))((.((((().).((()).","((.(..((.().())).))()..)())....).()).))(((.()..)((","()()).().((..)((()()((.(.)))))).).()().())(.()..))","()..(..).(.((.))(.((.))()..())()(..(..).))).).(.))","(((..(..)(..()((.()((..))((().)).)()()..((..)...((",")()(..).)((()(.((((()((..)(.)).))))).))()(..))...(",")).)....(())..(..(.)(..((..)(().(...())(..)(()())(",")().()().(.).).))().).)))..))).(((.).))).))())()).","()(.(.((.).).())).))())).(.(.(()(.).)))))(((.(.(.(",".)).((()).)(()..)(.))((..()(.).)(()).()())))(.)(..","))(..)()..(...).).((..)(..())"}

    9

    Returns: 110521650

  37. {"())))))()...).((.(().(.)))()((.)(...)(.()))))...()",".()...())).)()"}

    4

    Returns: 188

  38. {".).((..)))(())).)....(((.)(...(.)()))..)).).)()(.)",".).(().(...(.).(.()(.)())..((((...(.).(..)()))).).","..(((.)).(.(..(.(..))()(."}

    5

    Returns: 884

  39. {"((.(...)..(((.....))().(..)....().()(.((...()((.(.",")()...).)()))..()..)).)....(.(.)((.((..).().)(()).",".(..((())().()((()...)))."}

    5

    Returns: 4928

  40. {"(((())((.((.))(....)..().(((.(.()))(()((((.(.((((.","(...()))().(.).()((())(.))...).(.).(..)).((().(.))","(.))....(..(..(()()()))(...)(..().(..))(..)..(.(()","))).(..))(.).)())(((()..)..))).()(.(()(((.().)(.).",").((.)).).(.).)."}

    6

    Returns: 89914

  41. {"(..(....(.(.(.(..)()...((.)..(.()..((().(..(.())()",")((())))))..(."}

    4

    Returns: 264

  42. {"().(..))..).()(().))())()..()...)(..)))))).))).(((",")()...)().()((()....(.)()..)(..)))((.(.)())(.)..((","((.).).().((((.((()((((..)()((..)(()...).(.))..).(","(.))).(((((..(..).))(..()))).)()))).(().)..((...(.","((.)).(.(.)()()(....)((.(...).())()))(.).)....))).",")())..((..)(.)(.()..)...))(.)).)).)(()).)..()))(.(",").()))).(((.)(().)(.()()(..()..))....)((.).())(..(","...))(.().(.(.(()(..)(((.)(.)).).).)((..)(....))..","(((.))((.))).)((.())).))(.)())()).((..))(().(().((","..)))(.(..)((..(..(())()))()().(.((.))..).()..((.(","(..().()(.(().).).)()).((.)(...))((.).)(.((((.(.((","(()(.()(.)))).).(((.()((((...)(().((.)).)))..(((((",".((.))().((.)()(.()))()).(()).()).().()..).)..)())","().)..)(()((()(.(.).).()))..(((.(.)(.((.()(..((.()",".)(.(.....((..)).....)())..)))((.)..)()...)().()()","..).(.)).)(.(.)).((.)).)()(.))...((.().().()((.(.(","(.(.((.(().)((.)(..(().())..)).()..).(......))(.).",".)...()()))((.()).)).(.(()...).(())..(()...).)(...",").()((.().().)()...).)((((.((.).(.(.)(.).)(..)(..(","(.)(..()((.)(.)(.)())((.(().())()).((..).((()())))","((.((()......)).).((.).()..)().)((((()(..)((()(.).","))()..)(((.(.(..).(().((...))(()(.).))..)))(.()(((","..).(.)())(.).()..(.()).)((..)...)(((...(()().()))",".(((..(..)(..))).(.()(.(..)())((.(.()).)..)..).(..",".)).(.(.).()....)(((..)))....)...)().(.)()))(..()(","().)...).()(.()(())(..)).).(.)).(.(((().(.)).)).(.","(..(...())....).))(.)..))((.))."}

    11

    Returns: -1

  43. {".((.(..((.(...((.((.(.)..((.(.(.)(..((.)(.(.()(.)(",")(((...))))())((.((.().)).((()(.((((.))(.().)))(.)",").(..)())).(.).)).)(.(().))...(.)(.(.).))()))))())",")((..)(.)).)..)...)))).)))..)((.))()))(.)).))(.)((",")(...(().((.(..(((((.().)..)(((...).)(.)))(())()()","))).)..))(((..()(((....).)....)()((.(((((.).(.)).)","()(((((.()(.((((.).())(.().)...)....(.(.))(.()..).",".)).).)..)).)(()(((.))(..()..).()))(.)).)))(((.())","...).(()..(.)())).)).((.).)))(((.)))..(.(.(.)(..)(","(..((.().)).(.)(.))(.)(....))())()())..(.).(())))(",")(((..(()(()"}

    8

    Returns: 8030113

  44. {"(.)(..()"}

    2

    Returns: 4

  45. {".((())..((())))(..)))()(.((.).())()(..(..)))..(.))","))..(..(.(.).(((.(.)(.).(..(((((.)()(()..()(.((())","...)(()))).()..(()...)())..()(..)()(.(..)).))((.)(",").(.)())())...)().)(().((....)()()((..)...()().).)","(((.(..(()(()))."}

    6

    Returns: 26405

  46. {"(().)).)))).(.(..).((()))((()(.)..(.(..)().(.(()()","..).((.))))..)"}

    4

    Returns: 295

  47. {"()))).(.)))(..(.)..)().).))..(((.).)((.().(.).()(.","((..)((...(())))...()().().(()(.).(.((.(())()..((.",".())..))(..))()(...)(.)..)))((..(()((().())))..()(","())(...)(.().(...)((.).)(..)...).())(()..).).(.)(.","(((....()()()((())).()(.).(((((.(((..(...)).())(.(","....)())..).((.))).)..((()).).))..)((.(..(.(.).((.","(..(.)))(.)(()))))(.())..)(()(.())))).()..()..))(.",".(()(.()().).).).)()(..).())((()(.))(.(()).)()().)",".)(.)...(.(.)(()()(().))))(.).()))(...).).().)(..)",".(((.)))))(.).(()()).)).......).(.)..)..(...).(.)(",")().)...())(...())()).(.(((..)).()))())(..).)).()(","(.).(.())).)()).(.(.(()()))).))((()())().((.).).(.","(().)(.)((.).)(.....(.).((())..)..))..))(()(...(((","(..)))).)()((.(.((.()(.))..).)()))(((.())((().).()",".).)(..)..(..)..)))().)).().."}

    9

    Returns: 105384901

  48. {"(.).(.(...)((.(..).(....()())((().))))())((.))()((",".(.)).(..(()(.))(())(()())(.)(((()()))..(.)((..).(",")(((.)..)).).(.(.).)...(.)(((()((.((((...)).(()).(","((())(..)).()).)((.))))((.(()(.)(.(.()().(.)(((()(","..((((.().()....)(.((().).())).((....)..(.().).)(.",").()).(..(.)((((.(..()....))((...(.)(.(.(.()...)((",")()()(..(().(((...).((...).())))().))).(((.(.....)",")(.(.(.)(..(.).).().()()()(.)(..()).)).(...)))(.).","())())..(.)).)(.)(())())(.(...)..()(().((.())))..(",".(((.())(()).(.)(.((()()..))())(()()(.)(.))()()).)","()(...)(.)(.)()().()(()()(()).)(.....().))(.)(.((.","((.).).(.)).((.(..()(.().((.)(.)())....(.).)(.)().",")...))(((.(()())))))).(.(().))..(()((...(.(((((.(.",".(..().)...)(...(((.(..((((.().)((.(())(.))(.)(((.",")((.)..)((()()).)())..)...(()"}

    9

    Returns: 428997694

  49. {"..)(.)(())(...(.).)((.()(..((.(((.)..).).)(..).()(","...)(...()(.)()).)((.((..(.((.(.)).(...)))(.).)()(","().).()()())()().(.((...()((.))).)))((())).)(.).).","))().)).())))(.)().))))..)(.)(..(()((.(.(..().(((.",")(.))()()))((..(.((..)((.))().((..(((()).)())().((","((.(().(.()(((..(((.((..((.(.())())().((()..(.(...",")).)(())..))(.).()()(.)((..).)(..)((((.(..(.)(..(.",".(()((((((...).().)..).).(()(()(.).(...).(()(((()(","((.).((.(..).).))(..(..()(()()(()))()))))))).(.).)","((.(.)))((.(((...((()).).)(..)()(.(.((..((..)))).(",".))())(..))).())((..)(.)...(.).(()).(.)()..().)...","((((((..(()))).).))(().()(()))..((.))()..(..())..(","..(((.(.((.).()(..))(()().)..).()))(.)..).).(...).","(((()().)..)(.)..(.())())).()()().())().).(.(.)..(","((.))(((.)()..)()(())().)...."}

    9

    Returns: 58360558

  50. {".()))((.()(()..)..()(.).)(.()....)()(.(.(.)()..)))",".(()...)()(.)."}

    4

    Returns: 253

  51. {".))())(.().(()).).().).()((.)).))().((.(.)).((()).",".(()..())(.).)).(((.(..()(.)...((())(.)).(..().)(.",")))...()(.(().(().).()..()))(()(...)((..(..)()...)","(.)...(.(.()((()(.)(.(..).(......)(()(()(.(()(((.)","()()()).(.)).(().)((().())(().)(..)(.)((...).).(.(",")(..)())()))).(()()())(...)).))(.(..().)).((.)()..","..).)))....().()(.(()(())()(.)())(((.(((.()()()())",")..)(((((().().())(((.(((().(.).).)....(()(().)..)",")))).((..(()).((.)(())(.().().).))))))).())).(.)()","(..)..((((()..())).(.(..()).()..()((.).)))(.)(((()","))(()((..))."}

    8

    Returns: 6335188

  52. {"(().)(().(.)(...).(.).).(.)"}

    3

    Returns: 34

  53. {".)(((.)(..(.)().).).().(.()(..).((.((.)))(..(..)).","..()()()))()()()..)((()....(.)...).)(.)).((()()().",")()(.).)..((.((()..(().(.)).)).(..()..().)(()...((","...(((.))())...))()...().()..)(()))))(((((..(.(.((",".))....()(..(.(.(.))).)..).)().(()).(()(()).).(.((",".(.)..))).((.((())..)()).).).))(((()..(((()(.)))))","(())))....).(.().(....()((.)....(....(.())(.()(...",").))))()..))).().((.(().())))(..(.((.(.().).).(.)(","..(.)(.(.())..).()).((.)()().().).))().().((.().((","(.(..)(..((.(.)(()(()).)))().).(.()).).(..).(.))))","...(())).)))"}

    8

    Returns: 5774905

  54. {"().)))((.()().((....)((.()..).(..(.(.).))).(.)).))",".((()((..)).(().(..)..((().).()).((.))(.(..()..(()","((..(.).).((.....(.)).)(("}

    5

    Returns: 0

  55. {"((()..)."}

    2

    Returns: 1

  56. {"........"}

    2

    Returns: 6

  57. {"."}

    1

    Returns: 1

  58. {"("}

    1

    Returns: 0

  59. {")"}

    1

    Returns: 0

  60. {"()))))))))))))))))))))))))()))))))))))))()))))))))","))))()))))))))))))))))))))))))()))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","()))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))()))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))()))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))()))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))()","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))()))))))))))))()))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))(.(.())))))))(((..))))))))(.)(.)))))","))))(.)())))))))).))()))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))",")))))))))))))))))))))))))))))))))..((.)))))))))(.)","())))))))((.(.))))))))....())))))))..)))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))",")))())))))))))))...()))))))).).(()))))))))().())))","))))).()()))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))",")))))))))))))))))))))(..).))))))))((...)))))))))()","(())))))))..()())))))))))..)))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))..(.()))))",")))).)).))))))))..())))))))))...(.)))))))).(.))"}

    13

    Returns: 2634752

  61. {"()))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))()))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))()))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))()))))))))))))()()))))))))))))))))))))))))","()))))))))))))()))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))()))))))))))))(.","(()()))))))...).(())))))....(.())))))()()).())))))","(.)()(()))))).((..())))))))).)))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))",")))))))))))))))))(()..)()))))).()()(())))))).)).)(","))))))((..)))))))))).))()())))))).(()).))))))(()))","(())))))))))))))))))))))))))))))))))))))))))))))))",")))))))))))))))))))))))))))))))))))).))...()))))))","(...(()))))).))))).)))))).).)(.())))))()..(())))))",")(()).())))))))..().))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))",")))))...().))))))).((()(.))))))))((.).))))))))(())",".))))))))...(.))))))(...()())))))(()(.()))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))",")))))))))))))))))))))))))...)(.))))))))..((.))))))","..((.)())))))())()())))))).)...)())))))..)()(())))",")))())(())))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))(()))(",")))))).)(())()))))).(..).)))))))))(.))())))))(().)",".)))))))(())(.())))))(.).())))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))",")))))))))))).).(.).)))))).)...())))))))((.)(.)))))",")()((((.))))))..()(.())))))..).))())))))).(.)(."}

    13

    Returns: 13458368

  62. {"()))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))()))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))()))))))))))))()))))))))))))))))))))))))()))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))().)(().)(.)))).)(..",".)()))))(((..))..))))().(....())))(.))).(..))))((.",".((..)))))).)).)(..)))).()((()(.)))).)).)).).)))))","))))))))))))))))))))))))))))))))))))))))))))))))))",")).(..).)))))).(..(.)(()))).))()...)))))..)(..))()","))).)())))(()))).(.(((((.))))..(()(.).))))(.(.().)","())))).).)((..))))))))))))))))))))))))))))))))))))","))))))))))))))))))))..)).().()))))).))().)))))(..)","..)))))))(.)()).).))))(..()).(.))))((..).(.()))).)",").((((())))(())....))))))()....)()))))))))))))))))","))))))))))))))))))))))))))))))))))))))).(())((()))",")).((.).((())))().)(()(()))).)))(.().)))))))).....",")))))()).....))))(.(..).(()))).().))))())))()..)..","..))))))))))))))))))))))))))))))))))))))))))))))))",")))))))))..())((()))).)..)().())))(().)(()))))))(.","(().).)))).()).(((())))).).(((.)))))(())((.)))))).",".).).().))))....))((()))))))))))))))))))))))))))))",")))))))))))))))))))))))))))((.()))())))).)((...).)",")))).)(.(().))))()))()).()))).).(.().())))()())).)","())))..)).(.()))))).)....))))))(.))(..(())))))))))","))))))))))))))))))))))))))))))))))))))))))))))))).","))).()))))(((()))()))))....).(())))(.(..))).))))(.",".).)(..))))).)).)...)))).))()))()))))....).).())))","()()((()))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))((())((.)))))(.(.))(.)))))())(.))(",")))))...(.).)))))).()...(())))(..((.)())))))))...)",".))))))(.(.(().))))))(((.)()))))))))))))))))))))))","))))))))))))))))))))))))))))))))))((.(..())))))((.","(.))(.)))).)(()..()))))())((....)))).)))).((.))))(",")(((.((.)))).)())(())))))..(..))()))))()()(()))"}

    13

    Returns: 632487648

  63. {"()()))))))))))))))))))))))))()))))))))))))()))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))()))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","()))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))",")))))))))))))))))))))))))))))))).).()(()()))))())(","()(())))()((.))()))))(.)(().(.))))).))(.(..))))(.(","((.).))))).())..())))))))()..()))))))...()..))))))","))))))))))))))))))))))))))))))))))))))))))))))))))",")(..)()((.)))).)))..))())))(.).(.().))))))))))((()",")))).).)(()()))))))).().)))))(.((.)().))))..)))()(",".))))..())).(.))))))))))))))))))))))))))))))))))))","))))))))))))))))))))(().)).)))))).).(.).).)))).)).","..().))))())()((()))))(((.)()).)))))((.(()..))))()",".().))))))))((.())(())))).)...((.)))))))))))))))))","))))))))))))))))))))))))))))))))))))))))()(.())())",")))...)).(())))(()(.(((.)))).().)()())))).)())).((","))))).(()().())))()()).(())))).)(...)()))))))).(.)",").))))))))))))))))))))))))))))))))))))))))))))))))",")))))))))))())(.)))))((.().)).)))).)..())(.))))((.","(..(..)))).).()))(())))(.)..)...)))))()().)..)))).",".)(().(()))))(..(.(.))))))))))))))))))))))))))))))","))))))))))))))))))))))))))).))...).()))).)((()..))",")))()))().(())))(.().(.)())))..)().(..)))).)))(...",".)))))()))(.))))))))((...(.))))))).(.(..))))))))))","))))))))))))))))))))))))))))))))))))))))))))))....","...)))))))(.)()((())))(((())..))))))((..()..))))..","))(((()))))).)).))(())))).)....)())))).(().)(())))",")).()())()))))))))))))))))))))))))))))))))))))))))",")))))))))))))))..)((...)))))(.....).)))))..().()))","))))()..(((()))))))))(((.))))).)(()))(()))))()().)","..)))).((().(())))))()(().(.))))))))))))))))))))))","))))))))))))))))))))))))))))))))))).)(.)))))))))))",")...)()))).())(.)())))))(.()))(())))..().))(())))(","...(())))))))))))().))))))()).)..())))((.)(..(."}

    13

    Returns: 50350696

  64. {"()))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))()()))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))()))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))()))))))))))))()))))))))))))(.((.)()()))))()()",".()())))())()((()))))).)..)((())))))())(..()))).)(",".)))..))))))(()(..()))))()(()..())))))(..())()))))","))))))))))))))))))))))))))))))))))))))))))))))))))",")(()..))))))))(((().)..)))).().))).))))).(((()..))",")))(..(.)()())))..).()).())))).(())().))))(.).)()(",")))))(((()(.()))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))()(.().)))).())).())))))))).",".))(.))))(.(((.)(()))))(((((((.)))))())()...))))(.",").(.)(.))))(((((()..))))((()))...)))))))))))))))))",")))))))))))))))))))))))))))))))))))))))))).((().))",")))(())(..)))))((..)()).)))))()(()((()))).((.((.)(",")))))..(.....)))))(.)())..))))(...)..(())))).)(..)","(())))))))))))))))))))))))))))))))))))))))))))))))",")))))))).(.()))..)))).()((..()))))(.....((())))((.","(.).)())))(..)(.(..)))).)().)...))))).(()((.()))).","(((()(.())))(()(.())()))))))))))))))))))))))))))))",")))))))))))))))))))))))))))).)(((((.))))()).)).(()",")))))()(.)..)))).).)(.)))))))..()()(.())))).())(.(",".))))(()()))()))))()())(().))))()(().))())))))))))",")))))))))))))))))))))))))))))))))))))))))))))).)..","((...))))(((((.().))))().((.())))))..(()(.(.))))).",")(()(()))))()(((())())))...)..)(())))(.).).(.)))))",")(..(.(.))))))))))))))))))))))))))))))))))))))))))",")))))))))))))))())())))()))).())(().)))))((((())()",")))))((.(.)..))))()..)...())))(...)()(()))).())((.","(.))))..)()..(()))))...).).)))))))))))))))))))))))",")))))))))))))))))))))))))))))))))).)(.)...()))).()",").)...))))(..)()()())))()(.(.().)))))))(.(.(.)))).","()((...())))(.(.(()(.))))((...(.))))))(.)..(())"}

    13

    Returns: -1

  65. {"))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))","))))))))))))))))))))))))))))))))))))))))))))))))))",")))))))))))))))))))))))))))))))).).((..(()))))(()(",".(.)))))((.)(().()))))..)).)))))))))()..)())))))(.",").((.())))..((()()())))(..))).)()))))(..((.(.)))))","))))))))))))))))))))))))))))))))))))))))))))))))))",")().).)...)))))...(.(..))))(.).)(().)))).)(.).)).)",")))...)()())))))..(..(.)))))))(.).().)))))..())())","()))))).(.)...))))))))))))))))))))))))))))))))))))","))))))))))))))))))))())))(...))))))()...())))))())","().).)))).)))(.).())))())(.(.()))))...(()((.)))).(","((.((.))))).()()().()))))()((.)())))))))))))))))))",")))))))))))))))))))))))))))))))))))))))))..)..).))",")).(((.(.)())))))()..((.)))))..()..(()))))((.)((.(","))))()((((.).))))..()))(.))))))).(((.(())))())..((",")())))))))))))))))))))))))))))))))))))))))))))))))","))))))))(((.).((.))))(.(.))()())))(.(.)..)))))).((","..((())))).(()..)))))))(.)))(().)))).((..(.()))))(",".()...(.))))).)(.))..)))))))))))))))))))))))))))))",")))))))))))))))))))))))))))..))..)(.)))).))..((.))",")))(.())().())))...(()...)))).()...)()))))...((.()",")))))(((()).(()))).((.()..())))(.)(.((()))))))))))",")))))))))))))))))))))))))))))))))))))))))))))).(()",".)))))))).)())(...))))(.)(().(()))).))..(.())))).(","()().).)))).((.)(.()))))..)(.)..))))))((..).(.))))",".((.(().()))))))))))))))))))))))))))))))))))))))))",")))))))))))))))..)))())))))).)()()(.)))))().((().(","))))..)(.()(())))(.).).((())))))(().((.))))((.()))","(())))(()(().(.))))..(((((.())))))))))))))))))))))","))))))))))))))))))))))))))))))))))(.((())(()))))).",").().())))..).().(())))(.).((.))))))).)(.((()))))(",")(((())())))())((.)))))))(..)))..))))))).(.((()"}

    13

    Returns: 0

  66. {"..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", ".................................................." }

    10

    Returns: -1

  67. {"..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..............................................." }

    13

    Returns: -1

  68. {"((((((((((((((((", "((((((((((((((((", "))))))))))))))))", "))))))))))))))))" }

    4

    Returns: 320

  69. {"(" }

    1

    Returns: 0

  70. {"((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "((((((((((((((((((((((((((((((((((((((((((((((((((", "..............................................." }

    13

    Returns: 0

  71. {"(.........................)" }

    3

    Returns: 90

  72. {"(((((((((((((.....................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "...............................)..................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "...............................)..................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "...........................................)..)" }

    13

    Returns: -1

  73. {"()))()(...()()(.))()..(.)).((((.)())....).(.)(.().", "()(((.()))..).()(.)(()))(())().).())()(.(..).))).)", ".)....())....(.)(.).((.()...)......).(.)(..).(.)))", ".)(((()...)))(((()())).)).)(...(..)()(.((.(..)(.).", ".))).).(.(...)).(.).(.()(.))()...().(.((())(.((.()", ")(..)..)..).).))(())(()()((.)(.)).(().)...)).)(((.", "()..))(...()((((.(.()..()).).))().)((.().(..()..).", "(.(.....()(())..))(..(..((.)(..(.(.(.(()(..)......", "))(.()())(((((()((.(.(.()().()(.((.)(.()(((..).))(", "..).))(...)))(((..).)().).(((.)....(..)().())..())", ")).))((.().))((().)(..()(((.(...(....())()(())()..", "))(.))).)..).(..(())).))..((((.()...))(((()()))...", ".()))...)).)))..()))).()()()..))..()(..))((().()).", ")..(...))).(..())))).())()(((..)((()).(..()))()(()", "(()))((()...().))..)()(((()().))(()().((().)(()((.", "()...)).(.)(())(()(()))(..).)((..(.)))(.((..(()((.", "..)().)(.(()(())(().(.()()(.())..)..(().)(.)((()()", ".)...(.)(())).(()())...()).(.)()..((..).().)).)).(", "()..(.(.()().).((..))((.(((())()().))))..))(.)).((", "(()....).((.....().))().())...)).)).())().))))).)(", ")))(((.)((....)).()(().).(.(...)()(((((..().)()(.)", "(.())).)).().()((.).(..)...))..).))(..).))(()(()).", "(.(.()))(((()((....)))(.)..(((()()((..)(...)(.)).)", ".).(....))).))(.)(..).(((.(())((()(.(()).)(.(..)..", ").(..).).)(()()()())()(.(.().)(((((.)()..(..).)..)", "((())))())..)))()..).()..)(.)((())((()(.(.).(.(..(", ".))()).).).(.(.().(.((()))(.).(().)(((.(().().)().", "((.))(..)(((.)...)))((..().(())()))(.()()))()(()()", "((().(()(..()).)((())...((()))(((.)(.)((())...)(..", ".(......(((()(.(.)((...()(.)()).((().))))))...()(.", ".))...()()))..).).))..))...).)()()()((.)(....).).)", ")(..((()(..))....()((((.)(()(()(((.()..))).).)).)(", ".)(..).)())()))()(.(((.).().)....(....)()))..())(.", ")..)))).)((.((.(.)).)(()()(.)(.)(()()))((..())((()", ".)((()).((((().).(..(.).)()..)(.()).(..())).)).()(", ".)(.))))....((.().)....())).()))...))(..).))((.())", ")..(.))((..)()((()())..)..))..)((()((.(.(()((((..(", ")..(()(.)()..)).().))..).())(.).(..))..())).)()(()", "..).()()..(()()()...(.())..()(.((().((.())(())(().", ")((.()((.)).((.(((..().(.)).)(.((.))()).).)..().)(", ".(()))).(.()...())(()(.)().....)).((()).(().))..()", "(..()))())((()(())(..)))).(..().((.))))((()(...(((", ").)))(.()()..)(.(.)).)..((..(.)(...()).).))))).).(", "((((.).((.)))))))((.)(.)(.)).(.)()..)(((.)(().." }

    13

    Returns: -1

  74. {"..).)())(()(()))()(.()(.(((((()((.).(.((.))()..)).", ")...)(.).).(((()().).(.(.)))(..()()...((().)((.().", "..).))))((.)))..).)).).(.)))((((..(().)..((....(.(", "......((..))()))))(((.).)))))()..)))()....)..(.)..", ".(().).(.(())))))).))(()..))()()......)).)(..).))(", "((..))(((.)....(.)()..))))(()))...).))....)())()..", ").(()).)().)().)))..))))))((((.()(())(.)()..).)(.)", ")(())).)()(((())(.)....))).(.(.))((.)(..))()).(().", ".)(().().)((..)((.))((.)(.)()((().(()...)(.)().(()", "(.(.))()(.(.).()))())(.)((..)(..())).()()(())))((.", "((.)((..)(.." }

    8

    Returns: 12467418

  75. {"..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..................................................", "..............................................)" }

    13

    Returns: 0

  76. {"((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))", "((((((((((((((((((((((((()))))))))))))))))))))))))" }

    10

    Returns: -1

  77. {"(..........)....(.........)" }

    3

    Returns: 57

  78. {"..(....)" }

    2

    Returns: 2


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: