content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
"""
One way of improving the memory efficiency of the NaiveStack would be to recognise that:
[]
[1]
[1,2]
[1,2,3]
Holds the same information as:
[1, 2, 3]
(on the assumption that there have been no pops)
So rather than creating a new version for every push and every pop, we could create a new version only on pops... | """
One way of improving the memory efficiency of the NaiveStack would be to recognise that:
[]
[1]
[1,2]
[1,2,3]
Holds the same information as:
[1, 2, 3]
(on the assumption that there have been no pops)
So rather than creating a new version for every push and every pop, we could create a new version only on pops... |
__all__ = ("Values", )
class Data(object):
def __init__(
self,
plugin_instance=None,
meta=None,
plugin=None,
host=None,
type=None,
type_instance=None,
interval=None,
time=None,
values=None,
... | __all__ = ('Values',)
class Data(object):
def __init__(self, plugin_instance=None, meta=None, plugin=None, host=None, type=None, type_instance=None, interval=None, time=None, values=None):
self.plugin = plugin
self.plugin_instance = (plugin_instance,)
self.meta = meta
self.host = h... |
age = 6
if age < 1:
print("baby")
elif age < 3:
print("toddler")
elif age < 5:
print("preschool")
elif age < 12:
print("gradeschooler")
elif age < 19:
print("teen")
elif age > 20:
print("old")
else:
print("integer error") | age = 6
if age < 1:
print('baby')
elif age < 3:
print('toddler')
elif age < 5:
print('preschool')
elif age < 12:
print('gradeschooler')
elif age < 19:
print('teen')
elif age > 20:
print('old')
else:
print('integer error') |
def main():
# input
H, W = map(int, input().split())
sss = [input() for _ in range(H)]
# compute
cnt = 0
for h in range(1,H-1):
for w in range(1,W-1):
if sss[h][w]=='#' and sss[h-1][w]!='#' and sss[h+1][w]!='#' and sss[h][w-1]!='#' and sss[h][w+1]!='#':
cnt +... | def main():
(h, w) = map(int, input().split())
sss = [input() for _ in range(H)]
cnt = 0
for h in range(1, H - 1):
for w in range(1, W - 1):
if sss[h][w] == '#' and sss[h - 1][w] != '#' and (sss[h + 1][w] != '#') and (sss[h][w - 1] != '#') and (sss[h][w + 1] != '#'):
... |
class Solution:
def getModifiedArray(self, length: int, updates: List[List[int]]) -> List[int]:
arr = [0] * (length + 1)
for s, e, i in updates:
arr[s] += i
arr[e+1] -= i
for i in range(1, length):
arr[i] += arr[i-1]
return arr[:-1]
| class Solution:
def get_modified_array(self, length: int, updates: List[List[int]]) -> List[int]:
arr = [0] * (length + 1)
for (s, e, i) in updates:
arr[s] += i
arr[e + 1] -= i
for i in range(1, length):
arr[i] += arr[i - 1]
return arr[:-1] |
nerdle_len = 8
nerd_num_list = [str(x) for x in range(nerdle_len+2)]
nerd_op_list = ['+','-','*','/','==']
nerd_list = nerd_num_list+nerd_op_list | nerdle_len = 8
nerd_num_list = [str(x) for x in range(nerdle_len + 2)]
nerd_op_list = ['+', '-', '*', '/', '==']
nerd_list = nerd_num_list + nerd_op_list |
def assert_raises(excClass, callableObj, *args, **kwargs):
"""
Like unittest.TestCase.assertRaises, but returns the exception.
"""
try:
callableObj(*args, **kwargs)
except excClass as e:
return e
else:
if hasattr(excClass,'__name__'): excName = excClass.__name__
e... | def assert_raises(excClass, callableObj, *args, **kwargs):
"""
Like unittest.TestCase.assertRaises, but returns the exception.
"""
try:
callable_obj(*args, **kwargs)
except excClass as e:
return e
else:
if hasattr(excClass, '__name__'):
exc_name = excClass.__n... |
'''
As is can shift max '1111' -> 15 on one command...
So a call like shift(20) would need to be split up...
Thinking the user should do this when coding... or
could be stdlib fx that does this...
If want to do shift(16) in one cycle, can add s4 support
(and correspoinding 16muxes) to hardware... revisit as ... | """
As is can shift max '1111' -> 15 on one command...
So a call like shift(20) would need to be split up...
Thinking the user should do this when coding... or
could be stdlib fx that does this...
If want to do shift(16) in one cycle, can add s4 support
(and correspoinding 16muxes) to hardware... revisit as ... |
# coding: utf-8
SECRET_KEY = 'foo'
EMAIL_BACKEND = 'postmarker.django.EmailBackend'
POSTMARK = {
'TOKEN': '<YOUR POSTMARK SERVER TOKEN>'
}
| secret_key = 'foo'
email_backend = 'postmarker.django.EmailBackend'
postmark = {'TOKEN': '<YOUR POSTMARK SERVER TOKEN>'} |
def is_prime(num, primes):
for prime in primes:
if prime == num:
return True
if not num % prime:
return False
return True
def get_primes(num):
limit = (num // 2) + 1
candidates = list()
primes = list()
for i in range(2, limit):
if is_prime(i, pr... | def is_prime(num, primes):
for prime in primes:
if prime == num:
return True
if not num % prime:
return False
return True
def get_primes(num):
limit = num // 2 + 1
candidates = list()
primes = list()
for i in range(2, limit):
if is_prime(i, primes... |
#program to remove two duplicate numbers from a given number of list.
def two_unique_nums(nums):
return [i for i in nums if nums.count(i)==1]
print(two_unique_nums([1,2,3,2,3,4,5]))
print(two_unique_nums([1,2,3,2,4,5]))
print(two_unique_nums([1,2,3,4,5])) | def two_unique_nums(nums):
return [i for i in nums if nums.count(i) == 1]
print(two_unique_nums([1, 2, 3, 2, 3, 4, 5]))
print(two_unique_nums([1, 2, 3, 2, 4, 5]))
print(two_unique_nums([1, 2, 3, 4, 5])) |
types = [
{
'name': 'RNAExpression',
'item_type': 'rna-expression',
'schema': {
'title': 'RNAExpression',
'description': 'Schema for RNA-seq expression',
'properties': {
'uuid': {
'title': 'UUID',
... | types = [{'name': 'RNAExpression', 'item_type': 'rna-expression', 'schema': {'title': 'RNAExpression', 'description': 'Schema for RNA-seq expression', 'properties': {'uuid': {'title': 'UUID'}, 'expression': {'type': 'object', 'properties': {'gene_id': {'title': 'Gene ID', 'type': 'string'}, 'transcript_ids': {'title': ... |
def square(x):
return x * x
def launch_missiles():
print('missiles launched')
def even_or_odd(n):
if n % 2 == 0:
print('even')
return
print('odd')
| def square(x):
return x * x
def launch_missiles():
print('missiles launched')
def even_or_odd(n):
if n % 2 == 0:
print('even')
return
print('odd') |
n = 1
for i in range(1, 10 + 1):
print(n)
n *= i
| n = 1
for i in range(1, 10 + 1):
print(n)
n *= i |
#!/usr/bin/env python
# coding: utf-8
# # Hill Cipher
# Below is the code to implement the Hill Cipher, which is an example of a **polyalphabetic cryptosystem**, that is, it does
# not assign a single ciphertext letter to a single plaintext letter, but rather a ciphertext letter may represent more than
# one plaint... | def digitize(string):
cipher_text = []
holder = []
for i in string:
if i == 'A' or i == 'a':
holder.append(0)
if i == 'B' or i == 'b':
holder.append(1)
if i == 'C' or i == 'c':
holder.append(2)
if i == 'D' or i == 'd':
holder.ap... |
file = open('Advent-of-Code-2021\\Day 13\\Day 13 input.txt')
points = []
folds = []
for line in file:
line = line.strip()
if (line.find(',') != -1):
pointparse = line.split(',')
points.append([int(pointparse[0]),int(pointparse[1])])
elif (line.find('=') != -1):
foldparse = line.sp... | file = open('Advent-of-Code-2021\\Day 13\\Day 13 input.txt')
points = []
folds = []
for line in file:
line = line.strip()
if line.find(',') != -1:
pointparse = line.split(',')
points.append([int(pointparse[0]), int(pointparse[1])])
elif line.find('=') != -1:
foldparse = line.split('=... |
dummy1_iface_cfg = {
'INTERFACE': {
'MODULE': 'daq.interface.interface',
'CLASS': 'DummyInterface',
},
'IFCONFIG': {
'LABEL': 'Dummy1',
'ADDRESS': 'DummyAddress',
'SerialNumber': '1234',
}
}
dummycpc_inst_cfg = {
'INSTRUMENT': {
'MODULE': 'daq.instrum... | dummy1_iface_cfg = {'INTERFACE': {'MODULE': 'daq.interface.interface', 'CLASS': 'DummyInterface'}, 'IFCONFIG': {'LABEL': 'Dummy1', 'ADDRESS': 'DummyAddress', 'SerialNumber': '1234'}}
dummycpc_inst_cfg = {'INSTRUMENT': {'MODULE': 'daq.instrument.instrument', 'CLASS': 'DummyInstrument'}, 'INSTCONFIG': {'DESCRIPTION': {'L... |
print(dir(str))
nome = 'Flavio'
print(nome)
print(nome[:3])
texto = 'marca d\' agua'
print(texto)
texto = "marca d' agua"
print(texto)
texto = ''' texto
... texto
'''
print(texto)
texto = ' texto\n\t ...texto'
print(texto)
print(str.__add__('a', 'b'))
nome = 'Flavio Garcia Fernandes'
print(nome)... | print(dir(str))
nome = 'Flavio'
print(nome)
print(nome[:3])
texto = "marca d' agua"
print(texto)
texto = "marca d' agua"
print(texto)
texto = ' texto\n ... texto\n'
print(texto)
texto = ' texto\n\t ...texto'
print(texto)
print(str.__add__('a', 'b'))
nome = 'Flavio Garcia Fernandes'
print(nome)
print(nome[-9:])
print(n... |
with open('in') as f:
data = list(map(lambda l: list(l.strip().replace(' ', '')), f.readlines()))
def evaluate(e):
value = None
operation = None
i = 0
while i < len(e):
c = e[i]
if c in '+*':
operation = c
elif c in '0123456789':
c = int(c)
... | with open('in') as f:
data = list(map(lambda l: list(l.strip().replace(' ', '')), f.readlines()))
def evaluate(e):
value = None
operation = None
i = 0
while i < len(e):
c = e[i]
if c in '+*':
operation = c
elif c in '0123456789':
c = int(c)
... |
# just keep this as-is
def not_an_activity():
print("boom")
| def not_an_activity():
print('boom') |
label_data = open("label", encoding='utf-8').readlines()
label_data = [x.strip() for x in label_data]
print(len(label_data))
label_kinds = set(label_data)
print(label_kinds) | label_data = open('label', encoding='utf-8').readlines()
label_data = [x.strip() for x in label_data]
print(len(label_data))
label_kinds = set(label_data)
print(label_kinds) |
class NotFoundError(Exception):
"""
Thrown during :meth:`get` when the requested object could not be found.
"""
pass
class ValidationError(Exception):
"""
Thrown by :class:`Field` subclasses when setting attributes that are
invalid.
"""
pass
| class Notfounderror(Exception):
"""
Thrown during :meth:`get` when the requested object could not be found.
"""
pass
class Validationerror(Exception):
"""
Thrown by :class:`Field` subclasses when setting attributes that are
invalid.
"""
pass |
def tupler(atuple):
print(f"{atuple=}")
return (1, 2, 3)
print(f"{type(tupler((10, 11)))=}")
| def tupler(atuple):
print(f'atuple={atuple!r}')
return (1, 2, 3)
print(f'type(tupler((10, 11)))={type(tupler((10, 11)))!r}') |
n1 = int (input())
s1 = set(map(int,input().split()))
n2 = int (input())
s2 = set(map(int,input().split()))
print(len(s1.intersection(s2)))
| n1 = int(input())
s1 = set(map(int, input().split()))
n2 = int(input())
s2 = set(map(int, input().split()))
print(len(s1.intersection(s2))) |
raio = int(input())
pi = 3.14159
volume = float(4.0 * pi * (raio* raio * raio) / 3)
print("VOLUME = %0.3f" %volume)
| raio = int(input())
pi = 3.14159
volume = float(4.0 * pi * (raio * raio * raio) / 3)
print('VOLUME = %0.3f' % volume) |
#!/usr/bin/env python
# encoding: utf-8
GRADES_FILENAME = 'grades.csv'
GRADING_SLASH_DELIMINATOR = '/'
SUBMISSIONS_FILENAME = 'Submissions'
GRADING_URL_EXTENSION = '&action=grading'
SUBMISSION_LISTING_DELIMINATOR = '-_submission_-'
GRADING_BLANK_GRADE = '-'
GRADING_HEADER_NAME = 'Name'
GRADING_HEADER_EMAIL = 'Email'
... | grades_filename = 'grades.csv'
grading_slash_deliminator = '/'
submissions_filename = 'Submissions'
grading_url_extension = '&action=grading'
submission_listing_deliminator = '-_submission_-'
grading_blank_grade = '-'
grading_header_name = 'Name'
grading_header_email = 'Email'
grading_header_grade = 'Grade' |
#print("for loop")
#word = ["this", "is","roshan"]
# for w in word: print(w, len(w))
#give range of each word for w in range(len(word)): print(w, word[w])
#get odd or even
"""
for x in range(0,5):
x+=1
#print(x)
if x % 2 == 0:
print(f"{x}::Even No")
else:
print(f"{x}::Odd No")
... | """
for x in range(0,5):
x+=1
#print(x)
if x % 2 == 0:
print(f"{x}::Even No")
else:
print(f"{x}::Odd No")
print("PRime No's")
for n in range(1,10):
for x in range(2,n):
if n % x ==0:
print(f"{n} get by multiple of {x} and is divisible of {x}, So it... |
# Time: O(n)
# Space: O(n)
class UnionFind(object):
def __init__(self, n):
self.set = range(n)
def find_set(self, x):
if self.set[x] != x:
self.set[x] = self.find_set(self.set[x]) # path compression.
return self.set[x]
def union_set(self, x, y):
... | class Unionfind(object):
def __init__(self, n):
self.set = range(n)
def find_set(self, x):
if self.set[x] != x:
self.set[x] = self.find_set(self.set[x])
return self.set[x]
def union_set(self, x, y):
(x_root, y_root) = map(self.find_set, (x, y))
if x_roo... |
# IP and port to bind to.
bind = ['127.0.0.1:4000']
# Maximum number of pending connections.
backlog = 2048
# Number of worker processes to handle connections.
workers = 2
# Fork main process to background.
daemon = True
# PID file to write to.
pidfile = "web.gunicorn.pid"
# Allow connections from any frontend pro... | bind = ['127.0.0.1:4000']
backlog = 2048
workers = 2
daemon = True
pidfile = 'web.gunicorn.pid'
accesslog = 'web.gunicorn.access.log'
errorlog = 'web.gunicorn.error.log'
loglevel = 'warning'
proc_name = 'rouly.net-gunicorn' |
i = 0
while(True):
if i+1<5:
i = i + 1
continue
print(i+1, end=" ")
if(i==50):
break #stop the loop
i = i+ 1 | i = 0
while True:
if i + 1 < 5:
i = i + 1
continue
print(i + 1, end=' ')
if i == 50:
break
i = i + 1 |
#https://leetcode.com/problems/min-stack/
class MinStack(object):
def __init__(self):
self.stack = []
def push(self, x):
self.stack.append((x, min(x, self.getMin())))
def pop(self):
if len(self.stack)==0: return None
return self.stack.pop()[0]
... | class Minstack(object):
def __init__(self):
self.stack = []
def push(self, x):
self.stack.append((x, min(x, self.getMin())))
def pop(self):
if len(self.stack) == 0:
return None
return self.stack.pop()[0]
def top(self):
if len(self.stack) == 0:
... |
# -*- coding: utf-8 -*-
"""
flybirds common error
"""
class FlybirdNotFoundException(Exception):
"""
not find flybirds
"""
def __init__(self, message, select_dic, error=None):
message = f"selectors={str(select_dic)} {message}"
if error is not None:
message = f"{message} in... | """
flybirds common error
"""
class Flybirdnotfoundexception(Exception):
"""
not find flybirds
"""
def __init__(self, message, select_dic, error=None):
message = f'selectors={str(select_dic)} {message}'
if error is not None:
message = f'{message} innerErr:{error}'
s... |
class RaggedContiguous:
"""Mixin class for an underlying compressed ragged array.
.. versionadded:: (cfdm) 1.7.0
"""
def get_count(self, default=ValueError()):
"""Return the count variable for a compressed array.
.. versionadded:: (cfdm) 1.7.0
:Parameters:
defau... | class Raggedcontiguous:
"""Mixin class for an underlying compressed ragged array.
.. versionadded:: (cfdm) 1.7.0
"""
def get_count(self, default=value_error()):
"""Return the count variable for a compressed array.
.. versionadded:: (cfdm) 1.7.0
:Parameters:
defa... |
## This module deals with code regarding handling the double
## underscore separated keys
def dunderkey(*args):
"""Produces a nested key from multiple args separated by double
underscore
>>> dunderkey('a', 'b', 'c')
>>> 'a__b__c'
:param *args : *String
:rtype : String
"""
... | def dunderkey(*args):
"""Produces a nested key from multiple args separated by double
underscore
>>> dunderkey('a', 'b', 'c')
>>> 'a__b__c'
:param *args : *String
:rtype : String
"""
return '__'.join(args)
def dunder_partition(key):
"""Splits a dunderkey into 2 parts
... |
def insert_newlines(string, every=64):
return '\n'.join(string[i:i+every] for i in range(0, len(string), every))
for __ in range(int(input())):
n = int(input())
o = "O"
x = "X"
a = ["X" for i in range(64)]
for i in range(n):
a[i] = "."
a[0]=o
print(insert_newlines("".join(a),8))... | def insert_newlines(string, every=64):
return '\n'.join((string[i:i + every] for i in range(0, len(string), every)))
for __ in range(int(input())):
n = int(input())
o = 'O'
x = 'X'
a = ['X' for i in range(64)]
for i in range(n):
a[i] = '.'
a[0] = o
print(insert_newlines(''.join(a... |
## Set Configs
print('Set configs..')
sns.set()
pd.options.display.max_columns = None
RANDOM_SEED = 42
fig_path = os.path.join(os.getcwd(), 'figs')
model_path = os.path.join(os.getcwd(), 'models')
model_bib_path = os.path.join(model_path,'model_bib')
data_path = os.path.join(os.getcwd(), 'data')
## read the data
pri... | print('Set configs..')
sns.set()
pd.options.display.max_columns = None
random_seed = 42
fig_path = os.path.join(os.getcwd(), 'figs')
model_path = os.path.join(os.getcwd(), 'models')
model_bib_path = os.path.join(model_path, 'model_bib')
data_path = os.path.join(os.getcwd(), 'data')
print('Read the data..')
data_fn = os... |
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
# dumb way
# for i in range(0,len(a),1):
# if a[i]%2 == 0:
# print(str(a[i]),end=" ")
b = [i for i in a if i % 2 == 0]
print(b)
| a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
b = [i for i in a if i % 2 == 0]
print(b) |
'''
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, 2 is written as II in Roman numeral, just two one's added together. 12 is writte... | """
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000
For example, 2 is written as II in Roman numeral, just two one's added together. 12 is writte... |
# https://www.codewars.com/kata/55a243393fb3e87021000198/train/python
# My solution
def remember(text):
counter = {}
result = []
for ch in text:
counter[ch] = counter.get(ch, 0) + 1
if counter[ch] == 2:
result.append(ch)
return result
# ...
def remember(str_):
... | def remember(text):
counter = {}
result = []
for ch in text:
counter[ch] = counter.get(ch, 0) + 1
if counter[ch] == 2:
result.append(ch)
return result
def remember(str_):
seen = set()
res = []
for i in str_:
res.append(i) if i in seen and i not in res els... |
directory_map = {
"abilene": "directed-abilene-zhang-5min-over-6months-ALL",
"geant": "directed-geant-uhlig-15min-over-4months-ALL",
"germany50": "directed-germany50-DFN-aggregated-1day-over-1month",
}
| directory_map = {'abilene': 'directed-abilene-zhang-5min-over-6months-ALL', 'geant': 'directed-geant-uhlig-15min-over-4months-ALL', 'germany50': 'directed-germany50-DFN-aggregated-1day-over-1month'} |
class Math1():
def __init__(self):
self.my_num1 = 10
self.my_num2 = 20
def addition(self):
return self.my_num1 + self.my_num2
def subtraction(self):
return self.my_num1 - self.my_num2
class Math_Plus(Math1):
def __init__(self, my_num1=40, my_num2=90):
self... | class Math1:
def __init__(self):
self.my_num1 = 10
self.my_num2 = 20
def addition(self):
return self.my_num1 + self.my_num2
def subtraction(self):
return self.my_num1 - self.my_num2
class Math_Plus(Math1):
def __init__(self, my_num1=40, my_num2=90):
self.my_n... |
# single source of truth for package version,
# see https://packaging.python.org/en/latest/single_source_version/
__version__ = "0.6.0"
# app name to send as part of SDK requests
app_name = "DLHub CLI v{}".format(__version__)
| __version__ = '0.6.0'
app_name = 'DLHub CLI v{}'.format(__version__) |
# coding: utf8
# try something like
def index(): return plugin_flatpage()
def rfp(): return plugin_flatpage()
| def index():
return plugin_flatpage()
def rfp():
return plugin_flatpage() |
"""
MicroPython driver for MLX90615 IR temperature I2C sensor :
https://github.com/rcolistete/MicroPython_MLX90615_driver
Version with simple read functions : 0.2.1 @ 2020/05/05
Author: Roberto Colistete Jr. (roberto.colistete at gmail.com)
License: MIT License (https://opensource.org/licenses/MIT)
"""
__version__ = '... | """
MicroPython driver for MLX90615 IR temperature I2C sensor :
https://github.com/rcolistete/MicroPython_MLX90615_driver
Version with simple read functions : 0.2.1 @ 2020/05/05
Author: Roberto Colistete Jr. (roberto.colistete at gmail.com)
License: MIT License (https://opensource.org/licenses/MIT)
"""
__version__ = '0... |
# -*- coding: utf-8 -*-
"""Contains version information"""
__version__ = "0.7.9"
| """Contains version information"""
__version__ = '0.7.9' |
'''
PyTorch implementation of the RetinaNet object detector:
Lin, Tsung-Yi, et al. "Focal loss for dense object detection." Proceedings of the IEEE international conference on computer vision. 2017.
Basic implementation forked and adapted from: https://github.com/kuangliu/pytorch-retinanet
2019 Be... | """
PyTorch implementation of the RetinaNet object detector:
Lin, Tsung-Yi, et al. "Focal loss for dense object detection." Proceedings of the IEEE international conference on computer vision. 2017.
Basic implementation forked and adapted from: https://github.com/kuangliu/pytorch-retinanet
2019 Be... |
#import gui.gui as gui
# Python3 program to find number
# of bins required using
# First Fit algorithm.
# Returns number of bins required
# using first fit
# online algorithm
def firstFit(weight, n, c):
# Initialize result (Count of bins)
res = 0
# Create an array to store
# remaining space in bins
# there... | def first_fit(weight, n, c):
res = 0
bin_rem = [0] * n
for i in range(n):
j = 0
min = c + 1
bi = 0
for j in range(res):
if bin_rem[j] >= weight[i] and bin_rem[j] - weight[i] < min:
bi = j
min = bin_rem[j] - weight[i]
if min ... |
# mapping for AWS IAM user_name to slack ID accross all AWS accounts
#
# Fill in "<aws_IAM_user_id>:<slack_id>" here. Seperate each entry by a comma, and leave the last one without a comma
# Example:
# mapping = {
# "IAM_user_id1":"slack_id1",
# "IAM_user_id2":"slack_id2",
# "IAM_user_id3":"slack_id... | mapping = {'IAM_user_id1': 'slack_id1', 'IAM_user_id2': 'slack_id2', 'IAM_user_id3': 'slack_id3'} |
vents = """964,133 -> 596,133
920,215 -> 920,976
123,528 -> 123,661
613,13 -> 407,13
373,876 -> 424,876
616,326 -> 120,326
486,335 -> 539,388
104,947 -> 54,947
319,241 -> 282,204
453,175 -> 453,438
485,187 -> 915,617
863,605 -> 603,605
870,524 -> 342,524
967,395 -> 634,62
405,181 -> 807,181
961,363 -> 419,905
89,586 ->... | vents = '964,133 -> 596,133\n920,215 -> 920,976\n123,528 -> 123,661\n613,13 -> 407,13\n373,876 -> 424,876\n616,326 -> 120,326\n486,335 -> 539,388\n104,947 -> 54,947\n319,241 -> 282,204\n453,175 -> 453,438\n485,187 -> 915,617\n863,605 -> 603,605\n870,524 -> 342,524\n967,395 -> 634,62\n405,181 -> 807,181\n961,363 -> 419,... |
# Bot's version number
__version__ = "0.1.0"
# Authorized guild
GUILD_ID = 952941520867196958 | __version__ = '0.1.0'
guild_id = 952941520867196958 |
#Rep of loops
numbers = [2, 3, 4, 45]
l = len(numbers)
for i in range(l):
print(numbers[i]) # each iteration the i takes on a different
#value according to len of numbers (4)
for i in range(8):
print(i) # prints numbers 0 through 7
for el in numbers:
print(el)
# using a loop to change elements within ... | numbers = [2, 3, 4, 45]
l = len(numbers)
for i in range(l):
print(numbers[i])
for i in range(8):
print(i)
for el in numbers:
print(el)
items = ['yellow', 'red', 'green', 'purple', 'blue']
for i in range(5):
print('Before item ', i, 'is', items[i])
items[i] = 'different'
print('After item ', i, '... |
"""
cheesyutils - A number of utility packages and functions
"""
__title__ = "cheesyutils"
__author__ = "CheesyGamer77"
__copyright__ = "Copyright 2021-present CheesyGamer77"
__version__ = "0.0.30"
| """
cheesyutils - A number of utility packages and functions
"""
__title__ = 'cheesyutils'
__author__ = 'CheesyGamer77'
__copyright__ = 'Copyright 2021-present CheesyGamer77'
__version__ = '0.0.30' |
def append_text(new_text):
'''
Write the code instruction to be exported later on
Args.
new_text (str): the text that will be appended to the base string
'''
global code_base_text
code_base_text = code_base_text + new_text | def append_text(new_text):
"""
Write the code instruction to be exported later on
Args.
new_text (str): the text that will be appended to the base string
"""
global code_base_text
code_base_text = code_base_text + new_text |
"""
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
Your algorithm should run in O(n) complexity.
Example:
Input: [100, 4, 200, 1, 3, 2]
Output: 4
Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4.
Solution:
1. Sort
... | """
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
Your algorithm should run in O(n) complexity.
Example:
Input: [100, 4, 200, 1, 3, 2]
Output: 4
Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4.
Solution:
1. Sort
... |
SHORT_DESCRIPTION = "Sorter organises/sorts files using a customised search function to group those that have similar characteristics into a single folder. Similar characteristics include file type, file name or part of the name and file category. You can put all letters documents into one folder, all images with the w... | short_description = 'Sorter organises/sorts files using a customised search function to group those that have similar characteristics into a single folder. Similar characteristics include file type, file name or part of the name and file category. You can put all letters documents into one folder, all images with the w... |
n=int(input ('veverite'))
if n %2==0: print ('par')
else: print ('impar')
print('par' if n%2==0 else 'impar')
| n = int(input('veverite'))
if n % 2 == 0:
print('par')
else:
print('impar')
print('par' if n % 2 == 0 else 'impar') |
# pylint: disable=missing-class-docstring, disable=missing-function-docstring, missing-module-docstring/
#$ header class Point(public)
#$ header method __init__(Point, double, double)
#$ header method __del__(Point)
#$ header method translate(Point, double, double)
class Point(object):
def __init__(self, x, y):
... | class Point(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __del__(self):
pass
def translate(self, a, b):
self.x = self.x + a
self.y = self.y + b
if __name__ == '__main__':
p = point(0.0, 0.0)
x = p.x
p.x = x
a = p.x
a = p.x - 2
... |
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftPLUSMINUSleftTIMESDIVIDEleftPOWERrightUMINUSCOMMA DATA DEF DIM DIVIDE END EQUALS FLOAT FOR GE GOSUB GOTO GT ID IF INTEGER LE LET LIST LPAREN LT MINUS NE NEW NEWLINE... | _tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftPLUSMINUSleftTIMESDIVIDEleftPOWERrightUMINUSCOMMA DATA DEF DIM DIVIDE END EQUALS FLOAT FOR GE GOSUB GOTO GT ID IF INTEGER LE LET LIST LPAREN LT MINUS NE NEW NEWLINE NEXT PLUS POWER PRINT READ REM RETURN RPAREN RUN SEMI STEP STOP STRING THEN TIMES TOprogram :... |
#-*- coding: utf8 -*-
class P3PMiddleware(object):
def process_response(self, request, response):
response['P3P'] = 'CP="CAO PSA OUR"'
return response
| class P3Pmiddleware(object):
def process_response(self, request, response):
response['P3P'] = 'CP="CAO PSA OUR"'
return response |
# Copyright 2018 Databricks, Inc.
VERSION = '0.7.0.dev'
| version = '0.7.0.dev' |
#!/usr/bin/env python
'''
This script prints Hello World!
'''
print('Hello, World!')
| """
This script prints Hello World!
"""
print('Hello, World!') |
__all__ = ["InvalidECFGFormatException"]
class InvalidECFGFormatException(Exception):
pass
| __all__ = ['InvalidECFGFormatException']
class Invalidecfgformatexception(Exception):
pass |
r=int(input('banyaknya angka:'))
data=[]
for i in range (r): #v
n=int(input("Enter Integer {}:".format(i+1))) #v
data.append(n) #v
m=10**(r-1)
for i in range (r):
y=int(data[i]*m)
print(y)
m=m/10
#print(r);
| r = int(input('banyaknya angka:'))
data = []
for i in range(r):
n = int(input('Enter Integer {}:'.format(i + 1)))
data.append(n)
m = 10 ** (r - 1)
for i in range(r):
y = int(data[i] * m)
print(y)
m = m / 10 |
def define_display_nodes(tree,nodemap,unscoped_vectors=False,looped_definition=False):
if unscoped_vectors:
s = ''
else:
s = '\t\t\tstd::vector<MPILib::NodeId> display_nodes;\n'
display_nodes = tree.findall('.//Display')
for dn in display_nodes:
node_id = str(nodemap[dn.attrib[... | def define_display_nodes(tree, nodemap, unscoped_vectors=False, looped_definition=False):
if unscoped_vectors:
s = ''
else:
s = '\t\t\tstd::vector<MPILib::NodeId> display_nodes;\n'
display_nodes = tree.findall('.//Display')
for dn in display_nodes:
node_id = str(nodemap[dn.attrib... |
def factorial(n):
if n==0:
return 1
else:
return factorial(n-1)*n
print(factorial(80))
| def factorial(n):
if n == 0:
return 1
else:
return factorial(n - 1) * n
print(factorial(80)) |
# two_tasks.py
def task_reformat_temperature_data():
"""Reformats the raw temperature data file for easier analysis"""
return {
'file_dep': ['UK_Tmean_data.txt'],
'targets': ['UK_Tmean_data.reformatted.txt'],
'actions': ['python reformat_weather_data.py UK_Tmean_data.txt > UK_... | def task_reformat_temperature_data():
"""Reformats the raw temperature data file for easier analysis"""
return {'file_dep': ['UK_Tmean_data.txt'], 'targets': ['UK_Tmean_data.reformatted.txt'], 'actions': ['python reformat_weather_data.py UK_Tmean_data.txt > UK_Tmean_data.reformatted.txt']}
def task_reformat_su... |
#Make sure that we handle keyword-only arguments correctly
def f(a, *varargs, kw1, kw2="has-default"):
pass
#OK
f(1, 2, 3, kw1=1)
f(1, 2, kw1=1, kw2=2)
#Not OK
f(1, 2, 3, kw1=1, kw3=3)
f(1, 2, 3, kw3=3)
#ODASA-5897
def analyze_member_access(msg, *, original, override, chk: 'default' = None):
pass
def ok(... | def f(a, *varargs, kw1, kw2='has-default'):
pass
f(1, 2, 3, kw1=1)
f(1, 2, kw1=1, kw2=2)
f(1, 2, 3, kw1=1, kw3=3)
f(1, 2, 3, kw3=3)
def analyze_member_access(msg, *, original, override, chk: 'default'=None):
pass
def ok():
return analyze_member_access(msg, original=original, chk=chk)
def bad():
retur... |
class Parser():
def __init__(self, config):
self._config_args = config
@property
def experiment_args(self):
return self._config_args["Experiment"]
@property
def train_dataset_args(self):
return self._config_args["Dataset - metatrain"]
@property
def valid_dataset_ar... | class Parser:
def __init__(self, config):
self._config_args = config
@property
def experiment_args(self):
return self._config_args['Experiment']
@property
def train_dataset_args(self):
return self._config_args['Dataset - metatrain']
@property
def valid_dataset_arg... |
'''
According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970."
Given a board with m by n cells, each cell has an initial state live (1) or dead (0). Each cell interacts with its eight neighbors (horizonta... | """
According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970."
Given a board with m by n cells, each cell has an initial state live (1) or dead (0). Each cell interacts with its eight neighbors (horizonta... |
class X:
def __init__(self,x):
print("Inside X ", x)
class Y:
def __init__(self):
print("Inside Y")
class Z(X,Y):
def __init__(self):
super().__init__(10)
print("Inside Z")
obj = Z()
| class X:
def __init__(self, x):
print('Inside X ', x)
class Y:
def __init__(self):
print('Inside Y')
class Z(X, Y):
def __init__(self):
super().__init__(10)
print('Inside Z')
obj = z() |
# -*- coding: utf-8 -*-
valor = float(input())
if 0 < valor <= 25:
print('Intervalo [0, 25]')
elif 25 < valor <= 50:
print('Intervalo (25, 50]')
elif 50 < valor <= 75:
print('Intervalo (50, 75]')
elif 75 < valor <= 100:
print('Intervalo (75, 100]')
else:
print('Fora de intervalo')
| valor = float(input())
if 0 < valor <= 25:
print('Intervalo [0, 25]')
elif 25 < valor <= 50:
print('Intervalo (25, 50]')
elif 50 < valor <= 75:
print('Intervalo (50, 75]')
elif 75 < valor <= 100:
print('Intervalo (75, 100]')
else:
print('Fora de intervalo') |
"""
Consider the following:
A string,
, of length where
.
An integer,
, where is a factor of
.
We can split
into subsegments where each subsegment, , consists of a contiguous block of characters in . Then, use each to create string
such that:
The characters in
are a subsequence of the characters in
... | """
Consider the following:
A string,
, of length where
.
An integer,
, where is a factor of
.
We can split
into subsegments where each subsegment, , consists of a contiguous block of characters in . Then, use each to create string
such that:
The characters in
are a subsequence of the characters in
... |
# SPDX-FileCopyrightText: Copyright (C) 2020-2021 Ryan Finnie
# SPDX-License-Identifier: MIT
def numfmt(
num,
fmt="{num.real:0.02f} {num.prefix}",
binary=False,
rollover=1.0,
limit=0,
prefixes=None,
):
"""Formats a number with decimal or binary prefixes
num: Input number
fmt: Form... | def numfmt(num, fmt='{num.real:0.02f} {num.prefix}', binary=False, rollover=1.0, limit=0, prefixes=None):
"""Formats a number with decimal or binary prefixes
num: Input number
fmt: Format string of default repr/str output
binary: If True, use divide by 1024 and use IEC binary prefixes
rollover: Thr... |
# Aula 13 - Desafio 47: Contagem de numeros pares
# Mostrar na tela todos os numeros pares entre 1 e 50
print('Entre 1 e 50, sao numeros pares:')
for n in range(2, 51, 2):
print(n, end=' ')
| print('Entre 1 e 50, sao numeros pares:')
for n in range(2, 51, 2):
print(n, end=' ') |
word1=input()
word2=input()
dict={}
alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
for char in alphabet:
dict[char]=0
for ch in word1:
dict[ch]+=1
for ch in word2:
dict[ch]-=1
flag=False
sum=0
for char in dict:
count=dict[char]
sum+=count
if count == 1:
flag=True
... | word1 = input()
word2 = input()
dict = {}
alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
for char in alphabet:
dict[char] = 0
for ch in word1:
dict[ch] += 1
for ch in word2:
dict[ch] -= 1
flag = False
sum = 0
for char in dict:
count = dict[char]
sum += count
if count == 1:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Source code meta data
__author__ = 'Dalwar Hossain'
__email__ = 'dalwar.hossain@protonmail.com'
| __author__ = 'Dalwar Hossain'
__email__ = 'dalwar.hossain@protonmail.com' |
tm20 = toi = h = 0
print('-' * 25)
print(' CADASTRANDO PESSOAS ')
print('-' * 25)
while True:
id = int(input('digite a idade '))
sex = ' '
while sex not in 'MF':
sex = str(input('digite o sexo')).upper()
if id >= 18:
toi += 1
if sex == 'M':
h += 1
if sex == 'f' and id <... | tm20 = toi = h = 0
print('-' * 25)
print(' CADASTRANDO PESSOAS ')
print('-' * 25)
while True:
id = int(input('digite a idade '))
sex = ' '
while sex not in 'MF':
sex = str(input('digite o sexo')).upper()
if id >= 18:
toi += 1
if sex == 'M':
h += 1
if sex == 'f' and id < ... |
# De uitwerking van 4-autoencoder.py moet hiervoor gedraaid worden!
voorspeller = tf.keras.models.Sequential([
tf.keras.layers.Dense(200, activation=tf.nn.relu),
tf.keras.layers.Dense(50, activation=tf.nn.relu),
tf.keras.layers.Dense(50, activation=tf.nn.relu),
tf.keras.layers.Dense(10, activation=tf.nn.softma... | voorspeller = tf.keras.models.Sequential([tf.keras.layers.Dense(200, activation=tf.nn.relu), tf.keras.layers.Dense(50, activation=tf.nn.relu), tf.keras.layers.Dense(50, activation=tf.nn.relu), tf.keras.layers.Dense(10, activation=tf.nn.softmax)])
voorspeller.compile(optimizer='adam', loss='sparse_categorical_crossentro... |
# Time: O(logn)
# Space: O(1)
class Solution(object):
def fixedPoint(self, A):
"""
:type A: List[int]
:rtype: int
"""
left, right = 0, len(A)-1
while left <= right:
mid = left + (right-left)//2
if A[mid] >= mid:
right = mid-1
... | class Solution(object):
def fixed_point(self, A):
"""
:type A: List[int]
:rtype: int
"""
(left, right) = (0, len(A) - 1)
while left <= right:
mid = left + (right - left) // 2
if A[mid] >= mid:
right = mid - 1
else:
... |
# model settings
model = dict(
type='ImageClassifier',
pretrained=None,
backbone=dict(
type='OmzBackboneCls',
mode='train',
model_path='public/mobilenet-v2/FP32/mobilenet-v2.xml',
last_layer_name='relu6_4',
normalized_img_input=True
),
neck=dict(
type=... | model = dict(type='ImageClassifier', pretrained=None, backbone=dict(type='OmzBackboneCls', mode='train', model_path='public/mobilenet-v2/FP32/mobilenet-v2.xml', last_layer_name='relu6_4', normalized_img_input=True), neck=dict(type='GlobalAveragePooling'), head=dict(type='LinearClsHead', num_classes=1000, in_channels=12... |
class Environment(object):
def __init__(self):
pass
def act(self, state, action):
pass
def end_state(self, state):
return True
def reset(self):
pass
def available_actions(self):
return None
| class Environment(object):
def __init__(self):
pass
def act(self, state, action):
pass
def end_state(self, state):
return True
def reset(self):
pass
def available_actions(self):
return None |
class NodeCalculator:
@staticmethod
def calculate_node_size(node, relationships):
linked_tables = list()
size = 0
for table_key, table_value in relationships.items():
if table_key == node:
for table in relationships[table_key]:
linked_ta... | class Nodecalculator:
@staticmethod
def calculate_node_size(node, relationships):
linked_tables = list()
size = 0
for (table_key, table_value) in relationships.items():
if table_key == node:
for table in relationships[table_key]:
linked_ta... |
# Question(#1143): Given two strings text1 and text2, return the length of their longest common subsequence.
# Solution: Use the longest common susequence dynamic programming algorithm
def longestCommonSubsequence(text1: str, text2: str) -> int:
grid = [[0 for _ in range(len(text2)+1)] for _ in range(len(text1)+1)... | def longest_common_subsequence(text1: str, text2: str) -> int:
grid = [[0 for _ in range(len(text2) + 1)] for _ in range(len(text1) + 1)]
for i in range(1, len(text1) + 1):
for j in range(1, len(text2) + 1):
if text1[i - 1] == text2[j - 1]:
grid[i][j] = 1 + grid[i - 1][j - 1]... |
"""
gnmi_tools - Basic GNMI operations on a device
"""
__copyright__ = "Copyright (c) 2020 Cisco Systems, Inc. and/or its affiliates"
__version__ = "0.1"
__author__ = "Marcelo Reis"
__email__ = "mareis@cisco.com"
__url__ = "https://github.com/reismarcelo/gnmi_hello"
| """
gnmi_tools - Basic GNMI operations on a device
"""
__copyright__ = 'Copyright (c) 2020 Cisco Systems, Inc. and/or its affiliates'
__version__ = '0.1'
__author__ = 'Marcelo Reis'
__email__ = 'mareis@cisco.com'
__url__ = 'https://github.com/reismarcelo/gnmi_hello' |
print("Let's do Factorial") #printing the operation what we are performing
def factorial(number): #defining the factorial method
result = 1 # result is intially defined with 1. if we define initially with ... | print("Let's do Factorial")
def factorial(number):
result = 1
if number == 0:
print('The factorial of 0 is 1')
elif number < 0:
print('Error..Enter only whole numbers')
else:
for i in range(1, number + 1):
result = result * i
print('The Factorial of', number,... |
name = "glew"
version = "2.1.0"
authors = [
"Milan Ikits",
"Marcelo Magallon",
"Nigel Stewart"
]
description = \
"""
The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library.
"""
requires = [
"cmake-3+",
"gcc-6+"
]
variants = [
... | name = 'glew'
version = '2.1.0'
authors = ['Milan Ikits', 'Marcelo Magallon', 'Nigel Stewart']
description = '\n The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library.\n '
requires = ['cmake-3+', 'gcc-6+']
variants = [['platform-linux']]
tools = ['glewinfo', ... |
#!/usr/bin/env python
include = "$chrs".replace("[", "").replace("]", "").replace(" ", "").split(",")
ref = "$reference"
with open(ref) as ifh, open("include.bed", "w") as ofh:
for line in ifh:
toks = line.strip().split("\\t")
if toks[0] in include:
print(toks[0], 0, toks[1], sep="\\t"... | include = '$chrs'.replace('[', '').replace(']', '').replace(' ', '').split(',')
ref = '$reference'
with open(ref) as ifh, open('include.bed', 'w') as ofh:
for line in ifh:
toks = line.strip().split('\\t')
if toks[0] in include:
print(toks[0], 0, toks[1], sep='\\t', file=ofh) |
# Modify the program to show the numbers from 50 to 100
x=50
while x<=100:
print(x)
x=x+1 | x = 50
while x <= 100:
print(x)
x = x + 1 |
# Number of queens
print("Enter the number of queens")
N = int(input())
# chessboard
# NxN matrix with all elements 0
board = [[0]*N for _ in range(N)]
def is_attack(i, j):
# checking if there is a queen in row or column
for k in range(0, N):
if board[i][k] == 1 or board[k][j] == 1:
... | print('Enter the number of queens')
n = int(input())
board = [[0] * N for _ in range(N)]
def is_attack(i, j):
for k in range(0, N):
if board[i][k] == 1 or board[k][j] == 1:
return True
for k in range(0, N):
for l in range(0, N):
if k + l == i + j or k - l == i - j:
... |
class Device(object):
"""Device.
:param id: Unique identifier for the device.
:type id: str
:param name: The name of the device.
:type name: str
"""
def __init__(self, data=None):
if data is None:
data = {}
self.id = data.get('id', None)
self.name = dat... | class Device(object):
"""Device.
:param id: Unique identifier for the device.
:type id: str
:param name: The name of the device.
:type name: str
"""
def __init__(self, data=None):
if data is None:
data = {}
self.id = data.get('id', None)
self.name = data... |
start_inventory = 20
num_items = start_inventory
while num_items > 0:
print("We have " + str(num_items) + " items in inventory.")
user_purchase = input("How many would you like to buy? ")
if int(user_purchase) > num_items:
print("Not Enough Stock")
else:
num_items = num_items... | start_inventory = 20
num_items = start_inventory
while num_items > 0:
print('We have ' + str(num_items) + ' items in inventory.')
user_purchase = input('How many would you like to buy? ')
if int(user_purchase) > num_items:
print('Not Enough Stock')
else:
num_items = num_items - int(user_... |
first_list = range(11)
second_list = range(1,12)
ziplist = list(zip(first_list, second_list))
def square(a, b):
return (a*a) + (b*b) + 2 * a * b
# output = [square(item[0], item[1]) for item in ziplist]
output = [square(a, b) for a, b in ziplist]
print(output)
def square2(pair):
a = pair[0]
b = pair[1]
... | first_list = range(11)
second_list = range(1, 12)
ziplist = list(zip(first_list, second_list))
def square(a, b):
return a * a + b * b + 2 * a * b
output = [square(a, b) for (a, b) in ziplist]
print(output)
def square2(pair):
a = pair[0]
b = pair[1]
return a * a + b * b + 2 * a * b
map_list = list(map(... |
class Quest:
def __init__(self, dbRow):
self.id = dbRow[0]
self.name = dbRow[1]
self.description = dbRow[2]
self.objective = dbRow[3]
self.questType = dbRow[4]
self.category = dbRow[5]
self.location = dbRow[6]
self.stars = dbRow[7]
self.zenny = dbRow[8]
def __repr__(self):
return f"{self.__dict... | class Quest:
def __init__(self, dbRow):
self.id = dbRow[0]
self.name = dbRow[1]
self.description = dbRow[2]
self.objective = dbRow[3]
self.questType = dbRow[4]
self.category = dbRow[5]
self.location = dbRow[6]
self.stars = dbRow[7]
self.zenny ... |
r"""
cgtasknet is a library for training spiking neural
networks with cognitive tasks
"""
| """
cgtasknet is a library for training spiking neural
networks with cognitive tasks
""" |
termination = 4000000
previous = 1
current = 2
total = 2
while(True):
new = current+ previous
previous = current
current = new
if(current >= termination):
break
if(current % 2 == 0):
total = total + current
print(total)
| termination = 4000000
previous = 1
current = 2
total = 2
while True:
new = current + previous
previous = current
current = new
if current >= termination:
break
if current % 2 == 0:
total = total + current
print(total) |
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 assign_ROSCO_values(wt_opt, modeling_options, control):
# ROSCO tuning parameters
wt_opt['tune_rosco_ivc.PC_omega'] = control['pitch']['PC_omega']
wt_opt['tune_rosco_ivc.PC_zeta'] = control['pitch']['PC_zeta']
wt_opt['tune_rosco_ivc.VS_omega'] = control['torque']['VS_omega']
wt_o... | def assign_rosco_values(wt_opt, modeling_options, control):
wt_opt['tune_rosco_ivc.PC_omega'] = control['pitch']['PC_omega']
wt_opt['tune_rosco_ivc.PC_zeta'] = control['pitch']['PC_zeta']
wt_opt['tune_rosco_ivc.VS_omega'] = control['torque']['VS_omega']
wt_opt['tune_rosco_ivc.VS_zeta'] = control['torque... |
# Tuples
# Assignment 1
tuple_numbers = (1, 2, 3, 4, 5)
tuple_groceries = ('coconuts', 'bananas', 'onions', 'spinach', 'tomatoes', 'cilantro', 'milk')
groceries_inventory = ('coconuts', 'tomatoes', 'onions', 'coconuts', 'bananas', 'onions', 'spinach', 'tomatoes', 'cilantro', 'milk', 'spinach', 'tomatoes', 'cilantro', ... | tuple_numbers = (1, 2, 3, 4, 5)
tuple_groceries = ('coconuts', 'bananas', 'onions', 'spinach', 'tomatoes', 'cilantro', 'milk')
groceries_inventory = ('coconuts', 'tomatoes', 'onions', 'coconuts', 'bananas', 'onions', 'spinach', 'tomatoes', 'cilantro', 'milk', 'spinach', 'tomatoes', 'cilantro', 'tomatoes')
tuple_nested ... |
class QueryToken:
"""A placeholder token for dry-run query output"""
def __str__(self) -> str:
return "?"
def __repr__(self) -> str:
return "?"
| class Querytoken:
"""A placeholder token for dry-run query output"""
def __str__(self) -> str:
return '?'
def __repr__(self) -> str:
return '?' |
class Solution:
def minMeetingRooms(self, intervals: list[list[int]]) -> int:
start = sorted([i[0] for i in intervals])
end = sorted(i[1] for i in intervals)
result = count = 0
s, e = 0, 0
while s < len(intervals):
if start[s] < end[e]:
s += 1
... | class Solution:
def min_meeting_rooms(self, intervals: list[list[int]]) -> int:
start = sorted([i[0] for i in intervals])
end = sorted((i[1] for i in intervals))
result = count = 0
(s, e) = (0, 0)
while s < len(intervals):
if start[s] < end[e]:
s ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.