aboutsummaryrefslogtreecommitdiff
path: root/codechef/hardCash/main.cpp
blob: 2b49804aea17bc3ef699f6950aff5a7a8b2f3d51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <bits/stdc++.h>

using namespace std;

long long sum(vector<int> v) {
  long long sum = 0;
  for(int i = 0; i < v.size(); i++) {
    sum += v[i];
  }
  return sum;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tt;
  cin >> tt;
  while (tt--) {
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (int &x : v)
      cin >> x;
    cout << sum(v) % k << '\n';
  }
}