content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Solution: def isSolvable(self, words, result) -> bool: for word in words: if len(word) > len(result): return False words = [word[::-1] for word in words] result = result[::-1] c2i = [-1] * 26 i2c = [False] * 10 def dfs(idx, digit, s)...
class Solution: def is_solvable(self, words, result) -> bool: for word in words: if len(word) > len(result): return False words = [word[::-1] for word in words] result = result[::-1] c2i = [-1] * 26 i2c = [False] * 10 def dfs(idx, digit, ...
""" Script to find positive array with max sum """ class MaxSumSubArray(): """ # @param A : list of integers # @return a list of integers """ def maxsub(self, A): """ Function """ if not isinstance(A, (tuple, list)): A = tuple([A]) n = len(A) ...
""" Script to find positive array with max sum """ class Maxsumsubarray: """ # @param A : list of integers # @return a list of integers """ def maxsub(self, A): """ Function """ if not isinstance(A, (tuple, list)): a = tuple([A]) n = len(A) ...
def findMin(l): min = -1 for i in l: print (i) if i<min: min = i print("the lowest value is: ",min) l=[12,0,15,-30,-24,40] findMin(l)
def find_min(l): min = -1 for i in l: print(i) if i < min: min = i print('the lowest value is: ', min) l = [12, 0, 15, -30, -24, 40] find_min(l)
{ "targets": [ { "target_name": "towerdef", "sources": [ "./cpp/towerdef_Main.cpp", "./cpp/towerdef.cpp", "./cpp/towerdef_Map.cpp", "./cpp/towerdef_PathMap.cpp", "./cpp/towerdef_Structure.cpp", "./cpp/...
{'targets': [{'target_name': 'towerdef', 'sources': ['./cpp/towerdef_Main.cpp', './cpp/towerdef.cpp', './cpp/towerdef_Map.cpp', './cpp/towerdef_PathMap.cpp', './cpp/towerdef_Structure.cpp', './cpp/towerdef_oneTileStruct.cpp', './cpp/towerdef_Struct_Wall.cpp', './cpp/Grid.cpp', './cpp/GameMap.cpp', './cpp/PointList.cpp'...
def main(): T = int(input()) case_id = 1 while case_id <= T: num = int(input()) if num == 0: print("Case #{case_id}: INSOMNIA".format(case_id=case_id)) case_id += 1 continue all_nums = [] res = 0 cur_num = num while...
def main(): t = int(input()) case_id = 1 while case_id <= T: num = int(input()) if num == 0: print('Case #{case_id}: INSOMNIA'.format(case_id=case_id)) case_id += 1 continue all_nums = [] res = 0 cur_num = num while len(all_...
#POO 2 - POLIFORMISMO # class Coche(): def desplazamiento(self): print("Me desplazo utilizando cuatro ruedas") class Moto(): def desplazamiento(self): print("Me Desplazo utilizando dos Ruedas") class Camion(): def desplazamiento(self): print("Me Desplazo utilizando seis Rue...
class Coche: def desplazamiento(self): print('Me desplazo utilizando cuatro ruedas') class Moto: def desplazamiento(self): print('Me Desplazo utilizando dos Ruedas') class Camion: def desplazamiento(self): print('Me Desplazo utilizando seis Ruedas') def desplazamientovehiculo(v...
a=int(input('Enter first number:')) b=int(input('Enter second number:')) a=a+b b=a-b a=a-b print('After swaping first number is=',a) print('After swaping second number is=',b)
a = int(input('Enter first number:')) b = int(input('Enter second number:')) a = a + b b = a - b a = a - b print('After swaping first number is=', a) print('After swaping second number is=', b)
# automatically generated by the FlatBuffers compiler, do not modify # namespace: papi class Side(object): Sell = -1 None_ = 0 Buy = 1
class Side(object): sell = -1 none_ = 0 buy = 1
class DriverTarget: bone_target = None data_path = None id = None id_type = None transform_space = None transform_type = None
class Drivertarget: bone_target = None data_path = None id = None id_type = None transform_space = None transform_type = None
N = int(input()) road_ends = [] barns_list = [] for x in range(0, N): barns_list.append(x) for x in range(0, N): road_ends.append(-1) for x in range(0, N-1): temp_list = input().split() road_ends[int(temp_list[1])-1] = int(temp_list[0])-1 for x in range(0, N): wasthere = [] ...
n = int(input()) road_ends = [] barns_list = [] for x in range(0, N): barns_list.append(x) for x in range(0, N): road_ends.append(-1) for x in range(0, N - 1): temp_list = input().split() road_ends[int(temp_list[1]) - 1] = int(temp_list[0]) - 1 for x in range(0, N): wasthere = [] for y in range(...
def grade(arg, key): if "flag{1_h4v3_4_br41n}".lower() == key.lower(): return True, "You are not insane!" else: return False, "..."
def grade(arg, key): if 'flag{1_h4v3_4_br41n}'.lower() == key.lower(): return (True, 'You are not insane!') else: return (False, '...')
def selection_form(data, target, name, radio=False): body = '' for i in data: body += '<input value="{0}" name="{1}" type="{2}"> {0}</br>'.format(i, name, 'radio' if radio else 'checkbox') body += '</br><input type="submit" value="Submit">' return '<form method="post" action="{0}">{1}</form>'.format(target, body)...
def selection_form(data, target, name, radio=False): body = '' for i in data: body += '<input value="{0}" name="{1}" type="{2}"> {0}</br>'.format(i, name, 'radio' if radio else 'checkbox') body += '</br><input type="submit" value="Submit">' return '<form method="post" action="{0}">{1}</form>'.fo...
def resolve(): ''' code here ''' N = int(input()) As = [int(item) for item in input().split()] Bs = [int(item) for item in input().split()] Ds = [a - b for a, b in zip(As, Bs)] cnt_minus = 0 total_minus = 0 minus_list = [] cnt_plus_to_drow = 0 plus_list = [] for i...
def resolve(): """ code here """ n = int(input()) as = [int(item) for item in input().split()] bs = [int(item) for item in input().split()] ds = [a - b for (a, b) in zip(As, Bs)] cnt_minus = 0 total_minus = 0 minus_list = [] cnt_plus_to_drow = 0 plus_list = [] for ite...
# We your solution for 1.4 here! def is_prime(x): t=1 while t<x: if x%t==0: if t!=1 and t!=x: return False t=t+1 return True print(is_prime(5191))
def is_prime(x): t = 1 while t < x: if x % t == 0: if t != 1 and t != x: return False t = t + 1 return True print(is_prime(5191))
{ "targets": [ { "target_name": "knit_decoder", "sources": ["src/main.cpp", "src/context.hpp", "src/worker.hpp"], "include_dirs" : [ "<!(node -e \"require('nan')\")" ], "cflags_cc!": ["-fno-rtti", "-fno-exceptions"], "cflags!": ["-fno-exceptions", "-Wall", "-std=c++11"]...
{'targets': [{'target_name': 'knit_decoder', 'sources': ['src/main.cpp', 'src/context.hpp', 'src/worker.hpp'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'cflags_cc!': ['-fno-rtti', '-fno-exceptions'], 'cflags!': ['-fno-exceptions', '-Wall', '-std=c++11'], 'xcode_settings': {'OTHER_CPLUSPLUSFLAGS': ['-std=c++1...
""" :authors: v.oficerov :license: MIT :copyrighting: 2022 www.sqa.engineer """ __author__ = 'v.oficerov' __version__ = '0.3.1' __email__ = 'valeryoficerov@gmail.com'
""" :authors: v.oficerov :license: MIT :copyrighting: 2022 www.sqa.engineer """ __author__ = 'v.oficerov' __version__ = '0.3.1' __email__ = 'valeryoficerov@gmail.com'
class Properties: def __init__(self, client): self.client = client def search(self, params={}): url = '/properties' property_params = {'property': params} return self.client.request('GET', url, property_params)
class Properties: def __init__(self, client): self.client = client def search(self, params={}): url = '/properties' property_params = {'property': params} return self.client.request('GET', url, property_params)
class Solution: def longestPalindrome(self, s: str) -> int: total = 0 for i in collections.Counter(list(s)).values(): total += i // 2 * 2 if i % 2 == 1 and total % 2 == 0: total += 1 return total
class Solution: def longest_palindrome(self, s: str) -> int: total = 0 for i in collections.Counter(list(s)).values(): total += i // 2 * 2 if i % 2 == 1 and total % 2 == 0: total += 1 return total
def build_question_context(rendered_block, form): question = rendered_block["question"] context = { "block": rendered_block, "form": { "errors": form.errors, "question_errors": form.question_errors, "mapped_errors": form.map_errors(), "answer_erro...
def build_question_context(rendered_block, form): question = rendered_block['question'] context = {'block': rendered_block, 'form': {'errors': form.errors, 'question_errors': form.question_errors, 'mapped_errors': form.map_errors(), 'answer_errors': {}, 'fields': {}}} answer_ids = [] for answer in quest...
class Product: def __init__(self, id, isOwner, name, description, main_img): self.id = id self.isOwner = isOwner self.name = name self.description = description self.main_img = main_img self.images = [] self.stock = {} self.price = {} def add_imag...
class Product: def __init__(self, id, isOwner, name, description, main_img): self.id = id self.isOwner = isOwner self.name = name self.description = description self.main_img = main_img self.images = [] self.stock = {} self.price = {} def add_ima...
# File: difference_of_squares.py # Purpose: To find th difference of squares of first n numbers # Programmer: Amal Shehu # Course: Exercism # Date: Saturday 3rd September 2016, 01:50 PM def sum_of_squares(number): return sum([i**2 for i in range(1, number+1)]) def square_of_sum(number): ...
def sum_of_squares(number): return sum([i ** 2 for i in range(1, number + 1)]) def square_of_sum(number): return sum(range(1, number + 1)) ** 2 def difference(number): return square_of_sum(number) - sum_of_squares(number)
class InvalidOperationError(BaseException): pass class Node(): def __init__(self, value, next = None): self.value = value self.next = next class AnimalShelter(): def __init__(self): self.front = None self.rear = None def __str__(self): # FRONT -> { a } -> {...
class Invalidoperationerror(BaseException): pass class Node: def __init__(self, value, next=None): self.value = value self.next = next class Animalshelter: def __init__(self): self.front = None self.rear = None def __str__(self): if self.front == None: ...
#!/usr/bin/env python3 """Adds commands that need to be executed after the container starts.""" ENTRYPOINT_FILE = "/usr/local/bin/docker-entrypoint.sh" UPDATE_HOSTS_COMMAND = ("echo 127.0.0.1 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10" " >> /etc/hosts\n") RUN_SSHD_COMMAND = "/usr/sbin/sshd\n" EXEC_LINE ...
"""Adds commands that need to be executed after the container starts.""" entrypoint_file = '/usr/local/bin/docker-entrypoint.sh' update_hosts_command = 'echo 127.0.0.1 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 >> /etc/hosts\n' run_sshd_command = '/usr/sbin/sshd\n' exec_line = 'exec "$@"\n' def main(): with open(ENTRYPOINT_FI...
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # If-else-if flow control. marks = 84 if 80 < marks and 100 >= marks: print("A") elif 60 < marks and 80 >= marks: print("B") elif 50 < marks and 60 >= marks: print("C") elif 35 < marks and 50 >= marks: print("S") else: print("F") # Iteration/loop flo...
marks = 84 if 80 < marks and 100 >= marks: print('A') elif 60 < marks and 80 >= marks: print('B') elif 50 < marks and 60 >= marks: print('C') elif 35 < marks and 50 >= marks: print('S') else: print('F') my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] for num in my_list: print(num) for num in my_list: ...
symbol748 = {} def _update(code_748, code_gbk, numchars): for i in range(numchars): symbol748[code_748 + i] = code_gbk + i _update(0x8EFF, 0x8E8F, 1) # 8EFF -> 8E8F _update(0x94FF, 0x94DA, 1) # 94FF -> 94DA _update(0x95FF, 0x95F1, 1) # 95FF -> 95F1 _update(0x9680, 0xB17E, 1) # 9680 -> B17E _update...
symbol748 = {} def _update(code_748, code_gbk, numchars): for i in range(numchars): symbol748[code_748 + i] = code_gbk + i _update(36607, 36495, 1) _update(38143, 38106, 1) _update(38399, 38385, 1) _update(38528, 45438, 1) _update(38529, 46206, 1) _update(38530, 46462, 1) _update(38531, 45665, 1) _update(4...
# The method below seems to yield correct result but will end in TLE for large cases. # def candy(ratings) -> int: # n = len(ratings) # candies = [0]*n # while True: # changed = False # for i in range(1, n): # if ratings[i-1] < ratings[i] and candies[i-1]...
def candy(ratings) -> int: n = len(ratings) last_one = 1 num_candies = 1 last_le = 0 last_big_diff = [] for i in range(1, n): if ratings[i] > ratings[i - 1]: num_candies += last_one + 1 last_one += 1 last_le = i elif ratings[i] == ratings[i - 1...
def InsertionSort(array): for i in range(1,len(array)): current = array[i] j = i-1 while(j >= 0 and current < array[j]): array[j+1] = array[j] j -= 1 array[j+1] = current array = [32,33,1,0,23,98,-19,15,7,-52,76] print("Before sort: ") print(*array,sep=', ') print("After sort: ") InsertionSort(array) pri...
def insertion_sort(array): for i in range(1, len(array)): current = array[i] j = i - 1 while j >= 0 and current < array[j]: array[j + 1] = array[j] j -= 1 array[j + 1] = current array = [32, 33, 1, 0, 23, 98, -19, 15, 7, -52, 76] print('Before sort: ') print(*...
"""Skylark extension for terraform_sut_component.""" load("//skylark:toolchains.bzl", "toolchain_container_images") load("//skylark:integration_tests.bzl", "sut_component") def terraform_sut_component(name, tf_files, setup_timeout_seconds=None, teardown_timeout_seconds=None): # Create a list of terraform file locat...
"""Skylark extension for terraform_sut_component.""" load('//skylark:toolchains.bzl', 'toolchain_container_images') load('//skylark:integration_tests.bzl', 'sut_component') def terraform_sut_component(name, tf_files, setup_timeout_seconds=None, teardown_timeout_seconds=None): tf_files_loc = ','.join(['$(location %...
class JobErrorCode: """ Error Codes returned by Job related operations """ NoError = 0 JobNotFound = 1 MultipleJobsFound = 2 JobFailed = 3 SubmitNotAllowed = 4 ErrorOccurred = 5 InternalSchedulerError = 6 JobUnsanitary = 7 Executable...
class Joberrorcode: """ Error Codes returned by Job related operations """ no_error = 0 job_not_found = 1 multiple_jobs_found = 2 job_failed = 3 submit_not_allowed = 4 error_occurred = 5 internal_scheduler_error = 6 job_unsanitary = 7 executable_invalid = 8 job_held = 9 p...
HTTP_OK = 200 HTTP_UNAUTHORIZED = 401 HTTP_FOUND = 302 HTTP_BAD_REQUEST = 400 HTTP_NOT_FOUND = 404 HTTP_SERVICE_UNAVAILABLE = 503
http_ok = 200 http_unauthorized = 401 http_found = 302 http_bad_request = 400 http_not_found = 404 http_service_unavailable = 503
x=int(input("enter x1")) y=int(input("enter x2")) c=x*y print(c)
x = int(input('enter x1')) y = int(input('enter x2')) c = x * y print(c)
coordinates_E0E1E1 = ((126, 112), (126, 114), (126, 115), (126, 130), (126, 131), (127, 113), (127, 115), (127, 131), (128, 92), (128, 115), (128, 116), (128, 121), (128, 131), (129, 92), (129, 116), (129, 118), (129, 119), (129, 131), (130, 92), (130, 117), (130, 122), (130, 131), (131, 87), (131, 89), (131, 90), (1...
coordinates_e0_e1_e1 = ((126, 112), (126, 114), (126, 115), (126, 130), (126, 131), (127, 113), (127, 115), (127, 131), (128, 92), (128, 115), (128, 116), (128, 121), (128, 131), (129, 92), (129, 116), (129, 118), (129, 119), (129, 131), (130, 92), (130, 117), (130, 122), (130, 131), (131, 87), (131, 89), (131, 90), (1...
books = input().split("&") while True: commands = input().split(" | ") if commands[0] == "Done": print(", ".join(books)) break elif commands[0] == "Add Book": book_name = commands[1] if book_name not in books: ins = books.insert(0, book_name) else: ...
books = input().split('&') while True: commands = input().split(' | ') if commands[0] == 'Done': print(', '.join(books)) break elif commands[0] == 'Add Book': book_name = commands[1] if book_name not in books: ins = books.insert(0, book_name) else: ...
''' This utility is for Custom Exceptions. a) Stop_Test_Exception You can raise a generic exceptions using just a string. This is particularly useful when you want to end a test midway based on some condition. ''' class Stop_Test_Exception(Exception): def __init__(self,message): self.message=message ...
""" This utility is for Custom Exceptions. a) Stop_Test_Exception You can raise a generic exceptions using just a string. This is particularly useful when you want to end a test midway based on some condition. """ class Stop_Test_Exception(Exception): def __init__(self, message): self.message = message ...
class Node: def __init__(self, value): self.val = value self.next = self.prev = None class MyLinkedList(object): def __init__(self): self.__head = self.__tail = Node(-1) self.__head.next = self.__tail self.__tail.prev = self.__head self.__size = 0 def get(...
class Node: def __init__(self, value): self.val = value self.next = self.prev = None class Mylinkedlist(object): def __init__(self): self.__head = self.__tail = node(-1) self.__head.next = self.__tail self.__tail.prev = self.__head self.__size = 0 def get(...
class NotFound(Exception): pass class HTTPError(Exception): pass
class Notfound(Exception): pass class Httperror(Exception): pass
#!/usr/bin/env python """Common constants.""" IO_CHUNK_SIZE = 128
"""Common constants.""" io_chunk_size = 128
#!/usr/bin/python # -*- coding: utf-8 -*- __author__ = 'liyiqun' # microsrv_linkstat_url = 'http://127.0.0.1:32769/microsrv/link_stat' # microsrv_linkstat_url = 'http://127.0.0.1:33710/microsrv/link_stat' # microsrv_linkstat_url = 'http://10.9.63.208:7799/microsrv/ms_link/link/links' # microsrv_linkstat_url = '...
__author__ = 'liyiqun' te_flow_rest_port = 34770 te_sched_rest_port = 34773 te_protocol = 'http://' te_host_port_divider = ':' openo_ms_url_prefix = '/openoapi/microservices/v1/services' openo_dm_url_prefix = '/openoapi/drivermgr/v1/drivers' openo_esr_url_prefix = '/openoapi/extsys/v1/sdncontrollers' openo_brs_url_pref...
class EvaluationFactory: factories = {} @staticmethod def add_factory(name, evaluation_factory): """ Add a EvaluationFactory into all the factories :param name: the name of the factory :param evaluation_factory: the instance of the factory """ EvaluationFacto...
class Evaluationfactory: factories = {} @staticmethod def add_factory(name, evaluation_factory): """ Add a EvaluationFactory into all the factories :param name: the name of the factory :param evaluation_factory: the instance of the factory """ EvaluationFacto...
class QgisCtrl(): def __init__(self, iface): super(QgisCtrl, self).__init__() self.iface = iface
class Qgisctrl: def __init__(self, iface): super(QgisCtrl, self).__init__() self.iface = iface
def add_numbers(a, b): return a + b def two_n_plus_one(a): return 2 * a + 1
def add_numbers(a, b): return a + b def two_n_plus_one(a): return 2 * a + 1
conversation_property_create = """ <config> <host-table xmlns="urn:brocade.com:mgmt:brocade-arp"> <aging-mode> <conversational></conversational> </aging-mode> <aging-time> <conversational-timeout>{{arp_aging_timeout}}</conversational-timeout> </aging-tim...
conversation_property_create = '\n<config>\n <host-table xmlns="urn:brocade.com:mgmt:brocade-arp">\n <aging-mode>\n <conversational></conversational>\n </aging-mode>\n <aging-time>\n <conversational-timeout>{{arp_aging_timeout}}</conversational-timeout>\n </agi...
''' ## Question ### 13. [Roman to Integer](https://leetcode.com/problems/palindrome-number/) 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, `two` is written as `II` in Rom...
""" ## Question ### 13. [Roman to Integer](https://leetcode.com/problems/palindrome-number/) 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, `two` is written as `II` in Rom...
# Lesson 2 class FakeSocket: # These variables belong to the CLASS, not the instance! DEFAULT_IP = '127.0.0.1' DEFAULT_PORT = 12345 # instance methods can access instance, class, and static variables and methods. def __init__(self, ip=DEFAULT_IP, port=DEFAULT_PORT): # These variables belong...
class Fakesocket: default_ip = '127.0.0.1' default_port = 12345 def __init__(self, ip=DEFAULT_IP, port=DEFAULT_PORT): if self.ip_is_valid(ip): self._ip = ip else: self._ip = FakeSocket.DEFAULT_IP self._ip = self.__class__.DEFAULT_IP self._port = p...
class CacheItem: def __init__(self, id, value, compValue=1, order = 1) -> None: self.id = id self.compValue = compValue self.value = value self.order = order class PriorityQueue: items = [] def add(self, item: CacheItem): self.items.append(item) se...
class Cacheitem: def __init__(self, id, value, compValue=1, order=1) -> None: self.id = id self.compValue = compValue self.value = value self.order = order class Priorityqueue: items = [] def add(self, item: CacheItem): self.items.append(item) self.sort() ...
def greaterThan(a, b): flag = True count = 0 for i in range(3): if a[i] < b[i]: flag = False break if a[i] > b[i]: count += 1 if not flag or count < 1: return False else: return True t = int(input()) for _ in range(t): l = [] for i in range(3): l.append(list(map(int,...
def greater_than(a, b): flag = True count = 0 for i in range(3): if a[i] < b[i]: flag = False break if a[i] > b[i]: count += 1 if not flag or count < 1: return False else: return True t = int(input()) for _ in range(t): l = [] ...
i = 11 print(i) j = 12 print(j) f = 12.34 print(f) g = -0.99 print(g) s = "Hello, World" print(s) print(s[0]) print(s[:5]) print(s[7:12]) l = [2,3,4,5,7,11] print(l)
i = 11 print(i) j = 12 print(j) f = 12.34 print(f) g = -0.99 print(g) s = 'Hello, World' print(s) print(s[0]) print(s[:5]) print(s[7:12]) l = [2, 3, 4, 5, 7, 11] print(l)
# https://leetcode.com/problems/best-time-to-buy-and-sell-stock/ class Solution: def maxProfit(self, prices: list[int]) -> int: max_price = prices[-1] max_profit = 0 idx = len(prices) - 2 # Start from the penultimate item while idx >= 0: curr_price = prices[idx] ...
class Solution: def max_profit(self, prices: list[int]) -> int: max_price = prices[-1] max_profit = 0 idx = len(prices) - 2 while idx >= 0: curr_price = prices[idx] profit = max_price - curr_price if profit > max_profit: max_profit...
##### CLASSE ARBRE ##### class Arbre: #Initialise l'arbre def __init__(self): #Valeur de l'arbre self.valeur = 0 #Fils gauche self.gauche = None #Fils droit self.droit = None #Position de l'arbre self.position = Position() def __str__(self): return "["+s...
class Arbre: def __init__(self): self.valeur = 0 self.gauche = None self.droit = None self.position = position() def __str__(self): return '[' + str(self.gauche) + ',' + str(self.droit) + ']' def __len__(self): return len(self.gauche) + len(self.droit) ...
class Topology: """Heat exchanger topology data""" def __init__(self, exchanger_addresses, case_study, number): self.number = number # Initial heat exchanger topology self.initial_hot_stream = int(case_study.initial_exchanger_address_matrix['HS'][number] - 1) self.initial_cold_...
class Topology: """Heat exchanger topology data""" def __init__(self, exchanger_addresses, case_study, number): self.number = number self.initial_hot_stream = int(case_study.initial_exchanger_address_matrix['HS'][number] - 1) self.initial_cold_stream = int(case_study.initial_exchanger_a...
class A: def func(): pass class B: def func(): pass class C(B,A): pass c=C() c.func()
class A: def func(): pass class B: def func(): pass class C(B, A): pass c = c() c.func()
class Graph: def __init__(self, nodes): self.node = {i: set([]) for i in range(nodes)} def addEdge(self, src, dest, dir=False): self.node[src].add(dest) if not dir: self.node[dest].add(src) # for undirected edges class Solution: def hasCycle(self, graph): whitese...
class Graph: def __init__(self, nodes): self.node = {i: set([]) for i in range(nodes)} def add_edge(self, src, dest, dir=False): self.node[src].add(dest) if not dir: self.node[dest].add(src) class Solution: def has_cycle(self, graph): whiteset = set(graph.node...
"""Binance Module for XChainPY Clients .. moduleauthor:: Thorchain """ __version__ = '0.2.3'
"""Binance Module for XChainPY Clients .. moduleauthor:: Thorchain """ __version__ = '0.2.3'
epochs = 500 batch_size = 25 dropout = 0.2 variables_device = "/cpu:0" processing_device = "/cpu:0" sequence_length = 20 # input timesteps learning_rate = 1e-3 prediction_length = 2 # expected output sequence length embedding_dim = 5 # input dimension total number of features in our case ## BOSHLTD/ MICO same.... C...
epochs = 500 batch_size = 25 dropout = 0.2 variables_device = '/cpu:0' processing_device = '/cpu:0' sequence_length = 20 learning_rate = 0.001 prediction_length = 2 embedding_dim = 5 companies = ['EICHERMOT', 'BOSCHLTD', 'MARUTI', 'ULTRACEMCO', 'HEROMOTOCO', 'TATAMOTORS', 'BPCL', 'AXISBANK', 'TATASTEEL', 'ZEEL', 'CIPLA...
class JustCounter: __secretCount = 0 publicCount = 0 def count(self): self.__secretCount += 1 self.publicCount += 1 print(self.__secretCount) counter = JustCounter() counter.count() counter.count() print(counter.publicCount) print(counter.__secretCount)
class Justcounter: __secret_count = 0 public_count = 0 def count(self): self.__secretCount += 1 self.publicCount += 1 print(self.__secretCount) counter = just_counter() counter.count() counter.count() print(counter.publicCount) print(counter.__secretCount)
""" ``imbalanced-learn`` is a set of python methods to deal with imbalanced datset in machine learning and pattern recognition. """ # Based on NiLearn package # License: simplified BSD # PEP0440 compatible formatted version, see: # https://www.python.org/dev/peps/pep-0440/ # # Generic release markers: # X.Y # X.Y.Z # ...
""" ``imbalanced-learn`` is a set of python methods to deal with imbalanced datset in machine learning and pattern recognition. """ __version__ = '0.10.0.dev0'
# Password validation # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidato...
auth_password_validators = [{'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'}, {'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'}, {'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator'}, {'NAME': 'django.contrib.auth.password_validation.Num...
class Solution: def simplifyPath(self, path: str) -> str: spath = path.split('/') result = [] for i in range(len(spath)): if spath[i] == '' or spath[i] == '.' or (spath[i] == '..' and len(result) == 0): continue elif spath[i] == '..' and len(...
class Solution: def simplify_path(self, path: str) -> str: spath = path.split('/') result = [] for i in range(len(spath)): if spath[i] == '' or spath[i] == '.' or (spath[i] == '..' and len(result) == 0): continue elif spath[i] == '..' and len(result) ...
class TypeUnknownParser: """ Parse invocations to a APIGateway resource with an unknown integration type """ def invoke(self, request, integration): _type = integration["type"] raise NotImplementedError("The {0} type has not been implemented".format(_type))
class Typeunknownparser: """ Parse invocations to a APIGateway resource with an unknown integration type """ def invoke(self, request, integration): _type = integration['type'] raise not_implemented_error('The {0} type has not been implemented'.format(_type))
#MenuTitle: Nested Components # -*- coding: utf-8 -*- __doc__=""" Creates a new tab with glyphs that have nested components. """ Font = Glyphs.font tab = [] def showNestedComponents(glyph): for idx, layer in enumerate(glyph.layers): if not layer.components: continue for component in layer.components: compo...
__doc__ = '\nCreates a new tab with glyphs that have nested components.\n' font = Glyphs.font tab = [] def show_nested_components(glyph): for (idx, layer) in enumerate(glyph.layers): if not layer.components: continue for component in layer.components: component_name = compon...
# fig_supp_steady_pn_lognorm_syn.py --- # Author: Subhasis Ray # Created: Fri Mar 15 16:04:34 2019 (-0400) # Last-Updated: Fri Mar 15 16:05:11 2019 (-0400) # By: Subhasis Ray # Version: $Id$ # Code: jid = '22251511' # # fig_supp_steady_pn_lognorm_syn.py ends here
jid = '22251511'
# -*- coding: utf-8 -*- __author__ = 'Amit Arora' __email__ = 'aa1603@georgetown.edu' __version__ = '0.1.0'
__author__ = 'Amit Arora' __email__ = 'aa1603@georgetown.edu' __version__ = '0.1.0'
class Solution: def addStrings(self, num1: str, num2: str) -> str: nums1 = list(num1) nums2 = list(num2) res, carry = [], 0 while nums1 or nums2: n1 = n2 = 0 if nums1: n1 = ord(nums1.pop()) - ord("0") if nums2: n2 =...
class Solution: def add_strings(self, num1: str, num2: str) -> str: nums1 = list(num1) nums2 = list(num2) (res, carry) = ([], 0) while nums1 or nums2: n1 = n2 = 0 if nums1: n1 = ord(nums1.pop()) - ord('0') if nums2: ...
# # Copyright (c) 2013 Markus Eliasson, http://www.quarterapp.com/ # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use...
class Apierror: """ Represents a API error that is returned to the user. """ def __init__(self, code, message): self.code = code self.message = message success_code = 0 error_retrieve_setting = api_error(101, 'Could not retrieve setting') error_no_setting_key = api_error(102, 'No settin...
class DrumException(Exception): """Base drum exception""" pass class DrumCommonException(DrumException): """Raised in case of common errors in drum""" pass class DrumPerfTestTimeout(DrumException): """Raised when the perf-test case takes too long""" pass class DrumPerfTestOOM(DrumExcept...
class Drumexception(Exception): """Base drum exception""" pass class Drumcommonexception(DrumException): """Raised in case of common errors in drum""" pass class Drumperftesttimeout(DrumException): """Raised when the perf-test case takes too long""" pass class Drumperftestoom(DrumException): ...
class SATImportOptions(BaseImportOptions, IDisposable): """ The import options used to import SAT format files. SATImportOptions(option: SATImportOptions) SATImportOptions() """ def Dispose(self): """ Dispose(self: BaseImportOptions,A_0: bool) """ pass def ReleaseUn...
class Satimportoptions(BaseImportOptions, IDisposable): """ The import options used to import SAT format files. SATImportOptions(option: SATImportOptions) SATImportOptions() """ def dispose(self): """ Dispose(self: BaseImportOptions,A_0: bool) """ pass def release_unmanaged_resour...
# -*- coding: utf-8 -*- """ pagarmecoreapi This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ class HttpContext(object): """An HTTP Context that contains both the original HttpRequest object that intitiated the call and the HttpResponse object that is...
""" pagarmecoreapi This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). """ class Httpcontext(object): """An HTTP Context that contains both the original HttpRequest object that intitiated the call and the HttpResponse object that is the result of the call. Attribut...
Alcool=0 Gasolina=0 Diesel=0 numero=0 while True: numero=int(input()) if(numero==1): Alcool+=1 if(numero==2): Gasolina+=1 if(numero==3): Diesel+=1 if(numero==4): break print('MUITO OBRIGADO') print(f'Alcool: {Alcool}') print(f'Gasolina: {Gasolina}') print(f'Diesel: {D...
alcool = 0 gasolina = 0 diesel = 0 numero = 0 while True: numero = int(input()) if numero == 1: alcool += 1 if numero == 2: gasolina += 1 if numero == 3: diesel += 1 if numero == 4: break print('MUITO OBRIGADO') print(f'Alcool: {Alcool}') print(f'Gasolina: {Gasolina}'...
#!/usr/bin/python class GrabzItScrape: def __init__(self, identifier, name, status, nextRun, results): self.ID = identifier self.Name = name self.Status = status self.NextRun = nextRun self.Results = results
class Grabzitscrape: def __init__(self, identifier, name, status, nextRun, results): self.ID = identifier self.Name = name self.Status = status self.NextRun = nextRun self.Results = results
# -*- coding: utf-8 -*- def main(): s = input() n = len(s) k = int(input()) if k > n: print(0) else: ans = set() for i in range(n - k + 1): ans.add(s[i:i + k]) print(len(ans)) if __name__ == '__main__': main()
def main(): s = input() n = len(s) k = int(input()) if k > n: print(0) else: ans = set() for i in range(n - k + 1): ans.add(s[i:i + k]) print(len(ans)) if __name__ == '__main__': main()
nome = input ("colocar nome do cliente:") preco = float (input ("colocar preco:")) quantidade = float (input ("colocar a contidade:")) valor_total = (quantidade) * (preco) print("Senhor %s seus produtos totalizam R$ %.2f reais."%(nome,valor_total))
nome = input('colocar nome do cliente:') preco = float(input('colocar preco:')) quantidade = float(input('colocar a contidade:')) valor_total = quantidade * preco print('Senhor %s seus produtos totalizam R$ %.2f reais.' % (nome, valor_total))
# -*- coding: utf-8 -*- """ 1184. Distance Between Bus Stops A bus has n stops numbered from 0 to n - 1 that form a circle. We know the distance between all pairs of neighboring stops where distance[i] is the distance between the stops number i and (i + 1) % n. The bus goes along both directions i.e. clockwise and co...
""" 1184. Distance Between Bus Stops A bus has n stops numbered from 0 to n - 1 that form a circle. We know the distance between all pairs of neighboring stops where distance[i] is the distance between the stops number i and (i + 1) % n. The bus goes along both directions i.e. clockwise and counterclockwise. Return ...
"""Message passing enables object impermanent worlds. """ class Message: """A message can be passed between layers in order to affect the model's behavior. Each message has a unique id, which can be used to manipulate this message afterwards. """ def __init__(self, msg): self.msg = ms...
"""Message passing enables object impermanent worlds. """ class Message: """A message can be passed between layers in order to affect the model's behavior. Each message has a unique id, which can be used to manipulate this message afterwards. """ def __init__(self, msg): self.msg = ms...
""" Version of vpc """ __version__ = '0.5.0'
""" Version of vpc """ __version__ = '0.5.0'
class Celsius: def __init__(self, temperature=0): self.temperature = temperature def to_fahrenheit(self): return (self.temperature * 1.8) + 32 @property def temperature(self): print(f"Getting value: {self.__temperature}") return self.__temperature # private attribute = ...
class Celsius: def __init__(self, temperature=0): self.temperature = temperature def to_fahrenheit(self): return self.temperature * 1.8 + 32 @property def temperature(self): print(f'Getting value: {self.__temperature}') return self.__temperature @temperature.sette...
# Created by MechAviv # Map ID :: 807040000 # Momijigaoka : Unfamiliar Hillside if "1" not in sm.getQRValue(57375) and sm.getChr().getJob() == 4001: sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.sendDelay(1000) sm.levelUntil(10) sm.cr...
if '1' not in sm.getQRValue(57375) and sm.getChr().getJob() == 4001: sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.sendDelay(1000) sm.levelUntil(10) sm.createQuestWithQRValue(57375, '1') sm.removeSkill(40010001) sm.setJob(4100)...
age=input("How old are you?") height=input("How tall are you?") weight=input("How much do you weigh?") print("So, you're %r old, %r tall and %r heavy." %(age,height,weight))
age = input('How old are you?') height = input('How tall are you?') weight = input('How much do you weigh?') print("So, you're %r old, %r tall and %r heavy." % (age, height, weight))
#!/usr/bin/python3 __author__ = 'Alan Au' __date__ = '2017-12-13' ''' --- Day 10: Knot Hash --- You come across some programs that are trying to implement a software emulation of a hash based on knot-tying. The hash these programs are implementing isn't very strong, but you decide to help them anyway. You make a me...
__author__ = 'Alan Au' __date__ = '2017-12-13' "\n--- Day 10: Knot Hash ---\n\nYou come across some programs that are trying to implement a software emulation of a hash based on knot-tying. The hash these programs are implementing isn't very strong, but you decide to help them anyway. You make a mental note to remind t...
class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: d = {} for i, x in enumerate(nums): if target - x in d: return [i, d[target - x]] d[x] = i return []
class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: d = {} for (i, x) in enumerate(nums): if target - x in d: return [i, d[target - x]] d[x] = i return []
class Person: def __init__(self, name, money): self.name = name self.money = money @property def money(self): print("money getter executed") return self.__money @money.setter def money(self, money): print("setter executed") if money < 0: ...
class Person: def __init__(self, name, money): self.name = name self.money = money @property def money(self): print('money getter executed') return self.__money @money.setter def money(self, money): print('setter executed') if money < 0: ...
"""This module contains the constants.""" HTML_DIR = 'views' UI_DIR = 'views' VOCABULARY_FILE = 'vocabulary.json' CONFIG_FILE = 'config.json' WORDNIK_API_URL = 'https://api.wordnik.com/v4'
"""This module contains the constants.""" html_dir = 'views' ui_dir = 'views' vocabulary_file = 'vocabulary.json' config_file = 'config.json' wordnik_api_url = 'https://api.wordnik.com/v4'
# Lab 26 #!/usr/bin/env python3 def main(): round = 0 answer = ' ' while round < 3 and answer.lower() != "brian": round += 1 print('Finish the movie title, "Monty Python\'s The Life of ______"') answer = input("Your answer --> ") if answer.lower() == "brian": pr...
def main(): round = 0 answer = ' ' while round < 3 and answer.lower() != 'brian': round += 1 print('Finish the movie title, "Monty Python\'s The Life of ______"') answer = input('Your answer --> ') if answer.lower() == 'brian': print('Correct') break ...
config = { 'username': "", # Robinhood credentials 'password': "", 'trades_enabled': False, # if False, just collect data 'simulate_api_calls': False, # if enabled, just pretend to connect to Robinhood 'ticker_list': { # list of coin ticker pairs Kraken/Robinhood (XETHZUSD/ETH, etc) - https://api.k...
config = {'username': '', 'password': '', 'trades_enabled': False, 'simulate_api_calls': False, 'ticker_list': {'XETHZUSD': 'ETH'}, 'trade_signals': {'buy': 'sma_rsi_threshold', 'sell': 'above_buy'}, 'moving_average_periods': {'sma_fast': 12, 'sma_slow': 48, 'ema_fast': 12, 'ema_slow': 48, 'macd_fast': 12, 'macd_slow':...
# %% [279. Perfect Squares](https://leetcode.com/problems/perfect-squares/) class Solution: def numSquares(self, n: int) -> int: return numSquares(n, math.floor(math.sqrt(n))) @functools.lru_cache(None) def numSquares(n, m): if n <= 0 or not m: return 2 ** 31 if n else 0 return min(numSqua...
class Solution: def num_squares(self, n: int) -> int: return num_squares(n, math.floor(math.sqrt(n))) @functools.lru_cache(None) def num_squares(n, m): if n <= 0 or not m: return 2 ** 31 if n else 0 return min(num_squares(n - m * m, m) + 1, num_squares(n, m - 1))
class Service: def __init__(self): self.ver = '/api/nutanix/v3/' @property def name(self): return self.ver
class Service: def __init__(self): self.ver = '/api/nutanix/v3/' @property def name(self): return self.ver
# https://leetcode.com/problems/word-search class Solution: def __init__(self): self.ans = False def backtrack(self, current_length, visited, y, x, board, word): if self.ans: return if current_length == len(word): self.ans = True return next...
class Solution: def __init__(self): self.ans = False def backtrack(self, current_length, visited, y, x, board, word): if self.ans: return if current_length == len(word): self.ans = True return nexts = [(y + 1, x), (y - 1, x), (y, x + 1), (y, ...
a = 1 b = 2 c = 3 print("hello python")
a = 1 b = 2 c = 3 print('hello python')
# -*- coding: utf-8 -*- name = 'usd_katana' version = '0.8.2' requires = [ 'usd-0.8.2' ] build_requires = [ 'cmake-3.2', ] variants = [['platform-linux', 'arch-x86_64', 'katana-2.5.4'], ['platform-linux', 'arch-x86_64', 'katana-2.6.4']] def commands(): env.KATANA_RESOURCES.append('{this.r...
name = 'usd_katana' version = '0.8.2' requires = ['usd-0.8.2'] build_requires = ['cmake-3.2'] variants = [['platform-linux', 'arch-x86_64', 'katana-2.5.4'], ['platform-linux', 'arch-x86_64', 'katana-2.6.4']] def commands(): env.KATANA_RESOURCES.append('{this.root}/third_party/katana/plugin') env.KATANA_POST_PY...
class PMS_base(object): history_number = 2 # image history number jobs = 4 # thread or process number max_iter_number = 400 # 'control the max iteration number for trainning') paths_number = 4 # 'number of paths in each rollout') max_path_length = 200 # 'timesteps in each path') batch_siz...
class Pms_Base(object): history_number = 2 jobs = 4 max_iter_number = 400 paths_number = 4 max_path_length = 200 batch_size = 100 max_kl = 0.01 gae_lambda = 1.0 subsample_factor = 0.05 cg_damping = 0.001 discount = 0.99 cg_iters = 20 deviation = 0.1 render = False...
def labyrinth(levels, orcs_first, L): if levels == 1: return orcs_first return min(labyrinth(levels - 1, orcs_first, L) ** 2, labyrinth(levels - 1, orcs_first, L) + L) print(labyrinth(int(input()), int(input()), int(input())))
def labyrinth(levels, orcs_first, L): if levels == 1: return orcs_first return min(labyrinth(levels - 1, orcs_first, L) ** 2, labyrinth(levels - 1, orcs_first, L) + L) print(labyrinth(int(input()), int(input()), int(input())))
_base_ = [ '../_base_/models/mask_rcnn_r50_fpn.py', '../_base_/datasets/cityscapes_instance.py', '../_base_/default_runtime.py' ] model = dict( pretrained=None, roi_head=dict( bbox_head=dict( type='Shared2FCBBoxHead', in_channels=256, fc_out_channels=1024, ...
_base_ = ['../_base_/models/mask_rcnn_r50_fpn.py', '../_base_/datasets/cityscapes_instance.py', '../_base_/default_runtime.py'] model = dict(pretrained=None, roi_head=dict(bbox_head=dict(type='Shared2FCBBoxHead', in_channels=256, fc_out_channels=1024, roi_feat_size=7, num_classes=8, bbox_coder=dict(type='DeltaXYWHBBoxC...
#!/usr/bin/python3 for tens in range(0, 9): for ones in range(tens + 1, 10): if tens != 8: print("{}{}, ".format(tens, ones), end='') print("89")
for tens in range(0, 9): for ones in range(tens + 1, 10): if tens != 8: print('{}{}, '.format(tens, ones), end='') print('89')
# ================================================================================================== # Copyright 2014 Twitter, Inc. # -------------------------------------------------------------------------------------------------- # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...
def sizeof_fmt(num): for x in ('', 'KB', 'MB', 'GB'): if num < 1024.0: if x == '': return '%d%s' % (num, x) else: return '%3.1f%s' % (num, x) num /= 1024.0 return '%3.1f%s' % (num, 'TB') class Counters(object): all = -1 writes = 0 ...
# -*- coding: utf-8 -*- # Copyright (c) 2019, Silvio Peroni <essepuntato@gmail.com> # # Permission to use, copy, modify, and/or distribute this software for any purpose # with or without fee is hereby granted, provided that the above copyright notice # and this permission notice appear in all copies. # # THE SOFTWARE I...
def f(mat_string): c = 0 lst = list() for chr in mat_string: n = int(chr) lst.append(n) if n / 2 != n // 2: c = c + 1 return g(lst, c) def g(mat_list, c): if c <= 0 or len(mat_list) == 0: return 0 else: v = 0 result = list() fo...
class A: def __init__(self): self.A_NEW_NAME = 1 def _foo(self): pass a_class = A() a_class._foo() print(a_class.A_NEW_NAME)
class A: def __init__(self): self.A_NEW_NAME = 1 def _foo(self): pass a_class = a() a_class._foo() print(a_class.A_NEW_NAME)
# Constants used for creating the Filesets. FILESETS_ENTRY_GROUP_NAME_COLUMN_LABEL = 'entry_group_name' FILESETS_ENTRY_GROUP_DISPLAY_NAME_COLUMN_LABEL = 'entry_group_display_name' FILESETS_ENTRY_GROUP_DESCRIPTION_COLUMN_LABEL = 'entry_group_description' FILESETS_ENTRY_ID_COLUMN_LABEL = 'entry_id' FILESETS_ENTRY_DISPLAY...
filesets_entry_group_name_column_label = 'entry_group_name' filesets_entry_group_display_name_column_label = 'entry_group_display_name' filesets_entry_group_description_column_label = 'entry_group_description' filesets_entry_id_column_label = 'entry_id' filesets_entry_display_name_column_label = 'entry_display_name' fi...
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...
# # Copyright (c) 2020-2021 Arm Limited and Contributors. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # """Package containing jinja templates used by mbed_tools.project."""
"""Package containing jinja templates used by mbed_tools.project."""
__all__ = [ 'phone_regex' ] phone_regex = r'^010[-\s]??\d{3,4}[-\s]??\d{4}$'
__all__ = ['phone_regex'] phone_regex = '^010[-\\s]??\\d{3,4}[-\\s]??\\d{4}$'
def insertion(array): for i in range(1, len(array)): j = i -1 while array[j] > array[j+1] and j >= 0: array[j], array[j+1] = array[j+1], array[j] j-=1 return array print (insertion([7, 8, 5, 4, 9, 2]))
def insertion(array): for i in range(1, len(array)): j = i - 1 while array[j] > array[j + 1] and j >= 0: (array[j], array[j + 1]) = (array[j + 1], array[j]) j -= 1 return array print(insertion([7, 8, 5, 4, 9, 2]))