#include <iostream>
#include <vector>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int> c = {500, 100, 50, 10};
    int b = 0;
    for(int i = 0; i < 4; i++) {
        b += n/c[i];
        n%=c[i];
    }
    cout << b;
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: