contract ERC20 {
    using SafeMath for uint256;

    string public name;
    string public symbol;
    uint8 public decimals = 18;
    uint public totalSupply;
    mapping (address => uint) public balanceOf;
    mapping (address => mapping (address => uint)) public allowance;

    event Created(uint time);
    event Transfer(address indexed from, address indexed to, uint amount);
    event Approval(address indexed owner, address indexed spender, uint amount);
    event AllowanceUsed(address indexed owner, address indexed spender, uint amount);

    constructor(string _name, string _symbol)
    public
    {
        name = _name;
        symbol = _symbol;
        emit Created(now);
    }

    function transfer(address _to, uint _value)
    public
    returns (bool success)
    {
        return _transfer(msg.sender, _to, _value);
    }

    function approve(address _spender, uint _value)
    public
    returns (bool success)
    {
        allowance[msg.sender][_spender] = _value;
        emit Approval(msg.sender, _spender, _value);
        return true;
    }

    // Attempts to transfer `_value` from `_from` to `_to`
    //  if `_from` has sufficient allowance for `msg.sender`.
    function transferFrom(address _from, address _to, uint256 _value)
    public
    returns (bool success)
    {
        address _spender = msg.sender;
        require(allowance[_from][_spender] >= _value);
        allowance[_from][_spender] = allowance[_from][_spender].sub(_value);
        emit AllowanceUsed(_from, _spender, _value);
        return _transfer(_from, _to, _value);
    }

    // Transfers balance from `_from` to `_to` if `_to` has sufficient balance.
    // Called from transfer() and transferFrom().
    function _transfer(address _from, address _to, uint _value)
    private
    returns (bool success)
    {
        require(balanceOf[_from] >= _value);
        require(balanceOf[_to].add(_value) > balanceOf[_to]);
        balanceOf[_from] = balanceOf[_from].sub(_value);
        balanceOf[_to] = balanceOf[_to].add(_value);
        emit Transfer(_from, _to, _value);
        return true;
    }
}
function transferFrom(address _from, address _to, uint256 _value)
    public
    returns (bool success)
    {
        address _spender = msg.sender;
        require(allowance[_from][_spender] >= _value);
        allowance[_from][_spender] = allowance[_from][_spender].sub(_value);
        emit AllowanceUsed(_from, _spender, _value);
        return _transfer(_from, _to, _value);
    }
// Attempts to transfer `_value` from `_from` to `_to`
//  if `_from` has sufficient allowance for `msg.sender`.