Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

import math
_ = input()
nums = list(map(int, input().strip().split(" ")))
print(2 ** int(math.log2(sum(nums))))
eth_gasPrice
> {
> "method": "eth_gasPrice",
> "params": [],
> "id": 42,
> "jsonrpc": "2.0"
> }
eth_getTransactionCount
> {
> "method": "eth_getTransactionCount",
pragma solidity ^0.5.11;
pragma experimental ABIEncoderV2;
contract ItemDefiner {
struct Item {
bool isGood;
}
}
contract ValidItemChecker {
interface ToggleMachineState {
states: {
inactive: {};
active: {};
};
}
type ToggleEvent = { type: 'TOGGLE' };
type ToggleMachineConfig = MachineConfig<
@andrewgordstewart
andrewgordstewart / SketchSystems.spec
Last active November 14, 2019 20:27
Different Outcome Proposed
Different Outcome Proposed
Voting
vote -> Consensus Reached?
reject -> Current Outcome
Consensus Reached?
yes -> Updating Outcome
no -> Voting
Equal Outcome Proposed
Current Outcome*
@andrewgordstewart
andrewgordstewart / machine.js
Last active November 14, 2019 21:22
Generated by XState Viz: https://xstate.js.org/viz
// 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;
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' },
const config = {
key: 'respond-to-challenge',
initial: 'start',
states: {
start: {
on: {
'': [
{
target: 'submitResponse',
cond: 'haveResponse',
@andrewgordstewart
andrewgordstewart / machine.js
Last active November 15, 2019 20:17
Generated by XState Viz: https://xstate.js.org/viz
const config = {
key: 'ledger-update',
initial: 'vote',
states: {
vote: {
on: {
'': [
{ target: 'waiting', cond: 'turnNumberCorrect', actions: 'vote' },
{ target: 'failure', cond: 'turnNumberIncorrect' }
]
const minuteMachine = Machine({
id: 'timer',
initial: 'active',
states: {
active: {
after: {
5000: 'finished'
}
},
finished: { type: 'final', entry: sendParent('TIMES_UP') }