content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Solution:
def finalPrices(self, prices: List[int]) -> List[int]:
res = []
for i in range(len(prices)):
for j in range(i+1,len(prices)):
if prices[j]<=prices[i]:
res.append(prices[i]-prices[j])
break
if j==len(p... | class Solution:
def final_prices(self, prices: List[int]) -> List[int]:
res = []
for i in range(len(prices)):
for j in range(i + 1, len(prices)):
if prices[j] <= prices[i]:
res.append(prices[i] - prices[j])
break
if... |
N, M = map(int, input().split())
for i in range(1, M + 1):
if i % 2 == 1:
j = (i - 1) // 2
print(1 + j, M + 1 - j)
else:
j = (i - 2) // 2
print(M + 2 + j, 2 * M + 1 - j)
| (n, m) = map(int, input().split())
for i in range(1, M + 1):
if i % 2 == 1:
j = (i - 1) // 2
print(1 + j, M + 1 - j)
else:
j = (i - 2) // 2
print(M + 2 + j, 2 * M + 1 - j) |
summary = 0
i = 0
while i < 5:
summary = summary + i
print(summary)
i = i + 1
| summary = 0
i = 0
while i < 5:
summary = summary + i
print(summary)
i = i + 1 |
#
# PySNMP MIB module XXX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XXX-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:44:42 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:15)... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_union, value_range_constraint, value_size_constraint, constraints_intersection) ... |
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'conditions': [
['OS!="win"', {
'variables': {
'config_h_dir':
'.', # crafted for gcc/linux.
},
}, { # else, ... | {'conditions': [['OS!="win"', {'variables': {'config_h_dir': '.'}}, {'variables': {'config_h_dir': 'vsprojects'}, 'target_defaults': {'msvs_disabled_warnings': [4018, 4244, 4355], 'defines!': ['WIN32_LEAN_AND_MEAN']}}]], 'targets': [{'target_name': 'protobuf_lite', 'type': '<(library)', 'toolsets': ['host', 'target'], ... |
# def mul(a):
# return lambda b:b*a
# singler = mul(1) # addition = lambda b:b*1
# doubler = mul(2) # addition = lambda b:b*2
# tripler = mul(3) # addition = lambda b:b*3
# print(doubler(7)) # 7*2 = 14
# print(tripler(7)) # 7*3 = 21
# print(singler(7)) # 7*1 = 7
class Student:
def __init__(self, fna... | class Student:
def __init__(self, fname):
self.fname = fname
def greet(self, fname):
return f'Hello, {fname}'
class Batcha(Student):
def __init__(self, lname):
self.lname = lname
super().__init__('Nikunj')
def print_name(self):
return f'{self.fname} {self.lna... |
class MyError(Exception):
pass
class PropertyContainer(object):
def __init__(self):
self.props = {}
def set_property(self, prop, value):
self.props[prop] = value
def get_property(self, prop):
return self.props.get(prop)
def has_property(self, prop... | class Myerror(Exception):
pass
class Propertycontainer(object):
def __init__(self):
self.props = {}
def set_property(self, prop, value):
self.props[prop] = value
def get_property(self, prop):
return self.props.get(prop)
def has_property(self, prop):
return prop i... |
# code....
a = 1
b = 2
c = 3
s = a+b+c
r = s/3
print(r)
# code....
'''
def average():
a=1
b=2
c=3
s=a+b+c
r=s/3
print(r)
average()
'''
'''
#input
#parameter
#argument
def average(a,b,c):
s=a+b+c
r=s/3
print(r)
average(10,20,30)
'''
def average(a, b, c):
s = a+b+c
r = s/3
... | a = 1
b = 2
c = 3
s = a + b + c
r = s / 3
print(r)
'\ndef average():\n a=1\n b=2\n c=3\n s=a+b+c\n r=s/3\n print(r)\naverage()\n'
'\n#input\n#parameter\n#argument\ndef average(a,b,c):\n s=a+b+c\n r=s/3\n print(r)\naverage(10,20,30)\n'
def average(a, b, c):
s = a + b + c
r = s / 3
... |
'''
This is the Settings File for the Mattermost-Octane Bridge.
You can change various variables here to customize and set up the client.
'''
'''----------------------Mattermost Webhook Configuration----------------------'''
#URL of the webhook from mattermost. To create one go to `Main Menu -> Integrations -> Incom... | """
This is the Settings File for the Mattermost-Octane Bridge.
You can change various variables here to customize and set up the client.
"""
'----------------------Mattermost Webhook Configuration----------------------'
mm_webhook_url = 'http://localhost:8065/hooks/yuro8xrfeffj787cj1bwc4ziue'
mm_channel = None
mm_user... |
def hello_world(request):
request_json = request.get_json()
name = 'World'
if request_json and 'name' in request_json:
name = request_json['name']
headers = {
'Access-Control-Allow-Origin': 'https://furikuri.net',
'Access-Control-Allow-Methods': 'GET, POST',
'Access-Contr... | def hello_world(request):
request_json = request.get_json()
name = 'World'
if request_json and 'name' in request_json:
name = request_json['name']
headers = {'Access-Control-Allow-Origin': 'https://furikuri.net', 'Access-Control-Allow-Methods': 'GET, POST', 'Access-Control-Allow-Headers': 'Conte... |
#Copyright ReportLab Europe Ltd. 2000-2016
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/charts/__init__.py
__version__='3.3.0'
__doc__='''Business charts'''
| __version__ = '3.3.0'
__doc__ = 'Business charts' |
total_budget = 0
while True:
destination = input()
if destination == "End":
break
minimal_budget = float(input())
while True:
command = input()
if command == "End":
break
money = float(command)
total_budget += money
if total_budge... | total_budget = 0
while True:
destination = input()
if destination == 'End':
break
minimal_budget = float(input())
while True:
command = input()
if command == 'End':
break
money = float(command)
total_budget += money
if total_budget >= minimal_b... |
price = float(input())
puzzles = int(input())
dolls = int(input())
bears = int(input())
minions = int(input())
trucks = int(input())
total_toys = puzzles + dolls + bears + minions + trucks
price_puzzles = puzzles * 2.6
price_dolls = dolls * 3
price_bears = bears * 4.1
price_minions = minions * 8.2
pric... | price = float(input())
puzzles = int(input())
dolls = int(input())
bears = int(input())
minions = int(input())
trucks = int(input())
total_toys = puzzles + dolls + bears + minions + trucks
price_puzzles = puzzles * 2.6
price_dolls = dolls * 3
price_bears = bears * 4.1
price_minions = minions * 8.2
price_trucks = trucks... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of groupthink.
# https://github.com/emanuelfeld/groupthink
# This project is in the public domain within the United States.
# Additionally, the Government of the District of Columbia waives
# copyright and related rights in the work worldwide through t... | __version__ = '1.0.0' |
load("//python:compile.bzl", "py_proto_compile", "py_grpc_compile")
load("@grpc_py_deps//:requirements.bzl", "all_requirements")
def py_proto_library(**kwargs):
name = kwargs.get("name")
deps = kwargs.get("deps")
verbose = kwargs.get("verbose")
visibility = kwargs.get("visibility")
name_pb = name ... | load('//python:compile.bzl', 'py_proto_compile', 'py_grpc_compile')
load('@grpc_py_deps//:requirements.bzl', 'all_requirements')
def py_proto_library(**kwargs):
name = kwargs.get('name')
deps = kwargs.get('deps')
verbose = kwargs.get('verbose')
visibility = kwargs.get('visibility')
name_pb = name +... |
def indexof(listofnames, value):
if value in listofnames:
value_index = listofnames.index(value)
return(listofnames, value_index)
else: return(-1)
| def indexof(listofnames, value):
if value in listofnames:
value_index = listofnames.index(value)
return (listofnames, value_index)
else:
return -1 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 64,
"metadata": {},
"outputs": [],
"source": [
"# Import libraries\n",
"import os, csv"
]
},
{
"cell_type": "code",
"execution_count": 65,
"metadata": {},
"outputs": [],
"source": [
"#variables for the script\n",
... | {'cells': [{'cell_type': 'code', 'execution_count': 64, 'metadata': {}, 'outputs': [], 'source': ['# Import libraries\n', 'import os, csv']}, {'cell_type': 'code', 'execution_count': 65, 'metadata': {}, 'outputs': [], 'source': ['#variables for the script\n', 'months = [] #list of months\n', 'pl =[] ... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
__all__ = ["args", "colors", "libcolors", "routine"]
__version__ = "0.96"
| __all__ = ['args', 'colors', 'libcolors', 'routine']
__version__ = '0.96' |
def get_primes(n):
primes = [] # stores the prime numbers within the reange of the number
sieve = [False] * (n + 1) # stores boolean values indicating whether a number is prime or not
sieve[0] = sieve[1] = True # marking 0 and 1 as not prime
for i in range(2, n + 1): # loops over all the numbers to... | def get_primes(n):
primes = []
sieve = [False] * (n + 1)
sieve[0] = sieve[1] = True
for i in range(2, n + 1):
if sieve[i]:
continue
primes.append(i)
for j in range(i ** 2, n + 1, i):
sieve[j] = True
return primes
def get_factorization(n):
prime_fa... |
s = "([}}])"
stack = []
if len(s) % 2 == 1:
print(False)
exit()
for i in s:
if i == "(":
stack.append("(")
elif i == "[":
stack.append("[")
elif i == "{":
stack.append("{")
elif i == ")":
if len(stack) < 1:
print(False)
exit()
if... | s = '([}}])'
stack = []
if len(s) % 2 == 1:
print(False)
exit()
for i in s:
if i == '(':
stack.append('(')
elif i == '[':
stack.append('[')
elif i == '{':
stack.append('{')
elif i == ')':
if len(stack) < 1:
print(False)
exit()
if st... |
class Foo:
pass
class Bar(Foo):
def __init__(self):
super(Bar, self).__init__() # [super-with-arguments]
class Baz(Foo):
def __init__(self):
super().__init__()
class Qux(Foo):
def __init__(self):
super(Bar, self).__init__()
class NotSuperCall(Foo):
def __init__(self)... | class Foo:
pass
class Bar(Foo):
def __init__(self):
super(Bar, self).__init__()
class Baz(Foo):
def __init__(self):
super().__init__()
class Qux(Foo):
def __init__(self):
super(Bar, self).__init__()
class Notsupercall(Foo):
def __init__(self):
super.test(Bar, ... |
_base_ = [
'../retinanet_r50_fpn_1x_coco.py',
'../../_base_/datasets/hdr_detection_minmax_glob_gamma.py',
]
# optimizer
# lr is set for a batch size of 8
optimizer = dict(type='SGD', lr=0.0005, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None) # dict(grad_clip=dict(max_norm=35, norm_t... | _base_ = ['../retinanet_r50_fpn_1x_coco.py', '../../_base_/datasets/hdr_detection_minmax_glob_gamma.py']
optimizer = dict(type='SGD', lr=0.0005, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
lr_config = dict(policy='step', warmup='linear', warmup_iters=500, warmup_ratio=0.001, step=[10])
ru... |
# solution 1:
class Solution1:
def convert(self, s: str, numRows: int) -> str:
if numRows == 1 or numRows >= len(s):
return s
L = [''] * numRows
index, step = 0, 1
for x in s:
L[index] += x
if index == 0:
step = 1
... | class Solution1:
def convert(self, s: str, numRows: int) -> str:
if numRows == 1 or numRows >= len(s):
return s
l = [''] * numRows
(index, step) = (0, 1)
for x in s:
L[index] += x
if index == 0:
step = 1
elif index == n... |
MANIFEST = {
"hilt": {
"h1": {
"offsets": {"blade": 0, "button": {"x": (8, 9), "y": (110, 111)}},
"colours": {
"primary": (216, 216, 216), # d8d8d8
"secondary": (141, 141, 141), # 8d8d8d
"tertiary": (180, 97, 19), # b46113
... | manifest = {'hilt': {'h1': {'offsets': {'blade': 0, 'button': {'x': (8, 9), 'y': (110, 111)}}, 'colours': {'primary': (216, 216, 216), 'secondary': (141, 141, 141), 'tertiary': (180, 97, 19)}, 'length': 24, 'materials': 'Alloy metal/Salvaged materials'}, 'h2': {'offsets': {'blade': 20, 'button': {'x': (8, 8), 'y': (100... |
## @file
# Standardized Error Hanlding infrastructures.
#
# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text... | file_open_failure = 1
file_write_failure = 2
file_parse_failure = 3
file_read_failure = 4
file_create_failure = 5
file_checksum_failure = 6
file_compress_failure = 7
file_decompress_failure = 8
file_move_failure = 9
file_delete_failure = 10
file_copy_failure = 11
file_positioning_failure = 12
file_already_exist = 13
fi... |
ELECTRUM_VERSION = '4.1.5-radc' # version of the client package
APK_VERSION = '4.1.5.0' # read by buildozer.spec
PROTOCOL_VERSION = '1.4' # protocol version requested
# The hash of the mnemonic seed must begin with this
SEED_PREFIX = '01' # Standard wallet
SEED_PREFIX_SW = '100' # S... | electrum_version = '4.1.5-radc'
apk_version = '4.1.5.0'
protocol_version = '1.4'
seed_prefix = '01'
seed_prefix_sw = '100'
seed_prefix_2_fa = '101'
seed_prefix_2_fa_sw = '102'
def seed_prefix(seed_type):
if seed_type == 'standard':
return SEED_PREFIX
elif seed_type == 'segwit':
return SEED_PREF... |
class Node(object):
def __init__(self, name, follow_list, intention, lane):
self.name = name
self.follow_list = follow_list
self.intention = intention
self.lane = lane
def __eq__(self, other):
if isinstance(other, Node):
if self.name == other.get... | class Node(object):
def __init__(self, name, follow_list, intention, lane):
self.name = name
self.follow_list = follow_list
self.intention = intention
self.lane = lane
def __eq__(self, other):
if isinstance(other, Node):
if self.name == other.get_name() and ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Function to encrypt message using key is defined
def encrypt(msg, key):
# Defining empty strings and counters
hexadecimal = ''
iteration = 0
# Running for loop in the range of MSG and comparing the BITS
for i in range(len(msg)):
... | def encrypt(msg, key):
hexadecimal = ''
iteration = 0
for i in range(len(msg)):
temp = ord(msg[i]) ^ ord(key[iteration])
hexadecimal += hex(temp)[2:].zfill(2)
iteration += 1
if iteration >= len(key):
iteration = 0
return hexadecimal
def decrypt(msg, key):
... |
number_of_participants, number_of_pens, number_of_notebooks = map(int, input().split())
if number_of_pens >= number_of_participants and number_of_notebooks >= number_of_participants:
print('Yes')
else:
print('No')
| (number_of_participants, number_of_pens, number_of_notebooks) = map(int, input().split())
if number_of_pens >= number_of_participants and number_of_notebooks >= number_of_participants:
print('Yes')
else:
print('No') |
# coding: utf-8
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | mebibyte = 1024 * 1024
streaming_default_part_size = 10 * MEBIBYTE
default_part_size = 128 * MEBIBYTE
object_use_multipart_size = 128 * MEBIBYTE |
# Curbrock Summon 2
CURBROCK2 = 9400930 # MOD ID
CURBROCKS_ESCAPE_ROUTE_VER2 = 600050040 # MAP ID
CURBROCKS_ESCAPE_ROUTE_VER3 = 600050050 # MAP ID 2
sm.spawnMob(CURBROCK2, 190, -208, False)
sm.createClock(1800)
sm.addEvent(sm.invokeAfterDelay(1800000, "warp", CURBROCKS_ESCAPE_ROUTE_VER3, 0))
sm.waitForMobDeath(CURBRO... | curbrock2 = 9400930
curbrocks_escape_route_ver2 = 600050040
curbrocks_escape_route_ver3 = 600050050
sm.spawnMob(CURBROCK2, 190, -208, False)
sm.createClock(1800)
sm.addEvent(sm.invokeAfterDelay(1800000, 'warp', CURBROCKS_ESCAPE_ROUTE_VER3, 0))
sm.waitForMobDeath(CURBROCK2)
sm.warp(CURBROCKS_ESCAPE_ROUTE_VER2)
sm.stopEv... |
def getNumBags(color):
if color=='':
return 0
numBags=1
for bag in rules[color]:
numBags+=bag[1]*getNumBags(bag[0])
return numBags
with open('day7/input.txt') as f:
rules=dict([l.split(' contain') for l in f.read().replace(' bags', '').replace(' bag', '').replace('.', '').replace(' ... | def get_num_bags(color):
if color == '':
return 0
num_bags = 1
for bag in rules[color]:
num_bags += bag[1] * get_num_bags(bag[0])
return numBags
with open('day7/input.txt') as f:
rules = dict([l.split(' contain') for l in f.read().replace(' bags', '').replace(' bag', '').replace('.',... |
'''
Largest rectangle area in a histogram::
Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars.
For simplicity, assume that all bars have same width and the width is 1 unit.
'''
def max_area_histogram(histogram):
stack = list()... | """
Largest rectangle area in a histogram::
Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars.
For simplicity, assume that all bars have same width and the width is 1 unit.
"""
def max_area_histogram(histogram):
stack = list()
... |
def sort(arr):
# Start index 0.
start = 0
# End index
end = len(arr)-1
while start <= end:
# Swap all positive value with last index end & decrease end by 1.
if arr[start] >= 0:
arr[start], arr[end] = arr[end], arr[start]
end -= 1
else:
# ... | def sort(arr):
start = 0
end = len(arr) - 1
while start <= end:
if arr[start] >= 0:
(arr[start], arr[end]) = (arr[end], arr[start])
end -= 1
else:
start += 1
if __name__ == '__main__':
arr = [-1, 2, -3, 4, 5, 6, -7, 8, 9]
sort(arr)
print(arr) |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'includes': [
'../build/win_precompile.gypi',
'base.gypi',
],
'targets': [
{
'tar... | {'variables': {'chromium_code': 1}, 'includes': ['../build/win_precompile.gypi', 'base.gypi'], 'targets': [{'target_name': 'base', 'type': '<(component)', 'toolsets': ['host', 'target'], 'variables': {'base_target': 1, 'enable_wexit_time_destructors': 1, 'optimize': 'max'}, 'dependencies': ['base_static', 'allocator/al... |
k=0
while k!=1:
print(k)
k+=1
| k = 0
while k != 1:
print(k)
k += 1 |
class Some_enum(Enum):
some_literal = "some_literal"
class Something(Some_enum):
pass
class Reference:
pass
__book_url__ = "dummy"
__book_version__ = "dummy"
associate_ref_with(Reference)
| class Some_Enum(Enum):
some_literal = 'some_literal'
class Something(Some_enum):
pass
class Reference:
pass
__book_url__ = 'dummy'
__book_version__ = 'dummy'
associate_ref_with(Reference) |
def orangesRotting(elemnts):
if not elemnts or len(elemnts) == 0:
return 0
n = len(elemnts)
m = len(elemnts[0])
rotten = []
for i in range(n):
for j in range(m):
if elemnts[i][j] == 2:
rotten.append((i, j))
mins = 0
def dfs(rotten):
... | def oranges_rotting(elemnts):
if not elemnts or len(elemnts) == 0:
return 0
n = len(elemnts)
m = len(elemnts[0])
rotten = []
for i in range(n):
for j in range(m):
if elemnts[i][j] == 2:
rotten.append((i, j))
mins = 0
def dfs(rotten):
count... |
class TaskA:
def run(self):
V, A, B, C = map(int, input().split())
pass
class TaskB:
def run(self):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
counter = 0
for a in range(A+1):
for b in range(B+1):
... | class Taska:
def run(self):
(v, a, b, c) = map(int, input().split())
pass
class Taskb:
def run(self):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
counter = 0
for a in range(A + 1):
for b in range(B + 1):
... |
def banner_text(text):
screen_width = 80
if len(text) > screen_width - 4:
print("EEK!!")
print("THE TEXT IS TOO LONG TO FIT IN THE SPECIFIED WIDTH")
if text == "*":
print("*" * screen_width)
else:
centred_text = text.center(screen_width - 4)
output_string = "**{0... | def banner_text(text):
screen_width = 80
if len(text) > screen_width - 4:
print('EEK!!')
print('THE TEXT IS TOO LONG TO FIT IN THE SPECIFIED WIDTH')
if text == '*':
print('*' * screen_width)
else:
centred_text = text.center(screen_width - 4)
output_string = '**{0}... |
######################################################## FLASK SETTINGS ##############################################################
#Variable used to securly sign cookies
##THIS IS SET IN DEV ENVIRONMENT FOR CONVENIENCE BUT SHOULD BE SET AS AN ENVIRONMENT VARIABLE IN PROD
SECRET_KEY = "dev"
########################... | secret_key = 'dev'
database_uri = 'bolt://test:test@localhost:7687' |
def init():
global brightness
global calibration_mode
brightness = 500
calibration_mode = False
| def init():
global brightness
global calibration_mode
brightness = 500
calibration_mode = False |
class Node:
def __init__(self, data):
self.data = data
self.prev = None
self.next = None
class SingleLinkedList:
def __init__(self):
self.head = None
def add(self, ele):
new_node = Node(ele)
if self.head is None:
self.head = new_node
... | class Node:
def __init__(self, data):
self.data = data
self.prev = None
self.next = None
class Singlelinkedlist:
def __init__(self):
self.head = None
def add(self, ele):
new_node = node(ele)
if self.head is None:
self.head = new_node
... |
def solution(A):
total = sum(A)
m = float('inf')
left_sum = 0
for n in A[:-1]:
left_sum += n
v = abs(total - 2*left_sum)
if v < m:
m = v
return m
| def solution(A):
total = sum(A)
m = float('inf')
left_sum = 0
for n in A[:-1]:
left_sum += n
v = abs(total - 2 * left_sum)
if v < m:
m = v
return m |
def matrix_form():
r = int(input("Enter the no of rows"))
c = int(input("Enter the no of columns"))
matrix=[]
print("Enter the enteries")
for i in range(r):
a = []
for j in range(c):
a.append(int(input()))
matrix.append(a)
return(matrix)
def check_matrix(fi... | def matrix_form():
r = int(input('Enter the no of rows'))
c = int(input('Enter the no of columns'))
matrix = []
print('Enter the enteries')
for i in range(r):
a = []
for j in range(c):
a.append(int(input()))
matrix.append(a)
return matrix
def check_matrix(fir... |
# Assignment 1 Day 8
# write a decorator function for taking input for you
# any kind of function you want to build
def getInput(calculate_arg_fuc):
def wrap_function():
print("Enter two numbers ")
a=int(input("Enter first number = "))
b=int(input("Enter second number = "))
... | def get_input(calculate_arg_fuc):
def wrap_function():
print('Enter two numbers ')
a = int(input('Enter first number = '))
b = int(input('Enter second number = '))
calculate_arg_fuc(a, b)
return wrap_function
@getInput
def addition(num1, num2):
print('Addition = ', num1 + ... |
def unlock(m):
return m.lower().translate(
str.maketrans(
'abcdefghijklmnopqrstuvwxyz',
'22233344455566677778889999'
)
)
| def unlock(m):
return m.lower().translate(str.maketrans('abcdefghijklmnopqrstuvwxyz', '22233344455566677778889999')) |
nis=get('nis')
q1="xpto1"
q2=nis + "xpto2"
query=query1.q2
koneksi=0
q=execute(query,koneksi)
| nis = get('nis')
q1 = 'xpto1'
q2 = nis + 'xpto2'
query = query1.q2
koneksi = 0
q = execute(query, koneksi) |
def nearest_mid(input_list, lower_bound_index, upper_bound_index, search_value):
return lower_bound_index + (
(upper_bound_index - lower_bound_index)
// (input_list[upper_bound_index] - input_list[lower_bound_index])
) * (search_value - input_list[lower_bound_index])
def interpolation_search(o... | def nearest_mid(input_list, lower_bound_index, upper_bound_index, search_value):
return lower_bound_index + (upper_bound_index - lower_bound_index) // (input_list[upper_bound_index] - input_list[lower_bound_index]) * (search_value - input_list[lower_bound_index])
def interpolation_search(ordered_list, term):
s... |
def pickingNumbers(a):
# Write your code here
max = 0
for i in a:
c = a.count(i)
d = a.count(i-1)
e = c+d
if e>max:
max = e
return max
| def picking_numbers(a):
max = 0
for i in a:
c = a.count(i)
d = a.count(i - 1)
e = c + d
if e > max:
max = e
return max |
expected_output = {
"vrf": {
"VRF1": {
"address_family": {
"ipv6": {
"instance": {
"rip ripng": {
"redistribute": {
"static": {"route_policy": "static-to-rip"},
... | expected_output = {'vrf': {'VRF1': {'address_family': {'ipv6': {'instance': {'rip ripng': {'redistribute': {'static': {'route_policy': 'static-to-rip'}, 'connected': {}}, 'interfaces': {'GigabitEthernet3.200': {}, 'GigabitEthernet2.200': {}}}}}}}}} |
#!/usr/bin/env python
sw1_show_cdp_neighbors = '''
SW1>show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone
Device ID Local Intrfce Holdtme Capability Platform ... | sw1_show_cdp_neighbors = '\nSW1>show cdp neighbors\nCapability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge\n S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone\nDevice ID Local Intrfce Holdtme Capability Platform Port ID\nR1 ... |
EVENT_SCHEDULER_STARTED = EVENT_SCHEDULER_START = 2 ** 0
EVENT_SCHEDULER_SHUTDOWN = 2 ** 1
EVENT_SCHEDULER_PAUSED = 2 ** 2
EVENT_SCHEDULER_RESUMED = 2 ** 3
EVENT_EXECUTOR_ADDED = 2 ** 4
EVENT_EXECUTOR_REMOVED = 2 ** 5
EVENT_JOBSTORE_ADDED = 2 ** 6
EVENT_JOBSTORE_REMOVED = 2 ** 7
EVENT_ALL_JOBS_REMOVED = 2 ** 8
EVENT_JO... | event_scheduler_started = event_scheduler_start = 2 ** 0
event_scheduler_shutdown = 2 ** 1
event_scheduler_paused = 2 ** 2
event_scheduler_resumed = 2 ** 3
event_executor_added = 2 ** 4
event_executor_removed = 2 ** 5
event_jobstore_added = 2 ** 6
event_jobstore_removed = 2 ** 7
event_all_jobs_removed = 2 ** 8
event_jo... |
__author__ = 'Elias Haroun'
class BinaryNode(object):
def __init__(self, data, left, right):
self.data = data
self.left = left
self.right = right
def getData(self):
return self.data
def getLeft(self):
return self.left
def getRight(self):
return self.r... | __author__ = 'Elias Haroun'
class Binarynode(object):
def __init__(self, data, left, right):
self.data = data
self.left = left
self.right = right
def get_data(self):
return self.data
def get_left(self):
return self.left
def get_right(self):
return sel... |
# The isBadVersion API is already defined for you.
# @param version, an integer
# @return a bool
# def isBadVersion(version):
class Solution(object):
def firstBadVersion(self, n):
start = 1
end = n
while start + 1 < end:
mid = start + (end - start) / 2
if isBadVersi... | class Solution(object):
def first_bad_version(self, n):
start = 1
end = n
while start + 1 < end:
mid = start + (end - start) / 2
if is_bad_version(mid):
end = mid
else:
start = mid
if is_bad_version(start):
... |
#!/usr/bin/env python3
def binary(code, max, bits):
ret = []
for i in range(max):
ret.append(bits[code[i]])
return int(''.join(ret), base=2)
mid = 0
with open('input5.txt') as f:
for line in f.readlines():
line = line[:-1]
row = binary(line[:7], 7, {'F': '0', 'B': '1'})
... | def binary(code, max, bits):
ret = []
for i in range(max):
ret.append(bits[code[i]])
return int(''.join(ret), base=2)
mid = 0
with open('input5.txt') as f:
for line in f.readlines():
line = line[:-1]
row = binary(line[:7], 7, {'F': '0', 'B': '1'})
col = binary(line[7:], 3... |
def test_list_example_directory(client):
response = client.get("/api/files")
assert response.status_code == 200
file_list = response.get_json()
assert len(file_list) == 5
assert file_list[0]['key'] == 'image_annotated.jpg'
assert file_list[1]['key'] == 'image.jpg'
assert file_list[2]['key']... | def test_list_example_directory(client):
response = client.get('/api/files')
assert response.status_code == 200
file_list = response.get_json()
assert len(file_list) == 5
assert file_list[0]['key'] == 'image_annotated.jpg'
assert file_list[1]['key'] == 'image.jpg'
assert file_list[2]['key'] ... |
# This Part will gather Infos and demonstrate the use of Variables.
usrName = input("What is your Name?")
usrAge = int(input("What is your Age?"))
usrGPA = float(input("What is your GPA?"))
print () #cheap way to get a new line
print ("Hello, %s" % (usrName))
print ("Did you know that in two years you will be %d years ... | usr_name = input('What is your Name?')
usr_age = int(input('What is your Age?'))
usr_gpa = float(input('What is your GPA?'))
print()
print('Hello, %s' % usrName)
print('Did you know that in two years you will be %d years old? ' % (usrAge + 2))
print('Also you need to improve your GPA by %f points to have a perfect scor... |
class Message:
def __init__(self, from_channel=None, **kwargs):
self._channel = from_channel
if kwargs is not None:
for key, value in kwargs.items():
setattr(self, key, value)
@property
def carrier(self):
return self._channel
def sender(self):
... | class Message:
def __init__(self, from_channel=None, **kwargs):
self._channel = from_channel
if kwargs is not None:
for (key, value) in kwargs.items():
setattr(self, key, value)
@property
def carrier(self):
return self._channel
def sender(self):
... |
def main():
print("|\_/|")
print("|q p| /}")
print("( 0 )\"\"\"\\")
print("|\"^\"` |")
print("||_/=\\\\__|")
if __name__ == "__main__":
main()
| def main():
print('|\\_/|')
print('|q p| /}')
print('( 0 )"""\\')
print('|"^"` |')
print('||_/=\\\\__|')
if __name__ == '__main__':
main() |
# -*- coding: utf-8 -*-
n, w = map(int, input().split())
for _ in range(n):
entrada = input()
last_space = entrada.rfind(' ')
if int(entrada[last_space:]) > w:
print(entrada[:last_space])
| (n, w) = map(int, input().split())
for _ in range(n):
entrada = input()
last_space = entrada.rfind(' ')
if int(entrada[last_space:]) > w:
print(entrada[:last_space]) |
str1= input("enter a string :")
l1 =""
for i in str1 [::-1]:
l1 = i+l1
print(l1)
if str1 == l1:
print("string is a palindrome")
else :
print("string is not a palindrome")
| str1 = input('enter a string :')
l1 = ''
for i in str1[::-1]:
l1 = i + l1
print(l1)
if str1 == l1:
print('string is a palindrome')
else:
print('string is not a palindrome') |
# https://github.com/git/git/blob/master/Documentation/technical/index-format.txt
class GitIndexEntry(object):
# The last time a file's metadata changed. This is a tuple (seconds, nanoseconds)
ctime = None
# The last time a file's data changed. This is a tuple (seconds, nanoseconds)
mtime = None
#... | class Gitindexentry(object):
ctime = None
mtime = None
dev = None
ino = None
mode_type = None
mode_permissions = None
uui = None
gid = None
size = None
object = None
flag_assume_valid = None
flag_extended = None
flag_stage = None
flag_name_length = None
name =... |
__version__ = '7.8.0'
_optional_dependencies = [
{
'name': 'CuPy',
'packages': [
'cupy-cuda120',
'cupy-cuda114',
'cupy-cuda113',
'cupy-cuda112',
'cupy-cuda111',
'cupy-cuda110',
'cupy-cuda102',
'cupy-cud... | __version__ = '7.8.0'
_optional_dependencies = [{'name': 'CuPy', 'packages': ['cupy-cuda120', 'cupy-cuda114', 'cupy-cuda113', 'cupy-cuda112', 'cupy-cuda111', 'cupy-cuda110', 'cupy-cuda102', 'cupy-cuda101', 'cupy-cuda100', 'cupy-cuda92', 'cupy-cuda91', 'cupy-cuda90', 'cupy-cuda80', 'cupy'], 'specifier': '>=7.7.0,<8.0.0'... |
side_a=int(input("Enter the first side(a):"))
side_b=int(input("Enter the second side(b):"))
side_c=int(input("Enter the third side(c):"))
if side_a==side_b and side_a==side_c:
print("The triangle is an equilateral triangle.")
elif side_a==side_b or side_a==side_c or side_b==side_c:
print("The triangle is... | side_a = int(input('Enter the first side(a):'))
side_b = int(input('Enter the second side(b):'))
side_c = int(input('Enter the third side(c):'))
if side_a == side_b and side_a == side_c:
print('The triangle is an equilateral triangle.')
elif side_a == side_b or side_a == side_c or side_b == side_c:
print('The t... |
_base_ = [
'../_base_/models/cascade_rcnn_r50_fpn.py',
'./dataset_base.py',
'./scheduler_base.py',
'../_base_/default_runtime.py'
]
model = dict(
pretrained='open-mmlab://resnext101_32x4d',
backbone=dict(
type='DetectoRS_ResNeXt',
pretrained='open-mmlab://resnext101_32x4d',
... | _base_ = ['../_base_/models/cascade_rcnn_r50_fpn.py', './dataset_base.py', './scheduler_base.py', '../_base_/default_runtime.py']
model = dict(pretrained='open-mmlab://resnext101_32x4d', backbone=dict(type='DetectoRS_ResNeXt', pretrained='open-mmlab://resnext101_32x4d', depth=101, groups=32, base_width=4, conv_cfg=dict... |
def decodeLongLong(lst):
high = int(lst[0]) << 32
low = int(lst[1])
if low < 0:
low += 4294967296
if high < 0:
high += 4294967296
return high + low
def encodeLongLong(i):
high = int(i / 4294967296)
low = i - high
return high, low
def parseOk(str):
if str == 'ok':
return True
else:
return False
def ... | def decode_long_long(lst):
high = int(lst[0]) << 32
low = int(lst[1])
if low < 0:
low += 4294967296
if high < 0:
high += 4294967296
return high + low
def encode_long_long(i):
high = int(i / 4294967296)
low = i - high
return (high, low)
def parse_ok(str):
if str == '... |
#
# PySNMP MIB module ENTERASYS-NAC-APPLIANCE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-NAC-APPLIANCE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:04:09 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python versio... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_union, constraints_intersection, single_value_constraint) ... |
class Unsubclassable:
def __init_subclass__(cls, **kwargs):
raise TypeError('Unacceptable base type')
def prevent_subclassing():
raise TypeError('Unacceptable base type')
def final_class(cls):
setattr(cls, '__init_subclass__', prevent_subclassing)
return cls
class UnsubclassableType(type)... | class Unsubclassable:
def __init_subclass__(cls, **kwargs):
raise type_error('Unacceptable base type')
def prevent_subclassing():
raise type_error('Unacceptable base type')
def final_class(cls):
setattr(cls, '__init_subclass__', prevent_subclassing)
return cls
class Unsubclassabletype(type):... |
def solve():
# Read input
R, C, H, V = map(int, input().split())
choco = []
for _ in range(R):
choco.append([0] * C)
choco_row, choco_col = [0]*R, [0]*C
num_choco = 0
for i in range(R):
row = input()
for j in range(C):
if row[j] == '@':
cho... | def solve():
(r, c, h, v) = map(int, input().split())
choco = []
for _ in range(R):
choco.append([0] * C)
(choco_row, choco_col) = ([0] * R, [0] * C)
num_choco = 0
for i in range(R):
row = input()
for j in range(C):
if row[j] == '@':
choco_col[... |
#Definicion de la clase
#antes de empezar una clase se declara de la siguiente manera
class Lamp:
_LAMPS = ['''
.
. | ,
\ ' /
` ,-. '
--- ( ) ---
\ /
_|=|_
|_____|
''',
'''
,-.
( )
\ /
_|=|_
|___... | class Lamp:
_lamps = ["\n .\n . | ,\n \\ ' /\n ` ,-. '\n --- ( ) ---\n \\ /\n _|=|_\n |_____|\n ", '\n ,-.\n ( )\n \\ /\n _|=|_\n |_____|\n ']
def __init__(self, is_turned_on):
self._is_turned_on = i... |
votes_t_shape = [3, 0, 1, 2]
for i in range(6 - 4):
votes_t_shape += [i + 4]
print(votes_t_shape)
| votes_t_shape = [3, 0, 1, 2]
for i in range(6 - 4):
votes_t_shape += [i + 4]
print(votes_t_shape) |
#/ <reference path="./testBlocks/mb.ts" />
def function_0():
basic.showNumber(7)
basic.forever(function_0) | def function_0():
basic.showNumber(7)
basic.forever(function_0) |
#
# PySNMP MIB module HH3C-PPPOE-SERVER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-PPPOE-SERVER-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:16:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection, constraints_union) ... |
name = input("masukkan nama pembeli = ")
alamat= input("Alamat = ")
NoTelp = input("No Telp = ")
print("\n")
print("=================INFORMASI HARGA MOBIL DEALER JAYA ABADI===============")
print("Pilih Jenis Mobil :")
print("\t 1.Daihatsu ")
print("\t 2.Honda ")
print("\t 3.Toyota ")
print("")
pilihan = int(input("Pil... | name = input('masukkan nama pembeli = ')
alamat = input('Alamat = ')
no_telp = input('No Telp = ')
print('\n')
print('=================INFORMASI HARGA MOBIL DEALER JAYA ABADI===============')
print('Pilih Jenis Mobil :')
print('\t 1.Daihatsu ')
print('\t 2.Honda ')
print('\t 3.Toyota ')
print('')
pilihan = int(input('P... |
#!/bin/python3
with open('../camera/QCamera2/stack/common/cam_intf.h', 'r') as f:
data = f.read()
f.closed
start = data.find(' INCLUDE(CAM_INTF_META_HISTOGRAM')
end = data.find('} metadata_data_t;')
data = data[start:end]
metadata = data.split("\n")
metalist = list()
for line in metadata:
if (line.starts... | with open('../camera/QCamera2/stack/common/cam_intf.h', 'r') as f:
data = f.read()
f.closed
start = data.find(' INCLUDE(CAM_INTF_META_HISTOGRAM')
end = data.find('} metadata_data_t;')
data = data[start:end]
metadata = data.split('\n')
metalist = list()
for line in metadata:
if line.startswith(' INCLUDE'):... |
def g(A, n):
if A == -1:
return 0
return A // (2 * n) * n + max(A % (2 * n) - (n - 1), 0)
def f(A, B):
result = 0
for i in range(48):
t = 1 << i
if (g(B, t) - g(A - 1, t)) % 2 == 1:
result += t
return result
A, B = map(int, input().split())
print(f(A, B))
| def g(A, n):
if A == -1:
return 0
return A // (2 * n) * n + max(A % (2 * n) - (n - 1), 0)
def f(A, B):
result = 0
for i in range(48):
t = 1 << i
if (g(B, t) - g(A - 1, t)) % 2 == 1:
result += t
return result
(a, b) = map(int, input().split())
print(f(A, B)) |
# Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements.
def move_zeros(array):
#your code here
new_array = []
new_index = 0
while len(array) > 0:
item = array.pop(0)
if item == 0 and not type(item) == bool :
... | def move_zeros(array):
new_array = []
new_index = 0
while len(array) > 0:
item = array.pop(0)
if item == 0 and (not type(item) == bool):
new_array.append(item)
else:
new_array.insert(new_index, item)
new_index = new_index + 1
return new_array |
def construct_tag_data(tag_name, attrs=None, value=None, sorting=None):
data = {
'_name': tag_name,
'_attrs': attrs or [],
'_value': value,
}
if sorting:
data['_sorting'] = sorting
return data
def add_simple_child(data, child_friendly_name, child_tag_name, child_attr... | def construct_tag_data(tag_name, attrs=None, value=None, sorting=None):
data = {'_name': tag_name, '_attrs': attrs or [], '_value': value}
if sorting:
data['_sorting'] = sorting
return data
def add_simple_child(data, child_friendly_name, child_tag_name, child_attrs=None, child_value=None):
data... |
#
# PySNMP MIB module CISCO-DOT11-QOS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DOT11-QOS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:55:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, constraints_union, value_range_constraint, single_value_constraint) ... |
'''
Created on Jan 18, 2018
@author: riteshagarwal
'''
java = False
rest = False
cli = False | """
Created on Jan 18, 2018
@author: riteshagarwal
"""
java = False
rest = False
cli = False |
async def handler(context):
return await context.data
| async def handler(context):
return await context.data |
dataset_type = 'UNITER_VqaDataset'
data_root = '/home/datasets/mix_data/UNITER/VQA/'
train_datasets = ['train']
test_datasets = ['minival'] # name not in use, but have defined one to run
vqa_cfg = dict(
train_txt_dbs=[
data_root + 'vqa_train.db',
data_root + 'vqa_trainval.db',
data_root +... | dataset_type = 'UNITER_VqaDataset'
data_root = '/home/datasets/mix_data/UNITER/VQA/'
train_datasets = ['train']
test_datasets = ['minival']
vqa_cfg = dict(train_txt_dbs=[data_root + 'vqa_train.db', data_root + 'vqa_trainval.db', data_root + 'vqa_vg.db'], train_img_dbs=[data_root + 'coco_train2014/', data_root + 'coco_v... |
# Debug print levels for fine-grained debug trace output control
DNFQUEUE = (1 << 0) # netfilterqueue
DGENPKT = (1 << 1) # Generic packet handling
DGENPKTV = (1 << 2) # Generic packet handling with TCP analysis
DCB = (1 << 3) # Packet handlign callbacks
DPROCFS = (1 << 4) # procfs
DIPTBLS = (... | dnfqueue = 1 << 0
dgenpkt = 1 << 1
dgenpktv = 1 << 2
dcb = 1 << 3
dprocfs = 1 << 4
diptbls = 1 << 5
dnonloc = 1 << 6
ddpf = 1 << 7
ddpfv = 1 << 8
dipnat = 1 << 9
dmangle = 1 << 10
dpcap = 1 << 11
dign = 1 << 12
dftp = 1 << 13
dmisc = 1 << 27
dcomp = 268435455
dflag = 4026531840
devery = 268435455
devery2 = 2415919103
d... |
types_of_people = 10
x = f"There are {types_of_people} types of people."
binary = "binary"
do_not = "don't"
y = f"Those who know {binary} and those who {do_not}."
print(x)
print(y)
print(f"I said: {x}")
print(f"I also said: '{y}'")
hilarious = False
joke_evaluation = "Isn't that joke so funny?! {}"
print(joke_eval... | types_of_people = 10
x = f'There are {types_of_people} types of people.'
binary = 'binary'
do_not = "don't"
y = f'Those who know {binary} and those who {do_not}.'
print(x)
print(y)
print(f'I said: {x}')
print(f"I also said: '{y}'")
hilarious = False
joke_evaluation = "Isn't that joke so funny?! {}"
print(joke_evaluatio... |
def create_array(n):
res=[]
i=1
while i<=n:
res.append(i)
i += 1
return res
| def create_array(n):
res = []
i = 1
while i <= n:
res.append(i)
i += 1
return res |
class Popularity:
'''
Popularity( length=20 )
Used to iteratively calculate the average overall popularity of an algorithm's recommendations.
Parameters
-----------
length : int
Coverage@length
training_df : dataframe
determines how many distinct item_ids there are in the ... | class Popularity:
"""
Popularity( length=20 )
Used to iteratively calculate the average overall popularity of an algorithm's recommendations.
Parameters
-----------
length : int
Coverage@length
training_df : dataframe
determines how many distinct item_ids there are in the ... |
def create_auction(self):
expected_http_status = '201 Created'
request_data = {"data": self.auction}
entrypoint = '/auctions'
response = self.app.post_json(entrypoint, request_data)
self.assertEqual(response.status, expected_http_status)
def create_auction_check_minNumberOfQualifiedBids(self):
... | def create_auction(self):
expected_http_status = '201 Created'
request_data = {'data': self.auction}
entrypoint = '/auctions'
response = self.app.post_json(entrypoint, request_data)
self.assertEqual(response.status, expected_http_status)
def create_auction_check_min_number_of_qualified_bids(self):
... |
#===========================================================================
#
# Crystalfontz Raspberry-Pi Python example library for FTDI / BridgeTek
# EVE graphic accelerators.
#
#---------------------------------------------------------------------------
#
# This file is part of the port/adaptation of existin... | eve_device = 811
eve_clock_speed = 60000000
touch_resistive = False
touch_capacitive = False
touch_goodix_capacitive = False
lcd_swizzle = 2
lcd_pclkpol = 0
lcd_drive_10_ma = 0
lcd_pclk_cspread = 0
lcd_dither = 0
lcd_pclk = 5
hpx = 240
hsw = 10
hbp = 20
hfp = 10
hpp = 209
lcd_width = HPX
lcd_hsync0 = HFP
lcd_hsync1 = H... |
class Any2Int:
def __init__(self, min_count: int, include_UNK: bool, include_PAD: bool):
self.min_count = min_count
self.include_UNK = include_UNK
self.include_PAD = include_PAD
self.frozen = False
self.UNK_i = -1
self.UNK_s = "<UNK>"
self.PAD_i = -2
... | class Any2Int:
def __init__(self, min_count: int, include_UNK: bool, include_PAD: bool):
self.min_count = min_count
self.include_UNK = include_UNK
self.include_PAD = include_PAD
self.frozen = False
self.UNK_i = -1
self.UNK_s = '<UNK>'
self.PAD_i = -2
... |
# model settings
model = dict(
type='Semi_AppSup_TempSup_SimCLR_Crossclip_PTV_Recognizer3D',
backbone=dict(
type='ResNet3d',
depth=18,
pretrained=None,
pretrained2d=False,
norm_eval=False,
conv_cfg=dict(type='Conv3d'),
norm_cfg=dict(type='SyncBN', requires... | model = dict(type='Semi_AppSup_TempSup_SimCLR_Crossclip_PTV_Recognizer3D', backbone=dict(type='ResNet3d', depth=18, pretrained=None, pretrained2d=False, norm_eval=False, conv_cfg=dict(type='Conv3d'), norm_cfg=dict(type='SyncBN', requires_grad=True, eps=0.001), act_cfg=dict(type='ReLU'), conv1_kernel=(3, 7, 7), conv1_st... |
class SeqIter:
def __init__(self,l):
self.l = l
self.i = 0
self.stop = False
def __len__(self):
return len(self.l)
def __list__(self):
l = []
while True:
try:
l.append(self.__next__())
except StopIteration:
... | class Seqiter:
def __init__(self, l):
self.l = l
self.i = 0
self.stop = False
def __len__(self):
return len(self.l)
def __list__(self):
l = []
while True:
try:
l.append(self.__next__())
except StopIteration:
... |
def quicksort(xs):
if len(xs) == 0:
return []
pivot = xs[0]
xs = xs[1:]
left = [x for x in xs if x <= pivot]
right = [x for x in xs if x > pivot]
res = quicksort(left)
res.append(pivot)
res += quicksort(right)
return res
xs = [1, 3, 2, 4, 5, 2]
sorted_xs = quicksort(xs)
| def quicksort(xs):
if len(xs) == 0:
return []
pivot = xs[0]
xs = xs[1:]
left = [x for x in xs if x <= pivot]
right = [x for x in xs if x > pivot]
res = quicksort(left)
res.append(pivot)
res += quicksort(right)
return res
xs = [1, 3, 2, 4, 5, 2]
sorted_xs = quicksort(xs) |
#
# PySNMP MIB module CISCO-TRUSTSEC-POLICY-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-TRUSTSEC-POLICY-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:14:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, single_value_constraint, value_size_constraint, constraints_union) ... |
class Event:
def __init__(self):
self.handlers = set()
def subscribe(self, func):
self.handlers.add(func)
def unsubscribe(self, func):
self.handlers.remove(func)
def emit(self, *args):
for func in self.handlers:
func(*args)
| class Event:
def __init__(self):
self.handlers = set()
def subscribe(self, func):
self.handlers.add(func)
def unsubscribe(self, func):
self.handlers.remove(func)
def emit(self, *args):
for func in self.handlers:
func(*args) |
dataset_type = 'FlyingChairs'
data_root = 'data/FlyingChairs_release'
img_norm_cfg = dict(mean=[0., 0., 0.], std=[255., 255., 255.], to_rgb=False)
global_transform = dict(
translates=(0.05, 0.05),
zoom=(1.0, 1.5),
shear=(0.86, 1.16),
rotate=(-10., 10.))
relative_transform = dict(
translates=(0.00... | dataset_type = 'FlyingChairs'
data_root = 'data/FlyingChairs_release'
img_norm_cfg = dict(mean=[0.0, 0.0, 0.0], std=[255.0, 255.0, 255.0], to_rgb=False)
global_transform = dict(translates=(0.05, 0.05), zoom=(1.0, 1.5), shear=(0.86, 1.16), rotate=(-10.0, 10.0))
relative_transform = dict(translates=(0.00375, 0.00375), zo... |
tc = int(input())
while tc:
tc -= 1
best = 0
n, x = map(int, input().split())
for i in range(n):
s, r = map(int, input().split())
if x >= s:
best = max(best, r)
print(best) | tc = int(input())
while tc:
tc -= 1
best = 0
(n, x) = map(int, input().split())
for i in range(n):
(s, r) = map(int, input().split())
if x >= s:
best = max(best, r)
print(best) |
##
# This class encapsulates a Region Of Interest, which may be either horizontal
# (pixels) or vertical (rows/lines).
class ROI:
def __init__(self, start, end):
self.start = start
self.end = end
self.len = end - start + 1
def valid(self):
return self.start >= 0 and self.start ... | class Roi:
def __init__(self, start, end):
self.start = start
self.end = end
self.len = end - start + 1
def valid(self):
return self.start >= 0 and self.start < self.end
def crop(self, spectrum):
return spectrum[self.start:self.end + 1]
def contains(self, valu... |
__all__ = ['EnemyBucketWithStar',
'Nut',
'Beam',
'Enemy',
'Friend',
'Hero',
'Launcher',
'Rotor',
'SpikeyBuddy',
'Star',
'Wizard',
'EnemyEquipedRotor',
'CyclingEnemyObject',
'Joi... | __all__ = ['EnemyBucketWithStar', 'Nut', 'Beam', 'Enemy', 'Friend', 'Hero', 'Launcher', 'Rotor', 'SpikeyBuddy', 'Star', 'Wizard', 'EnemyEquipedRotor', 'CyclingEnemyObject', 'Joints', 'Bomb', 'Contacts'] |
days_of_week = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday', 'Sunday']
operation = ''
options = ['Info', 'Check-in/Out', 'Edit games', 'Back']
admins = ['admin1_telegram_nickname', 'admin2_telegram_nickname']
avail_days = []
TOKEN = 'bot_token'
group_id = id_of_group_chat | days_of_week = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
operation = ''
options = ['Info', 'Check-in/Out', 'Edit games', 'Back']
admins = ['admin1_telegram_nickname', 'admin2_telegram_nickname']
avail_days = []
token = 'bot_token'
group_id = id_of_group_chat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.