fork download
  1. #include <iostream>
  2. #include<vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. ios_base::sync_with_stdio(false);
  7. cin.tie(NULL);
  8. int n,q;
  9. cin>>n>>q;
  10. vector<int>freq(n+1,0);
  11. while(q--){
  12. int x,z;
  13. cin>>x>>z;
  14. if(x==1){
  15. freq[z]++;}
  16. else if(x==2){
  17. cout<<freq[z]<<endl;}
  18. }
  19. }
Success #stdin #stdout 0s 5320KB
stdin
6 7
1 1
1 6
1 3
2 1
1 3
2 3
2 5
stdout
1
2
0