The formulaic male-dominated genre needed some gender diversity. This action comedy (3 stars out of 4, rated R) pairing Melissa McCarthy with Sandra Bullock is no less predictable, but it's bawdier and funnier than most of its masculine counterparts.

The script, by Katie Dippold, draws cleverly on the pair's strong suits. McCarthy brings her envelope-pushing improvisational talents to the role of a freewheeling loudmouth beat cop. Put her with Bullock, who can nimbly play an uptight, klutzy FBI agent, and the result is goofy hysterics. Though McCarthy gets more outright laughs, the movie wouldn't work without Bullock as her straight woman. It's all about timing and chemistry, which they have in spades.

Those who thought McCarthy was a hoot in 2011's Bridesmaids (a role that resulted in an Oscar nomination) will see more of her capabilities.

Director Paul Feig, who also directed Bridesmaids, has a particularly savvy way with girl-centered comedy. He seems to know just when to get out of the way and let comic actors riff.

Bullock plays Special Agent Sarah Ashburn as a blend of Detective Cagney, the workaholic cop from the '80s TV show Cagney & Lacey, with a bit of the unctuous zealousness of Barney Fife.

McCarthy's Boston police detective Shannon Mullins is her polar opposite. Where the Yale-educated Ashburn is prim, multilingual and by-the-book, Mullins is foul-mouthed and uses unorthodox methods to collar perps. She has a brother who has done time and a rowdy family that won't forgive her for arresting him.

Both are gifted physical comedians. McCarthy throws her entire body into driving like a maniac, and Bullock is hilarious and convincing as she drags herself around after being wounded.

Despite their constant arguments and nattering, the cops have one trait in common: Neither plays well with others. Ashburn tends to be a prissy showoff, and Mullins is impatient and nasty. Both are staunchly disliked by their male co-workers, which hints at the workplace sexism in the field.

Ashburn's boss, Capt. Hale (Demián Bichir), likes to remind her she's no team player. So he ships her off to Boston to nab a ruthless drug lord. Or maybe it's just to get a break from listening to her overprecise pronunciation of Spanish words.

In Boston, she immediately runs afoul of Mullins as she treads self-righteously on her turf. Mullins finds Ashburn alternately pathetic and weird. Ashburn is dismayed by Mullins' sloppy habits and profanity-laced vocabulary. And then there's Mullins' family, a rowdy bunch whose idea of art is sports-themed paintings with Jesus as the spotlighted athlete.

Given buddy-cop clichés, it's no surprise that the two grudgingly become pals. But what makes the tired formula work so well is how these women embrace and gleefully send up the genre.

It's not a perfect movie, but it offers more laughs than any other this summer. The action drags toward the end, and a scene in which Ashburn performs an emergency tracheotomy is more gross than comical.

Given the various permutations of "buddies" that have populated the cop genre, it's a wonder that Hollywood has waited so long to again seize upon the concept of women as lethal weapons. It's about time.