content stringlengths 7 1.05M |
|---|
class InstagramException(Exception):
StatusCode = -1
def __init__(self, message="", code=500):
super().__init__(f'{message}, Code:{code}')
@staticmethod
def default(response_text, status_code):
StatusCode = status_code
return InstagramException(
'Response code i... |
class Spawn:
def __init__ (self, width, height):
self.width, self.height, self.spacing = self.fill = width, height, 100, d3.scale.category20 ()
self.svg = d3.select ('body'
) .append ('svg'
) .attr ('width', self.width
) .attr ('height', self.height
) .on ('mousemove', self.mousemove
) .on ('mo... |
class Queue(object):
def __init__(self):
super(Queue, self).__init__()
self.rear = -1
self.front = -1
self.MAX = 10
self.queue = [None]*self.MAX
def enqueue(self,element):
if(self.rear == self.MAX - 1):
print("Error- queue full")
else:
self.rear += 1
self.queue[self.rear] = element
if self.r... |
n=int(input())
arr=[[input(),float(input())] for _ in range(0,n)]
arr.sort(key=lambda x: (x[1],x[0]))
names = [i[0] for i in arr]
marks = [i[1] for i in arr]
min_val=min(marks)
while marks[0]==min_val:
marks.remove(marks[0])
names.remove(names[0])
for x in range(0,len(marks)):
if marks[x]==min(marks):
... |
'''
Umil Bolt é um excelente corredor. Sua especialidade é a prova dos 100 metros rasos. Todos os dias, ele faz uma bateria
de tentativas de correr esta prova em um tempo cada vez menor. Pode se perceber que, dependendo da quantidade de tentativas,
o seu desempenho melhora ou piora. Sobre isso, ele pede a sua ajuda par... |
class Solution:
def tree2str(self, t):
"""
:type t: TreeNode
:rtype: str
"""
if t is None: return ''
res = str(t.val)
if t.left is not None:
res += '(' + self.tree2str(t.left) + ')'
else:
if t.right is not None:
... |
row, column = map(int, input().split())
x, y, look = map(int, input().split())
mapData = []
for _ in range(row):
mapData.append(list(map(int, input().split())))
dx = [-1, 0, 1, 0]
dy = [0, 1, 0, -1]
# 시작점 방문 표시
mapData[x][y] = 1
count = 1
changeLookCount = 0
while(True):
# 방향전환
look = 3 if look-1 < 0 else lo... |
# -*- coding: utf-8 -*-
"""
@Time: 2021/6/18 15:17
@Author: zzhang zzhang@cenboomh.com
@File: Data2ArrayRule.py
@desc:
"""
|
sse3=1
debug=0
strict=1
osx_min_ver = '10.7'
compiler = 'clang'
osx_archs = 'x86_64'
cxxstd = 'c++14'
ccflags = '-stdlib=libc++ -Wno-unused-local-typedefs'
linkflags = '-stdlib=libc++'
package_arch = 'x86_64'
#disable_local = 'libevent re2'
sign_disable = 1
sign_keychain = 'login.keychain'
#sign_keychain = 'develope... |
special_characters_default = (
" ~!@#$%^&*{}[]()_+=-0987654321`<>,./?':;“”\"\t\n\\πه☆●¦″"
".۩۱(☛₨➩°・■↑☻、๑º‹€σ٪’Ø·−♥ıॽ،٥《‘©。¨﴿!★×✱´٬→±x:¹?£―▷ф"
"¡Г♫∟™ª₪®▬「—¯;¼❖․ø•�」٣,٢◦‑←§١ー٤)˚›٩▼٠«¢¸٨³½˜٭ˈ¿¬ι۞⌐¥►"
"†ƒ∙²»¤…﴾⠀》′ا✓"
)
parameters_filtering_default = {
"cond_remove_words_with_incorrect_substrings": Tru... |
"""
Integer Info
Create a program that takes an integer as input and
creates a list with the following elements:
The number of digits
The last digit
A 'True' boolean value if the number is even, 'False' if odd
Print the list.
Some examples are given to help check your work.
"""
# Example 1: The input 12345... |
# 99. Recover Binary Search Tree
# Runtime: 80 ms, faster than 30.01% of Python3 online submissions for Recover Binary Search Tree.
# Memory Usage: 14.7 MB, less than 57.01% of Python3 online submissions for Recover Binary Search Tree.
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, ... |
# -*- coding: utf-8 -*-
__author__ = 'lycheng'
__email__ = "lycheng997@gmail.com"
class Solution(object):
''' https://leetcode.com/problems/delete-node-in-a-linked-list/
'''
def deleteNode(self, node):
"""
:type node: ListNode
:rtype: void Do not return anything, modify node in-p... |
#define the main() function
def main():
i = 0 #declare interger i
x = 119.0 #declare float x
for i in range(120): #loop i from 0 to 119, inclusive
if((i%2)==0): #if i is even
x += 3. #add 3 to x
else: #if not true
x -= 5. #substract 5 from x
s = "%3.2e" % x #make a string containing x with sci... |
# This file is part of spot_motion_monitor.
#
# Developed for LSST System Integration, Test and Commissioning.
#
# See the LICENSE file at the top-level directory of this distribution
# for details of code ownership.
#
# Use of this source code is governed by a 3-clause BSD-style
# license that can be found in the LICE... |
# 7. Write a program that takes any two lists L and M of the same size and adds their elements
# together to form a new list N whose elements are sums of the corresponding elements in L
# and M. For instance, if L=[3,1,4] and M=[1,5,9], then N should equal [4,6,13].
L = input('Enter a list of numbers: ').split()
M = i... |
class Solution:
def canConstruct(self, s: str, k: int) -> bool:
if len(s) < k:
return False
if len(s) == k:
return True
letters = collections.Counter(s)
mid = []
for key, val in letters.items():
if val % 2 == 1:
mid.append... |
class NoChefException(Exception):
pass
class Chef(object):
def make(self, **params):
print("I am a chef")
class Boost(Chef):
def make(self, food=None, **keywords):
print("I can cook %s for robots" % food)
class Fry(Chef):
def make(self, food=None):
print("I can fry " + food... |
class Range:
def __init__(self, left, right, left_inclusive=True, right_inclusive=False):
self.left = left
self.right = right
self.left_inclusive = left_inclusive
self.right_inclusive = right_inclusive
def __contains__(self, item):
if self.left_inclusive and self.left ... |
"""
Collectible.sol constructor arguments.
"""
COLLECTIBLE = {
"name": "Super Art Collection", # <-
"symbol": "SAC", # <-
"contract_URI": "", # <-
"royalty_receiver": "0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199", # <-
"royalty_fraction": 250, # e.g. 100 (1%); 1000 (10%) # <-
}
"""
Is collectio... |
alphabet_dict = {
'a': 1,
'b': 2,
'c': 3,
'd': 4,
'e': 5,
'f': 6,
'g': 7,
'h': 8,
'i': 9,
'j': 10,
'k': 11,
'l': 12,
'm': 13,
'n': 14,
'o': 15,
'p': 16,
'q': 17,
'r': 18,
's': 19,
't': 20,
'u': 21,
'v': 22,
'w': 23,
'x': 24,... |
_base_ = './grid_rcnn_r50_fpn_gn-head_2x_coco.py'
model = dict(
pretrained='open-mmlab://resnext101_32x4d',
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
style... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Reference https://ebisuke33.hatenablog.com/entry/abc197c
def main():
N = int(input())
array = list(map(int,input().split()))
ans = 10**9+7
if N==1:
print(array[0])
exit()
for i in range(2**(N-1)):
base = 0
or_value = ar... |
info = """
pylie: a Pandas extension for LIE analysis
version: {version}
author: {author}
"""
|
"""GALINI exceptions module."""
class DomainError(ValueError):
"""Invalid function domain."""
pass
class InvalidFileExtensionError(Exception):
"""Exception for invalid input file extension."""
pass
class InvalidPythonInputError(Exception):
"""Exception for invalid python input file."""
pas... |
print("(1, 2, 3) < (1, 2, 4) :", (1, 2, 3) < (1, 2, 4))
print("[1, 2, 3] < [1, 2, 4] :", [1, 2, 3] < [1, 2, 4])
print("'ABC' < 'C' < 'Pascal' < 'Python' :", 'ABC' < 'C' < 'Pascal' < 'Python')
print("(1, 2, 3, 4) < (1, 2, 4) :",... |
#Spiral Traversal
def spiralTraverse(array):
# Write your code here.
result=[]
startRow=0
startCol=0
endRow=len(array)-1
endCol=len(array[0])-1
while startRow<=endRow and startCol<=endCol:
for col in range(startCol, endCol+1):
print(col)
result.append(array[startRow][col])
for row in range(startRow... |
class TwoSum(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.nums = []
self.is_sorted = False
def add(self, number):
"""
Add the number to an internal data structure..
:type number: int
:rtype: None
... |
# TODO Find a way to actually configure these :D
BASE_URL = 'http://localhost:8000/'
MAILCATCHER_URL = 'http://localhost:1080/'
|
'''
@Author: Yingshi Chen
@Date: 2020-03-20 17:39:56
@
# Description:
'''
|
#Ricky Deegan
#check if one number divides another
p = 8
m = 2
if (p % m) == 0:
print (p, "divided by", m, "leaves a remainder of zero")
print ("I'll be run too if the condition is true")
else:
print (p, "divided by", m, "does not leave leaves a remainder of zero")
print ("I'll be run too if the condi... |
"""
Dua buah bilangan bulat X dan Y. X merupakan panjang sisi kubus kecil dalam
centimeter. Dan Y adalah banyak kubus kecil yang menyusun panjang sisi kubus
besar.(1 ≤ X,Y ≤ 100)
"""
x, y = list(map(int, input().split()))
volume = (x*y)**3
print(volume)
|
stim_positions = {
'double' : [ [( .4584, .2575, .2038), # 3d location
( .4612, .2690,-.0283)],
[( .4601, .1549, .1937),
( .4614, .1660,-.0358)]
],
'double_20070301' : [ [( .4538, .2740, .1994), # top highy
( .4565,... |
def test_NEQSys():
pass
def test_SimpleNEQSys():
pass
|
def test():
assert Doc.has_extension("has_number"), "Você registrou a extensão no doc?"
ext = Doc.get_extension("has_number")
assert ext[2] is not None, "Você definiu o getter corretamente?"
assert (
"getter=get_has_number" in __solution__
), "Você atribuiu a função get_has_number como a fun... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 8 18:45:00 2019
@author: positiveoutlier
"""
s = 'azcbobobegghakl'
vowels = 0
for letter in s:
if letter in ("aeiou"):
vowels += 1
print("Number of vowels: " + str(vowels))
|
# -*- coding: utf-8 -*-
__author__ = """Arya D. McCarthy"""
__email__ = 'admccarthy@smu.edu'
__version__ = '0.1.0'
|
"""
PASSENGERS
"""
numPassengers = 3219
passenger_arriving = (
(3, 9, 5, 2, 1, 0, 9, 5, 5, 7, 1, 0), # 0
(5, 5, 5, 8, 2, 0, 5, 8, 3, 4, 3, 0), # 1
(5, 12, 6, 3, 0, 0, 9, 6, 3, 9, 3, 0), # 2
(3, 5, 6, 2, 3, 0, 3, 5, 11, 6, 3, 0), # 3
(6, 9, 9, 3, 4, 0, 3, 9, 3, 3, 1, 0), # 4
(5, 7, 9, 6, 4, 0, 5, 8, 6, 7, ... |
SET = "set" # sets an document's field to a new value
UNSET = "unset" # unset a document's field
PUSH = "push" # pushes an element into a document's array field
POP = "pop" # removes either the first or last element in an array
INC = "inc" # increments a document's numerical field
class Collection:
# constr... |
def str_or_list_to_list(path_or_paths):
if isinstance(path_or_paths, str):
# parameter is a string, turn it into a list of strings
paths = [path_or_paths]
else:
# parameter is a list
paths = path_or_paths
return paths
|
"""
Basic Math Ops
"""
# Given the list below, assign the correct values to the variables below.
# my_sum =
# my_min =
# my_max =
# my_range =
# my_mean =
nums = [2, 19, 20, 12, 6, 24, 8, 30, 28, 25]
# Once you finish, print out each value **on its own line** in this format: "my_median = " etc.
|
def f(a, b):
return a + b
def g():
i = 0
while i < 10:
a = 'foo'
i += 1
def h():
[x for x in range(10)]
|
if __name__ == "__main__":
count = 0
resolution = 10000
iota = 1 / resolution
a = 0
b = 0
while a <= 1:
b = 0
while b <= 1:
if (pow(a, 2) + pow(b, 2)) <= (2 * min(a, b)):
count = count + 1
b += iota
a += iota
print(f"Count is: {... |
class GradScaler(object):
def __init__(
self, init_scale, growth_factor, backoff_factor, growth_interval, enabled
):
self.scale_factor = init_scale
self.growth_factor = growth_factor
self.backoff_factor = backoff_factor
self.growth_interval = growth_interval
self.... |
# -*- coding: utf-8 -*-
__all__ = []
__version__ = '0.0'
FONTS = [
{
"name": "Roboto",
"fn_regular": fonts_path + 'Roboto-Regular.ttf',
"fn_bold": fonts_path + 'Roboto-Medium.ttf',
"fn_italic": fonts_path + 'Roboto-Italic.ttf',
"fn_bolditalic": fonts_path + 'Roboto-MediumIt... |
# TODO(dragondriver): add more default configs to here
class DefaultConfigs:
MaxSearchResultSize = 100 * 1024 * 1024
WaitTimeDurationWhenLoad = 0.5 # in seconds
|
"""
Implementation of a binary heap, with the minimum value at root (a min heap).
Created during Coursera Algorithm course.
Author: Jing Wang
"""
class BinHeap:
def __init__(self):
self.heap = []
self.heap_size = 0
self.pos = dict()
@staticmethod
def parent(idx):
return (i... |
def f():
n = 0
while True:
n = yield n + 1
print(n)
g = f()
try:
g.send(1)
print("FAIL")
raise SystemExit
except TypeError:
print("caught")
print(g.send(None))
print(g.send(100))
print(g.send(200))
def f2():
print("entering")
for i in range(3):
print(i)
... |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object):
def trimBST(self, root, low, high):
"""
:type root: TreeNode
:type l... |
# What substring do hish and fish have in common ?
# How about hish and vista ?
# Thats what we'll calculate
# grid
cell = []
word_a = 'fosh'
word_b = 'fort'
l_c_s = 0
# initiating with 0 values
for a in range(0, len(word_a)):
cell.append(list(0 for b in word_b))
for i in range(0, len(word_a)):
for j i... |
class Group(object):
def __init__(self, id=None, name=None, members=None) -> None:
self.id = id
self.name = name
self.members = []
def setId(self, id):
self.id = id
def getId(self):
return self.id
def setName(self, name):
self.id = name
... |
"""
GetFX base module
=================
This module provides base functionality (implemented in :py:class:`GetFX`
class) that should be extended by specific implementation for given FX
provider.
"""
class GetFX(object):
"""Super class for FX object.
It is expected this class to be **always extended** by s... |
# CONFIGURATION
# --------------------------------------------------------------------------------------------
y_min = 0 # minimum value displayed on y axis
y_max = 100 # maximum value displayed on y axis (maximum must be greater (not greater or equal) than minimum)
x_m... |
f=open('4.1.2_run_all_randomize_wholebrain.sh','w')
for i in range(1000):
cmd='python 4.1_randomize_wholebrain.py %d'%i
f.write(cmd+'\n')
f.close()
|
#Given an interval, the task is to count numbers which have same first and last digits.
#For example, 1231 has same first and last digits
def same_1andlast(s,e):
out=[]
for i in range(s,e+1):
num=i
nos=[]
while(num!=0):
nos.append(num%10)
num /= 10
if(nos[0]==nos[len(nos)-1]):
out.... |
# Problem:
# Write a program for converting money from one currency to another.
# The following currencies need to be maintained: BGN, USD, EUR, GBP.
# Use the following fixed exchange rates:
# BGN = 1.79549 USD / 1.95583 EUR / 2.53405 GBP
# The input is a conversion amount + Input Currency + Output Currency.
# The o... |
'''
Hyper Paramators
'''
LENGTH = 9
WALLS = 10
BREAK = 96
INPUT_SHAPE = (LENGTH, LENGTH, 4 + WALLS * 2)
OUTPUT_SHAPE = 8 + 2 * (LENGTH - 1) * (LENGTH - 1)
# Train epoch for one cycle.
EPOCHS = 200 # Training epoch number
BATCH_SIZE = 256
FILTER = 256
KERNEL = 3
STRIDE = 1
INITIALIZER = 'he_normal'
REGULARIZER = 0.0005
... |
class Solution:
def clipIsIncludeInOtherClip(self, clip, otherClip):
return otherClip[0] <= clip[0] and otherClip[1] >= clip[1]
def takeStart(self, ele):
return ele[0]
def videoStitching(self, clips, T):
# remove all bad clip which can be replaced by other
needRemoveIndex =... |
def readFile():
fileContent = []
with open('fileManage.txt', 'r') as f:
for line in f.readlines():
fileContent.append(line)
return fileContent
def toNumDigit(num, all):
addZero = all - len(str(num))
return '0' * addZero + str(num)
def eliminateZero(name):
isFirst = True
... |
# Zapytaj użytkownika o ceny trzech produktów i wypisz wyniki ich porównania
computer_price = float(input("Ile średnio kosztuje komputer? "))
car_price = float(input("Ile kosztuje typowy samochód? "))
bike_price = float(input("Ile kosztuje typowy rower? "))
if computer_price > car_price:
print("Komputer jest dro... |
_base_ = '../detectors/detectors_htc_r101_64x4d_1x_coco.py'
model = dict(
pretrained='open-mmlab://resnext101_64x4d',
backbone=dict(
type='DetectoRS_ResNeXt',
depth=101,
groups=64,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 17 15:39:35 2020
@author: rodri
"""
#https://github.com/Vachik-Dave/Data-Mining/tree/master/Eclat%20Algorithm%20in%20Python
|
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2019 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... |
routers = dict(
BASE = dict(
routes_onerror = [
('3muses/*', '3muses/default/handle_error')
]
)) |
class Triangulo:
def __init__(self):
self.lado1 = int(input('Ingrese el primer lado: '))
self.lado2 = int(input('Ingrese el segundo lado: '))
self.lado3 = int(input('Ingrese el tercer lado: '))
def mayor(self):
if self.lado1>self.lado2 and self.lado1>self.lado3 :
pri... |
__all__ = [
"__title__", "__summary__", "__uri__", "__version__", "__author__",
"__license__", "__copyright__",
]
__title__ = "warzone_map_utils"
__summary__ = "Map generation and validation repository"
__uri__ = "https://github.com/rmudambi/warlight-maps"
__version__ = "1.0.0"
__author__ = "Beren Erchamion"... |
def river_travelling(cost_matrix):
N = len(cost_matrix)
M = [[0 for x in range(N)] for x in range(N)]
for steps in range(1, N):
for i in range(N - steps):
j = i + steps
lowest = cost_matrix[i][j]
for k in range(i + 1, j):
lowest = min(lowest, M[k][... |
# coding: utf-8
# # Functions (2) - Using Functions
# In the last lesson we saw how to create a function using the <code>def</code> keyword. We found out how to pass arguments to a function and how to use these arguments within the function. Finally, we learnt how to return one or many objects from the function, and... |
PAGES = {
# https://github.com/Redocly/redoc
'redoc': """
<!DOCTYPE html>
<html>
<head>
<title>ReDoc</title>
<!-- needed for adaptive design -->
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href=
"https://f... |
"""
.. module:: simlayer2
:platform: Python, Micropython
"""
#---------------------------------------------------------------------------
#from stats.statsct import Statsct
class SimulLayer2:
"""
The layer 2 of LPWA is not symmetry.
The LPWA device must know the devaddr assigned to itself before process... |
def example(n):
if type(n) in [type(1), type(1.1)]:
n = str(n)
print()
print()
print("--------------------------Example {}--------------------------".format(n))
# create an empty dictionary
newDict = {}
# create an dictionary
age = {"Jason": 19, "Tim": 34, "Jeff": 48, "haha": -43}
# create a... |
#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#
def test_dummy_test():
"""this is the dummy test to pass integration tests step"""
pass
|
def respond(data):
"""Generate HTML response"""
print("Content-type: text/html; charset=UTF-8")
print("""
<html>
<head>
<meta http-equiv="refresh" content="3;/">
</head>
<body>
<h1>Your response has been recorded. Thank you.</h1>
<p>Redirecting you <a href="/">back home</a> in 3 seconds…</p>
</body>
</... |
class config():
# env config
render_train = True
render_test = False
env_name = "Pong-v0"
overwrite_render = True
record = True
high = 255.
# output config
output_path = "results/test/"
model_output = output_path + "model.weight... |
"""
This module lets you practice various patterns
for ITERATING through SEQUENCES, including selections from:
-- Beginning to end
-- Other ranges (e.g., backwards and every-3rd-item)
-- The COUNT/SUM/etc pattern
-- The FIND pattern (via LINEAR SEARCH)
-- The MAX/MIN pattern
-- Looking two places in the seq... |
"""
Don't put imports or code here
This file is imported by setup.py
Adding imports here will break setup.py
"""
__version__ = '1.9.0'
|
with open("sleepy.in") as input_file:
input_file.readline()
cows = list(map(int, input_file.readline().split()))
def is_list_sorted(lst):
return all(elem >= lst[index] for index, elem in enumerate(lst[1:]))
t = 0
sorted_cows = cows.copy()
for cow in cows:
if is_list_sorted(sorted_cows):
break
... |
# Variable for registering new components
# Add a new component here and define a file with the name <component_name>.py and override the main variables
COMPONENTS = ["aggregations-spot", "gbdisagg-spot"]
|
# Tabuada de adição
n = int(input('Tabuada de: '))
x = 1
while x <= 10:
print(n + x)
x = x + 1 |
FEATURES = [
'Post_Top_comment_Jaccard_sim', 'Post_Top_comment_topic_cosine_similarity',
'Post_text', 'Post_topic0', 'Post_topic1', 'Post_topic10', 'Post_topic11',
'Post_topic12', 'Post_topic13', 'Post_topic14', 'Post_topic15', 'Post_topic16',
'Post_topic17', 'Post_topic18', 'Post_topic2', 'Post_topic3'... |
#
# @lc app=leetcode id=441 lang=python3
#
# [441] Arranging Coins
#
# https://leetcode.com/problems/arranging-coins/description/
#
# algorithms
# Easy (38.86%)
# Likes: 247
# Dislikes: 528
# Total Accepted: 83.5K
# Total Submissions: 214.3K
# Testcase Example: '5'
#
# You have a total of n coins that you want t... |
# This file is part of the dune-gdt project:
# https://github.com/dune-community/dune-gdt
# Copyright 2010-2017 dune-gdt developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# or GPL-2.0+ (http://opensource.org/licenses/... |
# BASE
URL = "http://download.geofabrik.de/"
suffix = "-latest.osm.pbf"
africa_url = "africa/"
asia_url = "asia/"
australia_oceania_url = "australia-oceania/"
central_america_url = "central-america/"
europe_url = "europe/"
north_america_url = "north-america/"
south_america_url = "south-america/"
baden_wuerttemberg_url... |
load(
"//rules/common:private/utils.bzl",
_safe_name = "safe_name",
)
load(
"//rules/common:private/utils.bzl",
_resolve_execution_reqs = "resolve_execution_reqs",
)
scala_proto_library_private_attributes = {}
def scala_proto_library_implementation(ctx):
protos = [dep[ProtoInfo] for dep in ctx.att... |
t=int(input())
for sss in range(t):
sum=0
n,k=map(int,input().split())
a=[0]*(n+1)
for i in range(1,n+1):
if k==0 or k==n:
break
if (sum+1<=i+1 and k>0):
a[i]=i
sum+=i
i+=1
k-=1
continue
if sum>... |
def method1():
def findWater(arr, n):
left = [0] * n
right = [0] * n
water = 0
left[0] = arr[0]
for i in range(1, n):
left[i] = max(left[i - 1], arr[i])
right[n - 1] = arr[n - 1]
for i in range(n - 2, -1, -1):
right[i] = max(right[i + 1... |
#!/usr/bin/env python
# md5: 30abdfb918f7a6b87bd580600c506058
# coding: utf-8
databasename = 'ml-004_clickstream_video.sqlite'
def getDatabaseName():
return databasename
|
class Proxy(object):
response_type = "proxy"
def __init__(self, url, client_certificate=None, client_key=None):
self.url = url
self.certificate = client_certificate
self.key = client_key
def as_dict(self):
proxy = {
'to': self.url
}
... |
'''
On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed).
Once you pay the cost, you can either climb one or two steps. You need to find minimum cost to reach the top of the floor, and you can either start from the step with index 0, or the step with index 1.
Example 1:
Input: cost = ... |
'''Defines the `JavaCompilationInfo` provider.
'''
JavaCompilationInfo = provider(
doc = "Describes the inputs, outputs, and options of a Java compiler invocation for a particular Java target.",
fields = {
"srcs": "A depset of the Java source `File`s directly included in a Java target. (This does not i... |
def agent_settings(arglist, agent_name):
if agent_name[-1] == "1": return arglist.model1
elif agent_name[-1] == "2": return arglist.model2
elif agent_name[-1] == "3": return arglist.model3
elif agent_name[-1] == "4": return arglist.model4
else: raise ValueError("Agent name doesn't follow the right ... |
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2003-2017 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permis... |
# cp857_7x7.py - CP857 7x7 font file for Python
#
# Copyright (c) 2019-2022 Ercan Ersoy
# This file is written by Ercan Ersoy.
# This file is licensed under CC0-1.0 Universal License.
cp857_7x7 = [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x03... |
config = {
'bot': {
'username': "", # Robinhood credentials. If you don't want to keep them stored here, launch "./2fa.py" to setup the access token interactively
'password': "",
'trades_enabled': False, # if False, just collect data
'simulate_api_calls': False, # if enabled, just pr... |
primeiro = int(input('Primeiro termo : '))
razão = int(input('Razão : '))
décimo = primeiro + (10 -1) * razão
for c in range(primeiro, décimo + razão, razão ):
print('{}'.format(c), end='-> ')
print('ACABOU')
primeiro = int(input('Primeiro número : '))
razão = int(input('Razão : '))
décimo = primeiro + (10 - 1) * ... |
class DeprecatedLogger(object):
def __init__(self):
print(
"Deprecated logger, please use 'from puts import get_logger; logger = get_logger();' instead"
)
def debug(self, msg):
print(msg)
def info(self, msg):
print(msg)
def warning(self, msg):
print... |
"""
Contains the signatures of each telegram line.
Previously contained the channel + obis reference signatures, but has been
refactored to full line signatures to maintain backwards compatibility.
Might be refactored in a backwards incompatible way as soon as proper telegram
objects are introduced.
"""
P1_MESSAGE_HEA... |
def run_functions(proteins, species):
interactions = GetSTRINGInteractions()
IDs_df = interactions.map_identifiers_string(list(proteins.values()), species)
if IDs_df.empty: return
IDs = IDs_df.values.flatten()
known_interactions = interactions.get_interactions(IDs, species)
known_interactions['Original geneID_... |
# https://www.codingame.com/training/easy/detective-pikaptcha-ep1
def get_neighbors(row, col, grid):
if row > 0: yield row - 1, col
if row < len(grid) - 1: yield row + 1, col
if col > 0: yield row, col - 1
if col < len(grid[row]) - 1: yield row, col + 1
def solution():
width, height = [int(i) fo... |
"""
* Assignment: File Write Str
* Required: yes
* Complexity: easy
* Lines of code: 3 lines
* Time: 3 min
English:
1. Write `DATA` to file `FILE`
2. Run doctests - all must succeed
Polish:
1. Zapisz `DATA` do pliku `FILE`
2. Uruchom doctesty - wszystkie muszą się powieść
Hints:
* Add newline `\n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.