content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Next Greater Element I: https://leetcode.com/problems/next-greater-element-i/ # The next greater element of some element x in an array is the first greater element that is to the right of x in the same array. # You are given two distinct 0-indexed integer arrays nums1 and nums2, where nums1 is a subset of nums2. # F...
class Solution: def next_greater_element(self, nums1, nums2): next_greater = {} stack = [] for num in nums2: while len(stack) > 0 and num > stack[-1]: nextGreater[stack.pop()] = num stack.append(num) result = [] for num in nums1: ...
''' @Date: 2019-12-22 20:38:38 @Author: ywyz @LastModifiedBy: ywyz @Github: https://github.com/ywyz @LastEditors : ywyz @LastEditTime : 2019-12-22 20:52:02 ''' strings = input("Enter the first 12 digits of an ISBN-13 as a string: ") temp = 1 total = 0 for i in strings: if temp % 2 == 0: total += 3 * int(i)...
""" @Date: 2019-12-22 20:38:38 @Author: ywyz @LastModifiedBy: ywyz @Github: https://github.com/ywyz @LastEditors : ywyz @LastEditTime : 2019-12-22 20:52:02 """ strings = input('Enter the first 12 digits of an ISBN-13 as a string: ') temp = 1 total = 0 for i in strings: if temp % 2 == 0: total += 3 * int(i)...
def count_up_to(max): count = 1 while count <= max: yield count count += 1 counter = count_up_to(5) for num in counter: print(num)
def count_up_to(max): count = 1 while count <= max: yield count count += 1 counter = count_up_to(5) for num in counter: print(num)
__strict__ = True class SpotifyOauthError(Exception): pass class SpotifyRepositoryError(Exception): def __init__(self, http_status: int, body: str): self.http_status = http_status self.body = body def __str__(self): return 'http status: {0}, code:{1}'.format(str(self.http_status...
__strict__ = True class Spotifyoautherror(Exception): pass class Spotifyrepositoryerror(Exception): def __init__(self, http_status: int, body: str): self.http_status = http_status self.body = body def __str__(self): return 'http status: {0}, code:{1}'.format(str(self.http_status)...
# program numbers BASIC = 140624 GOTO = 158250875866513204219300194287615 VARIABLES = 6198727823
basic = 140624 goto = 158250875866513204219300194287615 variables = 6198727823
ENV_NAMES = { "PASSWORD": "DECT_MAIL_EXTRACT_PASSWORD", "USERNAME": "DECT_MAIL_EXTRACT_USER", "SERVER": "DECT_MAIL_EXTRACT_SERVER", }
env_names = {'PASSWORD': 'DECT_MAIL_EXTRACT_PASSWORD', 'USERNAME': 'DECT_MAIL_EXTRACT_USER', 'SERVER': 'DECT_MAIL_EXTRACT_SERVER'}
@customop('numpy') def my_softmax(x, y): probs = numpy.exp(x - numpy.max(x, axis=1, keepdims=True)) probs /= numpy.sum(probs, axis=1, keepdims=True) N = x.shape[0] loss = -numpy.sum(numpy.log(probs[numpy.arange(N), y])) / N return loss def my_softmax_grad(ans, x, y): def grad(g): N = x...
@customop('numpy') def my_softmax(x, y): probs = numpy.exp(x - numpy.max(x, axis=1, keepdims=True)) probs /= numpy.sum(probs, axis=1, keepdims=True) n = x.shape[0] loss = -numpy.sum(numpy.log(probs[numpy.arange(N), y])) / N return loss def my_softmax_grad(ans, x, y): def grad(g): n = x...
class MdFile(): def __init__(self, file_path, base_name, title, mdlinks): self.uid = 0 self.file_path = file_path self.base_name = base_name self.title = title if title else base_name self.mdlinks = mdlinks def __str__(self): return f'{self.uid}: {self.file_pat...
class Mdfile: def __init__(self, file_path, base_name, title, mdlinks): self.uid = 0 self.file_path = file_path self.base_name = base_name self.title = title if title else base_name self.mdlinks = mdlinks def __str__(self): return f'{self.uid}: {self.file_path},...
#/* *** ODSATag: MinVertex *** */ # Find the unvisited vertex with the smalled distance def minVertex(G, D): v = 0 # Initialize v to any unvisited vertex for i in range(G.nodeCount()): if G.getValue(i) != VISITED: v = i break for i in range(G.nodeCount()): # Now find small...
def min_vertex(G, D): v = 0 for i in range(G.nodeCount()): if G.getValue(i) != VISITED: v = i break for i in range(G.nodeCount()): if G.getValue(i) != VISITED and D[i] < D[v]: v = i return v def dijkstra(G, s, D): for i in range(G.nodeCount()): ...
config = { # -------------------------------------------------------------------------- # Database Connections # -------------------------------------------------------------------------- 'database': { 'default': 'auth', 'connections': { # SQLite # 'auth': { ...
config = {'database': {'default': 'auth', 'connections': {'auth': {'driver': 'mysql', 'dialect': 'pymysql', 'host': '127.0.0.1', 'port': 3306, 'database': 'uvicore_test', 'username': 'root', 'password': 'techie', 'prefix': 'auth_'}}}}
data = open('output_dataset_ALL.txt').readlines() original = open('dataset_ALL.txt').readlines() #data = open('dataset.txt').readlines() out = open('output_gcode_merged.gcode', 'w') for j in range(len(data)/4): i = j*4 x = data[i].strip() y = data[i+1].strip() z = original[i+2].strip() e = original...
data = open('output_dataset_ALL.txt').readlines() original = open('dataset_ALL.txt').readlines() out = open('output_gcode_merged.gcode', 'w') for j in range(len(data) / 4): i = j * 4 x = data[i].strip() y = data[i + 1].strip() z = original[i + 2].strip() e = original[i + 3].strip() out.write('G1...
## # Copyright 2018, Ammar Ali Khan # Licensed under MIT. ## # Application configuration APPLICATION_NAME = '' APPLICATION_VERSION = '1.0.1' # HTTP Port for web streaming HTTP_PORT = 8000 # HTTP page template path HTML_TEMPLATE_PATH = './src/common/package/http/template' # Capturing device index (used for web camera...
application_name = '' application_version = '1.0.1' http_port = 8000 html_template_path = './src/common/package/http/template' capturing_device = 0 use_pi_camera = True width = 640 height = 480 resolution = [WIDTH, HEIGHT] frame_rate = 24 database_name = 'database.db' storage_directory = './dataset/' unknown_prefix = '...
Total_Fuel_Need =0 Data_File = open("Day1_Data.txt") Data_Lines = Data_File.readlines() for i in range(len(Data_Lines)): Data_Lines[i] = int(Data_Lines[i].rstrip('\n')) Total_Fuel_Need += int(Data_Lines[i] / 3) - 2 print(Total_Fuel_Need)
total__fuel__need = 0 data__file = open('Day1_Data.txt') data__lines = Data_File.readlines() for i in range(len(Data_Lines)): Data_Lines[i] = int(Data_Lines[i].rstrip('\n')) total__fuel__need += int(Data_Lines[i] / 3) - 2 print(Total_Fuel_Need)
# This sample tests the special-case handling of Self when comparing # two functions whose signatures differ only in the Self scope. class SomeClass: def __str__(self) -> str: ... __repr__ = __str__
class Someclass: def __str__(self) -> str: ... __repr__ = __str__
lines = open("input").read().strip().splitlines() print("--- Day11 ---") class Seat: directions = [ (dx, dy) for dx in [-1, 0, 1] for dy in [-1, 0, 1] if (dx, dy) != (0, 0) ] def __init__(self, x, y, dx, dy): self.x = x self.y = y self.dx = dx self.dy = dy def...
lines = open('input').read().strip().splitlines() print('--- Day11 ---') class Seat: directions = [(dx, dy) for dx in [-1, 0, 1] for dy in [-1, 0, 1] if (dx, dy) != (0, 0)] def __init__(self, x, y, dx, dy): self.x = x self.y = y self.dx = dx self.dy = dy def p1(part2=False): ...
#list = [1,2,3,4,5] arr = list(range(1,6)) count = 0 #print(arr) #for i in arr: #print(i) list = ["a","b","c","d","e"] for index in range(len(arr)): print(f'Phan tu tai vi tri {index} cua arr la : {list[index]}') count += 1 print(count)
arr = list(range(1, 6)) count = 0 list = ['a', 'b', 'c', 'd', 'e'] for index in range(len(arr)): print(f'Phan tu tai vi tri {index} cua arr la : {list[index]}') count += 1 print(count)
def baseline3(X): return ( X['ABS'] | X['INT'] | X['UINT'] | (X['TDEP'] > X['TDEP'].mean()) | (X['FIELD'] > X['FIELD'].mean()) | ((X['UAPI']+X['TUAPI']) > (X['UAPI']+X['TUAPI']).mean()) | (X['EXPCAT'] > 0) | (X['RBFA'] > 0) | (X['CONDCALL'] > 0...
def baseline3(X): return X['ABS'] | X['INT'] | X['UINT'] | (X['TDEP'] > X['TDEP'].mean()) | (X['FIELD'] > X['FIELD'].mean()) | (X['UAPI'] + X['TUAPI'] > (X['UAPI'] + X['TUAPI']).mean()) | (X['EXPCAT'] > 0) | (X['RBFA'] > 0) | (X['CONDCALL'] > 0) | (X['SYNC'] > X['SYNC'].mean()) | (X['AFPR'] > 0)
def search_in_rotated_array(alist, k, leftix=0, rightix=None): if not rightix: rightix = len(alist) midpoint = (leftix + rightix) / 2 aleft, amiddle = alist[leftix], alist[midpoint] if k == amiddle: return midpoint if k == aleft: return leftix if aleft > amiddle: ...
def search_in_rotated_array(alist, k, leftix=0, rightix=None): if not rightix: rightix = len(alist) midpoint = (leftix + rightix) / 2 (aleft, amiddle) = (alist[leftix], alist[midpoint]) if k == amiddle: return midpoint if k == aleft: return leftix if aleft > amiddle: ...
''' https://www.codingame.com/training/easy/brackets-extreme-edition ''' e = input() d = {')': '(', ']': '[', '}': '{'} s = [] for c in e: if c in d.values(): s.append(c) elif c in d.keys(): if len(s) == 0: print("false") exit(0) else: ...
""" https://www.codingame.com/training/easy/brackets-extreme-edition """ e = input() d = {')': '(', ']': '[', '}': '{'} s = [] for c in e: if c in d.values(): s.append(c) elif c in d.keys(): if len(s) == 0: print('false') exit(0) elif d[c] == s.pop(): ...
#!/usr/bin/env python # from .api import SteamAPI class SteamUser(object): def __init__(self, steam_id=None, steam_api=None, **kwargs): self.steam_id = steam_id self.steam_api = steam_api self.__dict__.update(**kwargs) self._friends = None self._games = None self._...
class Steamuser(object): def __init__(self, steam_id=None, steam_api=None, **kwargs): self.steam_id = steam_id self.steam_api = steam_api self.__dict__.update(**kwargs) self._friends = None self._games = None self._profile_data = None self._profile_data_items...
class Solution: def solve(self, matrix): if matrix[0][0] == 1: return -1 R,C = len(matrix),len(matrix[0]) bfs = deque([[0,0]]) dists = {(0,0): 1} while bfs: r,c = bfs.popleft() if (r,c) == (R-1,C-1): return dists[r,c] for nr,n...
class Solution: def solve(self, matrix): if matrix[0][0] == 1: return -1 (r, c) = (len(matrix), len(matrix[0])) bfs = deque([[0, 0]]) dists = {(0, 0): 1} while bfs: (r, c) = bfs.popleft() if (r, c) == (R - 1, C - 1): return...
class Solution: def rob(self, nums: list[int]) -> int: if len(nums) == 0: return 0 max_loot: list[int] = [0 for _ in nums] for index, num in enumerate(nums): if index == 0: max_loot[index] = num elif index == 1: max_loot[in...
class Solution: def rob(self, nums: list[int]) -> int: if len(nums) == 0: return 0 max_loot: list[int] = [0 for _ in nums] for (index, num) in enumerate(nums): if index == 0: max_loot[index] = num elif index == 1: max_loot[...
async def processEvent(event): # Do event processing here ... return event
async def processEvent(event): return event
print("\nAverage is being calculated\n") APITimingFile = open("APITiming.txt", "r") APITimingVals = APITimingFile.readlines() sum = 0 for i in APITimingVals: sum += float(i[slice(len(i)-2)]) print("\nThe average time of start providing is " + str(round(sum/len(APITimingVals), 4)) + "\n")
print('\nAverage is being calculated\n') api_timing_file = open('APITiming.txt', 'r') api_timing_vals = APITimingFile.readlines() sum = 0 for i in APITimingVals: sum += float(i[slice(len(i) - 2)]) print('\nThe average time of start providing is ' + str(round(sum / len(APITimingVals), 4)) + '\n')
class OrderLog: def __init__(self, size): self.log = list() self.size = size def __repr__(self): return str(self.log) def record(self, order_id): self.log.append(order_id) if len(self.log) > self.size: self.log = self.log[1:] def get_last(self, i): ...
class Orderlog: def __init__(self, size): self.log = list() self.size = size def __repr__(self): return str(self.log) def record(self, order_id): self.log.append(order_id) if len(self.log) > self.size: self.log = self.log[1:] def get_last(self, i):...
# # PySNMP MIB module OADHCP-SERVER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/OADHCP-SERVER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:22:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint, constraints_union) ...
sample_split=1.0 data_loader_usage = 'Training' training_data = "train_train" evaluate_data = "privatetest"
sample_split = 1.0 data_loader_usage = 'Training' training_data = 'train_train' evaluate_data = 'privatetest'
# This function checks if year is a leap year. def isLeapYear(year): if year%100 == 0: return True if year%400 == 0 else False elif year%4 == 0: return True else: return False # This function returns the number of days in a month def monthDays(year, month): MONTHDAYS = (31, 28, ...
def is_leap_year(year): if year % 100 == 0: return True if year % 400 == 0 else False elif year % 4 == 0: return True else: return False def month_days(year, month): monthdays = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) if month == 2 and is_leap_year(year): re...
#encoding:utf-8 subreddit = 'wtf' t_channel = '@reddit_wtf' def send_post(submission, r2t): return r2t.send_simple(submission)
subreddit = 'wtf' t_channel = '@reddit_wtf' def send_post(submission, r2t): return r2t.send_simple(submission)
programming_languages = ["Python", "Scala", "Haskell", "F#", "C#", "JavaScript"] for lang in programming_languages: if (lang == "Haskell"): continue print("Found Haskell !!!", end='\n') # this statement will never be executed print(lang, end=' ')
programming_languages = ['Python', 'Scala', 'Haskell', 'F#', 'C#', 'JavaScript'] for lang in programming_languages: if lang == 'Haskell': continue print('Found Haskell !!!', end='\n') print(lang, end=' ')
inc = 1 num = 1 for x in range (5,0,-1): for y in range(x,0,-1): print(" ",end="") print(str(num)*inc) num += 2 inc += 2
inc = 1 num = 1 for x in range(5, 0, -1): for y in range(x, 0, -1): print(' ', end='') print(str(num) * inc) num += 2 inc += 2
n = int(input()) a = list(map(int, input().split())) k_max = 0 g_max = 0 for k in range(2, max(a) + 1): gcdness = 0 for elem in a: if elem % k == 0: gcdness += 1 if gcdness >= g_max: g_max = gcdness k_max = k print(k_max)
n = int(input()) a = list(map(int, input().split())) k_max = 0 g_max = 0 for k in range(2, max(a) + 1): gcdness = 0 for elem in a: if elem % k == 0: gcdness += 1 if gcdness >= g_max: g_max = gcdness k_max = k print(k_max)
class Solution: def getSmallestString(self, n: int, k: int) -> str: result = "" for index in range(n): digitsLeft = n - index - 1 for c in range(1, 27): if k - c <= digitsLeft * 26: k -= c result += chr(ord('a') + c -1...
class Solution: def get_smallest_string(self, n: int, k: int) -> str: result = '' for index in range(n): digits_left = n - index - 1 for c in range(1, 27): if k - c <= digitsLeft * 26: k -= c result += chr(ord('a') + c ...
a_val = int(input()) b_val = int(input()) def gcd(a, b): if b > a: a, b = b, a if a % b == 0: return b else: return gcd(b, a % b) def reduce_fraction(n, m): divider = gcd(n, m) return int(n / divider), int(m / divider) result = reduce_fraction(a_val, b_val) print(*resul...
a_val = int(input()) b_val = int(input()) def gcd(a, b): if b > a: (a, b) = (b, a) if a % b == 0: return b else: return gcd(b, a % b) def reduce_fraction(n, m): divider = gcd(n, m) return (int(n / divider), int(m / divider)) result = reduce_fraction(a_val, b_val) print(*res...
class Solution: def myPow(self, x: float, n: int) -> float: if n == 0: return 0 elif n < 0: return (1.0 / x) ** abs(n) else: return x ** n s = Solution() print(s.myPow(2.00000, 10))
class Solution: def my_pow(self, x: float, n: int) -> float: if n == 0: return 0 elif n < 0: return (1.0 / x) ** abs(n) else: return x ** n s = solution() print(s.myPow(2.0, 10))
MOD = 998244353 r, c, n = map(int, input().split()) dp = [[0] * (1 << c) for _ in range(r + 1)] dp[0][0] = 1 for row in range(r): for bit_prev in range(1 << c): bit_prev <<= 1 for bit in range(1 << c): bit <<= 1 count = 0 for i in range(c + 1): i...
mod = 998244353 (r, c, n) = map(int, input().split()) dp = [[0] * (1 << c) for _ in range(r + 1)] dp[0][0] = 1 for row in range(r): for bit_prev in range(1 << c): bit_prev <<= 1 for bit in range(1 << c): bit <<= 1 count = 0 for i in range(c + 1): i...
array([[ -8.71756106, -1.36180276], [ -8.58324975, -1.6198254 ], [ -8.44660752, -1.87329902], [ -8.30694854, -2.12042891], [ -8.16366778, -2.35941504], [ -8.01626074, -2.58846783], [ -7.8643173 , -2.80576865], [ -7.70752251, -3.0094502 ], [ -7.5458139 , -...
array([[-8.71756106, -1.36180276], [-8.58324975, -1.6198254], [-8.44660752, -1.87329902], [-8.30694854, -2.12042891], [-8.16366778, -2.35941504], [-8.01626074, -2.58846783], [-7.8643173, -2.80576865], [-7.70752251, -3.0094502], [-7.5458139, -3.19806094], [-7.37912158, -3.3697834], [-7.20747945, -3.5226388], [-7.0311328...
NAME = 'comic.py' ORIGINAL_AUTHORS = [ 'Miguel Boekhold' ] ABOUT = ''' Returns a random comic from xkcd ''' COMMANDS = ''' >>> .comic returns a url of a random comic ''' WEBSITE = ''
name = 'comic.py' original_authors = ['Miguel Boekhold'] about = '\nReturns a random comic from xkcd\n' commands = '\n>>> .comic\nreturns a url of a random comic\n' website = ''
def printMyName(myName): print('My name is' + myName) print('Who are you ?') myName = input() printMyName(myName)
def print_my_name(myName): print('My name is' + myName) print('Who are you ?') my_name = input() print_my_name(myName)
def get_version_from_win32_pe(file): # http://windowssdk.msdn.microsoft.com/en-us/library/ms646997.aspx sig = struct.pack("32s", u"VS_VERSION_INFO".encode("utf-16-le")) # This pulls the whole file into memory, so not very feasible for # large binaries. try: filedata = open(file).read() e...
def get_version_from_win32_pe(file): sig = struct.pack('32s', u'VS_VERSION_INFO'.encode('utf-16-le')) try: filedata = open(file).read() except IOError: return 'Unknown' offset = filedata.find(sig) if offset == -1: return 'Unknown' filedata = filedata[offset + 32:offset + ...
class NodeConfig: def __init__(self, node_name: str, ws_url: str) -> None: self.node_name = node_name self.ws_url = ws_url
class Nodeconfig: def __init__(self, node_name: str, ws_url: str) -> None: self.node_name = node_name self.ws_url = ws_url
#always put a repr in place to explicitly differentiate str from repr class Car: def __init__(self, color, mileage): self.color = color self.mileage = mileage def __repr__(self): return '{self.__class__.__name__}({self.color}, {self.mileage})'.format(self=self) def __str__(self): ...
class Car: def __init__(self, color, mileage): self.color = color self.mileage = mileage def __repr__(self): return '{self.__class__.__name__}({self.color}, {self.mileage})'.format(self=self) def __str__(self): return 'a {self.color} car'.format(self=self)
BROKER_URL = "mongodb://arbor/celery" CELERY_RESULT_BACKEND = "mongodb" CELERY_MONGODB_BACKEND_SETTINGS = { "host": "arbor", "database": "celery" }
broker_url = 'mongodb://arbor/celery' celery_result_backend = 'mongodb' celery_mongodb_backend_settings = {'host': 'arbor', 'database': 'celery'}
def fun(): a=89 str="adar" return[a,str]; print(fun())
def fun(): a = 89 str = 'adar' return [a, str] print(fun())
# input N, X, Y = map(int, input().split()) As = [*map(int, input().split())] Bs = [*map(int, input().split())] # compute # output print(sum(i not in As and i not in Bs for i in range(1, N+1)))
(n, x, y) = map(int, input().split()) as = [*map(int, input().split())] bs = [*map(int, input().split())] print(sum((i not in As and i not in Bs for i in range(1, N + 1))))
names = ["duanzijie","zhaokeer","lijiaxi","zhuzi","wangwenbo","gongyijun"] print(names) print(names[0]) print(names[1]) print(names[2]) print(names[3]) print(names[4]) print(names[5]) hi = "hi" + " " + name[1] print(hi)
names = ['duanzijie', 'zhaokeer', 'lijiaxi', 'zhuzi', 'wangwenbo', 'gongyijun'] print(names) print(names[0]) print(names[1]) print(names[2]) print(names[3]) print(names[4]) print(names[5]) hi = 'hi' + ' ' + name[1] print(hi)
n = int(input()) s = input() c=0 for i in range(n-1): if s[i]==s[i+1]: c +=1 print(c)
n = int(input()) s = input() c = 0 for i in range(n - 1): if s[i] == s[i + 1]: c += 1 print(c)
# practice of anna class TestClass: def __init__(self, name): # __init__ is the rule first creator made so every time we have to foloow self.name = name if __name__ == '__main__': obj1 = TestClass() print(obj1) obj2 = TestClass() print(obj2)
class Testclass: def __init__(self, name): self.name = name if __name__ == '__main__': obj1 = test_class() print(obj1) obj2 = test_class() print(obj2)
class SpiderpigError(Exception): pass class ValidationError(SpiderpigError): pass class NotInitialized(SpiderpigError): pass class CyclicExecution(SpiderpigError): pass class TooManyDependencies(SpiderpigError): pass
class Spiderpigerror(Exception): pass class Validationerror(SpiderpigError): pass class Notinitialized(SpiderpigError): pass class Cyclicexecution(SpiderpigError): pass class Toomanydependencies(SpiderpigError): pass
## bisenetv2 cfg = dict( model_type='bisenetv2', num_aux_heads=4, lr_start = 5e-2, weight_decay=5e-4, warmup_iters = 1000, max_iter = 150000, im_root='./datasets/coco', train_im_anns='./datasets/coco/train.txt', val_im_anns='./datasets/coco/val.txt', scales=[0.5, 1.5], crops...
cfg = dict(model_type='bisenetv2', num_aux_heads=4, lr_start=0.05, weight_decay=0.0005, warmup_iters=1000, max_iter=150000, im_root='./datasets/coco', train_im_anns='./datasets/coco/train.txt', val_im_anns='./datasets/coco/val.txt', scales=[0.5, 1.5], cropsize=[512, 512], ims_per_gpu=8, use_fp16=True, use_sync_bn=False...
class PorterStemmer: def __init__(self): self.vowels = ('a', 'e', 'i', 'o', 'u') def is_consonant(self, s: str, i: int): return not self.is_vowel(s, i) def is_vowel(self, s: str, i: int): if s[i].lower() in self.vowels: return True elif s[i].lower() == 'y': ...
class Porterstemmer: def __init__(self): self.vowels = ('a', 'e', 'i', 'o', 'u') def is_consonant(self, s: str, i: int): return not self.is_vowel(s, i) def is_vowel(self, s: str, i: int): if s[i].lower() in self.vowels: return True elif s[i].lower() == 'y': ...
def bubble_sort(L): swap = False while not swap: swap = True for j in range(1, len(L)): if L[j-1] > L[j]: swap = False temp = L[j] L[j] = L[j-1] L[j-1] = temp
def bubble_sort(L): swap = False while not swap: swap = True for j in range(1, len(L)): if L[j - 1] > L[j]: swap = False temp = L[j] L[j] = L[j - 1] L[j - 1] = temp
# # PySNMP MIB module CRESCENDO-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CRESCENDO-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:12:29 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...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, single_value_constraint, constraints_union, value_size_constraint) ...
la_liga_goals = 43 champions_league_goals = 10 copa_del_rey_goals = 5 total_goals = la_liga_goals + champions_league_goals + copa_del_rey_goals
la_liga_goals = 43 champions_league_goals = 10 copa_del_rey_goals = 5 total_goals = la_liga_goals + champions_league_goals + copa_del_rey_goals
class NoUserIdOrSessionKeyError(Exception): pass class NoProductToDelete(Exception): pass class NoCart(Exception): pass class BadConfigError(Exception): pass
class Nouseridorsessionkeyerror(Exception): pass class Noproducttodelete(Exception): pass class Nocart(Exception): pass class Badconfigerror(Exception): pass
def main(): *t, n = map(int, input().split()) t=list(t) for i in range(2, n): t.append(t[i-2] + t[i-1]*t[i-1]) print(t[-1]) if __name__ == '__main__': main()
def main(): (*t, n) = map(int, input().split()) t = list(t) for i in range(2, n): t.append(t[i - 2] + t[i - 1] * t[i - 1]) print(t[-1]) if __name__ == '__main__': main()
''' Created on Oct 2, 2012 @author: vadim Todo: need to learn string algorithms. ''' f = open('data/keylog.txt') mx = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, ...
""" Created on Oct 2, 2012 @author: vadim Todo: need to learn string algorithms. """ f = open('data/keylog.txt') mx = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, ...
# Swap assign variables print("Enter 3 no.s:") a = float(input("a: ")) b = float(input("b: ")) c = float(input("c: ")) a, b = a+b, b+c print("Variables are: ") print("a:", a) print("b:", b) print("c:", c)
print('Enter 3 no.s:') a = float(input('a: ')) b = float(input('b: ')) c = float(input('c: ')) (a, b) = (a + b, b + c) print('Variables are: ') print('a:', a) print('b:', b) print('c:', c)
class A: def __setitem__(self, e, f): print(e + f) a = A() a[2] = 8
class A: def __setitem__(self, e, f): print(e + f) a = a() a[2] = 8
cpp_config = [ 'query-lib/official/cpp/codeql-suites/cpp-security-and-quality.qls', 'query-lib/official/cpp/codeql-suites/cpp-security-extended.qls', ] js_config = [] # exported lang_configs = { 'cpp' : cpp_config, 'javascript' : js_config } need_compile = ['cpp', 'java']
cpp_config = ['query-lib/official/cpp/codeql-suites/cpp-security-and-quality.qls', 'query-lib/official/cpp/codeql-suites/cpp-security-extended.qls'] js_config = [] lang_configs = {'cpp': cpp_config, 'javascript': js_config} need_compile = ['cpp', 'java']
# Push (temp, idx) in a stack. Pop element when a bigger elem is seen and update arr[idx] with (new_idx-idx). # class Solution: # def dailyTemperatures(self, T: List[int]) -> List[int]: # S = [] # res = [0]*len(T) # for i in range(len(T)-1, -1, -1): # while S and T[S[-1...
class Solution: def daily_temperatures(self, T: List[int]) -> List[int]: res = [0] * len(T) stack = [] for (i, t1) in enumerate(T): while stack and t1 > stack[-1][1]: (j, t2) = stack.pop() res[j] = i - j stack.append((i, t1)) r...
class BaseType: def __init__(self, db_type: str, python_type: type): self.db_type = db_type self.python_type = python_type Float = BaseType("REAL", float) Int = BaseType("INTEGER", int) String = BaseType("TEXT", str) TypeMap = { float: Float, int: Int, str: String }
class Basetype: def __init__(self, db_type: str, python_type: type): self.db_type = db_type self.python_type = python_type float = base_type('REAL', float) int = base_type('INTEGER', int) string = base_type('TEXT', str) type_map = {float: Float, int: Int, str: String}
album_info = { 'Arrival - ABBA': { 'image': 'arrival.jpg', 'spotify_link_a': '1M4anG49aEs4YimBdj96Oy', }, }
album_info = {'Arrival - ABBA': {'image': 'arrival.jpg', 'spotify_link_a': '1M4anG49aEs4YimBdj96Oy'}}
print('Hello, world.') print('Hello, Python!') print(2 + 3) print('2' * 3) print(f'2 + 3 = {2 + 3}') print('1', '2', '3', sep=' + ', end=' ') print('=', 1 + 2 + 3, end='') print('!')
print('Hello, world.') print('Hello, Python!') print(2 + 3) print('2' * 3) print(f'2 + 3 = {2 + 3}') print('1', '2', '3', sep=' + ', end=' ') print('=', 1 + 2 + 3, end='') print('!')
#!/usr/bin/env python #coding: utf-8 class Solution: # @param A, a list of integers # @return an integer def firstMissingPositive(self, A): if not A: return 1 la = len(A) i = 0 while i < la: if i + 1 == A[i]: i += 1 continue ...
class Solution: def first_missing_positive(self, A): if not A: return 1 la = len(A) i = 0 while i < la: if i + 1 == A[i]: i += 1 continue if A[i] <= 0: i += 1 continue j =...
def xor(a, b): return (a or b) and not (a and b) def collapse_polymer(polymer): pos = 0 while pos + 1 < len(polymer): first = polymer[pos] second = polymer[pos + 1] if first.lower() == second.lower() and xor(first.isupper(), second.isupper()): if pos + 2 >= len(polymer)...
def xor(a, b): return (a or b) and (not (a and b)) def collapse_polymer(polymer): pos = 0 while pos + 1 < len(polymer): first = polymer[pos] second = polymer[pos + 1] if first.lower() == second.lower() and xor(first.isupper(), second.isupper()): if pos + 2 >= len(polymer...
class Aula: def __init__(self, id, numero, titulo): self._id = id self._numero = numero self._titulo = titulo def get_id(self): return self._id def get_numero(self): return self._numero def get_titulo(self): return self._titulo
class Aula: def __init__(self, id, numero, titulo): self._id = id self._numero = numero self._titulo = titulo def get_id(self): return self._id def get_numero(self): return self._numero def get_titulo(self): return self._titulo
class Queue(object): def __init__(self): self.q = [] def push(self, value): self.q.insert(0, value) def pop(self): return self.q.pop() def is_empty(self): return self.q == [] def size(self): return len(self.q) # Example q = Queue() q.push(1...
class Queue(object): def __init__(self): self.q = [] def push(self, value): self.q.insert(0, value) def pop(self): return self.q.pop() def is_empty(self): return self.q == [] def size(self): return len(self.q) q = queue() q.push(1) q.push(2) q.push(3) pri...
file = open("day 04/Toon - Python/input", "r") lines = file.readlines() numbers = [int(x) for x in lines[0][:-1].split(',')] boards = [[int(x) for x in line[:-1].split(' ') if x != '' ] for line in lines[2:]] boards = [boards[i*6:i*6+5] for i in range(100)] def contains_bingo(board): return -5 in [sum(line) for li...
file = open('day 04/Toon - Python/input', 'r') lines = file.readlines() numbers = [int(x) for x in lines[0][:-1].split(',')] boards = [[int(x) for x in line[:-1].split(' ') if x != ''] for line in lines[2:]] boards = [boards[i * 6:i * 6 + 5] for i in range(100)] def contains_bingo(board): return -5 in [sum(line) f...
listOriginPath = [ { "header": "test.example.com", "httpPort": 80, "mappingUniqueId": "993419389425697", "origin": "10.10.10.1", "originType": "HOST_SERVER", "path": "/example", "status": "RUNNING" }, { "header": "test.example.com", "ht...
list_origin_path = [{'header': 'test.example.com', 'httpPort': 80, 'mappingUniqueId': '993419389425697', 'origin': '10.10.10.1', 'originType': 'HOST_SERVER', 'path': '/example', 'status': 'RUNNING'}, {'header': 'test.example.com', 'httpPort': 80, 'mappingUniqueId': '993419389425697', 'origin': '10.10.10.1', 'originType...
@jit(nopython=True) def pressure_poisson(p, b, l2_target): J, I = b.shape iter_diff = l2_target + 1 n = 0 while iter_diff > l2_target and n <= 500: pn = p.copy() for i in range(1, I - 1): for j in range(1, J - 1): p[j, i] = (.25 * (pn[j, i + 1] + ...
@jit(nopython=True) def pressure_poisson(p, b, l2_target): (j, i) = b.shape iter_diff = l2_target + 1 n = 0 while iter_diff > l2_target and n <= 500: pn = p.copy() for i in range(1, I - 1): for j in range(1, J - 1): p[j, i] = 0.25 * (pn[j, i + 1] + pn[j, i - 1...
a = [int(x) for x in input().split()] time = None # a[0] initial hour # a[1] initial min # a[2] final hour # a[3] final min start = 60 * a[0] + a[1] finish = 60 * a[2] + a[3] if finish <= start: finish += 1440 # 24 * 60 time = finish - start print(f"O JOGO DUROU {int(time / 60)} HORA(S) E {int(time % 60)} MI...
a = [int(x) for x in input().split()] time = None start = 60 * a[0] + a[1] finish = 60 * a[2] + a[3] if finish <= start: finish += 1440 time = finish - start print(f'O JOGO DUROU {int(time / 60)} HORA(S) E {int(time % 60)} MINUTO(S)')
def Compute_kmeans_inertia(resultsDict, FSWRITE = False, gpu_available = False): # Measure inertia of kmeans model for a variety of values of cluster number n km_list = list() data = resultsDict['PCA_fit_transform'] #data = resultsDict['NP_images_STD'] N_clusters = len(resultsDict['imagesFilenameList'])...
def compute_kmeans_inertia(resultsDict, FSWRITE=False, gpu_available=False): km_list = list() data = resultsDict['PCA_fit_transform'] n_clusters = len(resultsDict['imagesFilenameList']) if gpu_available: print('Running Compute_kmeans_inertia on GPU: ') with gpu_context(): for...
n_students = int(input()) skills = list(input().split(" ")) skills = [int(skill) for skill in skills] skills = sorted(skills) n_problems = 0 ptr1 = n_students - 1 ptr2 = n_students - 2 while ptr2 >= 0: if (skills[ptr1] == skills[ptr2]): ptr1 -= 2 ptr2 -= 2 else: n_problems += 1 ...
n_students = int(input()) skills = list(input().split(' ')) skills = [int(skill) for skill in skills] skills = sorted(skills) n_problems = 0 ptr1 = n_students - 1 ptr2 = n_students - 2 while ptr2 >= 0: if skills[ptr1] == skills[ptr2]: ptr1 -= 2 ptr2 -= 2 else: n_problems += 1 ski...
teste = [0, 2, 3, 4, 5] print(teste) teste.insert(0, teste[3]) print(teste) teste.pop(4) print(teste)
teste = [0, 2, 3, 4, 5] print(teste) teste.insert(0, teste[3]) print(teste) teste.pop(4) print(teste)
arr = [1, 2, 3, 4, 4, 4, 5, 6, 6, 7, 8, 9] arr.sort() my_dict = {i:arr.count(i) for i in arr} # sorting the dictionary based on value my_dict = {k: v for k, v in sorted(my_dict.items(), key=lambda item: item[1])} print(len(my_dict)) print(my_dict) list = list(my_dict.keys()) print(list[-1])
arr = [1, 2, 3, 4, 4, 4, 5, 6, 6, 7, 8, 9] arr.sort() my_dict = {i: arr.count(i) for i in arr} my_dict = {k: v for (k, v) in sorted(my_dict.items(), key=lambda item: item[1])} print(len(my_dict)) print(my_dict) list = list(my_dict.keys()) print(list[-1])
# Model parameters model_hidden_size = 768 model_embedding_size = 256 model_num_layers = 1 # Training parameters n_steps = 2e4 learning_rate_init = 1e-3 speakers_per_batch = 16 utterances_per_speaker = 32 ## Tensor-train parameters for last linear layer. compression = 'tt' n_cores = 2 rank = 2 # Evaluation and Test...
model_hidden_size = 768 model_embedding_size = 256 model_num_layers = 1 n_steps = 20000.0 learning_rate_init = 0.001 speakers_per_batch = 16 utterances_per_speaker = 32 compression = 'tt' n_cores = 2 rank = 2 val_speakers_per_batch = 40 val_utterances_per_speaker = 32 test_speakers_per_batch = 40 test_utterances_per_sp...
BRIGHTID_NODE = 'http://node.brightid.org/brightid/v5' VERIFICATIONS_URL = BRIGHTID_NODE + '/verifications/idchain/' OPERATION_URL = BRIGHTID_NODE + '/operations/' CONTEXT = 'idchain' RPC_URL = 'wss://idchain.one/ws/' RELAYER_ADDRESS = '0x0df7eDDd60D613362ca2b44659F56fEbafFA9bFB' DISTRIBUTION_ADDRESS = '0x6E39d7540c2a...
brightid_node = 'http://node.brightid.org/brightid/v5' verifications_url = BRIGHTID_NODE + '/verifications/idchain/' operation_url = BRIGHTID_NODE + '/operations/' context = 'idchain' rpc_url = 'wss://idchain.one/ws/' relayer_address = '0x0df7eDDd60D613362ca2b44659F56fEbafFA9bFB' distribution_address = '0x6E39d7540c2ad...
# Time: O(n log n); Space: O(n) def target_indices(nums, target): nums.sort() ans = [] for i, n in enumerate(nums): if n == target: ans.append(i) return ans # Time: O(n + k); Space(n + k) def target_indices2(nums, target): count = [0] * (max(nums) + 1) for n in nums: ...
def target_indices(nums, target): nums.sort() ans = [] for (i, n) in enumerate(nums): if n == target: ans.append(i) return ans def target_indices2(nums, target): count = [0] * (max(nums) + 1) for n in nums: count[n] += 1 sorted_nums = [] for (i, n) in enumera...
class Browser(object): def __init__(self): form = {} def open(self, url): pass def set_handle_robots(self, status): pass def set_cookiejar(self, cj): pass def forms(self): forms = [{'session[username_or_email]':'', 'session[password]':''}] return f...
class Browser(object): def __init__(self): form = {} def open(self, url): pass def set_handle_robots(self, status): pass def set_cookiejar(self, cj): pass def forms(self): forms = [{'session[username_or_email]': '', 'session[password]': ''}] retur...
class Dataset(): def __init__(self, data,feature=None): self.len = data.shape[0] if (feature is not None): self.data = data[:,:feature] self.label = data[:,feature:] else: feature = data.shape[1] self.data = data[:,:feature] self.label = None def __getitem__(self, index):...
class Dataset: def __init__(self, data, feature=None): self.len = data.shape[0] if feature is not None: self.data = data[:, :feature] self.label = data[:, feature:] else: feature = data.shape[1] self.data = data[:, :feature] self.l...
class UnbundledTradeIndicatorEnum: UNBUNDLED_TRADE_NONE = 0 FIRST_SUB_TRADE_OF_UNBUNDLED_TRADE = 1 LAST_SUB_TRADE_OF_UNBUNDLED_TRADE = 2
class Unbundledtradeindicatorenum: unbundled_trade_none = 0 first_sub_trade_of_unbundled_trade = 1 last_sub_trade_of_unbundled_trade = 2
# -*- coding: UTF-8 -* def input_data2(): return None
def input_data2(): return None
def longest_possible_word_length(): return 189819 class iterlines(object): def __init__(self, filehandle): self._filehandle = filehandle def __iter__(self): self._filehandle.seek(0) return self def __next__(self): line = self._filehandle.readline() if line == '...
def longest_possible_word_length(): return 189819 class Iterlines(object): def __init__(self, filehandle): self._filehandle = filehandle def __iter__(self): self._filehandle.seek(0) return self def __next__(self): line = self._filehandle.readline() if line == ...
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def __repr__(self): if type(self.data) != 'str': return str(self.data) return self.data def _height(root): if root is None: return 0 return max(_heig...
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def __repr__(self): if type(self.data) != 'str': return str(self.data) return self.data def _height(root): if root is None: return 0 return max(_height...
def most_frequent(arr): ret = None counter = {} max_count = -1 for n in arr: counter.setdefault(n, 0) counter[n] += 1 if counter[n] > max_count: max_count = counter[n] ret = n return ret
def most_frequent(arr): ret = None counter = {} max_count = -1 for n in arr: counter.setdefault(n, 0) counter[n] += 1 if counter[n] > max_count: max_count = counter[n] ret = n return ret
# Created by MechAviv # Kinesis Introduction # Map ID :: 331003200 # Subway :: Subway Car #3 JAY = 1531001 GIRL = 1531067 sm.spawnNpc(GIRL, 699, 47) sm.showNpcSpecialActionByTemplateId(GIRL, "summon") sm.spawnMob(2700303, 250, 57, False) sm.spawnMob(2700303, 250, 57, False) sm.spawnMob(2700303, 250, 57, False) sm.spa...
jay = 1531001 girl = 1531067 sm.spawnNpc(GIRL, 699, 47) sm.showNpcSpecialActionByTemplateId(GIRL, 'summon') sm.spawnMob(2700303, 250, 57, False) sm.spawnMob(2700303, 250, 57, False) sm.spawnMob(2700303, 250, 57, False) sm.spawnMob(2700303, 250, 57, False) sm.spawnMob(2700303, 250, 57, False) sm.spawnMob(2700304, 300, 5...
# https://www.hackerrank.com/challenges/30-review-loop/ T = int(input()) S = list() for i in range(T): S.append(str(input())) for i in range(len(S)): print(S[i][0] + S[i][2::2] + ' ' + S[i][1::2])
t = int(input()) s = list() for i in range(T): S.append(str(input())) for i in range(len(S)): print(S[i][0] + S[i][2::2] + ' ' + S[i][1::2])
# # PySNMP MIB module A3COM0420-SWITCH-EXTENSIONS (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM0420-SWITCH-EXTENSIONS # Produced by pysmi-0.3.4 at Mon Apr 29 16:54:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python versio...
(brasica2,) = mibBuilder.importSymbols('A3COM0004-GENERIC', 'brasica2') (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constrain...
L = int(input()) R = int(input()) xor = L ^ R max_xor = 1 while xor: xor >>= 1 max_xor <<= 1 print (max_xor-1)
l = int(input()) r = int(input()) xor = L ^ R max_xor = 1 while xor: xor >>= 1 max_xor <<= 1 print(max_xor - 1)
# microbit-module: shared_config@0.1.0 RADIO_CHANNEL = 17 MSG_DEYLAY = 50
radio_channel = 17 msg_deylay = 50
# Invert a binary tree. # Input: # 4 # / \ # 2 7 # / \ / \ # 1 3 6 9 # # Output: # 4 # / \ # 7 2 # / \ / \ # 9 6 3 1 class TreeNode: def __init__(self, val): self.val = val self.left = None self.right = None class Solution: def invertTree...
class Treenode: def __init__(self, val): self.val = val self.left = None self.right = None class Solution: def invert_tree(self, node: TreeNode) -> TreeNode: if not node: return None (node.left, node.right) = (self.invertTree(node.right), self.invertTree(no...
def roundUp(number:float)->int: split = [int(i) for i in str(number).split(".")] if split[1] >0: return split[0]+1 return split[0] ## Program Start ## n, k = [int(i) for i in input().strip().split(" ")][-2:] scores = sorted([int(i) for i in input().strip().split(" ")]) min_days = roundUp(n/k) ou...
def round_up(number: float) -> int: split = [int(i) for i in str(number).split('.')] if split[1] > 0: return split[0] + 1 return split[0] (n, k) = [int(i) for i in input().strip().split(' ')][-2:] scores = sorted([int(i) for i in input().strip().split(' ')]) min_days = round_up(n / k) output = 0 for...
class StackOfPlates(object): def __init__(self): self.stack = [] self.capacity = 10 def push(self, item): if self.stack and self.stack[-1].length() < 10: self.stack[-1].push(item) else: new_stack = Stack() new_stack.push(item) sel...
class Stackofplates(object): def __init__(self): self.stack = [] self.capacity = 10 def push(self, item): if self.stack and self.stack[-1].length() < 10: self.stack[-1].push(item) else: new_stack = stack() new_stack.push(item) sel...
def skipVowels(word): novowels = '' for ch in word: if ch.lower() in 'aeiou': continue novowels += ch novowels+=ch return novowels print(skipVowels('hello')) print(skipVowels('awaited'))
def skip_vowels(word): novowels = '' for ch in word: if ch.lower() in 'aeiou': continue novowels += ch novowels += ch return novowels print(skip_vowels('hello')) print(skip_vowels('awaited'))
DosTags = { # System 33: "SYS_Input", 34: "SYS_Output", 35: "SYS_Asynch", 36: "SYS_UserShell", 37: "SYS_CustomShell", # CreateNewProc 1001: "NP_SegList", 1002: "NP_FreeSegList", 1003: "NP_Entry", 1004: "NP_Input", 1005: "NP_Output", 1006: "NP_CloseInput", 1007: "N...
dos_tags = {33: 'SYS_Input', 34: 'SYS_Output', 35: 'SYS_Asynch', 36: 'SYS_UserShell', 37: 'SYS_CustomShell', 1001: 'NP_SegList', 1002: 'NP_FreeSegList', 1003: 'NP_Entry', 1004: 'NP_Input', 1005: 'NP_Output', 1006: 'NP_CloseInput', 1007: 'NP_CloseOutput', 1008: 'NP_Error', 1009: 'NP_CloseError', 1010: 'NP_CurrentDir', 1...
# 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 class Solution: def findBottomLeftValue(self, root: TreeNode) -> int: current = [root] while True: ...
class Solution: def find_bottom_left_value(self, root: TreeNode) -> int: current = [root] while True: children = [] for node in current: if node.left: children.append(node.left) if node.right: children.a...
# # PySNMP MIB module CXMLPPP-IP-NCP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXMLPPP-IP-NCP-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:33:10 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, constraints_union, value_size_constraint, value_range_constraint) ...
def B(): n = int(input()) a = [int(x) for x in input().split()] d = {i:[] for i in range(1,n+1)} d[0]= [0,0] for i in range(2*n): d[a[i]].append(i) ans = 0 for i in range(n): a , b = d[i] , d[i+1] ans+= min(abs(b[0]-a[0])+abs(b[1]-a[1]) , abs(b[0]-a[1])+abs(b[1]-a[0])...
def b(): n = int(input()) a = [int(x) for x in input().split()] d = {i: [] for i in range(1, n + 1)} d[0] = [0, 0] for i in range(2 * n): d[a[i]].append(i) ans = 0 for i in range(n): (a, b) = (d[i], d[i + 1]) ans += min(abs(b[0] - a[0]) + abs(b[1] - a[1]), abs(b[0] - ...
line_items = [{ "invNumber": 100, "lineNumber": 1, "partNumber": "TU100", "description": "TacUmbrella", "price": 9.99 }, { "invNumber": 100, "lineNumber": 2, "partNumber": "TLB9000", "description": "TacLunch...
line_items = [{'invNumber': 100, 'lineNumber': 1, 'partNumber': 'TU100', 'description': 'TacUmbrella', 'price': 9.99}, {'invNumber': 100, 'lineNumber': 2, 'partNumber': 'TLB9000', 'description': 'TacLunchbox 9000', 'price': 19.99}, {'invNumber': 101, 'lineNumber': 1, 'partNumber': 'TPJ5', 'description': 'TacPajamas', '...