content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
n = int(input()) data = [] c1, c2 = 0, 0 flag = 0 for i in range(n): val = list(map(int, input().split())) data.append(tuple(val)) c1 += val[0] c2 += val[1] if (c1 % 2) != (c2 % 2): flag = 1 if c1 % 2 == 1 and c2 % 2 == 1 and (c1+c2) % 2 == 0 and n > 1 and flag == 1: print(1) elif c1 % ...
n = int(input()) data = [] (c1, c2) = (0, 0) flag = 0 for i in range(n): val = list(map(int, input().split())) data.append(tuple(val)) c1 += val[0] c2 += val[1] if c1 % 2 != c2 % 2: flag = 1 if c1 % 2 == 1 and c2 % 2 == 1 and ((c1 + c2) % 2 == 0) and (n > 1) and (flag == 1): print(1) eli...
FULL_SCREEN = "FULL_SCREEN" MOVE_UP = "MOVE_UP" MOVE_LEFT = "MOVE_LEFT" MOVE_RIGHT = "MOVE_RIGHT" MOVE_DOWN = "MOVE_DOWN" ATTACK = "ATTACK" INVENTORY = "INVENTORY" MOVEMENT_ACTION = [ MOVE_DOWN, MOVE_UP, MOVE_RIGHT, MOVE_LEFT, ]
full_screen = 'FULL_SCREEN' move_up = 'MOVE_UP' move_left = 'MOVE_LEFT' move_right = 'MOVE_RIGHT' move_down = 'MOVE_DOWN' attack = 'ATTACK' inventory = 'INVENTORY' movement_action = [MOVE_DOWN, MOVE_UP, MOVE_RIGHT, MOVE_LEFT]
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: current_carry = 0 current = ListNode(0) head = current ...
class Solution: def add_two_numbers(self, l1: ListNode, l2: ListNode) -> ListNode: current_carry = 0 current = list_node(0) head = current while l1 or l2 or current_carry: current_val = current_carry current_val += 0 if l1 is None else l1.val curr...
#!/usr/bin/python3 class Node: def __init__(self, data, lchild=None, rchild=None): self.data = data self.lchild = lchild self.rchild = rchild def pre_order(root): if root != None: print(root.data, end=' ') pre_order(root.lchild) pre_order(root.rchild) def in_or...
class Node: def __init__(self, data, lchild=None, rchild=None): self.data = data self.lchild = lchild self.rchild = rchild def pre_order(root): if root != None: print(root.data, end=' ') pre_order(root.lchild) pre_order(root.rchild) def in_order(root): if r...
DEBUG = False SECRET_KEY = b'_5#y2L"F4Q8z\n\xec]/' SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://hlapse:h91040635!@rm-uf6gm31bj3hm81y14to.mysql.rds.aliyuncs.com/rss' + '?charset=utf8mb4' SQLALCHEMY_TRACK_MODIFICATIONS = False # JWT JWT_ERROR_MESSAGE_KEY = "messsage" JWT_ACCESS_TOKEN_EXPIRES = False # APScheduler SCHEDUL...
debug = False secret_key = b'_5#y2L"F4Q8z\n\xec]/' sqlalchemy_database_uri = 'mysql+pymysql://hlapse:h91040635!@rm-uf6gm31bj3hm81y14to.mysql.rds.aliyuncs.com/rss' + '?charset=utf8mb4' sqlalchemy_track_modifications = False jwt_error_message_key = 'messsage' jwt_access_token_expires = False scheduler_api_enabled = True ...
UP = 1 DOWN = 2 FLOOR_COUNT = 6 class ElevatorLogic(object): """ An incorrect implementation. Can you make it pass all the tests? Fix the methods below to implement the correct logic for elevators. The tests are integrated into `README.md`. To run the tests: $ python -m doctest -v README.md To ...
up = 1 down = 2 floor_count = 6 class Elevatorlogic(object): """ An incorrect implementation. Can you make it pass all the tests? Fix the methods below to implement the correct logic for elevators. The tests are integrated into `README.md`. To run the tests: $ python -m doctest -v README.md To ...
ROTATED_PROXY_ENABLED = True PROXY_STORAGE = 'scrapy_rotated_proxy.extensions.file_storage.FileProxyStorage' PROXY_FILE_PATH = '' # PROXY_STORAGE = 'scrapy_rotated_proxy.extensions.mongodb_storage.MongoDBProxyStorage' PROXY_MONGODB_HOST = '127.0.0.1' PROXY_MONGODB_PORT = 27017 PROXY_MONGODB_USERNAME = None PROXY_MONGOD...
rotated_proxy_enabled = True proxy_storage = 'scrapy_rotated_proxy.extensions.file_storage.FileProxyStorage' proxy_file_path = '' proxy_mongodb_host = '127.0.0.1' proxy_mongodb_port = 27017 proxy_mongodb_username = None proxy_mongodb_password = None proxy_mongodb_auth_db = 'admin' proxy_mongodb_db = 'proxy_management' ...
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ # { # 'target_name': 'cast_extension_discoverer', # 'includes': ['../../../compile_js2.gypi'], # }, # { # 'target_nam...
{'targets': []}
"""Constants for the babydriver CAN protocol.""" # pylint: disable=too-few-public-methods # Both the C and Python babydriver projects use 15 as the device ID, see can_msg_defs.h. BABYDRIVER_DEVICE_ID = 15 # The babydriver CAN message has ID 63, see can_msg_defs.h. BABYDRIVER_CAN_MESSAGE_ID = 63 class BabydriverMess...
"""Constants for the babydriver CAN protocol.""" babydriver_device_id = 15 babydriver_can_message_id = 63 class Babydrivermessageid: """ An enumeration of babydriver IDs, which go in the first uint8 in a babydriver CAN message. This is the Python equivalent of the enum of the same name in babydriver_msg_d...
def iscomplex(a): # TODO(beam2d): Implement it raise NotImplementedError def iscomplexobj(x): # TODO(beam2d): Implement it raise NotImplementedError def isfortran(a): # TODO(beam2d): Implement it raise NotImplementedError def isreal(x): # TODO(beam2d): Implement it raise NotImpleme...
def iscomplex(a): raise NotImplementedError def iscomplexobj(x): raise NotImplementedError def isfortran(a): raise NotImplementedError def isreal(x): raise NotImplementedError def isrealobj(x): raise NotImplementedError
N, K = map(int, input().split()) S = list(input()) S[K-1] = S[K-1].swapcase() print("".join(S))
(n, k) = map(int, input().split()) s = list(input()) S[K - 1] = S[K - 1].swapcase() print(''.join(S))
full_submit = { 'processes' : [ { 'name': 'mkdir', 'cmd': 'mkdir -p /mnt/mesos/sandbox/sandbox/__jobio/input /mnt/mesos/sandbox/sandbox/__jobio/output' }, { 'name': 'symlink_in', 'cmd': 'ln -s /mnt/mesos/sandbox/sandbox/__jobio/input /job/input' }, { 'name': 'symlink_out', 'cmd': 'ln -s /mnt/mesos/sandbox/...
full_submit = {'processes': [{'name': 'mkdir', 'cmd': 'mkdir -p /mnt/mesos/sandbox/sandbox/__jobio/input /mnt/mesos/sandbox/sandbox/__jobio/output'}, {'name': 'symlink_in', 'cmd': 'ln -s /mnt/mesos/sandbox/sandbox/__jobio/input /job/input'}, {'name': 'symlink_out', 'cmd': 'ln -s /mnt/mesos/sandbox/sandbox/__jobio/outpu...
"""Make Collatz Sequence This program makes a `Collatz Sequence`_ for a given number. Write a function named :meth:`collatz` that has one parameter named number. If number is even, then :meth:`collatz` should print `number // 2` and return this value. If number is odd, then :meth:`collatz` should print and return `3 ...
"""Make Collatz Sequence This program makes a `Collatz Sequence`_ for a given number. Write a function named :meth:`collatz` that has one parameter named number. If number is even, then :meth:`collatz` should print `number // 2` and return this value. If number is odd, then :meth:`collatz` should print and return `3 ...
class TreasureMap: def __init__(self): self.map = {} def populate_map(self): self.map['beach'] = 'sandy shore' self.map['coast'] = 'ocean reef' self.map['volcano'] = 'hot lava' self.map['x'] = 'marks the spot' return
class Treasuremap: def __init__(self): self.map = {} def populate_map(self): self.map['beach'] = 'sandy shore' self.map['coast'] = 'ocean reef' self.map['volcano'] = 'hot lava' self.map['x'] = 'marks the spot' return
def sum(n): a = 0 for b in range(1,n+1,4): a+=b*b # b ** 2 return a n = int(input('n=')) print(sum(n))
def sum(n): a = 0 for b in range(1, n + 1, 4): a += b * b return a n = int(input('n=')) print(sum(n))
# %% """ # Exception handling """ # %% """ Exception handling allows a program to deal with runtime errors and continue its normal execution. Consider the following instructions: """ # %% a=input("Enter integer: ") num=int(a) inverse=1/num print(number,inverse) # %% """ What happens if the user enters a null or non...
""" # Exception handling """ '\nException handling allows a program to deal with runtime errors and continue its normal execution.\nConsider the following instructions:\n\n' a = input('Enter integer: ') num = int(a) inverse = 1 / num print(number, inverse) '\nWhat happens if the user enters a null or non-numeric value?...
#------------------------------------------------------------------------------ # interpreter/interpreter.py # Copyright 2011 Joseph Schilz # Licensed under Apache v2 #------------------------------------------------------------------------------ articles = [" a ", " the "] def verb(command): # A function ...
articles = [' a ', ' the '] def verb(command): this_verb = '' the_rest = '' first_space = command.find(' ') if first_space > 0: this_verb = command[0:first_space] the_rest = command[first_space + 1:len(command)] else: this_verb = command if command[0] == "'": thi...
URLs = [ ["https://www.oryxspioenkop.com/2022/02/attack-on-europe-documenting-equipment.html", True], # Current version ["https://web.archive.org/web/20220413213804/https://www.oryxspioenkop.com/2022/02/attack-on-europe-documenting-equipment.html", True], # Apr 13 - 21:38:04 UTC ["https://web.archive.org/we...
ur_ls = [['https://www.oryxspioenkop.com/2022/02/attack-on-europe-documenting-equipment.html', True], ['https://web.archive.org/web/20220413213804/https://www.oryxspioenkop.com/2022/02/attack-on-europe-documenting-equipment.html', True], ['https://web.archive.org/web/20220412213745/https://www.oryxspioenkop.com/2022/02...
#Enquiry Form name=input('Enter your First Name ') Class=int(input('Enter your class ')) school=input('Enter your school name ') address=input('Enter your Address ') number=int(input('Enter your phone number ')) #print("Name- ",name,"Class- ",Class,"School- ",school,"Address- ",address,"Phone Number- ",number,sep='\n')...
name = input('Enter your First Name ') class = int(input('Enter your class ')) school = input('Enter your school name ') address = input('Enter your Address ') number = int(input('Enter your phone number ')) print('Name- ', name) print('Class- ', Class) print('School- ', school) print('Address- ', address) print('Phone...
'''ftoc.py - Fahrenheit to Celsius temperature converter''' def f_to_c(f): c = (f - 32) * (5/9) return c def input_float(prompt): ans = input(prompt) return float(ans) f = input_float("What is the temperature (in degrees Fahrenheit)? ") c = f_to_c(f) print("That is", round(c, 1), "degrees Celsius")
"""ftoc.py - Fahrenheit to Celsius temperature converter""" def f_to_c(f): c = (f - 32) * (5 / 9) return c def input_float(prompt): ans = input(prompt) return float(ans) f = input_float('What is the temperature (in degrees Fahrenheit)? ') c = f_to_c(f) print('That is', round(c, 1), 'degrees Celsius')
class Solution: # Sort (Accepted), O(n log n) time, O(n) space def maxProductDifference(self, nums: List[int]) -> int: nums.sort() return (nums[-1] * nums[-2]) - (nums[0] * nums[1]) # One Pass (Top Voted), O(n) time, O(1) space def maxProductDifference(self, nums: List[int]) -> int: ...
class Solution: def max_product_difference(self, nums: List[int]) -> int: nums.sort() return nums[-1] * nums[-2] - nums[0] * nums[1] def max_product_difference(self, nums: List[int]) -> int: min1 = min2 = float('inf') max1 = max2 = float('-inf') for n in nums: ...
nota = float(input('Digite sua nota, Valor entre "0 e 10": ')) while True: if nota >= 8.5 and nota <= 10: print('Nota igual a A') elif nota >= 7.0 and nota <= 8.4: print('Nota igual a B') elif nota >= 5.0 and nota <= 6.9: print('Nota igual a C') elif nota >= 4.0 and nota <= 4.9: ...
nota = float(input('Digite sua nota, Valor entre "0 e 10": ')) while True: if nota >= 8.5 and nota <= 10: print('Nota igual a A') elif nota >= 7.0 and nota <= 8.4: print('Nota igual a B') elif nota >= 5.0 and nota <= 6.9: print('Nota igual a C') elif nota >= 4.0 and nota <= 4.9: ...
# Given an array, rotate the array to the right by k steps, where k is # non-negative. # Example 1: # Input: [1,2,3,4,5,6,7] and k = 3 # Output: [5,6,7,1,2,3,4] # Explanation: # rotate 1 steps to the right: [7,1,2,3,4,5,6] # rotate 2 steps to the right: [6,7,1,2,3,4,5] # rotate 3 steps to the right: [5,6,7,1,2,3,4] #...
class Solution: def rotate(self, nums, k): """ :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. """ stack = [] final_arr = [] for i in range(k): stack.append(nums.pop()) for i in...
INVALID_VALUE = -9999 def search_in_dictionary_list(dictionary_list, key_name, key_value): for dictionary in dictionary_list: if dictionary[key_name] == key_value: return dictionary return None def search_value_in_dictionary_list(dictionary_list, key_name, key_value, value_key): dict...
invalid_value = -9999 def search_in_dictionary_list(dictionary_list, key_name, key_value): for dictionary in dictionary_list: if dictionary[key_name] == key_value: return dictionary return None def search_value_in_dictionary_list(dictionary_list, key_name, key_value, value_key): dictio...
expected_output = { "global_drop_stats": { "Ipv4NoAdj": {"octets": 296, "packets": 7}, "Ipv4NoRoute": {"octets": 7964, "packets": 181}, "PuntPerCausePolicerDrops": {"octets": 184230, "packets": 2003}, "UidbNotCfgd": {"octets": 29312827, "packets": 466391}, "UnconfiguredIpv4Fi...
expected_output = {'global_drop_stats': {'Ipv4NoAdj': {'octets': 296, 'packets': 7}, 'Ipv4NoRoute': {'octets': 7964, 'packets': 181}, 'PuntPerCausePolicerDrops': {'octets': 184230, 'packets': 2003}, 'UidbNotCfgd': {'octets': 29312827, 'packets': 466391}, 'UnconfiguredIpv4Fia': {'octets': 360, 'packets': 6}}}
def func(ord_list, num): result = True if num in ord_list else False return result if __name__ == "__main__": l = [-1,3,5,6,8,9] # using binary search def find(ordered_list, element): start_index = 0 end_index = len(ordered_list) - 1 while True: middle_index = int((end_index + start_index) / 2)...
def func(ord_list, num): result = True if num in ord_list else False return result if __name__ == '__main__': l = [-1, 3, 5, 6, 8, 9] def find(ordered_list, element): start_index = 0 end_index = len(ordered_list) - 1 while True: middle_index = int((end_index + start_index) / 2) ...
# 54. Spiral Matrix class Solution: def spiralOrder(self, matrix): if not matrix: return matrix m, n = len(matrix), len(matrix[0]) visited = [[False] * n for _ in range(m)] ans = [] dirs = ((0,1), (1,0), (0,-1), (-1,0)) cur = 0 i = j = 0 ...
class Solution: def spiral_order(self, matrix): if not matrix: return matrix (m, n) = (len(matrix), len(matrix[0])) visited = [[False] * n for _ in range(m)] ans = [] dirs = ((0, 1), (1, 0), (0, -1), (-1, 0)) cur = 0 i = j = 0 while len(an...
class Solution: # @param s, a string # @param wordDict, a set<string> # @return a boolean def wordBreak(self, s, wordDict): n = len(s) if n == 0: return True res = [] chars = ''.join(wordDict) for i in xrange(n): if s[i] not in chars: ...
class Solution: def word_break(self, s, wordDict): n = len(s) if n == 0: return True res = [] chars = ''.join(wordDict) for i in xrange(n): if s[i] not in chars: return False lw = s[-1] lw_end = False for word i...
clan = { } def add_member(tag, name, age, level): clan[tag] = { "Name": name, "age": age, "level": level } return clan def display_clan(): print(clan) add_member("Voodoo", "Andre Williams", 26, "Beginner") display_clan()
clan = {} def add_member(tag, name, age, level): clan[tag] = {'Name': name, 'age': age, 'level': level} return clan def display_clan(): print(clan) add_member('Voodoo', 'Andre Williams', 26, 'Beginner') display_clan()
class CRSError(Exception): pass class DriverError(Exception): pass class TransactionError(RuntimeError): pass class UnsupportedGeometryTypeError(Exception): pass class DriverIOError(IOError): pass
class Crserror(Exception): pass class Drivererror(Exception): pass class Transactionerror(RuntimeError): pass class Unsupportedgeometrytypeerror(Exception): pass class Driverioerror(IOError): pass
# Search Part Problem n = int(input()) part_list = list(map(int, input().split())) m = int(input()) require_list = list(map(int, input().split())) def binary_search(array, target, start, end): mid = (start + end) // 2 if start >= end: return "no" if array[mid] == target: return "yes" ...
n = int(input()) part_list = list(map(int, input().split())) m = int(input()) require_list = list(map(int, input().split())) def binary_search(array, target, start, end): mid = (start + end) // 2 if start >= end: return 'no' if array[mid] == target: return 'yes' if array[mid] > target: ...
time_convert = {"s": 1, "m": 60, "h": 3600, "d": 86400} def convert_time_to_seconds(time): try: return int(time[:-1]) * time_convert[time[-1]] except: raise ValueError
time_convert = {'s': 1, 'm': 60, 'h': 3600, 'd': 86400} def convert_time_to_seconds(time): try: return int(time[:-1]) * time_convert[time[-1]] except: raise ValueError
def loadfile(name): lines = [] f = open(name, "r") for x in f: if x.endswith('\n'): x = x[:-1] lines.append(x.split("-")) return lines def pathFromPosition (position, graph, path, s, e, goingTwice, bt): beenThere = bt.copy() path = path + "-" + position print(pa...
def loadfile(name): lines = [] f = open(name, 'r') for x in f: if x.endswith('\n'): x = x[:-1] lines.append(x.split('-')) return lines def path_from_position(position, graph, path, s, e, goingTwice, bt): been_there = bt.copy() path = path + '-' + position print(p...
def launch(self, Dialog, **kwargs): # This is where the magic happens! # The lx module is persistent so you can store stuff there # and access it in commands. lx._widget = Dialog lx._widgetOptions = kwargs # widgetWrapper creates whatever widget is set via lx._widget above # note we're using launchScript whi...
def launch(self, Dialog, **kwargs): lx._widget = Dialog lx._widgetOptions = kwargs lx.eval('launchWidget') try: return lx._widgetInstance except: return None
test = { 'name': 'q1_2', 'points': 1, 'suites': [ { 'cases': [ {'code': '>>> sum(standard_units(make_array(1,2,3,4,5))) == 0\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> np.isclose(standard_units(make_array(1,2,3,4,5))[0], -1.41421356)\nTrue', 'hidden': Fal...
test = {'name': 'q1_2', 'points': 1, 'suites': [{'cases': [{'code': '>>> sum(standard_units(make_array(1,2,3,4,5))) == 0\nTrue', 'hidden': False, 'locked': False}, {'code': '>>> np.isclose(standard_units(make_array(1,2,3,4,5))[0], -1.41421356)\nTrue', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'te...
x = input() total = 0 while x != "NoMoreMoney": money = float(x) if money > 0: total += money print(f"Increase: {money:.2f}") x = input() elif money < 0: print("Invalid operation!") break print(f"Total: {total:.2f}")
x = input() total = 0 while x != 'NoMoreMoney': money = float(x) if money > 0: total += money print(f'Increase: {money:.2f}') x = input() elif money < 0: print('Invalid operation!') break print(f'Total: {total:.2f}')
#File Locations EXTRACT_LIST_FILE = "ExtractList.xlsx" RAW_DATA_FILE = "../../output/WorldBank/WDIData.csv" OUTPUT_PATH = "../../output/WorldBank/split_output/"
extract_list_file = 'ExtractList.xlsx' raw_data_file = '../../output/WorldBank/WDIData.csv' output_path = '../../output/WorldBank/split_output/'
# https://leetcode.com/problems/lucky-numbers-in-a-matrix def lucky_numbers(matrix): all_lucky_numbers, all_mins = [], [] for row in matrix: found_min, col_index = float('Inf'), -1 for index, column in enumerate(row): if column < found_min: found_min = ...
def lucky_numbers(matrix): (all_lucky_numbers, all_mins) = ([], []) for row in matrix: (found_min, col_index) = (float('Inf'), -1) for (index, column) in enumerate(row): if column < found_min: found_min = column col_index = index all_mins.appen...
[ [float("NaN"), float("NaN"), 66.66666667, 33.33333333, 0.0], [float("NaN"), float("NaN"), 33.33333333, 66.66666667, 66.66666667], [float("NaN"), float("NaN"), 0.0, 0.0, 33.33333333], ]
[[float('NaN'), float('NaN'), 66.66666667, 33.33333333, 0.0], [float('NaN'), float('NaN'), 33.33333333, 66.66666667, 66.66666667], [float('NaN'), float('NaN'), 0.0, 0.0, 33.33333333]]
encrypted_string = 'OMQEMDUEQMEK' for i in range(1,27): temp_str = "" for x in encrypted_string: int_val = ord(x) + i if int_val > 90: # 90 is the numerical value for 'Z' # 65 is the numerical value for 'A' # If int_val is greater than Z then # t...
encrypted_string = 'OMQEMDUEQMEK' for i in range(1, 27): temp_str = '' for x in encrypted_string: int_val = ord(x) + i if int_val > 90: int_val = 64 + (int_val - 90) temp_str += chr(int_val) print(f'{i} {temp_str}')
""" Contains methods for easily persisting `Pydantic <https://pydantic-docs.helpmanual.io/>`_ data structures to and from arbitrary storage back-ends. Contains a base class for the store behavior, as well as subclasses which allow Google Cloud Firestore or in-memory to be used as the storage back-end. Supports saving, ...
""" Contains methods for easily persisting `Pydantic <https://pydantic-docs.helpmanual.io/>`_ data structures to and from arbitrary storage back-ends. Contains a base class for the store behavior, as well as subclasses which allow Google Cloud Firestore or in-memory to be used as the storage back-end. Supports saving, ...
# -*- coding: utf-8 -*- ## \package dbr.moduleaccess # MIT licensing # See: docs/LICENSE.txt ## This class allows access to a 'name' attribute # # \param module_name # \b \e unicode|str : Ideally set to the module's __name__ attribute class ModuleAccessCtrl: def __init__(self, moduleName): self.ModuleName = mo...
class Moduleaccessctrl: def __init__(self, moduleName): self.ModuleName = moduleName def get_module_name(self): return self.ModuleName
# ternary method num1 = int(input('Enter the number 1::')) num2 = int(input('\nEnter the number 2::')) num3 = int(input('\nEnter the number 3::')) max = (num1 if (num1 > num2 and num1 > num3) else (num2 if(num2 > num3 and num2 > num1) else num3)) print('\n\nThe maximum number is ::', max) #with pre-...
num1 = int(input('Enter the number 1::')) num2 = int(input('\nEnter the number 2::')) num3 = int(input('\nEnter the number 3::')) max = num1 if num1 > num2 and num1 > num3 else num2 if num2 > num3 and num2 > num1 else num3 print('\n\nThe maximum number is ::', max)
num1 = int(input()) num2 = int(input()) if(num1>=num2): print(num1) else:print(num2)
num1 = int(input()) num2 = int(input()) if num1 >= num2: print(num1) else: print(num2)
""" Set of test functions so BeagleBone specific GPIO functions can be tested For obvious reasons these values are ONLY for testing! TODO: Expand to use test values instead of set values """ def begin(): print("WARNING, not using actual GPIO") def write(address, a, b): #print("WARNING, not actual GPIO") ...
""" Set of test functions so BeagleBone specific GPIO functions can be tested For obvious reasons these values are ONLY for testing! TODO: Expand to use test values instead of set values """ def begin(): print('WARNING, not using actual GPIO') def write(address, a, b): pass def read(address, start, lenght)...
class Solution: def leastInterval(self, tasks: List[str], n: int) -> int: tasksDict = collections.Counter(tasks) heap = [] c = 0 for k, v in tasksDict.items(): heappush(heap, (-v, k)) while heap: i = 0 stack = [] while i <= n: ...
class Solution: def least_interval(self, tasks: List[str], n: int) -> int: tasks_dict = collections.Counter(tasks) heap = [] c = 0 for (k, v) in tasksDict.items(): heappush(heap, (-v, k)) while heap: i = 0 stack = [] while i <=...
# Written 9/10/14 by dh4gan # Some useful functions for classifying eigenvalues and defining structure def classify_eigenvalue(eigenvalues, threshold): '''Given 3 eigenvalues, and some threshold, returns an integer 'iclass' corresponding to the number of eigenvalues below the threshold iclass = 0 --> ...
def classify_eigenvalue(eigenvalues, threshold): """Given 3 eigenvalues, and some threshold, returns an integer 'iclass' corresponding to the number of eigenvalues below the threshold iclass = 0 --> clusters (3 +ve eigenvalues, 0 -ve) iclass = 1 --> filaments (2 +ve eigenvalues, 1 -ve) iclass =...
# ------------------------------------------------------------------------- # # THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, # EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. # ----------------...
_batch_account_name = '' _batch_account_key = '' _batch_account_url = '' _storage_account_name = '' _storage_account_key = '' _input_blob_prefix = '' _input_container = '' _output_container = '' _pool_id = '' _dedicated_pool_node_count = 0 _low_priority_pool_node_count = 1 _pool_vm_size = 'STANDARD_D64_v3' _job_id = ''
class Solution: def largeGroupPositions(self, S): """ :type S: str :rtype: List[List[int]] """ return [[m.start(), m.end() - 1] for m in re.finditer(r'(\w)\1{2,}', S)]
class Solution: def large_group_positions(self, S): """ :type S: str :rtype: List[List[int]] """ return [[m.start(), m.end() - 1] for m in re.finditer('(\\w)\\1{2,}', S)]
minombre = "NaCho" minombre = minombre.lower() print (minombre) for i in range(100): print(i) break
minombre = 'NaCho' minombre = minombre.lower() print(minombre) for i in range(100): print(i) break
""" Initializing the Python package """ __version__ = '0.31' __all__ = ( '__version__', )
""" Initializing the Python package """ __version__ = '0.31' __all__ = ('__version__',)
"""SQL formatting for Teradata queries.""" class SQLFormattingError(Exception): """Custom Exception handling for empty SQL lists.""" pass def to_sql_list(iterable): """ Transform a Python list to a SQL list. input = [a1, a2] output = "('a1', 'a2')" """ if iterable: return '...
"""SQL formatting for Teradata queries.""" class Sqlformattingerror(Exception): """Custom Exception handling for empty SQL lists.""" pass def to_sql_list(iterable): """ Transform a Python list to a SQL list. input = [a1, a2] output = "('a1', 'a2')" """ if iterable: return '(' ...
class SceneManager: def __init__(self): self.scene_list = {} self.current_scene = None def append_scene(self, scene_name, scene): self.scene_list[scene_name] = scene def set_current_scene(self, scene_name): self.current_scene = self.scene_list[scene_name] class Scene: ...
class Scenemanager: def __init__(self): self.scene_list = {} self.current_scene = None def append_scene(self, scene_name, scene): self.scene_list[scene_name] = scene def set_current_scene(self, scene_name): self.current_scene = self.scene_list[scene_name] class Scene: ...
__all__ = ["ICCError", "CmdError", "CommError"] class ICCError(Exception): """A general exception for the ICC. Anything can throw one, passing a one line error message. The top-level event loop will close/cleanup/destroy any running command and return the error message on text. """ def __in...
__all__ = ['ICCError', 'CmdError', 'CommError'] class Iccerror(Exception): """A general exception for the ICC. Anything can throw one, passing a one line error message. The top-level event loop will close/cleanup/destroy any running command and return the error message on text. """ def __ini...
class Solution: def binary_search(self, array, val): index = bisect_left(array, val) if index != len(array) and array[index] == val: return index else: return -1 def smallestCommonElement(self, mat: List[List[int]]) -> int: values = mat[0] mat...
class Solution: def binary_search(self, array, val): index = bisect_left(array, val) if index != len(array) and array[index] == val: return index else: return -1 def smallest_common_element(self, mat: List[List[int]]) -> int: values = mat[0] mat....
# This problem was asked by Facebook. # Given a binary tree, return all paths from the root to leaves. # For example, given the tree # 1 # / \ # 2 3 # / \ # 4 5 # it should return [[1, 2], [1, 3, 4], [1, 3, 5]]. #### class Node: def __init__(self, val = None, left = None, right = None): sel...
class Node: def __init__(self, val=None, left=None, right=None): self.val = val self.left = left self.right = right l1 = node(5) l2 = node(3) l3 = node(7) l4 = node(4) m1 = node(2, l1, l2) m2 = node(1, l3, l4) root = node(6, m1, m2) def paths(root): if not root: return [] i...
class ApiConfig: api_key = None api_base = 'https://www.quandl.com/api/v3' api_version = None page_limit = 100
class Apiconfig: api_key = None api_base = 'https://www.quandl.com/api/v3' api_version = None page_limit = 100
_BEGIN = 0 ZERO=0 RAND=1 _END = 10
_begin = 0 zero = 0 rand = 1 _end = 10
# -*- coding: utf-8 -*- def main(): n, d = map(int, input().split()) s = [input() for _ in range(d)] ans = 0 for i in range(d): for j in range(i, d): if i != j: count = 0 for si, sj in zip(s[i], s[j]): if si == 'o'...
def main(): (n, d) = map(int, input().split()) s = [input() for _ in range(d)] ans = 0 for i in range(d): for j in range(i, d): if i != j: count = 0 for (si, sj) in zip(s[i], s[j]): if si == 'o' or sj == 'o': ...
TOPIC = "test.mosquitto.org" # Temperature and umidity publish interval (seconds) DATA_PUBLISH_INTERVAL = 5 # Data amount needed to start processing (reset after) DATA_PROCESS_AMOUNT = 5 # Percentage of mean temperature which will be sent to the air conditioner AIR_CONDITIONER_PERCENTAGE = 0.8 # Humidity below this...
topic = 'test.mosquitto.org' data_publish_interval = 5 data_process_amount = 5 air_conditioner_percentage = 0.8 humidifier_lower_threshold = 50 humidifier_upper_threshold = 80
PAGINATE_MODULES = { "Leads": { "stream_name": "leads", "module_name": "Leads", "params": {"per_page": 200, "sort_by": "Modified_Time", "sort_order": "asc"}, "bookmark_key": "Modified_Time", }, "Deals": { "stream_name": "deals", "module_name": "Deals", ...
paginate_modules = {'Leads': {'stream_name': 'leads', 'module_name': 'Leads', 'params': {'per_page': 200, 'sort_by': 'Modified_Time', 'sort_order': 'asc'}, 'bookmark_key': 'Modified_Time'}, 'Deals': {'stream_name': 'deals', 'module_name': 'Deals', 'params': {'per_page': 200, 'sort_by': 'Modified_Time', 'sort_order': 'a...
for arquivo in os.listdir(caminho): caminho_completo = os.path.join(caminho, arquivo) #zip.write(caminho_completo, arquivo) print(caminho_completo)
for arquivo in os.listdir(caminho): caminho_completo = os.path.join(caminho, arquivo) print(caminho_completo)
class Utils: def __init__(self, data_immigration=None, data_temp=None, data_us_dem=None, data_airport=None): self.data_immigration = data_immigration self.data_temp = data_temp self.data_us_dem = data_us_dem self.data_airport = data_airport @staticmethod def process_immigrat...
class Utils: def __init__(self, data_immigration=None, data_temp=None, data_us_dem=None, data_airport=None): self.data_immigration = data_immigration self.data_temp = data_temp self.data_us_dem = data_us_dem self.data_airport = data_airport @staticmethod def process_immigra...
class Solution: def removeCoveredIntervals(self, intervals: List[List[int]]) -> int: intervals.sort(key=lambda x: (x[0], -x[1])) count = 0 end = -1 for a, b in intervals: if b > end: count += 1 end = b return count
class Solution: def remove_covered_intervals(self, intervals: List[List[int]]) -> int: intervals.sort(key=lambda x: (x[0], -x[1])) count = 0 end = -1 for (a, b) in intervals: if b > end: count += 1 end = b return count
def comb(n, k): nCk = 1 MOD = 10**9+7 for i in range(n-k+1, n+1): nCk *= i nCk %= MOD for i in range(1, k+1): nCk *= pow(i, MOD-2, MOD) nCk %= MOD return nCk n, a, b = map(int, input().split()) mod = 10**9+7 ans = pow(2, n, mod)-1-comb(n, a)-comb(n, b) print(ans %...
def comb(n, k): n_ck = 1 mod = 10 ** 9 + 7 for i in range(n - k + 1, n + 1): n_ck *= i n_ck %= MOD for i in range(1, k + 1): n_ck *= pow(i, MOD - 2, MOD) n_ck %= MOD return nCk (n, a, b) = map(int, input().split()) mod = 10 ** 9 + 7 ans = pow(2, n, mod) - 1 - comb(n, ...
dict1={1:"John",2:"Bob",3:"Bill"} print(dict1) print(dict1.items()) k=dict1.keys() for key in k: print(key) v=dict1.values() for value in v: print(value) print(dict1[3]) del dict1[2] print(dict1)
dict1 = {1: 'John', 2: 'Bob', 3: 'Bill'} print(dict1) print(dict1.items()) k = dict1.keys() for key in k: print(key) v = dict1.values() for value in v: print(value) print(dict1[3]) del dict1[2] print(dict1)
""" /github/enums/repositorysubscription.py Copyright (c) 2019-2020 ShineyDev 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...
""" /github/enums/repositorysubscription.py Copyright (c) 2019-2020 ShineyDev 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...
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # lzma_sdk for standalone build. { 'targets': [ { 'target_name': 'ots_lzma_sdk', 'type': 'static_library', 'defines': [ '...
{'targets': [{'target_name': 'ots_lzma_sdk', 'type': 'static_library', 'defines': ['_7ZIP_ST', '_LZMA_PROB32'], 'sources': ['Alloc.c', 'Alloc.h', 'LzFind.c', 'LzFind.h', 'LzHash.h', 'LzmaEnc.c', 'LzmaEnc.h', 'LzmaDec.c', 'LzmaDec.h', 'LzmaLib.c', 'LzmaLib.h', 'Types.h'], 'include_dirs': ['.'], 'direct_dependent_setting...
""" Given an integer n. Each number from 1 to n is grouped according to the sum of its digits. Return how many groups have the largest size. """ class Solution: def countLargestGroup(self, n: int) -> int: def sum_digits(integer): tot = 0 while integer: tot += intege...
""" Given an integer n. Each number from 1 to n is grouped according to the sum of its digits. Return how many groups have the largest size. """ class Solution: def count_largest_group(self, n: int) -> int: def sum_digits(integer): tot = 0 while integer: tot += in...
# Create a sequence where each element is an individual base of DNA. # Make the array 15 bases long. bases = 'ATTCGGTCATGCTAA' # Print the length of the sequence print("DNA sequence length:", len(bases)) # Create a for loop to output every base of the sequence on a new line. print("All bases:") for base in bases: ...
bases = 'ATTCGGTCATGCTAA' print('DNA sequence length:', len(bases)) print('All bases:') for base in bases: print(base)
# Team 5 def save_to_json(datatables: list, directory=None): pass def open_json(): pass
def save_to_json(datatables: list, directory=None): pass def open_json(): pass
_base_ = "./FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_Pbr_01_ape.py" OUTPUT_DIR = "output/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_lmPbr_SO/duck" DATASETS = dict(TRAIN=("lm_pbr_duck_train",), TEST=("lm_real_duck_test",)) # bbnc6 # objects duck Avg(1) # ad_2 4.23 4.23 # ad_5 26....
_base_ = './FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_Pbr_01_ape.py' output_dir = 'output/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveV2_Flat_lmPbr_SO/duck' datasets = dict(TRAIN=('lm_pbr_duck_train',), TEST=('lm_real_duck_test',))
class Solution: def sortArray(self, nums: List[int]) -> List[int]: temp = [0] * len(nums) def mergeSort(start, end): if start < end: mid = (start + end) // 2 mergeSort(start, mid) mergeSort(mid + 1, end) i = k = start ...
class Solution: def sort_array(self, nums: List[int]) -> List[int]: temp = [0] * len(nums) def merge_sort(start, end): if start < end: mid = (start + end) // 2 merge_sort(start, mid) merge_sort(mid + 1, end) i = k = start ...
class Foo0(): def __init__(self): pass foo1 = Foo0() class Foo0(): ## error: redefined class def __init__(self, a): pass foo2 = Foo0()
class Foo0: def __init__(self): pass foo1 = foo0() class Foo0: def __init__(self, a): pass foo2 = foo0()
# List of possible Pokemon types types = [ "Normal", "Fire", "Water", "Electric", "Grass", "Ice", "Fighting", "Poison", "Ground", "Flying", "Psychic", "Bug", "Rock", "Ghost", "Dragon", "Dark", "Steel", "Fairy" ] # Chart of type weaknesses. type_dict["Water"]["Fire"] assumes water is attacking fire. type_dict = {"N...
types = ['Normal', 'Fire', 'Water', 'Electric', 'Grass', 'Ice', 'Fighting', 'Poison', 'Ground', 'Flying', 'Psychic', 'Bug', 'Rock', 'Ghost', 'Dragon', 'Dark', 'Steel', 'Fairy'] type_dict = {'Normal': {'Normal': 1, 'Fire': 1, 'Water': 1, 'Electric': 1, 'Grass': 1, 'Ice': 1, 'Fighting': 1, 'Poison': 1, 'Ground': 1, 'Flyi...
class Solution: def checkValidString(self, s: str) -> bool: left_count = 0 star_count = 0 for char in s: if char == '(': left_count += 1 elif char == '*': star_count += 1 else: if left_count > 0: ...
class Solution: def check_valid_string(self, s: str) -> bool: left_count = 0 star_count = 0 for char in s: if char == '(': left_count += 1 elif char == '*': star_count += 1 elif left_count > 0: left_count -=...
class SanSize(int): """ Size in bytes Range : [0..2^63-1]. """ @staticmethod def get_api_name(): return "san-size"
class Sansize(int): """ Size in bytes Range : [0..2^63-1]. """ @staticmethod def get_api_name(): return 'san-size'
class FibonacciTable: def __init__(self): self.forward_look_up_table = {0: 0, 1: 1} self.backward_look_up_table = {0: 0, 1: 1} def _build_lookup_table(self, fib_index: int) -> None: if fib_index in self.forward_look_up_table.keys(): return current_highest_index = m...
class Fibonaccitable: def __init__(self): self.forward_look_up_table = {0: 0, 1: 1} self.backward_look_up_table = {0: 0, 1: 1} def _build_lookup_table(self, fib_index: int) -> None: if fib_index in self.forward_look_up_table.keys(): return current_highest_index = ma...
# Given an array of ints length 3, return an array with the elements "rotated # left" so {1, 2, 3} yields {2, 3, 1}. # rotate_left3([1, 2, 3]) --> [2, 3, 1] # rotate_left3([5, 11, 9]) --> [11, 9, 5] # rotate_left3([7, 0, 0]) --> [0, 0, 7] def rotate_left3(nums): nums.append(nums.pop(0)) return nums print(rotate...
def rotate_left3(nums): nums.append(nums.pop(0)) return nums print(rotate_left3([1, 2, 3])) print(rotate_left3([5, 11, 9])) print(rotate_left3([7, 0, 0]))
""" This module provides procedures to check if an instance describes preferences that are single-crossing. """ def isSingleCrossing(instance): """ Tests whether the instance describe a profile of single-crossed preferences. :param instance: The instance to take the orders from. :type instance: preflibtools.inst...
""" This module provides procedures to check if an instance describes preferences that are single-crossing. """ def is_single_crossing(instance): """ Tests whether the instance describe a profile of single-crossed preferences. :param instance: The instance to take the orders from. :type instance: preflibtools...
#!/usr/bin/env python3 # Parse input lines = [] with open("10/input.txt", "r") as fd: for line in fd: lines.append(line.rstrip()) illegal = [] for line in lines: stack = list() for c in line: if c == "(": stack.append(")") elif c == "[": stack.append("]") ...
lines = [] with open('10/input.txt', 'r') as fd: for line in fd: lines.append(line.rstrip()) illegal = [] for line in lines: stack = list() for c in line: if c == '(': stack.append(')') elif c == '[': stack.append(']') elif c == '{': stack....
class Node: def __init__(self, data): self.data = data self.next = None class Queue: def __init__(self): self.front = self.back = None def isEmpty(self): return self.front == None def EnQueue(self, item): temp = Node(item) if(self.back == None): ...
class Node: def __init__(self, data): self.data = data self.next = None class Queue: def __init__(self): self.front = self.back = None def is_empty(self): return self.front == None def en_queue(self, item): temp = node(item) if self.back == None: ...
#/* *** ODSATag: RFact *** */ # Recursively compute and return n! def rfact(n): if n < 0: raise ValueError if n <= 1: return 1 # Base case: return base solution return n * rfact(n-1) # Recursive call for n > 1 #/* *** ODSAendTag: RFact *** */ #/* *** ODSATag: Sfact *** */ # Return n! def sfact(n): ...
def rfact(n): if n < 0: raise ValueError if n <= 1: return 1 return n * rfact(n - 1) def sfact(n): if n < 0: raise ValueError s = a_stack(n) while n > 1: S.push(n) n -= 1 result = 1 while S.length() > 0: result = result * S.pop() retur...
""" Range range(stop) range(start, stop) range(start, stop, step) start = 0 step = 1 - iterable object - string is iterable """ r = range(5, 10, 2) print(r.start) print(r.stop) print(r.step)
""" Range range(stop) range(start, stop) range(start, stop, step) start = 0 step = 1 - iterable object - string is iterable """ r = range(5, 10, 2) print(r.start) print(r.stop) print(r.step)
# https://www.hackerrank.com/challenges/ctci-is-binary-search-tree """ Node is defined as class node: def __init__(self, data): self.data = data self.left = None self.right = None """ arr = [] inlen = 0 def checkBST(root): global arr if root is None: return True if chec...
""" Node is defined as class node: def __init__(self, data): self.data = data self.left = None self.right = None """ arr = [] inlen = 0 def check_bst(root): global arr if root is None: return True if check_bst(root.left): arr.append(root.data) if len(arr)...
r1, c1 = map(int, input().split()) r2, c2 = map(int, input().split()) if abs(r1 - r2) + abs(c1 - c2) == 0: print(0) exit() # Move if abs(r1 - r2) + abs(c1 - c2) <= 3: print(1) exit() r3 = r2 t = abs(r1 - r2) if abs(c1 + t - c2) < abs(c1 - t - c2): c3 = c1 + t else: c3 = c1 - t # Bishop warp ...
(r1, c1) = map(int, input().split()) (r2, c2) = map(int, input().split()) if abs(r1 - r2) + abs(c1 - c2) == 0: print(0) exit() if abs(r1 - r2) + abs(c1 - c2) <= 3: print(1) exit() r3 = r2 t = abs(r1 - r2) if abs(c1 + t - c2) < abs(c1 - t - c2): c3 = c1 + t else: c3 = c1 - t if c3 == c2: prin...
age = 10 num = 0 while num < age: if num == 0: num += 1 continue if num % 2 == 0: print(num) if num > 4: break num += 1
age = 10 num = 0 while num < age: if num == 0: num += 1 continue if num % 2 == 0: print(num) if num > 4: break num += 1
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat May 25 19:01:56 2019 @author: joscelynec """ """ Iterative Binary Search of a Sorted Array Adapted from: https://codereview.stackexchange.com/questions/117180/python-2-binary-search """ def binary_search(array, value): start, stop = 0, len(array) ...
""" Created on Sat May 25 19:01:56 2019 @author: joscelynec """ '\nIterative Binary Search of a Sorted Array\nAdapted from:\nhttps://codereview.stackexchange.com/questions/117180/python-2-binary-search\n' def binary_search(array, value): (start, stop) = (0, len(array)) while start < stop: offset = sta...
# -*- coding: utf-8 -*- """ Created on Tue Dec 24 15:29:32 2019 @author: mwhitten """ def g2d1(Fy, Aw, Cv): """Nominal shear strength The nominal shear strength, Vn, of unstiffened or stiffened webs, according to the limit states of shear yielding and shear buckling, is Vn = 0.6*Fy*Aw*Cv...
""" Created on Tue Dec 24 15:29:32 2019 @author: mwhitten """ def g2d1(Fy, Aw, Cv): """Nominal shear strength The nominal shear strength, Vn, of unstiffened or stiffened webs, according to the limit states of shear yielding and shear buckling, is Vn = 0.6*Fy*Aw*Cv Args: ...
# This is Stack build using Singly Linked List class StackNode: def __init__(self, value): self.value = value self._next = None class Stack: def __init__(self): self.head = None # bottom self.tail = None # top self.size = 0 def __len__(self): return sel...
class Stacknode: def __init__(self, value): self.value = value self._next = None class Stack: def __init__(self): self.head = None self.tail = None self.size = 0 def __len__(self): return self.size def _size(self): return self.size def is...
def create_data(n): temp = [i for i in range(n)] return temp n = 100 target = n + 11 ma_list = create_data(n) def binary_search(input_list,target): found = False low = 0 high = len(input_list) - 1 mid = int((high + low) / 2) while (low <=high) and (not found): curr = input_list[mi...
def create_data(n): temp = [i for i in range(n)] return temp n = 100 target = n + 11 ma_list = create_data(n) def binary_search(input_list, target): found = False low = 0 high = len(input_list) - 1 mid = int((high + low) / 2) while low <= high and (not found): curr = input_list[mid]...
# @Author: Ozan YILDIZ@2022 # Simple printing operation val = 12 if __name__ == '__main__': #print operation print("Boolean True (True)", val)
val = 12 if __name__ == '__main__': print('Boolean True (True)', val)
class FlightParsingConfig(object): """ Configuration for parsing an IGC file. Defines a set of parameters used to validate a file, and to detect thermals and flight mode. Details in comments. """ # # Flight validation parameters. # # Minimum of fixes required before takeoff for fil...
class Flightparsingconfig(object): """ Configuration for parsing an IGC file. Defines a set of parameters used to validate a file, and to detect thermals and flight mode. Details in comments. """ min_fixes_before_takeoff = 5 min_fixes = 50 max_seconds_between_fixes = 50.0 min_seconds...
"""URL creator for the evergreen API.""" class UrlCreator: """Class to create evergreen URLs.""" def __init__(self, api_server: str) -> None: """ Initialize a url creator. :param api_server: Hostname API server to connect to. """ self.api_server = api_server def ...
"""URL creator for the evergreen API.""" class Urlcreator: """Class to create evergreen URLs.""" def __init__(self, api_server: str) -> None: """ Initialize a url creator. :param api_server: Hostname API server to connect to. """ self.api_server = api_server def r...
#http://shell-storm.org/shellcode/files/shellcode-103.php """ \x7f\x45\x4c\x46\x01\x01\x01\x09\x00\x00\x00\x00\x00\x00\x00\x00 \x02\x00\x03\x00\x01\x00\x00\x00\x74\x80\x04\x08\x34\x00\x00\x00 \xa8\x00\x00\x00\x00\x00\x00\x00\x34\x00\x20\x00\x02\x00\x28\x00 \x05\x00\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x80\x04\x...
""" \x7fELF\x01\x01\x01 \x00\x00\x00\x00\x00\x00\x00\x00 \x02\x00\x03\x00\x01\x00\x00\x00t\x80\x04\x084\x00\x00\x00 ¨\x00\x00\x00\x00\x00\x00\x004\x00 \x00\x02\x00(\x00 \x05\x00\x04\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x80\x04\x08 \x00\x80\x04\x08\x8b\x00\x00\x00\x8b\x00\x00\x00\x05\x00\x00\x00 \x00\x10\x00\x00\x01\...
#Finding least trial def least_trial_num(n): #making 1000001 size buffer buffer = [] for i in range(1000001): buffer += [0] #Minimum calculation of 1 is 0 times. buffer[1] = 0 #Minimum calculations of other values for i in range(2, n + 1): #Since calculations of...
def least_trial_num(n): buffer = [] for i in range(1000001): buffer += [0] buffer[1] = 0 for i in range(2, n + 1): buffer[i] = buffer[i - 1] + 1 if i % 2 == 0: buffer[i] = min2(buffer[i], buffer[i // 2] + 1) if i % 3 == 0: buffer[i] = min2(buffer[i...
#!/usr/local/bin/python3 # -*- coding: utf-8 -*- """ Date: 2019/11/27 Author: Xiao-Le Deng Email: xiaoledeng at gmail.com Function: get a list of each line in the file """ def read_file_to_list(file): """Return a list of each line in the file""" result=[] with open(file,'rt',encoding='utf-8') as f: ...
""" Date: 2019/11/27 Author: Xiao-Le Deng Email: xiaoledeng at gmail.com Function: get a list of each line in the file """ def read_file_to_list(file): """Return a list of each line in the file""" result = [] with open(file, 'rt', encoding='utf-8') as f: for line in f: result.append(lis...
# environment variables ATOM_PROGRAM = '/home/physics/bin/atm' ATOM_UTILS_DIR ='/home/physics/bin/pseudo' element = "Al" equil_volume = 16.4796 # general calculation parameters calc = {"element": element, "lattice": "FCC", "xc": "pb", "n_core": 3, "n_val": 2, "is_spin_pol": Fa...
atom_program = '/home/physics/bin/atm' atom_utils_dir = '/home/physics/bin/pseudo' element = 'Al' equil_volume = 16.4796 calc = {'element': element, 'lattice': 'FCC', 'xc': 'pb', 'n_core': 3, 'n_val': 2, 'is_spin_pol': False, 'core': True} electrons = [2, 1] radii = [2.4, 2.8, 2.3, 2.3, 0.7] siesta_calc = {'element': e...
idir="<path to public/template database>/"; odir=idir+"output/"; public_dir='DPA_contest2_public_base_diff_vcc_a128_2009_12_23/' template_dir='DPA_contest2_template_base_diff_vcc_a128_2009_12_23/' template_index_file=idir+'DPA_contest2_template_base_index_file' public_index_file=idir+'DPA_contest2_public_base_inde...
idir = '<path to public/template database>/' odir = idir + 'output/' public_dir = 'DPA_contest2_public_base_diff_vcc_a128_2009_12_23/' template_dir = 'DPA_contest2_template_base_diff_vcc_a128_2009_12_23/' template_index_file = idir + 'DPA_contest2_template_base_index_file' public_index_file = idir + 'DPA_contest2_publi...
def getNoZeroIntegers(self, n: int) -> List[int]: for i in range(1, n): a = i b = n - i if "0" in str(a) or "0" in str(b): continue return [a, b]
def get_no_zero_integers(self, n: int) -> List[int]: for i in range(1, n): a = i b = n - i if '0' in str(a) or '0' in str(b): continue return [a, b]