fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, m, a, b, k = 0, l = 0;
  6. cin >> n >> m;
  7. while (n--) {
  8. cin >> a >> b;
  9. k += a;
  10. l += b;
  11. }
  12. cout >> (k + m - 1) / m + (l + m - 1) / m;
  13. return 0;
  14. }
Success #stdin #stdout 0s 15232KB
stdin
7 2
5 6
3 4
2 5
1 3
9 3
8 7
6 4
stdout
33