content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
#!/usr/bin/env python # AUTHOR: jo # DATE: 2019-08-12 # DESCRIPTION: Tuse homework assignment #1. def partitionOnZeroSumAndMax(row): # Ex. Passing in [1,1,0,1] returns [2,0,1]. # max([2,0,1]) -> 2 localSums = [0] for val in row: if val != 0: localSums.append(localSums.pop() + val) else: localSums.append(0) return max(localSums) def getDistanceAndMax(matrix): # Initialize empty array with identical dimensions as input. matrix_distance = [ [None for row in range(len(matrix))] for column in range(len(matrix[0])) ] for row in range(len(matrix)): for column in range(len(matrix[row])): # Top row stays the same, and for any coordinate that's zero. if (row == 0) or (matrix[row][column] == 0): matrix_distance[row][column] = matrix[row][column] else: distance = 0 # Iterate in reverse, from bottom to top. for row_range in range(row, -1, -1): if matrix[row_range][column] == 1: distance += 1 # Being explicit here to handle zero. # elif can be replaced with "else: break" instead. elif matrix[row_range][column] == 0: break matrix_distance[row][column] = distance return {'distance' : matrix_distance, 'max_score': max(partitionOnZeroSumAndMax(row) for row in matrix_distance) } if __name__ == '__main__': snoots = [ [1, 0, 1], [0, 1, 1], [1, 1, 1] ] winkler = [ [1, 0, 0], [1, 1, 1], [0, 1, 0] ] tootSnoots = [1,1,0,1] toodles = [ [1,1,0,1], [1,1,0,1], [1,1,0,1], [1,1,0,1] ] print(getDistanceAndMax(snoots)) print(getDistanceAndMax(winkler)) print(partitionOnZeroSumAndMax(tootSnoots)) print(getDistanceAndMax(toodles))
def partition_on_zero_sum_and_max(row): local_sums = [0] for val in row: if val != 0: localSums.append(localSums.pop() + val) else: localSums.append(0) return max(localSums) def get_distance_and_max(matrix): matrix_distance = [[None for row in range(len(matrix))] for column in range(len(matrix[0]))] for row in range(len(matrix)): for column in range(len(matrix[row])): if row == 0 or matrix[row][column] == 0: matrix_distance[row][column] = matrix[row][column] else: distance = 0 for row_range in range(row, -1, -1): if matrix[row_range][column] == 1: distance += 1 elif matrix[row_range][column] == 0: break matrix_distance[row][column] = distance return {'distance': matrix_distance, 'max_score': max((partition_on_zero_sum_and_max(row) for row in matrix_distance))} if __name__ == '__main__': snoots = [[1, 0, 1], [0, 1, 1], [1, 1, 1]] winkler = [[1, 0, 0], [1, 1, 1], [0, 1, 0]] toot_snoots = [1, 1, 0, 1] toodles = [[1, 1, 0, 1], [1, 1, 0, 1], [1, 1, 0, 1], [1, 1, 0, 1]] print(get_distance_and_max(snoots)) print(get_distance_and_max(winkler)) print(partition_on_zero_sum_and_max(tootSnoots)) print(get_distance_and_max(toodles))
#!/usr/bin/env python2 def main(): n = input('') for i in range(0, n): rows = input('') matrix = [] for j in range(0, rows): matrix.append([int(x) for x in raw_input('').split()]) print(weight(matrix, 0, 0)) def weight(matrix, i, j): #print('weight called with', i, j) if i < len(matrix)-1: return matrix[i][j] + max(weight(matrix, i+1, j), weight(matrix, i+1, j+1)) else: return matrix[i][j] if __name__ == "__main__": main()
def main(): n = input('') for i in range(0, n): rows = input('') matrix = [] for j in range(0, rows): matrix.append([int(x) for x in raw_input('').split()]) print(weight(matrix, 0, 0)) def weight(matrix, i, j): if i < len(matrix) - 1: return matrix[i][j] + max(weight(matrix, i + 1, j), weight(matrix, i + 1, j + 1)) else: return matrix[i][j] if __name__ == '__main__': main()
codon_protein = { "AUG": "Methionine", "UUU": "Phenylalanine", "UUC": "Phenylalanine", "UUA": "Leucine", "UUG": "Leucine", "UCU": "Serine", "UCG": "Serine", "UCC": "Serine", "UCA": "Serine", "UAU": "Tyrosine", "UAC": "Tyrosine", "UGU": "Cysteine", "UGC": "Cysteine", "UGG": "Tryptophan", "UAA": None, "UAG": None, "UGA": None } def proteins(strand: str): codons = get_codons(strand) result = [] for codon in codons: protein = codon_protein[codon] if protein is None: break if protein not in result: result.append(protein) return result def get_codons(strand): chunk_size = 3 codons = [strand[i:i + chunk_size] for i in range(0, len(strand), chunk_size)] return codons
codon_protein = {'AUG': 'Methionine', 'UUU': 'Phenylalanine', 'UUC': 'Phenylalanine', 'UUA': 'Leucine', 'UUG': 'Leucine', 'UCU': 'Serine', 'UCG': 'Serine', 'UCC': 'Serine', 'UCA': 'Serine', 'UAU': 'Tyrosine', 'UAC': 'Tyrosine', 'UGU': 'Cysteine', 'UGC': 'Cysteine', 'UGG': 'Tryptophan', 'UAA': None, 'UAG': None, 'UGA': None} def proteins(strand: str): codons = get_codons(strand) result = [] for codon in codons: protein = codon_protein[codon] if protein is None: break if protein not in result: result.append(protein) return result def get_codons(strand): chunk_size = 3 codons = [strand[i:i + chunk_size] for i in range(0, len(strand), chunk_size)] return codons
# Copyright 2017-2022 Lawrence Livermore National Security, LLC and other # Hatchet Project Developers. See the top-level LICENSE file for details. # # SPDX-License-Identifier: MIT __version_info__ = ("2022", "1", "0") __version__ = ".".join(__version_info__)
__version_info__ = ('2022', '1', '0') __version__ = '.'.join(__version_info__)
# Time: O(n) # Space: O(1) class Solution(object): # @param {TreeNode} root # @param {TreeNode} p # @param {TreeNode} q # @return {TreeNode} def lowestCommonAncestor(self, root, p, q): s, b = sorted([p.val, q.val]) while not s <= root.val <= b: # Keep searching since root is outside of [s, b]. root = root.left if s <= root.val else root.right # s <= root.val <= b. return root
class Solution(object): def lowest_common_ancestor(self, root, p, q): (s, b) = sorted([p.val, q.val]) while not s <= root.val <= b: root = root.left if s <= root.val else root.right return root
n = int(input()) nsum = 0 for i in range(1, n+1): nsum += i if nsum == 1: print('BOWWOW') elif nsum <= 3: print('WANWAN') else: for i in range(2, n+1): if n % i == 0: print('BOWWOW') break else: print('WANWAN')
n = int(input()) nsum = 0 for i in range(1, n + 1): nsum += i if nsum == 1: print('BOWWOW') elif nsum <= 3: print('WANWAN') else: for i in range(2, n + 1): if n % i == 0: print('BOWWOW') break else: print('WANWAN')
#!/usr/bin/env python3 def find_array_intersection(A, B): ai = 0 bi = 0 ret = [] while ai < len(A) and bi < len(B): if A[ai] < B[bi]: ai += 1 elif A[ai] > B[bi]: bi += 1 else: ret.append(A[ai]) v = A[ai] while ai < len(A) and A[ai] == v: ai += 1 while bi < len(B) and B[bi] == v: bi += 1 return ret A = [1, 2, 3, 4, 4, 5, 7, 8, 10] B = [3, 4, 8, 9, 9, 10, 13] print(find_array_intersection(A, B))
def find_array_intersection(A, B): ai = 0 bi = 0 ret = [] while ai < len(A) and bi < len(B): if A[ai] < B[bi]: ai += 1 elif A[ai] > B[bi]: bi += 1 else: ret.append(A[ai]) v = A[ai] while ai < len(A) and A[ai] == v: ai += 1 while bi < len(B) and B[bi] == v: bi += 1 return ret a = [1, 2, 3, 4, 4, 5, 7, 8, 10] b = [3, 4, 8, 9, 9, 10, 13] print(find_array_intersection(A, B))
def do_stuff(fn, lhs, rhs): return fn(lhs, rhs) def add(lhs, rhs): return lhs + rhs def multiply(lhs, rhs): return lhs * rhs def exponent(lhs, rhs): return lhs ** rhs print(do_stuff(add, 2, 3)) print(do_stuff(multiply, 2, 3)) print(do_stuff(exponent, 2, 3))
def do_stuff(fn, lhs, rhs): return fn(lhs, rhs) def add(lhs, rhs): return lhs + rhs def multiply(lhs, rhs): return lhs * rhs def exponent(lhs, rhs): return lhs ** rhs print(do_stuff(add, 2, 3)) print(do_stuff(multiply, 2, 3)) print(do_stuff(exponent, 2, 3))
# A tuple operates like a list but it's initial values can't be modified # Tuples are declared using the () # Use case examples of using Tuple - Dates of the week, Months of the Year, Hours of the clock # we can create a tuple like this... monthsOfTheYear = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec") # Prints all the items in the tuple print(monthsOfTheYear) # prints an item in the tuple print(monthsOfTheYear[0]) print(monthsOfTheYear[:3]) # If we try to run the code below it will error # This is because we are change a value in the tuple, which is not allowed! # monthsOfTheYear[0] = "January" # Other operations we can do with tuples # find an item in the tuple myTuple = ('Mon', 'Tue', 'Wed', 'Thurs', 'Fri', 'Sat', 'Sun') print(len(myTuple)) print(sorted(myTuple)) names = ['John', 'Lamin', 'Vicky', 'Jasmine'] print(names * 3)
months_of_the_year = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec') print(monthsOfTheYear) print(monthsOfTheYear[0]) print(monthsOfTheYear[:3]) my_tuple = ('Mon', 'Tue', 'Wed', 'Thurs', 'Fri', 'Sat', 'Sun') print(len(myTuple)) print(sorted(myTuple)) names = ['John', 'Lamin', 'Vicky', 'Jasmine'] print(names * 3)
def solve(array): even = [] odd = [] for i in range(len(array)): if array[i] % 2 == 0: even.append(i) else: odd.append(i) if even: return f"1\n{even[-1] + 1}" if len(odd) > 1: return f"2\n{odd[-1] + 1} {odd[-2] + 1}" else: return "-1" def main(): t = int(input()) for _ in range(t): __ = int(input()) array = [int(x) for x in input().split(' ')] print(solve(array)) main()
def solve(array): even = [] odd = [] for i in range(len(array)): if array[i] % 2 == 0: even.append(i) else: odd.append(i) if even: return f'1\n{even[-1] + 1}' if len(odd) > 1: return f'2\n{odd[-1] + 1} {odd[-2] + 1}' else: return '-1' def main(): t = int(input()) for _ in range(t): __ = int(input()) array = [int(x) for x in input().split(' ')] print(solve(array)) main()
# These constants can be set by the external UI-layer process, don't change them manually is_ui_process = False execution_id = '' task_id = '' executable_name = 'insomniac' do_location_permission_dialog_checks = True # no need in these checks if location permission is denied beforehand def callback(profile_name): pass hardban_detected_callback = callback softban_detected_callback = callback def is_insomniac(): return execution_id == ''
is_ui_process = False execution_id = '' task_id = '' executable_name = 'insomniac' do_location_permission_dialog_checks = True def callback(profile_name): pass hardban_detected_callback = callback softban_detected_callback = callback def is_insomniac(): return execution_id == ''
defaults = ''' const vec4 light = vec4(4.0, 3.0, 10.0, 0.0); const vec4 eye = vec4(4.0, 3.0, 2.0, 0.0); const mat4 mvp = mat4( -0.8147971034049988, -0.7172931432723999, -0.7429299354553223, -0.7427813410758972, 1.0863960981369019, -0.5379698276519775, -0.5571974515914917, -0.5570859909057617, 0.0, 2.2415409088134766, -0.37146496772766113, -0.3713906705379486, 0.0, 0.0, 5.186222076416016, 5.385164737701416 ); '''
defaults = '\n const vec4 light = vec4(4.0, 3.0, 10.0, 0.0);\n const vec4 eye = vec4(4.0, 3.0, 2.0, 0.0);\n const mat4 mvp = mat4(\n -0.8147971034049988, -0.7172931432723999, -0.7429299354553223, -0.7427813410758972,\n 1.0863960981369019, -0.5379698276519775, -0.5571974515914917, -0.5570859909057617,\n 0.0, 2.2415409088134766, -0.37146496772766113, -0.3713906705379486,\n 0.0, 0.0, 5.186222076416016, 5.385164737701416\n );\n'
class OutOfService(Exception): def __init__(self,Note:str=""): pass class InternalError(Exception): def __init__(self,Note:str=""): pass class NothingFoundError(Exception): def __init__(self,Note:str=""): pass class DummyError(Exception): def __init__(self,Note:str=""): pass
class Outofservice(Exception): def __init__(self, Note: str=''): pass class Internalerror(Exception): def __init__(self, Note: str=''): pass class Nothingfounderror(Exception): def __init__(self, Note: str=''): pass class Dummyerror(Exception): def __init__(self, Note: str=''): pass
a = [1, 4, 5, 7, 19, 24] b = [4, 6, 7, 18, 24, 134] i = 0 j = 0 ans = [] while i < len(a) and j < len(b): if a[i] == b[j]: ans.append(a[i]) i += 1 j += 1 elif a[i] < b[j]: i += 1 else: j += 1 print(*ans)
a = [1, 4, 5, 7, 19, 24] b = [4, 6, 7, 18, 24, 134] i = 0 j = 0 ans = [] while i < len(a) and j < len(b): if a[i] == b[j]: ans.append(a[i]) i += 1 j += 1 elif a[i] < b[j]: i += 1 else: j += 1 print(*ans)
class Node: def __init__(self, value): self.value = value self.next = None class Queue(object): def __init__(self, size): self.queue = [] self.size = size def enqueue(self, value): '''This function adds an value to the rear end of the queue ''' if(self.isFull() != True): self.queue.insert(0, value) else: print('Queue is Full!') def dequeue(self): ''' This function removes an item from the front end of the queue ''' if(self.isEmpty() != True): return self.queue.pop() else: print('Queue is Empty!') def peek(self): ''' This function helps to see the first element at the fron end of the queue ''' if(self.isEmpty() != True): return self.queue[-1] else: print('Queue is Empty!') def isEmpty(self): ''' This function checks if the queue is empty ''' return self.queue == [] def isFull(self): ''' This function checks if the queue is full ''' return len(self.queue) == self.size def __str__(self): myString = ' '.join(str(i) for i in self.queue) return myString if __name__ == '__main__': myQueue = Queue(10) myQueue.enqueue(4) myQueue.enqueue(5) myQueue.enqueue(6) print(myQueue) myQueue.enqueue(1) myQueue.enqueue(2) myQueue.enqueue(3) print(myQueue) myQueue.dequeue() print(myQueue)
class Node: def __init__(self, value): self.value = value self.next = None class Queue(object): def __init__(self, size): self.queue = [] self.size = size def enqueue(self, value): """This function adds an value to the rear end of the queue """ if self.isFull() != True: self.queue.insert(0, value) else: print('Queue is Full!') def dequeue(self): """ This function removes an item from the front end of the queue """ if self.isEmpty() != True: return self.queue.pop() else: print('Queue is Empty!') def peek(self): """ This function helps to see the first element at the fron end of the queue """ if self.isEmpty() != True: return self.queue[-1] else: print('Queue is Empty!') def is_empty(self): """ This function checks if the queue is empty """ return self.queue == [] def is_full(self): """ This function checks if the queue is full """ return len(self.queue) == self.size def __str__(self): my_string = ' '.join((str(i) for i in self.queue)) return myString if __name__ == '__main__': my_queue = queue(10) myQueue.enqueue(4) myQueue.enqueue(5) myQueue.enqueue(6) print(myQueue) myQueue.enqueue(1) myQueue.enqueue(2) myQueue.enqueue(3) print(myQueue) myQueue.dequeue() print(myQueue)
bill_board = list(map(int, input().split())) tarp = list(map(int, input().split())) xOverlap = max(min(bill_board[2], tarp[2]) - max(bill_board[0], tarp[0]), 0) yOverlap = max(min(bill_board[3], tarp[3]) - max(bill_board[1], tarp[1]), 0) if xOverlap == 0 or yOverlap == 0: print((bill_board[2] - bill_board[0]) * (bill_board[3] - bill_board[1])) exit() if xOverlap >= bill_board[2] - bill_board[0] and yOverlap >= bill_board[3] - bill_board[1]: print(0) exit() if xOverlap < bill_board[2] - bill_board[0] and yOverlap < bill_board[3] - bill_board[1]: print((bill_board[2] - bill_board[0])*(bill_board[3]-bill_board[1])) elif xOverlap >= bill_board[2] - bill_board[0] and yOverlap < bill_board[3] - bill_board[1]: print(xOverlap*(bill_board[3]-bill_board[1] - yOverlap)) elif yOverlap >= bill_board[3] - bill_board[1] and xOverlap < bill_board[2] - bill_board[0]: print(yOverlap*(bill_board[2] - bill_board[0] - xOverlap)) else: print((bill_board[2] - bill_board[0]) * (bill_board[3] - bill_board[1]))
bill_board = list(map(int, input().split())) tarp = list(map(int, input().split())) x_overlap = max(min(bill_board[2], tarp[2]) - max(bill_board[0], tarp[0]), 0) y_overlap = max(min(bill_board[3], tarp[3]) - max(bill_board[1], tarp[1]), 0) if xOverlap == 0 or yOverlap == 0: print((bill_board[2] - bill_board[0]) * (bill_board[3] - bill_board[1])) exit() if xOverlap >= bill_board[2] - bill_board[0] and yOverlap >= bill_board[3] - bill_board[1]: print(0) exit() if xOverlap < bill_board[2] - bill_board[0] and yOverlap < bill_board[3] - bill_board[1]: print((bill_board[2] - bill_board[0]) * (bill_board[3] - bill_board[1])) elif xOverlap >= bill_board[2] - bill_board[0] and yOverlap < bill_board[3] - bill_board[1]: print(xOverlap * (bill_board[3] - bill_board[1] - yOverlap)) elif yOverlap >= bill_board[3] - bill_board[1] and xOverlap < bill_board[2] - bill_board[0]: print(yOverlap * (bill_board[2] - bill_board[0] - xOverlap)) else: print((bill_board[2] - bill_board[0]) * (bill_board[3] - bill_board[1]))
''' Edges in a block diagram computational graph. The edges themselves don't have direction, but the ports that they attach to may. ''' class WireConnection: pass class NamedConnection(WireConnection): def __init__(self, target_uid: int, target_port: str): self.target_uid = target_uid self.target_port = target_port def __str__(self): return f'NamedConnection(id={self.target_uid}, port={self.target_port})' class IdentConnection(WireConnection): def __init__(self, target_uid: int): self.target_uid = target_uid def __str__(self): return f'IdentConnection(id={self.target_uid})' class Wire: ''' Wires in TIA's S7 XML format can have more than two terminals, but we always decompose them into a series of two terminal blocks. ''' def __init__(self, a: WireConnection, b: WireConnection): self.a = a self.b = b
""" Edges in a block diagram computational graph. The edges themselves don't have direction, but the ports that they attach to may. """ class Wireconnection: pass class Namedconnection(WireConnection): def __init__(self, target_uid: int, target_port: str): self.target_uid = target_uid self.target_port = target_port def __str__(self): return f'NamedConnection(id={self.target_uid}, port={self.target_port})' class Identconnection(WireConnection): def __init__(self, target_uid: int): self.target_uid = target_uid def __str__(self): return f'IdentConnection(id={self.target_uid})' class Wire: """ Wires in TIA's S7 XML format can have more than two terminals, but we always decompose them into a series of two terminal blocks. """ def __init__(self, a: WireConnection, b: WireConnection): self.a = a self.b = b
RADIO_ENABLED = ":white_check_mark: **Radio enabled**" RADIO_DISABLED = ":x: **Radio disabled**" SKIPPED = ":fast_forward: **Skipped** :thumbsup:" NO_MATCH = ":x: **No matches**" SEARCHING = ":trumpet: **Searching** :mag_right:" PAUSE = "**Paused** :pause_button:" STOP = "**Stopped** :stop_button:" LOOP_ENABLED = "**Loop enabled**" LOOP_DISABLED = "**Loop disabled**" RESUME = "**Resumed**" SHUFFLE = "**Playlist shuffled**" CONNECT_TO_CHANNEL = ":x: **Please connect to a voice channel**" WRONG_CHANNEL = ":x: **You need to be in the same voice channel as HalvaBot to use this command**" CURRENT = "**Now playing** :notes:" NO_CURRENT = "**No current songs**" START_PLAYING = "**Playing** :notes: `{song_name}` - Now!" ENQUEUE = "`{song_name}` - **added to queue!**"
radio_enabled = ':white_check_mark: **Radio enabled**' radio_disabled = ':x: **Radio disabled**' skipped = ':fast_forward: **Skipped** :thumbsup:' no_match = ':x: **No matches**' searching = ':trumpet: **Searching** :mag_right:' pause = '**Paused** :pause_button:' stop = '**Stopped** :stop_button:' loop_enabled = '**Loop enabled**' loop_disabled = '**Loop disabled**' resume = '**Resumed**' shuffle = '**Playlist shuffled**' connect_to_channel = ':x: **Please connect to a voice channel**' wrong_channel = ':x: **You need to be in the same voice channel as HalvaBot to use this command**' current = '**Now playing** :notes:' no_current = '**No current songs**' start_playing = '**Playing** :notes: `{song_name}` - Now!' enqueue = '`{song_name}` - **added to queue!**'
def leiaInt(msg): while True: try: n = int(input(msg)) except (ValueError, TypeError): print('Erro: Por favor, digite um numero valido') continue except (KeyboardInterrupt): print('Entrada interromepida pelo usuario') return 0 else: return n def leiaFloat(msg): while True: try: n = float(input(msg)) except (ValueError, TypeError): print('Erro: Por favor, digite um numero valido') continue except (KeyboardInterrupt): print('Entrada interromepida pelo usuario') return 0 else: return n num1 = leiaInt('digite um numero inteiro: ') num2 = leiaFloat('digite um numero real: ') print(num1, num2 )
def leia_int(msg): while True: try: n = int(input(msg)) except (ValueError, TypeError): print('Erro: Por favor, digite um numero valido') continue except KeyboardInterrupt: print('Entrada interromepida pelo usuario') return 0 else: return n def leia_float(msg): while True: try: n = float(input(msg)) except (ValueError, TypeError): print('Erro: Por favor, digite um numero valido') continue except KeyboardInterrupt: print('Entrada interromepida pelo usuario') return 0 else: return n num1 = leia_int('digite um numero inteiro: ') num2 = leia_float('digite um numero real: ') print(num1, num2)
#leia um numero inteiro e #imprima a soma do sucessor de seu triplo com #o antecessor de seu dobro num=int(input("Informe um numero: ")) valor=((num*3)+1)+((num*2)-1) print(f"A soma do sucessor de seu triplo com o antecessor de seu dobro eh {valor}")
num = int(input('Informe um numero: ')) valor = num * 3 + 1 + (num * 2 - 1) print(f'A soma do sucessor de seu triplo com o antecessor de seu dobro eh {valor}')
input = open('input.txt', 'r').read().split("\n") depths = list(map(lambda s: int(s), input)) increases = 0; for i in range(1, len(depths)): if depths[i-2] + depths[i-1] + depths[i] > depths[i-3] + depths[i-2] + depths[i-1]: increases += 1 print(increases)
input = open('input.txt', 'r').read().split('\n') depths = list(map(lambda s: int(s), input)) increases = 0 for i in range(1, len(depths)): if depths[i - 2] + depths[i - 1] + depths[i] > depths[i - 3] + depths[i - 2] + depths[i - 1]: increases += 1 print(increases)
class NasmPackage (Package): def __init__ (self): Package.__init__ (self, 'nasm', '2.10.07', sources = [ 'http://www.nasm.us/pub/nasm/releasebuilds/2.10.07/nasm-%{version}.tar.xz' ]) NasmPackage ()
class Nasmpackage(Package): def __init__(self): Package.__init__(self, 'nasm', '2.10.07', sources=['http://www.nasm.us/pub/nasm/releasebuilds/2.10.07/nasm-%{version}.tar.xz']) nasm_package()
''' Description: Given the root of a binary search tree with distinct values, modify it so that every node has a new value equal to the sum of the values of the original tree that are greater than or equal to node.val. As a reminder, a binary search tree is a tree that satisfies these constraints: The left subtree of a node contains only nodes with keys less than the node's key. The right subtree of a node contains only nodes with keys greater than the node's key. Both the left and right subtrees must also be binary search trees. Example 1: Input: [4,1,6,0,2,5,7,null,null,null,3,null,null,null,8] Output: [30,36,21,36,35,26,15,null,null,null,33,null,null,null,8] Note: The number of nodes in the tree is between 1 and 100. Each node will have value between 0 and 100. The given tree is a binary search tree. ''' # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def reversed_inorder_traversal( self, node: TreeNode): if not node: # empty node or empty tree return else: # DFS to next level yield from self.reversed_inorder_traversal( node.right ) yield node yield from self.reversed_inorder_traversal( node.left ) def bstToGst(self, root: TreeNode) -> TreeNode: accumulation_sum = 0 for node in self.reversed_inorder_traversal(root): accumulation_sum += node.val node.val = accumulation_sum return root # n : number of nodes in binary tree ## Time Complexity: O( n ) # # The overhead in time is the cost of reversed in-order DFS traversal, which is of O( n ). ## Space Complexity: O( 1 ) # # The overhead in space is the looping index and iterator, which is of O( n ) def print_inorder( node: TreeNode): if node: print_inorder( node.left ) print(f'{node.val} ', end = '') print_inorder( node.right ) return def test_bench(): node_0 = TreeNode( 0 ) node_1 = TreeNode( 1 ) node_2 = TreeNode( 2 ) node_3 = TreeNode( 3 ) node_4 = TreeNode( 4 ) node_5 = TreeNode( 5 ) node_6 = TreeNode( 6 ) node_7 = TreeNode( 7 ) node_8 = TreeNode( 8 ) root = node_4 root.left = node_1 root.right = node_6 node_1.left = node_0 node_1.right = node_2 node_6.left = node_5 node_6.right = node_7 node_2.right = node_3 node_7.right = node_8 # before: # expected output: ''' 0 1 2 3 4 5 6 7 8 ''' print_inorder( root ) Solution().bstToGst( root ) print("\n") # after: # expected output: ''' 36 36 35 33 30 26 21 15 8 ''' print_inorder( root ) return if __name__ == '__main__': test_bench()
""" Description: Given the root of a binary search tree with distinct values, modify it so that every node has a new value equal to the sum of the values of the original tree that are greater than or equal to node.val. As a reminder, a binary search tree is a tree that satisfies these constraints: The left subtree of a node contains only nodes with keys less than the node's key. The right subtree of a node contains only nodes with keys greater than the node's key. Both the left and right subtrees must also be binary search trees. Example 1: Input: [4,1,6,0,2,5,7,null,null,null,3,null,null,null,8] Output: [30,36,21,36,35,26,15,null,null,null,33,null,null,null,8] Note: The number of nodes in the tree is between 1 and 100. Each node will have value between 0 and 100. The given tree is a binary search tree. """ class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def reversed_inorder_traversal(self, node: TreeNode): if not node: return else: yield from self.reversed_inorder_traversal(node.right) yield node yield from self.reversed_inorder_traversal(node.left) def bst_to_gst(self, root: TreeNode) -> TreeNode: accumulation_sum = 0 for node in self.reversed_inorder_traversal(root): accumulation_sum += node.val node.val = accumulation_sum return root def print_inorder(node: TreeNode): if node: print_inorder(node.left) print(f'{node.val} ', end='') print_inorder(node.right) return def test_bench(): node_0 = tree_node(0) node_1 = tree_node(1) node_2 = tree_node(2) node_3 = tree_node(3) node_4 = tree_node(4) node_5 = tree_node(5) node_6 = tree_node(6) node_7 = tree_node(7) node_8 = tree_node(8) root = node_4 root.left = node_1 root.right = node_6 node_1.left = node_0 node_1.right = node_2 node_6.left = node_5 node_6.right = node_7 node_2.right = node_3 node_7.right = node_8 '\n 0 1 2 3 4 5 6 7 8\n ' print_inorder(root) solution().bstToGst(root) print('\n') '\n 36 36 35 33 30 26 21 15 8\n ' print_inorder(root) return if __name__ == '__main__': test_bench()
number_of_drugs = 5 max_id = 1<<5 string_length = len("{0:#b}".format(max_id-1)) -2 EC50_for_0 = 0.75 EC50_for_1 = 1.3 f = lambda x: EC50_for_0 if x=='0' else EC50_for_1 print("[\n", end="") for x in range(0,max_id): gene_string = ("{0:0"+str(string_length)+"b}").format(x) ec50 = list(map(f, list(gene_string))) print(ec50, end="") if(x != max_id-1) : print(",") else: print("") print("]")
number_of_drugs = 5 max_id = 1 << 5 string_length = len('{0:#b}'.format(max_id - 1)) - 2 ec50_for_0 = 0.75 ec50_for_1 = 1.3 f = lambda x: EC50_for_0 if x == '0' else EC50_for_1 print('[\n', end='') for x in range(0, max_id): gene_string = ('{0:0' + str(string_length) + 'b}').format(x) ec50 = list(map(f, list(gene_string))) print(ec50, end='') if x != max_id - 1: print(',') else: print('') print(']')
input1='389125467' input2='496138527' lowest=1 highest=1000000 class Node: def __init__(self, val, next_node=None): self.val=val self.next=next_node cups=list(input2) cups=list(map(int,cups)) lookup_table={} prev=None # form linked list from the end node to beginning node for i in range(len(cups)-1,-1,-1): new=Node(cups[i]) new.next=prev lookup_table[cups[i]]=new # direct reference to the node that has the cup value prev=new for i in range(highest,9,-1): new=Node(i) new.next=prev lookup_table[i]=new prev=new lookup_table[cups[-1]].next=lookup_table[10] current=lookup_table[cups[0]] for _ in range(10000000): a=current.next b=a.next c=b.next current.next=c.next removed={current.val,a.val,b.val,c.val} destination=current.val while destination in removed: destination-=1 if destination==0: destination=highest destination_reference=lookup_table[destination] destination_old_next=destination_reference.next destination_reference.next=a c.next=destination_old_next current=current.next maincup=lookup_table[1] a=maincup.next b=a.next print(a.val*b.val)
input1 = '389125467' input2 = '496138527' lowest = 1 highest = 1000000 class Node: def __init__(self, val, next_node=None): self.val = val self.next = next_node cups = list(input2) cups = list(map(int, cups)) lookup_table = {} prev = None for i in range(len(cups) - 1, -1, -1): new = node(cups[i]) new.next = prev lookup_table[cups[i]] = new prev = new for i in range(highest, 9, -1): new = node(i) new.next = prev lookup_table[i] = new prev = new lookup_table[cups[-1]].next = lookup_table[10] current = lookup_table[cups[0]] for _ in range(10000000): a = current.next b = a.next c = b.next current.next = c.next removed = {current.val, a.val, b.val, c.val} destination = current.val while destination in removed: destination -= 1 if destination == 0: destination = highest destination_reference = lookup_table[destination] destination_old_next = destination_reference.next destination_reference.next = a c.next = destination_old_next current = current.next maincup = lookup_table[1] a = maincup.next b = a.next print(a.val * b.val)
def counting_sort(arr): k = max(arr) count = [0] * k + [0] for x in arr: count[x] += 1 for i in range(1, len(count)): count[i] = count[i] + count[i-1] output = [0] * len(arr) for x in arr: output[count[x]-1] = x yield output, count[x]-1 count[x] -= 1 yield output, count[x] #print(counting_sort([1,4,2,3,4,5]))
def counting_sort(arr): k = max(arr) count = [0] * k + [0] for x in arr: count[x] += 1 for i in range(1, len(count)): count[i] = count[i] + count[i - 1] output = [0] * len(arr) for x in arr: output[count[x] - 1] = x yield (output, count[x] - 1) count[x] -= 1 yield (output, count[x])
number = int(input()) if 100 <= number <= 200 or number == 0: pass else: print('invalid')
number = int(input()) if 100 <= number <= 200 or number == 0: pass else: print('invalid')
def nth(test, items): if test > 0: test -= 1 else: test = 0 for i, v in enumerate(items): if i == test: return v
def nth(test, items): if test > 0: test -= 1 else: test = 0 for (i, v) in enumerate(items): if i == test: return v
# Combinations class Solution: def combine(self, n, k): ans = [] def helper(choices, start, count, ans): if count == k: # cloning the list here ans.append(list(choices)) return for i in range(start, n + 1): choices[count] = i helper(choices, i + 1, count + 1, ans) helper([None] * k, 1, 0, ans) return ans if __name__ == "__main__": sol = Solution() n = 1 k = 1 print(sol.combine(n, k))
class Solution: def combine(self, n, k): ans = [] def helper(choices, start, count, ans): if count == k: ans.append(list(choices)) return for i in range(start, n + 1): choices[count] = i helper(choices, i + 1, count + 1, ans) helper([None] * k, 1, 0, ans) return ans if __name__ == '__main__': sol = solution() n = 1 k = 1 print(sol.combine(n, k))
class PyTime: def printTime(self,input): time_in_string = str(input) length = len(time_in_string) if length == 3: hour,minute1,minute2 = time_in_string hours = "0" + hour minutes = minute1 + minute2 converted_time = self.calculateTime(hours,minutes) elif length == 4: hour1,hour2,minute1,minute2 = time_in_string hours = hour1 + hour2 minutes = minute1 + minute2 converted_time = self.calculateTime(hours,minutes) elif time_in_string=="000" or time_in_string=="0000": hour1,hour2,minute1,minute2 = time_in_string hours = hour1 + hour2 minutes = minute1 + minute2 converted_time = self.calculateTime(hours,minutes) else: return "Invalid Format" return converted_time def calculateTime(self,hours,minutes): hours_in_int = int(hours) minutes_in_int = int(minutes) if hours_in_int >= 1 and hours_in_int < 12: converted_time = hours + ":" + minutes + " AM" elif hours_in_int >= 12 and hours_in_int < 24: converted_time = hours + ":" + minutes + " PM" elif hours == "00": hours = "12" converted_time = hours + ":" + minutes + " AM" return converted_time
class Pytime: def print_time(self, input): time_in_string = str(input) length = len(time_in_string) if length == 3: (hour, minute1, minute2) = time_in_string hours = '0' + hour minutes = minute1 + minute2 converted_time = self.calculateTime(hours, minutes) elif length == 4: (hour1, hour2, minute1, minute2) = time_in_string hours = hour1 + hour2 minutes = minute1 + minute2 converted_time = self.calculateTime(hours, minutes) elif time_in_string == '000' or time_in_string == '0000': (hour1, hour2, minute1, minute2) = time_in_string hours = hour1 + hour2 minutes = minute1 + minute2 converted_time = self.calculateTime(hours, minutes) else: return 'Invalid Format' return converted_time def calculate_time(self, hours, minutes): hours_in_int = int(hours) minutes_in_int = int(minutes) if hours_in_int >= 1 and hours_in_int < 12: converted_time = hours + ':' + minutes + ' AM' elif hours_in_int >= 12 and hours_in_int < 24: converted_time = hours + ':' + minutes + ' PM' elif hours == '00': hours = '12' converted_time = hours + ':' + minutes + ' AM' return converted_time
# create sets names = {'anonymous','tazri','farha'}; extra_name = {'tazri','farha','troy'}; name_list = {'solus','xenon','neon'}; name_tuple = ('helium','hydrogen'); print("names : ",names); # add focasa in names print("add 'focasa' than set : "); names.add("focasa"); print(names); # update method print("\n\nadd extra_name in set with update method : "); names.update(extra_name); print(names); # update set with list print("\nadd name_list in set with update method : "); names.update(name_list); print(names); # update set with tuple print("\nadd name_tuple in set with update method : "); names.update(name_tuple); print(names);
names = {'anonymous', 'tazri', 'farha'} extra_name = {'tazri', 'farha', 'troy'} name_list = {'solus', 'xenon', 'neon'} name_tuple = ('helium', 'hydrogen') print('names : ', names) print("add 'focasa' than set : ") names.add('focasa') print(names) print('\n\nadd extra_name in set with update method : ') names.update(extra_name) print(names) print('\nadd name_list in set with update method : ') names.update(name_list) print(names) print('\nadd name_tuple in set with update method : ') names.update(name_tuple) print(names)
user = int(input("ENTER NUMBER OF STUDENTS IN CLASS : ")) i = 1 marks = [] absent = [] # mark = marks.copy() print("FOR ABSENT STUDENTS TYPE -1 AS MARKS") for j in range(user): student = int(input("ENTER MARKS OF STUDENT {} : ".format(i))) if student == -1: absent.append(i) else: marks.append(student) i += 1 def avg(): mrk = 0 for mark in marks: mrk += mark avg = mrk/(user-len(absent)) print("AVERAGE SCORE OF THE CLASS IS {}".format(avg)) def hmax_hmin(): hmax = 0 hmin = 100 for high in marks: if high > hmax: hmax = high for min in marks: if min < hmin: hmin = min print("HIGHEST SCORE OF THE CLASS IS {}".format(hmax)) print("--------------------------") print("LOWEST SCORE OF THE CLASS IS {}".format(hmin)) print("--------------------------") # print("--------------------------") # print("--------------------------") def abs_nt(): if len(absent) > 1: print("{} STUDENTS WERE ABSENT FOR THE TEST".format(len(absent))) elif len(absent) >= 1: print("{} STUDENT WAS ABSENT FOR THE TEST".format(len(absent))) else: print("ALL STUDENTS WERE PRESENT FOR THE TEST") print("--------------------------") def freq(): frq = 0 frmax = 0 for ele in marks: if marks.count(ele) > frq: frq = marks.count(ele) frmax = ele print("{} IS THE SCORE WITH HIGHEST OCCURING FREQUENCY {}".format(frmax, frq)) ######################################## while(1): print("FOR AVG TYPE 1") print("FOR MAX_MARKS AND MIN_MARKS TYPE 2") print("FOR FREQUENCY TYPE 3") print("FOR NUMBER OF ABSENT STUDENT TYPE 4") choise=int(input()) if choise==1: print("--------------------------") avg() print("--------------------------") elif choise==2: print("--------------------------") hmax_hmin() print("--------------------------") elif choise==3: print("--------------------------") freq() print("--------------------------") elif choise==4: print("--------------------------") abs_nt() print("--------------------------") else: print("--------------------------") print("TYPE RIGHT CHOICE") print("--------------------------") break
user = int(input('ENTER NUMBER OF STUDENTS IN CLASS : ')) i = 1 marks = [] absent = [] print('FOR ABSENT STUDENTS TYPE -1 AS MARKS') for j in range(user): student = int(input('ENTER MARKS OF STUDENT {} : '.format(i))) if student == -1: absent.append(i) else: marks.append(student) i += 1 def avg(): mrk = 0 for mark in marks: mrk += mark avg = mrk / (user - len(absent)) print('AVERAGE SCORE OF THE CLASS IS {}'.format(avg)) def hmax_hmin(): hmax = 0 hmin = 100 for high in marks: if high > hmax: hmax = high for min in marks: if min < hmin: hmin = min print('HIGHEST SCORE OF THE CLASS IS {}'.format(hmax)) print('--------------------------') print('LOWEST SCORE OF THE CLASS IS {}'.format(hmin)) print('--------------------------') def abs_nt(): if len(absent) > 1: print('{} STUDENTS WERE ABSENT FOR THE TEST'.format(len(absent))) elif len(absent) >= 1: print('{} STUDENT WAS ABSENT FOR THE TEST'.format(len(absent))) else: print('ALL STUDENTS WERE PRESENT FOR THE TEST') print('--------------------------') def freq(): frq = 0 frmax = 0 for ele in marks: if marks.count(ele) > frq: frq = marks.count(ele) frmax = ele print('{} IS THE SCORE WITH HIGHEST OCCURING FREQUENCY {}'.format(frmax, frq)) while 1: print('FOR AVG TYPE 1') print('FOR MAX_MARKS AND MIN_MARKS TYPE 2') print('FOR FREQUENCY TYPE 3') print('FOR NUMBER OF ABSENT STUDENT TYPE 4') choise = int(input()) if choise == 1: print('--------------------------') avg() print('--------------------------') elif choise == 2: print('--------------------------') hmax_hmin() print('--------------------------') elif choise == 3: print('--------------------------') freq() print('--------------------------') elif choise == 4: print('--------------------------') abs_nt() print('--------------------------') else: print('--------------------------') print('TYPE RIGHT CHOICE') print('--------------------------') break
def sum_func(num1,num2 =30,num3=40): return num1 + num2 + num3 print(sum_func(10)) print(sum_func(10,20)) print(sum_func(10,20,30))
def sum_func(num1, num2=30, num3=40): return num1 + num2 + num3 print(sum_func(10)) print(sum_func(10, 20)) print(sum_func(10, 20, 30))
def variableName(name): str_name = [i for i in str(name)] non_acc_chars = [ " ", ">", "<", ":", "-", "|", ".", ",", "!", "[", "]", "'", "/", "@", "#", "&", "%", "?", "*", ] if str_name[0] in str([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]): return False for j in range(len(str_name)): if str_name[j] in non_acc_chars: return False return True
def variable_name(name): str_name = [i for i in str(name)] non_acc_chars = [' ', '>', '<', ':', '-', '|', '.', ',', '!', '[', ']', "'", '/', '@', '#', '&', '%', '?', '*'] if str_name[0] in str([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]): return False for j in range(len(str_name)): if str_name[j] in non_acc_chars: return False return True
def palindrome(num): return str(num) == str(num)[::-1] # Bots are software programs that combine requests # top Returns a reference to the top most element of the stack def largest(bot, top): z = 0 for i in range(top, bot, -1): for j in range(top, bot, -1): if palindrome(i * j): if i*j > z: z = i*j return z print(largest(100, 999))
def palindrome(num): return str(num) == str(num)[::-1] def largest(bot, top): z = 0 for i in range(top, bot, -1): for j in range(top, bot, -1): if palindrome(i * j): if i * j > z: z = i * j return z print(largest(100, 999))
# # Copyright (c) 2020 Xilinx, Inc. All rights reserved. # SPDX-License-Identifier: MIT # plnx_package_boot = True # Generate Package Boot Images
plnx_package_boot = True
# # PySNMP MIB module AGG-TRAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AGG-TRAP-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:15:43 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # devName, mateHost, unknownDeviceTrapContents, pepName, oldFile, reason, result, matePort, file, sbProducerPort, port, snName, host, myHost, minutes, newFile, sbProducerHost, myPort = mibBuilder.importSymbols("AGGREGATED-EXT-MIB", "devName", "mateHost", "unknownDeviceTrapContents", "pepName", "oldFile", "reason", "result", "matePort", "file", "sbProducerPort", "port", "snName", "host", "myHost", "minutes", "newFile", "sbProducerHost", "myPort") ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ConstraintsUnion") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") snmpModules, ObjectName, Counter32, IpAddress, Integer32, TimeTicks, ModuleIdentity, Unsigned32, Gauge32, NotificationType, enterprises, Counter64, Bits, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier, iso = mibBuilder.importSymbols("SNMPv2-SMI", "snmpModules", "ObjectName", "Counter32", "IpAddress", "Integer32", "TimeTicks", "ModuleIdentity", "Unsigned32", "Gauge32", "NotificationType", "enterprises", "Counter64", "Bits", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier", "iso") RowStatus, TruthValue, TestAndIncr, DisplayString, TimeStamp, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TruthValue", "TestAndIncr", "DisplayString", "TimeStamp", "TextualConvention") lucent = MibIdentifier((1, 3, 6, 1, 4, 1, 1751)) products = MibIdentifier((1, 3, 6, 1, 4, 1, 1751, 1)) mantraDevice = MibIdentifier((1, 3, 6, 1, 4, 1, 1751, 1, 1198)) mantraTraps = ModuleIdentity((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0)) if mibBuilder.loadTexts: mantraTraps.setLastUpdated('240701') if mibBuilder.loadTexts: mantraTraps.setOrganization('Lucent Technologies') if mibBuilder.loadTexts: mantraTraps.setContactInfo('') if mibBuilder.loadTexts: mantraTraps.setDescription('The MIB module for entities implementing the xxxx protocol.') unParsedEvent = NotificationType((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 5)).setObjects(("AGGREGATED-EXT-MIB", "unknownDeviceTrapContents")) if mibBuilder.loadTexts: unParsedEvent.setStatus('current') if mibBuilder.loadTexts: unParsedEvent.setDescription('An event is sent up as unParsedEvent, if there is an error in formatting, and event construction does not succeed. The variables are: 1) unknownDeviceTrapContents - a string representing the event text as the pep received it. Severity: MAJOR') styxProducerConnect = NotificationType((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 6)).setObjects(("AGGREGATED-EXT-MIB", "pepName"), ("AGGREGATED-EXT-MIB", "devName"), ("AGGREGATED-EXT-MIB", "host"), ("AGGREGATED-EXT-MIB", "port"), ("AGGREGATED-EXT-MIB", "file")) if mibBuilder.loadTexts: styxProducerConnect.setStatus('current') if mibBuilder.loadTexts: styxProducerConnect.setDescription('Indicates that the pep was sucessfully able to connect to the source of events specified in its config. The variables are: 1) pepName - this is the name of the PEP who is raising the event 2) devName - this is the logical name of the device this pep is connected to 3-4) host:port - these two identify the device that was mounted by the pep 5) file - this is the file name used internally start-up event, mainly. Severity: INFO') styxProducerUnReadable = NotificationType((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 7)).setObjects(("AGGREGATED-EXT-MIB", "pepName"), ("AGGREGATED-EXT-MIB", "devName"), ("AGGREGATED-EXT-MIB", "host"), ("AGGREGATED-EXT-MIB", "port"), ("AGGREGATED-EXT-MIB", "file")) if mibBuilder.loadTexts: styxProducerUnReadable.setStatus('current') if mibBuilder.loadTexts: styxProducerUnReadable.setDescription("Indicates that the pep's connection exists to the device, but the file named in the trap is not readable. The variables are: 1) pepName - this is the name of the PEP who is raising the event 2) devName - this is the logical name of the device this pep is connected to 3-4) host:port - these two identify the device that was mounted by the pep 5) file - this is the file name used internally Severity: MAJOR") styxProducerDisconnect = NotificationType((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 8)).setObjects(("AGGREGATED-EXT-MIB", "pepName"), ("AGGREGATED-EXT-MIB", "devName"), ("AGGREGATED-EXT-MIB", "host"), ("AGGREGATED-EXT-MIB", "port"), ("AGGREGATED-EXT-MIB", "file")) if mibBuilder.loadTexts: styxProducerDisconnect.setStatus('current') if mibBuilder.loadTexts: styxProducerDisconnect.setDescription("Indicates that the pep's connection to the source of events was severed. This could either be because device process died, or because there is a network outage. The variables are: 1) pepName - this is the name of the PEP who is raising the event 2) devName - this is the logical name of the device this pep is connected to 3-4) host:port - these two identify the device that was mounted by the pep 5) file - this is the file name used internally Severity: MAJOR") styxProducerUnReachable = NotificationType((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 9)).setObjects(("AGGREGATED-EXT-MIB", "pepName"), ("AGGREGATED-EXT-MIB", "devName"), ("AGGREGATED-EXT-MIB", "host"), ("AGGREGATED-EXT-MIB", "port"), ("AGGREGATED-EXT-MIB", "file"), ("AGGREGATED-EXT-MIB", "minutes")) if mibBuilder.loadTexts: styxProducerUnReachable.setStatus('current') if mibBuilder.loadTexts: styxProducerUnReachable.setDescription("Indicates that the pep's connection to the device has not been up for some time now, indicated in minutes. The variables are: 1) pepName - this is the name of the PEP who is raising the event 2) devName - this is the logical name of the device this pep is connected to 3-4) host, port - these two identify the device that was mounted by the pep 5) file - this is the file name used internally minutes - the time in minutes for which the connection to the device has not been up. Severity: MAJOR") logFileChanged = NotificationType((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 10)).setObjects(("AGGREGATED-EXT-MIB", "oldFile"), ("AGGREGATED-EXT-MIB", "newFile"), ("AGGREGATED-EXT-MIB", "result"), ("AGGREGATED-EXT-MIB", "reason")) if mibBuilder.loadTexts: logFileChanged.setStatus('current') if mibBuilder.loadTexts: logFileChanged.setDescription("Indicates that a log-file-change attempt is successful or failure. The variables are: 1) oldFile - this is the name of the old file which was to be changed. 2) newFile - this is the new log file name 3) result - this indicates 'success' or failure of logFileChange attempt. 4) reason - this describes the reason when log file change has failed. Severity: INFO") styxFTMateConnect = NotificationType((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 11)).setObjects(("AGGREGATED-EXT-MIB", "snName"), ("AGGREGATED-EXT-MIB", "myHost"), ("AGGREGATED-EXT-MIB", "myPort"), ("AGGREGATED-EXT-MIB", "mateHost"), ("AGGREGATED-EXT-MIB", "matePort")) if mibBuilder.loadTexts: styxFTMateConnect.setStatus('current') if mibBuilder.loadTexts: styxFTMateConnect.setDescription('Indicates that this ServiceNode was sucessfully able to connect to its redundant mate. This event is usually raised by the Backup mate who is responsible for monitoring its respective Primary. The variables are: 1) snName - this is the name of the ServiceNode who is raising the event. 2-3) myHost:myPort - these identify the host and port of the ServiceNode raising the event. 4-5) mateHost:matePort - these identify the host and port of the mate to which this ServiceNode connected. Severity: INFO') styxFTMateDisconnect = NotificationType((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 12)).setObjects(("AGGREGATED-EXT-MIB", "snName"), ("AGGREGATED-EXT-MIB", "myHost"), ("AGGREGATED-EXT-MIB", "myPort"), ("AGGREGATED-EXT-MIB", "mateHost"), ("AGGREGATED-EXT-MIB", "matePort")) if mibBuilder.loadTexts: styxFTMateDisconnect.setStatus('current') if mibBuilder.loadTexts: styxFTMateDisconnect.setDescription('Indicates that this ServiceNode has lost connection to its redundant mate due to either process or host failure. This event is usually raised by the Backup mate who is monitoring its respective Primary. Connection will be established upon recovery of the mate. The variables are: 1) snName - this is the name of the ServiceNode who is raising the event 2-3) myHost:myPort - these identify the host and port of the ServiceNode raising the event. 4-5) mateHost:matePort - these identify the host and port of the mate to which this ServiceNode lost connection. Severity: MAJOR') sBProducerUnreachable = NotificationType((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 13)).setObjects(("AGGREGATED-EXT-MIB", "pepName"), ("AGGREGATED-EXT-MIB", "devName"), ("AGGREGATED-EXT-MIB", "sbProducerHost"), ("AGGREGATED-EXT-MIB", "sbProducerPort")) if mibBuilder.loadTexts: sBProducerUnreachable.setStatus('current') if mibBuilder.loadTexts: sBProducerUnreachable.setDescription('Indicates that this Socket Based Producer is not reachable by the Policy Enforcement Point. The variables are: 1) pepName - this is the name of the Policy Enforcement Point (PEP) who is raising the event 2) devName: Device which is unreachable 3) sbProducerHost: Host where the Socket Based event producer is on. 4) sbProducerPort: Port where the Socket Based event producer is running on. Severity: MAJOR') sBProducerConnected = NotificationType((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 14)).setObjects(("AGGREGATED-EXT-MIB", "pepName"), ("AGGREGATED-EXT-MIB", "devName"), ("AGGREGATED-EXT-MIB", "sbProducerHost"), ("AGGREGATED-EXT-MIB", "sbProducerPort")) if mibBuilder.loadTexts: sBProducerConnected.setStatus('current') if mibBuilder.loadTexts: sBProducerConnected.setDescription('Indicates that this Socket Based Producer has connected to the Policy Enforcement Point (PEP). The variables are: 1) pepName - this is the name of the Policy Enforcement Point (PEP) who is raising the event 2) devName: Device which is unreachable 3) sbProducerHost: Host where the Socket Based event producer is on. 4) sbProducerPort: Port where the Socket Based event producer is running on. Severity: MAJOR') sBProducerRegistered = NotificationType((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 15)).setObjects(("AGGREGATED-EXT-MIB", "pepName"), ("AGGREGATED-EXT-MIB", "devName"), ("AGGREGATED-EXT-MIB", "sbProducerHost"), ("AGGREGATED-EXT-MIB", "sbProducerPort")) if mibBuilder.loadTexts: sBProducerRegistered.setStatus('current') if mibBuilder.loadTexts: sBProducerRegistered.setDescription('Indicates that this Socket Based Producer has registered with the Policy Enforcement Point (PEP). The variables are: 1) pepName - this is the name of the Policy Enforcement Point (PEP) who is raising the event 2) devName: Device which is unreachable 3) sbProducerHost: Host where the Socket Based event producer is on. 4) sbProducerPort: Port where the Socket Based event producer is running on. Severity: INFO') sBProducerDisconnected = NotificationType((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 16)).setObjects(("AGGREGATED-EXT-MIB", "pepName"), ("AGGREGATED-EXT-MIB", "devName"), ("AGGREGATED-EXT-MIB", "sbProducerHost"), ("AGGREGATED-EXT-MIB", "sbProducerPort")) if mibBuilder.loadTexts: sBProducerDisconnected.setStatus('current') if mibBuilder.loadTexts: sBProducerDisconnected.setDescription('Indicates that this Socket Based Producer has disconnected from the Policy Enforcement Point (PEP). The variables are: 1) pepName - this is the name of the Policy Enforcement Point (PEP) who is raising the event 2) devName: Device which is unreachable 3) sbProducerHost: Host where the Socket Based event producer is on. 4) sbProducerPort: Port where the Socket Based event producer is running on. Severity: INFO') sBProducerCannotRegister = NotificationType((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 17)).setObjects(("AGGREGATED-EXT-MIB", "pepName"), ("AGGREGATED-EXT-MIB", "devName"), ("AGGREGATED-EXT-MIB", "sbProducerHost"), ("AGGREGATED-EXT-MIB", "sbProducerPort")) if mibBuilder.loadTexts: sBProducerCannotRegister.setStatus('current') if mibBuilder.loadTexts: sBProducerCannotRegister.setDescription('Indicates that this Socket Based Producer cannot register to the Policy Enforcement Point (PEP). The variables are: 1) pepName - this is the name of the Policy Enforcement Point (PEP) who is raising the event 2) devName: Device which is unreachable 3) sbProducerHost: Host where the Socket Based event producer is on. 4) sbProducerPort: Port where the Socket Based event producer is running on. Severity: INFO') sBProducerCannotDisconnect = NotificationType((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 18)).setObjects(("AGGREGATED-EXT-MIB", "pepName"), ("AGGREGATED-EXT-MIB", "devName"), ("AGGREGATED-EXT-MIB", "sbProducerHost"), ("AGGREGATED-EXT-MIB", "sbProducerPort")) if mibBuilder.loadTexts: sBProducerCannotDisconnect.setStatus('current') if mibBuilder.loadTexts: sBProducerCannotDisconnect.setDescription('Indicates that this Socket Based Producer cannot disconenct from the Policy Enforcement Point (PEP). The variables are: 1) pepName - this is the name of the Policy Enforcement Point (PEP) who is raising the event 2) devName: Device which is unreachable 3) sbProducerHost: Host where the Socket Based event producer is on. 4) sbProducerPort: Port where the Socket Based event producer is running on. Severity: INFO') mibBuilder.exportSymbols("AGG-TRAP-MIB", sBProducerUnreachable=sBProducerUnreachable, sBProducerRegistered=sBProducerRegistered, PYSNMP_MODULE_ID=mantraTraps, sBProducerDisconnected=sBProducerDisconnected, products=products, styxProducerConnect=styxProducerConnect, mantraTraps=mantraTraps, styxFTMateDisconnect=styxFTMateDisconnect, sBProducerCannotDisconnect=sBProducerCannotDisconnect, styxProducerUnReachable=styxProducerUnReachable, sBProducerCannotRegister=sBProducerCannotRegister, unParsedEvent=unParsedEvent, styxFTMateConnect=styxFTMateConnect, sBProducerConnected=sBProducerConnected, logFileChanged=logFileChanged, lucent=lucent, styxProducerDisconnect=styxProducerDisconnect, mantraDevice=mantraDevice, styxProducerUnReadable=styxProducerUnReadable)
(dev_name, mate_host, unknown_device_trap_contents, pep_name, old_file, reason, result, mate_port, file, sb_producer_port, port, sn_name, host, my_host, minutes, new_file, sb_producer_host, my_port) = mibBuilder.importSymbols('AGGREGATED-EXT-MIB', 'devName', 'mateHost', 'unknownDeviceTrapContents', 'pepName', 'oldFile', 'reason', 'result', 'matePort', 'file', 'sbProducerPort', 'port', 'snName', 'host', 'myHost', 'minutes', 'newFile', 'sbProducerHost', 'myPort') (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (snmp_modules, object_name, counter32, ip_address, integer32, time_ticks, module_identity, unsigned32, gauge32, notification_type, enterprises, counter64, bits, object_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, mib_identifier, iso) = mibBuilder.importSymbols('SNMPv2-SMI', 'snmpModules', 'ObjectName', 'Counter32', 'IpAddress', 'Integer32', 'TimeTicks', 'ModuleIdentity', 'Unsigned32', 'Gauge32', 'NotificationType', 'enterprises', 'Counter64', 'Bits', 'ObjectIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'MibIdentifier', 'iso') (row_status, truth_value, test_and_incr, display_string, time_stamp, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'RowStatus', 'TruthValue', 'TestAndIncr', 'DisplayString', 'TimeStamp', 'TextualConvention') lucent = mib_identifier((1, 3, 6, 1, 4, 1, 1751)) products = mib_identifier((1, 3, 6, 1, 4, 1, 1751, 1)) mantra_device = mib_identifier((1, 3, 6, 1, 4, 1, 1751, 1, 1198)) mantra_traps = module_identity((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0)) if mibBuilder.loadTexts: mantraTraps.setLastUpdated('240701') if mibBuilder.loadTexts: mantraTraps.setOrganization('Lucent Technologies') if mibBuilder.loadTexts: mantraTraps.setContactInfo('') if mibBuilder.loadTexts: mantraTraps.setDescription('The MIB module for entities implementing the xxxx protocol.') un_parsed_event = notification_type((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 5)).setObjects(('AGGREGATED-EXT-MIB', 'unknownDeviceTrapContents')) if mibBuilder.loadTexts: unParsedEvent.setStatus('current') if mibBuilder.loadTexts: unParsedEvent.setDescription('An event is sent up as unParsedEvent, if there is an error in formatting, and event construction does not succeed. The variables are: 1) unknownDeviceTrapContents - a string representing the event text as the pep received it. Severity: MAJOR') styx_producer_connect = notification_type((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 6)).setObjects(('AGGREGATED-EXT-MIB', 'pepName'), ('AGGREGATED-EXT-MIB', 'devName'), ('AGGREGATED-EXT-MIB', 'host'), ('AGGREGATED-EXT-MIB', 'port'), ('AGGREGATED-EXT-MIB', 'file')) if mibBuilder.loadTexts: styxProducerConnect.setStatus('current') if mibBuilder.loadTexts: styxProducerConnect.setDescription('Indicates that the pep was sucessfully able to connect to the source of events specified in its config. The variables are: 1) pepName - this is the name of the PEP who is raising the event 2) devName - this is the logical name of the device this pep is connected to 3-4) host:port - these two identify the device that was mounted by the pep 5) file - this is the file name used internally start-up event, mainly. Severity: INFO') styx_producer_un_readable = notification_type((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 7)).setObjects(('AGGREGATED-EXT-MIB', 'pepName'), ('AGGREGATED-EXT-MIB', 'devName'), ('AGGREGATED-EXT-MIB', 'host'), ('AGGREGATED-EXT-MIB', 'port'), ('AGGREGATED-EXT-MIB', 'file')) if mibBuilder.loadTexts: styxProducerUnReadable.setStatus('current') if mibBuilder.loadTexts: styxProducerUnReadable.setDescription("Indicates that the pep's connection exists to the device, but the file named in the trap is not readable. The variables are: 1) pepName - this is the name of the PEP who is raising the event 2) devName - this is the logical name of the device this pep is connected to 3-4) host:port - these two identify the device that was mounted by the pep 5) file - this is the file name used internally Severity: MAJOR") styx_producer_disconnect = notification_type((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 8)).setObjects(('AGGREGATED-EXT-MIB', 'pepName'), ('AGGREGATED-EXT-MIB', 'devName'), ('AGGREGATED-EXT-MIB', 'host'), ('AGGREGATED-EXT-MIB', 'port'), ('AGGREGATED-EXT-MIB', 'file')) if mibBuilder.loadTexts: styxProducerDisconnect.setStatus('current') if mibBuilder.loadTexts: styxProducerDisconnect.setDescription("Indicates that the pep's connection to the source of events was severed. This could either be because device process died, or because there is a network outage. The variables are: 1) pepName - this is the name of the PEP who is raising the event 2) devName - this is the logical name of the device this pep is connected to 3-4) host:port - these two identify the device that was mounted by the pep 5) file - this is the file name used internally Severity: MAJOR") styx_producer_un_reachable = notification_type((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 9)).setObjects(('AGGREGATED-EXT-MIB', 'pepName'), ('AGGREGATED-EXT-MIB', 'devName'), ('AGGREGATED-EXT-MIB', 'host'), ('AGGREGATED-EXT-MIB', 'port'), ('AGGREGATED-EXT-MIB', 'file'), ('AGGREGATED-EXT-MIB', 'minutes')) if mibBuilder.loadTexts: styxProducerUnReachable.setStatus('current') if mibBuilder.loadTexts: styxProducerUnReachable.setDescription("Indicates that the pep's connection to the device has not been up for some time now, indicated in minutes. The variables are: 1) pepName - this is the name of the PEP who is raising the event 2) devName - this is the logical name of the device this pep is connected to 3-4) host, port - these two identify the device that was mounted by the pep 5) file - this is the file name used internally minutes - the time in minutes for which the connection to the device has not been up. Severity: MAJOR") log_file_changed = notification_type((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 10)).setObjects(('AGGREGATED-EXT-MIB', 'oldFile'), ('AGGREGATED-EXT-MIB', 'newFile'), ('AGGREGATED-EXT-MIB', 'result'), ('AGGREGATED-EXT-MIB', 'reason')) if mibBuilder.loadTexts: logFileChanged.setStatus('current') if mibBuilder.loadTexts: logFileChanged.setDescription("Indicates that a log-file-change attempt is successful or failure. The variables are: 1) oldFile - this is the name of the old file which was to be changed. 2) newFile - this is the new log file name 3) result - this indicates 'success' or failure of logFileChange attempt. 4) reason - this describes the reason when log file change has failed. Severity: INFO") styx_ft_mate_connect = notification_type((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 11)).setObjects(('AGGREGATED-EXT-MIB', 'snName'), ('AGGREGATED-EXT-MIB', 'myHost'), ('AGGREGATED-EXT-MIB', 'myPort'), ('AGGREGATED-EXT-MIB', 'mateHost'), ('AGGREGATED-EXT-MIB', 'matePort')) if mibBuilder.loadTexts: styxFTMateConnect.setStatus('current') if mibBuilder.loadTexts: styxFTMateConnect.setDescription('Indicates that this ServiceNode was sucessfully able to connect to its redundant mate. This event is usually raised by the Backup mate who is responsible for monitoring its respective Primary. The variables are: 1) snName - this is the name of the ServiceNode who is raising the event. 2-3) myHost:myPort - these identify the host and port of the ServiceNode raising the event. 4-5) mateHost:matePort - these identify the host and port of the mate to which this ServiceNode connected. Severity: INFO') styx_ft_mate_disconnect = notification_type((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 12)).setObjects(('AGGREGATED-EXT-MIB', 'snName'), ('AGGREGATED-EXT-MIB', 'myHost'), ('AGGREGATED-EXT-MIB', 'myPort'), ('AGGREGATED-EXT-MIB', 'mateHost'), ('AGGREGATED-EXT-MIB', 'matePort')) if mibBuilder.loadTexts: styxFTMateDisconnect.setStatus('current') if mibBuilder.loadTexts: styxFTMateDisconnect.setDescription('Indicates that this ServiceNode has lost connection to its redundant mate due to either process or host failure. This event is usually raised by the Backup mate who is monitoring its respective Primary. Connection will be established upon recovery of the mate. The variables are: 1) snName - this is the name of the ServiceNode who is raising the event 2-3) myHost:myPort - these identify the host and port of the ServiceNode raising the event. 4-5) mateHost:matePort - these identify the host and port of the mate to which this ServiceNode lost connection. Severity: MAJOR') s_b_producer_unreachable = notification_type((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 13)).setObjects(('AGGREGATED-EXT-MIB', 'pepName'), ('AGGREGATED-EXT-MIB', 'devName'), ('AGGREGATED-EXT-MIB', 'sbProducerHost'), ('AGGREGATED-EXT-MIB', 'sbProducerPort')) if mibBuilder.loadTexts: sBProducerUnreachable.setStatus('current') if mibBuilder.loadTexts: sBProducerUnreachable.setDescription('Indicates that this Socket Based Producer is not reachable by the Policy Enforcement Point. The variables are: 1) pepName - this is the name of the Policy Enforcement Point (PEP) who is raising the event 2) devName: Device which is unreachable 3) sbProducerHost: Host where the Socket Based event producer is on. 4) sbProducerPort: Port where the Socket Based event producer is running on. Severity: MAJOR') s_b_producer_connected = notification_type((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 14)).setObjects(('AGGREGATED-EXT-MIB', 'pepName'), ('AGGREGATED-EXT-MIB', 'devName'), ('AGGREGATED-EXT-MIB', 'sbProducerHost'), ('AGGREGATED-EXT-MIB', 'sbProducerPort')) if mibBuilder.loadTexts: sBProducerConnected.setStatus('current') if mibBuilder.loadTexts: sBProducerConnected.setDescription('Indicates that this Socket Based Producer has connected to the Policy Enforcement Point (PEP). The variables are: 1) pepName - this is the name of the Policy Enforcement Point (PEP) who is raising the event 2) devName: Device which is unreachable 3) sbProducerHost: Host where the Socket Based event producer is on. 4) sbProducerPort: Port where the Socket Based event producer is running on. Severity: MAJOR') s_b_producer_registered = notification_type((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 15)).setObjects(('AGGREGATED-EXT-MIB', 'pepName'), ('AGGREGATED-EXT-MIB', 'devName'), ('AGGREGATED-EXT-MIB', 'sbProducerHost'), ('AGGREGATED-EXT-MIB', 'sbProducerPort')) if mibBuilder.loadTexts: sBProducerRegistered.setStatus('current') if mibBuilder.loadTexts: sBProducerRegistered.setDescription('Indicates that this Socket Based Producer has registered with the Policy Enforcement Point (PEP). The variables are: 1) pepName - this is the name of the Policy Enforcement Point (PEP) who is raising the event 2) devName: Device which is unreachable 3) sbProducerHost: Host where the Socket Based event producer is on. 4) sbProducerPort: Port where the Socket Based event producer is running on. Severity: INFO') s_b_producer_disconnected = notification_type((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 16)).setObjects(('AGGREGATED-EXT-MIB', 'pepName'), ('AGGREGATED-EXT-MIB', 'devName'), ('AGGREGATED-EXT-MIB', 'sbProducerHost'), ('AGGREGATED-EXT-MIB', 'sbProducerPort')) if mibBuilder.loadTexts: sBProducerDisconnected.setStatus('current') if mibBuilder.loadTexts: sBProducerDisconnected.setDescription('Indicates that this Socket Based Producer has disconnected from the Policy Enforcement Point (PEP). The variables are: 1) pepName - this is the name of the Policy Enforcement Point (PEP) who is raising the event 2) devName: Device which is unreachable 3) sbProducerHost: Host where the Socket Based event producer is on. 4) sbProducerPort: Port where the Socket Based event producer is running on. Severity: INFO') s_b_producer_cannot_register = notification_type((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 17)).setObjects(('AGGREGATED-EXT-MIB', 'pepName'), ('AGGREGATED-EXT-MIB', 'devName'), ('AGGREGATED-EXT-MIB', 'sbProducerHost'), ('AGGREGATED-EXT-MIB', 'sbProducerPort')) if mibBuilder.loadTexts: sBProducerCannotRegister.setStatus('current') if mibBuilder.loadTexts: sBProducerCannotRegister.setDescription('Indicates that this Socket Based Producer cannot register to the Policy Enforcement Point (PEP). The variables are: 1) pepName - this is the name of the Policy Enforcement Point (PEP) who is raising the event 2) devName: Device which is unreachable 3) sbProducerHost: Host where the Socket Based event producer is on. 4) sbProducerPort: Port where the Socket Based event producer is running on. Severity: INFO') s_b_producer_cannot_disconnect = notification_type((1, 3, 6, 1, 4, 1, 1751, 1, 1198, 0, 18)).setObjects(('AGGREGATED-EXT-MIB', 'pepName'), ('AGGREGATED-EXT-MIB', 'devName'), ('AGGREGATED-EXT-MIB', 'sbProducerHost'), ('AGGREGATED-EXT-MIB', 'sbProducerPort')) if mibBuilder.loadTexts: sBProducerCannotDisconnect.setStatus('current') if mibBuilder.loadTexts: sBProducerCannotDisconnect.setDescription('Indicates that this Socket Based Producer cannot disconenct from the Policy Enforcement Point (PEP). The variables are: 1) pepName - this is the name of the Policy Enforcement Point (PEP) who is raising the event 2) devName: Device which is unreachable 3) sbProducerHost: Host where the Socket Based event producer is on. 4) sbProducerPort: Port where the Socket Based event producer is running on. Severity: INFO') mibBuilder.exportSymbols('AGG-TRAP-MIB', sBProducerUnreachable=sBProducerUnreachable, sBProducerRegistered=sBProducerRegistered, PYSNMP_MODULE_ID=mantraTraps, sBProducerDisconnected=sBProducerDisconnected, products=products, styxProducerConnect=styxProducerConnect, mantraTraps=mantraTraps, styxFTMateDisconnect=styxFTMateDisconnect, sBProducerCannotDisconnect=sBProducerCannotDisconnect, styxProducerUnReachable=styxProducerUnReachable, sBProducerCannotRegister=sBProducerCannotRegister, unParsedEvent=unParsedEvent, styxFTMateConnect=styxFTMateConnect, sBProducerConnected=sBProducerConnected, logFileChanged=logFileChanged, lucent=lucent, styxProducerDisconnect=styxProducerDisconnect, mantraDevice=mantraDevice, styxProducerUnReadable=styxProducerUnReadable)
nums = [int(input()) for _ in range(int(input()))] nums_count = [nums.count(a) for a in nums] min_count, max_count - min(nums_count), max(nums_count) min_num, max_num = 0, 0 a, b = 0, 0 for i in range(len(nums)): if nums_count[i] > b: max_num = nums[i] elif nums_count[i] == b: if nums[i] > max_num: max_num = numx[i]
nums = [int(input()) for _ in range(int(input()))] nums_count = [nums.count(a) for a in nums] (min_count, max_count - min(nums_count), max(nums_count)) (min_num, max_num) = (0, 0) (a, b) = (0, 0) for i in range(len(nums)): if nums_count[i] > b: max_num = nums[i] elif nums_count[i] == b: if nums[i] > max_num: max_num = numx[i]
# File: phishtank_consts.py # # Copyright (c) 2016-2021 Splunk Inc. # # 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 agreed to in writing, software distributed under # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, # either express or implied. See the License for the specific language governing permissions # and limitations under the License. PHISHTANK_DOMAIN = 'http://www.phishtank.com' PHISHTANK_API_DOMAIN = 'https://checkurl.phishtank.com/checkurl/' PHISHTANK_APP_KEY = 'app_key' PHISHTANK_MSG_QUERY_URL = 'Querying URL: {query_url}' PHISHTANK_MSG_CONNECTING = 'Polling Phishtank site ...' PHISHTANK_SERVICE_SUCC_MSG = 'Phishtank Service successfully executed.' PHISHTANK_SUCC_CONNECTIVITY_TEST = 'Connectivity test passed' PHISHTANK_ERR_CONNECTIVITY_TEST = 'Connectivity test failed' PHISHTANK_MSG_GOT_RESP = 'Got response from Phishtank' PHISHTANK_NO_RESPONSE = 'Server did not return a response \ for the object queried' PHISHTANK_SERVER_CONNECTION_ERROR = 'Server connection error' PHISHTANK_MSG_CHECK_CONNECTIVITY = 'Please check your network connectivity' PHISHTANK_SERVER_RETURNED_ERROR_CODE = 'Server returned error code: {code}' PHISHTANK_ERR_MSG_OBJECT_QUERIED = "Phishtank response didn't \ send expected response" PHISHTANK_ERR_MSG_ACTION_PARAM = 'Mandatory action parameter missing' PHISHTANK_SERVER_ERROR_RATE_LIMIT = 'Query is being rate limited. \ Server returned 509'
phishtank_domain = 'http://www.phishtank.com' phishtank_api_domain = 'https://checkurl.phishtank.com/checkurl/' phishtank_app_key = 'app_key' phishtank_msg_query_url = 'Querying URL: {query_url}' phishtank_msg_connecting = 'Polling Phishtank site ...' phishtank_service_succ_msg = 'Phishtank Service successfully executed.' phishtank_succ_connectivity_test = 'Connectivity test passed' phishtank_err_connectivity_test = 'Connectivity test failed' phishtank_msg_got_resp = 'Got response from Phishtank' phishtank_no_response = 'Server did not return a response for the object queried' phishtank_server_connection_error = 'Server connection error' phishtank_msg_check_connectivity = 'Please check your network connectivity' phishtank_server_returned_error_code = 'Server returned error code: {code}' phishtank_err_msg_object_queried = "Phishtank response didn't send expected response" phishtank_err_msg_action_param = 'Mandatory action parameter missing' phishtank_server_error_rate_limit = 'Query is being rate limited. Server returned 509'
# -*- coding: utf-8 -*- { 'name': 'Events', 'category': 'Website/Website', 'sequence': 166, 'summary': 'Publish events, sell tickets', 'website': 'https://www.odoo.com/page/events', 'description': "", 'depends': ['website', 'website_partner', 'website_mail', 'event'], 'data': [ 'data/event_data.xml', 'views/res_config_settings_views.xml', 'views/event_snippets.xml', 'views/event_templates.xml', 'views/event_views.xml', 'security/ir.model.access.csv', 'security/event_security.xml', ], 'demo': [ 'data/event_demo.xml' ], 'application': True, 'license': 'LGPL-3', }
{'name': 'Events', 'category': 'Website/Website', 'sequence': 166, 'summary': 'Publish events, sell tickets', 'website': 'https://www.odoo.com/page/events', 'description': '', 'depends': ['website', 'website_partner', 'website_mail', 'event'], 'data': ['data/event_data.xml', 'views/res_config_settings_views.xml', 'views/event_snippets.xml', 'views/event_templates.xml', 'views/event_views.xml', 'security/ir.model.access.csv', 'security/event_security.xml'], 'demo': ['data/event_demo.xml'], 'application': True, 'license': 'LGPL-3'}
Ds = [1, 1.2, 1.5, 2, 4] file_name = "f.csv" f = open(file_name, 'r') for depth in Ds: print('\n\n DEALING WITH ALL D = ', depth-1) DATA['below_depth'] = (depth - 1) * HEIGHT for angle in range(2,90,1): if angle %5 ==0: continue if angle >= 50 and angle <=60: continue f.close() f = open(file_name, 'a') update_data(new_slope=angle, radius_step=0.1, steps_number=400) DATA['below_depth'] = (depth - 1) * HEIGHT mySlope = generate_failures(DATA['h'], DATA['slope_angle'], DATA['steps_number'], DATA['left_right'], DATA['radius_range'], below_level=DATA['below_depth'], density=DATA['density'], plot=False) iter_data = [depth, SLOPE, mySlope.stability_number, mySlope.radius, mySlope.circle_cg[0], mySlope.circle_cg[1], mySlope.type, mySlope.compound] f.write(write_list(iter_data)) f.close() for angle in range(10,90,5): plt.clf() update_data(new_slope=angle) mySlope = generate_failures(DATA['h'], DATA['slope_angle'], DATA['steps_number'], DATA['left_right'], DATA['radius_range'], below_level=DATA['below_depth'], density=DATA['density']) plt.gca().set_aspect('equal', adjustable='box') plt.xlim(-10,70) plt.ylim(-1*DATA['below_depth']-1,50) plt.savefig('plots/' + str(angle) + '.png')
ds = [1, 1.2, 1.5, 2, 4] file_name = 'f.csv' f = open(file_name, 'r') for depth in Ds: print('\n\n DEALING WITH ALL D = ', depth - 1) DATA['below_depth'] = (depth - 1) * HEIGHT for angle in range(2, 90, 1): if angle % 5 == 0: continue if angle >= 50 and angle <= 60: continue f.close() f = open(file_name, 'a') update_data(new_slope=angle, radius_step=0.1, steps_number=400) DATA['below_depth'] = (depth - 1) * HEIGHT my_slope = generate_failures(DATA['h'], DATA['slope_angle'], DATA['steps_number'], DATA['left_right'], DATA['radius_range'], below_level=DATA['below_depth'], density=DATA['density'], plot=False) iter_data = [depth, SLOPE, mySlope.stability_number, mySlope.radius, mySlope.circle_cg[0], mySlope.circle_cg[1], mySlope.type, mySlope.compound] f.write(write_list(iter_data)) f.close() for angle in range(10, 90, 5): plt.clf() update_data(new_slope=angle) my_slope = generate_failures(DATA['h'], DATA['slope_angle'], DATA['steps_number'], DATA['left_right'], DATA['radius_range'], below_level=DATA['below_depth'], density=DATA['density']) plt.gca().set_aspect('equal', adjustable='box') plt.xlim(-10, 70) plt.ylim(-1 * DATA['below_depth'] - 1, 50) plt.savefig('plots/' + str(angle) + '.png')
class Db(): def __init__(self, section, host, wiki): self.section = section self.host = host self.wiki = wiki
class Db: def __init__(self, section, host, wiki): self.section = section self.host = host self.wiki = wiki
# a dp method class Solution: def longestPalindrome(self, s: str) -> str: size = len(s) if size < 2: return s dp = [[False for _ in range(size)] for _ in range(size)] maxLen = 1 start = 0 for i in range(size): dp[i][i] = True for j in range(1, size): for i in range(0, j): if s[i] == s[j]: if j - i <= 2: dp[i][j] = True else: dp[i][j] = dp[i + 1][j - 1] if dp[i][j]: curLen = j - i + 1 if curLen > maxLen: maxLen = curLen start = i return s[start : start + maxLen]
class Solution: def longest_palindrome(self, s: str) -> str: size = len(s) if size < 2: return s dp = [[False for _ in range(size)] for _ in range(size)] max_len = 1 start = 0 for i in range(size): dp[i][i] = True for j in range(1, size): for i in range(0, j): if s[i] == s[j]: if j - i <= 2: dp[i][j] = True else: dp[i][j] = dp[i + 1][j - 1] if dp[i][j]: cur_len = j - i + 1 if curLen > maxLen: max_len = curLen start = i return s[start:start + maxLen]
#Votes Voter0 = int(input("Vote:")) Voter1 = int(input("Vote:")) Voter2 = int(input("Vote:")) #Count def count_votes(): #Accounts voter0_account = 0 voter1_account = 0 voter2_account = 0 #Total total = Voter0 + Voter1 + Voter2 #Return if total > 1: voter2_account =+ 1 print(voter2_account) else: print(voter2_account) count_votes()
voter0 = int(input('Vote:')) voter1 = int(input('Vote:')) voter2 = int(input('Vote:')) def count_votes(): voter0_account = 0 voter1_account = 0 voter2_account = 0 total = Voter0 + Voter1 + Voter2 if total > 1: voter2_account = +1 print(voter2_account) else: print(voter2_account) count_votes()
otra_coordenada=(0, 1) new=otra_coordenada.x print(new)
otra_coordenada = (0, 1) new = otra_coordenada.x print(new)
#!/usr/bin/env python # coding: utf-8 # Given two arrays, write a function to compute their intersection. # # Example 1: # # Input: nums1 = [1,2,2,1], nums2 = [2,2] # Output: [2] # Example 2: # # Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4] # Output: [9,4] # In[1]: def intersection(nums1, nums2): return list(set(nums1) & set(nums2)) print(intersection([4,9,5],[9,4,9,8,4])) # In[2]: def intersection(nums1, nums2): stack =[] for i in nums1: if i not in stack and i in nums2: stack.append(i) return stack print(intersection([4,9,5],[9,4,9,8,4])) # In[ ]:
def intersection(nums1, nums2): return list(set(nums1) & set(nums2)) print(intersection([4, 9, 5], [9, 4, 9, 8, 4])) def intersection(nums1, nums2): stack = [] for i in nums1: if i not in stack and i in nums2: stack.append(i) return stack print(intersection([4, 9, 5], [9, 4, 9, 8, 4]))
s = 0 for c in range(0, 6): n = int(input('Digite numero inteiro: ')) if n%2==0: s += n print(f'A soma dos valores par e {s}')
s = 0 for c in range(0, 6): n = int(input('Digite numero inteiro: ')) if n % 2 == 0: s += n print(f'A soma dos valores par e {s}')
#stringCaps.py msg = "john nash" print(msg) # ALL CAPS msg_upper = msg.upper() print(msg_upper) # First Letter Of Each Word Capitalized msg_title = msg.title() print(msg_title)
msg = 'john nash' print(msg) msg_upper = msg.upper() print(msg_upper) msg_title = msg.title() print(msg_title)
def create_500M_file(name): native.genrule( name = name + "_target", outs = [name], output_to_bindir = 1, cmd = "truncate -s 500M $@", )
def create_500_m_file(name): native.genrule(name=name + '_target', outs=[name], output_to_bindir=1, cmd='truncate -s 500M $@')
hotels = pois[pois['fclass']=='hotel'] citylondon = boroughs.loc[boroughs['name'] == 'City of London', 'geometry'].squeeze() cityhotels = hotels[hotels.within(citylondon)] [fig,ax] = plt.subplots(1, figsize=(12, 8)) base = boroughs.plot(color='lightblue', edgecolor='black',ax=ax); cityhotels.plot(ax=ax, marker='o', color='red', markersize=8); ax.axis('off');
hotels = pois[pois['fclass'] == 'hotel'] citylondon = boroughs.loc[boroughs['name'] == 'City of London', 'geometry'].squeeze() cityhotels = hotels[hotels.within(citylondon)] [fig, ax] = plt.subplots(1, figsize=(12, 8)) base = boroughs.plot(color='lightblue', edgecolor='black', ax=ax) cityhotels.plot(ax=ax, marker='o', color='red', markersize=8) ax.axis('off')
class Config: PROXY_WEBPAGE = "https://free-proxy-list.net/" TESTING_URL = "https://google.com" REDIS_CONFIG = { "host": "redis", "port": "6379", "db": 0 } REDIS_KEY = "proxies" MAX_WORKERS = 50 NUMBER_OF_PROXIES = 50 RSS_FEEDS = { "en": [ "https://www.goal.com/feeds/en/news", "https://www.eyefootball.com/football_news.xml", "https://www.101greatgoals.com/feed/", "https://sportslens.com/feed/", "https://deadspin.com/rss" ], "pl": [ "https://weszlo.com/feed/", "https://sportowefakty.wp.pl/rss.xml", "https://futbolnews.pl/feed", "https://igol.pl/feed/" ], "es": [ "https://as.com/rss/tags/ultimas_noticias.xml", "https://e00-marca.uecdn.es/rss/futbol/mas-futbol.xml", "https://www.futbolred.com/rss-news/liga-de-espana.xml", "https://www.futbolya.com/rss/noticias.xml" ], "de": [ "https://www.spox.com/pub/rss/sport-media.xml", "https://www.dfb.de/news/rss/feed/" ] } BOOTSTRAP_SERVERS = ["kafka:9092"] TOPIC = "rss_news" VALIDATOR_CONFIG = { "description_length": 10, "languages": [ "en", "pl", "es", "de" ] } REFERENCE_RATES = { "secured": ["https://markets.newyorkfed.org/api/rates/secured/all/latest.xml"], "unsecured": ["https://markets.newyorkfed.org/api/rates/unsecured/all/latest.xml"] }
class Config: proxy_webpage = 'https://free-proxy-list.net/' testing_url = 'https://google.com' redis_config = {'host': 'redis', 'port': '6379', 'db': 0} redis_key = 'proxies' max_workers = 50 number_of_proxies = 50 rss_feeds = {'en': ['https://www.goal.com/feeds/en/news', 'https://www.eyefootball.com/football_news.xml', 'https://www.101greatgoals.com/feed/', 'https://sportslens.com/feed/', 'https://deadspin.com/rss'], 'pl': ['https://weszlo.com/feed/', 'https://sportowefakty.wp.pl/rss.xml', 'https://futbolnews.pl/feed', 'https://igol.pl/feed/'], 'es': ['https://as.com/rss/tags/ultimas_noticias.xml', 'https://e00-marca.uecdn.es/rss/futbol/mas-futbol.xml', 'https://www.futbolred.com/rss-news/liga-de-espana.xml', 'https://www.futbolya.com/rss/noticias.xml'], 'de': ['https://www.spox.com/pub/rss/sport-media.xml', 'https://www.dfb.de/news/rss/feed/']} bootstrap_servers = ['kafka:9092'] topic = 'rss_news' validator_config = {'description_length': 10, 'languages': ['en', 'pl', 'es', 'de']} reference_rates = {'secured': ['https://markets.newyorkfed.org/api/rates/secured/all/latest.xml'], 'unsecured': ['https://markets.newyorkfed.org/api/rates/unsecured/all/latest.xml']}
# This file describes some constants which stay the same in every testing environment # Total number of fish N_FISH = 70 # Total number of fish species N_SPECIES = 7 # Total number of time steps per environment N_STEPS = 180 # Number of possible emissions, i.e. fish movements # (all emissions are represented with integers from 0 to this constant (exclusive)) N_EMISSIONS = 8 # Time limit per each guess (in seconds) # You can change this value locally, but it will be fixed to 5 on Kattis STEP_TIME_THRESHOLD = 5
n_fish = 70 n_species = 7 n_steps = 180 n_emissions = 8 step_time_threshold = 5
class Solution: def getLucky(self, s: str, k: int) -> int: nums = '' for char in s: nums += str(ord(char) - ord('a') + 1) for i in range(k): nums = str(sum((int(c) for c in nums))) return nums
class Solution: def get_lucky(self, s: str, k: int) -> int: nums = '' for char in s: nums += str(ord(char) - ord('a') + 1) for i in range(k): nums = str(sum((int(c) for c in nums))) return nums
keys = ['red', 'green', 'blue'] values = ['#FF0000','#008000', '#0000FF'] color_dictionary = dict(zip(keys, values)) print(color_dictionary)
keys = ['red', 'green', 'blue'] values = ['#FF0000', '#008000', '#0000FF'] color_dictionary = dict(zip(keys, values)) print(color_dictionary)
#!/bin/python # list lauguage = 'Python' lst = list(lauguage) print(type(lst)) print(lst) print("-------------------------------") # [i for i in iterable if expression] lst = [i for i in lauguage] print(type(lst)) print(lst) print("-------------------------------") add_two_nums = lambda a, b: a + b print(add_two_nums(2, 3))
lauguage = 'Python' lst = list(lauguage) print(type(lst)) print(lst) print('-------------------------------') lst = [i for i in lauguage] print(type(lst)) print(lst) print('-------------------------------') add_two_nums = lambda a, b: a + b print(add_two_nums(2, 3))
SERIAL_DEVICE = '/dev/ttyAMA0' SERIAL_SPEED = 115200 CALIBRATION_FILE = '/home/pi/stephmeter/calibration.json' TIMEOUT = 300 # 5 minutes MQTT_SERVER = '192.168.1.2' MQTT_PORT = 1883 MQTT_TOPIC_PWM = 'traccar/eta' MQTT_TOPIC_LED = 'traccar/led'
serial_device = '/dev/ttyAMA0' serial_speed = 115200 calibration_file = '/home/pi/stephmeter/calibration.json' timeout = 300 mqtt_server = '192.168.1.2' mqtt_port = 1883 mqtt_topic_pwm = 'traccar/eta' mqtt_topic_led = 'traccar/led'
def example(): print('basic function') z=3+9 print(z) #Function with parameter def add(a,b): c=a+b print('the result is',c) add(5,3) add(a=3,b=5) #Function with default parameters def add_new(a,b=6): print(a,b) add_new(2) def basic_window(width,height,font='TNR',bgc='w',scrollbar=True): print(width,height,font,bgc) basic_window(500,350,bgc='a')
def example(): print('basic function') z = 3 + 9 print(z) def add(a, b): c = a + b print('the result is', c) add(5, 3) add(a=3, b=5) def add_new(a, b=6): print(a, b) add_new(2) def basic_window(width, height, font='TNR', bgc='w', scrollbar=True): print(width, height, font, bgc) basic_window(500, 350, bgc='a')
# This program will compute the factorial of any number given by user # until user enter some negative values. n = int(input("please input a number: ")) # the loop for getting user inputs while n >= 0: # initializing fact = 1 # calculating the factorial for i in range(1, n+1): fact *= i # fact = fact * i print("%d ! = %d"%(n,fact)) n = int(input("please input a number: "))
n = int(input('please input a number: ')) while n >= 0: fact = 1 for i in range(1, n + 1): fact *= i print('%d ! = %d' % (n, fact)) n = int(input('please input a number: '))
class GroupDirectoryError(Exception): pass class NoSuchRoleIdError(GroupDirectoryError): def __init__(self, *args, role_id, **kwargs): super().__init__(*args, **kwargs) self.role_id = role_id class NoSuchRoleNameError(GroupDirectoryError): def __init__(self, *args, role_name, **kwargs): super().__init__(*args, **kwargs) self.role_name = role_name class GroupDirectoryGroupError(GroupDirectoryError): def __init__(self, *args, group, **kwargs): super().__init__(*args, **kwargs) self.group = group class NoSuchGroupError(GroupDirectoryGroupError): pass class GroupAlreadyExistsError(GroupDirectoryGroupError): pass
class Groupdirectoryerror(Exception): pass class Nosuchroleiderror(GroupDirectoryError): def __init__(self, *args, role_id, **kwargs): super().__init__(*args, **kwargs) self.role_id = role_id class Nosuchrolenameerror(GroupDirectoryError): def __init__(self, *args, role_name, **kwargs): super().__init__(*args, **kwargs) self.role_name = role_name class Groupdirectorygrouperror(GroupDirectoryError): def __init__(self, *args, group, **kwargs): super().__init__(*args, **kwargs) self.group = group class Nosuchgrouperror(GroupDirectoryGroupError): pass class Groupalreadyexistserror(GroupDirectoryGroupError): pass
consultation_mention = [ "rendez-vous pris", r"consultation", r"consultation.{1,8}examen", "examen clinique", r"de compte rendu", r"date de l'examen", r"examen realise le", "date de la visite", ] town_mention = [ "paris", "kremlin.bicetre", "creteil", "boulogne.billancourt", "villejuif", "clamart", "bobigny", "clichy", "ivry.sur.seine", "issy.les.moulineaux", "draveil", "limeil", "champcueil", "roche.guyon", "bondy", "colombes", "hendaye", "herck.sur.mer", "labruyere", "garches", "sevran", "hyeres", ] document_date_mention = [ "imprime le", r"signe electroniquement", "signe le", "saisi le", "dicte le", "tape le", "date de reference", r"date\s*:", "dactylographie le", "date du rapport", ]
consultation_mention = ['rendez-vous pris', 'consultation', 'consultation.{1,8}examen', 'examen clinique', 'de compte rendu', "date de l'examen", 'examen realise le', 'date de la visite'] town_mention = ['paris', 'kremlin.bicetre', 'creteil', 'boulogne.billancourt', 'villejuif', 'clamart', 'bobigny', 'clichy', 'ivry.sur.seine', 'issy.les.moulineaux', 'draveil', 'limeil', 'champcueil', 'roche.guyon', 'bondy', 'colombes', 'hendaye', 'herck.sur.mer', 'labruyere', 'garches', 'sevran', 'hyeres'] document_date_mention = ['imprime le', 'signe electroniquement', 'signe le', 'saisi le', 'dicte le', 'tape le', 'date de reference', 'date\\s*:', 'dactylographie le', 'date du rapport']
class Solution: def myPow(self, x: float, n: int) -> float: memo = {} def power(x,n): if n in memo:return memo[n] if n==0: return 1 elif n==1:return x elif n < 0: memo[n] = power(1/x,-n) return memo[n] elif n%2==0: memo[n] = power(x*x,n//2) return memo[n] else: memo[n] = x * power(x*x,(n-1)//2) return memo[n] return power(x,n)
class Solution: def my_pow(self, x: float, n: int) -> float: memo = {} def power(x, n): if n in memo: return memo[n] if n == 0: return 1 elif n == 1: return x elif n < 0: memo[n] = power(1 / x, -n) return memo[n] elif n % 2 == 0: memo[n] = power(x * x, n // 2) return memo[n] else: memo[n] = x * power(x * x, (n - 1) // 2) return memo[n] return power(x, n)
def sum_Natural(n): if n == 0: return 0 else: return sum_Natural(n - 1) + n n = int(input()) result = sum_Natural(n) print(f"Sum of first {n} natural numbers -> {result}")
def sum__natural(n): if n == 0: return 0 else: return sum__natural(n - 1) + n n = int(input()) result = sum__natural(n) print(f'Sum of first {n} natural numbers -> {result}')
config = { 'cf_template_description': 'This template is generated with python' 'using troposphere framework to create' 'dynamic Cloudfront templates with' 'different vars according to the' 'PYTHON_ENV environment variable for' 'ECS fargate.', 'project_name': 'demo-ecs-fargate', 'network_stack_name': 'ansible-demo-network' }
config = {'cf_template_description': 'This template is generated with pythonusing troposphere framework to createdynamic Cloudfront templates withdifferent vars according to thePYTHON_ENV environment variable forECS fargate.', 'project_name': 'demo-ecs-fargate', 'network_stack_name': 'ansible-demo-network'}
outputdir = "/map" rendermode = "smooth_lighting" world_name = "MCServer" worlds[world_name] = "/data/world" renders["North"] = { 'world': world_name, 'title': 'North', 'dimension': "overworld", 'rendermode': rendermode, 'northdirection': 'upper-left' } renders["East"] = { 'world': world_name, 'title': 'East', 'dimension': "overworld", 'rendermode': rendermode, 'northdirection': 'upper-right' } renders["South"] = { 'world': world_name, 'title': 'South', 'dimension': "overworld", 'rendermode': rendermode, 'northdirection': 'lower-right' } renders["West"] = { 'world': world_name, 'title': 'West', 'dimension': "overworld", 'rendermode': rendermode, 'northdirection': 'lower-left' } renders["Nether-North"] = { 'world': world_name, 'title': 'Nether-North', 'dimension': 'nether', 'rendermode': 'nether_smooth_lighting', 'northdirection': 'upper-left' } renders["Nether-South"] = { 'world': world_name, 'title': 'Nether-South', 'dimension': 'nether', 'rendermode': 'nether_smooth_lighting', 'northdirection': 'lower-right' } renders["End-North"] = { 'world': world_name, 'title': 'End-North', 'dimension': 'end', 'rendermode': 'smooth_lighting', 'northdirection': 'upper-left' } renders["End-South"] = { 'world': world_name, 'title': 'End-South', 'dimension': 'end', 'rendermode': 'smooth_lighting', 'northdirection': 'lower-right' } renders["Caves-North"] = { 'world': world_name, 'title': 'Caves-North', 'dimension': "overworld", 'rendermode': 'cave', 'northdirection': 'upper-left' } renders["Caves-South"] = { 'world': world_name, 'title': 'Caves-South', 'dimension': "overworld", 'rendermode': 'cave', 'northdirection': 'lower-right' }
outputdir = '/map' rendermode = 'smooth_lighting' world_name = 'MCServer' worlds[world_name] = '/data/world' renders['North'] = {'world': world_name, 'title': 'North', 'dimension': 'overworld', 'rendermode': rendermode, 'northdirection': 'upper-left'} renders['East'] = {'world': world_name, 'title': 'East', 'dimension': 'overworld', 'rendermode': rendermode, 'northdirection': 'upper-right'} renders['South'] = {'world': world_name, 'title': 'South', 'dimension': 'overworld', 'rendermode': rendermode, 'northdirection': 'lower-right'} renders['West'] = {'world': world_name, 'title': 'West', 'dimension': 'overworld', 'rendermode': rendermode, 'northdirection': 'lower-left'} renders['Nether-North'] = {'world': world_name, 'title': 'Nether-North', 'dimension': 'nether', 'rendermode': 'nether_smooth_lighting', 'northdirection': 'upper-left'} renders['Nether-South'] = {'world': world_name, 'title': 'Nether-South', 'dimension': 'nether', 'rendermode': 'nether_smooth_lighting', 'northdirection': 'lower-right'} renders['End-North'] = {'world': world_name, 'title': 'End-North', 'dimension': 'end', 'rendermode': 'smooth_lighting', 'northdirection': 'upper-left'} renders['End-South'] = {'world': world_name, 'title': 'End-South', 'dimension': 'end', 'rendermode': 'smooth_lighting', 'northdirection': 'lower-right'} renders['Caves-North'] = {'world': world_name, 'title': 'Caves-North', 'dimension': 'overworld', 'rendermode': 'cave', 'northdirection': 'upper-left'} renders['Caves-South'] = {'world': world_name, 'title': 'Caves-South', 'dimension': 'overworld', 'rendermode': 'cave', 'northdirection': 'lower-right'}
def load(filename): lines = [s.strip() for s in open(filename,'r').readlines()] time = int(lines[0]) busses = [int(value) for value in lines[1].split(",") if value != "x"] return time,busses t,busses = load("input") print(f"Tiempo buscado {t}"); print(busses) for i in range(t,t+1000): for bus in busses: if (i % bus) == 0: print(f"Hemos encontrado {i} el bus {bus})") print(f"Resultado: {(i - t) * bus}") exit(0)
def load(filename): lines = [s.strip() for s in open(filename, 'r').readlines()] time = int(lines[0]) busses = [int(value) for value in lines[1].split(',') if value != 'x'] return (time, busses) (t, busses) = load('input') print(f'Tiempo buscado {t}') print(busses) for i in range(t, t + 1000): for bus in busses: if i % bus == 0: print(f'Hemos encontrado {i} el bus {bus})') print(f'Resultado: {(i - t) * bus}') exit(0)
ALL = 'All servers' def caller_check(servers = ALL): def func_wrapper(func): # TODO: To be implemented. Could get current_app and check it. Useful for anything? return func return func_wrapper
all = 'All servers' def caller_check(servers=ALL): def func_wrapper(func): return func return func_wrapper
#Programming I ####################### # Mission 5.1 # # Vitality Points # ####################### #Background #========== #To encourage their customers to exercise more, insurance companies are giving #vouchers for the distances that customers had clocked in a week as follows: ###################################################### # Distance (km) # Gift # ###################################################### # Less than 25 # $2 Popular eVoucher # # 25 <= distance < 50 # $5 Cold Storage eVoucher # # 50 <= distance < 75 # $10 Starbucks eVoucher # # More than 75 # $20 Subway eVoucher # ###################################################### #Write a Python program to check and display the gift that customer will recieve. #The program is to prompt user for the total distance he had travelled (by walking or running) #in a week and check which gift he will get and display the information to him. #The return value of the function is the eVoucher value (e.g., 2 for the Popular eVoucher) #Important Notes #=============== #1) Comment out ALL input prompts before submitting. #2) You MUST use the following variables # - distance # - gift # - value #START CODING FROM HERE #====================== #Prompt user for the total distance travelled (either by walking or running). #Check gifts to be given to customer def check_gift(distance): #Check gift to be given if distance < 25: value = 2 elif distance < 50: value = 5 elif distance < 75: value = 10 else: value = 20 print(str(value) + ' eVoucher') #Modify to display gift to be given return value #Do not remove this line #Do not remove the next line check_gift(distance) #input 10 output 2 #input 25 output 5 #input 50 output 10 #input 76 output 20
def check_gift(distance): if distance < 25: value = 2 elif distance < 50: value = 5 elif distance < 75: value = 10 else: value = 20 print(str(value) + ' eVoucher') return value check_gift(distance)
# Sage version information for Python scripts # This file is auto-generated by the sage-update-version script, do not edit! version = '9.6.beta5' date = '2022-03-12' banner = 'SageMath version 9.6.beta5, Release Date: 2022-03-12'
version = '9.6.beta5' date = '2022-03-12' banner = 'SageMath version 9.6.beta5, Release Date: 2022-03-12'
ls = list(input().split()) count = 0 for l in ls: if l == 1: count += 1 print(count)
ls = list(input().split()) count = 0 for l in ls: if l == 1: count += 1 print(count)
def solve(n): F = [1, 1] while len(str(F[-1])) < n: F.append(F[-1] + F[-2]) return len(F) # n = 3 n = 1000 answer = solve(n) print(answer)
def solve(n): f = [1, 1] while len(str(F[-1])) < n: F.append(F[-1] + F[-2]) return len(F) n = 1000 answer = solve(n) print(answer)
def isunique(s): for i in range(len(s)): for j in range(len(s)): if i != j: if(s[i] == s[j]): return False return True if __name__ == "__main__": res = isunique("hsjdfhjdhjfk") print(res)
def isunique(s): for i in range(len(s)): for j in range(len(s)): if i != j: if s[i] == s[j]: return False return True if __name__ == '__main__': res = isunique('hsjdfhjdhjfk') print(res)
uctable = [ [ 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55 ], [ 56 ], [ 57 ], [ 194, 178 ], [ 194, 179 ], [ 194, 185 ], [ 194, 188 ], [ 194, 189 ], [ 194, 190 ], [ 217, 160 ], [ 217, 161 ], [ 217, 162 ], [ 217, 163 ], [ 217, 164 ], [ 217, 165 ], [ 217, 166 ], [ 217, 167 ], [ 217, 168 ], [ 217, 169 ], [ 219, 176 ], [ 219, 177 ], [ 219, 178 ], [ 219, 179 ], [ 219, 180 ], [ 219, 181 ], [ 219, 182 ], [ 219, 183 ], [ 219, 184 ], [ 219, 185 ], [ 223, 128 ], [ 223, 129 ], [ 223, 130 ], [ 223, 131 ], [ 223, 132 ], [ 223, 133 ], [ 223, 134 ], [ 223, 135 ], [ 223, 136 ], [ 223, 137 ], [ 224, 165, 166 ], [ 224, 165, 167 ], [ 224, 165, 168 ], [ 224, 165, 169 ], [ 224, 165, 170 ], [ 224, 165, 171 ], [ 224, 165, 172 ], [ 224, 165, 173 ], [ 224, 165, 174 ], [ 224, 165, 175 ], [ 224, 167, 166 ], [ 224, 167, 167 ], [ 224, 167, 168 ], [ 224, 167, 169 ], [ 224, 167, 170 ], [ 224, 167, 171 ], [ 224, 167, 172 ], [ 224, 167, 173 ], [ 224, 167, 174 ], [ 224, 167, 175 ], [ 224, 167, 180 ], [ 224, 167, 181 ], [ 224, 167, 182 ], [ 224, 167, 183 ], [ 224, 167, 184 ], [ 224, 167, 185 ], [ 224, 169, 166 ], [ 224, 169, 167 ], [ 224, 169, 168 ], [ 224, 169, 169 ], [ 224, 169, 170 ], [ 224, 169, 171 ], [ 224, 169, 172 ], [ 224, 169, 173 ], [ 224, 169, 174 ], [ 224, 169, 175 ], [ 224, 171, 166 ], [ 224, 171, 167 ], [ 224, 171, 168 ], [ 224, 171, 169 ], [ 224, 171, 170 ], [ 224, 171, 171 ], [ 224, 171, 172 ], [ 224, 171, 173 ], [ 224, 171, 174 ], [ 224, 171, 175 ], [ 224, 173, 166 ], [ 224, 173, 167 ], [ 224, 173, 168 ], [ 224, 173, 169 ], [ 224, 173, 170 ], [ 224, 173, 171 ], [ 224, 173, 172 ], [ 224, 173, 173 ], [ 224, 173, 174 ], [ 224, 173, 175 ], [ 224, 173, 178 ], [ 224, 173, 179 ], [ 224, 173, 180 ], [ 224, 173, 181 ], [ 224, 173, 182 ], [ 224, 173, 183 ], [ 224, 175, 166 ], [ 224, 175, 167 ], [ 224, 175, 168 ], [ 224, 175, 169 ], [ 224, 175, 170 ], [ 224, 175, 171 ], [ 224, 175, 172 ], [ 224, 175, 173 ], [ 224, 175, 174 ], [ 224, 175, 175 ], [ 224, 175, 176 ], [ 224, 175, 177 ], [ 224, 175, 178 ], [ 224, 177, 166 ], [ 224, 177, 167 ], [ 224, 177, 168 ], [ 224, 177, 169 ], [ 224, 177, 170 ], [ 224, 177, 171 ], [ 224, 177, 172 ], [ 224, 177, 173 ], [ 224, 177, 174 ], [ 224, 177, 175 ], [ 224, 177, 184 ], [ 224, 177, 185 ], [ 224, 177, 186 ], [ 224, 177, 187 ], [ 224, 177, 188 ], [ 224, 177, 189 ], [ 224, 177, 190 ], [ 224, 179, 166 ], [ 224, 179, 167 ], [ 224, 179, 168 ], [ 224, 179, 169 ], [ 224, 179, 170 ], [ 224, 179, 171 ], [ 224, 179, 172 ], [ 224, 179, 173 ], [ 224, 179, 174 ], [ 224, 179, 175 ], [ 224, 181, 166 ], [ 224, 181, 167 ], [ 224, 181, 168 ], [ 224, 181, 169 ], [ 224, 181, 170 ], [ 224, 181, 171 ], [ 224, 181, 172 ], [ 224, 181, 173 ], [ 224, 181, 174 ], [ 224, 181, 175 ], [ 224, 181, 176 ], [ 224, 181, 177 ], [ 224, 181, 178 ], [ 224, 181, 179 ], [ 224, 181, 180 ], [ 224, 181, 181 ], [ 224, 183, 166 ], [ 224, 183, 167 ], [ 224, 183, 168 ], [ 224, 183, 169 ], [ 224, 183, 170 ], [ 224, 183, 171 ], [ 224, 183, 172 ], [ 224, 183, 173 ], [ 224, 183, 174 ], [ 224, 183, 175 ], [ 224, 185, 144 ], [ 224, 185, 145 ], [ 224, 185, 146 ], [ 224, 185, 147 ], [ 224, 185, 148 ], [ 224, 185, 149 ], [ 224, 185, 150 ], [ 224, 185, 151 ], [ 224, 185, 152 ], [ 224, 185, 153 ], [ 224, 187, 144 ], [ 224, 187, 145 ], [ 224, 187, 146 ], [ 224, 187, 147 ], [ 224, 187, 148 ], [ 224, 187, 149 ], [ 224, 187, 150 ], [ 224, 187, 151 ], [ 224, 187, 152 ], [ 224, 187, 153 ], [ 224, 188, 160 ], [ 224, 188, 161 ], [ 224, 188, 162 ], [ 224, 188, 163 ], [ 224, 188, 164 ], [ 224, 188, 165 ], [ 224, 188, 166 ], [ 224, 188, 167 ], [ 224, 188, 168 ], [ 224, 188, 169 ], [ 224, 188, 170 ], [ 224, 188, 171 ], [ 224, 188, 172 ], [ 224, 188, 173 ], [ 224, 188, 174 ], [ 224, 188, 175 ], [ 224, 188, 176 ], [ 224, 188, 177 ], [ 224, 188, 178 ], [ 224, 188, 179 ], [ 225, 129, 128 ], [ 225, 129, 129 ], [ 225, 129, 130 ], [ 225, 129, 131 ], [ 225, 129, 132 ], [ 225, 129, 133 ], [ 225, 129, 134 ], [ 225, 129, 135 ], [ 225, 129, 136 ], [ 225, 129, 137 ], [ 225, 130, 144 ], [ 225, 130, 145 ], [ 225, 130, 146 ], [ 225, 130, 147 ], [ 225, 130, 148 ], [ 225, 130, 149 ], [ 225, 130, 150 ], [ 225, 130, 151 ], [ 225, 130, 152 ], [ 225, 130, 153 ], [ 225, 141, 169 ], [ 225, 141, 170 ], [ 225, 141, 171 ], [ 225, 141, 172 ], [ 225, 141, 173 ], [ 225, 141, 174 ], [ 225, 141, 175 ], [ 225, 141, 176 ], [ 225, 141, 177 ], [ 225, 141, 178 ], [ 225, 141, 179 ], [ 225, 141, 180 ], [ 225, 141, 181 ], [ 225, 141, 182 ], [ 225, 141, 183 ], [ 225, 141, 184 ], [ 225, 141, 185 ], [ 225, 141, 186 ], [ 225, 141, 187 ], [ 225, 141, 188 ], [ 225, 155, 174 ], [ 225, 155, 175 ], [ 225, 155, 176 ], [ 225, 159, 160 ], [ 225, 159, 161 ], [ 225, 159, 162 ], [ 225, 159, 163 ], [ 225, 159, 164 ], [ 225, 159, 165 ], [ 225, 159, 166 ], [ 225, 159, 167 ], [ 225, 159, 168 ], [ 225, 159, 169 ], [ 225, 159, 176 ], [ 225, 159, 177 ], [ 225, 159, 178 ], [ 225, 159, 179 ], [ 225, 159, 180 ], [ 225, 159, 181 ], [ 225, 159, 182 ], [ 225, 159, 183 ], [ 225, 159, 184 ], [ 225, 159, 185 ], [ 225, 160, 144 ], [ 225, 160, 145 ], [ 225, 160, 146 ], [ 225, 160, 147 ], [ 225, 160, 148 ], [ 225, 160, 149 ], [ 225, 160, 150 ], [ 225, 160, 151 ], [ 225, 160, 152 ], [ 225, 160, 153 ], [ 225, 165, 134 ], [ 225, 165, 135 ], [ 225, 165, 136 ], [ 225, 165, 137 ], [ 225, 165, 138 ], [ 225, 165, 139 ], [ 225, 165, 140 ], [ 225, 165, 141 ], [ 225, 165, 142 ], [ 225, 165, 143 ], [ 225, 167, 144 ], [ 225, 167, 145 ], [ 225, 167, 146 ], [ 225, 167, 147 ], [ 225, 167, 148 ], [ 225, 167, 149 ], [ 225, 167, 150 ], [ 225, 167, 151 ], [ 225, 167, 152 ], [ 225, 167, 153 ], [ 225, 167, 154 ], [ 225, 170, 128 ], [ 225, 170, 129 ], [ 225, 170, 130 ], [ 225, 170, 131 ], [ 225, 170, 132 ], [ 225, 170, 133 ], [ 225, 170, 134 ], [ 225, 170, 135 ], [ 225, 170, 136 ], [ 225, 170, 137 ], [ 225, 170, 144 ], [ 225, 170, 145 ], [ 225, 170, 146 ], [ 225, 170, 147 ], [ 225, 170, 148 ], [ 225, 170, 149 ], [ 225, 170, 150 ], [ 225, 170, 151 ], [ 225, 170, 152 ], [ 225, 170, 153 ], [ 225, 173, 144 ], [ 225, 173, 145 ], [ 225, 173, 146 ], [ 225, 173, 147 ], [ 225, 173, 148 ], [ 225, 173, 149 ], [ 225, 173, 150 ], [ 225, 173, 151 ], [ 225, 173, 152 ], [ 225, 173, 153 ], [ 225, 174, 176 ], [ 225, 174, 177 ], [ 225, 174, 178 ], [ 225, 174, 179 ], [ 225, 174, 180 ], [ 225, 174, 181 ], [ 225, 174, 182 ], [ 225, 174, 183 ], [ 225, 174, 184 ], [ 225, 174, 185 ], [ 225, 177, 128 ], [ 225, 177, 129 ], [ 225, 177, 130 ], [ 225, 177, 131 ], [ 225, 177, 132 ], [ 225, 177, 133 ], [ 225, 177, 134 ], [ 225, 177, 135 ], [ 225, 177, 136 ], [ 225, 177, 137 ], [ 225, 177, 144 ], [ 225, 177, 145 ], [ 225, 177, 146 ], [ 225, 177, 147 ], [ 225, 177, 148 ], [ 225, 177, 149 ], [ 225, 177, 150 ], [ 225, 177, 151 ], [ 225, 177, 152 ], [ 225, 177, 153 ], [ 226, 129, 176 ], [ 226, 129, 180 ], [ 226, 129, 181 ], [ 226, 129, 182 ], [ 226, 129, 183 ], [ 226, 129, 184 ], [ 226, 129, 185 ], [ 226, 130, 128 ], [ 226, 130, 129 ], [ 226, 130, 130 ], [ 226, 130, 131 ], [ 226, 130, 132 ], [ 226, 130, 133 ], [ 226, 130, 134 ], [ 226, 130, 135 ], [ 226, 130, 136 ], [ 226, 130, 137 ], [ 226, 133, 144 ], [ 226, 133, 145 ], [ 226, 133, 146 ], [ 226, 133, 147 ], [ 226, 133, 148 ], [ 226, 133, 149 ], [ 226, 133, 150 ], [ 226, 133, 151 ], [ 226, 133, 152 ], [ 226, 133, 153 ], [ 226, 133, 154 ], [ 226, 133, 155 ], [ 226, 133, 156 ], [ 226, 133, 157 ], [ 226, 133, 158 ], [ 226, 133, 159 ], [ 226, 133, 160 ], [ 226, 133, 161 ], [ 226, 133, 162 ], [ 226, 133, 163 ], [ 226, 133, 164 ], [ 226, 133, 165 ], [ 226, 133, 166 ], [ 226, 133, 167 ], [ 226, 133, 168 ], [ 226, 133, 169 ], [ 226, 133, 170 ], [ 226, 133, 171 ], [ 226, 133, 172 ], [ 226, 133, 173 ], [ 226, 133, 174 ], [ 226, 133, 175 ], [ 226, 133, 176 ], [ 226, 133, 177 ], [ 226, 133, 178 ], [ 226, 133, 179 ], [ 226, 133, 180 ], [ 226, 133, 181 ], [ 226, 133, 182 ], [ 226, 133, 183 ], [ 226, 133, 184 ], [ 226, 133, 185 ], [ 226, 133, 186 ], [ 226, 133, 187 ], [ 226, 133, 188 ], [ 226, 133, 189 ], [ 226, 133, 190 ], [ 226, 133, 191 ], [ 226, 134, 128 ], [ 226, 134, 129 ], [ 226, 134, 130 ], [ 226, 134, 133 ], [ 226, 134, 134 ], [ 226, 134, 135 ], [ 226, 134, 136 ], [ 226, 134, 137 ], [ 226, 145, 160 ], [ 226, 145, 161 ], [ 226, 145, 162 ], [ 226, 145, 163 ], [ 226, 145, 164 ], [ 226, 145, 165 ], [ 226, 145, 166 ], [ 226, 145, 167 ], [ 226, 145, 168 ], [ 226, 145, 169 ], [ 226, 145, 170 ], [ 226, 145, 171 ], [ 226, 145, 172 ], [ 226, 145, 173 ], [ 226, 145, 174 ], [ 226, 145, 175 ], [ 226, 145, 176 ], [ 226, 145, 177 ], [ 226, 145, 178 ], [ 226, 145, 179 ], [ 226, 145, 180 ], [ 226, 145, 181 ], [ 226, 145, 182 ], [ 226, 145, 183 ], [ 226, 145, 184 ], [ 226, 145, 185 ], [ 226, 145, 186 ], [ 226, 145, 187 ], [ 226, 145, 188 ], [ 226, 145, 189 ], [ 226, 145, 190 ], [ 226, 145, 191 ], [ 226, 146, 128 ], [ 226, 146, 129 ], [ 226, 146, 130 ], [ 226, 146, 131 ], [ 226, 146, 132 ], [ 226, 146, 133 ], [ 226, 146, 134 ], [ 226, 146, 135 ], [ 226, 146, 136 ], [ 226, 146, 137 ], [ 226, 146, 138 ], [ 226, 146, 139 ], [ 226, 146, 140 ], [ 226, 146, 141 ], [ 226, 146, 142 ], [ 226, 146, 143 ], [ 226, 146, 144 ], [ 226, 146, 145 ], [ 226, 146, 146 ], [ 226, 146, 147 ], [ 226, 146, 148 ], [ 226, 146, 149 ], [ 226, 146, 150 ], [ 226, 146, 151 ], [ 226, 146, 152 ], [ 226, 146, 153 ], [ 226, 146, 154 ], [ 226, 146, 155 ], [ 226, 147, 170 ], [ 226, 147, 171 ], [ 226, 147, 172 ], [ 226, 147, 173 ], [ 226, 147, 174 ], [ 226, 147, 175 ], [ 226, 147, 176 ], [ 226, 147, 177 ], [ 226, 147, 178 ], [ 226, 147, 179 ], [ 226, 147, 180 ], [ 226, 147, 181 ], [ 226, 147, 182 ], [ 226, 147, 183 ], [ 226, 147, 184 ], [ 226, 147, 185 ], [ 226, 147, 186 ], [ 226, 147, 187 ], [ 226, 147, 188 ], [ 226, 147, 189 ], [ 226, 147, 190 ], [ 226, 147, 191 ], [ 226, 157, 182 ], [ 226, 157, 183 ], [ 226, 157, 184 ], [ 226, 157, 185 ], [ 226, 157, 186 ], [ 226, 157, 187 ], [ 226, 157, 188 ], [ 226, 157, 189 ], [ 226, 157, 190 ], [ 226, 157, 191 ], [ 226, 158, 128 ], [ 226, 158, 129 ], [ 226, 158, 130 ], [ 226, 158, 131 ], [ 226, 158, 132 ], [ 226, 158, 133 ], [ 226, 158, 134 ], [ 226, 158, 135 ], [ 226, 158, 136 ], [ 226, 158, 137 ], [ 226, 158, 138 ], [ 226, 158, 139 ], [ 226, 158, 140 ], [ 226, 158, 141 ], [ 226, 158, 142 ], [ 226, 158, 143 ], [ 226, 158, 144 ], [ 226, 158, 145 ], [ 226, 158, 146 ], [ 226, 158, 147 ], [ 226, 179, 189 ], [ 227, 128, 135 ], [ 227, 128, 161 ], [ 227, 128, 162 ], [ 227, 128, 163 ], [ 227, 128, 164 ], [ 227, 128, 165 ], [ 227, 128, 166 ], [ 227, 128, 167 ], [ 227, 128, 168 ], [ 227, 128, 169 ], [ 227, 128, 184 ], [ 227, 128, 185 ], [ 227, 128, 186 ], [ 227, 134, 146 ], [ 227, 134, 147 ], [ 227, 134, 148 ], [ 227, 134, 149 ], [ 227, 136, 160 ], [ 227, 136, 161 ], [ 227, 136, 162 ], [ 227, 136, 163 ], [ 227, 136, 164 ], [ 227, 136, 165 ], [ 227, 136, 166 ], [ 227, 136, 167 ], [ 227, 136, 168 ], [ 227, 136, 169 ], [ 227, 137, 136 ], [ 227, 137, 137 ], [ 227, 137, 138 ], [ 227, 137, 139 ], [ 227, 137, 140 ], [ 227, 137, 141 ], [ 227, 137, 142 ], [ 227, 137, 143 ], [ 227, 137, 145 ], [ 227, 137, 146 ], [ 227, 137, 147 ], [ 227, 137, 148 ], [ 227, 137, 149 ], [ 227, 137, 150 ], [ 227, 137, 151 ], [ 227, 137, 152 ], [ 227, 137, 153 ], [ 227, 137, 154 ], [ 227, 137, 155 ], [ 227, 137, 156 ], [ 227, 137, 157 ], [ 227, 137, 158 ], [ 227, 137, 159 ], [ 227, 138, 128 ], [ 227, 138, 129 ], [ 227, 138, 130 ], [ 227, 138, 131 ], [ 227, 138, 132 ], [ 227, 138, 133 ], [ 227, 138, 134 ], [ 227, 138, 135 ], [ 227, 138, 136 ], [ 227, 138, 137 ], [ 227, 138, 177 ], [ 227, 138, 178 ], [ 227, 138, 179 ], [ 227, 138, 180 ], [ 227, 138, 181 ], [ 227, 138, 182 ], [ 227, 138, 183 ], [ 227, 138, 184 ], [ 227, 138, 185 ], [ 227, 138, 186 ], [ 227, 138, 187 ], [ 227, 138, 188 ], [ 227, 138, 189 ], [ 227, 138, 190 ], [ 227, 138, 191 ], [ 234, 152, 160 ], [ 234, 152, 161 ], [ 234, 152, 162 ], [ 234, 152, 163 ], [ 234, 152, 164 ], [ 234, 152, 165 ], [ 234, 152, 166 ], [ 234, 152, 167 ], [ 234, 152, 168 ], [ 234, 152, 169 ], [ 234, 155, 166 ], [ 234, 155, 167 ], [ 234, 155, 168 ], [ 234, 155, 169 ], [ 234, 155, 170 ], [ 234, 155, 171 ], [ 234, 155, 172 ], [ 234, 155, 173 ], [ 234, 155, 174 ], [ 234, 155, 175 ], [ 234, 160, 176 ], [ 234, 160, 177 ], [ 234, 160, 178 ], [ 234, 160, 179 ], [ 234, 160, 180 ], [ 234, 160, 181 ], [ 234, 163, 144 ], [ 234, 163, 145 ], [ 234, 163, 146 ], [ 234, 163, 147 ], [ 234, 163, 148 ], [ 234, 163, 149 ], [ 234, 163, 150 ], [ 234, 163, 151 ], [ 234, 163, 152 ], [ 234, 163, 153 ], [ 234, 164, 128 ], [ 234, 164, 129 ], [ 234, 164, 130 ], [ 234, 164, 131 ], [ 234, 164, 132 ], [ 234, 164, 133 ], [ 234, 164, 134 ], [ 234, 164, 135 ], [ 234, 164, 136 ], [ 234, 164, 137 ], [ 234, 167, 144 ], [ 234, 167, 145 ], [ 234, 167, 146 ], [ 234, 167, 147 ], [ 234, 167, 148 ], [ 234, 167, 149 ], [ 234, 167, 150 ], [ 234, 167, 151 ], [ 234, 167, 152 ], [ 234, 167, 153 ], [ 234, 167, 176 ], [ 234, 167, 177 ], [ 234, 167, 178 ], [ 234, 167, 179 ], [ 234, 167, 180 ], [ 234, 167, 181 ], [ 234, 167, 182 ], [ 234, 167, 183 ], [ 234, 167, 184 ], [ 234, 167, 185 ], [ 234, 169, 144 ], [ 234, 169, 145 ], [ 234, 169, 146 ], [ 234, 169, 147 ], [ 234, 169, 148 ], [ 234, 169, 149 ], [ 234, 169, 150 ], [ 234, 169, 151 ], [ 234, 169, 152 ], [ 234, 169, 153 ], [ 234, 175, 176 ], [ 234, 175, 177 ], [ 234, 175, 178 ], [ 234, 175, 179 ], [ 234, 175, 180 ], [ 234, 175, 181 ], [ 234, 175, 182 ], [ 234, 175, 183 ], [ 234, 175, 184 ], [ 234, 175, 185 ], [ 239, 188, 144 ], [ 239, 188, 145 ], [ 239, 188, 146 ], [ 239, 188, 147 ], [ 239, 188, 148 ], [ 239, 188, 149 ], [ 239, 188, 150 ], [ 239, 188, 151 ], [ 239, 188, 152 ], [ 239, 188, 153 ], [ 240, 144, 132, 135 ], [ 240, 144, 132, 136 ], [ 240, 144, 132, 137 ], [ 240, 144, 132, 138 ], [ 240, 144, 132, 139 ], [ 240, 144, 132, 140 ], [ 240, 144, 132, 141 ], [ 240, 144, 132, 142 ], [ 240, 144, 132, 143 ], [ 240, 144, 132, 144 ], [ 240, 144, 132, 145 ], [ 240, 144, 132, 146 ], [ 240, 144, 132, 147 ], [ 240, 144, 132, 148 ], [ 240, 144, 132, 149 ], [ 240, 144, 132, 150 ], [ 240, 144, 132, 151 ], [ 240, 144, 132, 152 ], [ 240, 144, 132, 153 ], [ 240, 144, 132, 154 ], [ 240, 144, 132, 155 ], [ 240, 144, 132, 156 ], [ 240, 144, 132, 157 ], [ 240, 144, 132, 158 ], [ 240, 144, 132, 159 ], [ 240, 144, 132, 160 ], [ 240, 144, 132, 161 ], [ 240, 144, 132, 162 ], [ 240, 144, 132, 163 ], [ 240, 144, 132, 164 ], [ 240, 144, 132, 165 ], [ 240, 144, 132, 166 ], [ 240, 144, 132, 167 ], [ 240, 144, 132, 168 ], [ 240, 144, 132, 169 ], [ 240, 144, 132, 170 ], [ 240, 144, 132, 171 ], [ 240, 144, 132, 172 ], [ 240, 144, 132, 173 ], [ 240, 144, 132, 174 ], [ 240, 144, 132, 175 ], [ 240, 144, 132, 176 ], [ 240, 144, 132, 177 ], [ 240, 144, 132, 178 ], [ 240, 144, 132, 179 ], [ 240, 144, 133, 128 ], [ 240, 144, 133, 129 ], [ 240, 144, 133, 130 ], [ 240, 144, 133, 131 ], [ 240, 144, 133, 132 ], [ 240, 144, 133, 133 ], [ 240, 144, 133, 134 ], [ 240, 144, 133, 135 ], [ 240, 144, 133, 136 ], [ 240, 144, 133, 137 ], [ 240, 144, 133, 138 ], [ 240, 144, 133, 139 ], [ 240, 144, 133, 140 ], [ 240, 144, 133, 141 ], [ 240, 144, 133, 142 ], [ 240, 144, 133, 143 ], [ 240, 144, 133, 144 ], [ 240, 144, 133, 145 ], [ 240, 144, 133, 146 ], [ 240, 144, 133, 147 ], [ 240, 144, 133, 148 ], [ 240, 144, 133, 149 ], [ 240, 144, 133, 150 ], [ 240, 144, 133, 151 ], [ 240, 144, 133, 152 ], [ 240, 144, 133, 153 ], [ 240, 144, 133, 154 ], [ 240, 144, 133, 155 ], [ 240, 144, 133, 156 ], [ 240, 144, 133, 157 ], [ 240, 144, 133, 158 ], [ 240, 144, 133, 159 ], [ 240, 144, 133, 160 ], [ 240, 144, 133, 161 ], [ 240, 144, 133, 162 ], [ 240, 144, 133, 163 ], [ 240, 144, 133, 164 ], [ 240, 144, 133, 165 ], [ 240, 144, 133, 166 ], [ 240, 144, 133, 167 ], [ 240, 144, 133, 168 ], [ 240, 144, 133, 169 ], [ 240, 144, 133, 170 ], [ 240, 144, 133, 171 ], [ 240, 144, 133, 172 ], [ 240, 144, 133, 173 ], [ 240, 144, 133, 174 ], [ 240, 144, 133, 175 ], [ 240, 144, 133, 176 ], [ 240, 144, 133, 177 ], [ 240, 144, 133, 178 ], [ 240, 144, 133, 179 ], [ 240, 144, 133, 180 ], [ 240, 144, 133, 181 ], [ 240, 144, 133, 182 ], [ 240, 144, 133, 183 ], [ 240, 144, 133, 184 ], [ 240, 144, 134, 138 ], [ 240, 144, 134, 139 ], [ 240, 144, 139, 161 ], [ 240, 144, 139, 162 ], [ 240, 144, 139, 163 ], [ 240, 144, 139, 164 ], [ 240, 144, 139, 165 ], [ 240, 144, 139, 166 ], [ 240, 144, 139, 167 ], [ 240, 144, 139, 168 ], [ 240, 144, 139, 169 ], [ 240, 144, 139, 170 ], [ 240, 144, 139, 171 ], [ 240, 144, 139, 172 ], [ 240, 144, 139, 173 ], [ 240, 144, 139, 174 ], [ 240, 144, 139, 175 ], [ 240, 144, 139, 176 ], [ 240, 144, 139, 177 ], [ 240, 144, 139, 178 ], [ 240, 144, 139, 179 ], [ 240, 144, 139, 180 ], [ 240, 144, 139, 181 ], [ 240, 144, 139, 182 ], [ 240, 144, 139, 183 ], [ 240, 144, 139, 184 ], [ 240, 144, 139, 185 ], [ 240, 144, 139, 186 ], [ 240, 144, 139, 187 ], [ 240, 144, 140, 160 ], [ 240, 144, 140, 161 ], [ 240, 144, 140, 162 ], [ 240, 144, 140, 163 ], [ 240, 144, 141, 129 ], [ 240, 144, 141, 138 ], [ 240, 144, 143, 145 ], [ 240, 144, 143, 146 ], [ 240, 144, 143, 147 ], [ 240, 144, 143, 148 ], [ 240, 144, 143, 149 ], [ 240, 144, 146, 160 ], [ 240, 144, 146, 161 ], [ 240, 144, 146, 162 ], [ 240, 144, 146, 163 ], [ 240, 144, 146, 164 ], [ 240, 144, 146, 165 ], [ 240, 144, 146, 166 ], [ 240, 144, 146, 167 ], [ 240, 144, 146, 168 ], [ 240, 144, 146, 169 ], [ 240, 144, 161, 152 ], [ 240, 144, 161, 153 ], [ 240, 144, 161, 154 ], [ 240, 144, 161, 155 ], [ 240, 144, 161, 156 ], [ 240, 144, 161, 157 ], [ 240, 144, 161, 158 ], [ 240, 144, 161, 159 ], [ 240, 144, 161, 185 ], [ 240, 144, 161, 186 ], [ 240, 144, 161, 187 ], [ 240, 144, 161, 188 ], [ 240, 144, 161, 189 ], [ 240, 144, 161, 190 ], [ 240, 144, 161, 191 ], [ 240, 144, 162, 167 ], [ 240, 144, 162, 168 ], [ 240, 144, 162, 169 ], [ 240, 144, 162, 170 ], [ 240, 144, 162, 171 ], [ 240, 144, 162, 172 ], [ 240, 144, 162, 173 ], [ 240, 144, 162, 174 ], [ 240, 144, 162, 175 ], [ 240, 144, 163, 187 ], [ 240, 144, 163, 188 ], [ 240, 144, 163, 189 ], [ 240, 144, 163, 190 ], [ 240, 144, 163, 191 ], [ 240, 144, 164, 150 ], [ 240, 144, 164, 151 ], [ 240, 144, 164, 152 ], [ 240, 144, 164, 153 ], [ 240, 144, 164, 154 ], [ 240, 144, 164, 155 ], [ 240, 144, 166, 188 ], [ 240, 144, 166, 189 ], [ 240, 144, 167, 128 ], [ 240, 144, 167, 129 ], [ 240, 144, 167, 130 ], [ 240, 144, 167, 131 ], [ 240, 144, 167, 132 ], [ 240, 144, 167, 133 ], [ 240, 144, 167, 134 ], [ 240, 144, 167, 135 ], [ 240, 144, 167, 136 ], [ 240, 144, 167, 137 ], [ 240, 144, 167, 138 ], [ 240, 144, 167, 139 ], [ 240, 144, 167, 140 ], [ 240, 144, 167, 141 ], [ 240, 144, 167, 142 ], [ 240, 144, 167, 143 ], [ 240, 144, 167, 146 ], [ 240, 144, 167, 147 ], [ 240, 144, 167, 148 ], [ 240, 144, 167, 149 ], [ 240, 144, 167, 150 ], [ 240, 144, 167, 151 ], [ 240, 144, 167, 152 ], [ 240, 144, 167, 153 ], [ 240, 144, 167, 154 ], [ 240, 144, 167, 155 ], [ 240, 144, 167, 156 ], [ 240, 144, 167, 157 ], [ 240, 144, 167, 158 ], [ 240, 144, 167, 159 ], [ 240, 144, 167, 160 ], [ 240, 144, 167, 161 ], [ 240, 144, 167, 162 ], [ 240, 144, 167, 163 ], [ 240, 144, 167, 164 ], [ 240, 144, 167, 165 ], [ 240, 144, 167, 166 ], [ 240, 144, 167, 167 ], [ 240, 144, 167, 168 ], [ 240, 144, 167, 169 ], [ 240, 144, 167, 170 ], [ 240, 144, 167, 171 ], [ 240, 144, 167, 172 ], [ 240, 144, 167, 173 ], [ 240, 144, 167, 174 ], [ 240, 144, 167, 175 ], [ 240, 144, 167, 176 ], [ 240, 144, 167, 177 ], [ 240, 144, 167, 178 ], [ 240, 144, 167, 179 ], [ 240, 144, 167, 180 ], [ 240, 144, 167, 181 ], [ 240, 144, 167, 182 ], [ 240, 144, 167, 183 ], [ 240, 144, 167, 184 ], [ 240, 144, 167, 185 ], [ 240, 144, 167, 186 ], [ 240, 144, 167, 187 ], [ 240, 144, 167, 188 ], [ 240, 144, 167, 189 ], [ 240, 144, 167, 190 ], [ 240, 144, 167, 191 ], [ 240, 144, 169, 128 ], [ 240, 144, 169, 129 ], [ 240, 144, 169, 130 ], [ 240, 144, 169, 131 ], [ 240, 144, 169, 132 ], [ 240, 144, 169, 133 ], [ 240, 144, 169, 134 ], [ 240, 144, 169, 135 ], [ 240, 144, 169, 189 ], [ 240, 144, 169, 190 ], [ 240, 144, 170, 157 ], [ 240, 144, 170, 158 ], [ 240, 144, 170, 159 ], [ 240, 144, 171, 171 ], [ 240, 144, 171, 172 ], [ 240, 144, 171, 173 ], [ 240, 144, 171, 174 ], [ 240, 144, 171, 175 ], [ 240, 144, 173, 152 ], [ 240, 144, 173, 153 ], [ 240, 144, 173, 154 ], [ 240, 144, 173, 155 ], [ 240, 144, 173, 156 ], [ 240, 144, 173, 157 ], [ 240, 144, 173, 158 ], [ 240, 144, 173, 159 ], [ 240, 144, 173, 184 ], [ 240, 144, 173, 185 ], [ 240, 144, 173, 186 ], [ 240, 144, 173, 187 ], [ 240, 144, 173, 188 ], [ 240, 144, 173, 189 ], [ 240, 144, 173, 190 ], [ 240, 144, 173, 191 ], [ 240, 144, 174, 169 ], [ 240, 144, 174, 170 ], [ 240, 144, 174, 171 ], [ 240, 144, 174, 172 ], [ 240, 144, 174, 173 ], [ 240, 144, 174, 174 ], [ 240, 144, 174, 175 ], [ 240, 144, 179, 186 ], [ 240, 144, 179, 187 ], [ 240, 144, 179, 188 ], [ 240, 144, 179, 189 ], [ 240, 144, 179, 190 ], [ 240, 144, 179, 191 ], [ 240, 144, 185, 160 ], [ 240, 144, 185, 161 ], [ 240, 144, 185, 162 ], [ 240, 144, 185, 163 ], [ 240, 144, 185, 164 ], [ 240, 144, 185, 165 ], [ 240, 144, 185, 166 ], [ 240, 144, 185, 167 ], [ 240, 144, 185, 168 ], [ 240, 144, 185, 169 ], [ 240, 144, 185, 170 ], [ 240, 144, 185, 171 ], [ 240, 144, 185, 172 ], [ 240, 144, 185, 173 ], [ 240, 144, 185, 174 ], [ 240, 144, 185, 175 ], [ 240, 144, 185, 176 ], [ 240, 144, 185, 177 ], [ 240, 144, 185, 178 ], [ 240, 144, 185, 179 ], [ 240, 144, 185, 180 ], [ 240, 144, 185, 181 ], [ 240, 144, 185, 182 ], [ 240, 144, 185, 183 ], [ 240, 144, 185, 184 ], [ 240, 144, 185, 185 ], [ 240, 144, 185, 186 ], [ 240, 144, 185, 187 ], [ 240, 144, 185, 188 ], [ 240, 144, 185, 189 ], [ 240, 144, 185, 190 ], [ 240, 145, 129, 146 ], [ 240, 145, 129, 147 ], [ 240, 145, 129, 148 ], [ 240, 145, 129, 149 ], [ 240, 145, 129, 150 ], [ 240, 145, 129, 151 ], [ 240, 145, 129, 152 ], [ 240, 145, 129, 153 ], [ 240, 145, 129, 154 ], [ 240, 145, 129, 155 ], [ 240, 145, 129, 156 ], [ 240, 145, 129, 157 ], [ 240, 145, 129, 158 ], [ 240, 145, 129, 159 ], [ 240, 145, 129, 160 ], [ 240, 145, 129, 161 ], [ 240, 145, 129, 162 ], [ 240, 145, 129, 163 ], [ 240, 145, 129, 164 ], [ 240, 145, 129, 165 ], [ 240, 145, 129, 166 ], [ 240, 145, 129, 167 ], [ 240, 145, 129, 168 ], [ 240, 145, 129, 169 ], [ 240, 145, 129, 170 ], [ 240, 145, 129, 171 ], [ 240, 145, 129, 172 ], [ 240, 145, 129, 173 ], [ 240, 145, 129, 174 ], [ 240, 145, 129, 175 ], [ 240, 145, 131, 176 ], [ 240, 145, 131, 177 ], [ 240, 145, 131, 178 ], [ 240, 145, 131, 179 ], [ 240, 145, 131, 180 ], [ 240, 145, 131, 181 ], [ 240, 145, 131, 182 ], [ 240, 145, 131, 183 ], [ 240, 145, 131, 184 ], [ 240, 145, 131, 185 ], [ 240, 145, 132, 182 ], [ 240, 145, 132, 183 ], [ 240, 145, 132, 184 ], [ 240, 145, 132, 185 ], [ 240, 145, 132, 186 ], [ 240, 145, 132, 187 ], [ 240, 145, 132, 188 ], [ 240, 145, 132, 189 ], [ 240, 145, 132, 190 ], [ 240, 145, 132, 191 ], [ 240, 145, 135, 144 ], [ 240, 145, 135, 145 ], [ 240, 145, 135, 146 ], [ 240, 145, 135, 147 ], [ 240, 145, 135, 148 ], [ 240, 145, 135, 149 ], [ 240, 145, 135, 150 ], [ 240, 145, 135, 151 ], [ 240, 145, 135, 152 ], [ 240, 145, 135, 153 ], [ 240, 145, 135, 161 ], [ 240, 145, 135, 162 ], [ 240, 145, 135, 163 ], [ 240, 145, 135, 164 ], [ 240, 145, 135, 165 ], [ 240, 145, 135, 166 ], [ 240, 145, 135, 167 ], [ 240, 145, 135, 168 ], [ 240, 145, 135, 169 ], [ 240, 145, 135, 170 ], [ 240, 145, 135, 171 ], [ 240, 145, 135, 172 ], [ 240, 145, 135, 173 ], [ 240, 145, 135, 174 ], [ 240, 145, 135, 175 ], [ 240, 145, 135, 176 ], [ 240, 145, 135, 177 ], [ 240, 145, 135, 178 ], [ 240, 145, 135, 179 ], [ 240, 145, 135, 180 ], [ 240, 145, 139, 176 ], [ 240, 145, 139, 177 ], [ 240, 145, 139, 178 ], [ 240, 145, 139, 179 ], [ 240, 145, 139, 180 ], [ 240, 145, 139, 181 ], [ 240, 145, 139, 182 ], [ 240, 145, 139, 183 ], [ 240, 145, 139, 184 ], [ 240, 145, 139, 185 ], [ 240, 145, 147, 144 ], [ 240, 145, 147, 145 ], [ 240, 145, 147, 146 ], [ 240, 145, 147, 147 ], [ 240, 145, 147, 148 ], [ 240, 145, 147, 149 ], [ 240, 145, 147, 150 ], [ 240, 145, 147, 151 ], [ 240, 145, 147, 152 ], [ 240, 145, 147, 153 ], [ 240, 145, 153, 144 ], [ 240, 145, 153, 145 ], [ 240, 145, 153, 146 ], [ 240, 145, 153, 147 ], [ 240, 145, 153, 148 ], [ 240, 145, 153, 149 ], [ 240, 145, 153, 150 ], [ 240, 145, 153, 151 ], [ 240, 145, 153, 152 ], [ 240, 145, 153, 153 ], [ 240, 145, 155, 128 ], [ 240, 145, 155, 129 ], [ 240, 145, 155, 130 ], [ 240, 145, 155, 131 ], [ 240, 145, 155, 132 ], [ 240, 145, 155, 133 ], [ 240, 145, 155, 134 ], [ 240, 145, 155, 135 ], [ 240, 145, 155, 136 ], [ 240, 145, 155, 137 ], [ 240, 145, 156, 176 ], [ 240, 145, 156, 177 ], [ 240, 145, 156, 178 ], [ 240, 145, 156, 179 ], [ 240, 145, 156, 180 ], [ 240, 145, 156, 181 ], [ 240, 145, 156, 182 ], [ 240, 145, 156, 183 ], [ 240, 145, 156, 184 ], [ 240, 145, 156, 185 ], [ 240, 145, 156, 186 ], [ 240, 145, 156, 187 ], [ 240, 145, 163, 160 ], [ 240, 145, 163, 161 ], [ 240, 145, 163, 162 ], [ 240, 145, 163, 163 ], [ 240, 145, 163, 164 ], [ 240, 145, 163, 165 ], [ 240, 145, 163, 166 ], [ 240, 145, 163, 167 ], [ 240, 145, 163, 168 ], [ 240, 145, 163, 169 ], [ 240, 145, 163, 170 ], [ 240, 145, 163, 171 ], [ 240, 145, 163, 172 ], [ 240, 145, 163, 173 ], [ 240, 145, 163, 174 ], [ 240, 145, 163, 175 ], [ 240, 145, 163, 176 ], [ 240, 145, 163, 177 ], [ 240, 145, 163, 178 ], [ 240, 146, 144, 128 ], [ 240, 146, 144, 129 ], [ 240, 146, 144, 130 ], [ 240, 146, 144, 131 ], [ 240, 146, 144, 132 ], [ 240, 146, 144, 133 ], [ 240, 146, 144, 134 ], [ 240, 146, 144, 135 ], [ 240, 146, 144, 136 ], [ 240, 146, 144, 137 ], [ 240, 146, 144, 138 ], [ 240, 146, 144, 139 ], [ 240, 146, 144, 140 ], [ 240, 146, 144, 141 ], [ 240, 146, 144, 142 ], [ 240, 146, 144, 143 ], [ 240, 146, 144, 144 ], [ 240, 146, 144, 145 ], [ 240, 146, 144, 146 ], [ 240, 146, 144, 147 ], [ 240, 146, 144, 148 ], [ 240, 146, 144, 149 ], [ 240, 146, 144, 150 ], [ 240, 146, 144, 151 ], [ 240, 146, 144, 152 ], [ 240, 146, 144, 153 ], [ 240, 146, 144, 154 ], [ 240, 146, 144, 155 ], [ 240, 146, 144, 156 ], [ 240, 146, 144, 157 ], [ 240, 146, 144, 158 ], [ 240, 146, 144, 159 ], [ 240, 146, 144, 160 ], [ 240, 146, 144, 161 ], [ 240, 146, 144, 162 ], [ 240, 146, 144, 163 ], [ 240, 146, 144, 164 ], [ 240, 146, 144, 165 ], [ 240, 146, 144, 166 ], [ 240, 146, 144, 167 ], [ 240, 146, 144, 168 ], [ 240, 146, 144, 169 ], [ 240, 146, 144, 170 ], [ 240, 146, 144, 171 ], [ 240, 146, 144, 172 ], [ 240, 146, 144, 173 ], [ 240, 146, 144, 174 ], [ 240, 146, 144, 175 ], [ 240, 146, 144, 176 ], [ 240, 146, 144, 177 ], [ 240, 146, 144, 178 ], [ 240, 146, 144, 179 ], [ 240, 146, 144, 180 ], [ 240, 146, 144, 181 ], [ 240, 146, 144, 182 ], [ 240, 146, 144, 183 ], [ 240, 146, 144, 184 ], [ 240, 146, 144, 185 ], [ 240, 146, 144, 186 ], [ 240, 146, 144, 187 ], [ 240, 146, 144, 188 ], [ 240, 146, 144, 189 ], [ 240, 146, 144, 190 ], [ 240, 146, 144, 191 ], [ 240, 146, 145, 128 ], [ 240, 146, 145, 129 ], [ 240, 146, 145, 130 ], [ 240, 146, 145, 131 ], [ 240, 146, 145, 132 ], [ 240, 146, 145, 133 ], [ 240, 146, 145, 134 ], [ 240, 146, 145, 135 ], [ 240, 146, 145, 136 ], [ 240, 146, 145, 137 ], [ 240, 146, 145, 138 ], [ 240, 146, 145, 139 ], [ 240, 146, 145, 140 ], [ 240, 146, 145, 141 ], [ 240, 146, 145, 142 ], [ 240, 146, 145, 143 ], [ 240, 146, 145, 144 ], [ 240, 146, 145, 145 ], [ 240, 146, 145, 146 ], [ 240, 146, 145, 147 ], [ 240, 146, 145, 148 ], [ 240, 146, 145, 149 ], [ 240, 146, 145, 150 ], [ 240, 146, 145, 151 ], [ 240, 146, 145, 152 ], [ 240, 146, 145, 153 ], [ 240, 146, 145, 154 ], [ 240, 146, 145, 155 ], [ 240, 146, 145, 156 ], [ 240, 146, 145, 157 ], [ 240, 146, 145, 158 ], [ 240, 146, 145, 159 ], [ 240, 146, 145, 160 ], [ 240, 146, 145, 161 ], [ 240, 146, 145, 162 ], [ 240, 146, 145, 163 ], [ 240, 146, 145, 164 ], [ 240, 146, 145, 165 ], [ 240, 146, 145, 166 ], [ 240, 146, 145, 167 ], [ 240, 146, 145, 168 ], [ 240, 146, 145, 169 ], [ 240, 146, 145, 170 ], [ 240, 146, 145, 171 ], [ 240, 146, 145, 172 ], [ 240, 146, 145, 173 ], [ 240, 146, 145, 174 ], [ 240, 150, 169, 160 ], [ 240, 150, 169, 161 ], [ 240, 150, 169, 162 ], [ 240, 150, 169, 163 ], [ 240, 150, 169, 164 ], [ 240, 150, 169, 165 ], [ 240, 150, 169, 166 ], [ 240, 150, 169, 167 ], [ 240, 150, 169, 168 ], [ 240, 150, 169, 169 ], [ 240, 150, 173, 144 ], [ 240, 150, 173, 145 ], [ 240, 150, 173, 146 ], [ 240, 150, 173, 147 ], [ 240, 150, 173, 148 ], [ 240, 150, 173, 149 ], [ 240, 150, 173, 150 ], [ 240, 150, 173, 151 ], [ 240, 150, 173, 152 ], [ 240, 150, 173, 153 ], [ 240, 150, 173, 155 ], [ 240, 150, 173, 156 ], [ 240, 150, 173, 157 ], [ 240, 150, 173, 158 ], [ 240, 150, 173, 159 ], [ 240, 150, 173, 160 ], [ 240, 150, 173, 161 ], [ 240, 157, 141, 160 ], [ 240, 157, 141, 161 ], [ 240, 157, 141, 162 ], [ 240, 157, 141, 163 ], [ 240, 157, 141, 164 ], [ 240, 157, 141, 165 ], [ 240, 157, 141, 166 ], [ 240, 157, 141, 167 ], [ 240, 157, 141, 168 ], [ 240, 157, 141, 169 ], [ 240, 157, 141, 170 ], [ 240, 157, 141, 171 ], [ 240, 157, 141, 172 ], [ 240, 157, 141, 173 ], [ 240, 157, 141, 174 ], [ 240, 157, 141, 175 ], [ 240, 157, 141, 176 ], [ 240, 157, 141, 177 ], [ 240, 157, 159, 142 ], [ 240, 157, 159, 143 ], [ 240, 157, 159, 144 ], [ 240, 157, 159, 145 ], [ 240, 157, 159, 146 ], [ 240, 157, 159, 147 ], [ 240, 157, 159, 148 ], [ 240, 157, 159, 149 ], [ 240, 157, 159, 150 ], [ 240, 157, 159, 151 ], [ 240, 157, 159, 152 ], [ 240, 157, 159, 153 ], [ 240, 157, 159, 154 ], [ 240, 157, 159, 155 ], [ 240, 157, 159, 156 ], [ 240, 157, 159, 157 ], [ 240, 157, 159, 158 ], [ 240, 157, 159, 159 ], [ 240, 157, 159, 160 ], [ 240, 157, 159, 161 ], [ 240, 157, 159, 162 ], [ 240, 157, 159, 163 ], [ 240, 157, 159, 164 ], [ 240, 157, 159, 165 ], [ 240, 157, 159, 166 ], [ 240, 157, 159, 167 ], [ 240, 157, 159, 168 ], [ 240, 157, 159, 169 ], [ 240, 157, 159, 170 ], [ 240, 157, 159, 171 ], [ 240, 157, 159, 172 ], [ 240, 157, 159, 173 ], [ 240, 157, 159, 174 ], [ 240, 157, 159, 175 ], [ 240, 157, 159, 176 ], [ 240, 157, 159, 177 ], [ 240, 157, 159, 178 ], [ 240, 157, 159, 179 ], [ 240, 157, 159, 180 ], [ 240, 157, 159, 181 ], [ 240, 157, 159, 182 ], [ 240, 157, 159, 183 ], [ 240, 157, 159, 184 ], [ 240, 157, 159, 185 ], [ 240, 157, 159, 186 ], [ 240, 157, 159, 187 ], [ 240, 157, 159, 188 ], [ 240, 157, 159, 189 ], [ 240, 157, 159, 190 ], [ 240, 157, 159, 191 ], [ 240, 158, 163, 135 ], [ 240, 158, 163, 136 ], [ 240, 158, 163, 137 ], [ 240, 158, 163, 138 ], [ 240, 158, 163, 139 ], [ 240, 158, 163, 140 ], [ 240, 158, 163, 141 ], [ 240, 158, 163, 142 ], [ 240, 158, 163, 143 ], [ 240, 159, 132, 128 ], [ 240, 159, 132, 129 ], [ 240, 159, 132, 130 ], [ 240, 159, 132, 131 ], [ 240, 159, 132, 132 ], [ 240, 159, 132, 133 ], [ 240, 159, 132, 134 ], [ 240, 159, 132, 135 ], [ 240, 159, 132, 136 ], [ 240, 159, 132, 137 ], [ 240, 159, 132, 138 ], [ 240, 159, 132, 139 ], [ 240, 159, 132, 140 ] ]
uctable = [[48], [49], [50], [51], [52], [53], [54], [55], [56], [57], [194, 178], [194, 179], [194, 185], [194, 188], [194, 189], [194, 190], [217, 160], [217, 161], [217, 162], [217, 163], [217, 164], [217, 165], [217, 166], [217, 167], [217, 168], [217, 169], [219, 176], [219, 177], [219, 178], [219, 179], [219, 180], [219, 181], [219, 182], [219, 183], [219, 184], [219, 185], [223, 128], [223, 129], [223, 130], [223, 131], [223, 132], [223, 133], [223, 134], [223, 135], [223, 136], [223, 137], [224, 165, 166], [224, 165, 167], [224, 165, 168], [224, 165, 169], [224, 165, 170], [224, 165, 171], [224, 165, 172], [224, 165, 173], [224, 165, 174], [224, 165, 175], [224, 167, 166], [224, 167, 167], [224, 167, 168], [224, 167, 169], [224, 167, 170], [224, 167, 171], [224, 167, 172], [224, 167, 173], [224, 167, 174], [224, 167, 175], [224, 167, 180], [224, 167, 181], [224, 167, 182], [224, 167, 183], [224, 167, 184], [224, 167, 185], [224, 169, 166], [224, 169, 167], [224, 169, 168], [224, 169, 169], [224, 169, 170], [224, 169, 171], [224, 169, 172], [224, 169, 173], [224, 169, 174], [224, 169, 175], [224, 171, 166], [224, 171, 167], [224, 171, 168], [224, 171, 169], [224, 171, 170], [224, 171, 171], [224, 171, 172], [224, 171, 173], [224, 171, 174], [224, 171, 175], [224, 173, 166], [224, 173, 167], [224, 173, 168], [224, 173, 169], [224, 173, 170], [224, 173, 171], [224, 173, 172], [224, 173, 173], [224, 173, 174], [224, 173, 175], [224, 173, 178], [224, 173, 179], [224, 173, 180], [224, 173, 181], [224, 173, 182], [224, 173, 183], [224, 175, 166], [224, 175, 167], [224, 175, 168], [224, 175, 169], [224, 175, 170], [224, 175, 171], [224, 175, 172], [224, 175, 173], [224, 175, 174], [224, 175, 175], [224, 175, 176], [224, 175, 177], [224, 175, 178], [224, 177, 166], [224, 177, 167], [224, 177, 168], [224, 177, 169], [224, 177, 170], [224, 177, 171], [224, 177, 172], [224, 177, 173], [224, 177, 174], [224, 177, 175], [224, 177, 184], [224, 177, 185], [224, 177, 186], [224, 177, 187], [224, 177, 188], [224, 177, 189], [224, 177, 190], [224, 179, 166], [224, 179, 167], [224, 179, 168], [224, 179, 169], [224, 179, 170], [224, 179, 171], [224, 179, 172], [224, 179, 173], [224, 179, 174], [224, 179, 175], [224, 181, 166], [224, 181, 167], [224, 181, 168], [224, 181, 169], [224, 181, 170], [224, 181, 171], [224, 181, 172], [224, 181, 173], [224, 181, 174], [224, 181, 175], [224, 181, 176], [224, 181, 177], [224, 181, 178], [224, 181, 179], [224, 181, 180], [224, 181, 181], [224, 183, 166], [224, 183, 167], [224, 183, 168], [224, 183, 169], [224, 183, 170], [224, 183, 171], [224, 183, 172], [224, 183, 173], [224, 183, 174], [224, 183, 175], [224, 185, 144], [224, 185, 145], [224, 185, 146], [224, 185, 147], [224, 185, 148], [224, 185, 149], [224, 185, 150], [224, 185, 151], [224, 185, 152], [224, 185, 153], [224, 187, 144], [224, 187, 145], [224, 187, 146], [224, 187, 147], [224, 187, 148], [224, 187, 149], [224, 187, 150], [224, 187, 151], [224, 187, 152], [224, 187, 153], [224, 188, 160], [224, 188, 161], [224, 188, 162], [224, 188, 163], [224, 188, 164], [224, 188, 165], [224, 188, 166], [224, 188, 167], [224, 188, 168], [224, 188, 169], [224, 188, 170], [224, 188, 171], [224, 188, 172], [224, 188, 173], [224, 188, 174], [224, 188, 175], [224, 188, 176], [224, 188, 177], [224, 188, 178], [224, 188, 179], [225, 129, 128], [225, 129, 129], [225, 129, 130], [225, 129, 131], [225, 129, 132], [225, 129, 133], [225, 129, 134], [225, 129, 135], [225, 129, 136], [225, 129, 137], [225, 130, 144], [225, 130, 145], [225, 130, 146], [225, 130, 147], [225, 130, 148], [225, 130, 149], [225, 130, 150], [225, 130, 151], [225, 130, 152], [225, 130, 153], [225, 141, 169], [225, 141, 170], [225, 141, 171], [225, 141, 172], [225, 141, 173], [225, 141, 174], [225, 141, 175], [225, 141, 176], [225, 141, 177], [225, 141, 178], [225, 141, 179], [225, 141, 180], [225, 141, 181], [225, 141, 182], [225, 141, 183], [225, 141, 184], [225, 141, 185], [225, 141, 186], [225, 141, 187], [225, 141, 188], [225, 155, 174], [225, 155, 175], [225, 155, 176], [225, 159, 160], [225, 159, 161], [225, 159, 162], [225, 159, 163], [225, 159, 164], [225, 159, 165], [225, 159, 166], [225, 159, 167], [225, 159, 168], [225, 159, 169], [225, 159, 176], [225, 159, 177], [225, 159, 178], [225, 159, 179], [225, 159, 180], [225, 159, 181], [225, 159, 182], [225, 159, 183], [225, 159, 184], [225, 159, 185], [225, 160, 144], [225, 160, 145], [225, 160, 146], [225, 160, 147], [225, 160, 148], [225, 160, 149], [225, 160, 150], [225, 160, 151], [225, 160, 152], [225, 160, 153], [225, 165, 134], [225, 165, 135], [225, 165, 136], [225, 165, 137], [225, 165, 138], [225, 165, 139], [225, 165, 140], [225, 165, 141], [225, 165, 142], [225, 165, 143], [225, 167, 144], [225, 167, 145], [225, 167, 146], [225, 167, 147], [225, 167, 148], [225, 167, 149], [225, 167, 150], [225, 167, 151], [225, 167, 152], [225, 167, 153], [225, 167, 154], [225, 170, 128], [225, 170, 129], [225, 170, 130], [225, 170, 131], [225, 170, 132], [225, 170, 133], [225, 170, 134], [225, 170, 135], [225, 170, 136], [225, 170, 137], [225, 170, 144], [225, 170, 145], [225, 170, 146], [225, 170, 147], [225, 170, 148], [225, 170, 149], [225, 170, 150], [225, 170, 151], [225, 170, 152], [225, 170, 153], [225, 173, 144], [225, 173, 145], [225, 173, 146], [225, 173, 147], [225, 173, 148], [225, 173, 149], [225, 173, 150], [225, 173, 151], [225, 173, 152], [225, 173, 153], [225, 174, 176], [225, 174, 177], [225, 174, 178], [225, 174, 179], [225, 174, 180], [225, 174, 181], [225, 174, 182], [225, 174, 183], [225, 174, 184], [225, 174, 185], [225, 177, 128], [225, 177, 129], [225, 177, 130], [225, 177, 131], [225, 177, 132], [225, 177, 133], [225, 177, 134], [225, 177, 135], [225, 177, 136], [225, 177, 137], [225, 177, 144], [225, 177, 145], [225, 177, 146], [225, 177, 147], [225, 177, 148], [225, 177, 149], [225, 177, 150], [225, 177, 151], [225, 177, 152], [225, 177, 153], [226, 129, 176], [226, 129, 180], [226, 129, 181], [226, 129, 182], [226, 129, 183], [226, 129, 184], [226, 129, 185], [226, 130, 128], [226, 130, 129], [226, 130, 130], [226, 130, 131], [226, 130, 132], [226, 130, 133], [226, 130, 134], [226, 130, 135], [226, 130, 136], [226, 130, 137], [226, 133, 144], [226, 133, 145], [226, 133, 146], [226, 133, 147], [226, 133, 148], [226, 133, 149], [226, 133, 150], [226, 133, 151], [226, 133, 152], [226, 133, 153], [226, 133, 154], [226, 133, 155], [226, 133, 156], [226, 133, 157], [226, 133, 158], [226, 133, 159], [226, 133, 160], [226, 133, 161], [226, 133, 162], [226, 133, 163], [226, 133, 164], [226, 133, 165], [226, 133, 166], [226, 133, 167], [226, 133, 168], [226, 133, 169], [226, 133, 170], [226, 133, 171], [226, 133, 172], [226, 133, 173], [226, 133, 174], [226, 133, 175], [226, 133, 176], [226, 133, 177], [226, 133, 178], [226, 133, 179], [226, 133, 180], [226, 133, 181], [226, 133, 182], [226, 133, 183], [226, 133, 184], [226, 133, 185], [226, 133, 186], [226, 133, 187], [226, 133, 188], [226, 133, 189], [226, 133, 190], [226, 133, 191], [226, 134, 128], [226, 134, 129], [226, 134, 130], [226, 134, 133], [226, 134, 134], [226, 134, 135], [226, 134, 136], [226, 134, 137], [226, 145, 160], [226, 145, 161], [226, 145, 162], [226, 145, 163], [226, 145, 164], [226, 145, 165], [226, 145, 166], [226, 145, 167], [226, 145, 168], [226, 145, 169], [226, 145, 170], [226, 145, 171], [226, 145, 172], [226, 145, 173], [226, 145, 174], [226, 145, 175], [226, 145, 176], [226, 145, 177], [226, 145, 178], [226, 145, 179], [226, 145, 180], [226, 145, 181], [226, 145, 182], [226, 145, 183], [226, 145, 184], [226, 145, 185], [226, 145, 186], [226, 145, 187], [226, 145, 188], [226, 145, 189], [226, 145, 190], [226, 145, 191], [226, 146, 128], [226, 146, 129], [226, 146, 130], [226, 146, 131], [226, 146, 132], [226, 146, 133], [226, 146, 134], [226, 146, 135], [226, 146, 136], [226, 146, 137], [226, 146, 138], [226, 146, 139], [226, 146, 140], [226, 146, 141], [226, 146, 142], [226, 146, 143], [226, 146, 144], [226, 146, 145], [226, 146, 146], [226, 146, 147], [226, 146, 148], [226, 146, 149], [226, 146, 150], [226, 146, 151], [226, 146, 152], [226, 146, 153], [226, 146, 154], [226, 146, 155], [226, 147, 170], [226, 147, 171], [226, 147, 172], [226, 147, 173], [226, 147, 174], [226, 147, 175], [226, 147, 176], [226, 147, 177], [226, 147, 178], [226, 147, 179], [226, 147, 180], [226, 147, 181], [226, 147, 182], [226, 147, 183], [226, 147, 184], [226, 147, 185], [226, 147, 186], [226, 147, 187], [226, 147, 188], [226, 147, 189], [226, 147, 190], [226, 147, 191], [226, 157, 182], [226, 157, 183], [226, 157, 184], [226, 157, 185], [226, 157, 186], [226, 157, 187], [226, 157, 188], [226, 157, 189], [226, 157, 190], [226, 157, 191], [226, 158, 128], [226, 158, 129], [226, 158, 130], [226, 158, 131], [226, 158, 132], [226, 158, 133], [226, 158, 134], [226, 158, 135], [226, 158, 136], [226, 158, 137], [226, 158, 138], [226, 158, 139], [226, 158, 140], [226, 158, 141], [226, 158, 142], [226, 158, 143], [226, 158, 144], [226, 158, 145], [226, 158, 146], [226, 158, 147], [226, 179, 189], [227, 128, 135], [227, 128, 161], [227, 128, 162], [227, 128, 163], [227, 128, 164], [227, 128, 165], [227, 128, 166], [227, 128, 167], [227, 128, 168], [227, 128, 169], [227, 128, 184], [227, 128, 185], [227, 128, 186], [227, 134, 146], [227, 134, 147], [227, 134, 148], [227, 134, 149], [227, 136, 160], [227, 136, 161], [227, 136, 162], [227, 136, 163], [227, 136, 164], [227, 136, 165], [227, 136, 166], [227, 136, 167], [227, 136, 168], [227, 136, 169], [227, 137, 136], [227, 137, 137], [227, 137, 138], [227, 137, 139], [227, 137, 140], [227, 137, 141], [227, 137, 142], [227, 137, 143], [227, 137, 145], [227, 137, 146], [227, 137, 147], [227, 137, 148], [227, 137, 149], [227, 137, 150], [227, 137, 151], [227, 137, 152], [227, 137, 153], [227, 137, 154], [227, 137, 155], [227, 137, 156], [227, 137, 157], [227, 137, 158], [227, 137, 159], [227, 138, 128], [227, 138, 129], [227, 138, 130], [227, 138, 131], [227, 138, 132], [227, 138, 133], [227, 138, 134], [227, 138, 135], [227, 138, 136], [227, 138, 137], [227, 138, 177], [227, 138, 178], [227, 138, 179], [227, 138, 180], [227, 138, 181], [227, 138, 182], [227, 138, 183], [227, 138, 184], [227, 138, 185], [227, 138, 186], [227, 138, 187], [227, 138, 188], [227, 138, 189], [227, 138, 190], [227, 138, 191], [234, 152, 160], [234, 152, 161], [234, 152, 162], [234, 152, 163], [234, 152, 164], [234, 152, 165], [234, 152, 166], [234, 152, 167], [234, 152, 168], [234, 152, 169], [234, 155, 166], [234, 155, 167], [234, 155, 168], [234, 155, 169], [234, 155, 170], [234, 155, 171], [234, 155, 172], [234, 155, 173], [234, 155, 174], [234, 155, 175], [234, 160, 176], [234, 160, 177], [234, 160, 178], [234, 160, 179], [234, 160, 180], [234, 160, 181], [234, 163, 144], [234, 163, 145], [234, 163, 146], [234, 163, 147], [234, 163, 148], [234, 163, 149], [234, 163, 150], [234, 163, 151], [234, 163, 152], [234, 163, 153], [234, 164, 128], [234, 164, 129], [234, 164, 130], [234, 164, 131], [234, 164, 132], [234, 164, 133], [234, 164, 134], [234, 164, 135], [234, 164, 136], [234, 164, 137], [234, 167, 144], [234, 167, 145], [234, 167, 146], [234, 167, 147], [234, 167, 148], [234, 167, 149], [234, 167, 150], [234, 167, 151], [234, 167, 152], [234, 167, 153], [234, 167, 176], [234, 167, 177], [234, 167, 178], [234, 167, 179], [234, 167, 180], [234, 167, 181], [234, 167, 182], [234, 167, 183], [234, 167, 184], [234, 167, 185], [234, 169, 144], [234, 169, 145], [234, 169, 146], [234, 169, 147], [234, 169, 148], [234, 169, 149], [234, 169, 150], [234, 169, 151], [234, 169, 152], [234, 169, 153], [234, 175, 176], [234, 175, 177], [234, 175, 178], [234, 175, 179], [234, 175, 180], [234, 175, 181], [234, 175, 182], [234, 175, 183], [234, 175, 184], [234, 175, 185], [239, 188, 144], [239, 188, 145], [239, 188, 146], [239, 188, 147], [239, 188, 148], [239, 188, 149], [239, 188, 150], [239, 188, 151], [239, 188, 152], [239, 188, 153], [240, 144, 132, 135], [240, 144, 132, 136], [240, 144, 132, 137], [240, 144, 132, 138], [240, 144, 132, 139], [240, 144, 132, 140], [240, 144, 132, 141], [240, 144, 132, 142], [240, 144, 132, 143], [240, 144, 132, 144], [240, 144, 132, 145], [240, 144, 132, 146], [240, 144, 132, 147], [240, 144, 132, 148], [240, 144, 132, 149], [240, 144, 132, 150], [240, 144, 132, 151], [240, 144, 132, 152], [240, 144, 132, 153], [240, 144, 132, 154], [240, 144, 132, 155], [240, 144, 132, 156], [240, 144, 132, 157], [240, 144, 132, 158], [240, 144, 132, 159], [240, 144, 132, 160], [240, 144, 132, 161], [240, 144, 132, 162], [240, 144, 132, 163], [240, 144, 132, 164], [240, 144, 132, 165], [240, 144, 132, 166], [240, 144, 132, 167], [240, 144, 132, 168], [240, 144, 132, 169], [240, 144, 132, 170], [240, 144, 132, 171], [240, 144, 132, 172], [240, 144, 132, 173], [240, 144, 132, 174], [240, 144, 132, 175], [240, 144, 132, 176], [240, 144, 132, 177], [240, 144, 132, 178], [240, 144, 132, 179], [240, 144, 133, 128], [240, 144, 133, 129], [240, 144, 133, 130], [240, 144, 133, 131], [240, 144, 133, 132], [240, 144, 133, 133], [240, 144, 133, 134], [240, 144, 133, 135], [240, 144, 133, 136], [240, 144, 133, 137], [240, 144, 133, 138], [240, 144, 133, 139], [240, 144, 133, 140], [240, 144, 133, 141], [240, 144, 133, 142], [240, 144, 133, 143], [240, 144, 133, 144], [240, 144, 133, 145], [240, 144, 133, 146], [240, 144, 133, 147], [240, 144, 133, 148], [240, 144, 133, 149], [240, 144, 133, 150], [240, 144, 133, 151], [240, 144, 133, 152], [240, 144, 133, 153], [240, 144, 133, 154], [240, 144, 133, 155], [240, 144, 133, 156], [240, 144, 133, 157], [240, 144, 133, 158], [240, 144, 133, 159], [240, 144, 133, 160], [240, 144, 133, 161], [240, 144, 133, 162], [240, 144, 133, 163], [240, 144, 133, 164], [240, 144, 133, 165], [240, 144, 133, 166], [240, 144, 133, 167], [240, 144, 133, 168], [240, 144, 133, 169], [240, 144, 133, 170], [240, 144, 133, 171], [240, 144, 133, 172], [240, 144, 133, 173], [240, 144, 133, 174], [240, 144, 133, 175], [240, 144, 133, 176], [240, 144, 133, 177], [240, 144, 133, 178], [240, 144, 133, 179], [240, 144, 133, 180], [240, 144, 133, 181], [240, 144, 133, 182], [240, 144, 133, 183], [240, 144, 133, 184], [240, 144, 134, 138], [240, 144, 134, 139], [240, 144, 139, 161], [240, 144, 139, 162], [240, 144, 139, 163], [240, 144, 139, 164], [240, 144, 139, 165], [240, 144, 139, 166], [240, 144, 139, 167], [240, 144, 139, 168], [240, 144, 139, 169], [240, 144, 139, 170], [240, 144, 139, 171], [240, 144, 139, 172], [240, 144, 139, 173], [240, 144, 139, 174], [240, 144, 139, 175], [240, 144, 139, 176], [240, 144, 139, 177], [240, 144, 139, 178], [240, 144, 139, 179], [240, 144, 139, 180], [240, 144, 139, 181], [240, 144, 139, 182], [240, 144, 139, 183], [240, 144, 139, 184], [240, 144, 139, 185], [240, 144, 139, 186], [240, 144, 139, 187], [240, 144, 140, 160], [240, 144, 140, 161], [240, 144, 140, 162], [240, 144, 140, 163], [240, 144, 141, 129], [240, 144, 141, 138], [240, 144, 143, 145], [240, 144, 143, 146], [240, 144, 143, 147], [240, 144, 143, 148], [240, 144, 143, 149], [240, 144, 146, 160], [240, 144, 146, 161], [240, 144, 146, 162], [240, 144, 146, 163], [240, 144, 146, 164], [240, 144, 146, 165], [240, 144, 146, 166], [240, 144, 146, 167], [240, 144, 146, 168], [240, 144, 146, 169], [240, 144, 161, 152], [240, 144, 161, 153], [240, 144, 161, 154], [240, 144, 161, 155], [240, 144, 161, 156], [240, 144, 161, 157], [240, 144, 161, 158], [240, 144, 161, 159], [240, 144, 161, 185], [240, 144, 161, 186], [240, 144, 161, 187], [240, 144, 161, 188], [240, 144, 161, 189], [240, 144, 161, 190], [240, 144, 161, 191], [240, 144, 162, 167], [240, 144, 162, 168], [240, 144, 162, 169], [240, 144, 162, 170], [240, 144, 162, 171], [240, 144, 162, 172], [240, 144, 162, 173], [240, 144, 162, 174], [240, 144, 162, 175], [240, 144, 163, 187], [240, 144, 163, 188], [240, 144, 163, 189], [240, 144, 163, 190], [240, 144, 163, 191], [240, 144, 164, 150], [240, 144, 164, 151], [240, 144, 164, 152], [240, 144, 164, 153], [240, 144, 164, 154], [240, 144, 164, 155], [240, 144, 166, 188], [240, 144, 166, 189], [240, 144, 167, 128], [240, 144, 167, 129], [240, 144, 167, 130], [240, 144, 167, 131], [240, 144, 167, 132], [240, 144, 167, 133], [240, 144, 167, 134], [240, 144, 167, 135], [240, 144, 167, 136], [240, 144, 167, 137], [240, 144, 167, 138], [240, 144, 167, 139], [240, 144, 167, 140], [240, 144, 167, 141], [240, 144, 167, 142], [240, 144, 167, 143], [240, 144, 167, 146], [240, 144, 167, 147], [240, 144, 167, 148], [240, 144, 167, 149], [240, 144, 167, 150], [240, 144, 167, 151], [240, 144, 167, 152], [240, 144, 167, 153], [240, 144, 167, 154], [240, 144, 167, 155], [240, 144, 167, 156], [240, 144, 167, 157], [240, 144, 167, 158], [240, 144, 167, 159], [240, 144, 167, 160], [240, 144, 167, 161], [240, 144, 167, 162], [240, 144, 167, 163], [240, 144, 167, 164], [240, 144, 167, 165], [240, 144, 167, 166], [240, 144, 167, 167], [240, 144, 167, 168], [240, 144, 167, 169], [240, 144, 167, 170], [240, 144, 167, 171], [240, 144, 167, 172], [240, 144, 167, 173], [240, 144, 167, 174], [240, 144, 167, 175], [240, 144, 167, 176], [240, 144, 167, 177], [240, 144, 167, 178], [240, 144, 167, 179], [240, 144, 167, 180], [240, 144, 167, 181], [240, 144, 167, 182], [240, 144, 167, 183], [240, 144, 167, 184], [240, 144, 167, 185], [240, 144, 167, 186], [240, 144, 167, 187], [240, 144, 167, 188], [240, 144, 167, 189], [240, 144, 167, 190], [240, 144, 167, 191], [240, 144, 169, 128], [240, 144, 169, 129], [240, 144, 169, 130], [240, 144, 169, 131], [240, 144, 169, 132], [240, 144, 169, 133], [240, 144, 169, 134], [240, 144, 169, 135], [240, 144, 169, 189], [240, 144, 169, 190], [240, 144, 170, 157], [240, 144, 170, 158], [240, 144, 170, 159], [240, 144, 171, 171], [240, 144, 171, 172], [240, 144, 171, 173], [240, 144, 171, 174], [240, 144, 171, 175], [240, 144, 173, 152], [240, 144, 173, 153], [240, 144, 173, 154], [240, 144, 173, 155], [240, 144, 173, 156], [240, 144, 173, 157], [240, 144, 173, 158], [240, 144, 173, 159], [240, 144, 173, 184], [240, 144, 173, 185], [240, 144, 173, 186], [240, 144, 173, 187], [240, 144, 173, 188], [240, 144, 173, 189], [240, 144, 173, 190], [240, 144, 173, 191], [240, 144, 174, 169], [240, 144, 174, 170], [240, 144, 174, 171], [240, 144, 174, 172], [240, 144, 174, 173], [240, 144, 174, 174], [240, 144, 174, 175], [240, 144, 179, 186], [240, 144, 179, 187], [240, 144, 179, 188], [240, 144, 179, 189], [240, 144, 179, 190], [240, 144, 179, 191], [240, 144, 185, 160], [240, 144, 185, 161], [240, 144, 185, 162], [240, 144, 185, 163], [240, 144, 185, 164], [240, 144, 185, 165], [240, 144, 185, 166], [240, 144, 185, 167], [240, 144, 185, 168], [240, 144, 185, 169], [240, 144, 185, 170], [240, 144, 185, 171], [240, 144, 185, 172], [240, 144, 185, 173], [240, 144, 185, 174], [240, 144, 185, 175], [240, 144, 185, 176], [240, 144, 185, 177], [240, 144, 185, 178], [240, 144, 185, 179], [240, 144, 185, 180], [240, 144, 185, 181], [240, 144, 185, 182], [240, 144, 185, 183], [240, 144, 185, 184], [240, 144, 185, 185], [240, 144, 185, 186], [240, 144, 185, 187], [240, 144, 185, 188], [240, 144, 185, 189], [240, 144, 185, 190], [240, 145, 129, 146], [240, 145, 129, 147], [240, 145, 129, 148], [240, 145, 129, 149], [240, 145, 129, 150], [240, 145, 129, 151], [240, 145, 129, 152], [240, 145, 129, 153], [240, 145, 129, 154], [240, 145, 129, 155], [240, 145, 129, 156], [240, 145, 129, 157], [240, 145, 129, 158], [240, 145, 129, 159], [240, 145, 129, 160], [240, 145, 129, 161], [240, 145, 129, 162], [240, 145, 129, 163], [240, 145, 129, 164], [240, 145, 129, 165], [240, 145, 129, 166], [240, 145, 129, 167], [240, 145, 129, 168], [240, 145, 129, 169], [240, 145, 129, 170], [240, 145, 129, 171], [240, 145, 129, 172], [240, 145, 129, 173], [240, 145, 129, 174], [240, 145, 129, 175], [240, 145, 131, 176], [240, 145, 131, 177], [240, 145, 131, 178], [240, 145, 131, 179], [240, 145, 131, 180], [240, 145, 131, 181], [240, 145, 131, 182], [240, 145, 131, 183], [240, 145, 131, 184], [240, 145, 131, 185], [240, 145, 132, 182], [240, 145, 132, 183], [240, 145, 132, 184], [240, 145, 132, 185], [240, 145, 132, 186], [240, 145, 132, 187], [240, 145, 132, 188], [240, 145, 132, 189], [240, 145, 132, 190], [240, 145, 132, 191], [240, 145, 135, 144], [240, 145, 135, 145], [240, 145, 135, 146], [240, 145, 135, 147], [240, 145, 135, 148], [240, 145, 135, 149], [240, 145, 135, 150], [240, 145, 135, 151], [240, 145, 135, 152], [240, 145, 135, 153], [240, 145, 135, 161], [240, 145, 135, 162], [240, 145, 135, 163], [240, 145, 135, 164], [240, 145, 135, 165], [240, 145, 135, 166], [240, 145, 135, 167], [240, 145, 135, 168], [240, 145, 135, 169], [240, 145, 135, 170], [240, 145, 135, 171], [240, 145, 135, 172], [240, 145, 135, 173], [240, 145, 135, 174], [240, 145, 135, 175], [240, 145, 135, 176], [240, 145, 135, 177], [240, 145, 135, 178], [240, 145, 135, 179], [240, 145, 135, 180], [240, 145, 139, 176], [240, 145, 139, 177], [240, 145, 139, 178], [240, 145, 139, 179], [240, 145, 139, 180], [240, 145, 139, 181], [240, 145, 139, 182], [240, 145, 139, 183], [240, 145, 139, 184], [240, 145, 139, 185], [240, 145, 147, 144], [240, 145, 147, 145], [240, 145, 147, 146], [240, 145, 147, 147], [240, 145, 147, 148], [240, 145, 147, 149], [240, 145, 147, 150], [240, 145, 147, 151], [240, 145, 147, 152], [240, 145, 147, 153], [240, 145, 153, 144], [240, 145, 153, 145], [240, 145, 153, 146], [240, 145, 153, 147], [240, 145, 153, 148], [240, 145, 153, 149], [240, 145, 153, 150], [240, 145, 153, 151], [240, 145, 153, 152], [240, 145, 153, 153], [240, 145, 155, 128], [240, 145, 155, 129], [240, 145, 155, 130], [240, 145, 155, 131], [240, 145, 155, 132], [240, 145, 155, 133], [240, 145, 155, 134], [240, 145, 155, 135], [240, 145, 155, 136], [240, 145, 155, 137], [240, 145, 156, 176], [240, 145, 156, 177], [240, 145, 156, 178], [240, 145, 156, 179], [240, 145, 156, 180], [240, 145, 156, 181], [240, 145, 156, 182], [240, 145, 156, 183], [240, 145, 156, 184], [240, 145, 156, 185], [240, 145, 156, 186], [240, 145, 156, 187], [240, 145, 163, 160], [240, 145, 163, 161], [240, 145, 163, 162], [240, 145, 163, 163], [240, 145, 163, 164], [240, 145, 163, 165], [240, 145, 163, 166], [240, 145, 163, 167], [240, 145, 163, 168], [240, 145, 163, 169], [240, 145, 163, 170], [240, 145, 163, 171], [240, 145, 163, 172], [240, 145, 163, 173], [240, 145, 163, 174], [240, 145, 163, 175], [240, 145, 163, 176], [240, 145, 163, 177], [240, 145, 163, 178], [240, 146, 144, 128], [240, 146, 144, 129], [240, 146, 144, 130], [240, 146, 144, 131], [240, 146, 144, 132], [240, 146, 144, 133], [240, 146, 144, 134], [240, 146, 144, 135], [240, 146, 144, 136], [240, 146, 144, 137], [240, 146, 144, 138], [240, 146, 144, 139], [240, 146, 144, 140], [240, 146, 144, 141], [240, 146, 144, 142], [240, 146, 144, 143], [240, 146, 144, 144], [240, 146, 144, 145], [240, 146, 144, 146], [240, 146, 144, 147], [240, 146, 144, 148], [240, 146, 144, 149], [240, 146, 144, 150], [240, 146, 144, 151], [240, 146, 144, 152], [240, 146, 144, 153], [240, 146, 144, 154], [240, 146, 144, 155], [240, 146, 144, 156], [240, 146, 144, 157], [240, 146, 144, 158], [240, 146, 144, 159], [240, 146, 144, 160], [240, 146, 144, 161], [240, 146, 144, 162], [240, 146, 144, 163], [240, 146, 144, 164], [240, 146, 144, 165], [240, 146, 144, 166], [240, 146, 144, 167], [240, 146, 144, 168], [240, 146, 144, 169], [240, 146, 144, 170], [240, 146, 144, 171], [240, 146, 144, 172], [240, 146, 144, 173], [240, 146, 144, 174], [240, 146, 144, 175], [240, 146, 144, 176], [240, 146, 144, 177], [240, 146, 144, 178], [240, 146, 144, 179], [240, 146, 144, 180], [240, 146, 144, 181], [240, 146, 144, 182], [240, 146, 144, 183], [240, 146, 144, 184], [240, 146, 144, 185], [240, 146, 144, 186], [240, 146, 144, 187], [240, 146, 144, 188], [240, 146, 144, 189], [240, 146, 144, 190], [240, 146, 144, 191], [240, 146, 145, 128], [240, 146, 145, 129], [240, 146, 145, 130], [240, 146, 145, 131], [240, 146, 145, 132], [240, 146, 145, 133], [240, 146, 145, 134], [240, 146, 145, 135], [240, 146, 145, 136], [240, 146, 145, 137], [240, 146, 145, 138], [240, 146, 145, 139], [240, 146, 145, 140], [240, 146, 145, 141], [240, 146, 145, 142], [240, 146, 145, 143], [240, 146, 145, 144], [240, 146, 145, 145], [240, 146, 145, 146], [240, 146, 145, 147], [240, 146, 145, 148], [240, 146, 145, 149], [240, 146, 145, 150], [240, 146, 145, 151], [240, 146, 145, 152], [240, 146, 145, 153], [240, 146, 145, 154], [240, 146, 145, 155], [240, 146, 145, 156], [240, 146, 145, 157], [240, 146, 145, 158], [240, 146, 145, 159], [240, 146, 145, 160], [240, 146, 145, 161], [240, 146, 145, 162], [240, 146, 145, 163], [240, 146, 145, 164], [240, 146, 145, 165], [240, 146, 145, 166], [240, 146, 145, 167], [240, 146, 145, 168], [240, 146, 145, 169], [240, 146, 145, 170], [240, 146, 145, 171], [240, 146, 145, 172], [240, 146, 145, 173], [240, 146, 145, 174], [240, 150, 169, 160], [240, 150, 169, 161], [240, 150, 169, 162], [240, 150, 169, 163], [240, 150, 169, 164], [240, 150, 169, 165], [240, 150, 169, 166], [240, 150, 169, 167], [240, 150, 169, 168], [240, 150, 169, 169], [240, 150, 173, 144], [240, 150, 173, 145], [240, 150, 173, 146], [240, 150, 173, 147], [240, 150, 173, 148], [240, 150, 173, 149], [240, 150, 173, 150], [240, 150, 173, 151], [240, 150, 173, 152], [240, 150, 173, 153], [240, 150, 173, 155], [240, 150, 173, 156], [240, 150, 173, 157], [240, 150, 173, 158], [240, 150, 173, 159], [240, 150, 173, 160], [240, 150, 173, 161], [240, 157, 141, 160], [240, 157, 141, 161], [240, 157, 141, 162], [240, 157, 141, 163], [240, 157, 141, 164], [240, 157, 141, 165], [240, 157, 141, 166], [240, 157, 141, 167], [240, 157, 141, 168], [240, 157, 141, 169], [240, 157, 141, 170], [240, 157, 141, 171], [240, 157, 141, 172], [240, 157, 141, 173], [240, 157, 141, 174], [240, 157, 141, 175], [240, 157, 141, 176], [240, 157, 141, 177], [240, 157, 159, 142], [240, 157, 159, 143], [240, 157, 159, 144], [240, 157, 159, 145], [240, 157, 159, 146], [240, 157, 159, 147], [240, 157, 159, 148], [240, 157, 159, 149], [240, 157, 159, 150], [240, 157, 159, 151], [240, 157, 159, 152], [240, 157, 159, 153], [240, 157, 159, 154], [240, 157, 159, 155], [240, 157, 159, 156], [240, 157, 159, 157], [240, 157, 159, 158], [240, 157, 159, 159], [240, 157, 159, 160], [240, 157, 159, 161], [240, 157, 159, 162], [240, 157, 159, 163], [240, 157, 159, 164], [240, 157, 159, 165], [240, 157, 159, 166], [240, 157, 159, 167], [240, 157, 159, 168], [240, 157, 159, 169], [240, 157, 159, 170], [240, 157, 159, 171], [240, 157, 159, 172], [240, 157, 159, 173], [240, 157, 159, 174], [240, 157, 159, 175], [240, 157, 159, 176], [240, 157, 159, 177], [240, 157, 159, 178], [240, 157, 159, 179], [240, 157, 159, 180], [240, 157, 159, 181], [240, 157, 159, 182], [240, 157, 159, 183], [240, 157, 159, 184], [240, 157, 159, 185], [240, 157, 159, 186], [240, 157, 159, 187], [240, 157, 159, 188], [240, 157, 159, 189], [240, 157, 159, 190], [240, 157, 159, 191], [240, 158, 163, 135], [240, 158, 163, 136], [240, 158, 163, 137], [240, 158, 163, 138], [240, 158, 163, 139], [240, 158, 163, 140], [240, 158, 163, 141], [240, 158, 163, 142], [240, 158, 163, 143], [240, 159, 132, 128], [240, 159, 132, 129], [240, 159, 132, 130], [240, 159, 132, 131], [240, 159, 132, 132], [240, 159, 132, 133], [240, 159, 132, 134], [240, 159, 132, 135], [240, 159, 132, 136], [240, 159, 132, 137], [240, 159, 132, 138], [240, 159, 132, 139], [240, 159, 132, 140]]
class LazyDict(dict): def __init__(self, load_func, *args, **kwargs): self._load_func = load_func self._args = args self._kwargs = kwargs self._loaded = False super().__init__() def load(self): if not self._loaded: self.update(self._load_func(*self._args, **self._kwargs)) self._loaded = True # Clear these out so pickling always works (pickling a func can fail) self._load_func = None self._args = None self._kwargs = None def __getitem__(self, item): try: return super().__getitem__(item) except KeyError: self.load() return super().__getitem__(item) def __contains__(self, item): self.load() return super().__contains__(item) def keys(self): self.load() return super().keys() def values(self): self.load() return super().values() def items(self): self.load() return super().items() def __len__(self): self.load() return super().__len__() def get(self, key, default=None): self.load() return super().get(key, default)
class Lazydict(dict): def __init__(self, load_func, *args, **kwargs): self._load_func = load_func self._args = args self._kwargs = kwargs self._loaded = False super().__init__() def load(self): if not self._loaded: self.update(self._load_func(*self._args, **self._kwargs)) self._loaded = True self._load_func = None self._args = None self._kwargs = None def __getitem__(self, item): try: return super().__getitem__(item) except KeyError: self.load() return super().__getitem__(item) def __contains__(self, item): self.load() return super().__contains__(item) def keys(self): self.load() return super().keys() def values(self): self.load() return super().values() def items(self): self.load() return super().items() def __len__(self): self.load() return super().__len__() def get(self, key, default=None): self.load() return super().get(key, default)
def gcd(a, b): i = min(a, b) while i>0: if (a%i) == 0 and (b%i) == 0: return i else: i = i-1 def p(s): print(s) if __name__ == "__main__": p("input a:") a = int(input()) p("input b:") b = int(input()) p("gcd of "+str(a)+" and "+str(b)+" is:") print(gcd(a, b))
def gcd(a, b): i = min(a, b) while i > 0: if a % i == 0 and b % i == 0: return i else: i = i - 1 def p(s): print(s) if __name__ == '__main__': p('input a:') a = int(input()) p('input b:') b = int(input()) p('gcd of ' + str(a) + ' and ' + str(b) + ' is:') print(gcd(a, b))
class Solution: def sortedSquares(self, A: List[int]) -> List[int]: if A[0] >= 0 and A[-1] >= 0: return [a ** 2 for a in A] if A[0] <= 0 and A[-1] <= 0: return [a ** 2 for a in A][::-1] i = 0 while i < len(A) - 1 and A[i] < 0 and A[i + 1] < 0: i += 1 left, right = i, i + 1 ans = [] while left >= 0 and right < len(A): if -A[left] <= A[right]: ans.append(A[left] ** 2) left -= 1 else: ans.append(A[right] ** 2) right += 1 if left != -1: ans.extend([A[i] ** 2 for i in range(left, -1, -1)]) else: ans.extend([A[i] ** 2 for i in range(right, len(A))]) return ans
class Solution: def sorted_squares(self, A: List[int]) -> List[int]: if A[0] >= 0 and A[-1] >= 0: return [a ** 2 for a in A] if A[0] <= 0 and A[-1] <= 0: return [a ** 2 for a in A][::-1] i = 0 while i < len(A) - 1 and A[i] < 0 and (A[i + 1] < 0): i += 1 (left, right) = (i, i + 1) ans = [] while left >= 0 and right < len(A): if -A[left] <= A[right]: ans.append(A[left] ** 2) left -= 1 else: ans.append(A[right] ** 2) right += 1 if left != -1: ans.extend([A[i] ** 2 for i in range(left, -1, -1)]) else: ans.extend([A[i] ** 2 for i in range(right, len(A))]) return ans
# pylint: disable=missing-docstring,invalid-name,too-few-public-methods class A: myfield: int class B(A): pass class C: pass class D(C, B): pass a = A() print(a.myfield) b = B() print(b.myfield) d = D() print(d.myfield) c = C() print(c.myfield) # [no-member]
class A: myfield: int class B(A): pass class C: pass class D(C, B): pass a = a() print(a.myfield) b = b() print(b.myfield) d = d() print(d.myfield) c = c() print(c.myfield)
''' The goal of binary search is to search whether a given number is present in the string or not. ''' lst = [1,3,2,4,5,6,9,8,7,10] lst.sort() first=0 last=len(lst)-1 mid = (first+last)//2 item = int(input("enter the number to be search")) found = False while( first<=last and not found): mid = (first + last)//2 if lst[mid] == item : print(f"found at location {mid}") found= True else: if item < lst[mid]: last = mid - 1 else: first = mid + 1 if found == False: print("Number not found")
""" The goal of binary search is to search whether a given number is present in the string or not. """ lst = [1, 3, 2, 4, 5, 6, 9, 8, 7, 10] lst.sort() first = 0 last = len(lst) - 1 mid = (first + last) // 2 item = int(input('enter the number to be search')) found = False while first <= last and (not found): mid = (first + last) // 2 if lst[mid] == item: print(f'found at location {mid}') found = True elif item < lst[mid]: last = mid - 1 else: first = mid + 1 if found == False: print('Number not found')
# SAME BSTS # O(N^2) time and space def sameBsts(arrayOne, arrayTwo): # Write your code here. if len(arrayOne) != len(arrayTwo): return False if len(arrayOne) == 0: return True if arrayOne[0] != arrayTwo[0]: return False leftSubtreeFirst = [num for num in arrayOne[1:] if num < arrayOne[0]] rightSubtreeFirst = [num for num in arrayOne[1:] if num >= arrayOne[0]] leftSubtreeSecond = [num for num in arrayTwo[1:] if num < arrayTwo[0]] rightSubtreeSecond = [num for num in arrayTwo[1:] if num >= arrayTwo[0]] return sameBsts(leftSubtreeFirst, leftSubtreeSecond) and sameBsts(rightSubtreeFirst, rightSubtreeSecond) # O(N^2) time and O(d) space def sameBsts(arrayOne, arrayTwo): # Write your code here. return areSameBsts(arrayOne, arrayTwo, 0, 0, float('-inf'), float('inf')) def areSameBsts(arrayOne, arrayTwo, rootIdxOne, rootIdxTwo, minVal, maxVal): if rootIdxOne == -1 or rootIdxTwo == -1: return rootIdxOne == rootIdxTwo if arrayOne[rootIdxOne] != arrayTwo[rootIdxTwo]: return False leftRootIdxOne = getIdxOfFirstSmaller(arrayOne, rootIdxOne, minVal) leftRootIdxTwo = getIdxOfFirstSmaller(arrayTwo, rootIdxTwo, minVal) rightRootIdxOne = getIdxOfFirstBiggerOrEqual(arrayOne, rootIdxOne, maxVal) rightRootIdxTwo = getIdxOfFirstBiggerOrEqual(arrayTwo, rootIdxTwo, maxVal) currentValue = arrayOne[rootIdxOne] leftAreSame = areSameBsts(arrayOne, arrayTwo, leftRootIdxOne, leftRootIdxTwo, minVal, currentValue) rightAreSame = areSameBsts(arrayOne, arrayTwo, rightRootIdxOne, rightRootIdxTwo, currentValue, maxVal) return leftAreSame and rightAreSame def getIdxOfFirstSmaller(array, startingIdx, minVal): for i in range(startingIdx + 1, len(array)): if array[i] < array[startingIdx] and array[i] >= minVal: return i return -1 def getIdxOfFirstBiggerOrEqual(array, startingIdx, maxVal): for i in range(startingIdx + 1, len(array)): if array[i] >= array[startingIdx] and array[i] < maxVal: return i return -1
def same_bsts(arrayOne, arrayTwo): if len(arrayOne) != len(arrayTwo): return False if len(arrayOne) == 0: return True if arrayOne[0] != arrayTwo[0]: return False left_subtree_first = [num for num in arrayOne[1:] if num < arrayOne[0]] right_subtree_first = [num for num in arrayOne[1:] if num >= arrayOne[0]] left_subtree_second = [num for num in arrayTwo[1:] if num < arrayTwo[0]] right_subtree_second = [num for num in arrayTwo[1:] if num >= arrayTwo[0]] return same_bsts(leftSubtreeFirst, leftSubtreeSecond) and same_bsts(rightSubtreeFirst, rightSubtreeSecond) def same_bsts(arrayOne, arrayTwo): return are_same_bsts(arrayOne, arrayTwo, 0, 0, float('-inf'), float('inf')) def are_same_bsts(arrayOne, arrayTwo, rootIdxOne, rootIdxTwo, minVal, maxVal): if rootIdxOne == -1 or rootIdxTwo == -1: return rootIdxOne == rootIdxTwo if arrayOne[rootIdxOne] != arrayTwo[rootIdxTwo]: return False left_root_idx_one = get_idx_of_first_smaller(arrayOne, rootIdxOne, minVal) left_root_idx_two = get_idx_of_first_smaller(arrayTwo, rootIdxTwo, minVal) right_root_idx_one = get_idx_of_first_bigger_or_equal(arrayOne, rootIdxOne, maxVal) right_root_idx_two = get_idx_of_first_bigger_or_equal(arrayTwo, rootIdxTwo, maxVal) current_value = arrayOne[rootIdxOne] left_are_same = are_same_bsts(arrayOne, arrayTwo, leftRootIdxOne, leftRootIdxTwo, minVal, currentValue) right_are_same = are_same_bsts(arrayOne, arrayTwo, rightRootIdxOne, rightRootIdxTwo, currentValue, maxVal) return leftAreSame and rightAreSame def get_idx_of_first_smaller(array, startingIdx, minVal): for i in range(startingIdx + 1, len(array)): if array[i] < array[startingIdx] and array[i] >= minVal: return i return -1 def get_idx_of_first_bigger_or_equal(array, startingIdx, maxVal): for i in range(startingIdx + 1, len(array)): if array[i] >= array[startingIdx] and array[i] < maxVal: return i return -1
def getNextGreaterElement(array: list) -> None: if len(array) <= 0: return print(bruteForce(array)) print(optimizationUsingSpace(array)) # bruteforce def bruteForce(array: list) -> list: ''' time complexicity: O(n^2) space complexicity: O(1) ''' greater_element_list = [-1] * len(array) for index, element in enumerate(array): for next_element in array[index+1:]: if next_element > element: greater_element_list[index] = next_element break return greater_element_list # optimized using space def optimizationUsingSpace(array: list) -> list: ''' time complexicity: O(n) space complexicity: O(n) ''' greater_element_stack: list = [] next_greater_element_list: list = [-1] * len(array) top = -1 # iterate array from end for index in range(len(array)-1, -1, -1): # pop smaller elements while greater_element_stack and array[index] >= greater_element_stack[top]: greater_element_stack.pop() if greater_element_stack: next_greater_element_list[index] = greater_element_stack[top] greater_element_stack.append(array[index]) return next_greater_element_list if __name__ == '__main__': arr1 = [4,5,2,25] arr2 = [6,8,0,1,3] getNextGreaterElement(arr1) getNextGreaterElement(arr2)
def get_next_greater_element(array: list) -> None: if len(array) <= 0: return print(brute_force(array)) print(optimization_using_space(array)) def brute_force(array: list) -> list: """ time complexicity: O(n^2) space complexicity: O(1) """ greater_element_list = [-1] * len(array) for (index, element) in enumerate(array): for next_element in array[index + 1:]: if next_element > element: greater_element_list[index] = next_element break return greater_element_list def optimization_using_space(array: list) -> list: """ time complexicity: O(n) space complexicity: O(n) """ greater_element_stack: list = [] next_greater_element_list: list = [-1] * len(array) top = -1 for index in range(len(array) - 1, -1, -1): while greater_element_stack and array[index] >= greater_element_stack[top]: greater_element_stack.pop() if greater_element_stack: next_greater_element_list[index] = greater_element_stack[top] greater_element_stack.append(array[index]) return next_greater_element_list if __name__ == '__main__': arr1 = [4, 5, 2, 25] arr2 = [6, 8, 0, 1, 3] get_next_greater_element(arr1) get_next_greater_element(arr2)
#remove duplicates from an unsorted linked list def foo(linkedlist): current_node = linkedlist.head while current_node is not None: checker_node = current_node while checker_node.next is not None: if checker_node.next.value == current_node.value: checker_node.next = checker_node.next.next else: checker_node = checker_node.next current_node = current_node.next
def foo(linkedlist): current_node = linkedlist.head while current_node is not None: checker_node = current_node while checker_node.next is not None: if checker_node.next.value == current_node.value: checker_node.next = checker_node.next.next else: checker_node = checker_node.next current_node = current_node.next
description = 'Verify the user can add an element to a page and save it successfully' pages = ['common', 'index', 'project_pages', 'page_builder'] def setup(data): common.access_golem(data.env.url, data.env.admin) index.create_access_project('test') common.navigate_menu('Pages') project_pages.create_access_random_page() def test(data): store('element_def', ['some_element', 'id', 'selector_value', 'display_name']) page_builder.add_element(data.element_def) wait(1) page_builder.save_page() refresh_page() page_builder.verify_element_exists(data.element_def)
description = 'Verify the user can add an element to a page and save it successfully' pages = ['common', 'index', 'project_pages', 'page_builder'] def setup(data): common.access_golem(data.env.url, data.env.admin) index.create_access_project('test') common.navigate_menu('Pages') project_pages.create_access_random_page() def test(data): store('element_def', ['some_element', 'id', 'selector_value', 'display_name']) page_builder.add_element(data.element_def) wait(1) page_builder.save_page() refresh_page() page_builder.verify_element_exists(data.element_def)
## # A collection of functions to search in lists. # ## # Returns the minimum element in a list of integers def maximum_in_list(list): # Your task: # - Check if this function works for all possible integers. # - Throw a ValueError if the input list is empty (see code below) # if not list: # raise ValueError('List may not be empty') max_element = 0 # we loop trough the list and look at each element for element in list: if element > max_element: max_element = element return max_element
def maximum_in_list(list): max_element = 0 for element in list: if element > max_element: max_element = element return max_element
def set_fill_color(red, green, blue): pass def draw_rectangle(corner, other_corner): pass set_fill_color(red=161, green=219, blue=114) draw_rectangle(corner=(105,20), other_corner=(60,60))
def set_fill_color(red, green, blue): pass def draw_rectangle(corner, other_corner): pass set_fill_color(red=161, green=219, blue=114) draw_rectangle(corner=(105, 20), other_corner=(60, 60))
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") def anchore_extra_deps(configure_go=True): if configure_go: go_rules_dependencies() go_register_toolchains(version = "1.17.1")
load('@io_bazel_rules_go//go:deps.bzl', 'go_register_toolchains', 'go_rules_dependencies') def anchore_extra_deps(configure_go=True): if configure_go: go_rules_dependencies() go_register_toolchains(version='1.17.1')
def checkprime(value: int): factor = 2 sqrt = value ** 0.5 while factor <= sqrt: if value % factor == 0: return False factor += 1 return True def sum_primes_under(n: int): num = 2 sum = 0 while num < n: if checkprime(num): sum += num num += 1 return(sum) if __name__ == "__main__": print(sum_primes_under(10))
def checkprime(value: int): factor = 2 sqrt = value ** 0.5 while factor <= sqrt: if value % factor == 0: return False factor += 1 return True def sum_primes_under(n: int): num = 2 sum = 0 while num < n: if checkprime(num): sum += num num += 1 return sum if __name__ == '__main__': print(sum_primes_under(10))
month = input() days = int(input()) cost_a = 0 cost_s = 0 if month == "May" or month == "October": cost_a = days * 65 cost_s = days * 50 if 7 < days <= 14: cost_s = cost_s * 0.95 if days > 14: cost_s = cost_s * 0.7 elif month == "June" or month == "September": cost_a = days * 68.70 cost_s = days * 75.20 if days > 14: cost_s = cost_s * 0.8 elif month == "July" or month == "August": cost_a = days * 77 cost_s = days * 76 if days > 14: cost_a = cost_a * 0.9 print(f"Apartment: {cost_a:.2f} lv.") print(f"Studio: {cost_s:.2f} lv.")
month = input() days = int(input()) cost_a = 0 cost_s = 0 if month == 'May' or month == 'October': cost_a = days * 65 cost_s = days * 50 if 7 < days <= 14: cost_s = cost_s * 0.95 if days > 14: cost_s = cost_s * 0.7 elif month == 'June' or month == 'September': cost_a = days * 68.7 cost_s = days * 75.2 if days > 14: cost_s = cost_s * 0.8 elif month == 'July' or month == 'August': cost_a = days * 77 cost_s = days * 76 if days > 14: cost_a = cost_a * 0.9 print(f'Apartment: {cost_a:.2f} lv.') print(f'Studio: {cost_s:.2f} lv.')
## creat fct def raise_to_power(base_num, pow_num): ## fct take 2 input num result = 1 ## def var call result is going to store result for index in range(pow_num): ## specify for loop that loop through range of num result = result * base_num ## math is going to be store in result return result print(raise_to_power(2,3))
def raise_to_power(base_num, pow_num): result = 1 for index in range(pow_num): result = result * base_num return result print(raise_to_power(2, 3))
CENSUS_YEAR = 2017 COMSCORE_YEAR = 2017 N_PANELS = 500 N_CORES = 8 # income mapping for aggregating ComScore data to fewer # categories so stratification creates larger panels INCOME_MAPPING = { # 1 is 0 to 25k # 2 is 25k to 50k # 3 is 50k to 100k # 4 is 100k + 1: 1, # less than 10k and 10k-15k 2: 1, # 15-25k 3: 2, # 25-35k 4: 2, # 35-50k 5: 3, # 50-75k 6: 3, # 75-100k 7: 4, # 100k+ }
census_year = 2017 comscore_year = 2017 n_panels = 500 n_cores = 8 income_mapping = {1: 1, 2: 1, 3: 2, 4: 2, 5: 3, 6: 3, 7: 4}
def maximo(a, b, c): if a > b and a > c: return a elif b > c and b > a: return b elif c > a and c > b: return c elif a == b == c: return a
def maximo(a, b, c): if a > b and a > c: return a elif b > c and b > a: return b elif c > a and c > b: return c elif a == b == c: return a
#A loop statement allows us to execute a statement or group of statements multiple times. def main(): var = 0 # define a while loop while (var < 5): print (var) var = var + 1 # define a for loop for var in range(5,10): print (var) # use a for loop over a collection days = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"] for d in days: print (d) # use the break and continue statements for var in range(5,10): #if (x == 7): break #if (x % 2 == 0): continue print (var) #using the enumerate() function to get index days = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"] for i, d in enumerate(days): print (i, d) if __name__ == "__main__": main()
def main(): var = 0 while var < 5: print(var) var = var + 1 for var in range(5, 10): print(var) days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] for d in days: print(d) for var in range(5, 10): print(var) days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] for (i, d) in enumerate(days): print(i, d) if __name__ == '__main__': main()
KERNAL_FILENAME = "kernel" INITRD_FILENAME = "initrd" DISK_FILENAME = "disk.img" BOOT_DISK_FILENAME = "boot.img" CLOUDINIT_ISO_NAME = "cloudinit.img"
kernal_filename = 'kernel' initrd_filename = 'initrd' disk_filename = 'disk.img' boot_disk_filename = 'boot.img' cloudinit_iso_name = 'cloudinit.img'
# import math # def longest_palindromic_contiguous(contiguous_substring): # start_ptr = 0 # end_ptr = 0 # for i in range(len(contiguous_substring)): # len_1 = expand_from_center(contiguous_substring, i, i) # len_2 = expand_from_center(contiguous_substring, i, i + 1) # max_len = max(len_1, len_2) # if max_len > (end_ptr - start_ptr): # start_ptr = i - math.floor((max_len - 1) / 2) # end_ptr = i + math.floor((max_len / 2)) # return contiguous_substring.replace(contiguous_substring[start_ptr:end_ptr + 1], "") # def expand_from_center(string_s, left_ptr, right_ptr): # if (not string_s or left_ptr > right_ptr): # return 0 # while (left_ptr >= 0 and right_ptr < len(string_s) and string_s[left_ptr] == string_s[right_ptr]): # left_ptr -= 1 # right_ptr += 1 # return right_ptr - left_ptr - 1 # num_gemstones = int(input()) # gemstones_colors = "".join([str(color) for color in input().split(" ")]) # min_seconds = 0 # while gemstones_colors: # print(gemstones_colors) # gemstones_colors = longest_palindromic_contiguous(gemstones_colors) # min_seconds += 1 num_gemstones = int(input()) #print("num_gemstones: {}".format(num_gemstones)) gemstones_colors = "".join([str(color) for color in input().split(" ")]) #print("string_length: {}".format(len(gemstones_colors))) # num_seconds = [[]] * (num_gemstones + 1) # print(num_seconds) # for idx_i in range(num_gemstones + 1): # for idx_j in range(num_gemstones + 1): # print(num_seconds[idx_i]) # num_seconds[idx_i].append(0) num_seconds = [[0 for x in range(num_gemstones + 1)] for y in range(num_gemstones + 1)] #print(num_seconds[0]) for length in range(1, num_gemstones + 1): idx_i = 0 idx_j = length - 1 while idx_j < num_gemstones: if length == 1: num_seconds[idx_i][idx_j] = 1 idx_i += 1 idx_j += 1 continue new = num_seconds[idx_i][idx_j] = 1 + num_seconds[idx_i + 1][idx_j] if (gemstones_colors[idx_i] == gemstones_colors[idx_i + 1]): num_seconds[idx_i][idx_j] = min(1 + num_seconds[idx_i + 2][idx_j], num_seconds[idx_i][idx_j]) num_seconds[idx_i][idx_j] = min(new, num_seconds[idx_i][idx_j]) first_occurrence = idx_i + 2 while first_occurrence <= idx_j: if (gemstones_colors[idx_i] == gemstones_colors[first_occurrence]): new = num_seconds[idx_i + 1][first_occurrence - 1] + num_seconds[first_occurrence + 1][idx_j] num_seconds[idx_i][idx_j] = min(new, num_seconds[idx_i][idx_j]) first_occurrence += 1 idx_i += 1 idx_j += 1 #print(num_seconds) #print(num_seconds[0]) min_seconds = num_seconds[0][num_gemstones - 1] print(min_seconds)
num_gemstones = int(input()) gemstones_colors = ''.join([str(color) for color in input().split(' ')]) num_seconds = [[0 for x in range(num_gemstones + 1)] for y in range(num_gemstones + 1)] for length in range(1, num_gemstones + 1): idx_i = 0 idx_j = length - 1 while idx_j < num_gemstones: if length == 1: num_seconds[idx_i][idx_j] = 1 idx_i += 1 idx_j += 1 continue new = num_seconds[idx_i][idx_j] = 1 + num_seconds[idx_i + 1][idx_j] if gemstones_colors[idx_i] == gemstones_colors[idx_i + 1]: num_seconds[idx_i][idx_j] = min(1 + num_seconds[idx_i + 2][idx_j], num_seconds[idx_i][idx_j]) num_seconds[idx_i][idx_j] = min(new, num_seconds[idx_i][idx_j]) first_occurrence = idx_i + 2 while first_occurrence <= idx_j: if gemstones_colors[idx_i] == gemstones_colors[first_occurrence]: new = num_seconds[idx_i + 1][first_occurrence - 1] + num_seconds[first_occurrence + 1][idx_j] num_seconds[idx_i][idx_j] = min(new, num_seconds[idx_i][idx_j]) first_occurrence += 1 idx_i += 1 idx_j += 1 min_seconds = num_seconds[0][num_gemstones - 1] print(min_seconds)
# unselectGlyphsWithExtension.py f = CurrentFont() for gname in f.selection: if '.' in gname: f[gname].selected = 0
f = current_font() for gname in f.selection: if '.' in gname: f[gname].selected = 0
# Problem: https://www.hackerrank.com/challenges/s10-weighted-mean/problem # Score: 30 n = int(input()) arr = list(map(int, input().split())) weights = list(map(int, input().split())) print(round(sum([arr[x]*weights[x] for x in range(len(arr))]) / sum(weights), 1))
n = int(input()) arr = list(map(int, input().split())) weights = list(map(int, input().split())) print(round(sum([arr[x] * weights[x] for x in range(len(arr))]) / sum(weights), 1))
a = float(raw_input("What is the coefficients a? ")) b = float(raw_input("What is the coefficients b? ")) c = float(raw_input("What is the coefficients c? ")) d = b*b - 4.*a*c if d >= 0.0: print("Solutions are real") elif b == 0.0: print("Solutions are imaginary") else: print("Solutions are complex") print("Finished!")
a = float(raw_input('What is the coefficients a? ')) b = float(raw_input('What is the coefficients b? ')) c = float(raw_input('What is the coefficients c? ')) d = b * b - 4.0 * a * c if d >= 0.0: print('Solutions are real') elif b == 0.0: print('Solutions are imaginary') else: print('Solutions are complex') print('Finished!')
def separador(mano): lista_valor = [] lista_suit = [] valor_carta = {'2':1, '3':2, '4':3, '5':4, '6':5, '7':6, '8':7, '9':8, 'T':9, 'J':10, 'Q':11, 'K':12, 'A':13} for i in mano.split(' '): lista_valor.append(valor_carta.get(i[0])) lista_suit.append(i[1]) return(sorted(lista_valor), lista_suit) def Royal_Flush(mano): valores = separador(mano) if sorted(valores[0]) == [9,10,11,12,13]: for i in ('H','S','C','D'): if valores[1].count(i) == 5: return True else: return False return False def Straight_Flush(mano): valores = separador(mano) for i in range(4): if (valores[0][i + 1] - valores[0][i]) != 1: return False for i in ('H','S','C','D'): if valores[1].count(i) == 5: return True return False def Four_of_a_Kind(mano): valores = separador(mano) for i in range(14): if valores[0].count(i) == 4: return True return False def Full_House(mano): valores = separador(mano) for i in range(14): if valores[0].count(i) == 3: for j in range(14): if valores[0].count(j) == 2: return(True, i) return(False, 0) def Flush(mano): valores = separador(mano) for i in ('H','S','C','D'): if valores[1].count(i) == 5: return True return False def Straight(mano): valores = separador(mano) for i in range(4): if (valores[0][i + 1] - valores[0][i]) != 1: return False return True def Three_of_a_Kind(mano): valores = separador(mano) for i in range(14): if valores[0].count(i) == 3: return(True, i) return(False, 0) def Two_Pairs(mano): valores = separador(mano) for i in range(14): if valores[0].count(i) == 2: (valores[0]).remove(i) for j in range(14): if valores[0].count(j) == 2: return True return False def One_Pair(mano): valores = separador(mano) for i in range(14): if valores[0].count(i) == 2: return(True, i) return(False, 0) def Crupier(mano): if Royal_Flush(mano): return(10, 0) elif Straight_Flush(mano): return(9, 0) elif Four_of_a_Kind(mano): return(8, 0) elif Full_House(mano)[0]: return(7, Full_House(mano)[1]) elif Flush(mano): return(6, 0) elif Straight(mano): return(5, 0) elif Three_of_a_Kind(mano)[0]: return(4, Three_of_a_Kind(mano)[1]) elif Two_Pairs(mano): return(3, 0) elif One_Pair(mano)[0]: return(2,One_Pair(mano)[1]) else:#High Card valores = separador(mano) return(1, max(valores[0])) def draw_One_Pair(mano1, mano2): #draw_High_Card, Straight y Flush valores1 = separador(mano1)[0] valores2 = separador(mano2)[0] while True: c1 = max(valores1) c2 = max(valores2) valores1.remove(c1) valores2.remove(c2) if c1 > c2: return(1) elif c1 == c2: pass else: return(2) def draw_Full_House(c1, c2): if c1 > c2: return(1) else: return(2) def mesa(m1, m2): mano1 = Crupier(m1) mano2 = Crupier(m2) if mano1[0] > mano2[0]: return(1) elif mano1[0] < mano2[0]: return(2) else: if mano1[0] in (1, 5, 6): return(draw_One_Pair(m1, m2)) elif mano1[0] == 2: if mano1[1] > mano2[1]: return(1) elif mano1[1] < mano2[1]: return(2) else: return(draw_One_Pair(m1, m2)) elif mano1[0] in (7, 4): if mano1[1] > mano2[1]: return(1) else: return(2) def main(): entrada = open('p054_poker.txt', 'r') #salida = open('output.txt', 'w') T = int(entrada.readline()) total = 0 for i in range(T): xy = entrada.readline() x = xy[0:14] y = xy[15:29] #salida.write("Caso #{}: Jugador {}\n".format(i+1, mesa(x, y))) if mesa(x, y) == 1: total += 1 print(total) entrada.close() #salida.close() main() #376 #[Finished in 0.2s]
def separador(mano): lista_valor = [] lista_suit = [] valor_carta = {'2': 1, '3': 2, '4': 3, '5': 4, '6': 5, '7': 6, '8': 7, '9': 8, 'T': 9, 'J': 10, 'Q': 11, 'K': 12, 'A': 13} for i in mano.split(' '): lista_valor.append(valor_carta.get(i[0])) lista_suit.append(i[1]) return (sorted(lista_valor), lista_suit) def royal__flush(mano): valores = separador(mano) if sorted(valores[0]) == [9, 10, 11, 12, 13]: for i in ('H', 'S', 'C', 'D'): if valores[1].count(i) == 5: return True else: return False return False def straight__flush(mano): valores = separador(mano) for i in range(4): if valores[0][i + 1] - valores[0][i] != 1: return False for i in ('H', 'S', 'C', 'D'): if valores[1].count(i) == 5: return True return False def four_of_a__kind(mano): valores = separador(mano) for i in range(14): if valores[0].count(i) == 4: return True return False def full__house(mano): valores = separador(mano) for i in range(14): if valores[0].count(i) == 3: for j in range(14): if valores[0].count(j) == 2: return (True, i) return (False, 0) def flush(mano): valores = separador(mano) for i in ('H', 'S', 'C', 'D'): if valores[1].count(i) == 5: return True return False def straight(mano): valores = separador(mano) for i in range(4): if valores[0][i + 1] - valores[0][i] != 1: return False return True def three_of_a__kind(mano): valores = separador(mano) for i in range(14): if valores[0].count(i) == 3: return (True, i) return (False, 0) def two__pairs(mano): valores = separador(mano) for i in range(14): if valores[0].count(i) == 2: valores[0].remove(i) for j in range(14): if valores[0].count(j) == 2: return True return False def one__pair(mano): valores = separador(mano) for i in range(14): if valores[0].count(i) == 2: return (True, i) return (False, 0) def crupier(mano): if royal__flush(mano): return (10, 0) elif straight__flush(mano): return (9, 0) elif four_of_a__kind(mano): return (8, 0) elif full__house(mano)[0]: return (7, full__house(mano)[1]) elif flush(mano): return (6, 0) elif straight(mano): return (5, 0) elif three_of_a__kind(mano)[0]: return (4, three_of_a__kind(mano)[1]) elif two__pairs(mano): return (3, 0) elif one__pair(mano)[0]: return (2, one__pair(mano)[1]) else: valores = separador(mano) return (1, max(valores[0])) def draw__one__pair(mano1, mano2): valores1 = separador(mano1)[0] valores2 = separador(mano2)[0] while True: c1 = max(valores1) c2 = max(valores2) valores1.remove(c1) valores2.remove(c2) if c1 > c2: return 1 elif c1 == c2: pass else: return 2 def draw__full__house(c1, c2): if c1 > c2: return 1 else: return 2 def mesa(m1, m2): mano1 = crupier(m1) mano2 = crupier(m2) if mano1[0] > mano2[0]: return 1 elif mano1[0] < mano2[0]: return 2 elif mano1[0] in (1, 5, 6): return draw__one__pair(m1, m2) elif mano1[0] == 2: if mano1[1] > mano2[1]: return 1 elif mano1[1] < mano2[1]: return 2 else: return draw__one__pair(m1, m2) elif mano1[0] in (7, 4): if mano1[1] > mano2[1]: return 1 else: return 2 def main(): entrada = open('p054_poker.txt', 'r') t = int(entrada.readline()) total = 0 for i in range(T): xy = entrada.readline() x = xy[0:14] y = xy[15:29] if mesa(x, y) == 1: total += 1 print(total) entrada.close() main()
substring=input() word=input() while substring in word: word=word.replace(substring,"") print(word)
substring = input() word = input() while substring in word: word = word.replace(substring, '') print(word)
# names tuple names = ('Anonymous','Tazri','Focasa','Troy','Farha','Xenon'); print("names : ",names); ## adding value of names updating = list(names); updating.append('solus'); names = tuple(updating); print("update names : "); print(names);
names = ('Anonymous', 'Tazri', 'Focasa', 'Troy', 'Farha', 'Xenon') print('names : ', names) updating = list(names) updating.append('solus') names = tuple(updating) print('update names : ') print(names)
AUTHOR = 'Name Lastname' SITENAME = "The name of your website" SITEURL = 'http://example.com' TIMEZONE = "" DISQUS_SITENAME = '' DEFAULT_DATE_FORMAT = '%d/%m/%Y' REVERSE_ARCHIVE_ORDER = True TAG_CLOUD_STEPS = 8 PATH = '' THEME = '' OUTPUT_PATH = '' MARKUP = 'md' MD_EXTENSIONS = 'extra' FEED_RSS = 'feeds/all.rss.xml' TAG_FEED_RSS = 'feeds/%s.rss.xml' GOOGLE_ANALYTICS = 'UA-XXXXX-X' HTML_LANG = 'es' TWITTER_USERNAME = '' SOCIAL = (('GitHub', 'http://github.com/yourusername'), ('Twitter', 'http://twitter.com/yourusername'),)
author = 'Name Lastname' sitename = 'The name of your website' siteurl = 'http://example.com' timezone = '' disqus_sitename = '' default_date_format = '%d/%m/%Y' reverse_archive_order = True tag_cloud_steps = 8 path = '' theme = '' output_path = '' markup = 'md' md_extensions = 'extra' feed_rss = 'feeds/all.rss.xml' tag_feed_rss = 'feeds/%s.rss.xml' google_analytics = 'UA-XXXXX-X' html_lang = 'es' twitter_username = '' social = (('GitHub', 'http://github.com/yourusername'), ('Twitter', 'http://twitter.com/yourusername'))
instructor = { "name":"Cosmic", "num_courses":'4', "favorite_language" :"Python", "is_hillarious": False, 44 : "is my favorite number" } # Way to check if a key exists in a dict and returns True or False as a response a = "name" in instructor print(a) b = "phone" in instructor print(b) c = instructor.values() print(c) # Direct in goes to find the given stuff in the key of dictionary if you want otherwise then you should go for .values() method defined above.
instructor = {'name': 'Cosmic', 'num_courses': '4', 'favorite_language': 'Python', 'is_hillarious': False, 44: 'is my favorite number'} a = 'name' in instructor print(a) b = 'phone' in instructor print(b) c = instructor.values() print(c)