content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
N = int(input()) a_list = [] for i in range(N): a_list.append(int(input())) checked = set() if a_list[0] == 2: print(1) exit() checked.add(a_list[0]) count = 1 btn = a_list[0] for i in range(1, N): ai = a_list[btn-1] count +=1 if ai in checked: print(-1) exit() else: ...
n = int(input()) a_list = [] for i in range(N): a_list.append(int(input())) checked = set() if a_list[0] == 2: print(1) exit() checked.add(a_list[0]) count = 1 btn = a_list[0] for i in range(1, N): ai = a_list[btn - 1] count += 1 if ai in checked: print(-1) exit() elif ai == ...
class Point(object): def __init__(self, coordinate): self.x_coordinate = coordinate[0] self.y_coordinate = coordinate[1] self.order = 0 self.maximal_manhattan_distance = 0 self.maximal_manhattan_distance_coordinate = ( self.x_coordinate, self.y_coordinate) ...
class Point(object): def __init__(self, coordinate): self.x_coordinate = coordinate[0] self.y_coordinate = coordinate[1] self.order = 0 self.maximal_manhattan_distance = 0 self.maximal_manhattan_distance_coordinate = (self.x_coordinate, self.y_coordinate) def update_man...
class Moon: def __init__(self, coords): self.coords = coords self.velocity = [0, 0, 0] def adjust_from_other(self, other): for n in range(3): if (self.coords[n] < other.coords[n]): self.velocity[n] += 1 elif (self.coords[n] > other.coords[n]): ...
class Moon: def __init__(self, coords): self.coords = coords self.velocity = [0, 0, 0] def adjust_from_other(self, other): for n in range(3): if self.coords[n] < other.coords[n]: self.velocity[n] += 1 elif self.coords[n] > other.coords[n]: ...
class FtpCrawler: def __init__(self, base_path, ftplib): self.base_path = base_path self.ftplib = ftplib def get_all_entries(self): def make_path(components): return '/'.join(components) self.ftplib.login() result = list() stack = [self.base_path] ...
class Ftpcrawler: def __init__(self, base_path, ftplib): self.base_path = base_path self.ftplib = ftplib def get_all_entries(self): def make_path(components): return '/'.join(components) self.ftplib.login() result = list() stack = [self.base_path] ...
# A program that displays the square, cube, and fourth power. x = int (input("Enter the number: ")) print("Square: {}\nCube: {}\nFourth Power: {}". format(x * x, x ** 3, pow(x, 4)))
x = int(input('Enter the number: ')) print('Square: {}\nCube: {}\nFourth Power: {}'.format(x * x, x ** 3, pow(x, 4)))
__author__ = 'Aaron Yang' __email__ = 'byang971@usc.edu' __date__ = '12/2/2020 10:49 PM' class Solution: def minDistance(self, word1: str, word2: str) -> int: row = len(word1) col = len(word2) dp = [[0] * (col + 1) for j in range(row + 1)] temp = 0 for j in range(1, col + ...
__author__ = 'Aaron Yang' __email__ = 'byang971@usc.edu' __date__ = '12/2/2020 10:49 PM' class Solution: def min_distance(self, word1: str, word2: str) -> int: row = len(word1) col = len(word2) dp = [[0] * (col + 1) for j in range(row + 1)] temp = 0 for j in range(1, col + ...
# Fill out these fields and rename this file to config.py to run. flask_key: str = "" # secret key used by flask flask_port: int = 5000 # port the run flask on (5000 for dev, 80 for prod) discord_client: str = "" # bot application client id - used for oauth2 discord_secret: str = "" # bot application client secre...
flask_key: str = '' flask_port: int = 5000 discord_client: str = '' discord_secret: str = '' discord_redirect: str = '' discord_webhook: str = '' bot_token: str = '' admin_role: str = '' guild_id: str = '' db_user: str = '' db_pass: str = '' db_host: str = '' db_port: str = '' db_name: str = ''
DEFAULT_CSV_SEPERATOR = "\t" DEFAULT_PRE_CHUNK_SIZE = 500 # end of string # EOS = '~'
default_csv_seperator = '\t' default_pre_chunk_size = 500
#Define a list of the Greek Alphabet for Latex greek_alph = ['alpha','beta','gamma','delta','epsilon', 'varepsilon','zeta','eta','theta','vartheta', 'iota','kappa','lambda','mu','nu','xi','pi', 'varpi','rho','varrho','sigma','varsigma', 'tau','upsilon','phi','varphi','chi','psi',...
greek_alph = ['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'varepsilon', 'zeta', 'eta', 'theta', 'vartheta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'pi', 'varpi', 'rho', 'varrho', 'sigma', 'varsigma', 'tau', 'upsilon', 'phi', 'varphi', 'chi', 'psi', 'omega', 'Gamma', 'Delta', 'Theta', 'Lambda', 'Xi', 'Pi', 'Sigm...
class InvalidStateError(Exception): def __init__(self, message = "The environment state received is not contained in the observation space."): self.message = message def __str__(self): return self.message class RobotServerError(Exception): def __init__(self, service): if service == ...
class Invalidstateerror(Exception): def __init__(self, message='The environment state received is not contained in the observation space.'): self.message = message def __str__(self): return self.message class Robotservererror(Exception): def __init__(self, service): if service ==...
class Solution: def XXX(self, x: int) -> bool: x=str(x) return True if x==x[::-1] else False
class Solution: def xxx(self, x: int) -> bool: x = str(x) return True if x == x[::-1] else False
def fn(): x = [] if a % 2 == 1: return "bad" for i in range(len(b)): if b[i] == c[i]: return "bad" if b[i] < c[i]: x.append(b[i] + c[i]) else: x.append(c[i] + b[i]) for i in x: if x.count(i) != 2: return "bad" re...
def fn(): x = [] if a % 2 == 1: return 'bad' for i in range(len(b)): if b[i] == c[i]: return 'bad' if b[i] < c[i]: x.append(b[i] + c[i]) else: x.append(c[i] + b[i]) for i in x: if x.count(i) != 2: return 'bad' re...
# -*- coding: utf-8 -*- __author__ = 'Karl Palsson' __email__ = 'karlp@tweak.net.au' __version__ = '0.1.0'
__author__ = 'Karl Palsson' __email__ = 'karlp@tweak.net.au' __version__ = '0.1.0'
def Xmastree(): str = "*" strsp = "" for i in range(51): strsp += " " for i in range(100): print(strsp+str) str += "**" spaces = 50-(i) strsp = "" for i in range(spaces): strsp += " "
def xmastree(): str = '*' strsp = '' for i in range(51): strsp += ' ' for i in range(100): print(strsp + str) str += '**' spaces = 50 - i strsp = '' for i in range(spaces): strsp += ' '
ReLU [[0.0553801, 0.190198, -0.0377036, -1.32009, -0.704992], [-0.010481, -0.118571, 0.153946, -0.736114, -1.00878], [0.482564, 0.0565022, 0.0443098, 0.0600691, 0.0020876], [-0.0778212, -0.0577902, -0.153575, 0.0605465, 0.450204], [0.0143941, -0.25066, -0.132743, 0.533158, -0.0781143], [-0.00869665, -0.447464, -0.05171...
ReLU [[0.0553801, 0.190198, -0.0377036, -1.32009, -0.704992], [-0.010481, -0.118571, 0.153946, -0.736114, -1.00878], [0.482564, 0.0565022, 0.0443098, 0.0600691, 0.0020876], [-0.0778212, -0.0577902, -0.153575, 0.0605465, 0.450204], [0.0143941, -0.25066, -0.132743, 0.533158, -0.0781143], [-0.00869665, -0.447464, -0.05171...
expected_output = { "bay": "0", "chassis": { 1: { "boot_hashes": { "17.9.0.3r": "CD187702DD2CB79BC1B8E62BF8EF596E9227F76254E19BE0F5A0AB9E9D9A3F1FF643FA1AE9354037355119E974B62903FBD045C152EB66C19412FA78FB13AE17", "MA0081R06.1307262016": "80F5629CB70F2B4ABD89F11...
expected_output = {'bay': '0', 'chassis': {1: {'boot_hashes': {'17.9.0.3r': 'CD187702DD2CB79BC1B8E62BF8EF596E9227F76254E19BE0F5A0AB9E9D9A3F1FF643FA1AE9354037355119E974B62903FBD045C152EB66C19412FA78FB13AE17', 'MA0081R06.1307262016': '80F5629CB70F2B4ABD89F118BF402A105E82E0A8A0AE5E7CD9E4D21F898CEFF5'}, 'os': {'hashes': {'...
# Question 9 - Convert binary to decimal # Asmit De # 03/24/2017 # Enter binary binary = int(input('Enter binary number: ')) # Duplicate variable for modification b = binary # Initialize decimal decimal = 0 # Initialize bit position i = 0 # Set a valid flag isValid = True # Extract each bit and...
binary = int(input('Enter binary number: ')) b = binary decimal = 0 i = 0 is_valid = True while b > 0: bit = b % 10 if bit > 1: is_valid = False break decimal += 2 ** i * bit b //= 10 i += 1 if isValid == True: print('The decimal equivalent of', binary, 'is', decimal) else: p...
def B(): s = input() o_bracket = set() c_bracket = set() colon = set() for i in range(len(s)): if(s[i]=='['): o_bracket.add(i) if(s[i]==']'): c_bracket.add(i) if(len(o_bracket)*len(c_bracket)==0): print(-1) return l , r = min(o_bracket) , max(c_bracket) for i in range(l,r+1): if(s[i]==':'): colo...
def b(): s = input() o_bracket = set() c_bracket = set() colon = set() for i in range(len(s)): if s[i] == '[': o_bracket.add(i) if s[i] == ']': c_bracket.add(i) if len(o_bracket) * len(c_bracket) == 0: print(-1) return (l, r) = (min(o_b...
#q5.Write a program to check whether the entered year is leap year or not. year=int(input ("enter year: ")) if (year%4==0 or year%100==0 or year%400==0): print("its leap year.") else: print("its not leap year.")
year = int(input('enter year: ')) if year % 4 == 0 or year % 100 == 0 or year % 400 == 0: print('its leap year.') else: print('its not leap year.')
# -*- coding: utf-8 -*- extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx'] source_suffix = '.rst' master_doc = 'index' project = u'unleash' copyright = u'2015, Marc Brinkmann' version = '0.7.2' release = '0.7.2.dev1' exclude_patterns = ['_build'] pygments_style = 'sphinx' html_theme = 'alabaster' inters...
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx'] source_suffix = '.rst' master_doc = 'index' project = u'unleash' copyright = u'2015, Marc Brinkmann' version = '0.7.2' release = '0.7.2.dev1' exclude_patterns = ['_build'] pygments_style = 'sphinx' html_theme = 'alabaster' intersphinx_mapping = {'http://docs...
# Created by MechAviv # ID :: [865020001] # Commerci Republic : Canal 1 sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.setStandAloneMode(True) sm.forcedInput(2) sm.curNodeEventEnd(True)
sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.setStandAloneMode(True) sm.forcedInput(2) sm.curNodeEventEnd(True)
def pedra_papel_tesoura(j1, j2): if j1 not in "pedrapapeltesoura": return "Escolha pedra, papel ou tesoura para jogar" if j2 not in "pedrapapeltesoura": return "Escolha pedra, papel ou tesoura para jogar" if j1 == "pedra" and j2 == "tesoura": return "um" elif j1 ...
def pedra_papel_tesoura(j1, j2): if j1 not in 'pedrapapeltesoura': return 'Escolha pedra, papel ou tesoura para jogar' if j2 not in 'pedrapapeltesoura': return 'Escolha pedra, papel ou tesoura para jogar' if j1 == 'pedra' and j2 == 'tesoura': return 'um' elif j1 == 'tesoura' and ...
# variables that contain user credentials CONSUMER_KEY = "tMFjs33CpuKRq4MUqK3A87tPV" CONSUMER_SECRET = "x9sKeTeUvXPLhkqkHutQYZInpNVNCjxqmyrR4Ve8R4kRzNsaCL" ACCESS_TOKEN = "1005899876742377474-Fd44TJWSfTUiGBapM8YOtjah9Kv8Ef" ACCESS_TOKEN_SECRET = "dlkbbp3Ibc7nSH6f1tHZeopMCn4XKPANqYAahQgXgheot"
consumer_key = 'tMFjs33CpuKRq4MUqK3A87tPV' consumer_secret = 'x9sKeTeUvXPLhkqkHutQYZInpNVNCjxqmyrR4Ve8R4kRzNsaCL' access_token = '1005899876742377474-Fd44TJWSfTUiGBapM8YOtjah9Kv8Ef' access_token_secret = 'dlkbbp3Ibc7nSH6f1tHZeopMCn4XKPANqYAahQgXgheot'
def smooth_number_3(n): res = [0 for i in range(n)] res[0] = 1 p2, p3 = 0, 0 for i in range(1, n): if res[p2] * 2 == res[i - 1]: p2 += 1 if res[p3] * 3 == res[i - 1]: p3 += 1 u2 = res[p2] * 2 u3 = res[p3] * 3 if u2 < u3: ...
def smooth_number_3(n): res = [0 for i in range(n)] res[0] = 1 (p2, p3) = (0, 0) for i in range(1, n): if res[p2] * 2 == res[i - 1]: p2 += 1 if res[p3] * 3 == res[i - 1]: p3 += 1 u2 = res[p2] * 2 u3 = res[p3] * 3 if u2 < u3: p2 ...
#Read source file try: f=open("Bereishis 1.txt", "r+", encoding="utf8") print(f.readline()) finally: f.close() #It works!
try: f = open('Bereishis 1.txt', 'r+', encoding='utf8') print(f.readline()) finally: f.close()
print("Name: Aderinsola Adebisi") print("Email: adebisiaderinsola@gmail.com") print("Slack username: @Aderinsola") print("Biostack: Drug Development") print("Twitter username: @Derinsolar") print("Hamming distance: 2")
print('Name: Aderinsola Adebisi') print('Email: adebisiaderinsola@gmail.com') print('Slack username: @Aderinsola') print('Biostack: Drug Development') print('Twitter username: @Derinsolar') print('Hamming distance: 2')
# Deklarasi semua type rumah dan harga rumah!! semuaTypeRumah = ['Rose', 'Gold', 'Platinum'] semuaHargaRumah = { semuaTypeRumah[0]: 120000000, semuaTypeRumah[1]: 300000000, semuaTypeRumah[2]: 360000000 } # Display input print(".------------------->") print("| 1. Rose\t120.000.000") print("| 2. Gold\t300.00...
semua_type_rumah = ['Rose', 'Gold', 'Platinum'] semua_harga_rumah = {semuaTypeRumah[0]: 120000000, semuaTypeRumah[1]: 300000000, semuaTypeRumah[2]: 360000000} print('.------------------->') print('| 1. Rose\t120.000.000') print('| 2. Gold\t300.000.000') print('| 3. Platinum\t360.000.000') print('`------------------->')...
# Radix sort in Python # Using counting sort to sort the elements in the basis of significant places def countingSort(array, place): size = len(array) output = [0] * size count = [0] * 10 # Calculate count of elements for i in range(0, size): index = array[i] // place count[index ...
def counting_sort(array, place): size = len(array) output = [0] * size count = [0] * 10 for i in range(0, size): index = array[i] // place count[index % 10] += 1 for i in range(1, 10): count[i] += count[i - 1] i = size - 1 while i >= 0: index = array[i] // pla...
# deftools.py -- contains functions related to reading and writing dataset # and pipeline definition files. def parse_stream(f): contents = f.read() lines = contents.splitlines() tokens = [] for l in lines: stripped = l.strip() if len(stripped)!=0: if strip...
def parse_stream(f): contents = f.read() lines = contents.splitlines() tokens = [] for l in lines: stripped = l.strip() if len(stripped) != 0: if stripped[len(stripped) - 1] == ':': tokens.append([stripped[:len(stripped) - 1]]) else: ...
def solve(): n = int(input()) binary = [2**i for i in range(30)] remaining = [10**9-i for i in range(n-30)] a = binary + remaining print(*a, flush=True) b = list(map(int, input().split())) x, y = [], [] judge = b + remaining for i in judge: if sum(x) >= sum(y): ...
def solve(): n = int(input()) binary = [2 ** i for i in range(30)] remaining = [10 ** 9 - i for i in range(n - 30)] a = binary + remaining print(*a, flush=True) b = list(map(int, input().split())) (x, y) = ([], []) judge = b + remaining for i in judge: if sum(x) >= sum(y): ...
### OLD VERSION ### # Set online input_select option_list from entity state, attribute or string # Must be entity of the input_select like 'input_select.sonos_favs' entity_inputselect = data.get('entity_id')[0] # A entity or string to make a list from # entity attribute: media_player.buro.source_list # entity state:...
entity_inputselect = data.get('entity_id')[0] entity_optionsstring = data.get('data_source') if entity_inputselect is None and entity_optionsstring is None: logger.warning('No data!') exit() current_selection = hass.states.get(entity_inputselect).state option_list = ['None'] if '.' not in entity_optionsstring: ...
# # PySNMP MIB module CISCO-DOCS-REMOTE-QUERY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DOCS-REMOTE-QUERY-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:55:31 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python versio...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) ...
for _ in range(int(input())): x,n=map(int,input().split()) ans=0 if n%4==1: ans=-n if n%4==2: ans=1 if n%4==3: ans=n+1 if n%4==0: ans=0 if abs(x)%2==1: ans=-ans print(ans+x)
for _ in range(int(input())): (x, n) = map(int, input().split()) ans = 0 if n % 4 == 1: ans = -n if n % 4 == 2: ans = 1 if n % 4 == 3: ans = n + 1 if n % 4 == 0: ans = 0 if abs(x) % 2 == 1: ans = -ans print(ans + x)
def is_palindrome(number): n = str(number) if n.startswith('0'): return False return str(number) == str(number)[::-1] def to_binary(number): return bin(number).replace('0b', '') def main(number): palindromes = [] for n in range(1, number + 1): if is_palindrome(n): ...
def is_palindrome(number): n = str(number) if n.startswith('0'): return False return str(number) == str(number)[::-1] def to_binary(number): return bin(number).replace('0b', '') def main(number): palindromes = [] for n in range(1, number + 1): if is_palindrome(n): b...
class Node: def __init__(self): self.left = None self.right = None self.value = 0 def is_less_than_max(value, max_value): return value < max_value if max_value != -1 else True def is_bst(node, min_value, max_value): if node is None: return True if min_value < node.val...
class Node: def __init__(self): self.left = None self.right = None self.value = 0 def is_less_than_max(value, max_value): return value < max_value if max_value != -1 else True def is_bst(node, min_value, max_value): if node is None: return True if min_value < node.valu...
class model(): def __init__(self): print("Initialising model") def process(self, frame): raise NotImplementedError("Add this function")
class Model: def __init__(self): print('Initialising model') def process(self, frame): raise not_implemented_error('Add this function')
class GeneralizeStorageLocationException(Exception): pass class UninitializedStorageLocationException(Exception): pass
class Generalizestoragelocationexception(Exception): pass class Uninitializedstoragelocationexception(Exception): pass
mod = 1000000007 dp = [[0] * 6 for _ in range(1010)] n = int(input()) for i in range(1, n + 1): dp[i][0] = 1 dp[i][1] = (dp[i - 1][0] + dp[i - 1][1] * 2) % mod dp[i][2] = (dp[i - 1][0] + dp[i - 1][2]) % mod dp[i][3] = (dp[i - 1][1] + dp[i - 1][3] * 2) % mod dp[i][4] = (dp[i - 1][1] + d...
mod = 1000000007 dp = [[0] * 6 for _ in range(1010)] n = int(input()) for i in range(1, n + 1): dp[i][0] = 1 dp[i][1] = (dp[i - 1][0] + dp[i - 1][1] * 2) % mod dp[i][2] = (dp[i - 1][0] + dp[i - 1][2]) % mod dp[i][3] = (dp[i - 1][1] + dp[i - 1][3] * 2) % mod dp[i][4] = (dp[i - 1][1] + dp[i - 1][2] + ...
# A =[3, 1, 2, 4, 3] # For this one, it is important to re-use previous calculations. For instance: # (A[0] + A[1] + A[2]) = (A[0] + A[1]) + A[2] def solution(A): # head = A[0] tail = sum(A[1:]) min_dif = abs(head - tail) # Important not to include the first and last element for index in range(1...
def solution(A): head = A[0] tail = sum(A[1:]) min_dif = abs(head - tail) for index in range(1, len(A) - 1): head += A[index] tail -= A[index] if abs(head - tail) < min_dif: min_dif = abs(head - tail) return min_dif
# Generated by rpcgen.py from /home/nickolai/proj/go-rpcgen/rfc1057/prot.x on Fri Dec 6 10:47:00 2019 FALSE = 0 TRUE = 1 AUTH_NONE = 0 AUTH_UNIX = 1 AUTH_SHORT = 2 AUTH_DES = 3 auth_flavor = { 0 : 'AUTH_NONE', 1 : 'AUTH_UNIX', 2 : 'AUTH_SHORT', 3 : 'AUTH_DES', } CALL = 0 REPLY = 1 msg_type = { 0 : ...
false = 0 true = 1 auth_none = 0 auth_unix = 1 auth_short = 2 auth_des = 3 auth_flavor = {0: 'AUTH_NONE', 1: 'AUTH_UNIX', 2: 'AUTH_SHORT', 3: 'AUTH_DES'} call = 0 reply = 1 msg_type = {0: 'CALL', 1: 'REPLY'} msg_accepted = 0 msg_denied = 1 reply_stat = {0: 'MSG_ACCEPTED', 1: 'MSG_DENIED'} success = 0 prog_unavail = 1 p...
# https://www.hackerrank.com/challenges/python-mutations/problem def mutate_string(string, position, character): string = list(string) string[position] = character return "".join(string)
def mutate_string(string, position, character): string = list(string) string[position] = character return ''.join(string)
reg_list=[ # exmaple: # ["ISR","uint64_t","MEM_MAPPED",["NS",1,"RES0_0",2]], #distributor ["GICD_CTLR","uint32_t","MEM_MAPPED",[["EnableGrp0",1, "EnableGrp1NS",1, "EnableGrp1S",1, "RES0_0",1, "ARE_S",1, "ARE_NS",1, "DS",1, "E1NWF",1, "RES0_1",23, "RWP",1 ]] ], #cpu-system-side ...
reg_list = [['GICD_CTLR', 'uint32_t', 'MEM_MAPPED', [['EnableGrp0', 1, 'EnableGrp1NS', 1, 'EnableGrp1S', 1, 'RES0_0', 1, 'ARE_S', 1, 'ARE_NS', 1, 'DS', 1, 'E1NWF', 1, 'RES0_1', 23, 'RWP', 1]]], ['ICC_BPR0_EL1', 'uint32_t', 'GCC_REPR', [['BinaryPoint', 3, 'RES0', 29]]], ['ICC_BPR1_EL1', 'uint32_t', 'GCC_REPR', [['Binary...
def countsubarray(nums, k): if k <= 1: return 0 prod = 1 ans = left = 0 for right, val in enumerate(nums): prod *= val while prod >= k: prod /= nums[left] left += 1 ans += right - left + 1 return ans t = int(input()) for _ in range(t): n,k = map(in...
def countsubarray(nums, k): if k <= 1: return 0 prod = 1 ans = left = 0 for (right, val) in enumerate(nums): prod *= val while prod >= k: prod /= nums[left] left += 1 ans += right - left + 1 return ans t = int(input()) for _ in range(t): (n...
N, M = map(int, input().split()) set_list = [] for i in range(M): x, y = map(int, input().split()) set_list.append({x, y}) max_num = 1 for i in range(2**N): binary = format(i, 'b').zfill(N+2)[2:] group = [] for j in range(N): if binary[j] == '1': group.append(j+1) failed = Fa...
(n, m) = map(int, input().split()) set_list = [] for i in range(M): (x, y) = map(int, input().split()) set_list.append({x, y}) max_num = 1 for i in range(2 ** N): binary = format(i, 'b').zfill(N + 2)[2:] group = [] for j in range(N): if binary[j] == '1': group.append(j + 1) f...
N = (int(input())) i = 0 while i < N - 2: i = i + 2 print(i)
n = int(input()) i = 0 while i < N - 2: i = i + 2 print(i)
class Ability(): def __init__(self, name, value): self.name=name self.value=value self.modifier=0 self.setModifier() def setModifier(self): if self.value>=10: self.modifier=(self.value-10)//2 else: self.modifier=(self.value-10)//2 class Defense(): def __init__(self, charlevel, abilitymodifier): ...
class Ability: def __init__(self, name, value): self.name = name self.value = value self.modifier = 0 self.setModifier() def set_modifier(self): if self.value >= 10: self.modifier = (self.value - 10) // 2 else: self.modifier = (self.value...
print(2.0/2) print(7.0//2) print(-5//4) print(8%3) print(455643/17.43) a=10 b=30 print(a/b) a=4.445*10**8 b=5*10**6 c=(b*10)/100 d=b-c print(d) g=b+a print(g) f=(b*5)/100 e=b-f print(e)
print(2.0 / 2) print(7.0 // 2) print(-5 // 4) print(8 % 3) print(455643 / 17.43) a = 10 b = 30 print(a / b) a = 4.445 * 10 ** 8 b = 5 * 10 ** 6 c = b * 10 / 100 d = b - c print(d) g = b + a print(g) f = b * 5 / 100 e = b - f print(e)
def __binary_search(leafs, l, r, d): result = 0 while l <= r: mid = (l + r) // 2 if leafs[mid] < d: l = mid + 1 result = mid + 1 else: r = mid - 1 return result def solution(leafs): leafs.sort() n = len(leafs) answer = 0 for i in ...
def __binary_search(leafs, l, r, d): result = 0 while l <= r: mid = (l + r) // 2 if leafs[mid] < d: l = mid + 1 result = mid + 1 else: r = mid - 1 return result def solution(leafs): leafs.sort() n = len(leafs) answer = 0 for i in r...
# Problem: https://www.hackerrank.com/challenges/python-string-split-and-join/problem def split_and_join(line): return "-".join(line.split(' ')) line = input() result = split_and_join(line) print(result)
def split_and_join(line): return '-'.join(line.split(' ')) line = input() result = split_and_join(line) print(result)
# # If you prefer some of the entries are preloaded with values # just complete the entries according using this keys as examples # #default = { # 'hostname': 'replace_with_hostname', # 'username': 'replace_with_user', ## 'password': 'replace_with_password', # 'directory': 'replace_with_directory', ## 'p...
default = {}
class FlowerCareException(Exception): ''' Flower Care exception ''' pass
class Flowercareexception(Exception): """ Flower Care exception """ pass
# Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project au...
{'includes': ['../build/common.gypi'], 'targets': [{'target_name': 'rtc_media', 'type': 'static_library', 'dependencies': ['<(webrtc_root)/base/base.gyp:rtc_base_approved', '<(webrtc_root)/common.gyp:webrtc_common', '<(webrtc_root)/webrtc.gyp:webrtc', '<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine', '<(webr...
def asset_path(model, asset_name): if not hasattr(model, '__tfi_asset_path__'): return None return model.__tfi_asset_path__(asset_name)
def asset_path(model, asset_name): if not hasattr(model, '__tfi_asset_path__'): return None return model.__tfi_asset_path__(asset_name)
# IDLE (Python 3.8.0) # YMDHMS (Years, Months, Days, Hours, Minutes, Seconds) def WAF(FrO, O, ScO): # WAF means Whole And Fraction. # FrO means First Operand and is a value of a variable. # O means Operator and is a string of an operator symbol. # ScO means Second Operand and is a value of a variable....
def waf(FrO, O, ScO): if O == ' + ': sum = FrO + ScO whole = int(Sum) fraction = Sum - Whole return (Whole, Fraction) elif O == ' - ': remainder = FrO - ScO whole = int(Remainder) fraction = Remainder - Whole return (Whole, Fraction) elif O == ...
class DirectedAdjacencyMatrix: def __init__(self, n): self.n = n self.data = [[0] * n for i in range(n)] def connect(self, i_from, i_to): self.data[i_from][i_to] += 1 def disconnect(self, i_from, i_to): self.data[i_from][i_to] = max(0, self.data[i_from][i_to] - 1) def ...
class Directedadjacencymatrix: def __init__(self, n): self.n = n self.data = [[0] * n for i in range(n)] def connect(self, i_from, i_to): self.data[i_from][i_to] += 1 def disconnect(self, i_from, i_to): self.data[i_from][i_to] = max(0, self.data[i_from][i_to] - 1) def...
class TeachersParser: def __init__(self, file,days_mapping): self.file = file self.days_mapping = days_mapping def parse_teachers(self): teachers = {} for record in self.file: name = record['osoba'] if name is not None and name != '': fe...
class Teachersparser: def __init__(self, file, days_mapping): self.file = file self.days_mapping = days_mapping def parse_teachers(self): teachers = {} for record in self.file: name = record['osoba'] if name is not None and name != '': fe...
class Material: def __init__(self): self.data = {} self.data["mesh_color"] = [1.0, 1.0, 1.0, 1.0] def assign_material(self, index, value): self.data[index] = value def get_material_data(self): return self.data def get_copy(self): mat = Material() ...
class Material: def __init__(self): self.data = {} self.data['mesh_color'] = [1.0, 1.0, 1.0, 1.0] def assign_material(self, index, value): self.data[index] = value def get_material_data(self): return self.data def get_copy(self): mat = material() for n...
# https://www.interviewbitcom/problems/grid-unique-paths/ # Grid Unique Path # Input : A = 2, B = 2 # Output : 2 # 2 possible routes : (0, 0) -> (0, 1) -> (1, 1) # OR : (0, 0) -> (1, 0) -> (1, 1) class Solution: # @param A : integer # @param B : integer # @return an integer def uniqu...
class Solution: def unique_paths(self, rows, cols): if rows == 1 or cols == 1: return 1 a = [[1] + [0] * (cols - 1)] * rows a[0] = [1] * cols for i in range(1, rows): for j in range(1, cols): a[i][j] = a[i - 1][j] + a[i][j - 1] return ...
# To Do: Figure out the base item classes for use in the scripting language class Item(): # The Base Class for All Items def __init__(self, name, description, value): if type(name) != str: raise TypeError("Name must be a string") self.name = name if type(descripti...
class Item: def __init__(self, name, description, value): if type(name) != str: raise type_error('Name must be a string') self.name = name if type(description) != str: raise type_error('Description must be a string') self.description = description if ...
X=1234567891.1234 X=int(X) #1234567890 X=str(X) #"1234567890" X=X[4] #computer starts at 0 print(X)
x = 1234567891.1234 x = int(X) x = str(X) x = X[4] print(X)
# -*- coding: utf-8 -*- class GildedRose(object): def __init__(self, items): self.items = items def update_quality(self): for item in self.items: item.update() class Item: def __init__(self, name, sell_in, quality): self.name = name self.sell_in = sell_in ...
class Gildedrose(object): def __init__(self, items): self.items = items def update_quality(self): for item in self.items: item.update() class Item: def __init__(self, name, sell_in, quality): self.name = name self.sell_in = sell_in self.quality = quali...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"Learner.one_batch": "00_core.ipynb", "unrar": "00_core.ipynb", "extract_frames": "00_core.ipynb", "avi2frames": "00_core.ipynb", "get_instances": "00_core.ipynb", ...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'Learner.one_batch': '00_core.ipynb', 'unrar': '00_core.ipynb', 'extract_frames': '00_core.ipynb', 'avi2frames': '00_core.ipynb', 'get_instances': '00_core.ipynb', 'Path.ls_sorted': '00_core.ipynb', 'ImageTuple': '00_core.ipynb', 'ImageTupleTfm': '0...
LANGUAGES = None BASE_URL = '/' STATIC_URL = '/' DEFAULT_PAGE = None DEFAULT_LANGUAGE = None LAYOUTS = {} BUNDLES = {} ORDERING = {} PAGINATION = {} PAGE_NAME = 'page%i'
languages = None base_url = '/' static_url = '/' default_page = None default_language = None layouts = {} bundles = {} ordering = {} pagination = {} page_name = 'page%i'
limit = int(input("Enter upper limit:")) c = 0 m = 2 while c < limit: for n in range(1, m + 1): a = m * m - n * n b = 2 * m * n c = m * m + n * n if c > limit: break if a == 0 or b == 0 or c == 0: break print(a, b, c) m = m + 1
limit = int(input('Enter upper limit:')) c = 0 m = 2 while c < limit: for n in range(1, m + 1): a = m * m - n * n b = 2 * m * n c = m * m + n * n if c > limit: break if a == 0 or b == 0 or c == 0: break print(a, b, c) m = m + 1
#-----Read data from 2008 flt2008=pd.read_csv('2008.csv') print("shape of dataset : ", flt2008.shape) print("Features in dataset : ", flt2008.columns) print("No of features in dataset : ", flt2008.columns.shape) # shape of dataset : s(7009728, 29) # Features in dataset : Index(['Year', 'Month', 'DayofMonth', 'Da...
flt2008 = pd.read_csv('2008.csv') print('shape of dataset : ', flt2008.shape) print('Features in dataset : ', flt2008.columns) print('No of features in dataset : ', flt2008.columns.shape) flt2008 = flt2008[flt2008['Cancelled'] == 0] flt2008.drop(['Cancelled', 'CancellationCode', 'CarrierDelay', 'WeatherDelay', 'NASDela...
# Version info __version__ = '0.2.6' __license__ = 'MIT' # Project description(s) __description__ = 'First order optimization tools' # The project's main homepage. __url__ = 'https://github.com/nirum/descent' # Author details __author__ = 'Niru Maheswaranathan' __author_email__ = 'niru@fastmail.com'
__version__ = '0.2.6' __license__ = 'MIT' __description__ = 'First order optimization tools' __url__ = 'https://github.com/nirum/descent' __author__ = 'Niru Maheswaranathan' __author_email__ = 'niru@fastmail.com'
def getID(i,j): return ("%05d%05d")%(i,j) def getIDL(i,j): return ("%08d%08d")%(i,j) def getIDFour(i,j,m,n): return ("%05d%05d%05d%05d")%(i,j,m,n)
def get_id(i, j): return '%05d%05d' % (i, j) def get_idl(i, j): return '%08d%08d' % (i, j) def get_id_four(i, j, m, n): return '%05d%05d%05d%05d' % (i, j, m, n)
def average_number(*args): return sum(args, 0.0) / len(args) average_number(6, 9, 10)
def average_number(*args): return sum(args, 0.0) / len(args) average_number(6, 9, 10)
#2 for row in range(10): for col in range(10): if (row==9 )or (col+row==9 and row!=0 and row!=2 and row!=1)or (row==2 and col==6)or (row==1 and col==6)or (row==0 and col==5)or (row==0 and col==4)or (row==0 and col==3)or (row==1 and col==2): print("*",end=" ") else: pri...
for row in range(10): for col in range(10): if row == 9 or (col + row == 9 and row != 0 and (row != 2) and (row != 1)) or (row == 2 and col == 6) or (row == 1 and col == 6) or (row == 0 and col == 5) or (row == 0 and col == 4) or (row == 0 and col == 3) or (row == 1 and col == 2): print('*', end...
# Challenge 52, easy # https://www.reddit.com/r/dailyprogrammer/comments/tmnfq/5142012_challenge_52_easy/ word_list = ['Shoe', 'Hat', "ZZTop", "Aa"] def get_value(word): new_letter_values = [ord(letter.upper()) - 64 for letter in word] return sum(new_letter_values) print(sorted(word_list, key = get_value))
word_list = ['Shoe', 'Hat', 'ZZTop', 'Aa'] def get_value(word): new_letter_values = [ord(letter.upper()) - 64 for letter in word] return sum(new_letter_values) print(sorted(word_list, key=get_value))
# 2020.09.18 # Problem Statement: # https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/ class Solution: def removeDuplicates(self, nums: List[int]) -> int: # do early return if len(nums) <= 2: return len(nums) # count counts for the occurance of the current element ...
class Solution: def remove_duplicates(self, nums: List[int]) -> int: if len(nums) <= 2: return len(nums) count = 1 index = 1 while True: if index > len(nums) - 1: break if nums[index] == nums[index - 1]: count = cou...
#Input Format n = int(input()) for i in range(1, 11): #Output Format print(str(n) + " x " + str(i) + " = " + str(n * i))
n = int(input()) for i in range(1, 11): print(str(n) + ' x ' + str(i) + ' = ' + str(n * i))
tipo=0 alcohol=0 gasolina=0 diesel=0 while True: tipo=int(input("")) if tipo==1: alcohol=alcohol+1 elif tipo==2: gasolina=gasolina+1 elif tipo==3: diesel=diesel+1 elif tipo==4: break print("MUITO OBRIGADO") print("Alcool: "+str(alcohol)) print("Gasolina: "+str(gasolin...
tipo = 0 alcohol = 0 gasolina = 0 diesel = 0 while True: tipo = int(input('')) if tipo == 1: alcohol = alcohol + 1 elif tipo == 2: gasolina = gasolina + 1 elif tipo == 3: diesel = diesel + 1 elif tipo == 4: break print('MUITO OBRIGADO') print('Alcool: ' + str(alcohol)...
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/apple/catkin_ws/src/hd_map/msg/element.msg;/home/apple/catkin_ws/src/hd_map/msg/elements.msg" services_str = "" pkg_name = "hd_map" dependencies_str = "std_msgs;sensor_msgs" langs = "gencpp;geneus;genlisp;gennodejs;genpy" dep_include_paths_str =...
messages_str = '/home/apple/catkin_ws/src/hd_map/msg/element.msg;/home/apple/catkin_ws/src/hd_map/msg/elements.msg' services_str = '' pkg_name = 'hd_map' dependencies_str = 'std_msgs;sensor_msgs' langs = 'gencpp;geneus;genlisp;gennodejs;genpy' dep_include_paths_str = 'hd_map;/home/apple/catkin_ws/src/hd_map/msg;std_msg...
original = input().split() new = [int(i) for i in original] new.sort() for i in new: print(i) print('') for k in original: print(k)
original = input().split() new = [int(i) for i in original] new.sort() for i in new: print(i) print('') for k in original: print(k)
expected_output = { "oper_state": { "admin_enabled" : False, "oper_up" : False } }
expected_output = {'oper_state': {'admin_enabled': False, 'oper_up': False}}
# https://leetcode.com/problems/paint-fence/ # --------------------------------------------------- # Runtime Complexity: O(N) # Space Complexity: O(1) class Solution: def numWays(self, n: int, k: int) -> int: if n == 0: return 0 if n == 1: return k same_color = k ...
class Solution: def num_ways(self, n: int, k: int) -> int: if n == 0: return 0 if n == 1: return k same_color = k diff_color = k * (k - 1) for i in range(2, n): tmp = diff_color diff_color = (diff_color + same_color) * (k - 1) ...
def main(): input_int = input("Choose a number(1): ") input_int2 = input("Choose another number(2): ") if represents_int(input_int) and represents_int(input_int2): return print("Both values are ints. sum= %i" %(int(input_int) + int(input_int2))) return print("One or more of the values is not a...
def main(): input_int = input('Choose a number(1): ') input_int2 = input('Choose another number(2): ') if represents_int(input_int) and represents_int(input_int2): return print('Both values are ints. sum= %i' % (int(input_int) + int(input_int2))) return print('One or more of the values is not an...
# Error classes for peripherals # # Luz micro-controller simulator # Eli Bendersky (C) 2008-2010 # class PeripheralError(Exception): pass class PeripheralMemoryError(Exception): pass class PeripheralMemoryAlignError(PeripheralMemoryError): pass class PeripheralMemoryAccessError(PeripheralMemoryError): pass
class Peripheralerror(Exception): pass class Peripheralmemoryerror(Exception): pass class Peripheralmemoryalignerror(PeripheralMemoryError): pass class Peripheralmemoryaccesserror(PeripheralMemoryError): pass
#!/usr/bin/env python3 code_0 = 0 code_1 = 1 code_a = "a" code_b = "b" l_b = {code_a} l_c = {code_b: code_0} if __name__ == "__main__": assert "a" in l_b # Dereferencing items in the dict fails on Rust. # Dict compare 'in' does not work on Dart # Print of sets and dicts fails on Rust print("OK...
code_0 = 0 code_1 = 1 code_a = 'a' code_b = 'b' l_b = {code_a} l_c = {code_b: code_0} if __name__ == '__main__': assert 'a' in l_b print('OK')
#!/usr/bin/env python # -*- coding:utf-8 -*- ''' @author: ?? @file: __init__.py.py @time: 2018/8/23 10:18 @desc: '''
""" @author: ?? @file: __init__.py.py @time: 2018/8/23 10:18 @desc: """
def countdown(i): if i < 1: return 0 else: print(i) countdown(i - 1) number = int(input()) countdown(number)
def countdown(i): if i < 1: return 0 else: print(i) countdown(i - 1) number = int(input()) countdown(number)
class Solution: def removeDuplicates(self, nums): cur = 0 for i in range(len(nums)): if nums[cur] != nums[i]: cur += 1 nums[cur] = nums[i] print(cur + 1) return(cur + 1) obj = Solution() obj.removeDuplicates([1,1,2]) obj.removeDuplicates...
class Solution: def remove_duplicates(self, nums): cur = 0 for i in range(len(nums)): if nums[cur] != nums[i]: cur += 1 nums[cur] = nums[i] print(cur + 1) return cur + 1 obj = solution() obj.removeDuplicates([1, 1, 2]) obj.removeDuplicates...
# from enum import IntEnum class __Error__(): def __init__(self, code, msg): self.code = code self.msg = msg def __str__(self): return f'[{self.code}] {self.msg}' class ExceptionApp(Exception): def __init__(self, error, *args): self.errCode = error.code self.errMsg = error.msg.format(*args)...
class __Error__: def __init__(self, code, msg): self.code = code self.msg = msg def __str__(self): return f'[{self.code}] {self.msg}' class Exceptionapp(Exception): def __init__(self, error, *args): self.errCode = error.code self.errMsg = error.msg.format(*args) ...
#Program for Odd Even a=int(input("Enter positive integer ")) if a%2==0: print("The given number ",a,"is even") else: print("The given number ",a,"is odd")
a = int(input('Enter positive integer ')) if a % 2 == 0: print('The given number ', a, 'is even') else: print('The given number ', a, 'is odd')
def printHam(self): print('ham') class myclass(object): def __init__(self): self.x = 5 TypeClass = type("TypeClass", (), {"x": 5, "printHam": printHam}) m = myclass() t = TypeClass() print(m.x, t.x) print(m == t) print(type(m)) t.printHam()
def print_ham(self): print('ham') class Myclass(object): def __init__(self): self.x = 5 type_class = type('TypeClass', (), {'x': 5, 'printHam': printHam}) m = myclass() t = type_class() print(m.x, t.x) print(m == t) print(type(m)) t.printHam()
''' speed: 89.11% memory: 21:02% N = len(S), A = 1~26(size of diff alpabet) ex) aab, N=3, A=2 time complexity: O(A * (N + logA)) space complexity: O(N) ''' class Solution: def reorganizeString(self, S: str) -> str: n = len(S) a= [] for c,x in sorted((S.count(x), x) for x in set(S)):...
""" speed: 89.11% memory: 21:02% N = len(S), A = 1~26(size of diff alpabet) ex) aab, N=3, A=2 time complexity: O(A * (N + logA)) space complexity: O(N) """ class Solution: def reorganize_string(self, S: str) -> str: n = len(S) a = [] for (c, x) in sorted(((S.count(x), x) for x in set(S))):...
def permutationIsAPalindrome(inString): seenDict = {} for character in inString: if character not in seenDict: seenDict[character] = 1 else: del seenDict[character] return len(seenDict.keys()) <= 1 def main(): testCaseList = [] testCaseList.append(["civic"...
def permutation_is_a_palindrome(inString): seen_dict = {} for character in inString: if character not in seenDict: seenDict[character] = 1 else: del seenDict[character] return len(seenDict.keys()) <= 1 def main(): test_case_list = [] testCaseList.append(['civ...
a = 4 b = 5 # Operator (=) assigns the value to variable print(a, "is of type", type(a)) print(a + b) print(4 + 5) print(a - a * b) print(25 - 3 * 6) print((20 - 3 * 7) / 2) print(9 / 5) c = b / a # division returns a floating point number print(c, "is of type", type(c)) print(c) # No need to explicitly decl...
a = 4 b = 5 print(a, 'is of type', type(a)) print(a + b) print(4 + 5) print(a - a * b) print(25 - 3 * 6) print((20 - 3 * 7) / 2) print(9 / 5) c = b / a print(c, 'is of type', type(c)) print(c) a = 4 b = 5 d = b // a print(d) print(d, 'is of type', type(d)) print(-7 / 5) print(7 / 5) print(-7 // 5) a = 7 b = 5 e = b ** ...
ES_HOST = 'localhost:9200' ES_INDEX = 'pending-go_bp' ES_DOC_TYPE = 'geneset' API_PREFIX = 'go_bp' API_VERSION = ''
es_host = 'localhost:9200' es_index = 'pending-go_bp' es_doc_type = 'geneset' api_prefix = 'go_bp' api_version = ''
# Copyright 2020 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. DEPS = [ 'flutter/firebase', 'recipe_engine/path', ] def RunSteps(api): docs_path = api.path['start_dir'].join('flutter', 'dev', 'docs') api.fi...
deps = ['flutter/firebase', 'recipe_engine/path'] def run_steps(api): docs_path = api.path['start_dir'].join('flutter', 'dev', 'docs') api.firebase.deploy_docs({}, {}, docs_path, 'myproject') def gen_tests(api): yield api.test('basic')
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right # Diameter = 1+ max depth of left and max depth of right # use DFS to recursively find left and right nodes class Solution: ...
class Solution: def diameter_of_binary_tree(self, root: TreeNode) -> int: self.ans = 1 def depth(p): if not p: return 0 left = depth(p.left) right = depth(p.right) self.ans = max(self.ans, left + right + 1) return max(left...
sieve = [True] * 110000 primes = [] for i in range(2, 110000): if sieve[i] == True: primes.append(i) for j in range(2*i, 110000, i): sieve[j] = False while True: n, p = map(int, input().split()) if n == -1 and p == -1: break cnt = 0 for i in primes: if n < i: ...
sieve = [True] * 110000 primes = [] for i in range(2, 110000): if sieve[i] == True: primes.append(i) for j in range(2 * i, 110000, i): sieve[j] = False while True: (n, p) = map(int, input().split()) if n == -1 and p == -1: break cnt = 0 for i in primes: if...
output = [] with open("iso3166_alpha2_codes.csv") as f: for line in f: output.append(line[0:2]) print(output)
output = [] with open('iso3166_alpha2_codes.csv') as f: for line in f: output.append(line[0:2]) print(output)
class Solution: def finalValueAfterOperations(self, operations: List[str]) -> int: x = 0 # counter = collections.Counter(operations) # print(counter) # for operation, count in counter.items(): # if operation == "X++" or operation == "++X": # ...
class Solution: def final_value_after_operations(self, operations: List[str]) -> int: x = 0 for operation in operations: if operation == 'X++' or operation == '++X': x += 1 else: x -= 1 return x
class Policy(object): ''' Encapsulates a policy document for an S3 POST request. http://docs.aws.amazon.com/AmazonS3/latest/dev/HTTPPOSTForms.html#HTTPPOSTConstructPolicy expiration: The policy expiration date, a native datetime.datetime object conditions: A list of PolicyCondition objects ...
class Policy(object): """ Encapsulates a policy document for an S3 POST request. http://docs.aws.amazon.com/AmazonS3/latest/dev/HTTPPOSTForms.html#HTTPPOSTConstructPolicy expiration: The policy expiration date, a native datetime.datetime object conditions: A list of PolicyCondition objects ...
GOOGLE_GEOCODE_KEY = 'key' YELP_CONSUMER_KEY = 'key' YELP_CONSUMER_SECRET = 'key' YELP_TOKEN = 'key' YELP_TOKEN_SECRET = 'key' TMDB_KEY = 'key' WA_KEY = 'key' UL_KEY = 'key'
google_geocode_key = 'key' yelp_consumer_key = 'key' yelp_consumer_secret = 'key' yelp_token = 'key' yelp_token_secret = 'key' tmdb_key = 'key' wa_key = 'key' ul_key = 'key'
class Solution: def findAnagrams(self, s: str, p: str) -> List[int]: n = len(s) m = len(p) res = [] if n < m: return s_ct = [0] * 26 p_ct = [0] * 26 for i in range(m): p_ct[ord(p[i]) - ord('a')] += 1 s_ct[ord(s[i]) - ord('a...
class Solution: def find_anagrams(self, s: str, p: str) -> List[int]: n = len(s) m = len(p) res = [] if n < m: return s_ct = [0] * 26 p_ct = [0] * 26 for i in range(m): p_ct[ord(p[i]) - ord('a')] += 1 s_ct[ord(s[i]) - ord('...
#!/usr/bin/env python def override_init(): return { 'init': 'systemd' }
def override_init(): return {'init': 'systemd'}
# -*- coding: utf-8 -*- def get_context_and_entities(request): return request['context'], request['entities'] def get_first_entity_value(entities, entity): if entities is None or entity not in entities: return None value = entities[entity][0]['value'] if not value: return None return value['value'] if isinsta...
def get_context_and_entities(request): return (request['context'], request['entities']) def get_first_entity_value(entities, entity): if entities is None or entity not in entities: return None value = entities[entity][0]['value'] if not value: return None return value['value'] if is...