content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def get_just_smaller(arr): just_smaller_array = [-1] * len(arr) stack = [] for i in range(len(arr) - 1, -1, -1): elem = arr[i] while len(stack) > 0 and elem < arr[stack[-1]]: index = stack.pop() just_smaller_array[index] = i stack.append(i) return just_s...
def get_just_smaller(arr): just_smaller_array = [-1] * len(arr) stack = [] for i in range(len(arr) - 1, -1, -1): elem = arr[i] while len(stack) > 0 and elem < arr[stack[-1]]: index = stack.pop() just_smaller_array[index] = i stack.append(i) return just_sma...
class Empty(Exception): pass class ArrayStack: def __init__(self): self._data = [] def __len__(self): return len(self._data) def is_empty(self): return len(self._data) == 0 def push(self, e): self._data.append(e) def top(self): if self.is_empty()...
class Empty(Exception): pass class Arraystack: def __init__(self): self._data = [] def __len__(self): return len(self._data) def is_empty(self): return len(self._data) == 0 def push(self, e): self._data.append(e) def top(self): if self.is_empty(): ...
class WorklogError(ValueError): pass class CommandError(WorklogError): pass class GitError(WorklogError): pass
class Worklogerror(ValueError): pass class Commanderror(WorklogError): pass class Giterror(WorklogError): pass
# https://www.freecodecamp.org/learn/scientific-computing-with-python/scientific-computing-with-python-projects/time-calculator # https://replit.com/@harmonify/time-calculator#time_calculator.py def add_time(base: str, addon: str, dow: str = "") -> str: DAYS_OF_WEEK = ("Monday", "Tuesday", "Wednesday", ...
def add_time(base: str, addon: str, dow: str='') -> str: days_of_week = ('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday') base_arr = base.split() (base_hour, base_minute) = map(int, base_arr[0].split(':')) meridiem = base_arr[1] (addon_hour, addon_minute) = map(int, addo...
# 3.6 Excel Spreadsheet - Column Number to Column Name def excel_column_number_to_name(column_number): output = '' index = column_number - 1 while index >= 0: character = chr((index % 26) + ord('A')) output = output + character index = (index / 26) - 1 return output[::-1]
def excel_column_number_to_name(column_number): output = '' index = column_number - 1 while index >= 0: character = chr(index % 26 + ord('A')) output = output + character index = index / 26 - 1 return output[::-1]
class collision(): def rectangle(x, y, target_x, target_y, width=32, height=32, target_width=32, target_height=32): # Assuming width/height is *dangerous* since this library might give false-positives. if x >= target_x and (x + width) <= (target_x + target_width): if y >= target_y an...
class Collision: def rectangle(x, y, target_x, target_y, width=32, height=32, target_width=32, target_height=32): if x >= target_x and x + width <= target_x + target_width: if y >= target_y and y + height <= target_y + target_height: return True return False
# THIS FILE IS GENERATED FROM pytsrepr SETUP.PY short_version = '0.0.1' version = '0.0.1' full_version = '0.0.1.dev0+Unknown' git_revision = 'Unknown' release = False if not release: version = full_version
short_version = '0.0.1' version = '0.0.1' full_version = '0.0.1.dev0+Unknown' git_revision = 'Unknown' release = False if not release: version = full_version
#!/usr/bin/python class Employee: empCount = 0 def __init__(self, name, salary, age): self.name = name self.salary = salary self.age = age Employee.empCount += 1 def displayCount(self): print ("Total Employee %d" % Employee.empCount) def displayEmployee(self): print...
class Employee: emp_count = 0 def __init__(self, name, salary, age): self.name = name self.salary = salary self.age = age Employee.empCount += 1 def display_count(self): print('Total Employee %d' % Employee.empCount) def display_employee(self): print('N...
class minHeap: harr=[] def parent(self,i): return (i-1)/2 def left(self,i): return ((2*i)+1) def right(self,i): return ((2*i)*2) def getMin(self): return self.harr[0] def replaceMax(self,x): self.harr[0]=x minHeapify(0) def __init__(self,arr,...
class Minheap: harr = [] def parent(self, i): return (i - 1) / 2 def left(self, i): return 2 * i + 1 def right(self, i): return 2 * i * 2 def get_min(self): return self.harr[0] def replace_max(self, x): self.harr[0] = x min_heapify(0) def...
class Vet: animals = [] space = 5 def __init__(self, name): self.name = name self.animals = [] def register_animal(self, animal): if self.space <= len(self.animals): return f"Not enough space" self.animals.append(animal) Vet.animals.append(animal) ...
class Vet: animals = [] space = 5 def __init__(self, name): self.name = name self.animals = [] def register_animal(self, animal): if self.space <= len(self.animals): return f'Not enough space' self.animals.append(animal) Vet.animals.append(animal) ...
def solution(A): return 1 if __name__ == '__main__': print ('Start tests..') assert solution([1, 5, 2, 1, 4, 0]) == 1 print ('passed!')
def solution(A): return 1 if __name__ == '__main__': print('Start tests..') assert solution([1, 5, 2, 1, 4, 0]) == 1 print('passed!')
def generate_key_table(key): table=[] all_chars=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] for char in key: if char not in table: if char=='i': if 'j' not in table and 'i' not in table: table.append(char) elif char=='j': if 'i' not i...
def generate_key_table(key): table = [] all_chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] for char in key: if char not in table: if char == 'i': if 'j' not in table and 'i' not in...
# -*- coding: utf-8 -*- def import_oauth_class(m): m = m.split('.') c = m.pop(-1) module = __import__('.'.join(m), fromlist=[c]) return getattr(module, c)
def import_oauth_class(m): m = m.split('.') c = m.pop(-1) module = __import__('.'.join(m), fromlist=[c]) return getattr(module, c)
def init(): global white global black global red global green global fill global blue global yellow white = [255, 255, 255] black = [0, 0, 0] red = [204, 0, 0] green = [0, 153, 0] fill = [48, 48, 48] blue = [15, 176, 255] yellow = [255, 241, 27]
def init(): global white global black global red global green global fill global blue global yellow white = [255, 255, 255] black = [0, 0, 0] red = [204, 0, 0] green = [0, 153, 0] fill = [48, 48, 48] blue = [15, 176, 255] yellow = [255, 241, 27]
class Main: def __init__(self): self.li = [] for i in range(0, 2): self.li.append(int(input())) self.salary = float(input()) def totalSalary(self): return self.li[1] * self.salary def output(self): print("NUMBER = {num}".format(num=self.li[0])) p...
class Main: def __init__(self): self.li = [] for i in range(0, 2): self.li.append(int(input())) self.salary = float(input()) def total_salary(self): return self.li[1] * self.salary def output(self): print('NUMBER = {num}'.format(num=self.li[0])) ...
# see https://www.codewars.com/kata/556196a6091a7e7f58000018/solutions/python def largest_pair_sum(numbers): return sorted(numbers)[-1] + sorted(numbers)[-2] print(largest_pair_sum([10,14,2,23,19]) == 42) print(largest_pair_sum([-100,-29,-24,-19,19]) == 0) print(largest_pair_sum([1,2,3,4,6,-1,2]) == 10) print(l...
def largest_pair_sum(numbers): return sorted(numbers)[-1] + sorted(numbers)[-2] print(largest_pair_sum([10, 14, 2, 23, 19]) == 42) print(largest_pair_sum([-100, -29, -24, -19, 19]) == 0) print(largest_pair_sum([1, 2, 3, 4, 6, -1, 2]) == 10) print(largest_pair_sum([-10, -8, -16, -18, -19]) == -18)
ckpt_path = '../ckpts' data_path = '../../data' graph_path = '../graphs' num_trains = { 'mnist': 60000, 'cifar': 50000, 'fmnist': 60000 } num_tests = { 'mnist': 10000, 'cifar': 10000, 'fmnist': 10000 } input_sizes = { 'mnist': 28*28, 'cifar': 3*32*32, 'fmnist': 28*28 } output_siz...
ckpt_path = '../ckpts' data_path = '../../data' graph_path = '../graphs' num_trains = {'mnist': 60000, 'cifar': 50000, 'fmnist': 60000} num_tests = {'mnist': 10000, 'cifar': 10000, 'fmnist': 10000} input_sizes = {'mnist': 28 * 28, 'cifar': 3 * 32 * 32, 'fmnist': 28 * 28} output_sizes = {'mnist': 10, 'cifar': 10, 'fmnis...
#Y = Species("Y",U_Y) class Species: def __init__(self, name, U): self.name = name #Y.name = "Y" self.U = U #Y.U = U_Y self.behaviour = None def get_U(self): return self.U #Y.get_U returns U_Y #Y.set_U(U) def set_U(self, U): self.U =...
class Species: def __init__(self, name, U): self.name = name self.U = U self.behaviour = None def get_u(self): return self.U def set_u(self, U): self.U = U def get_name(self): return self.name def set_behaviour(self, behaviour): self.behav...
display = [[False for i in range(50)] for j in range(6)] commands = [] while True: try: line = input() except: break if not line: break commands.append(line) for command in commands: if command[:4] == 'rect': i, j = command.find(' '), command.find('x') a = command[i+1 : j] ...
display = [[False for i in range(50)] for j in range(6)] commands = [] while True: try: line = input() except: break if not line: break commands.append(line) for command in commands: if command[:4] == 'rect': (i, j) = (command.find(' '), command.find('x')) a =...
''' https://www.hackerrank.com/challenges/python-mutations/problem ''' def mutate_string(s, p, ch): if p < 0 or p >= len(s): return s return s[:p] + ch + s[p+1:] ''' Reverse String -------------- Problem: Given a string, reverse the characters order so that the last at first, ...
""" https://www.hackerrank.com/challenges/python-mutations/problem """ def mutate_string(s, p, ch): if p < 0 or p >= len(s): return s return s[:p] + ch + s[p + 1:] "\n Reverse String\n --------------\n\n Problem:\n Given a string, reverse the characters order so that the last at fir...
class ReskinPacket: def __init__(self): self.type = "RESKIN" self.skinID = 0 def write(self, writer): writer.writeInt32(self.skinID) def read(self, reader): self.skinID = reader.readerInt32()
class Reskinpacket: def __init__(self): self.type = 'RESKIN' self.skinID = 0 def write(self, writer): writer.writeInt32(self.skinID) def read(self, reader): self.skinID = reader.readerInt32()
class Stack: # Construct an empty Stack object. def __init__(self): self._a = [] # Items # Return True if self is empty, and False otherwise. def is_empty(self): return len(self._a) == 0 # Push object item onto the top of self. def push(self, item): self...
class Stack: def __init__(self): self._a = [] def is_empty(self): return len(self._a) == 0 def push(self, item): self._a += [item] def pop(self): return self._a.pop()
def rectangle_area(w, h): return w * h width = int(input()) height = int(input()) print(rectangle_area(width, height))
def rectangle_area(w, h): return w * h width = int(input()) height = int(input()) print(rectangle_area(width, height))
class IUserManager: def logIn(self, userId, password): raise NotImplementedError def SignUp(self, userId, password): raise NotImplementedError
class Iusermanager: def log_in(self, userId, password): raise NotImplementedError def sign_up(self, userId, password): raise NotImplementedError
display_name = "Myriad Worlds" library_name = "myriad" version = "0.5" author = "Duncan McGreggor, Paul McGuire" author_email = "oubiwann@twistedmatrix.com" license = "MIT" url = "http://github.com/oubiwann/myriad-worlds" description = "Myriad Worlds Game Server" long_description = ("An experiment in generating worlds,...
display_name = 'Myriad Worlds' library_name = 'myriad' version = '0.5' author = 'Duncan McGreggor, Paul McGuire' author_email = 'oubiwann@twistedmatrix.com' license = 'MIT' url = 'http://github.com/oubiwann/myriad-worlds' description = 'Myriad Worlds Game Server' long_description = 'An experiment in generating worlds, ...
def setup_routes(app, handler): app.router.add_get( '/browsers/{version}', handler.browsers, name='browsers', )
def setup_routes(app, handler): app.router.add_get('/browsers/{version}', handler.browsers, name='browsers')
# McrpType.py def typedproperty(name, expected_type): private_name = '_'+name @property def prop(self): return getattr(self, private_name) @prop.setter def prop(self, value): if not isinstance(value, expected_type): raise TypeError('Expected type {}'.format(exp...
def typedproperty(name, expected_type): private_name = '_' + name @property def prop(self): return getattr(self, private_name) @prop.setter def prop(self, value): if not isinstance(value, expected_type): raise type_error('Expected type {}'.format(expected_type)) ...
# # PySNMP MIB module TVD-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TVD-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:20:44 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)...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, value_range_constraint, constraints_union, constraints_intersection) ...
''' * Colors for terminal ''' class COLORS: # Regular colors Black = "\033[0;30m" Red = "\033[0;31m" Green = "\033[0;32m" Yellow = "\033[0;33m" Blue = "\033[0;34m" Purple = "\033[0;35m" Cyan = "\033[0;36m" White = "\033[0;37m" ...
""" * Colors for terminal """ class Colors: black = '\x1b[0;30m' red = '\x1b[0;31m' green = '\x1b[0;32m' yellow = '\x1b[0;33m' blue = '\x1b[0;34m' purple = '\x1b[0;35m' cyan = '\x1b[0;36m' white = '\x1b[0;37m' on__black = '\x1b[40m' on__red = '\x1b[41m' on__green = '\x1b...
# me - this DAT # par - the Par object that has changed # val - the current value # prev - the previous value # # Make sure the corresponding toggle is enabled in the Parameter Execute DAT. def onValueChange(par, prev): # use par.eval() to get current value parent.save.Par_functions(par) return # Called at end of...
def on_value_change(par, prev): parent.save.Par_functions(par) return def on_values_changed(changes): for c in changes: par = c.par prev = c.prev return def on_pulse(par): parent.save.Par_functions(par) return def on_expression_change(par, val, prev): return def on_export...
# Formatting configuration for locale sh_YU languages={'el': u'Gr\u010dki', 'en': 'Engleski', 'co': 'Korzikanski', 'af': 'Afrikanerski', 'sw': 'Svahili', 'ca': 'Katalonski', 'it': 'Italijanski', 'cs': u'\u010ce\u0161ki', 'ar': 'Arapski', 'mk': 'Makedonski', 'ga': 'Irski', 'eu': 'Baskijski', 'et': 'Estonski', 'zh': 'Ki...
languages = {'el': u'Grčki', 'en': 'Engleski', 'co': 'Korzikanski', 'af': 'Afrikanerski', 'sw': 'Svahili', 'ca': 'Katalonski', 'it': 'Italijanski', 'cs': u'Češki', 'ar': 'Arapski', 'mk': 'Makedonski', 'ga': 'Irski', 'eu': 'Baskijski', 'et': 'Estonski', 'zh': 'Kineski', 'id': 'Indonezijski', 'es': u'Španski', 'ru': 'Rus...
print(f"{'='*12} BRANT'STORE {'='*12}") price = float(input('How much the product costs? $')) print('''Choose the form of payment: [1] Cash/check [2] Credit Card''') payment = int(input('What is the payment method? ')) if payment == 1: price -= price * 0.1 print(f'The price will be ${price:.2f}') elif payment ...
print(f"{'=' * 12} BRANT'STORE {'=' * 12}") price = float(input('How much the product costs? $')) print('Choose the form of payment:\n[1] Cash/check\n[2] Credit Card') payment = int(input('What is the payment method? ')) if payment == 1: price -= price * 0.1 print(f'The price will be ${price:.2f}') elif payment...
class Solution: def replaceSpaces(self, S: str, length: int) -> str: cnt = 0 S = list(S) cnt += sum((1 for c in S[:length] if c == ' ')) newLen = length + 2 * cnt #print(length, newLen) S = S[:newLen] for i in range(length - 1, -1, -1): if S[i] ==...
class Solution: def replace_spaces(self, S: str, length: int) -> str: cnt = 0 s = list(S) cnt += sum((1 for c in S[:length] if c == ' ')) new_len = length + 2 * cnt s = S[:newLen] for i in range(length - 1, -1, -1): if S[i] == ' ': S[newLe...
# DFLOW LIBRARY: # dflow matrices module # with zeros and ones # functions def zeros(rows, columns): return [[0]*columns]*rows def ones(rows, columns): return [[1]*columns]*rows
def zeros(rows, columns): return [[0] * columns] * rows def ones(rows, columns): return [[1] * columns] * rows
def merge(L, R, arr): nl = len(L) nr = len(R) i, j, k = 0, 0, 0 while i < nl and j < nr: if L[i] <= R[j]: arr[k] = L[i] k += 1 i += 1 else: arr[k] = R[j] k += 1 j += 1 def exhaust(index, maxIndex, arrIndex, ar...
def merge(L, R, arr): nl = len(L) nr = len(R) (i, j, k) = (0, 0, 0) while i < nl and j < nr: if L[i] <= R[j]: arr[k] = L[i] k += 1 i += 1 else: arr[k] = R[j] k += 1 j += 1 def exhaust(index, maxIndex, arrIndex, ...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"article_holder": "00_loadarticles.ipynb", "CoverageTrendsLoader": "00_loadarticles.ipynb", "dailysourcepermalinksLoader": "00_loadarticles.ipynb", "describer": "01_descriptive_anal...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'article_holder': '00_loadarticles.ipynb', 'CoverageTrendsLoader': '00_loadarticles.ipynb', 'dailysourcepermalinksLoader': '00_loadarticles.ipynb', 'describer': '01_descriptive_analysis.ipynb', 'predicter': '02_predictive_analysis.ipynb', 'get_mse':...
class ShellException(Exception): def __init__(self, msg): self._msg = msg def __str__(self): return repr(self._msg) class ParseException(Exception): def __init__(self, msg): self._msg = msg def __str__(self): return repr(self._msg) class TreeException(Exception): ...
class Shellexception(Exception): def __init__(self, msg): self._msg = msg def __str__(self): return repr(self._msg) class Parseexception(Exception): def __init__(self, msg): self._msg = msg def __str__(self): return repr(self._msg) class Treeexception(Exception): ...
#!/usr/bin/env python # -*- coding : utf-8 -*- message = "hello python" def say(): print(message)
message = 'hello python' def say(): print(message)
''' Created on 18.05.2018 @author: yvo ''' class DataReader(object): ''' Generic main class of all data reader objects used for the GLAMOS data interface. An inherited data reader object can be specialised for file, database or web-services ... As main object common to all inherited objects ...
""" Created on 18.05.2018 @author: yvo """ class Datareader(object): """ Generic main class of all data reader objects used for the GLAMOS data interface. An inherited data reader object can be specialised for file, database or web-services ... As main object common to all inherited objects ...
def addBorder(picture): pictureWithBorder = [] pictureWithBorder.append('*'*(len(picture[0])+2)) for i in range(len(picture)): pictureWithBorder.append('*' + picture[i] + '*') pictureWithBorder.append('*'*(len(picture[0])+2)) return pictureWithBorder
def add_border(picture): picture_with_border = [] pictureWithBorder.append('*' * (len(picture[0]) + 2)) for i in range(len(picture)): pictureWithBorder.append('*' + picture[i] + '*') pictureWithBorder.append('*' * (len(picture[0]) + 2)) return pictureWithBorder
x = 5 for i in range(1,10, 2): for j in reversed(range(x, x+3)): print("I={} J={}".format(i,j)) x = x + 2
x = 5 for i in range(1, 10, 2): for j in reversed(range(x, x + 3)): print('I={} J={}'.format(i, j)) x = x + 2
key = 5 message = open("encrypted.txt", "r") encrypted = message.read() message.close() print(encrypted) print("DECRYPTED: ", " ") decrypt = [] for i in range(0, len(encrypted)): decrypt.append(ord(encrypted[i]) - key) #decrypt[i] = decrypt[i] - key for i in range(0, len(decrypt)): decrypt[i] = chr(decry...
key = 5 message = open('encrypted.txt', 'r') encrypted = message.read() message.close() print(encrypted) print('DECRYPTED: ', ' ') decrypt = [] for i in range(0, len(encrypted)): decrypt.append(ord(encrypted[i]) - key) for i in range(0, len(decrypt)): decrypt[i] = chr(decrypt[i]) decrypted = open('decrypted.tx...
__author__ = "IceArrow256" __version__ = '4' def union(first, second): result = set() for i in first: result.add(i) for i in second: if i not in result: result.add(i) return result def intersection(first, second): result = set() for i in first: if i in sec...
__author__ = 'IceArrow256' __version__ = '4' def union(first, second): result = set() for i in first: result.add(i) for i in second: if i not in result: result.add(i) return result def intersection(first, second): result = set() for i in first: if i in secon...
__all__ = ["InvalidUnrestrictedGrammarFormatException"] class InvalidUnrestrictedGrammarFormatException(Exception): pass
__all__ = ['InvalidUnrestrictedGrammarFormatException'] class Invalidunrestrictedgrammarformatexception(Exception): pass
def greet(firstName='', middleName='', lastName=''): print('Hello, ' + lastName + ', ' + middleName + ' ' + firstName) greet('Michael', 'G', 'Bay') # supplying parameters in a specific sequence greet('Michael', 'G') # skipping lastName parameter greet() # skipping all parameters # specifying the custom sequen...
def greet(firstName='', middleName='', lastName=''): print('Hello, ' + lastName + ', ' + middleName + ' ' + firstName) greet('Michael', 'G', 'Bay') greet('Michael', 'G') greet() greet(middleName='J', lastName='Damodaran', firstName='Ramkumar')
# Maze in a 85x85 grid # Nodes: 1231 # Edges: 1280 adjList = [ [41, 1], [27, 0], [55, 3], [57, 4, 2], [87, 3], [22, 6], [59, 7, 5], [60, 6], [30, 9], [32, 8], [44, 11], [46, 10], [47, 13], [34, 12], [77, 15], [36, 14], [89, 17], [67, 18, 16], ...
adj_list = [[41, 1], [27, 0], [55, 3], [57, 4, 2], [87, 3], [22, 6], [59, 7, 5], [60, 6], [30, 9], [32, 8], [44, 11], [46, 10], [47, 13], [34, 12], [77, 15], [36, 14], [89, 17], [67, 18, 16], [40, 17], [28], [53, 21], [54, 20], [5], [33, 24], [43, 23], [49, 26], [50, 25], [1, 28], [19, 27], [61, 30], [8, 29], [63, 32],...
global N N = 4 def printSolution(board): for i in range(N): for j in range(N): print (board[i][j], end = " ") print() def isSafe(board, row, col): # Check this row on left side for i in range(col): if board[row][i] == 1: return False # Check upper diagonal on left side for i, j in zip(range(row, -1...
global N n = 4 def print_solution(board): for i in range(N): for j in range(N): print(board[i][j], end=' ') print() def is_safe(board, row, col): for i in range(col): if board[row][i] == 1: return False for (i, j) in zip(range(row, -1, -1), range(col, -1, -1...
marks = int(input("What is you marks in Math: ")) def show_grade(grade): print(f"You got: {grade}") if marks >= 80: show_grade("A+") elif marks >= 70: show_grade("A") elif marks >= 60: show_grade("A-") elif marks >= 50: show_grade("B") elif marks >= 40: show_grade("C") else: show_grade("...
marks = int(input('What is you marks in Math: ')) def show_grade(grade): print(f'You got: {grade}') if marks >= 80: show_grade('A+') elif marks >= 70: show_grade('A') elif marks >= 60: show_grade('A-') elif marks >= 50: show_grade('B') elif marks >= 40: show_grade('C') else: show_grade('F')...
# we are given a 2d matrix of 0s and 1s where 0 represents water and 1 represents land. # any chunk of land disconnected from the borders(edges) of matrix is considered an island. # The task is to remove all the islands from the matrix. # Example # [1, 0, 0, 0, 0, 0] [1, 0, 0, 0, 0, 0] # [0, 1, 0, 1, 1, 1] [0, 0, 0,...
def is_valid(row, col, matrix): return row >= 0 and row < len(matrix) and (col >= 0) and (col < len(matrix[0])) def scan(matrix, row, col, res): if not is_valid(row, col, matrix): return if matrix[row][col] == 0: return if res[row][col] == 1: return res[row][col] = 1 sca...
class Solution: def isValid(self, s): if not s: # empty string is valid return True stack = [] for ch in s: if ch == '(' or ch == '[' or ch == '{': # push opening brackets onto stack stack.append(ch) elif not stack: # if stack is empty then cannot pop needed closing bracket return False # st...
class Solution: def is_valid(self, s): if not s: return True stack = [] for ch in s: if ch == '(' or ch == '[' or ch == '{': stack.append(ch) elif not stack: return False else: x = stack.pop() ...
class DenseNetConfig(object): # number of groups for group normalization numGroups = 8 compressionRate = .5 growthRate = 32 # number of conv blocks numBlocks = [6, 12, 24, 16]
class Densenetconfig(object): num_groups = 8 compression_rate = 0.5 growth_rate = 32 num_blocks = [6, 12, 24, 16]
class WeAre(): fl = False _count = 0 def __init__(self): WeAre.fl = True WeAre._count += 1 WeAre.fl = False @property def count(self): return WeAre._count @count.setter def count(self, value): if WeAre.fl: print("SAS") WeA...
class Weare: fl = False _count = 0 def __init__(self): WeAre.fl = True WeAre._count += 1 WeAre.fl = False @property def count(self): return WeAre._count @count.setter def count(self, value): if WeAre.fl: print('SAS') WeAre._c...
def prestamo(informacion: dict)-> dict: id_prestamo = informacion['id_prestamo'] casado = informacion['casado'] dependientes = informacion['dependientes'] educacion = informacion['educacion'] independiente = informacion['independiente'] ingreso_deudor = informacion['ingreso_deudor'] ic...
def prestamo(informacion: dict) -> dict: id_prestamo = informacion['id_prestamo'] casado = informacion['casado'] dependientes = informacion['dependientes'] educacion = informacion['educacion'] independiente = informacion['independiente'] ingreso_deudor = informacion['ingreso_deudor'] ic = in...
MAJOR = 0 MINOR = 5 MICRO = 2 __version__ = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
major = 0 minor = 5 micro = 2 __version__ = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
if __name__ == '__main__': with open('input', 'r') as file: outputs = [] for line in file.readlines(): vals = line.split('|') outputs.extend(vals[1].split()) print(len([x for x in outputs if len(x) in [2, 3, 4, 7]]))
if __name__ == '__main__': with open('input', 'r') as file: outputs = [] for line in file.readlines(): vals = line.split('|') outputs.extend(vals[1].split()) print(len([x for x in outputs if len(x) in [2, 3, 4, 7]]))
def get_credentials_from_vault(path): # TODO pass
def get_credentials_from_vault(path): pass
def pangram(s): a = "abcdefghijklmnopqrstuvwxyz" for i in a: if i not in s.lower(): return False return True pan_Str = input("Enter the String : ") if(pangram(pan_Str) == True): print("Pangram Exists") else: print("Pangram Not Exists")
def pangram(s): a = 'abcdefghijklmnopqrstuvwxyz' for i in a: if i not in s.lower(): return False return True pan__str = input('Enter the String : ') if pangram(pan_Str) == True: print('Pangram Exists') else: print('Pangram Not Exists')
class Solution: def XXX(self, digits: List[int]) -> List[int]: s = digits[::-1] i = 0 if s[0]+1 < 10: s[0] += 1 else: while s[i]+1 >= 10: s[i] = 0 i += 1 if i != len(s): s[i] += 1 ...
class Solution: def xxx(self, digits: List[int]) -> List[int]: s = digits[::-1] i = 0 if s[0] + 1 < 10: s[0] += 1 else: while s[i] + 1 >= 10: s[i] = 0 i += 1 if i != len(s): s[i] += 1 ...
print(min(1, 2, 3, 4, 0, 2, 1)) print(max([1, 4, 9, 2, 5, 6, 8])) print(abs(-99)) print(abs(42)) print(sum([1, 2, 3, 4, 5]))
print(min(1, 2, 3, 4, 0, 2, 1)) print(max([1, 4, 9, 2, 5, 6, 8])) print(abs(-99)) print(abs(42)) print(sum([1, 2, 3, 4, 5]))
def Setup(Settings,DefaultModel): # set1-test_of_models_against_datasets/osm299.py Settings["experiment_name"] = "set1_Img_model_versus_datasets_299px" Settings["graph_histories"] = ['together'] #['all','together',[],[1,0],[0,0,0],[]] # 5556x_minlen30_640px 5556x_minlen20_640px 5556x_reslen20_299px 5...
def setup(Settings, DefaultModel): Settings['experiment_name'] = 'set1_Img_model_versus_datasets_299px' Settings['graph_histories'] = ['together'] n = 0 Settings['models'][n]['dataset_name'] = '5556x_reslen30_299px' Settings['models'][n]['dump_file_override'] = 'SegmentsData_marked_R100_4Tables.dump...
xs = ( x and x for x in range(10) if x and x )
xs = (x and x for x in range(10) if x and x)
Scale.default = "chromatic" Root.default = 2 Clock.bpm = 120 drp = [0, 7, 12, 17, 21, 26] std = [0, 5, 10, 15, 19, 24] p1 >> play( "<Vs>< n >", sample = 2, ).every(5, "stutter", 2, dur=3) p2 >> play( "{ ppP[pP][Pp]}", sample = PRand(5), rate = PRand([0.5, 1, 2]), ) a1 >> karp( oct = PRand(...
Scale.default = 'chromatic' Root.default = 2 Clock.bpm = 120 drp = [0, 7, 12, 17, 21, 26] std = [0, 5, 10, 15, 19, 24] p1 >> play('<Vs>< n >', sample=2).every(5, 'stutter', 2, dur=3) p2 >> play('{ ppP[pP][Pp]}', sample=p_rand(5), rate=p_rand([0.5, 1, 2])) a1 >> karp(oct=p_rand([4, 5, 6]), dur=1 / 4, hpf=linvar([1000,...
def solveMeFirst(a, b): return a + b print(solveMeFirst(1, 2))
def solve_me_first(a, b): return a + b print(solve_me_first(1, 2))
# -*- coding: utf-8 -*- # @Author: David Hanson # @Date: 2021-01-30 23:30:31 # @Last Modified by: David Hanson # @Last Modified time: 2021-01-31 13:41:39 counter = 0 def inception(): global counter print(counter) if counter > 3: return "done!" counter += 1 return inception() inception(...
counter = 0 def inception(): global counter print(counter) if counter > 3: return 'done!' counter += 1 return inception() inception()
class Vehicle(): def __init__(self, wheels, max_weight, max_volume): self.wheels = wheels self.speed = 0 self._packages = [] self.max_weight = max_weight self.max_volume = max_volume def accelerate(self, amount): self.speed += amount def add_packages(self, packages): if not isinstan...
class Vehicle: def __init__(self, wheels, max_weight, max_volume): self.wheels = wheels self.speed = 0 self._packages = [] self.max_weight = max_weight self.max_volume = max_volume def accelerate(self, amount): self.speed += amount def add_packages(self, pa...
#!/usr/bin/env python # -*- coding: utf-8 -*- def neues_konto(inhaber, kontonummer, kontostand, max_tagesumsatz=1500): return { "Inhaber" : inhaber, "Kontonummer" : kontonummer, "Kontostand" : kontostand, "MaxTagesumsatz" : max_tagesumsatz, "UmsatzHeute" : 0 ...
def neues_konto(inhaber, kontonummer, kontostand, max_tagesumsatz=1500): return {'Inhaber': inhaber, 'Kontonummer': kontonummer, 'Kontostand': kontostand, 'MaxTagesumsatz': max_tagesumsatz, 'UmsatzHeute': 0} def geldtransfer(quelle, ziel, betrag): if betrag < 0 or quelle['UmsatzHeute'] + betrag > quelle['MaxTa...
def first_recurring(data): seen = [] for index in data: if index not in seen: seen.append(index) else: return index return "All unique characters." data = [1, 2, 3, 3, 2, 1, 3] print("first_recurring():", first_recurring(data))
def first_recurring(data): seen = [] for index in data: if index not in seen: seen.append(index) else: return index return 'All unique characters.' data = [1, 2, 3, 3, 2, 1, 3] print('first_recurring():', first_recurring(data))
class Matrix: def __init__(self, matrix_string): self.matrix = [[int(a) for a in line.split()] for line in matrix_string.splitlines()] def row(self, row): return (self.matrix.copy())[row-1] def column(self, col): #return [self.matrix[k][col-1] for k in enumerate(len(self.matrix))] ...
class Matrix: def __init__(self, matrix_string): self.matrix = [[int(a) for a in line.split()] for line in matrix_string.splitlines()] def row(self, row): return self.matrix.copy()[row - 1] def column(self, col): return [k[col - 1] for k in self.matrix] end = matrix('9 8 7\n5 3 2\...
number = input() def get_sums(number): return [sum(list(map(int, filter(lambda x: int(x) % 2 == 0, number)))), sum([int(x) for x in number if int(x) % 2 == 1])] result = get_sums(number) print(f"Odd sum = {result[1]}, Even sum = {result[0]}")
number = input() def get_sums(number): return [sum(list(map(int, filter(lambda x: int(x) % 2 == 0, number)))), sum([int(x) for x in number if int(x) % 2 == 1])] result = get_sums(number) print(f'Odd sum = {result[1]}, Even sum = {result[0]}')
#!/usr/bin/python3 Rectangle = __import__('6-rectangle').Rectangle my_rectangle_1 = Rectangle(2, 4) my_rectangle_2 = Rectangle(2, 4) print("{:d} instances of Rectangle".format(Rectangle.number_of_instances)) del my_rectangle_1 print("{:d} instances of Rectangle".format(Rectangle.number_of_instances)) del my_rectangle_...
rectangle = __import__('6-rectangle').Rectangle my_rectangle_1 = rectangle(2, 4) my_rectangle_2 = rectangle(2, 4) print('{:d} instances of Rectangle'.format(Rectangle.number_of_instances)) del my_rectangle_1 print('{:d} instances of Rectangle'.format(Rectangle.number_of_instances)) del my_rectangle_2 print('{:d} instan...
def export_users(users, workbook, mimic_upload=False): data_prefix = 'data: ' if mimic_upload else 'd.' user_keys = ('user_id', 'username', 'is_active', 'name', 'groups') user_rows = [] fields = set() for user in users: user_row = {} for key in user_keys: if key == 'usern...
def export_users(users, workbook, mimic_upload=False): data_prefix = 'data: ' if mimic_upload else 'd.' user_keys = ('user_id', 'username', 'is_active', 'name', 'groups') user_rows = [] fields = set() for user in users: user_row = {} for key in user_keys: if key == 'usern...
'''[Question 10952] ''' # import sys # while True: # try: # a, b = map(int, sys.stdin.readline().split()) # print(a+b) # except: # break ''' Fail [Question 1110] ''' # import sys # copy = n = int(sys.stdin.readline()) # count = 0 # while True: # a = copy//10 # b = copy%10 # ...
"""[Question 10952] """ ' Fail [Question 1110] ' ' [Question 2562] ' ' [Question 2577] ' ' [Question 3052] ' result_1 = [] for _ in range(10): n = int(input()) n = n % 42 result_1.append(n) result_2 = set(result_1) print(len(result_2))
def get_input(): numbers_dict = {} command = str(input()) while command != "Search": try: number = int(input()) except ValueError: print('The variable number must be an integer') command = str(input()) continue numbers_dict[command] = n...
def get_input(): numbers_dict = {} command = str(input()) while command != 'Search': try: number = int(input()) except ValueError: print('The variable number must be an integer') command = str(input()) continue numbers_dict[command] = n...
#!/usr/bin/python def web_socket_do_extra_handshake(request): request.ws_protocol = 'foobar' def web_socket_transfer_data(request): pass
def web_socket_do_extra_handshake(request): request.ws_protocol = 'foobar' def web_socket_transfer_data(request): pass
# # This file contains constants and methods for configurations in the # TinkerSpaceCommand server. # CONFIG_NAME_EXTERNAL_ID = "externalId" CONFIG_NAME_NAME = "name" CONFIG_NAME_DESCRIPTION = "description" CONFIG_NAME_MEASUREMENT_TYPE = "measurementType" CONFIG_NAME_MEASUREMENT_UNIT = "measurementUnit" CONFIG_N...
config_name_external_id = 'externalId' config_name_name = 'name' config_name_description = 'description' config_name_measurement_type = 'measurementType' config_name_measurement_unit = 'measurementUnit' config_name_sensor_id = 'sensorId' config_name_sensed_id = 'sensedId' config_name_channel_ids = 'channelIds' config_v...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def pseudoPalindromicPaths (self, root: TreeNode) -> int: counter = [0] * 10 self.cnt = 0 ...
class Solution: def pseudo_palindromic_paths(self, root: TreeNode) -> int: counter = [0] * 10 self.cnt = 0 def dfs(node, counter): if node is not None: counter[node.val] += 1 if node.left is None and node.right is None: if sum...
__version__ = "0.3.3" def version(): return __version__
__version__ = '0.3.3' def version(): return __version__
registry = {} def access(key): return registry[key]
registry = {} def access(key): return registry[key]
# https://en.bitcoin.it/wiki/Secp256k1 _p = 115792089237316195423570985008687907853269984665640564039457584007908834671663 _n = 115792089237316195423570985008687907852837564279074904382605163141518161494337 _a = 0 _b = 7 _gx = int("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", 16) _gy = int("483ada...
_p = 115792089237316195423570985008687907853269984665640564039457584007908834671663 _n = 115792089237316195423570985008687907852837564279074904382605163141518161494337 _a = 0 _b = 7 _gx = int('79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', 16) _gy = int('483ada7726a3c4655da4fbfc0e1108a8fd17b448a6855...
# Print the result of 9 / 2 print(9 / 2) # Print the result of 7 * 5 print(7 * 5) # Print the remainder of 5 divided by 2 using % print(5 % 2)
print(9 / 2) print(7 * 5) print(5 % 2)
# print the tuples for the conflict_table inputs def print_lines(l): for e in l: l2 = l[:] l2.remove(e) for f in l2: l3 = l2[:] l3.remove(f) for g in l3: l4 = l3[:] l4.remove(g) for h in l4: ...
def print_lines(l): for e in l: l2 = l[:] l2.remove(e) for f in l2: l3 = l2[:] l3.remove(f) for g in l3: l4 = l3[:] l4.remove(g) for h in l4: print((e, f, g, h)) print_lines(['g0', 'g1', '...
# COLORS BLACK = (0, 0, 0) # Black WHITE = (255, 255, 255) # White YELLOW = (255, 255, 0) # Yellow RED = (255, 0, 0) # SCREEN WIDTH, HEIGHT = (1000, 800) # Screen dims SCREEN_DIMS = (WIDTH, HEIGHT) CENTER = (WIDTH // 2, HEIGHT // 2) # GAME OPTIONS FPS = 60 PLAYER_SPEED = 1.01 PLAYER_COORD = [ (CENTER[0] - 10, C...
black = (0, 0, 0) white = (255, 255, 255) yellow = (255, 255, 0) red = (255, 0, 0) (width, height) = (1000, 800) screen_dims = (WIDTH, HEIGHT) center = (WIDTH // 2, HEIGHT // 2) fps = 60 player_speed = 1.01 player_coord = [(CENTER[0] - 10, CENTER[1]), (CENTER[0] + 10, CENTER[1]), (CENTER[0], CENTER[1] - 25)] player_sen...
bole=True n=0 while n<=30: n=n+1 print(f'ola turma{n}') break print('passou')
bole = True n = 0 while n <= 30: n = n + 1 print(f'ola turma{n}') break print('passou')
#from cryptomath import * #import Cryptoalphabet as ca #alpha = ca.Cryptoalphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ") def affine_encode(plaintext, a, b): process = "" cipherFinal = "" modulusValue = len(alphabet) #removes punctuation from plaintext for s in plaintext: if s!= '.' and s!= ',' and s!= ' ' and s!= '!' an...
def affine_encode(plaintext, a, b): process = '' cipher_final = '' modulus_value = len(alphabet) for s in plaintext: if s != '.' and s != ',' and (s != ' ') and (s != '!') and (s != '?') and (s != "'"): process += s process = process.upper() for letter in process: ind...
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") results = dict() def solution(N): # write your code in Python 3.6 # 1000000 if N in results: return results[N] else: result = f_series(N) results[N] = result return result def f...
results = dict() def solution(N): if N in results: return results[N] else: result = f_series(N) results[N] = result return result def f_series(n): if n < 2: return n elif n in results: return results[n] else: result = (f_series(n - 1) + f_ser...
def isgore(a,b): nbr1=int(a+b) nbr2=int(b+a) return nbr1>=nbr2 def largest_number(a): res = "" while len(a)!=0: mx=0 for x in a: if isgore(str(x),str(mx)): mx=x res+=str(mx) a.remove(mx) return res n = int(input()) a = list(map(int,...
def isgore(a, b): nbr1 = int(a + b) nbr2 = int(b + a) return nbr1 >= nbr2 def largest_number(a): res = '' while len(a) != 0: mx = 0 for x in a: if isgore(str(x), str(mx)): mx = x res += str(mx) a.remove(mx) return res n = int(input()) ...
weight=1 a = _State('hh', 'naziv') def run(): @_spawn(_name='haha') def _(): #with _while(1): _label('a') _goto('a') _label('b') p1=nazadp.picked() p2=napredp.picked() sleep(0.1) @_do def _(): # print('drzi ', hex(p1.val), hex(p2.val)) print('drzi ', p1.val, p2.val) _goto('b') for i in ran...
weight = 1 a = __state('hh', 'naziv') def run(): @_spawn(_name='haha') def _(): _label('a') _goto('a') _label('b') p1 = nazadp.picked() p2 = napredp.picked() sleep(0.1) @_do def _(): print('drzi ', p1.val, p2.val) _goto('b') ...
name = 'Abid' age = 25 salary = 15.5 # Earning in Ks print(name, age, salary) print(' My name is ' + name + ' and my age is ' + str(age) + ' and I earn ' + str(salary) + 'K per month')
name = 'Abid' age = 25 salary = 15.5 print(name, age, salary) print(' My name is ' + name + ' and my age is ' + str(age) + ' and I earn ' + str(salary) + 'K per month')
class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKCYAN = '\033[96m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' lista = list() espacios = 0 print(bcolors.BOLD, "Programa que calcula la longitud de un ...
class Bcolors: header = '\x1b[95m' okblue = '\x1b[94m' okcyan = '\x1b[96m' okgreen = '\x1b[92m' warning = '\x1b[93m' fail = '\x1b[91m' endc = '\x1b[0m' bold = '\x1b[1m' underline = '\x1b[4m' lista = list() espacios = 0 print(bcolors.BOLD, 'Programa que calcula la longitud de un texto...
def create_rooted_spanning_tree(G, root): def s_rec(root, S): for node in G[root]: if node in S: if root not in S[node]: S.setdefault(root, {})[node] = 'red' S[node][root] = 'red' else: S.setdefault(root, {})[nod...
def create_rooted_spanning_tree(G, root): def s_rec(root, S): for node in G[root]: if node in S: if root not in S[node]: S.setdefault(root, {})[node] = 'red' S[node][root] = 'red' else: S.setdefault(root, {})[no...
# -*- coding: utf-8 -*- def test1(): print("test1") def test2(): print("test2")
def test1(): print('test1') def test2(): print('test2')
# This is an AWESOME LIBRARY. # You can use its AWESOME CLASSES to do Great Things. # The author however DOESN'T allow you to CHANGE the source code and taint it with Pyro decorators! class WeirdReturnType(object): def __init__(self, value): self.value = value class AwesomeClass(object): def method(...
class Weirdreturntype(object): def __init__(self, value): self.value = value class Awesomeclass(object): def method(self, arg): print('Awesome object is called with: ', arg) return 'awesome' def private(self): print('This should be a private method...') return 'bo...
class Song: def __init__(self, name, lenght, single): self.name = name self.lenght = lenght self.single = single def get_info(self): return f"{self.name} - {self.lenght}"
class Song: def __init__(self, name, lenght, single): self.name = name self.lenght = lenght self.single = single def get_info(self): return f'{self.name} - {self.lenght}'
class BaseEngine(object): database = '' def __init__(self, databaseName="epubdb"): self.databaseName = databaseName self.databasePath = "databases/" + databaseName self.open() pass def open(self): ''' Opens the database for reading ''' p...
class Baseengine(object): database = '' def __init__(self, databaseName='epubdb'): self.databaseName = databaseName self.databasePath = 'databases/' + databaseName self.open() pass def open(self): """ Opens the database for reading """ pass ...
a, b, c = [int(x) for x in input().split()] if a >= b >= c: print(c, b, a, sep='\n') elif a >= c >= b: print(b, c, a, sep='\n') elif b >= a >= c: print(c, a, b, sep='\n') elif b >= c >= a: print(a, c, b, sep='\n') elif c >= a >= b: print(b, a, c, sep='\n') elif c >= b >= a: print(a, b, c, sep='...
(a, b, c) = [int(x) for x in input().split()] if a >= b >= c: print(c, b, a, sep='\n') elif a >= c >= b: print(b, c, a, sep='\n') elif b >= a >= c: print(c, a, b, sep='\n') elif b >= c >= a: print(a, c, b, sep='\n') elif c >= a >= b: print(b, a, c, sep='\n') elif c >= b >= a: print(a, b, c, sep=...
class ListNode: def __init__(self, x): self.x = x self.val = x self.next = None class PointNode: def __init__(self, x, y): self.x = x self.y = y # Definition for singly-linked list with a random pointer. class RandomListNode: def __init__(self, x): self.labe...
class Listnode: def __init__(self, x): self.x = x self.val = x self.next = None class Pointnode: def __init__(self, x, y): self.x = x self.y = y class Randomlistnode: def __init__(self, x): self.label = x self.next = None self.random = Non...
class OTMSConfig(object): MYSQL_DATABASE_USER = 'root' MYSQL_DATABASE_PASSWORD = '' MYSQL_DATABASE_DB = 'otms' MYSQL_DATABASE_PORT = '3308' MYSQL_DATABASE_HOST = 'localhost'
class Otmsconfig(object): mysql_database_user = 'root' mysql_database_password = '' mysql_database_db = 'otms' mysql_database_port = '3308' mysql_database_host = 'localhost'
# # Simple Image # # Copyright 2017, Adam Edwards # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
class Simpleimage: def __init__(self, width, height, is_sparse=False, default_color=0): self.__width = width self.__height = height self.__sparse_size = 0 self.__default_color = default_color self.__is_sparse = is_sparse self.__sparse_map = {} self.__image_da...
''' Created on 09.03.2019 @author: Nicco ''' class act_base(object): ''' providing all the methods to connect to the simulator, and plan ''' def __init__(self, params): ''' Constructor '''
""" Created on 09.03.2019 @author: Nicco """ class Act_Base(object): """ providing all the methods to connect to the simulator, and plan """ def __init__(self, params): """ Constructor """
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold(s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s ...
def f_gold(s): maxvalue = 0 i = 1 for i in range(s - 1): j = 1 for j in range(s): k = s - i - j maxvalue = max(maxvalue, i * j * k) return maxvalue if __name__ == '__main__': param = [(67,), (48,), (59,), (22,), (14,), (66,), (1,), (75,), (58,), (78,)] n_s...