fork download
  1. //Done by: K Ashwin
  2.  
  3. #include<bits/stdc++.h>
  4.  
  5. using namespace std;
  6.  
  7. typedef long long ll;
  8. typedef pair<int, int> pii;
  9.  
  10. #define REP(i, a, b) \
  11. for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
  12. #define TR(c, it) \
  13. for (auto it = (c).begin(); it != (c).end(); it++)
  14.  
  15. #define s(x) scanf("%d", &x)
  16. #define sl(x) scanf("%lld", &x)
  17. #define pb push_back
  18. #define mp make_pair
  19. #define fi first
  20. #define se second
  21. #define set0(a) memset(a, 0, sizeof(a))
  22. #define setdp(a) memset(a, -1, sizeof(a))
  23. #define INF 2000000000
  24. #define MOD 1000000007
  25.  
  26. vector <pair <ll, ll> > v;
  27.  
  28. int main()
  29. {
  30. ll n, c, x, y;
  31.  
  32. cin >> n >> c;
  33.  
  34. REP (i, 1, c) {
  35. cin >> x >> y;
  36.  
  37. v.pb(mp(y, x));
  38. }
  39.  
  40. sort(v.rbegin(), v.rend());
  41.  
  42. ll ans = 0;
  43. TR (v, it) {
  44. ans += (it->first) * min(n, it->second);
  45. n -= min(n, it->second);
  46. }
  47.  
  48. cout << ans << endl;
  49.  
  50. return 0;
  51. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/py_compile.py", line 117, in compile
    raise py_exc
py_compile.PyCompileError:   File "prog.py", line 1
    //Done by: K Ashwin
     ^
SyntaxError: invalid syntax

stdout
Standard output is empty