contract ERC20Token {
  using SafeMath for uint256;

  uint256 public totalSupply;

  mapping (address => uint256) public balanceOf;
  mapping (address => mapping (address => uint256)) public allowance;

  event Transfer(address indexed from, address indexed to, uint256 value);
  event Approval(address indexed owner, address indexed spender, uint256 value);

  /**
   * @dev Send tokens to a specified address
   * @param _to     address  The address to send to
   * @param _value  uint256  The amount to send
   */
  function transfer(address _to, uint256 _value) public returns (bool) {
    // Prevent sending to zero address
    require(_to != address(0));
    // Check sender has enough balance
    require(_value <= balanceOf[msg.sender]);

    // Do transfer
    balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
    balanceOf[_to] = balanceOf[_to].add(_value);

    emit Transfer(msg.sender, _to, _value);

    return true;
  }

  /**
   * @dev Send tokens in behalf of one address to another
   * @param _from   address   The sender address
   * @param _to     address   The recipient address
   * @param _value  uint256   The amount to send
   */
  function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
    // Prevent sending to zero address
    require(_to != address(0));
    // Check sender has enough balance
    require(_value <= balanceOf[_from]);
    // Check caller has enough allowed balance
    require(_value <= allowance[_from][msg.sender]);

    // Make sure sending amount is subtracted from `allowance` before actual transfer
    allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);

    // Do transfer
    balanceOf[_from] = balanceOf[_from].sub(_value);
    balanceOf[_to] = balanceOf[_to].add(_value);

    emit Transfer(_from, _to, _value);

    return true;
  }

  /**
   * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
   * @param _spender  address   The address which will spend the funds.
   * @param _value    uint256   The amount of tokens can be spend.
   */
  function approve(address _spender, uint256 _value) public returns (bool) {
    allowance[msg.sender][_spender] = _value;
    emit Approval(msg.sender, _spender, _value);
    return true;
  }
}
/**
 * @title Standard ERC20 token
 *
 * @dev Implementation of ERC20 token interface
 */
function approve(address _spender, uint256 _value) public returns (bool) {
  allowance[msg.sender][_spender] = _value;
  emit Approval(msg.sender, _spender, _value);
  return true;
}

/**
 * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
 * @param _spender  address   The address which will spend the funds.
 * @param _value    uint256   The amount of tokens can be spend.
 */