fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define pb push_back
  4. #define lld I64d
  5. int main()
  6. {;
  7. int m,n;
  8. cin>>n>>m;
  9. int arr[m];
  10. for (int i = 0; i < m; ++i)
  11. {
  12. /* code */
  13. cin>>arr[i];
  14. }
  15. sort(arr,a++n);
  16. int ans = 100000;
  17. for(int i =0;i+n-1<m;i++)
  18. {
  19. ans = min(ans,arr[i+n-1]-arr[i]);
  20. }
  21. cout<<ans;
  22. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
4 6
10 12 10 7 5 22
compilation info
prog.cpp: In function 'int main()':
prog.cpp:15:11: error: 'a' was not declared in this scope
  sort(arr,a++n);
           ^
stdout
Standard output is empty