This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
_ = input() | |
nums = list(map(int, input().strip().split(" "))) | |
print(2 ** int(math.log2(sum(nums)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eth_gasPrice | |
> { | |
> "method": "eth_gasPrice", | |
> "params": [], | |
> "id": 42, | |
> "jsonrpc": "2.0" | |
> } | |
eth_getTransactionCount | |
> { | |
> "method": "eth_getTransactionCount", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.11; | |
pragma experimental ABIEncoderV2; | |
contract ItemDefiner { | |
struct Item { | |
bool isGood; | |
} | |
} | |
contract ValidItemChecker { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ToggleMachineState { | |
states: { | |
inactive: {}; | |
active: {}; | |
}; | |
} | |
type ToggleEvent = { type: 'TOGGLE' }; | |
type ToggleMachineConfig = MachineConfig< |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Different Outcome Proposed | |
Voting | |
vote -> Consensus Reached? | |
reject -> Current Outcome | |
Consensus Reached? | |
yes -> Updating Outcome | |
no -> Voting | |
Equal Outcome Proposed | |
Current Outcome* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You can click on the enabled (ie. blue) actions in the diagram, and view the current state in the "state" tab on the right. | |
// For simplicity, the `PROPOSE_NEW_OUTCOME` | |
// event uses nextOutcome() to assign the | |
// proposed outcome. | |
// You can proposedOutcome in the | |
// customActions object with the following | |
// | |
// proposedOutcome: function(c, event) { | |
// return event.outcome; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const config = { | |
key: 'declarative-ledger-update', | |
initial: 'start', | |
states: { | |
start: { | |
entry: 'voteForGoal', | |
on: { | |
CHANNEL_UPDATED: [ | |
{ target: 'start', cond: 'shouldVote', actions: 'voteForGoal' }, | |
{ target: 'success', cond: 'consensusReached' }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const config = { | |
key: 'respond-to-challenge', | |
initial: 'start', | |
states: { | |
start: { | |
on: { | |
'': [ | |
{ | |
target: 'submitResponse', | |
cond: 'haveResponse', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const config = { | |
key: 'ledger-update', | |
initial: 'vote', | |
states: { | |
vote: { | |
on: { | |
'': [ | |
{ target: 'waiting', cond: 'turnNumberCorrect', actions: 'vote' }, | |
{ target: 'failure', cond: 'turnNumberIncorrect' } | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const minuteMachine = Machine({ | |
id: 'timer', | |
initial: 'active', | |
states: { | |
active: { | |
after: { | |
5000: 'finished' | |
} | |
}, | |
finished: { type: 'final', entry: sendParent('TIMES_UP') } |
OlderNewer