content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
N = int(input()) p = list(map(int, input().split())) dp = [[False] * (100 * 101) for _ in range(N + 1)] dp[0][0] = True for i in range(N): for j, dpj in enumerate(dp[i - 1]): if dpj: dp[i][j] = True dp[i][j + p[i]] = True ans = 0 for dpi in dp[N - 1]: if dpi is True: ans ...
n = int(input()) p = list(map(int, input().split())) dp = [[False] * (100 * 101) for _ in range(N + 1)] dp[0][0] = True for i in range(N): for (j, dpj) in enumerate(dp[i - 1]): if dpj: dp[i][j] = True dp[i][j + p[i]] = True ans = 0 for dpi in dp[N - 1]: if dpi is True: an...
def get_row(s): s = s[:-3] s = s.replace('F', '0') s = s.replace('B', '1') return int(s, 2) def get_col(s): s = s[-3:] s = s.replace('L', '0') s = s.replace('R', '1') return int(s, 2) def get_code(s): return get_row(s) * 8 + get_col(s) #nums = ["FBFBBFFRLR", "BFFFBBFRRR", "FF...
def get_row(s): s = s[:-3] s = s.replace('F', '0') s = s.replace('B', '1') return int(s, 2) def get_col(s): s = s[-3:] s = s.replace('L', '0') s = s.replace('R', '1') return int(s, 2) def get_code(s): return get_row(s) * 8 + get_col(s) with open('Input.txt') as f: lines = f.rea...
""" utils ~~~~~ Helper routines & 3rd party interfaces can be placed in this module. """
""" utils ~~~~~ Helper routines & 3rd party interfaces can be placed in this module. """
config = { 'label2ind': { 'pos': 0, 'neg': 1 }, 'model_type': 'bert-base-uncased', 'task2ner_rel': { "mte": set([ ('Target', 'Component', 'Contains'), ('Target', 'Property', 'HasProperty') ]), "chemprot":set([('Chemical', 'Protein', 'CPR:3'),('Chemical', 'Protein', 'CPR:4'), ('Chemica...
config = {'label2ind': {'pos': 0, 'neg': 1}, 'model_type': 'bert-base-uncased', 'task2ner_rel': {'mte': set([('Target', 'Component', 'Contains'), ('Target', 'Property', 'HasProperty')]), 'chemprot': set([('Chemical', 'Protein', 'CPR:3'), ('Chemical', 'Protein', 'CPR:4'), ('Chemical', 'Protein', 'CPR:5'), ('Chemical', '...
def print_corr(tica, feat, ic=0, num=20, save=False, outname=None): ''' helpful printing function for finding correlations between features and tICs .. math:: \mathbf{Corr}(X_i - \mu_i, \mathbf{\theta}_j) = \frac{1}{\sigma_{X_i - \mu_i}}\sum_l \sigma_{(X_i - \mu_i)(X_l - \mu_l} \mathbf{U}_{li} ...
def print_corr(tica, feat, ic=0, num=20, save=False, outname=None): """ helpful printing function for finding correlations between features and tICs .. math:: \\mathbf{Corr}(X_i - \\mu_i, \\mathbf{ heta}_j) = \x0crac{1}{\\sigma_{X_i - \\mu_i}}\\sum_l \\sigma_{(X_i - \\mu_i)(X_l - \\mu_l} \\mathbf{U}_{li} ...
x, y = 1, 1 mode = ['L', 'R', 'U', 'D'] move_x = [0, 0, -1, 1] move_y = [-1, 1, 0, 0] n = int(input()) plan = list(input().split()) for s in plan: i = mode.index(s) if s == mode[i]: _x = x + move_x[i] _y = y + move_y[i] if _x < 1 or _x > n or _y < 1 or _y > n: continue x, y = _x, _y print(x...
(x, y) = (1, 1) mode = ['L', 'R', 'U', 'D'] move_x = [0, 0, -1, 1] move_y = [-1, 1, 0, 0] n = int(input()) plan = list(input().split()) for s in plan: i = mode.index(s) if s == mode[i]: _x = x + move_x[i] _y = y + move_y[i] if _x < 1 or _x > n or _y < 1 or (_y > n): continue ...
countries = input().split(', ') capitals = input().split(', ') dd = zip(countries, capitals) result = {x: y for (x, y) in dd} [print(f'{key} -> {value}') for (key, value) in result.items()]
countries = input().split(', ') capitals = input().split(', ') dd = zip(countries, capitals) result = {x: y for (x, y) in dd} [print(f'{key} -> {value}') for (key, value) in result.items()]
def __virtual__(): if __salt__["cmd.which"]("cpanm"): return True return (False, "cpanm is not installed") def install(module, upgrade=True): """ Install or upgrade perl module with cpanm script """ ret = {} # dont upgrade if upgrade = False if is_installed(module) and not upg...
def __virtual__(): if __salt__['cmd.which']('cpanm'): return True return (False, 'cpanm is not installed') def install(module, upgrade=True): """ Install or upgrade perl module with cpanm script """ ret = {} if is_installed(module) and (not upgrade): return ret cmd = 'cp...
class SingletonMetaClass(type): def __init__(cls, name, bases, dict): super(SingletonMetaClass, cls).__init__(name, bases, dict) original_new = cls.__new__ def my_new(_cls, *args, **kwargs): if _cls.instance is None: _cls.instance = original_new(_cls, *args, **kw...
class Singletonmetaclass(type): def __init__(cls, name, bases, dict): super(SingletonMetaClass, cls).__init__(name, bases, dict) original_new = cls.__new__ def my_new(_cls, *args, **kwargs): if _cls.instance is None: _cls.instance = original_new(_cls, *args, **k...
"""Version details for simple-credentials This file shamelessly taken from the requests library/simple-salesforce""" __title__ = 'simple-credentials' __description__ = 'A basic credentials parser.' __url__ = 'https://github.com/mutenpo/simple-credentials' __version__ = '0.0.4' __author__ = 'Po' __author_email__ = 'po...
"""Version details for simple-credentials This file shamelessly taken from the requests library/simple-salesforce""" __title__ = 'simple-credentials' __description__ = 'A basic credentials parser.' __url__ = 'https://github.com/mutenpo/simple-credentials' __version__ = '0.0.4' __author__ = 'Po' __author_email__ = 'po'...
for t in range(int(input())): N = int(input()) P = sorted(list(map(int,input().split())), reverse = True) profit = 0 for i in range(N): if P[i] - i > 0 : profit += P[i] - i else: break print(profit%1000000007)
for t in range(int(input())): n = int(input()) p = sorted(list(map(int, input().split())), reverse=True) profit = 0 for i in range(N): if P[i] - i > 0: profit += P[i] - i else: break print(profit % 1000000007)
""" Copyright (c) Microsoft Corporation. All Rights Reserved. """ """ Licensed under the MIT license. See LICENSE file on the project webpage for details. """ OEMBED_SERVICES = { 'youtube': { 'regex': '(https?:\/\/(www\.)?)(youtube\.com|youtu\.be|youtube\.googleapis.com)\/(?:embed\/|v\/|watch\?v=|watch\?....
""" Copyright (c) Microsoft Corporation. All Rights Reserved. """ ' Licensed under the MIT license. See LICENSE file on the project webpage for details. ' oembed_services = {'youtube': {'regex': '(https?:\\/\\/(www\\.)?)(youtube\\.com|youtu\\.be|youtube\\.googleapis.com)\\/(?:embed\\/|v\\/|watch\\?v=|watch\\?.+&amp;v=|...
""" https://www.hackerrank.com/contests/projecteuler/challenges/euler016 Project Euler #16: Power digit sum """ #!/bin/python3 for _ in range(int(input())): num = list(str(2**int(input()))) print(sum([int(x) for x in num]))
""" https://www.hackerrank.com/contests/projecteuler/challenges/euler016 Project Euler #16: Power digit sum """ for _ in range(int(input())): num = list(str(2 ** int(input()))) print(sum([int(x) for x in num]))
class Node(): def __init__(self, val, next=None, prev=None): self.item = val self.next = next self.prev = prev class LinkedList(): def __init__(self): self.first = None self.last = None def add_first(self, val): if self.first == None: self.first =...
class Node: def __init__(self, val, next=None, prev=None): self.item = val self.next = next self.prev = prev class Linkedlist: def __init__(self): self.first = None self.last = None def add_first(self, val): if self.first == None: self.first = ...
lovely_loveseat_description = """ Lovely Loveseat. Tufted polyester blend on wood. 32 inches high x 40 inches wide x 30 inches deep. Red or white. """ lovely_loveseat_price = 254.00 stylish_settee_description = """ Stylish Settee. Faux leather on birch. 29.50 inches high x 54.75 inches wide x 28 inches ...
lovely_loveseat_description = '\nLovely Loveseat. Tufted polyester blend on wood. 32 inches high x 40 inches wide x 30 inches deep. Red or white.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t' lovely_loveseat_price = 254.0 stylish_settee_description = '\nStylish Settee. Faux leather on birch. 29.50 inches high x 54.75 inches wide x ...
"""Constants of the aqara protocol""" MCAST_ADDR = "224.0.0.50" MCAST_PORT = 4321 LISTEN_IP = "0.0.0.0" LISTEN_PORT = 9898 GATEWAY_PORT = 9898 AQARA_DEVICE_HT = 'sensor_ht' AQARA_DEVICE_MOTION = 'motion' AQARA_DEVICE_MAGNET = 'magnet' AQARA_DEVICE_SWITCH = 'switch' AQARA_DEVICE_GATEWAY = 'gateway' AQARA_SWITCH_ACT...
"""Constants of the aqara protocol""" mcast_addr = '224.0.0.50' mcast_port = 4321 listen_ip = '0.0.0.0' listen_port = 9898 gateway_port = 9898 aqara_device_ht = 'sensor_ht' aqara_device_motion = 'motion' aqara_device_magnet = 'magnet' aqara_device_switch = 'switch' aqara_device_gateway = 'gateway' aqara_switch_action_c...
a = 1 b = 2 c = 3 dd = 4 efg = 6666
a = 1 b = 2 c = 3 dd = 4 efg = 6666
""" Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. """ class Solution(object): def generateParanthesisHelper(self, left, right, current, result, n): if right == 0: result.append(current) if left > 0: self.generatePara...
""" Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. """ class Solution(object): def generate_paranthesis_helper(self, left, right, current, result, n): if right == 0: result.append(current) if left > 0: self.generateP...
class Solution(object): def twoSum(self, nums: list[int], target: int) -> list[int]: """ :type nums: List[int] :type target: int :rtype: List[int] """ dict = {} for index,number in enumerate(nums): if number in dict: retur...
class Solution(object): def two_sum(self, nums: list[int], target: int) -> list[int]: """ :type nums: List[int] :type target: int :rtype: List[int] """ dict = {} for (index, number) in enumerate(nums): if number in dict: return [di...
""" Backend structure of web application AutoGram. .. module:: backend :platform: Unix :synopsis: Backend structure of web application AutoGram. .. moduleauthor:: Jakub Drahos <drahoja9@fit.cvut.cz>, Dominika Kralikova <kralidom@fit.cvut.cz> """ class AlgorithmTypes: """ Simple enum class represe...
""" Backend structure of web application AutoGram. .. module:: backend :platform: Unix :synopsis: Backend structure of web application AutoGram. .. moduleauthor:: Jakub Drahos <drahoja9@fit.cvut.cz>, Dominika Kralikova <kralidom@fit.cvut.cz> """ class Algorithmtypes: """ Simple enum class represen...
def listify(obj): """ Wraps all non-list or tuple objects in a list; provides a simple way to accept flexible arguments. """ if obj is None: return [] else: return obj if isinstance(obj, (list, tuple, type(None))) else [obj]
def listify(obj): """ Wraps all non-list or tuple objects in a list; provides a simple way to accept flexible arguments. """ if obj is None: return [] else: return obj if isinstance(obj, (list, tuple, type(None))) else [obj]
peptide = 'NIIDV' #peptide = 'NQEL' #peptide = 'MPYENCCCWMFNIRKGQPDFFRKGAVPYVVPMNCIRWS' #peptide = 'HCKCDMKGWECEWSGRKDFTNYESSQLDGRTKMIHSCCK' amino_acid_mass = {'G':57,'A':71,'S':87,'P':97,'V':99,'T':101,'C':103,'I':113,'L':113, 'N':114,'D':115,'K':128,'Q':128,'E':129,'M':131,'H':137,'F':147, ...
peptide = 'NIIDV' amino_acid_mass = {'G': 57, 'A': 71, 'S': 87, 'P': 97, 'V': 99, 'T': 101, 'C': 103, 'I': 113, 'L': 113, 'N': 114, 'D': 115, 'K': 128, 'Q': 128, 'E': 129, 'M': 131, 'H': 137, 'F': 147, 'R': 156, 'Y': 163, 'W': 186} def linear_spectrum(peptide, amino_acid_mass): prefix_mass = [0] for i in range...
""" Events and global state for controlling the validation actions. """
""" Events and global state for controlling the validation actions. """
# Matrix Search # https://www.interviewbit.com/problems/matrix-search/ # # Write an efficient algorithm that searches for a value in an m x n matrix. # # This matrix has the following properties: # # Integers in each row are sorted from left to right. # The first integer of each row is greater than or e...
class Solution: def binary_search(self, A, B): (low, high) = (0, len(A) - 1) while low <= high: mid = (low + high) // 2 if A[mid] == B: return 1 elif B < A[mid]: high = mid - 1 else: low = mid + 1 ...
def iterator_mean(iterator): n = 0 sum_value = 0.0 for value in iterator: sum_value += value n += 1 return sum_value / n
def iterator_mean(iterator): n = 0 sum_value = 0.0 for value in iterator: sum_value += value n += 1 return sum_value / n
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 OpenStack Foundation # # 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 # # Unle...
registry = {} _future_dependencies = {} _future_optionals = {} class Unresolvabledependencyexception(Exception): def __init__(self, name): msg = 'Unregistered dependency: %s' % name super(UnresolvableDependencyException, self).__init__(msg) def provider(name): """Register the wrapped dependen...
#!/usr/bin/env python3 #------------------------------------------------------------------------------- # Optimal Solution O(n) #------------------------------------------------------------------------------- class Solution: def productExceptSelf(self, nums): """ :type nums: List[int] :rty...
class Solution: def product_except_self(self, nums): """ :type nums: List[int] :rtype: List[int] """ p = 1 output = [] for i in range(len(nums)): output.append(p) p *= nums[i] p = 1 for i in range(len(nums) - 1, -1, -1)...
# Time Complexity: O(n) # Space Complexity: O(1) def is_duplicate(input_string): if len(input_string)>256: return True flags = [False]*256 for char in input_string: if not flags[ord[char]]: flags[ord[char]] else: return True return False
def is_duplicate(input_string): if len(input_string) > 256: return True flags = [False] * 256 for char in input_string: if not flags[ord[char]]: flags[ord[char]] else: return True return False
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def cusip_check(cusip: str) -> bool: if len(cusip) != 9: raise ValueError('CUSIP must be 9 characters') cusip = cusip.upper() total = 0 for i in range(8): c = cusip[i] if c.isdigit(): v = int(c) elif c.isalpha(...
def cusip_check(cusip: str) -> bool: if len(cusip) != 9: raise value_error('CUSIP must be 9 characters') cusip = cusip.upper() total = 0 for i in range(8): c = cusip[i] if c.isdigit(): v = int(c) elif c.isalpha(): p = ord(c) - ord('A') + 1 ...
def resolve(): ''' code here ''' S = input() N = len(S) a_list = [ 0 for _ in range(N+1)] for i in range(N): if S[i] == '<': a_list[i+1] = a_list[i] + 1 # print(a_list) for i in range(N): if S[-1*(i+1)] == '>': a_list[-1*(i+2)] = max(a_list...
def resolve(): """ code here """ s = input() n = len(S) a_list = [0 for _ in range(N + 1)] for i in range(N): if S[i] == '<': a_list[i + 1] = a_list[i] + 1 for i in range(N): if S[-1 * (i + 1)] == '>': a_list[-1 * (i + 2)] = max(a_list[-1 * (i + 1)...
# function my_fun def myfun(): # return 1 return 1 # call myfun myfun()
def myfun(): return 1 myfun()
# Global tax rate taxRate = 0.13 # Data fields used for the item class class Item: def __init__(self, info): self.number = info[0:4] self.intNumber = int(self.number.strip()) self.name = info[8:19].strip() self.price = info[24:30] self.floatPrice = float(self.pri...
tax_rate = 0.13 class Item: def __init__(self, info): self.number = info[0:4] self.intNumber = int(self.number.strip()) self.name = info[8:19].strip() self.price = info[24:30] self.floatPrice = float(self.price.strip()) self.taxed = info[32].strip() if self....
class Solution(object): def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ # Quick exit if not prices: return 0 # First transaction going forward min_price = sys.maxint max_profit = 0 profits = [] ...
class Solution(object): def max_profit(self, prices): """ :type prices: List[int] :rtype: int """ if not prices: return 0 min_price = sys.maxint max_profit = 0 profits = [] for i in range(len(prices)): min_price = min(m...
# BOJ 10250 # bjHotel T = int(input()) for _ in range(T): h, w, n = map(int, input().split()) res = "" cnt = 1 while n > h: n -= h cnt += 1 res += str(n) if cnt < 10: res += "0" res += str(cnt) else: res += str(cnt) print(res)
t = int(input()) for _ in range(T): (h, w, n) = map(int, input().split()) res = '' cnt = 1 while n > h: n -= h cnt += 1 res += str(n) if cnt < 10: res += '0' res += str(cnt) else: res += str(cnt) print(res)
# Definition for a binary tree node class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: # @param A : root node of tree # @return a list of integers # pre order traversal is L R N def pre_order_traversal(self, A): c...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def pre_order_traversal(self, A): current = A if not current: return [] stack1 = [] anser = [] stack2 = [] stack1.append(c...
def count(V): V = sorted([int(v) for v in V.split()]) base = V[0] tot = 0 for i, v in enumerate(V[1:], 1): v -= base steps = v // 5 tot += steps V[i] -= 5 * steps d = v % 5 return tot def add(N, step, V, i): s = N // step if s: V[i] -= s * st...
def count(V): v = sorted([int(v) for v in V.split()]) base = V[0] tot = 0 for (i, v) in enumerate(V[1:], 1): v -= base steps = v // 5 tot += steps V[i] -= 5 * steps d = v % 5 return tot def add(N, step, V, i): s = N // step if s: V[i] -= s * s...
class Field(object): """ A schema field composed of a name and a type. A geometric attribute also contains a :class:`Projection <geoscript.proj.Projection>`. """ def __init__(self, name, typ, proj=None): self.name = name self.typ = typ self.proj = proj def __repr__(self): return '%s: %s' % ...
class Field(object): """ A schema field composed of a name and a type. A geometric attribute also contains a :class:`Projection <geoscript.proj.Projection>`. """ def __init__(self, name, typ, proj=None): self.name = name self.typ = typ self.proj = proj def __repr__(self): ...
''' Pytorch implementation for ResNeXt. Original paper: https://arxiv.org/abs/1611.05431 '''
""" Pytorch implementation for ResNeXt. Original paper: https://arxiv.org/abs/1611.05431 """
# Philius's Request PHILIUS = 1033202 sm.setSpeakerID(PHILIUS) sm.sendNext("Maybe we're the lucky ones. " "While we sleep, Maple World will heal from the terrible things the Black Mage has done. " "I wonder what kind of world we'll wake up to?") response = sm.sendAskYesNo("Your Highness, I w...
philius = 1033202 sm.setSpeakerID(PHILIUS) sm.sendNext("Maybe we're the lucky ones. While we sleep, Maple World will heal from the terrible things the Black Mage has done. I wonder what kind of world we'll wake up to?") response = sm.sendAskYesNo('Your Highness, I will dream of a more beautiful world when we awaken...'...
# Detlev Aschhoff info@vmais.de # 433 RC Remote for Quigg GT 7000, Tevion, GT-FSI-04 # # first 12 bit = Adresse 0 to 11 # 12,13 Units 0=00 1=10 2=11 3=01 4 to 7 same wiith dim bit 16 # 14 Command to all units # 15 1 = on 0 = off oder Dimmer up/ down # 16 0= Switch 1 = Dimmer # 17 allways 0 # 18...
def code(dev): addr = dev['addr'] unit = dev['unit'] state = dev['state'] code = list(bin(int(addr))[2:]) for i in range(12 - len(code)): code.insert(i, '0') for i in range(20 - len(code)): code.append('0') if unit > '3': code[16] = '1' if unit == '0' or unit == '...
class Grafo: def __init__(self): self.vertices = [] self.arestas = {} self.pesos = {} def adiciona_vertice(self,valor): self.vertices.append(valor) self.arestas[valor] = [] def adiciona_aresta(self,origem,destino,peso): if origem not in sel...
class Grafo: def __init__(self): self.vertices = [] self.arestas = {} self.pesos = {} def adiciona_vertice(self, valor): self.vertices.append(valor) self.arestas[valor] = [] def adiciona_aresta(self, origem, destino, peso): if origem not in self.vertices: ...
# ============LICENSE_START======================================================= # Copyright (c) 2020 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use ...
""" """ __docformat__ = 'restructuredtext' def init(): global sw_storm_counter_dict sw_storm_counter_dict = {} global sw_storm_active_dict sw_storm_active_dict = {} global sw_config_oid_dict sw_config_oid_dict = {} global sw_config_low_water_in_interval_dict sw_config_low_water_in_inter...
first_employee_efficiency = int(input()) second_employee_efficiency = int(input()) third_employee_efficiency = int(input()) students_count = int(input())
first_employee_efficiency = int(input()) second_employee_efficiency = int(input()) third_employee_efficiency = int(input()) students_count = int(input())
def binarySearchAscending(array,value): l=0 u=len(array)-1 while l<=u: mid=(l+u)//2 if array[mid]==value: return mid elif array[mid]<value: l=mid+1 else: u=mid-1 return -1 def binarySearchDescending(array,value): l=0 u=len(arra...
def binary_search_ascending(array, value): l = 0 u = len(array) - 1 while l <= u: mid = (l + u) // 2 if array[mid] == value: return mid elif array[mid] < value: l = mid + 1 else: u = mid - 1 return -1 def binary_search_descending(array...
__author__ = 'yinjun' class Solution: def strStr(self, source, target): # write your code here if source == None or target == None: return -1 if source == target: return 0 ls = len(source) lt = len(target) if lt >= ls: ...
__author__ = 'yinjun' class Solution: def str_str(self, source, target): if source == None or target == None: return -1 if source == target: return 0 ls = len(source) lt = len(target) if lt >= ls: return -1 for i in range(ls - lt)...
# -*- coding: utf-8 -*- main_sheet = { "example": "example", }
main_sheet = {'example': 'example'}
# -*- coding: utf-8 -*- """ Created on Sat Mar 21 20:19:45 2020 @author: willi """ def search(arr, item): for i in range(len(arr)): if arr[i] == item: return i return -1 arr = [1, 2, 3, 4] print(search(arr, 5)) print(search(arr, 3)) print(search(arr, 1))
""" Created on Sat Mar 21 20:19:45 2020 @author: willi """ def search(arr, item): for i in range(len(arr)): if arr[i] == item: return i return -1 arr = [1, 2, 3, 4] print(search(arr, 5)) print(search(arr, 3)) print(search(arr, 1))
class Circle: def __init__(self,radius): self.radius=radius def area(self): return (3.14*self.radius*self.radius) def perimeter(self): return (2*3.14*self.radius) radius=int(input("Enter the radius :")) my_obj=Circle(radius) print("Area of the circle: "+str(my_obj.area())) prin...
class Circle: def __init__(self, radius): self.radius = radius def area(self): return 3.14 * self.radius * self.radius def perimeter(self): return 2 * 3.14 * self.radius radius = int(input('Enter the radius :')) my_obj = circle(radius) print('Area of the circle: ' + str(my_obj.are...
# TD Ameritrade API Key # Get one for free at https://developer.tdameritrade.com/ API_KEY = "" # Ticker of the stock you want spreads of, no $ needed SYMBOL = "" # Price where you want the strike to break even TARGET_PRICE = 0 # Price where you do not expect the stock to exceed UPPER_LIMIT = 0 # CONFIDENCE INTERVAL - ...
api_key = '' symbol = '' target_price = 0 upper_limit = 0 ci = 0.1 timeframe_long = True
# Given n nodes labeled from 0 to n-1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make up a valid tree. # # Example 1: # # Input: n = 5, and edges = [[0,1], [0,2], [0,3], [1,4]] # Output: true # Example 2: # # Input: n = 5, and edges = [[0,1], [1,2], [2,3...
class Solution(object): def valid_tree(self, n, edges): """ :type n: int :type edges: List[List[int]] :rtype: bool """ m = [[0 for _ in range(n)] for _ in range(n)] for (i, j) in edges: m[i][j] = 1 visited = set() visited.add(0) ...
""" https://www.hackerrank.com/challenges/one-week-preparation-kit-diagonal-difference/problem """ def _solve_method_1(a): """Literally did this first and was surprised when it didn't work on any other test case, and then found out about the problem inputs.""" first_d = a[0][0] + a[1][1] + a[2][2] sec...
""" https://www.hackerrank.com/challenges/one-week-preparation-kit-diagonal-difference/problem """ def _solve_method_1(a): """Literally did this first and was surprised when it didn't work on any other test case, and then found out about the problem inputs.""" first_d = a[0][0] + a[1][1] + a[2][2] seco...
#-*-coding:utf-8-*- patience = 9 warm_up = 6 patience_decay = {1:0.8,2:0.5,3:0} device = "cuda:0" computer = 'sean' epoch = 20 convert_weight = True weight_dest = "grayE-4" sparse_param = [] # Hyperparameters (j-series, 50.5 mAP yolov3-320) -d by @ktian08 https://github.com/ultralytics/yolov3/issues/310 hyp = {'giou': ...
patience = 9 warm_up = 6 patience_decay = {1: 0.8, 2: 0.5, 3: 0} device = 'cuda:0' computer = 'sean' epoch = 20 convert_weight = True weight_dest = 'grayE-4' sparse_param = [] hyp = {'giou': 1.0, 'cls': 27.76, 'cls_pw': 1.446, 'obj': 31.35, 'obj_pw': 3.941, 'iou_t': 0.2635, 'lr0': 0.001324, 'lrf': -4.0, 'momentum': 0.9...
"""Byte-related utility functions""" def hexstr_to_byte(string: str, pad: bool = True) -> int: """Converts a hexstring to a byte; items less than 4 characters 'wide' are padded""" if pad: return int(string.rjust(4, '0'), 16) return int(string, 16)
"""Byte-related utility functions""" def hexstr_to_byte(string: str, pad: bool=True) -> int: """Converts a hexstring to a byte; items less than 4 characters 'wide' are padded""" if pad: return int(string.rjust(4, '0'), 16) return int(string, 16)
health = 100 bitcoins = 0 you_are_died = False dungeons_zode = input().split('|') for i in range(0, len(dungeons_zode)): room = dungeons_zode[i].split(' ') command = room[0] number = int(room[1]) if command == 'potion': if health + number <= 100: health += number p...
health = 100 bitcoins = 0 you_are_died = False dungeons_zode = input().split('|') for i in range(0, len(dungeons_zode)): room = dungeons_zode[i].split(' ') command = room[0] number = int(room[1]) if command == 'potion': if health + number <= 100: health += number print(f'...
for _ in range(int(input())): a, b = map(int, input().split()) if a < b: a, b = b, a if a > 2 * b: print("NO") elif (a + b) % 3 == 0: print("YES") else: print("NO")
for _ in range(int(input())): (a, b) = map(int, input().split()) if a < b: (a, b) = (b, a) if a > 2 * b: print('NO') elif (a + b) % 3 == 0: print('YES') else: print('NO')
# Created by MechAviv # ID :: [914000200] # Black Road : Burning Forest 1 sm.killMobs() sm.removeSkill(20000014) sm.removeSkill(20000015) sm.giveSkill(20000014) sm.giveSkill(20000015) sm.warp(914000210, 1)
sm.killMobs() sm.removeSkill(20000014) sm.removeSkill(20000015) sm.giveSkill(20000014) sm.giveSkill(20000015) sm.warp(914000210, 1)
# The isBadVersion API is already defined for you. # @param version, an integer # @return an integer # def isBadVersion(version): class Solution: def firstBadVersion(self, n): left, right = 1, n while left < right: i = (left + right) // 2 if isBadVersion(i): ...
class Solution: def first_bad_version(self, n): (left, right) = (1, n) while left < right: i = (left + right) // 2 if is_bad_version(i): right = i else: left = i + 1 return left
def pascal_triangle(num_rows): # init list for all the rows rows = list([list() for _ in range(num_rows)]) # create the rows for row_index in range(num_rows): # A: at each index in the overall matrix, create an array as long as that # row position new_row = list([1 for i in range...
def pascal_triangle(num_rows): rows = list([list() for _ in range(num_rows)]) for row_index in range(num_rows): new_row = list([1 for i in range(row_index + 1)]) previous_row = rows[row_index - 1] for column_index in range(1, len(new_row) - 1): new_row[column_index] = previou...
l = [10,20,30,40,50] del l print(l)
l = [10, 20, 30, 40, 50] del l print(l)
Parameters='''(kvalue:int,nei:[?D1] int, start_i:[?D2] int,src:[?D3] int, dst:[?D4] int, neiR:[?D11] int, start_iR:[?D12] int,srcR:[?D13] int, dstR:[?D14] int,TriCount:[?D5] int):string throws{''' ParametersAtomic='''(kvalue:int,nei:[?D1] int, start_i:[?D2] int,src:[?D3] int, dst:[?D4] int, ...
parameters = '(kvalue:int,nei:[?D1] int, start_i:[?D2] int,src:[?D3] int, dst:[?D4] int,\n neiR:[?D11] int, start_iR:[?D12] int,srcR:[?D13] int, dstR:[?D14] int,TriCount:[?D5] int):string throws{' parameters_atomic = '(kvalue:int,nei:[?D1] int, start_i:[?D2] int,src:[?D3] int, dst:[?D4] int,\n ...
"""Dummy init module for the price_monitor package. It will be overwritten when docker mounts the real package.""" def get_version(): """ Returns DEV as version. Just a placeholder while building the web docker image, will be overwritten by mounted docker volume. :return: the version identifier """ ...
"""Dummy init module for the price_monitor package. It will be overwritten when docker mounts the real package.""" def get_version(): """ Returns DEV as version. Just a placeholder while building the web docker image, will be overwritten by mounted docker volume. :return: the version identifier """ ...
class Solution: def longestCommonSubsequence(self, s1: str, s2: str) -> int: m = len(s1) n = len(s2) t = [[-1 for j in range(n+1)] for i in range(m+1)] for i in range(m+1): t[i][0] = 0 for j in range(n+1): t[0][j] = 0 ...
class Solution: def longest_common_subsequence(self, s1: str, s2: str) -> int: m = len(s1) n = len(s2) t = [[-1 for j in range(n + 1)] for i in range(m + 1)] for i in range(m + 1): t[i][0] = 0 for j in range(n + 1): t[0][j] = 0 for i in range(...
""" Calculate the tank wanter based on the slab (brackets) Calculation is as below: 0 to 500 - 2 rupees 501 to 1500 - 3 rupees 1501 to 3000 - 5 rupees 3001 above - 8 rupees The method calculates similar to how tax gets calculated """ def tank_water_slab(consumption:int) -> int: brackets ...
""" Calculate the tank wanter based on the slab (brackets) Calculation is as below: 0 to 500 - 2 rupees 501 to 1500 - 3 rupees 1501 to 3000 - 5 rupees 3001 above - 8 rupees The method calculates similar to how tax gets calculated """ def tank_water_slab(consumption: int) -> int: brackets = {(1, 50...
class Recipient: def __init__(self, recipient): if isinstance(recipient, (list, tuple)): recipient = ",".join(recipient) self.recipient = recipient def header(self): headers = [] for address in self.recipient.split(","): if "<" in address: ...
class Recipient: def __init__(self, recipient): if isinstance(recipient, (list, tuple)): recipient = ','.join(recipient) self.recipient = recipient def header(self): headers = [] for address in self.recipient.split(','): if '<' in address: ...
def minSubsetSumDiff(n, arr): summ = sum(arr) dp = [[0]*(summ + 1) for i in range(n + 1)] for i in range(n + 1): dp[i][0] = 1 for i in range(n + 1): for j in range(summ + 1): if arr[i - 1] <= j: dp[i][j] = dp[i - 1][j] | dp[i - 1][j - arr[i - 1]] ...
def min_subset_sum_diff(n, arr): summ = sum(arr) dp = [[0] * (summ + 1) for i in range(n + 1)] for i in range(n + 1): dp[i][0] = 1 for i in range(n + 1): for j in range(summ + 1): if arr[i - 1] <= j: dp[i][j] = dp[i - 1][j] | dp[i - 1][j - arr[i - 1]] ...
class Solution: def fib(self, n): if n in memo: return memo[n] if n < 2: return 1 else: f = self.fib(n-1) + self.fib(n-2) memo[n] = f return f obj = Solution() num = 10 memo = {} print("Fibonacci Number at Index: {}" .format(num)) print("Answer: {}" .format(obj.fib(num)))
class Solution: def fib(self, n): if n in memo: return memo[n] if n < 2: return 1 else: f = self.fib(n - 1) + self.fib(n - 2) memo[n] = f return f obj = solution() num = 10 memo = {} print('Fibonacci Number at Index: {}'.format(num)) print...
# ----------------------------------------------------------------------------- # Copyright (c) 2005-2020, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License (version 2 # or later) with exception for distributing the bootloader. # # The full license is in the file COPYING.tx...
hiddenimports = ['pyexcel_odsr']
""" PASSENGERS """ numPassengers = 30505 passenger_arriving = ( (8, 6, 10, 8, 6, 1, 3, 1, 4, 2, 0, 0, 0, 7, 0, 1, 5, 11, 4, 4, 1, 1, 1, 0, 2, 0), # 0 (5, 6, 3, 8, 7, 1, 4, 1, 5, 0, 1, 2, 0, 12, 8, 4, 3, 9, 6, 4, 5, 5, 1, 1, 1, 0), # 1 (12, 8, 7, 6, 3, 1, 2, 2, 1, 3, 0, 0, 0, 9, 9, 5, 4, 10, 10, 6, 2, 4, 2, 2, 2...
""" PASSENGERS """ num_passengers = 30505 passenger_arriving = ((8, 6, 10, 8, 6, 1, 3, 1, 4, 2, 0, 0, 0, 7, 0, 1, 5, 11, 4, 4, 1, 1, 1, 0, 2, 0), (5, 6, 3, 8, 7, 1, 4, 1, 5, 0, 1, 2, 0, 12, 8, 4, 3, 9, 6, 4, 5, 5, 1, 1, 1, 0), (12, 8, 7, 6, 3, 1, 2, 2, 1, 3, 0, 0, 0, 9, 9, 5, 4, 10, 10, 6, 2, 4, 2, 2, 2, 0), (14, 17, 8...
big_factories = ['ByteDance','Alibaba','Tencnet','Google','Meituan'] for index in range (len(big_factories)): print(big_factories[index],end=',')
big_factories = ['ByteDance', 'Alibaba', 'Tencnet', 'Google', 'Meituan'] for index in range(len(big_factories)): print(big_factories[index], end=',')
input = """ 1 2 0 0 1 3 0 0 1 4 0 0 1 5 0 0 1 6 0 0 1 7 0 0 1 8 0 0 1 9 0 0 1 10 0 0 1 11 0 0 1 12 0 0 1 13 0 0 1 14 0 0 1 15 0 0 1 16 0 0 1 17 0 0 1 18 0 0 1 19 0 0 1 20 0 0 1 21 0 0 1 22 0 0 1 23 0 0 1 24 0 0 1 25 0 0 1 26 0 0 1 27 0 0 1 28 0 0 1 29 0 0 1 30 0 0 1 31 0 0 1 32 0 0 1 33 0 0 1 34 0 0 1 35 0 0 1 36 0 0 1...
input = '\n1 2 0 0\n1 3 0 0\n1 4 0 0\n1 5 0 0\n1 6 0 0\n1 7 0 0\n1 8 0 0\n1 9 0 0\n1 10 0 0\n1 11 0 0\n1 12 0 0\n1 13 0 0\n1 14 0 0\n1 15 0 0\n1 16 0 0\n1 17 0 0\n1 18 0 0\n1 19 0 0\n1 20 0 0\n1 21 0 0\n1 22 0 0\n1 23 0 0\n1 24 0 0\n1 25 0 0\n1 26 0 0\n1 27 0 0\n1 28 0 0\n1 29 0 0\n1 30 0 0\n1 31 0 0\n1 32 0 0\n1 33 0 ...
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/hyperxai01/can-autoware/install/include".split(';') if "/home/hyperxai01/can-autoware/install/include" != "" else [] PROJECT_CATKIN_DEPENDS = "roscpp;geometry_msgs;rosconsole;autoware_msgs;messag...
catkin_package_prefix = '' project_pkg_config_include_dirs = '/home/hyperxai01/can-autoware/install/include'.split(';') if '/home/hyperxai01/can-autoware/install/include' != '' else [] project_catkin_depends = 'roscpp;geometry_msgs;rosconsole;autoware_msgs;message_runtime;std_msgs;can_msgs;socketcan_interface'.replace(...
def coinChangePer(coins, targetSum): dp = [0] * (targetSum+1) dp[0] = 1 for amount in range(1, targetSum+1): for coin in coins: if coin <= amount: reamingAmount = amount - coin dp[amount] += dp[reamingAmount] return dp[targetSum] ...
def coin_change_per(coins, targetSum): dp = [0] * (targetSum + 1) dp[0] = 1 for amount in range(1, targetSum + 1): for coin in coins: if coin <= amount: reaming_amount = amount - coin dp[amount] += dp[reamingAmount] return dp[targetSum] if __name__ == ...
# time complexity: O(n^2) # https://en.wikipedia.org/wiki/Bubble_sort def recursive_bubble(arr): for i, num in enumerate(arr): try: if arr[i+1] < num: arr[i] = arr[i+1] arr[i+1] = num recursive_bubble(arr) except IndexError: pa...
def recursive_bubble(arr): for (i, num) in enumerate(arr): try: if arr[i + 1] < num: arr[i] = arr[i + 1] arr[i + 1] = num recursive_bubble(arr) except IndexError: pass return arr arr = [90, 7, 85, 13, 71, 22, 67, 36, 59, 45]...
dog_names = ['ages/train/001.Affenpinscher', 'ages/train/002.Afghan_hound', 'ages/train/003.Airedale_terrier', 'ages/train/004.Akita', 'ages/train/005.Alaskan_malamute', 'ages/train/006.American_eskimo_dog', 'ages/train/007.American_foxhound', 'ages/train/008.American_staffordshire_terrier', 'ages/train...
dog_names = ['ages/train/001.Affenpinscher', 'ages/train/002.Afghan_hound', 'ages/train/003.Airedale_terrier', 'ages/train/004.Akita', 'ages/train/005.Alaskan_malamute', 'ages/train/006.American_eskimo_dog', 'ages/train/007.American_foxhound', 'ages/train/008.American_staffordshire_terrier', 'ages/train/009.American_wa...
#weights file PRETRAIN_WEIGHTS = '/save/yolo_weights/YOLO_small.ckpt' WEIGHTS_FILE = None # image parameters IMAGE_SIZE = 448 VIEW_POINTS = 30 # model parameters CELL_SIZE = 7 LOCATION_SCALE = 2.0 CONFIDENCE_SCALE = 1.0 NOOBJ_CONFIDENCE_SCALE = 0.1 VIEW_POINTS_SCALE = 2.0 LEAKY_RELU_ALPHA = 0.1 # training pa...
pretrain_weights = '/save/yolo_weights/YOLO_small.ckpt' weights_file = None image_size = 448 view_points = 30 cell_size = 7 location_scale = 2.0 confidence_scale = 1.0 noobj_confidence_scale = 0.1 view_points_scale = 2.0 leaky_relu_alpha = 0.1 data_size = 5000 max_iters = 30000 batch_size = 32 summary_iters = 10 save_i...
class Candlestick: def __init__(self): self.startTime = 0 self.closeTime = 0 self.symbol = "" self.interval = "" self.firstTradeId = 0 self.lastTradeId = 0 self.open = 0.0 self.close = 0.0 self.high = 0.0 self.low = 0.0 ...
class Candlestick: def __init__(self): self.startTime = 0 self.closeTime = 0 self.symbol = '' self.interval = '' self.firstTradeId = 0 self.lastTradeId = 0 self.open = 0.0 self.close = 0.0 self.high = 0.0 self.low = 0.0 self.vo...
# empty dictionary adjLists_dict = {} # insert (vertex, list) pairs into dictionary adjLists_dict[0] = [1,2] adjLists_dict[1] = [2,3] adjLists_dict[2] = [4] adjLists_dict[3] = [4,5] adjLists_dict[4] = [5] adjLists_dict[5] = [] # testing print("Neighbors of vertex 0: ", adjLists_dict[0]) print("Neighbors of vertex 3: ...
adj_lists_dict = {} adjLists_dict[0] = [1, 2] adjLists_dict[1] = [2, 3] adjLists_dict[2] = [4] adjLists_dict[3] = [4, 5] adjLists_dict[4] = [5] adjLists_dict[5] = [] print('Neighbors of vertex 0: ', adjLists_dict[0]) print('Neighbors of vertex 3: ', adjLists_dict[3]) print('\nPrint all adjacency lists with correspondin...
print("este programa conta de um a dez") for x in range(1,11): print(x)
print('este programa conta de um a dez') for x in range(1, 11): print(x)
# Copyright 2016 by Stephen Marshall. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """ This module provides code to work with the cellosaurus.txt file from http://web.expasy....
""" This module provides code to work with the cellosaurus.txt file from http://web.expasy.org/cellosaurus/ Tested with the release of Version 18 (July 2016) Functions: - read Reads a file containing one cell line entry - parse Reads a file containing multiple cell line entries Classes: - Re...
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : # AUTHOR : # PROJECT : # # ---------------------------------------------------------------------------- # Docstring """**DOCSTRING**. description Routine Listings ---------------- """ __author__ =...
"""**DOCSTRING**. description Routine Listings ---------------- """ __author__ = '' def timeout_handler(signum, frame) -> Exception: """timeout_handler.""" raise exception('Calculation timed-out')
# python3 def linear_search(keys, query): for i in range(len(keys)): if keys[i] == query: return i return -1 def binary_search(arr, l, r, x): # Check base case if r >= l: mid = l + (r - l) // 2 # If element is present at the middle itself if arr[mid] == x...
def linear_search(keys, query): for i in range(len(keys)): if keys[i] == query: return i return -1 def binary_search(arr, l, r, x): if r >= l: mid = l + (r - l) // 2 if arr[mid] == x: return mid elif arr[mid] > x: return binary_search(arr,...
# # DEEP EXTENSIONS # DEEP_EXT_LOG = ".log" DEEP_EXT_YAML = ".yaml" DEEP_EXT_JPG = ".jpg" DEEP_EXT_CSV = ".csv" DEEP_EXT_NPY = ".npy" DEEP_EXT_NPZ = ".npz" DEEP_EXT_ONNX = ".onnx" DEEP_EXT_PYTORCH = ".pt"
deep_ext_log = '.log' deep_ext_yaml = '.yaml' deep_ext_jpg = '.jpg' deep_ext_csv = '.csv' deep_ext_npy = '.npy' deep_ext_npz = '.npz' deep_ext_onnx = '.onnx' deep_ext_pytorch = '.pt'
a, b, c = map(int, input().split()) if b + c > a: print(b+c - a) else: print(0)
(a, b, c) = map(int, input().split()) if b + c > a: print(b + c - a) else: print(0)
class Token : def __init__(self,type_,value = None,position=None): self.type = type_ self.value = value if position: self.position = position.copy() def matches(self,type_,value): return self.type == type_ and self.value == value def __repr__(self): return f'{sel...
class Token: def __init__(self, type_, value=None, position=None): self.type = type_ self.value = value if position: self.position = position.copy() def matches(self, type_, value): return self.type == type_ and self.value == value def __repr__(self): r...
def power(a: float, n: int) -> float: if n == 0: return 1 return a * power(a, n - 1) a = float(input()) n = int(input()) print(power(a, n))
def power(a: float, n: int) -> float: if n == 0: return 1 return a * power(a, n - 1) a = float(input()) n = int(input()) print(power(a, n))
class Solution: def topKFrequent(self, words, k): """ :type words: List[str] :type k: int :rtype: List[str] """ pairs = [(-cnt, word) for word, cnt in collections.Counter(words).items()] return [word for _, word in heapq.nsmallest(k, pairs)]
class Solution: def top_k_frequent(self, words, k): """ :type words: List[str] :type k: int :rtype: List[str] """ pairs = [(-cnt, word) for (word, cnt) in collections.Counter(words).items()] return [word for (_, word) in heapq.nsmallest(k, pairs)]
""" Calling conventions """ class CallingConvention: def __init__(self, name): self.name = name
""" Calling conventions """ class Callingconvention: def __init__(self, name): self.name = name
# [callable(getattr(__builtins__, attr)) for attr in dir(__builtins__)] # [(attr,type(getattr(__builtins__, attr))) for attr in dir(__builtins__)] # print('hello'*100) class Test: def __repr__(self): return "test" def __str__(self): return "test2" t = Test() print(t)
class Test: def __repr__(self): return 'test' def __str__(self): return 'test2' t = test() print(t)
def pick_pens(writing_colours, is_marking): if is_marking is True: writing_colours.append('red') return writing_colours
def pick_pens(writing_colours, is_marking): if is_marking is True: writing_colours.append('red') return writing_colours
def writeToFile(array): f = open('points', 'w') f.write(array[0] + '\n' + array[1] + '\n') f.close() def getPoint(): x = raw_input("X Coordinate: ") y = raw_input("Y Coordinate: ") write = [x,y] writeToFile(write) def main(): while 1: getPoint()
def write_to_file(array): f = open('points', 'w') f.write(array[0] + '\n' + array[1] + '\n') f.close() def get_point(): x = raw_input('X Coordinate: ') y = raw_input('Y Coordinate: ') write = [x, y] write_to_file(write) def main(): while 1: get_point()
N = int(input()) L = list(map(int, input().split())) L.sort() print(sum(L[::2]))
n = int(input()) l = list(map(int, input().split())) L.sort() print(sum(L[::2]))
#!/usr/bin/python3 class Rectangle(): number_of_instances = 0 def __init__(self, width=0, height=0): self.height = height self.width = width Rectangle.number_of_instances += 1 def area(self): return self.__height * self.__width def perimeter(self): if self.wid...
class Rectangle: number_of_instances = 0 def __init__(self, width=0, height=0): self.height = height self.width = width Rectangle.number_of_instances += 1 def area(self): return self.__height * self.__width def perimeter(self): if self.width == 0 or self.height...
class GameBoard: def __init__(self, size=3): # TODO: make dynamic self.board = [ [0, 0, 0], [0, 0, 0], [0, 0, 0] ] def make_move(self, value, pos_x, pos_y): if pos_x > 3 or pos_y > 3: print("invalid index") return ...
class Gameboard: def __init__(self, size=3): self.board = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] def make_move(self, value, pos_x, pos_y): if pos_x > 3 or pos_y > 3: print('invalid index') return if self.board[pos_x][pos_y] < 1: self.board[pos_x][pos_y] =...
# # PySNMP MIB module STN-SNMP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/STN-SNMP-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:11:41 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_size_constraint, value_range_constraint, single_value_constraint) ...
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None """ The following is a solution of Add two numbers problem which is described as: You are given two non-empty linked lists representing two non-negative integers. The digits are...
""" The following is a solution of Add two numbers problem which is described as: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. You may assume t...
# model settings embed_dims = 448 num_classes = 1000 model = dict( type='ImageClassifier', backbone=dict( type='T2T_ViT', img_size=224, in_channels=3, embed_dims=embed_dims, t2t_cfg=dict( token_dims=64, use_performer=False, ), num_...
embed_dims = 448 num_classes = 1000 model = dict(type='ImageClassifier', backbone=dict(type='T2T_ViT', img_size=224, in_channels=3, embed_dims=embed_dims, t2t_cfg=dict(token_dims=64, use_performer=False), num_layers=19, layer_cfgs=dict(num_heads=7, feedforward_channels=3 * embed_dims), drop_path_rate=0.1, init_cfg=[dic...
# # PySNMP MIB module AIHUBPORT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/AIHUBPORT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:00:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(positive_integer,) = mibBuilder.importSymbols('AISYSTEM-MIB', 'PositiveInteger') (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size...
L = int(raw_input()) B = int(raw_input()) area = L * B peri = 2*(L + B) if area > peri: print("Area") print(area) else: print("Peri") print(peri)
l = int(raw_input()) b = int(raw_input()) area = L * B peri = 2 * (L + B) if area > peri: print('Area') print(area) else: print('Peri') print(peri)
def _push_state(self): self._state_stack.append({ self._SK_POS: self._pos, self._SK_ROW: self._row, self._SK_COL: self._col, self._SK_TOK_IDX: self._token_index, self._SK_OCC: 0, }) def _pop_state(self): res = self._state_stack.pop() self._pos = res[self._SK_POS...
def _push_state(self): self._state_stack.append({self._SK_POS: self._pos, self._SK_ROW: self._row, self._SK_COL: self._col, self._SK_TOK_IDX: self._token_index, self._SK_OCC: 0}) def _pop_state(self): res = self._state_stack.pop() self._pos = res[self._SK_POS] self._row = res[self._SK_ROW] self._co...
#!/usr/bin/env python3 secret = [0x0E,0x05,0x06,0x1A,0x39,0x7D,0x60,0x75,0x7B,0x54,0x18,0x6A] seed = [0x61,0x75,0x63,0x74,0x66] for i in range(len(secret)): for j in range(0x20,0x7F): bar = seed[i%5] ^ j if bar == secret[i]: print(chr(j), end='') seed[i%5] = bar break print()
secret = [14, 5, 6, 26, 57, 125, 96, 117, 123, 84, 24, 106] seed = [97, 117, 99, 116, 102] for i in range(len(secret)): for j in range(32, 127): bar = seed[i % 5] ^ j if bar == secret[i]: print(chr(j), end='') seed[i % 5] = bar break print()