fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main(){
  4.  
  5.  
  6. int b,a;
  7. scanf("%d %d",&a,&b);
  8.  
  9. long long int box[a],mox[b];
  10.  
  11. for(int i=0;i<a;i++){
  12. scanf("%lld",&box[i]);
  13. }
  14.  
  15. for(int i=0;i<b;i++){
  16. scanf("%lld",&mox[i]);
  17. }
  18.  
  19. sort(box,box+a);
  20. //int cnt;
  21. /*for(int j=0;j<b;j++){
  22.  
  23.   cnt=0;
  24.  
  25.   for(int i=0;i<a;i++){
  26.   if(box[i]<=mox[j])
  27.   cnt++;
  28.   }
  29.   if(j==b-1)
  30.   printf("%d\n",cnt);
  31.   else
  32.   printf("%d ",cnt);
  33. */}
  34.  
  35. for(int j=0;j<b;j++){
  36. int n= upper_bound(box,box+a,mox[j]);
  37. cout<<n<<" ";
  38. }
  39.  
  40.  
  41.  
  42. return 0;
  43.  
  44. }
  45.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:35:1: error: expected unqualified-id before ‘for’
 for(int j=0;j<b;j++){
 ^~~
prog.cpp:35:13: error: ‘j’ does not name a type
 for(int j=0;j<b;j++){
             ^
prog.cpp:35:17: error: ‘j’ does not name a type
 for(int j=0;j<b;j++){
                 ^
prog.cpp:42:1: error: expected unqualified-id before ‘return’
 return 0;
 ^~~~~~
prog.cpp:44:1: error: expected declaration before ‘}’ token
 }
 ^
stdout
Standard output is empty