content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
load("//third_party:common.bzl", "err_out", "execute") _LLVM_BINARIES = [ "clang", "clang-cpp", "ld.lld", "llvm-ar", "llvm-as", "llvm-nm", "llvm-objcopy", "llvm-objdump", "llvm-profdata", "llvm-dwp", "llvm-ranlib", "llvm-readelf", "llvm-strip", "llvm-symbolizer",...
load('//third_party:common.bzl', 'err_out', 'execute') _llvm_binaries = ['clang', 'clang-cpp', 'ld.lld', 'llvm-ar', 'llvm-as', 'llvm-nm', 'llvm-objcopy', 'llvm-objdump', 'llvm-profdata', 'llvm-dwp', 'llvm-ranlib', 'llvm-readelf', 'llvm-strip', 'llvm-symbolizer'] _llvm_version_minimal = '10.0.0' def _label(filename): ...
valid=False def marray(arr,*args,**kwargs): return arr def unitsDict(*args,**kwargs): return None def varMeta(*args,**kwargs): return None
valid = False def marray(arr, *args, **kwargs): return arr def units_dict(*args, **kwargs): return None def var_meta(*args, **kwargs): return None
{ 'OS-EXT-STS:task_state': None, 'addresses': {'int-net': [ {'OS-EXT-IPS-MAC:mac_addr': 'fa:16:3e:5d:9e:22', 'version': 4, 'addr': '192.168.1.8', 'OS-EXT-IPS:type': 'fixed' }, {'OS-EXT-IPS-MAC:mac_addr': 'fa:16:3e:5d:9e:22', 'version': 4, 'addr': '192.168.166.23', 'O...
{'OS-EXT-STS:task_state': None, 'addresses': {'int-net': [{'OS-EXT-IPS-MAC:mac_addr': 'fa:16:3e:5d:9e:22', 'version': 4, 'addr': '192.168.1.8', 'OS-EXT-IPS:type': 'fixed'}, {'OS-EXT-IPS-MAC:mac_addr': 'fa:16:3e:5d:9e:22', 'version': 4, 'addr': '192.168.166.23', 'OS-EXT-IPS:type': 'floating'}]}, 'OS-EXT-STS:vm_state': '...
with open('input.txt') as f: lines = f.readlines() count = 0 curDepth = 0 for line in lines: newDepth = int(line) if curDepth != 0: if newDepth > curDepth: count += 1 curDepth = newDepth print(count)
with open('input.txt') as f: lines = f.readlines() count = 0 cur_depth = 0 for line in lines: new_depth = int(line) if curDepth != 0: if newDepth > curDepth: count += 1 cur_depth = newDepth print(count)
def add(x, y=3): print(x + y) add(5) # 8 add(5, 8) # 13 add(y=3) # Error, missing x # -- Order of default parameters -- # def add(x=5, y): # Not OK, default parameters must go after non-default # print(x + y) # -- Usually don't use variables as default value -- default_y = 3 def add(x, y=default_y):...
def add(x, y=3): print(x + y) add(5) add(5, 8) add(y=3) default_y = 3 def add(x, y=default_y): sum = x + y print(sum) add(2) default_y = 4 print(default_y) add(2)
''' Filippo Aleotti filippo.aleotti2@unibo.it 29 November 2019 I PROFESSIONAL MASTER'S PROGRAM, II LEVEL "SIMUR", Imola 2019 Given a list of integer, store the frequency of each value in a dict, where the key is the value. ''' def are_equals(dict1, dict2): ''' check if two dict are equal. Both the dicts...
""" Filippo Aleotti filippo.aleotti2@unibo.it 29 November 2019 I PROFESSIONAL MASTER'S PROGRAM, II LEVEL "SIMUR", Imola 2019 Given a list of integer, store the frequency of each value in a dict, where the key is the value. """ def are_equals(dict1, dict2): """ check if two dict are equal. Both the dicts...
#!/usr/bin/env python print("Hello from cx_Freeze Advanced #1\n") module = __import__("testfreeze_1")
print('Hello from cx_Freeze Advanced #1\n') module = __import__('testfreeze_1')
# Create a function that takes an integer as an argument and returns "Even" for even numbers or "Odd" for odd numbers. def even_or_odd(number): if number % 2 == 0: return "Even" else: return "Odd" assert (even_or_odd(2)) == "Even", "Debe devolver Even" assert (even_or_odd(0)) == "Even", "Debe...
def even_or_odd(number): if number % 2 == 0: return 'Even' else: return 'Odd' assert even_or_odd(2) == 'Even', 'Debe devolver Even' assert even_or_odd(0) == 'Even', 'Debe devolver Even' assert even_or_odd(7) == 'Odd', 'Debe devolver Odd' assert even_or_odd(1) == 'Odd', 'Debe devolver Odd'
n = int(input()) L = list(map(int,input().split())) A = list(set(L[:])) d = {} A.sort() for i in range(len(A)): d[A[i]] = i for i in L: print(d[i],end = " ")
n = int(input()) l = list(map(int, input().split())) a = list(set(L[:])) d = {} A.sort() for i in range(len(A)): d[A[i]] = i for i in L: print(d[i], end=' ')
# Url https://leetcode.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer/ class Solution: def subtractProductAndSum(self, n): prod, sum_n, curr = 1, 0, 0 while n != 0: curr = n % 10 prod = prod * curr sum_n = sum_n + curr n = n//10 ...
class Solution: def subtract_product_and_sum(self, n): (prod, sum_n, curr) = (1, 0, 0) while n != 0: curr = n % 10 prod = prod * curr sum_n = sum_n + curr n = n // 10 return prod - sum_n if __name__ == '__main__': a = solution() print(...
# Work out the first ten digits of the sum of N 50 digit numbers. total = 0 for x in range(int(input())): total += int(input().rstrip()) print(str(total)[:10])
total = 0 for x in range(int(input())): total += int(input().rstrip()) print(str(total)[:10])
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author: class TaskName(): Classify_Task = "classify" Detect2d_Task = "detect2d" Segment_Task = "segment" PC_Classify_Task = "pc_classify"
class Taskname: classify__task = 'classify' detect2d__task = 'detect2d' segment__task = 'segment' pc__classify__task = 'pc_classify'
class TheEquation: def leastSum(self, X, Y, P): m = 2*P for i in xrange(1, P+1): for j in xrange(1, P+1): if (X*i + Y*j)%P == 0: m = min(m, i+j) return m
class Theequation: def least_sum(self, X, Y, P): m = 2 * P for i in xrange(1, P + 1): for j in xrange(1, P + 1): if (X * i + Y * j) % P == 0: m = min(m, i + j) return m
#!/usr/bin/env python3 class FakeSerial: def __init__(self): self._last_written_data = None self._response = None self.read_data = [] @property def last_written_data(self): return self._last_written_data @property def response(self): return self._response ...
class Fakeserial: def __init__(self): self._last_written_data = None self._response = None self.read_data = [] @property def last_written_data(self): return self._last_written_data @property def response(self): return self._response @response.setter ...
# coding=utf-8 # Definition for singly-linked list. class ListNode(object): def __init__(self, x, next=None): self.val = x self.next = next class DoubleNode(object): def __init__(self, key, val, pre=None, next=None): self.key = key self.val = val self.pre = pre ...
class Listnode(object): def __init__(self, x, next=None): self.val = x self.next = next class Doublenode(object): def __init__(self, key, val, pre=None, next=None): self.key = key self.val = val self.pre = pre self.next = next class Treenode(object): def ...
seen = [] # Prduces the length of the longest Substring # thats comprised of just unique characters def max_diff(string): seen = [0]*256 curr_start = 0 max_start = 0 unique = 0 max_unique = 0 for n,i in enumerate(string): if seen[assn_num(i)] == 0: unique += 1 ...
seen = [] def max_diff(string): seen = [0] * 256 curr_start = 0 max_start = 0 unique = 0 max_unique = 0 for (n, i) in enumerate(string): if seen[assn_num(i)] == 0: unique += 1 else: if unique > max_unique: max_unique = unique w...
def _test_sources_aspect_impl(target, ctx): result = depset() if hasattr(ctx.rule.attr, "tags") and "NODE_MODULE_MARKER" in ctx.rule.attr.tags: return struct(node_test_sources=result) if hasattr(ctx.rule.attr, "deps"): for dep in ctx.rule.attr.deps: if hasattr(dep, "node_test_s...
def _test_sources_aspect_impl(target, ctx): result = depset() if hasattr(ctx.rule.attr, 'tags') and 'NODE_MODULE_MARKER' in ctx.rule.attr.tags: return struct(node_test_sources=result) if hasattr(ctx.rule.attr, 'deps'): for dep in ctx.rule.attr.deps: if hasattr(dep, 'node_test_sou...
def is_prime(n): if n > 1: for i in range(2, n // 2 + 1): if (n % i) == 0: return False else: return True else: return False def fibonacci(n): n1, n2 = 1, 1 count = 0 if n == 1: print(n1) else: while count < n: ...
def is_prime(n): if n > 1: for i in range(2, n // 2 + 1): if n % i == 0: return False else: return True else: return False def fibonacci(n): (n1, n2) = (1, 1) count = 0 if n == 1: print(n1) else: while count < n: ...
class Solution: def maxProfit(self, prices: List[int]) -> int: running_min = prices[0] best_trans1 = [0] for p in prices[1:]: if p < running_min: running_min = p best_trans1.append(max(p - running_min, best_trans1[-1])) running_max = prices[...
class Solution: def max_profit(self, prices: List[int]) -> int: running_min = prices[0] best_trans1 = [0] for p in prices[1:]: if p < running_min: running_min = p best_trans1.append(max(p - running_min, best_trans1[-1])) running_max = prices[-...
version = "dev 0.0" running = False def init(): global running if not running: print("JFUtils-python \"" + version + "\" by jonnelafin") running = True
version = 'dev 0.0' running = False def init(): global running if not running: print('JFUtils-python "' + version + '" by jonnelafin') running = True
class FiniteAutomataState: def __init__(self, structure): self.states = [] self.alphabet = [] self.initial = [] self.finals = [] self.transitions = {} self._file = open(structure, "r") self._load() # print(self.validate()) def _load(self): ...
class Finiteautomatastate: def __init__(self, structure): self.states = [] self.alphabet = [] self.initial = [] self.finals = [] self.transitions = {} self._file = open(structure, 'r') self._load() def _load(self): reading = 'none' readin...
#!/usr/bin/python compteur = 0 i,j = 3,1 terrain = [] fichier = open('day3_input.txt') for l in fichier: terrain.append(fichier.readline().strip('\n')) nblig = len(terrain) nbcol = len(terrain[0]) print('nblig : %s / nbcol : %s' % (nblig,nbcol)) for f in terrain: print(f) while j<nblig: #print(i,j,terra...
compteur = 0 (i, j) = (3, 1) terrain = [] fichier = open('day3_input.txt') for l in fichier: terrain.append(fichier.readline().strip('\n')) nblig = len(terrain) nbcol = len(terrain[0]) print('nblig : %s / nbcol : %s' % (nblig, nbcol)) for f in terrain: print(f) while j < nblig: if terrain[j][i] == '#': ...
dicionario_sites = {"Diego": "diegomariano.com"} print(dicionario_sites['Diego']) dicionario_sites = {"Diego": "diegomariano.com", "Google": "google.com", "Udemy": "udemy.com", "Luiz Carlin" : "luizcarlin.com.br"} print ("-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=") for chave in dicionario_sites: print (chave + " -...
dicionario_sites = {'Diego': 'diegomariano.com'} print(dicionario_sites['Diego']) dicionario_sites = {'Diego': 'diegomariano.com', 'Google': 'google.com', 'Udemy': 'udemy.com', 'Luiz Carlin': 'luizcarlin.com.br'} print('-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=') for chave in dicionario_sites: print(chave + ' -:- ' ...
# -*- coding: utf-8 -*- # Author: Tonio Teran <tonio@stateoftheart.ai> # Copyright: Stateoftheart AI PBC 2021. '''RLlib's library wrapper.''' SOURCE_METADATA = { 'name': 'rllib', 'original_name': 'RLlib', 'url': 'https://docs.ray.io/en/master/rllib.html' } MODELS = { 'discrete': [ 'A2C', 'A3C'...
"""RLlib's library wrapper.""" source_metadata = {'name': 'rllib', 'original_name': 'RLlib', 'url': 'https://docs.ray.io/en/master/rllib.html'} models = {'discrete': ['A2C', 'A3C', 'ARS', 'BC', 'ES', 'DQN', 'Rainbow', 'APEX-DQN', 'IMPALA', 'MARWIL', 'PG', 'PPO', 'APPO', 'R2D2', 'SAC', 'SlateQ', 'LinUCB', 'LinTS', 'Alph...
# Recursive, O(2^n) def LCS(X, Y, m, n): if m == 0 or n == 0: return 0 elif X[m - 1] == Y[n - 1]: return 1 + LCS(X, Y, m - 1, n - 1) else: return max(LCS(X, Y, m - 1, n), LCS(X, Y, m, n - 1)) X = "AGGTAB" Y = "GXTXAYB" print("Length of LCS is ", LCS(X, Y, len(X), len(Y))) # Overl...
def lcs(X, Y, m, n): if m == 0 or n == 0: return 0 elif X[m - 1] == Y[n - 1]: return 1 + lcs(X, Y, m - 1, n - 1) else: return max(lcs(X, Y, m - 1, n), lcs(X, Y, m, n - 1)) x = 'AGGTAB' y = 'GXTXAYB' print('Length of LCS is ', lcs(X, Y, len(X), len(Y))) def lcs(X, Y): m = len(X) ...
class CalculoZ(): def calcular_z(self, n1, n2, x, y, ux, uy, ox, oy): arriba = (x-y)-(ux-uy) abajo = (((ox)**2/(n1))+((oy)**2/(n2)))**0.5 z = arriba/abajo return z
class Calculoz: def calcular_z(self, n1, n2, x, y, ux, uy, ox, oy): arriba = x - y - (ux - uy) abajo = (ox ** 2 / n1 + oy ** 2 / n2) ** 0.5 z = arriba / abajo return z
class Solution: def intToRoman(self, num: int) -> str: res = "" s = ['I', 'V', 'X', 'L', 'C', 'D', 'M'] index = 0 while num > 0: x = num % 10 if x < 5: if x == 4: temp = s[index] + s[index + 1] else: ...
class Solution: def int_to_roman(self, num: int) -> str: res = '' s = ['I', 'V', 'X', 'L', 'C', 'D', 'M'] index = 0 while num > 0: x = num % 10 if x < 5: if x == 4: temp = s[index] + s[index + 1] else: ...
N, X, T = map(int, input().split()) time = N // X if(N%X == 0): print(time * T) else: print((time+1) * T)
(n, x, t) = map(int, input().split()) time = N // X if N % X == 0: print(time * T) else: print((time + 1) * T)
class Token: __slots__ = ('start', 'end') def __init__(self, start: int=None, end: int=None): self.start = start self.end = end @property def type(self): "Type of current token" return self.__class__.__name__ def to_json(self): return dict([(k, self.__getat...
class Token: __slots__ = ('start', 'end') def __init__(self, start: int=None, end: int=None): self.start = start self.end = end @property def type(self): """Type of current token""" return self.__class__.__name__ def to_json(self): return dict([(k, self.__g...
literals = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ,.?/:;{[]}-=_+~!@#$%^&*()" #obfuscated literals = "tJ;EM mKrFzQ_SOT?]B[U@$yqec~fhd{=is&alxPIbnuRkC%Z(jDw#G:/)L,*.V!pov+HNYA^g-}WX" key = 7 def shuffle(plaintext): shuffled = "" # shuffle plaintext for i in range(int(len(plaintext) / 3)): ...
literals = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ,.?/:;{[]}-=_+~!@#$%^&*()' literals = 'tJ;EM mKrFzQ_SOT?]B[U@$yqec~fhd{=is&alxPIbnuRkC%Z(jDw#G:/)L,*.V!pov+HNYA^g-}WX' key = 7 def shuffle(plaintext): shuffled = '' for i in range(int(len(plaintext) / 3)): block = plaintext[i * 3] + plain...
curupira = int(input()) boitata = int(input()) boto = int(input()) mapinguari = int(input()) lara = int(input()) total = 225 + (curupira * 300) + (boitata *1500) + (boto * 600) + (mapinguari * 1000)+(lara*150) print(total)
curupira = int(input()) boitata = int(input()) boto = int(input()) mapinguari = int(input()) lara = int(input()) total = 225 + curupira * 300 + boitata * 1500 + boto * 600 + mapinguari * 1000 + lara * 150 print(total)
class Sibling: pass
class Sibling: pass
if True: foo = 42 else: foo = None
if True: foo = 42 else: foo = None
#!/usr/bin/python3 print("Sum of even-valued terms less than four million in the Fibonacci sequence:") a, b, sum = 1, 1, 0 while b < 4000000: sum += b if b % 2 == 0 else 0 a, b = b, a + b print(sum)
print('Sum of even-valued terms less than four million in the Fibonacci sequence:') (a, b, sum) = (1, 1, 0) while b < 4000000: sum += b if b % 2 == 0 else 0 (a, b) = (b, a + b) print(sum)
#LeetCode problem 200: Number of Islands class Solution: def check(self,grid,nodesVisited,row,col,m,n): return (row>=0 and row<m and col>=0 and col<n and grid[row][col]=="1" and nodesVisited[row][col]==0) def dfs(self,grid,nodesVisited,row,col,m,n): a=[-1,1,0,0] b=[0,0,1,-1] ...
class Solution: def check(self, grid, nodesVisited, row, col, m, n): return row >= 0 and row < m and (col >= 0) and (col < n) and (grid[row][col] == '1') and (nodesVisited[row][col] == 0) def dfs(self, grid, nodesVisited, row, col, m, n): a = [-1, 1, 0, 0] b = [0, 0, 1, -1] nod...
''' Create exceptions based on your inputs. Please follow the tasks below. - Capture and handle system exceptions - Create custom user-based exceptions ''' class CustomInputError(Exception): def __init__(self, *args, **kwargs): print("Going through my own CustomInputError") # Exception.__init_...
""" Create exceptions based on your inputs. Please follow the tasks below. - Capture and handle system exceptions - Create custom user-based exceptions """ class Custominputerror(Exception): def __init__(self, *args, **kwargs): print('Going through my own CustomInputError') class Myzerodivisionexcepti...
# https://www.acmicpc.net/problem/8393 a = int(input()) result = 0 for i in range(a + 1): result = result + i print(result)
a = int(input()) result = 0 for i in range(a + 1): result = result + i print(result)
# conf.py/Open GoPro, Version 1.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro). # This copyright was auto-generated on Tue May 18 22:08:50 UTC 2021 project = "Open GoPro Python SDK" copyright = "2020, GoPro Inc." author = "Tim Camise" version = "0.5.8" release = "0.5.8" templates_path = ["_templates"] s...
project = 'Open GoPro Python SDK' copyright = '2020, GoPro Inc.' author = 'Tim Camise' version = '0.5.8' release = '0.5.8' templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' pygments_style = 'sphinx' html_static_path = ['_static'] extensions = ['sphinx.ext.autodoc', 'sphinxcontrib.napoleon', 's...
# Link --> https://www.hackerrank.com/challenges/maximum-element/problem # Code: def getMax(operations): maximum = 0 temp = [] answer = [] for i in operations: if i != '2' and i != '3': numbers = i.split() number = int(numbers[1]) temp.append(number) ...
def get_max(operations): maximum = 0 temp = [] answer = [] for i in operations: if i != '2' and i != '3': numbers = i.split() number = int(numbers[1]) temp.append(number) if number > maximum: maximum = number elif i == '2': ...
#!/usr/bin/env python3 if __name__ == "__main__": N = int(input().strip()) stamps = set() for _ in range(N): stamp = input().strip() stamps.add(stamp) print(len(stamps))
if __name__ == '__main__': n = int(input().strip()) stamps = set() for _ in range(N): stamp = input().strip() stamps.add(stamp) print(len(stamps))
# -*- coding: utf-8 -*- # Copyright (C) 2017 Intel Corporation. All rights reserved. # # 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 # # ...
class Group(object): def __init__(self, name): self.name = name self.__attributes = {} def equals(self, obj): return self.name == obj.get_name() def get_attribute(self, key): return self._attributes[key] def get_device_members(self): devices = [] all_d...
datasetDir = '../dataset/' model = '../model/lenet' modelDir = '../model/' epochs = 20 batchSize = 128 rate = 0.001 mu = 0 sigma = 0.1
dataset_dir = '../dataset/' model = '../model/lenet' model_dir = '../model/' epochs = 20 batch_size = 128 rate = 0.001 mu = 0 sigma = 0.1
# flake8: noqa _JULIA_V1 = { "$schema": "http://json-schema.org/draft-04/schema#", "title": "PythonRuntimeMetadata v1.0", "description": "PythonRuntimeMetadata runtime/metadata.json schema.", "type": "object", "properties": { "metadata_version": { "description": "The metadata ver...
_julia_v1 = {'$schema': 'http://json-schema.org/draft-04/schema#', 'title': 'PythonRuntimeMetadata v1.0', 'description': 'PythonRuntimeMetadata runtime/metadata.json schema.', 'type': 'object', 'properties': {'metadata_version': {'description': 'The metadata version.', 'type': 'string'}, 'implementation': {'description...
# Copyright 2009 Moyshe BenRabi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
class Programfragment(object): def __init__(self): self.max_program_name = 25 self.program_name = '' self.program_major_version = 0 self.program_minor_version = 0 self.protocol_major_version = 0 self.protocol_minor_version = 0 self.protocol_source_revision = ...
test_cases = int(input()) for t in range(1, test_cases + 1): nums = list(map(int, input().strip().split())) result = [] for i in range(0, 5): for j in range(i + 1, 6): for k in range(j + 1, 7): result.append(nums[i] + nums[j] + nums[k]) result = sorted(list(set(resul...
test_cases = int(input()) for t in range(1, test_cases + 1): nums = list(map(int, input().strip().split())) result = [] for i in range(0, 5): for j in range(i + 1, 6): for k in range(j + 1, 7): result.append(nums[i] + nums[j] + nums[k]) result = sorted(list(set(result...
# atomic level def get_idx(list, key): for idx in range(len(list)): if key == list[idx][0]: return idx def ins(list, key, val): list.append([key, val]) return list def ret(list, key): idx = get_idx(list, key) return list[idx][1] def upd(list, key, val): new_item = [key....
def get_idx(list, key): for idx in range(len(list)): if key == list[idx][0]: return idx def ins(list, key, val): list.append([key, val]) return list def ret(list, key): idx = get_idx(list, key) return list[idx][1] def upd(list, key, val): new_item = [key.lower(), val] ...
class Example: def __init__(self): self.name = "" pass def greet(self, name): self.name = name print("hello " + name)
class Example: def __init__(self): self.name = '' pass def greet(self, name): self.name = name print('hello ' + name)
#!/usr/bin/env python3 visited = set() visited.add((0, 0)) turn = 0 # Santa = 0, Robo-Santa = 1 locations = [[0, 0], [0, 0]] with open('input.txt', 'r') as f: for line in f: for ch in line: pos = locations[turn] turn = (turn + 1) % 2 if ch == '^': pos[...
visited = set() visited.add((0, 0)) turn = 0 locations = [[0, 0], [0, 0]] with open('input.txt', 'r') as f: for line in f: for ch in line: pos = locations[turn] turn = (turn + 1) % 2 if ch == '^': pos[0] += 1 elif ch == 'v': pos...
# import pytest class TestBaseReplacerMixin: def test_target(self): # synced assert True def test_write(self): # synced assert True def test_flush(self): # synced assert True def test_close(self): # synced assert True class TestStdOutReplacerMixin: def test...
class Testbasereplacermixin: def test_target(self): assert True def test_write(self): assert True def test_flush(self): assert True def test_close(self): assert True class Teststdoutreplacermixin: def test_target(self): assert True class Teststderrrepla...
# coding: utf8 db.define_table('post', Field('Email',requires=IS_EMAIL()), Field('filen','upload'), auth.signature)
db.define_table('post', field('Email', requires=is_email()), field('filen', 'upload'), auth.signature)
class Solution: def dfs(self,row_cnt:int, col_cnt:int, i:int, j:int, obs_arr:list, solve_dict:dict): if (i, j) in solve_dict: return solve_dict[(i,j)] right_cnt = 0 down_cnt = 0 #right if i + 1 < row_cnt and not obs_arr[i + 1][j]: if (i + 1, j) in sol...
class Solution: def dfs(self, row_cnt: int, col_cnt: int, i: int, j: int, obs_arr: list, solve_dict: dict): if (i, j) in solve_dict: return solve_dict[i, j] right_cnt = 0 down_cnt = 0 if i + 1 < row_cnt and (not obs_arr[i + 1][j]): if (i + 1, j) in solve_dict...
dataset_type = 'ShipRSImageNet_Level2' # data_root = 'data/Ship_ImageNet/' data_root = './data/ShipRSImageNet/' CLASSES = ('Other Ship', 'Other Warship', 'Submarine', 'Aircraft Carrier', 'Cruiser', 'Destroyer', 'Frigate', 'Patrol', 'Landing', 'Commander', 'Auxiliary Ships', 'Other Merchant', 'Con...
dataset_type = 'ShipRSImageNet_Level2' data_root = './data/ShipRSImageNet/' classes = ('Other Ship', 'Other Warship', 'Submarine', 'Aircraft Carrier', 'Cruiser', 'Destroyer', 'Frigate', 'Patrol', 'Landing', 'Commander', 'Auxiliary Ships', 'Other Merchant', 'Container Ship', 'RoRo', 'Cargo', 'Barge', 'Tugboat', 'Ferry',...
def dbapi_subscription(dbsession, action, input_dict, action_filter={}, caller_area={}): _api_name = "dbapi_subscription" _api_entity = 'SUBSCRIPTION' _api_action = action _api_msgID = set_msgID(_api_name, _api_action, _api_entity) _process_identity_kwargs = {'type': 'api', 'module': module_id, 'na...
def dbapi_subscription(dbsession, action, input_dict, action_filter={}, caller_area={}): _api_name = 'dbapi_subscription' _api_entity = 'SUBSCRIPTION' _api_action = action _api_msg_id = set_msg_id(_api_name, _api_action, _api_entity) _process_identity_kwargs = {'type': 'api', 'module': module_id, 'n...
def recursiveCalc(n, counter=0, steps=''): if n<10: steps += 'Total Steps: ' + str(counter) + '.' return steps, counter counter+=1 result = calc(n) steps += str(result)+', ' return recursiveCalc(result, counter, steps) def calc(n): result = 1 while (n>0): mod = n % 1...
def recursive_calc(n, counter=0, steps=''): if n < 10: steps += 'Total Steps: ' + str(counter) + '.' return (steps, counter) counter += 1 result = calc(n) steps += str(result) + ', ' return recursive_calc(result, counter, steps) def calc(n): result = 1 while n > 0: m...
def ifPossible(a): while a%2==0: a/=2 return a test=int(input()) while test: a,b = input().split() a=int(a) b=int(b) if a>b: n=b b=a a=n num=ifPossible(b) ans=0 if num!=ifPossible(a): print("-1") else: b/=a while b>=8: b/=8 ans+=1 if b>1: ans+=1 print(ans) test-=1
def if_possible(a): while a % 2 == 0: a /= 2 return a test = int(input()) while test: (a, b) = input().split() a = int(a) b = int(b) if a > b: n = b b = a a = n num = if_possible(b) ans = 0 if num != if_possible(a): print('-1') else: ...
def bubble_sort(arr): swapped = True while swapped: swapped = False for i in range(len(arr) - 1): if arr[i] > arr[i + 1]: arr[i], arr[i + 1] = arr[i + 1], arr[i] swapped = True def selection_sort(arr): for i in range(len(arr)): minpos =...
def bubble_sort(arr): swapped = True while swapped: swapped = False for i in range(len(arr) - 1): if arr[i] > arr[i + 1]: (arr[i], arr[i + 1]) = (arr[i + 1], arr[i]) swapped = True def selection_sort(arr): for i in range(len(arr)): minpos ...
class AllennlpReaderToDict: def __init__(self, **kwargs): self.kwargs = kwargs def __call__(self, *args_ignore, **kwargs_ignore): kwargs = self.kwargs reader = kwargs.get("reader") file_path = kwargs.get("file_path") n_samples = kwargs.get("n_samples") instances...
class Allennlpreadertodict: def __init__(self, **kwargs): self.kwargs = kwargs def __call__(self, *args_ignore, **kwargs_ignore): kwargs = self.kwargs reader = kwargs.get('reader') file_path = kwargs.get('file_path') n_samples = kwargs.get('n_samples') instances...
def one_hot_encode(_df, _col): _values = set(_df[_col].values) for v in _values: _df[_col + str(v)] = _df[_col].apply(lambda x : float(x == v) ) return _df
def one_hot_encode(_df, _col): _values = set(_df[_col].values) for v in _values: _df[_col + str(v)] = _df[_col].apply(lambda x: float(x == v)) return _df
def differ(string_1, string_2): new_string = "" for i in range(len(string_1)): if string_1[i] == string_2[i]: new_string += string_1[i] return new_string def main(): f = [line.rstrip("\n") for line in open("Data.txt")] for i in range(len(f)): for j in range(i + 1, len...
def differ(string_1, string_2): new_string = '' for i in range(len(string_1)): if string_1[i] == string_2[i]: new_string += string_1[i] return new_string def main(): f = [line.rstrip('\n') for line in open('Data.txt')] for i in range(len(f)): for j in range(i + 1, len(f)...
class Car(object): # setting some default values num_of_doors = 4 num_of_wheels = 4 def __init__(self, name='General', model='GM', car_type='saloon', speed=0): self.name = name self.model = model self.car_type = car_type self.speed = speed if self.name is 'Porshe...
class Car(object): num_of_doors = 4 num_of_wheels = 4 def __init__(self, name='General', model='GM', car_type='saloon', speed=0): self.name = name self.model = model self.car_type = car_type self.speed = speed if self.name is 'Porshe' or self.name is 'Koenigsegg': ...
class Tree: def __init__(self,data): self.tree = [data, [],[]] def left_subtree(self,branch): left_list = self.tree.pop(1) if len(left_list) > 1: branch.tree[1]=left_list self.tree.insert(1,branch.tree) else: self.tree.insert(1,bra...
class Tree: def __init__(self, data): self.tree = [data, [], []] def left_subtree(self, branch): left_list = self.tree.pop(1) if len(left_list) > 1: branch.tree[1] = left_list self.tree.insert(1, branch.tree) else: self.tree.insert(1, branch....
def input_dimension(): while True: dimension = input("Enter your board dimensions: ").split() len_x1 = 0 len_y1 = 0 if len(dimension) != 2: print("Invalid dimensions!") continue try: len_x1 = int(dimension[0]) len_y1 =...
def input_dimension(): while True: dimension = input('Enter your board dimensions: ').split() len_x1 = 0 len_y1 = 0 if len(dimension) != 2: print('Invalid dimensions!') continue try: len_x1 = int(dimension[0]) len_y1 = int(dimen...
# # This file contains the Python code from Program 6.2 of # "Data Structures and Algorithms # with Object-Oriented Design Patterns in Python" # by Bruno R. Preiss. # # Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved. # # http://www.brpreiss.com/books/opus7/programs/pgm06_02.txt # class StackAsArray(...
class Stackasarray(Stack): def __init__(self, size=0): super(StackAsArray, self).__init__() self._array = array(size) def purge(self): while self._count > 0: self._array[self._count] = None self._count -= 1
n = input() split =n.split() limak = int(split[0]) bob = int(split[-1]) years = 0 while True: limak*=3 bob*=2 years+=1 if limak>bob: break print(years)
n = input() split = n.split() limak = int(split[0]) bob = int(split[-1]) years = 0 while True: limak *= 3 bob *= 2 years += 1 if limak > bob: break print(years)
fizz = 3 buzz = 5 upto = 100 for n in range(1,(upto + 1)): if n % fizz == 0: if n % buzz == 0: print("FizzBuzz") else: print("Fizz") elif n % buzz == 0: print("Buzz") else: print(n)
fizz = 3 buzz = 5 upto = 100 for n in range(1, upto + 1): if n % fizz == 0: if n % buzz == 0: print('FizzBuzz') else: print('Fizz') elif n % buzz == 0: print('Buzz') else: print(n)
#!/usr/bin/env python3 def count_combos(coins, total): len_coins = len(coins) memo = {} def count(tot, i): if tot == 0: return 1 if i == len_coins: return 0 subproblem = (tot, i) try: return memo[subproblem] except KeyError: ...
def count_combos(coins, total): len_coins = len(coins) memo = {} def count(tot, i): if tot == 0: return 1 if i == len_coins: return 0 subproblem = (tot, i) try: return memo[subproblem] except KeyError: j = i + 1 ...
ans = [] n = int(input()) for i in range(n): a, b = list(map(int, input().split())) ans.append(a + b) for i in range(len(ans)): print("Case #{}: {}".format(i+1, ans[i]))
ans = [] n = int(input()) for i in range(n): (a, b) = list(map(int, input().split())) ans.append(a + b) for i in range(len(ans)): print('Case #{}: {}'.format(i + 1, ans[i]))
SYSDIGERR = -1 NOPROCESS = -2 NOFUNCS = -3 NOATTACH = -4 CONSTOP = -5 HSTOPS = -6 HLOGLEN = -7 HNOKILL = -8 HNORUN = -9 CACHE = ".cache" LIBFILENAME = "libs.out" LANGFILENAME = ".lang.cache" BINLISTCACHE = ".binlist.cache" LIBLISTCACHE = ".liblist.cache" BINTOLIBCACHE = ".bintolib.cache" TOOLNAME = "CONF...
sysdigerr = -1 noprocess = -2 nofuncs = -3 noattach = -4 constop = -5 hstops = -6 hloglen = -7 hnokill = -8 hnorun = -9 cache = '.cache' libfilename = 'libs.out' langfilename = '.lang.cache' binlistcache = '.binlist.cache' liblistcache = '.liblist.cache' bintolibcache = '.bintolib.cache' toolname = 'CONFINE' seccompcpr...
#Given an array nums and a value val, remove all instances of that value in-place and return the new length. #Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. #The order of elements can be changed. It doesn't matter what you leave beyond the...
class Solution: def remove_element(self, nums: List[int], val: int) -> int: result = [] m = 0 for n in range(len(nums)): if nums[n] != val: nums[m] = nums[n] m += 1 return m
#!/bin/env/python infileList = [] keyList = [] cList = ( "GBR", "FIN", "CHS", "PUR", "CLM", "IBS", "CEU", "YRI", "CHB", "JPT", "LWK", "ASW", "MXL", "TSI", ) for i in range(17,23): infileList.app...
infile_list = [] key_list = [] c_list = ('GBR', 'FIN', 'CHS', 'PUR', 'CLM', 'IBS', 'CEU', 'YRI', 'CHB', 'JPT', 'LWK', 'ASW', 'MXL', 'TSI') for i in range(17, 23): infileList.append('proc_input.chr' + str(i) + '.vcf') keyList.append('cluster_chr' + str(i)) infileList.append('proc_input.chrX.vcf') keyList.append(...
n = int(input()) sumI = 0 for i in range(n): sumI = sumI + int(input()) o = int(input()) for i in range(o): sumI = sumI + int(input()) print('{:.3f}'.format((round(sumI*1000/(n+i+1)))/1000))
n = int(input()) sum_i = 0 for i in range(n): sum_i = sumI + int(input()) o = int(input()) for i in range(o): sum_i = sumI + int(input()) print('{:.3f}'.format(round(sumI * 1000 / (n + i + 1)) / 1000))
class HeapError(Exception): pass class Heap(object): def __init__(self, iterable=()): self._heap = [] for value in iterable: self.push(value) def _get(self, node): if not self._heap: raise HeapError("empty heap") if node is None: retur...
class Heaperror(Exception): pass class Heap(object): def __init__(self, iterable=()): self._heap = [] for value in iterable: self.push(value) def _get(self, node): if not self._heap: raise heap_error('empty heap') if node is None: return...
# Sum of numbers 3 def get_sum(x, y): s = 0 if x > y: for index in range(y, x + 1): s = s + index return s elif x < y: for index in range(x, y + 1): s = s + index return s else: return x print(get_sum(2, 1)) print(get_sum(0, -1))
def get_sum(x, y): s = 0 if x > y: for index in range(y, x + 1): s = s + index return s elif x < y: for index in range(x, y + 1): s = s + index return s else: return x print(get_sum(2, 1)) print(get_sum(0, -1))
# EMPTY = "L" # OCCUPIED = "#" # FIXED = "." EMPTY = 0 OCCUPIED = 1 FIXED = -1 def read_input(file_name): seats = [] with open(file_name) as input_file: for line in input_file: line = line.strip() seats.append( list(map(map_input, line) )) return seats # Failed attempt to...
empty = 0 occupied = 1 fixed = -1 def read_input(file_name): seats = [] with open(file_name) as input_file: for line in input_file: line = line.strip() seats.append(list(map(map_input, line))) return seats def map_input(x): if x == '.': return FIXED elif x =...
# When user enters 'exit', exit program while (True): inp = raw_input('> ') if inp.lower() == 'exit': break else: print(inp)
while True: inp = raw_input('> ') if inp.lower() == 'exit': break else: print(inp)
# https://leetcode.com/problems/bulls-and-cows class Solution: def getHint(self, secret, guess): s_used, g_used = set(), set() bull = 0 for idx, (s_char, g_char) in enumerate(zip(secret, guess)): if s_char == g_char: bull += 1 s_used.add(idx) ...
class Solution: def get_hint(self, secret, guess): (s_used, g_used) = (set(), set()) bull = 0 for (idx, (s_char, g_char)) in enumerate(zip(secret, guess)): if s_char == g_char: bull += 1 s_used.add(idx) g_used.add(idx) prin...
__version__ = '0.2.2' default_app_config = 'cid.apps.CidAppConfig'
__version__ = '0.2.2' default_app_config = 'cid.apps.CidAppConfig'
# # PySNMP MIB module HH3C-IDS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-IDS-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:27:21 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,...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_union, value_range_constraint, constraints_intersection) ...
class TrieNode(): def __init__(self, letter=''): self.children = {} self.is_word = False def lookup_letter(self, c): if c in self.children: return True, self.children[c].is_word else: return False, False class Trie(): def __init__(self): se...
class Trienode: def __init__(self, letter=''): self.children = {} self.is_word = False def lookup_letter(self, c): if c in self.children: return (True, self.children[c].is_word) else: return (False, False) class Trie: def __init__(self): se...
def calcula_fatorial(n): resultado = 1 for i in range(1, n+1): resultado = resultado * i return resultado def imprime_numeros(n): imprimir = "" for i in range(n, 0, -1): imprimir += "%d . " %(i) return imprimir[:len(imprimir) - 3] numero = int(input("Digite um numero: ")) ...
def calcula_fatorial(n): resultado = 1 for i in range(1, n + 1): resultado = resultado * i return resultado def imprime_numeros(n): imprimir = '' for i in range(n, 0, -1): imprimir += '%d . ' % i return imprimir[:len(imprimir) - 3] numero = int(input('Digite um numero: ')) print...
class Solution: def minMeetingRooms(self, intervals: List[List[int]]) -> int: rooms = 0 if not intervals: return 0 endp = 0 starts = sorted([i[0] for i in intervals]) ends = sorted([i[1] for i in intervals]) for i in ran...
class Solution: def min_meeting_rooms(self, intervals: List[List[int]]) -> int: rooms = 0 if not intervals: return 0 endp = 0 starts = sorted([i[0] for i in intervals]) ends = sorted([i[1] for i in intervals]) for i in range(len(starts)): if s...
# Copyright (C) 2021 Intel Corporation # # SPDX-License-Identifier: MIT class PointCloudPath: BASE_DIR = 'ds0' ANNNOTATION_DIR = 'ann' DEFAULT_IMAGE_EXT = '.jpg' POINT_CLOUD_DIR = 'pointcloud' RELATED_IMAGES_DIR = 'related_images' KEY_ID_FILE = 'key_id_map.json' META_FILE = 'meta.json' ...
class Pointcloudpath: base_dir = 'ds0' annnotation_dir = 'ann' default_image_ext = '.jpg' point_cloud_dir = 'pointcloud' related_images_dir = 'related_images' key_id_file = 'key_id_map.json' meta_file = 'meta.json' special_attrs = {'description', 'track_id', 'labelerLogin', 'createdAt', ...
VIDEO_ELEMENT = 'videoRenderer' CHANNEL_ELEMENT = 'channelRenderer' PLAYLIST_ELEMENT = 'playlistRenderer' SHELF_ELEMENT = 'shelfRenderer' class ResultMode: json = 0 dict = 1 class SearchMode: videos = 'EgIQAQ%3D%3D' channels = 'EgIQAg%3D%3D' playlists = 'EgIQAw%3D%3D' class VideoU...
video_element = 'videoRenderer' channel_element = 'channelRenderer' playlist_element = 'playlistRenderer' shelf_element = 'shelfRenderer' class Resultmode: json = 0 dict = 1 class Searchmode: videos = 'EgIQAQ%3D%3D' channels = 'EgIQAg%3D%3D' playlists = 'EgIQAw%3D%3D' class Videouploaddatefilter:...
#!/usr/bin/env python # encoding: utf-8 # # Copyright SAS Institute # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
""" Write python code for creating the SAS model """ def write_input_layer(model_name='sas', layer_name='data', channels='-1', width='-1', height='-1', scale='1.0'): """ Generate Python code defining a SAS deep learning input layer Parameters ---------- model_name : string Name for deep lea...
# This package will contain the spiders of your Scrapy project # # Please refer to the documentation for information on how to create and manage # your spiders. DOUBAN_COOKIE = { "__gads": "ID=2421173a5ca57aed-228b4c29c5c800c1:T=1621494084:RT=1621494084:S=ALNI_MaJlRkH7cibeVPuRhGgoy4NehQdpw", "__utma": "8137958...
douban_cookie = {'__gads': 'ID=2421173a5ca57aed-228b4c29c5c800c1:T=1621494084:RT=1621494084:S=ALNI_MaJlRkH7cibeVPuRhGgoy4NehQdpw', '__utma': '81379588.766923198.1621432056.1634626277.1634642692.15', '__utmv': '30149280.23826', '__utmz': '81379588.1634626277.14.8.utmcsr=cn.bing.com|utmccn=(referral)|utmcmd=referral|utmc...
class Mail: def __init__(self, prot, *argv): self.prot = prot(*argv) def login(self, account, passwd): self.prot.login(account, passwd) def send(self, frm, to, subject, content): self.prot.send(frm, to, subject, content) def quit(self): self.prot.quit()
class Mail: def __init__(self, prot, *argv): self.prot = prot(*argv) def login(self, account, passwd): self.prot.login(account, passwd) def send(self, frm, to, subject, content): self.prot.send(frm, to, subject, content) def quit(self): self.prot.quit()
class BaseError(Exception): error_id = "" error_msg = "" def __repr__(self): return "<{err_id}>: {err_msg}".format( err_id=self.error_id, err_msg=self.error_msg, ) def render(self): return dict( error_id=self.error_id, error_msg=s...
class Baseerror(Exception): error_id = '' error_msg = '' def __repr__(self): return '<{err_id}>: {err_msg}'.format(err_id=self.error_id, err_msg=self.error_msg) def render(self): return dict(error_id=self.error_id, error_msg=self.error_msg) class Clienterror(BaseError): error_id =...
TOTAL_BUDGET_AUTHORITY = 8361447130497.72 TOTAL_OBLIGATIONS_INCURRED = 4690484214947.31 WEBSITE_AWARD_BINS = { "<1M": {"lower": None, "upper": 1000000}, "1M..25M": {"lower": 1000000, "upper": 25000000}, "25M..100M": {"lower": 25000000, "upper": 100000000}, "100M..500M": {"lower": 100000000, "upper": 500...
total_budget_authority = 8361447130497.72 total_obligations_incurred = 4690484214947.31 website_award_bins = {'<1M': {'lower': None, 'upper': 1000000}, '1M..25M': {'lower': 1000000, 'upper': 25000000}, '25M..100M': {'lower': 25000000, 'upper': 100000000}, '100M..500M': {'lower': 100000000, 'upper': 500000000}, '>500M':...
def f(): x: list[list[i32]] x = [[1, 2, 3]] y: list[list[str]] y = [['a', 'b']] x = y
def f(): x: list[list[i32]] x = [[1, 2, 3]] y: list[list[str]] y = [['a', 'b']] x = y
permissions = { "on_permissions": { "all": "0", "uids": [], "badges": { "broadcaster": "1" }, "forbid": { "all": "0", "uids": [], "badges": {} } }, "on_channel": { "all": "0", "uids": [], ...
permissions = {'on_permissions': {'all': '0', 'uids': [], 'badges': {'broadcaster': '1'}, 'forbid': {'all': '0', 'uids': [], 'badges': {}}}, 'on_channel': {'all': '0', 'uids': [], 'badges': {}, 'forbid': {'all': '0', 'uids': [], 'badges': {}}}, 'on_commadd': {'all': '0', 'uids': [], 'badges': {'broadcaster': '1'}, 'for...
a = 0 def fun1(): print("fun1: a=", a) def fun2(): a = 10 # By default, the assignment statement creates variables in the local scope print("fun2: a=", a) def fun3(): global a # refer global variable a = 5 print("fun3: a=", a) fun1() fun2() fun1() fun3() fun1()
a = 0 def fun1(): print('fun1: a=', a) def fun2(): a = 10 print('fun2: a=', a) def fun3(): global a a = 5 print('fun3: a=', a) fun1() fun2() fun1() fun3() fun1()
def reverse_string(string): reversed_letters = list() index = 1 for letter in string: reversed_letters.append(string[ len(string) - index ]) index += 1 return "".join(reversed_letters) word_input = str(input("Input a word: ")) print(f"INPUT: {word_input}") print("OUTPUT: %s (%d char...
def reverse_string(string): reversed_letters = list() index = 1 for letter in string: reversed_letters.append(string[len(string) - index]) index += 1 return ''.join(reversed_letters) word_input = str(input('Input a word: ')) print(f'INPUT: {word_input}') print('OUTPUT: %s (%d characters)...
def conta_a(palavra): c = 0 for letra in palavra: if letra == 'a': c += 1 return c s = 'Insper' r = s[::-2] print(r)
def conta_a(palavra): c = 0 for letra in palavra: if letra == 'a': c += 1 return c s = 'Insper' r = s[::-2] print(r)
#String functions myStr = 'Hello world!' #Capitalize print(myStr.capitalize()) #Swap case print(myStr.swapcase()) #Get length print(len(myStr)) #Replace print(myStr.replace('world', 'everyone')) #Count sub = 'l' print(myStr.count(sub)) #Startswith print(myStr.startswith('Hello')) #Endswith print(myStr.endswith(...
my_str = 'Hello world!' print(myStr.capitalize()) print(myStr.swapcase()) print(len(myStr)) print(myStr.replace('world', 'everyone')) sub = 'l' print(myStr.count(sub)) print(myStr.startswith('Hello')) print(myStr.endswith('Hello')) print(myStr.split()) print(myStr.find('world')) print(myStr.index('world')) print(myStr....
#!/usr/bin/env python DESCRIPTION = "Variant of djb2 hash in use by Nokoyawa ransomware" # Type can be either 'unsigned_int' (32bit) or 'unsigned_long' (64bit) TYPE = 'unsigned_int' # Test must match the exact has of the string 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' TEST_1 = 3792689168 def ...
description = 'Variant of djb2 hash in use by Nokoyawa ransomware' type = 'unsigned_int' test_1 = 3792689168 def hash(data): generated_hash = 5381 for b in data: generated_hash = generated_hash * 33 + (b if b < 97 else b - 32) & 4294967295 return generated_hash
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"Scraper": "00_scraper.ipynb", "Scraper.get_facebook_posts": "00_scraper.ipynb", "print_something": "00_scraper.ipynb"} modules = ["scraper.py"] doc_url = "https://devacto.github.io/talk_l...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'Scraper': '00_scraper.ipynb', 'Scraper.get_facebook_posts': '00_scraper.ipynb', 'print_something': '00_scraper.ipynb'} modules = ['scraper.py'] doc_url = 'https://devacto.github.io/talk_like/' git_url = 'https://github.com/devacto/talk_like/tree/ma...
class Solution: def flipAndInvertImage(self, A: List[List[int]]) -> List[List[int]]: FI_A = list() for row in A: row = [0 if i else 1 for i in row[::-1]] FI_A.append(row) return FI_A
class Solution: def flip_and_invert_image(self, A: List[List[int]]) -> List[List[int]]: fi_a = list() for row in A: row = [0 if i else 1 for i in row[::-1]] FI_A.append(row) return FI_A
{{AUTO_GENERATED_NOTICE}} load("@{{REPO_NAME}}//:rules.bzl", "rescript_compiler") rescript_compiler( name = "darwin", bsc = ":darwin/bsc.exe", bsb_helper = ":darwin/bsb_helper.exe", visibility = ["//visibility:public"], ) rescript_compiler( name = "linux", bsc = ":linux/bsc.exe", bsb_helpe...
{{AUTO_GENERATED_NOTICE}} load('@{{REPO_NAME}}//:rules.bzl', 'rescript_compiler') rescript_compiler(name='darwin', bsc=':darwin/bsc.exe', bsb_helper=':darwin/bsb_helper.exe', visibility=['//visibility:public']) rescript_compiler(name='linux', bsc=':linux/bsc.exe', bsb_helper=':linux/bsb_helper.exe', visibility=['//visi...
def myFunction(): print('The value of __name__ is ' + __name__) def main(): myFunction() if __name__ == '__main__': main()
def my_function(): print('The value of __name__ is ' + __name__) def main(): my_function() if __name__ == '__main__': main()
tokens = { 'ID': r'[A-Za-z][A-Za-z_0-9]*', 'FLOATNUM': r'(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)', 'INTNUM': r'[0-9]+', # Multi-character operators '==': r'==', '<=': r'<=', '>=': r'>=', '<>': r'<>', '::': r'::', } special_characters = '<>+-*/=(){}...
tokens = {'ID': '[A-Za-z][A-Za-z_0-9]*', 'FLOATNUM': '(([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)', 'INTNUM': '[0-9]+', '==': '==', '<=': '<=', '>=': '>=', '<>': '<>', '::': '::'} special_characters = '<>+-*/=(){}[];,.:' reserved_keywords = {'if': 'IF', 'then': 'THEN', 'else': 'ELSE', 'w...