content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#
# PySNMP MIB module CISCO-DMN-DSG-FETHRESHOLDS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DMN-DSG-FETHRESHOLDS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:37:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_range_constraint, single_value_constraint, value_size_constraint) ... |
class TreeNode():
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def __repr__(self):
return '<TreeNode {}>'.format(self.val)
def flatten(root):
n = root
while True:
if n.left is not None:
last_leaf = find_last_leaf(n.left)
... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def __repr__(self):
return '<TreeNode {}>'.format(self.val)
def flatten(root):
n = root
while True:
if n.left is not None:
last_leaf = find_last_leaf(n.left)
... |
# Chunk
class Chunk():
count = 0
constants_count = 0
code = []
lines = []
columns = []
constants = []
local_variables = []
# Write to chunk
def chunk_write(chunk, byte, line, column):
chunk.code.append(byte)
chunk.lines.append(line)
... | class Chunk:
count = 0
constants_count = 0
code = []
lines = []
columns = []
constants = []
local_variables = []
def chunk_write(chunk, byte, line, column):
chunk.code.append(byte)
chunk.lines.append(line)
chunk.columns.append(column)
chunk.count += 1
def add_constant(chunk... |
# The actual working code is tpc.py :)
def arrange_data(s, key):
data = []
n = len(s)
rows = n//key + 1
cols = key
for i in range(rows + 1):
row_val = []
row_val = [c for j, c in enumerate(s) if ((j < i*key) and (j >= (i-1)*key))]
for k, l in enumerate(row_val):
if l == " ":
row_val[k] = "$"
if ro... | def arrange_data(s, key):
data = []
n = len(s)
rows = n // key + 1
cols = key
for i in range(rows + 1):
row_val = []
row_val = [c for (j, c) in enumerate(s) if j < i * key and j >= (i - 1) * key]
for (k, l) in enumerate(row_val):
if l == ' ':
row_v... |
class ExitState:
def __init__(self, target, distribution):
# Number of cases that will take this path
self.distribution = distribution
# normalized probability of taking this path
self.probability = 0
self.target = target
def pass_downstream(self, value):
portion = value * self.probability
self.targe... | class Exitstate:
def __init__(self, target, distribution):
self.distribution = distribution
self.probability = 0
self.target = target
def pass_downstream(self, value):
portion = value * self.probability
self.target.store_pending(portion)
return portion
class Su... |
class ServiceTask(object):
def __init__(self, command):
self.command = command
pass
pass
| class Servicetask(object):
def __init__(self, command):
self.command = command
pass
pass |
def outer_function():
global a
a = 20
def inner_function():
global a
a = 30
print('a =', a)
inner_function()
print('a =', a)
a = 10
outer_function()
print('a =', a)
| def outer_function():
global a
a = 20
def inner_function():
global a
a = 30
print('a =', a)
inner_function()
print('a =', a)
a = 10
outer_function()
print('a =', a) |
#
# PySNMP MIB module AT-TTY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AT-TTY-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:30:43 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, single_value_constraint, constraints_intersection, constraints_union) ... |
def selection_sort(lista):
for count in range(len(lista)):
index = count
for count2 in range(count+1, len(lista)):
if lista[count2] < lista[index]:
index = count2
if index != count:
aux = lista[index]
lista[index] = lista[count]
... | def selection_sort(lista):
for count in range(len(lista)):
index = count
for count2 in range(count + 1, len(lista)):
if lista[count2] < lista[index]:
index = count2
if index != count:
aux = lista[index]
lista[index] = lista[count]
... |
# Define the Add function
def add(*args):
for val in args:
print(val)
add(10, 239, 12, 242, 2465426) | def add(*args):
for val in args:
print(val)
add(10, 239, 12, 242, 2465426) |
def get_new_problems_payloads(problems_from_api, problems_from_file):
# global_new_problems_by_severity = get_severity_dict_template()
local_problem_ids = []
for problem in problems_from_file:
local_problem_ids.append(problem['displayId'])
global_new_problem_count = 0
m... | def get_new_problems_payloads(problems_from_api, problems_from_file):
local_problem_ids = []
for problem in problems_from_file:
local_problem_ids.append(problem['displayId'])
global_new_problem_count = 0
mz_problem_count_dict = {}
new_problem_payloads = []
for problem in problems_from_ap... |
def list_animals(animals):
my_list = ''
k=1
for i in animals:
my_list += f"{k}. {i}\n"
k+=1
return my_list
| def list_animals(animals):
my_list = ''
k = 1
for i in animals:
my_list += f'{k}. {i}\n'
k += 1
return my_list |
component_random_radio = dict(
Instruments=[dict(
Instrument=dict(
RadioButtonGroup=dict(
AlignForStimuli='0',
HeaderLabel='Do you have '
'any hearing '
'disorders',
RandomizeOrder=True,
... | component_random_radio = dict(Instruments=[dict(Instrument=dict(RadioButtonGroup=dict(AlignForStimuli='0', HeaderLabel='Do you have any hearing disorders', RandomizeOrder=True, Items=dict(Item=[dict(Id='1', Label='Yes', Selected='0'), dict(Id='2', Label='No', Selected='0'), dict(Id='3', Label='Dont know', Selected='0')... |
class Node(object):
def __init__(self, char):
self.char = char
self.children = {}
class WordDictionary(object):
def __init__(self):
self.root = Node('')
self.endSign = ';'
def addWord(self, word):
word = word + self.endSign
node = self.root
... | class Node(object):
def __init__(self, char):
self.char = char
self.children = {}
class Worddictionary(object):
def __init__(self):
self.root = node('')
self.endSign = ';'
def add_word(self, word):
word = word + self.endSign
node = self.root
for c ... |
# divide function
def partition(arr,low,high):
i = ( low-1 )
pivot = arr[high] # pivot element
for j in range(low , high):
# If current element is smaller
if arr[j] <= pivot:
# increment
i = i+1
arr[i],arr[j] = arr[j],arr[i]
arr[i+1],arr[high] = arr[high],arr[i+1]
r... | def partition(arr, low, high):
i = low - 1
pivot = arr[high]
for j in range(low, high):
if arr[j] <= pivot:
i = i + 1
(arr[i], arr[j]) = (arr[j], arr[i])
(arr[i + 1], arr[high]) = (arr[high], arr[i + 1])
return i + 1
def quick_sort(arr, low, high):
if low < high:... |
# coding=utf-8
# restore builtins
def restore_builtins(module, base):
module.__builtins__ = [x for x in base.__class__.__base__.__subclasses__() if x.__name__ == 'catch_warnings'][0]()._module.__builtins__
| def restore_builtins(module, base):
module.__builtins__ = [x for x in base.__class__.__base__.__subclasses__() if x.__name__ == 'catch_warnings'][0]()._module.__builtins__ |
jwt_token = ""
userId = ""
profile_url = ""
user_agent = ""
visit_url = ""
trace_id = ""
game1 = {
"url":"",
"data":""
}
game2 = {
"url":"",
"data":""
}
game3 = {
"url":"",
"data":""
}
game4 = {
"url":"",
"data":""
}
game5 = {
"url":"",
"data":""
}
game6 = {
"url":"",
"data":""
}
ga... | jwt_token = ''
user_id = ''
profile_url = ''
user_agent = ''
visit_url = ''
trace_id = ''
game1 = {'url': '', 'data': ''}
game2 = {'url': '', 'data': ''}
game3 = {'url': '', 'data': ''}
game4 = {'url': '', 'data': ''}
game5 = {'url': '', 'data': ''}
game6 = {'url': '', 'data': ''}
game7 = {'url': '', 'data': ''}
game8 ... |
var1 = 'x'
var2 = 'y'
print(f'interpolate {var1} strings {var2!r} {var2!s} py36')
print(f'{abc}0')
print(f'{abc}{abc!s}')
| var1 = 'x'
var2 = 'y'
print(f'interpolate {var1} strings {var2!r} {var2!s} py36')
print(f'{abc}0')
print(f'{abc}{abc!s}') |
def saddle_points(matrix):
points = []
cached_column_mins = {}
row_len = len(matrix[0]) if matrix else 0
for i, row in enumerate(matrix):
if len(row) != row_len:
raise ValueError("Invalid matrix")
_max = max(row)
max_in_row = [
_i for _i in range(row.index... | def saddle_points(matrix):
points = []
cached_column_mins = {}
row_len = len(matrix[0]) if matrix else 0
for (i, row) in enumerate(matrix):
if len(row) != row_len:
raise value_error('Invalid matrix')
_max = max(row)
max_in_row = [_i for _i in range(row.index(_max), ro... |
_base_ = "./ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10_ape.py"
OUTPUT_DIR = "output/self6dpp/ssLM/ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10/can"
DATASETS = dict(
TRAIN=("lm_real_can_train",), TRAIN2=("lm_pbr_can_train",), TRAIN2_RATIO=0.0, TEST=("lm_real_can_test",)
)
MODEL = dict(
WEIGHTS="output/gdrn/l... | _base_ = './ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10_ape.py'
output_dir = 'output/self6dpp/ssLM/ss_v1_dibr_mlBCE_FreezeBN_woCenter_refinePM10/can'
datasets = dict(TRAIN=('lm_real_can_train',), TRAIN2=('lm_pbr_can_train',), TRAIN2_RATIO=0.0, TEST=('lm_real_can_test',))
model = dict(WEIGHTS='output/gdrn/lm_pbr/resne... |
#! /usr/bin/env python
######################################################
# Define Exception Classes
######################################################
class CustomError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)... | class Customerror(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class Criterror(CustomError):
pass
class Syntaxerror(CustomError):
pass
class Logicerror(CustomError):
pass |
#!/usr/bin/python3.5
print("Carpool Vote ETL Utility - Drivers")
# Pseudocode:
# See if the driver is already registered.
# if so, associate the new opportunity for the driver to drive, with the existing driver.
# if not, add the driver to the list.
# Initiate the validation of the user's email (or phone, via... | print('Carpool Vote ETL Utility - Drivers') |
# Help Informations
#
# The Hascal Programming Language
# Copyright 2019-2022 Hascal Development Team,
# all rights reserved.
HASCAL_COMPILER_VERSION = "1.3.2"
HASCAL_GITHUB_REPO = "https://github.com/hascal/hascal"
| hascal_compiler_version = '1.3.2'
hascal_github_repo = 'https://github.com/hascal/hascal' |
def compare_length(strA, strB):
'''Compare the length of 2 strings and return a float'''
return float(len(strA) / len(strB))
def compare_contents(strA, strB):
'''Compare the commonality of the characters in the 2 strings'''
print(sorted(strA.lower()))
print(sorted(strB.lower()))
rel_length... | def compare_length(strA, strB):
"""Compare the length of 2 strings and return a float"""
return float(len(strA) / len(strB))
def compare_contents(strA, strB):
"""Compare the commonality of the characters in the 2 strings"""
print(sorted(strA.lower()))
print(sorted(strB.lower()))
rel_length = co... |
# -*- coding: utf-8 -*-
################################################################################
# | #
# | ______________________________________________________________ #
# | :~8a.`~888a:::::::::::::::88......88:::::::::... | def lang(i, lang):
if lang == 'bg':
i = i.replace('Action', u'Екшън')
i = i.replace('Adventure', u'Приключение')
i = i.replace('Animation', u'Анимация')
i = i.replace('Anime', u'Anime')
i = i.replace('Biography', u'Biography')
i = i.replace('Comedy', u'Комедия')
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def GET(**params):
return repr(params) | def get(**params):
return repr(params) |
# Definition for binary tree with next pointer.
# class TreeLinkNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# self.next = None
class Solution:
# @param root, a tree link node
# @return nothing
def connect(self, root):
if... | class Solution:
def connect(self, root):
if root and root.left:
root.left.next = root.right
if root.next:
root.right.next = root.next.left
self.connect(root.left)
self.connect(root.right) |
class Character:
def __init__(self,nome,idade,jedi,vivo): # Cria um personagem
self.nome = nome
self.idade = idade
self.e_jedi = jedi
self.vivo = vivo
def isJedi(self):
return self.e_jedi
def isAlive(self):
return self... | class Character:
def __init__(self, nome, idade, jedi, vivo):
self.nome = nome
self.idade = idade
self.e_jedi = jedi
self.vivo = vivo
def is_jedi(self):
return self.e_jedi
def is_alive(self):
return self.vivo
def char__kill(self):
self.vivo = F... |
def init_cells_arr(height, width):
cells_arr = [[[0, 'white'] for _ in range(width)] for _ in range(height)]
return cells_arr
def init_walls_arr(height, width):
walls_arr = [[[0, 0] for _ in range(width)] for _ in range(height)]
for i in range(width):
walls_arr[-1][i][1] = 1
for i in range... | def init_cells_arr(height, width):
cells_arr = [[[0, 'white'] for _ in range(width)] for _ in range(height)]
return cells_arr
def init_walls_arr(height, width):
walls_arr = [[[0, 0] for _ in range(width)] for _ in range(height)]
for i in range(width):
walls_arr[-1][i][1] = 1
for i in range(... |
__author__ = 'shukkkur'
'''
https://codeforces.com/problemset/problem/791/A
A. Bear and Big Brother
'''
Limak, Bob = map(int, input().split())
years = 0
if Limak == Bob:
years += 1
print(years)
else:
while Limak <= Bob:
Limak *= 3
Bob *= 2
ye... | __author__ = 'shukkkur'
'\nhttps://codeforces.com/problemset/problem/791/A\nA. Bear and Big Brother\n'
(limak, bob) = map(int, input().split())
years = 0
if Limak == Bob:
years += 1
print(years)
else:
while Limak <= Bob:
limak *= 3
bob *= 2
years += 1
print(years) |
def shortest_paths(source, weight_by_edge):
weight_by_node = {
v: float('inf') for u, v in weight_by_edge
}
weight_by_node[source] = 0
for i in range(len(weight_by_node) - 1):
for (u, v), weight in weight_by_edge.items():
weight_by_node[v] = min(
weight_by_n... | def shortest_paths(source, weight_by_edge):
weight_by_node = {v: float('inf') for (u, v) in weight_by_edge}
weight_by_node[source] = 0
for i in range(len(weight_by_node) - 1):
for ((u, v), weight) in weight_by_edge.items():
weight_by_node[v] = min(weight_by_node[u] + weight, weight_by_no... |
fir = int(input())
sec = int(input())
def additionakasum(fir,sec):
return fir + sec
print(additionakasum(fir,sec)) | fir = int(input())
sec = int(input())
def additionakasum(fir, sec):
return fir + sec
print(additionakasum(fir, sec)) |
# Comment it before submitting
# class Node:
# def __init__(self, value, next_item=None):
# self.value = value
# self.next_item = next_item
def solution(node):
while node:
print(node.value)
node = node.next_item
return None
# def test():
# node3 = Node("node3", None)
# ... | def solution(node):
while node:
print(node.value)
node = node.next_item
return None |
#
# PySNMP MIB module ISNS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ISNS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:46:27 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, value_size_constraint, single_value_constraint, constraints_intersection) ... |
class Word:
def __init__(self, text):
fields = text.split("\t")
self.ID = int(fields[0])
self.FORM = fields[1]
self.LEMMA = fields[2]
self.UPOSTAG = fields[3]
self.XPOSTAG = fields[4]
self.HEAD = fields[5]
self.DEPREL = fields[6]
self.DEPS = f... | class Word:
def __init__(self, text):
fields = text.split('\t')
self.ID = int(fields[0])
self.FORM = fields[1]
self.LEMMA = fields[2]
self.UPOSTAG = fields[3]
self.XPOSTAG = fields[4]
self.HEAD = fields[5]
self.DEPREL = fields[6]
self.DEPS = f... |
{
"targets": [
{
"target_name": "boost-range",
"type": "none",
"include_dirs": [
"1.62.0/clone/include"
],
"all_dependent_settings": {
"include_dirs": [
"1.62.0/clone/include"
]
... | {'targets': [{'target_name': 'boost-range', 'type': 'none', 'include_dirs': ['1.62.0/clone/include'], 'all_dependent_settings': {'include_dirs': ['1.62.0/clone/include']}, 'dependencies': ['../boost-config/boost-config.gyp:*', '../boost-assert/boost-assert.gyp:*', '../boost-regex/boost-regex.gyp:*', '../boost-conversio... |
N, M = map(int, input().split())
p = 998244353
always = 2 ** N # In case of adding 1 or M for every time
| (n, m) = map(int, input().split())
p = 998244353
always = 2 ** N |
#!/usr/bin/env python3
# A complete build that you could race with
class Build:
def __init__(self, driver, vehicle, tires, glider):
self.driver = driver
sefl.vehicle = vehicle
self.tires = tires
self.glider = glider
# A part of a build
class Component:
def __init__(self, name, ... | class Build:
def __init__(self, driver, vehicle, tires, glider):
self.driver = driver
sefl.vehicle = vehicle
self.tires = tires
self.glider = glider
class Component:
def __init__(self, name, stats):
self.name = name
self.stats = stats
def get_stat(self, st... |
def is_in_middle(sequence: str) -> bool:
SEQ="abc"
if len(sequence) < len(SEQ):
return False
start,d = divmod(len(sequence)-len(SEQ), 2)
return sequence[start:start+len(SEQ)] == SEQ or sequence[start+d:start+d+len(SEQ)] == SEQ
| def is_in_middle(sequence: str) -> bool:
seq = 'abc'
if len(sequence) < len(SEQ):
return False
(start, d) = divmod(len(sequence) - len(SEQ), 2)
return sequence[start:start + len(SEQ)] == SEQ or sequence[start + d:start + d + len(SEQ)] == SEQ |
#!/usr/bin/env python
#####################################
# Installation module for Wifite
#####################################
# AUTHOR OF MODULE NAME
AUTHOR="Frank Trezza (thatrez)"
# DESCRIPTION OF THE MODUL
DESCRIPTION="This module will install/update fluxion - a fake access point designed to trick users into ... | author = 'Frank Trezza (thatrez)'
description = 'This module will install/update fluxion - a fake access point designed to trick users into divulgining wifi passwords'
install_type = 'GIT'
repository_location = 'https://github.com/deltaxflux/fluxion'
install_location = 'fluxion'
debian = 'bully'
fedora = 'git'
after_co... |
PLAYERS = [yozhiks[0], yozhiks[1]]
BALL = yozhiks[2]
PLAYER_BOT = bots[1]
BALL_BOT = bots[2]
NET = points[0]
WAYPOINT = points[1]
PLAYER_SPAWNS = [1, 4]
BALL_SPAWNS = [2, 3]
PUNCH_VELOCITY_X = 10
PUNCH_VELOCITY_Y = -15
if timers[0].value == 1:
player_touches = [0, 0]
system.bots = 2
PLAYERS[0].spawn(P... | players = [yozhiks[0], yozhiks[1]]
ball = yozhiks[2]
player_bot = bots[1]
ball_bot = bots[2]
net = points[0]
waypoint = points[1]
player_spawns = [1, 4]
ball_spawns = [2, 3]
punch_velocity_x = 10
punch_velocity_y = -15
if timers[0].value == 1:
player_touches = [0, 0]
system.bots = 2
PLAYERS[0].spawn(PLAYER_... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def traverse(self, pNode, qNode):
if not pNode and not qNode:
return True
if not... | class Solution:
def traverse(self, pNode, qNode):
if not pNode and (not qNode):
return True
if not pNode and qNode or (pNode and (not qNode)) or pNode.val != qNode.val:
return False
return self.traverse(pNode.left, qNode.left) and self.traverse(pNode.right, qNode.rig... |
# model settings
norm_cfg = dict(type='SyncBN', eps=1e-03, requires_grad=True)
model = dict(
type='EncoderDecoder',
backbone=dict(
type='CGNet',
norm_cfg=norm_cfg,
in_channels=3,
num_channels=(32, 64, 128),
num_blocks=(3, 21),
dilations=(2, 4),
... | norm_cfg = dict(type='SyncBN', eps=0.001, requires_grad=True)
model = dict(type='EncoderDecoder', backbone=dict(type='CGNet', norm_cfg=norm_cfg, in_channels=3, num_channels=(32, 64, 128), num_blocks=(3, 21), dilations=(2, 4), reductions=(8, 16)), decode_head=dict(type='FCNHead', in_channels=256, in_index=2, channels=25... |
class Log:
RED = '\033[91m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
END = '\033[0m'
@classmethod
def error(cls, message, **kwargs):
print(cls.RED + message + cls.END, **kwargs)
@classmethod
def success(cls, message, **kwargs):
print(cls.GREEN + message + cls.END, **kwa... | class Log:
red = '\x1b[91m'
green = '\x1b[92m'
yellow = '\x1b[93m'
end = '\x1b[0m'
@classmethod
def error(cls, message, **kwargs):
print(cls.RED + message + cls.END, **kwargs)
@classmethod
def success(cls, message, **kwargs):
print(cls.GREEN + message + cls.END, **kwarg... |
# @Author: Edmund Lam <edl>
# @Date: 17:59:50, 05-Nov-2018
# @Filename: objutils.py
# @Last modified by: edl
# @Last modified time: 17:59:56, 05-Nov-2018
def integer(s):
try:
int(s)
return True
except ValueError:
return False
| def integer(s):
try:
int(s)
return True
except ValueError:
return False |
# Find this puzzle at:
# https://adventofcode.com/2020/day/13
with open('input.txt', 'r') as file:
puzzle_input = file.read().splitlines()
arrival = int(puzzle_input[0])
buses = puzzle_input[1].split(',')
close_bus_time = float("inf")
for bus in buses:
if bus != 'x':
bus = int(bus)
# If the bus... | with open('input.txt', 'r') as file:
puzzle_input = file.read().splitlines()
arrival = int(puzzle_input[0])
buses = puzzle_input[1].split(',')
close_bus_time = float('inf')
for bus in buses:
if bus != 'x':
bus = int(bus)
if arrival % bus == 0:
print(0)
break
else:... |
print('aa')
print("123")
print('cc' )
print('ss')
print('cc')
print("456")
print("789")
print('bb')
| print('aa')
print('123')
print('cc')
print('ss')
print('cc')
print('456')
print('789')
print('bb') |
def ficha (a='<desconhecido>',b=0):
print(f'O jogador {a} fez {b} gol(s).')
n = input('Nome do Jogador: ')
g = input('Quantidade de Gols: ')
if g.isnumeric():
int(g)
else:
g = 0
if n.strip() == '':
ficha(a='<desconhecido>')
else:
ficha(n, g)
| def ficha(a='<desconhecido>', b=0):
print(f'O jogador {a} fez {b} gol(s).')
n = input('Nome do Jogador: ')
g = input('Quantidade de Gols: ')
if g.isnumeric():
int(g)
else:
g = 0
if n.strip() == '':
ficha(a='<desconhecido>')
else:
ficha(n, g) |
class Node:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def __contains__(self, target):
if self.left and target < self.value :
return self.left.__contains__(target)
elif self.right and target > self.value:
return self.right.__contains__(target)
else:
print("... | class Node:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def __contains__(self, target):
if self.left and target < self.value:
return self.left.__contains__(target)
elif self.right and target > self.value:
retu... |
N,FIND,UP,DOWN,LEFT,RIGHT=int(input()),int(input()),11,22,33,44
L=[[0]*N for _ in range(N)]
L[N//2][N//2],dir,length,prev_i,prev_j,next,cnt=1,UP,1,N//2,N//2,2,0
while 1:
if next>N*N: break
if dir==UP:
for j in range(1,length+1):
if next>N*N: break
L[prev_i-j][prev_j]=next
next+=1
prev_i=p... | (n, find, up, down, left, right) = (int(input()), int(input()), 11, 22, 33, 44)
l = [[0] * N for _ in range(N)]
(L[N // 2][N // 2], dir, length, prev_i, prev_j, next, cnt) = (1, UP, 1, N // 2, N // 2, 2, 0)
while 1:
if next > N * N:
break
if dir == UP:
for j in range(1, length + 1):
... |
expected_output = {
"vrf": {
"VRF1": {
"interfaces": {
"Loopback300": {
"group": {
"224.0.0.2": {
"host_mode": "exclude",
"last_reporter": "10.16.2.2",
... | expected_output = {'vrf': {'VRF1': {'interfaces': {'Loopback300': {'group': {'224.0.0.2': {'host_mode': 'exclude', 'last_reporter': '10.16.2.2', 'router_mode': 'EXCLUDE', 'router_mode_expires': 'never', 'suppress': 0, 'up_time': '02:43:30'}, '224.0.0.9': {'host_mode': 'exclude', 'last_reporter': '10.16.2.2', 'router_mo... |
def bool_from_str(text: str) -> bool:
if text.lower() == 'true':
return True
if text.lower() == 'false':
return False | def bool_from_str(text: str) -> bool:
if text.lower() == 'true':
return True
if text.lower() == 'false':
return False |
# regularize the image
def regularizeImage(img, size = (9, 8)):
return img.resize(size).convert('L')
# calculate the hash value
def getHashCode(img, size = (9, 8)):
result = []
for i in range(size[0] - 1):
for j in range(size[1]):
current_val = img.getpixel((i, j))
next_val... | def regularize_image(img, size=(9, 8)):
return img.resize(size).convert('L')
def get_hash_code(img, size=(9, 8)):
result = []
for i in range(size[0] - 1):
for j in range(size[1]):
current_val = img.getpixel((i, j))
next_val = img.getpixel((i + 1, j))
if current_v... |
#
# File: pscExceptions.py
# @author: BSC
# Description:
# Custom execption class to manage error in the PSC
#
class pscExceptions():
class pscWrongProfileType(Exception):
pass
class TVDnotInstantiated(Exception):
pass
class PSAconfNotFound(Exception):
pass
| class Pscexceptions:
class Pscwrongprofiletype(Exception):
pass
class Tvdnotinstantiated(Exception):
pass
class Psaconfnotfound(Exception):
pass |
def refine_INSTALLED_APPS(original):
return ['cssbasics'] + list(original)
| def refine_installed_apps(original):
return ['cssbasics'] + list(original) |
# @Date: 2019-09-08T22:38:57+08:00
# @Email: 1730416009@stu.suda.edu.cn
# @Filename: apply_template.py
# @Last modified time: 2019-09-08T22:49:47+08:00
template_path = r'C:\Users\Nature\Desktop\LiGroup\Work\SIFTS_Plus_Muta_Maps\md\script\pdb_table_template.html'
out_path = r'C:\Users\Nature\Desktop\LiGroup\Work\SIF... | template_path = 'C:\\Users\\Nature\\Desktop\\LiGroup\\Work\\SIFTS_Plus_Muta_Maps\\md\\script\\pdb_table_template.html'
out_path = 'C:\\Users\\Nature\\Desktop\\LiGroup\\Work\\SIFTS_Plus_Muta_Maps\\md\\script\\output_0908.html'
pdb_list = ['2zqt', '6iwg', '1hho', '2ake', '2xyn', '3a6p', '1dfv', '3hl2']
with open(template... |
# twitter authentication keys
consumer_key = ""
consumer_secret = ""
key = ""
secret = ""
# ---------------------------
# google custom search api
google_api = ""
cx = ""
# ---------------------------
| consumer_key = ''
consumer_secret = ''
key = ''
secret = ''
google_api = ''
cx = '' |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# yocto-css, an extremely bare minimum CSS parser
#
# Copyright 2009 Jeff Schiller
#
# This file is part of Scour, http://www.codedread.com/scour/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance wi... | def parse_css_string(str):
rules = []
chunks = str.split('}')
for chunk in chunks:
bits = chunk.split('{')
if len(bits) != 2:
continue
rule = {}
rule['selector'] = bits[0].strip()
bites = bits[1].strip().split(';')
if len(bites) < 1:
co... |
def find_last(x,ln):
index=False
for i in range(len(ln)):
if ln[i]==x:
index=i
return index
| def find_last(x, ln):
index = False
for i in range(len(ln)):
if ln[i] == x:
index = i
return index |
'''
Write a function named printTable() that takes a list of lists of strings and
displays it in a well-organized table with each column right-justified. Assume
that all the inner lists will contain the same number of strings. For example,
the value could look like this:
===============================================... | """
Write a function named printTable() that takes a list of lists of strings and
displays it in a well-organized table with each column right-justified. Assume
that all the inner lists will contain the same number of strings. For example,
the value could look like this:
===============================================... |
# -*- coding: utf-8 -*-
__version__ = "0.4.0-dev1"
__author__ = "Mike Perry"
__license__ = "MIT/Expat"
__url__ = "https://github.com/mikeperry-tor/vanguards"
| __version__ = '0.4.0-dev1'
__author__ = 'Mike Perry'
__license__ = 'MIT/Expat'
__url__ = 'https://github.com/mikeperry-tor/vanguards' |
#!/usr/bin/env python3
with open("input") as infile:
instructions = [line.strip() for line in infile]
# 0 = north
# 1 = east
# 2 = south
# 3 = west
location_x = 0
location_y = 0
# Action N means to move the waypoint north by the given value.
# Action S means to move the waypoint south by the given value.
# Act... | with open('input') as infile:
instructions = [line.strip() for line in infile]
location_x = 0
location_y = 0
waypoint_x = 10
waypoint_y = 1
for instruction in instructions:
inst = instruction[0]
val = int(instruction[1:])
if inst == 'N':
waypoint_y += val
elif inst == 'S':
waypoint_y... |
# coding=utf-8
class NewdexAPIException(Exception):
'''Exception class to handle general API Exceptions'''
def __init__(self, response):
self.code = ''
self.message = 'Unknown Error'
try:
json_res = response
except ValueError:
print("Can't parse error res... | class Newdexapiexception(Exception):
"""Exception class to handle general API Exceptions"""
def __init__(self, response):
self.code = ''
self.message = 'Unknown Error'
try:
json_res = response
except ValueError:
print("Can't parse error response: {}".form... |
if __name__ == "__main__":
e, s, m = map(int, input().split())
e -= 1
s -= 1
m -= 1
year = 0
while True:
if year % 15 == e and year % 28 == s and year % 19 == m:
print(year+1)
break
year += 1
| if __name__ == '__main__':
(e, s, m) = map(int, input().split())
e -= 1
s -= 1
m -= 1
year = 0
while True:
if year % 15 == e and year % 28 == s and (year % 19 == m):
print(year + 1)
break
year += 1 |
class Solution:
def getPermutation(self, n: int, k: int) -> str:
result = ''
k = k - 1
fact = math.factorial(n - 1)
permutation = [i for i in range(1, n + 1)]
for i in reversed(range(n)):
index = floor(k / fact)
current = permutation[index]
... | class Solution:
def get_permutation(self, n: int, k: int) -> str:
result = ''
k = k - 1
fact = math.factorial(n - 1)
permutation = [i for i in range(1, n + 1)]
for i in reversed(range(n)):
index = floor(k / fact)
current = permutation[index]
... |
def boolean_or(value):
if value: # Complete the if clause on this line
return "Try Again"
else:
return "Pass"
print(boolean_or(75)) # Change this value to test
| def boolean_or(value):
if value:
return 'Try Again'
else:
return 'Pass'
print(boolean_or(75)) |
# lambda3.py to get product of corresponding item in the two lists
mylist1 = [1, 2, 3, 4, 5]
mylist2 = [6, 7, 8, 9]
new_list = list(map(lambda x,y: x*y, mylist1, mylist2))
print(new_list)
| mylist1 = [1, 2, 3, 4, 5]
mylist2 = [6, 7, 8, 9]
new_list = list(map(lambda x, y: x * y, mylist1, mylist2))
print(new_list) |
n, m = input().split(' ')
v = [0]*10
l = []
def dfs():
if len(l) == int(m):
for i in l:
print(i, end=' ')
print()
return;
for i in range(1, int(n)+1):
if not v[i]:
v[i] = 1
if len(l) == 0:
l.append(i)
dfs()
... | (n, m) = input().split(' ')
v = [0] * 10
l = []
def dfs():
if len(l) == int(m):
for i in l:
print(i, end=' ')
print()
return
for i in range(1, int(n) + 1):
if not v[i]:
v[i] = 1
if len(l) == 0:
l.append(i)
dfs()... |
class Solution:
def halvesAreAlike(self, s: str) -> bool:
a,b = s[:len(s)//2], s[len(s)//2:]
a = [c.lower() for c in a]
b = [c.lower() for c in b]
return a.count('a')+a.count('e')+a.count('i')+a.count('o')+a.count('u')==b.count('a')+b.count('e')+b.count('i')+b.count('o')+b.c... | class Solution:
def halves_are_alike(self, s: str) -> bool:
(a, b) = (s[:len(s) // 2], s[len(s) // 2:])
a = [c.lower() for c in a]
b = [c.lower() for c in b]
return a.count('a') + a.count('e') + a.count('i') + a.count('o') + a.count('u') == b.count('a') + b.count('e') + b.count('i')... |
def test_http_1_0_ping_response(client) -> None:
response = client.get('/ping', environ_overrides={'SERVER_PROTOCOL': 'HTTP/1.0'})
assert response.status_code == 200
assert response.content_type == 'text/plain; charset=utf-8'
assert response.data == b'pong'
assert response.headers['Cache-Control'... | def test_http_1_0_ping_response(client) -> None:
response = client.get('/ping', environ_overrides={'SERVER_PROTOCOL': 'HTTP/1.0'})
assert response.status_code == 200
assert response.content_type == 'text/plain; charset=utf-8'
assert response.data == b'pong'
assert response.headers['Cache-Control'] =... |
DEPS = [
'recipe_engine/path',
'recipe_engine/raw_io',
'recipe_engine/step',
]
| deps = ['recipe_engine/path', 'recipe_engine/raw_io', 'recipe_engine/step'] |
# __ ____ __
# _________ _/ /_____ ____ / / /_/ /__
# / ___/ __ `/ //_/ _ \______/ __ \/ / __/ //_/
# / / / /_/ / ,< / __/_____/ / / / / /_/ ,<
# /_/ \__,_/_/|_|\___/ /_/ /_/_/\__/_/|_|
__title__ = "rake-nltk"
__description__ = "Python implementation of the Rapi... | __title__ = 'rake-nltk'
__description__ = 'Python implementation of the Rapid Automatic Keyword Extraction algorithm using NLTK'
__url__ = 'https://github.com/csurfer/rake-nltk'
__version__ = '1.0.4'
__author__ = 'Vishwas B Sharma'
__author_email__ = 'sharma.vishwas88@gmail.com'
__license__ = 'MIT'
__copyright__ = 'Cop... |
if True:
a = 1
b = 2
def f():
if True:
a = 1
b = 2
| if True:
a = 1
b = 2
def f():
if True:
a = 1
b = 2 |
class Human():
def __init__(self):
self.name = input("Enter the name of the player \n")
def get_rownum(self):
return int(input(self.name + " enter a row number \n"))
def get_matches(self):
return int(input(self.name + " enter number of matches you want to remove from a row \n"))
... | class Human:
def __init__(self):
self.name = input('Enter the name of the player \n')
def get_rownum(self):
return int(input(self.name + ' enter a row number \n'))
def get_matches(self):
return int(input(self.name + ' enter number of matches you want to remove from a row \n'))
... |
#redis key dictionary
lid_closed = "lid_closed"
lid_blowlevel = "lid_blowlevel"
lid_open = "lid_open"
blowforce = "blowforce"
blowtime = "blowtime"
lid_setuplevel = "lid_setuplevel"
lid_fill = "lid_fill"
liquid_level = "liquid_level"
liquid_level_warn = "liquid_level_warn"
shutdown = "shutdown" | lid_closed = 'lid_closed'
lid_blowlevel = 'lid_blowlevel'
lid_open = 'lid_open'
blowforce = 'blowforce'
blowtime = 'blowtime'
lid_setuplevel = 'lid_setuplevel'
lid_fill = 'lid_fill'
liquid_level = 'liquid_level'
liquid_level_warn = 'liquid_level_warn'
shutdown = 'shutdown' |
p4 = bfrt.main.pipe
# # This function can clear all the tables and later on other fixed objects
# # once bfrt support is added.
def clear_all(p4):
# The order is important. We do want to clear from the top, i.e.
# delete objects that use other objects, e.g. table entries use
# selector groups and selector ... | p4 = bfrt.main.pipe
def clear_all(p4):
for table in p4.info(return_info=True, print_info=False):
if table['type'] in ['MATCH_DIRECT', 'MATCH_INDIRECT_SELECTOR']:
print('Clearing table {}'.format(table['full_name']))
if table['usage'] > 0:
for entry in table['node'].g... |
## S3 settings
S3_MOOC_FOLDER = 'sct03'
S3_BUCKET = "mooc-test"
S3_VIDEOS_FOLDER = "videos"
S3_ANSWERS_FOLDER = 'mob_answers'
S3_EXAMPLES_FOLDER = 'mob_examples'
S3_LINKS_URL = 'https://mooc-test.s3-ap-southeast-1.amazonaws.com/' # must end in '/'
# edx settings
EDX_EXTERNAL_GRADER_QUEUENAME = 'spatial_computational... | s3_mooc_folder = 'sct03'
s3_bucket = 'mooc-test'
s3_videos_folder = 'videos'
s3_answers_folder = 'mob_answers'
s3_examples_folder = 'mob_examples'
s3_links_url = 'https://mooc-test.s3-ap-southeast-1.amazonaws.com/'
edx_external_grader_queuename = 'spatial_computational_thinking'
edx_asset_file_extensions = ['jpg', 'jpe... |
name = "Alice"
coordinates = (10.0, 20.0)
#List of individiual people name
names = ["Alice", "Bob", "Charlie"]
| name = 'Alice'
coordinates = (10.0, 20.0)
names = ['Alice', 'Bob', 'Charlie'] |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... | power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres... |
def setup():
size(500,500)
smooth()
background(255)
strokeWeight(30)
noLoop()
def draw():
stroke(20,100)
i = 1;
while i < 8:
stroke(20*i)
line(i*50, 200, 150 + (i-1)*50, 300)
line(i*50+100, 200, 50 + (i-1)*50, 300)
i = i+1
| def setup():
size(500, 500)
smooth()
background(255)
stroke_weight(30)
no_loop()
def draw():
stroke(20, 100)
i = 1
while i < 8:
stroke(20 * i)
line(i * 50, 200, 150 + (i - 1) * 50, 300)
line(i * 50 + 100, 200, 50 + (i - 1) * 50, 300)
i = i + 1 |
#!/usr/bin/python3
# author: Karel Fiala
# email: fiala.karel@gmail.com
# version 0.1.0
# DNS
self.host["main.haut.local"] = "192.168.1.74"
self.host["dev.haut.local"] = "192.168.1.71"
self.host["webserver.haut.local"] = "127.0.0.1"
self.host["bedroom1.haut.local"] = "192.168.1.80"
| self.host['main.haut.local'] = '192.168.1.74'
self.host['dev.haut.local'] = '192.168.1.71'
self.host['webserver.haut.local'] = '127.0.0.1'
self.host['bedroom1.haut.local'] = '192.168.1.80' |
# initialize a set with the following syntax
myset = {"item 1", "item 2", "any type besides list and dict", 5, 8, 3}
# or
myothset = set() # creates an empty set
notaset = {} # doesn't create a set; creates a dict; remember that
# sets don't always print the same way
# try it
print(myset)
print(myset)
print(myset)
#... | myset = {'item 1', 'item 2', 'any type besides list and dict', 5, 8, 3}
myothset = set()
notaset = {}
print(myset)
print(myset)
print(myset)
anotherset = {'this', 'might', 'not', 'be', 'in', 'order'}
for i in anotherset:
print(i)
oursuperset = {1, 3, 5, 7, 9}
oursubset = {1, 5, 3}
print(oursuperset.issuperset(oursu... |
class Node:
def __init__(self, data):
self.data = data
self.left_child = None
self.right_child = None
self.height = 0
class AVL:
def __init__(self):
self.root = None
def traverse(self):
if self.root:
self.traverse_in_order(self.root)
def tr... | class Node:
def __init__(self, data):
self.data = data
self.left_child = None
self.right_child = None
self.height = 0
class Avl:
def __init__(self):
self.root = None
def traverse(self):
if self.root:
self.traverse_in_order(self.root)
def t... |
# ******************
# * i686 Toolchain *
# ******************
def generate(env):
env.Replace(
ARCH='i686',
CXX='i686-elf-g++',
CC='i686-elf-gcc',
AR='i686-elf-ar',
LD='i686-elf-g++',
RANLIB='i686-elf-gcc-ranlib',
)
env.Append(
ASFLAGS=[
'... | def generate(env):
env.Replace(ARCH='i686', CXX='i686-elf-g++', CC='i686-elf-gcc', AR='i686-elf-ar', LD='i686-elf-g++', RANLIB='i686-elf-gcc-ranlib')
env.Append(ASFLAGS=['-felf32'], CCFLAGS=['-mno-avx', '-mno-sse'])
def exists(env):
return 1 |
def gcd(a, b):
while a != 0:
a, b = b % a, a
return b
print(gcd(42, 28))
print(gcd(28, 42))
print(gcd(345, 766))
| def gcd(a, b):
while a != 0:
(a, b) = (b % a, a)
return b
print(gcd(42, 28))
print(gcd(28, 42))
print(gcd(345, 766)) |
def sumofDigits(n):
sum = 0
for digit in str(n):
sum += int(digit)
print(sum)
n =input()
sumofDigits(n)
| def sumof_digits(n):
sum = 0
for digit in str(n):
sum += int(digit)
print(sum)
n = input()
sumof_digits(n) |
#!/usr/bin/env python
# encoding: utf-8
class Solution:
def threeSumClosest(self, nums, target):
n = len(nums)
nums.sort()
best_sum = -1
best_delta = float("+inf")
for i in range(n-2):
j, k = i+1, n-1
while j < k:
cur_sum = nums[i] +... | class Solution:
def three_sum_closest(self, nums, target):
n = len(nums)
nums.sort()
best_sum = -1
best_delta = float('+inf')
for i in range(n - 2):
(j, k) = (i + 1, n - 1)
while j < k:
cur_sum = nums[i] + nums[j] + nums[k]
... |
class Solution:
def canPermutePalindrome(self, s: str) -> bool:
# build a hash map
helper = {}
counter_odd = 0
# traverse the string
for l in s:
if l in helper:
helper[l] += 1
if helper[l]%2==0:
counter_odd -= 1
... | class Solution:
def can_permute_palindrome(self, s: str) -> bool:
helper = {}
counter_odd = 0
for l in s:
if l in helper:
helper[l] += 1
if helper[l] % 2 == 0:
counter_odd -= 1
else:
counter_... |
class Complex():
def __init__(self, x, y):
self.real = x
self.img = y
def __repr__(self):
return str(float(self.real)) + ' + ' + str(float(self.img)) + 'j'
def __add__(self, other):
result = Complex(0, 0)
result.real = self.real + other.real
result.img = self.img + other.img
return result
def __m... | class Complex:
def __init__(self, x, y):
self.real = x
self.img = y
def __repr__(self):
return str(float(self.real)) + ' + ' + str(float(self.img)) + 'j'
def __add__(self, other):
result = complex(0, 0)
result.real = self.real + other.real
result.img = self... |
#Exercise 7-5 Movie Tickets
print('\nEnter your age.')
print('For go out program, enter finish.')
age = ''
while age != 'finish':
age = input('Age: ')
if age != 'finish':
age_int = int(age)
if (age_int < 3) and (age_int >= 0):
print('\nYour ticket is free.\n')
elif (age_int >... | print('\nEnter your age.')
print('For go out program, enter finish.')
age = ''
while age != 'finish':
age = input('Age: ')
if age != 'finish':
age_int = int(age)
if age_int < 3 and age_int >= 0:
print('\nYour ticket is free.\n')
elif age_int >= 3 and age_int <= 12:
... |
__all__ = [
"DatabaseController"
]
| __all__ = ['DatabaseController'] |
def test():
arr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
i = 0
while i < 1e7:
ign = arr[7]
ign = arr[7]
ign = arr[7]
ign = arr[7]
ign = arr[7]
ign = arr[7]
ign = arr[7]
ign = arr[7]
ign = arr[7]
ign = arr[7]
i += 1
test()
| def test():
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
i = 0
while i < 10000000.0:
ign = arr[7]
ign = arr[7]
ign = arr[7]
ign = arr[7]
ign = arr[7]
ign = arr[7]
ign = arr[7]
ign = arr[7]
ign = arr[7]
ign = arr[7]
i += 1
test(... |
global mysql
def init_connection(new_mysql):
global mysql
mysql = new_mysql
################### Nasional ###################
def get_nasional():
today = get_today_nasional()
yesterday = get_yesterday_nasional()
# Memgambil index array agar saat pemanggilan variabel mudah, tidak today[0] dst
... | global mysql
def init_connection(new_mysql):
global mysql
mysql = new_mysql
def get_nasional():
today = get_today_nasional()
yesterday = get_yesterday_nasional()
if len(today) > 0:
positif = 1
sembuh = 2
meninggal = 3
perawatan = 4
datetime = 6
selis... |
# https://leetcode.com/problems/get-maximum-in-generated-array/
class Solution:
def getMaximumGenerated(self, n: int) -> int:
# nums[0] = 0
# nums[1] = 1
# nums[2 * i] = nums[i] when 2 <= 2 * i <= n
# nums[2 * i + 1] = nums[i] + nums[i + 1] when 2 <= 2 * i + 1 <= n
if n ==... | class Solution:
def get_maximum_generated(self, n: int) -> int:
if n == 0:
return 0
if n == 1:
return 1
nums = [0] * (n + 2)
nums[1] = 1
for i in range(2, n + 1):
if i % 2 == 0:
nums[i] = nums[i // 2]
else:
... |
# SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# This file is where you keep secret settings, passwords, and tokens!
# If you put them in the code you risk committing that info or sharing it
secrets = {
'ssid' : 'CHANGE ME',
'password' : 'CHANGE ME',
... | secrets = {'ssid': 'CHANGE ME', 'password': 'CHANGE ME', 'zip': 'CHANGE ME'} |
class Solution:
def reorderedPowerOf2(self, n: int) -> bool:
digit_dict = collections.Counter(str(n))
for i in xrange(30):
if digit_dict == collections.Counter(str(1<<i)):
return True
return False
| class Solution:
def reordered_power_of2(self, n: int) -> bool:
digit_dict = collections.Counter(str(n))
for i in xrange(30):
if digit_dict == collections.Counter(str(1 << i)):
return True
return False |
expected_output = {
"vrf": {
"default": {
"address_family": {
"ipv6": {
"rp": {
"bsr": {
"2001:3:3:3::3": {
"address": "2001:3:3:3::3",
"priorit... | expected_output = {'vrf': {'default': {'address_family': {'ipv6': {'rp': {'bsr': {'2001:3:3:3::3': {'address': '2001:3:3:3::3', 'priority': 5, 'mode': 'SM', 'holdtime': 150, 'interval': 60}, 'rp_candidate_next_advertisement': '00:00:48'}}}}}}} |
with open("input.txt") as f:
stream = f.read()
total = 0
deep = 0
garbage = False
i = 0
l = len(stream)
while i < l:
c = stream[i]
if c == "!":
i += 1
elif garbage == True:
if c == ">":
garbage = False
elif c == "{":
deep += 1
elif c == "}":
... | with open('input.txt') as f:
stream = f.read()
total = 0
deep = 0
garbage = False
i = 0
l = len(stream)
while i < l:
c = stream[i]
if c == '!':
i += 1
elif garbage == True:
if c == '>':
garbage = False
elif c == '{':
deep += 1
elif c == '}':
total += d... |
#
# PySNMP MIB module DNS-SERVER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DNS-SERVER-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:54:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, single_value_constraint, constraints_union, value_size_constraint) ... |
class Solution:
def combinationSum3(self, k: int, n: int) -> List[List[int]]:
def helper(l: int, k: int, n: int) -> List[List[int]]:
if k == 1: return [[n]] if l <= n <= 9 else []
result = []
for i in range(l, min(n, 9)):
for sub_result in helper(max(i, ... | class Solution:
def combination_sum3(self, k: int, n: int) -> List[List[int]]:
def helper(l: int, k: int, n: int) -> List[List[int]]:
if k == 1:
return [[n]] if l <= n <= 9 else []
result = []
for i in range(l, min(n, 9)):
for sub_result ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.