content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# Python type
a = 'Python is a great language.'
b = 10
c = 2.5
d = {a, b, c}
e = [a, b, c]
f = (a, b, c)
g = {"a":b, "a":c}
h = b > c
i = 3 + 4j
'''
print('a =',a,type(a))
print('b =',b,type(b))
print('c =',c,type(c))
print('d =',d,type(d))
print('e =',e,type(e))
print('f =',f,type(f))
print('g =',g,type(g))
print('h... | a = 'Python is a great language.'
b = 10
c = 2.5
d = {a, b, c}
e = [a, b, c]
f = (a, b, c)
g = {'a': b, 'a': c}
h = b > c
i = 3 + 4j
"\nprint('a =',a,type(a))\nprint('b =',b,type(b))\nprint('c =',c,type(c))\nprint('d =',d,type(d))\nprint('e =',e,type(e))\nprint('f =',f,type(f))\nprint('g =',g,type(g))\nprint('h =',h,ty... |
#!/usr/bin/python3
#https://practice.geeksforgeeks.org/problems/rearrange-characters/0
def sol(s):
"""
If a character frequency is 4 then it requires atleast 3 other
characters so that the characters are not adjacent. We only need to
check the character with highest frequency because if those are not ... | def sol(s):
"""
If a character frequency is 4 then it requires atleast 3 other
characters so that the characters are not adjacent. We only need to
check the character with highest frequency because if those are not
adjacent then no other can be adjacent
"""
n = len(s)
arr = [0] * 26
... |
class ValidationError(Exception):
def __init__(self, message, errors):
super().__init__(message)
self.message = message
self.errors = errors
def __errPrint__(self, foo, space=' '):
'''
Function to petty print the error from cerberus.
'''
error = ''
... | class Validationerror(Exception):
def __init__(self, message, errors):
super().__init__(message)
self.message = message
self.errors = errors
def __err_print__(self, foo, space=' '):
"""
Function to petty print the error from cerberus.
"""
error = ''
... |
class TestInstitutionsSearch:
def test_institutions_search(self, client):
res = client.get("/institutions?search=university")
json_data = res.get_json()
assert "university" in json_data["results"][0]["display_name"].lower()
for result in json_data["results"][:25]:
assert ... | class Testinstitutionssearch:
def test_institutions_search(self, client):
res = client.get('/institutions?search=university')
json_data = res.get_json()
assert 'university' in json_data['results'][0]['display_name'].lower()
for result in json_data['results'][:25]:
assert... |
start_year = int(input())
current_year = start_year + 1
found = False
while True:
not_found = False
for fi in range(len(str(current_year))):
for si in range(fi + 1, len(str(current_year))):
fd = str(current_year)[fi]
sd = str(current_year)[si]
if fd == sd:
... | start_year = int(input())
current_year = start_year + 1
found = False
while True:
not_found = False
for fi in range(len(str(current_year))):
for si in range(fi + 1, len(str(current_year))):
fd = str(current_year)[fi]
sd = str(current_year)[si]
if fd == sd:
... |
"""
common.py provides constant values to be used throughout the app
"""
EXCHANGE_BINANCE = 'BINANCE'
SIDE_HODL = "hodl"
SIDE_SELL = "sell"
SIDE_BUY = "buy"
| """
common.py provides constant values to be used throughout the app
"""
exchange_binance = 'BINANCE'
side_hodl = 'hodl'
side_sell = 'sell'
side_buy = 'buy' |
def fat (n):
fat = 1
while (n > 1):
fat = fat * n
n -= 1
return fat
def test_fat0 ():
assert fat (0)==1 | def fat(n):
fat = 1
while n > 1:
fat = fat * n
n -= 1
return fat
def test_fat0():
assert fat(0) == 1 |
# --------------------------------------------------------------------------------> Rotation
class Rotation:
def __init__(self, start_line, end_line, rotation_center=None):
self.type = "Rotation"
self.start_line = start_line
self.end_line = end_line
self.rotation_center = rotation_ce... | class Rotation:
def __init__(self, start_line, end_line, rotation_center=None):
self.type = 'Rotation'
self.start_line = start_line
self.end_line = end_line
self.rotation_center = rotation_center
def __repr__(self):
return 'Rotation(start_line={}, end_line={}, rotation_... |
# todo: make this configurable
EXCHANGE_CRONOS_BLOCKCHAIN = "Cronos"
CUR_CRONOS = "CRO"
MILLION = 100000000.0
CURRENCIES = {
"ibc/14F9BC3E44B8A9C1BE1FB08980FAB87034C9905EF17CF2F5008FC085218811CC": "OSMO",
"ibc/EB2CED20AB0466F18BE49285E56B31306D4C60438A022EA995BA65D5E3CF7E09": "SCRT",
"ibc/FA0006F056DB6719B8... | exchange_cronos_blockchain = 'Cronos'
cur_cronos = 'CRO'
million = 100000000.0
currencies = {'ibc/14F9BC3E44B8A9C1BE1FB08980FAB87034C9905EF17CF2F5008FC085218811CC': 'OSMO', 'ibc/EB2CED20AB0466F18BE49285E56B31306D4C60438A022EA995BA65D5E3CF7E09': 'SCRT', 'ibc/FA0006F056DB6719B8C16C551FC392B62F5729978FC0B125AC9A432DBB2AA1... |
with plt.xkcd():
plt.figure(figsize=(8,6))
#####################################
## determine which variables you want to look at, replace question marks
# determine which variables you want to look at, replace question marks
plt.hist(s_ves, label='a', alpha=0.5) # set the first argument here
plt.hist(s_o... | with plt.xkcd():
plt.figure(figsize=(8, 6))
plt.hist(s_ves, label='a', alpha=0.5)
plt.hist(s_opt, label='b', alpha=0.5)
plt.legend(facecolor='xkcd:white')
plt.show() |
"""
Codebay site-wide default configuration.
The format of this file is normal Python syntax where configuration
values are directly modified in the 'conf' object.
Example:
>>> conf.conftest_test1 = 5
>>> conf.conftest_test2 = 'test'
>>> conf.conftest_test3 = True
Use the '.codebayrc.py' file in home directory to ad... | """
Codebay site-wide default configuration.
The format of this file is normal Python syntax where configuration
values are directly modified in the 'conf' object.
Example:
>>> conf.conftest_test1 = 5
>>> conf.conftest_test2 = 'test'
>>> conf.conftest_test3 = True
Use the '.codebayrc.py' file in home directory to ad... |
OCTICON_CHECK = """
<svg class="octicon octicon-check" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg>
"""
| octicon_check = '\n<svg class="octicon octicon-check" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg>\n' |
# Create a new class level variable called person_counter
# Create a property called person_id and return a unique ID for each person object
class Person:
def __init__(self, first_name: str, last_name: str):
self.__first_name = first_name
self.__last_name = last_name
@property
def full_na... | class Person:
def __init__(self, first_name: str, last_name: str):
self.__first_name = first_name
self.__last_name = last_name
@property
def full_name(self):
return f'{self.__first_name} {self.__last_name}'
new_person = person('Luke', 'Edmunds')
print(newPerson.full_name)
print(new... |
class Stack:
def __init__(self):
self.stack = []
def empty(self):
return len(self.stack) == 0
def peek(self):
return self.stack[-1]
def push(self, x):
self.stack.append(x)
def pop(self):
del self.stack[-1]
class Queue:
def __ini... | class Stack:
def __init__(self):
self.stack = []
def empty(self):
return len(self.stack) == 0
def peek(self):
return self.stack[-1]
def push(self, x):
self.stack.append(x)
def pop(self):
del self.stack[-1]
class Queue:
def __init__(self):
se... |
class Player():
"""
This player class initializes a player with a unique ID and exposes
functions to play a card and assign/add cards to the player's deck.
"""
def __init__(self, player_id):
self.player_id = player_id
self.player_deck = []
def assign_cards(self, cards):
... | class Player:
"""
This player class initializes a player with a unique ID and exposes
functions to play a card and assign/add cards to the player's deck.
"""
def __init__(self, player_id):
self.player_id = player_id
self.player_deck = []
def assign_cards(self, cards):
"... |
class Solution:
def tree2str(self, t):
"""
:type t: TreeNode
:rtype: str
"""
if not t:
return ''
ans = str(t.val)
if t.left or t.right:
ans += '(' + self.tree2str(t.left) + ')'
if t.right:
ans += '(' + self.tree2str... | class Solution:
def tree2str(self, t):
"""
:type t: TreeNode
:rtype: str
"""
if not t:
return ''
ans = str(t.val)
if t.left or t.right:
ans += '(' + self.tree2str(t.left) + ')'
if t.right:
ans += '(' + self.tree2str... |
class Solution:
def hasAllCodes(self, s: str, k: int) -> bool:
sub_s = set()
for i in range(0, len(s) - k + 1):
sub_s.add(s[i:i+k])
return True if len(sub_s) == 2**k else False
| class Solution:
def has_all_codes(self, s: str, k: int) -> bool:
sub_s = set()
for i in range(0, len(s) - k + 1):
sub_s.add(s[i:i + k])
return True if len(sub_s) == 2 ** k else False |
"""
CNGI Package
Module functions with blank descriptions have not been completed yet. As each function is completed, its description will be populated.
"""
#__init__.py
| """
CNGI Package
Module functions with blank descriptions have not been completed yet. As each function is completed, its description will be populated.
""" |
# region Deprecated_code
"""notes = []
is_generating = threading.Event()
is_throwing = threading.Event()
notes_count = 0
portion_iter = 0
notes_amount = 0
portion_iters_amount = 0
out_path = ""
# DEPRECATED CODE!!!
def setup():
global notes_amount, portion_iters_amount, out_path
notes_amount = gen... | """notes = []
is_generating = threading.Event()
is_throwing = threading.Event()
notes_count = 0
portion_iter = 0
notes_amount = 0
portion_iters_amount = 0
out_path = ""
# DEPRECATED CODE!!!
def setup():
global notes_amount, portion_iters_amount, out_path
notes_amount = generator.get_notes_amount()
portion_... |
# Let's just use the local mongod instance. Edit as needed.
# Please note that MONGO_HOST and MONGO_PORT could very well be left
# out as they already default to a bare bones local 'mongod' instance.
#MONGO_HOST = 'localhost'
#MONGO_PORT = 27017
# Skip these if your db has no auth. But it really should.
#MONG... | elasticsearch_url = 'http://maurice-vm.epa.ie:9200/'
elasticsearch_index = 'eric'
resource_methods = ['GET']
item_methods = ['GET']
description = ('Description of the user resource',)
schema = {'measurementid': {'type': 'int32'}, 'locationname': {'type': 'string'}, 'latitude_dec': {'type': 'double'}, 'longitude_dec': {... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
def compose_char(char):
return NotImplementedError
def compose(string):
return NotImplementedError
def decompose_char(char):
return NotImplementedError
def decompose(string, aslist=False):
l = (decompose_char(c) for c in string)
if aslist:
... | def compose_char(char):
return NotImplementedError
def compose(string):
return NotImplementedError
def decompose_char(char):
return NotImplementedError
def decompose(string, aslist=False):
l = (decompose_char(c) for c in string)
if aslist:
return list(l)
else:
flattened = filt... |
n=int(input()); res=""
for _ in range(n):
car=int(input())
opt=int(input())
for _ in range(opt):
a,b=map(int, input().split())
car+=a*b
res+=str(car)+"\n"
print(res)
| n = int(input())
res = ''
for _ in range(n):
car = int(input())
opt = int(input())
for _ in range(opt):
(a, b) = map(int, input().split())
car += a * b
res += str(car) + '\n'
print(res) |
class dotSolid_t(object):
""" dotSolid_t(Size: int) """
@staticmethod
def __new__(self, Size):
"""
__new__[dotSolid_t]() -> dotSolid_t
__new__(cls: type,Size: int)
"""
pass
CreationType = None
EdgeIndex = None
Edges = None
FaceIndex = None
F... | class Dotsolid_T(object):
""" dotSolid_t(Size: int) """
@staticmethod
def __new__(self, Size):
"""
__new__[dotSolid_t]() -> dotSolid_t
__new__(cls: type,Size: int)
"""
pass
creation_type = None
edge_index = None
edges = None
face_index = None
forming_states = ... |
HEADER = '''<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="manifest" href... | header = '<!doctype html>\n<html class="no-js" lang="">\n\n<head>\n <meta charset="utf-8">\n <meta http-equiv="x-ua-compatible" content="ie=edge">\n <title></title>\n <meta name="description" content="">\n <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">\n\n <link rel="manife... |
# A recursive implementation of Binary Search
def recBinarySearch(target, theValues, first, last):
# If the sequence of values cannot be subdivided further,
# we are done
if last <= first: # BASE CASE #1
return False
else:
# Find the midpoint of the sequence
mid = (first + las... | def rec_binary_search(target, theValues, first, last):
if last <= first:
return False
else:
mid = (first + last) // 2
if theValues[mid] == target:
return True
elif target < theValues[mid]:
return rec_binary_search(target, theValues, first, mid - 1)
... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Custom exceptions used in the astroquery query classes
"""
__all__ = ['TimeoutError', 'InvalidQueryError', 'RemoteServiceError', 'TableParseError']
class TimeoutError(Exception):
"""
Raised on failure to establish connection with server
... | """
Custom exceptions used in the astroquery query classes
"""
__all__ = ['TimeoutError', 'InvalidQueryError', 'RemoteServiceError', 'TableParseError']
class Timeouterror(Exception):
"""
Raised on failure to establish connection with server
within a particular time limit
"""
pass
class Invalidquer... |
#
# PySNMP MIB module ZYXEL-XGS4728F-MIB (http://pysnmp.sf.net)
# ASN.1 source file:///usr/local/share/snmp/ZYXEL-XGS-4728F.my
# Produced by pysmi-0.0.7 at Fri Feb 17 12:27:14 2017
# On host e0f449e7a145 platform Linux version 4.4.0-62-generic by user root
# Using Python version 3.5.3 (default, Feb 10 2017, 02:09:54)
... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint, constraints_union) ... |
def validate(number):
if not 0 < number <= 64:
raise ValueError("Invalid input!")
def square(number):
validate(number)
return 2 ** (number - 1)
def total(number):
validate(number)
return sum(square(i + 1) for i in range(number))
| def validate(number):
if not 0 < number <= 64:
raise value_error('Invalid input!')
def square(number):
validate(number)
return 2 ** (number - 1)
def total(number):
validate(number)
return sum((square(i + 1) for i in range(number))) |
"""
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water
it is able to trap after raining.
Example :
Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6.
Rain water trapped: Example 1
The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1].
In ... | """
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water
it is able to trap after raining.
Example :
Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6.
Rain water trapped: Example 1
The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1].
In ... |
DB_NAME = "defaultdb"
DB_USER = "postgres"
SESSIONSDB_HOST = '127.0.0.1'
SESSIONSDB_PORT = 6379
SESSIONSDB_PASSWD = None
SESSIONSDB_NO = 1
# SMTP
MD_HOST = '127.0.0.1'
MD_PORT = 10000
MD_USERNAME = None
MD_KEY = ''
class API_LOGGER:
ENABLED = False
| db_name = 'defaultdb'
db_user = 'postgres'
sessionsdb_host = '127.0.0.1'
sessionsdb_port = 6379
sessionsdb_passwd = None
sessionsdb_no = 1
md_host = '127.0.0.1'
md_port = 10000
md_username = None
md_key = ''
class Api_Logger:
enabled = False |
inpt = []
while True:
try:
inpt.append(int(input()))
except EOFError:
break
even = lambda x: True if x % 2 == 0 else False
l = lambda lst: list(map(even, inpt))
print(l(inpt))
| inpt = []
while True:
try:
inpt.append(int(input()))
except EOFError:
break
even = lambda x: True if x % 2 == 0 else False
l = lambda lst: list(map(even, inpt))
print(l(inpt)) |
#/usr/bin/python3
class Car() :
def __init__(self) :
print("This is class named car")
car = Car()
class ChinaCar(Car) :
def __init__(self, name) :
self.__name__ = name
print("China car named ", name)
china_car = ChinaCar("byd")
class FlyCar(Car) :
def __init__(self) :
... | class Car:
def __init__(self):
print('This is class named car')
car = car()
class Chinacar(Car):
def __init__(self, name):
self.__name__ = name
print('China car named ', name)
china_car = china_car('byd')
class Flycar(Car):
def __init__(self):
super().__init__()
@pr... |
#
# PySNMP MIB module CISCO-UNIFIED-COMPUTING-FC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-UNIFIED-COMPUTING-FC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:59:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint) ... |
def heapSort(self):
heap = hp.Heap()
heap.createHeap(*self.arr)
i = 0
while(heap.size > 0):
self.arr[i] = heap.delete()
i += 1 | def heap_sort(self):
heap = hp.Heap()
heap.createHeap(*self.arr)
i = 0
while heap.size > 0:
self.arr[i] = heap.delete()
i += 1 |
text = input()
new = "@"
dash = "-"
save = []
command = input()
while command != "Complete":
conversion = command.split(" ")
if conversion[0] == "Make":
if conversion[1] == "Upper":
conv = text.upper()
text = conv
print(conv)
elif conversion[1... | text = input()
new = '@'
dash = '-'
save = []
command = input()
while command != 'Complete':
conversion = command.split(' ')
if conversion[0] == 'Make':
if conversion[1] == 'Upper':
conv = text.upper()
text = conv
print(conv)
elif conversion[1] == 'Lower':
... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
LOW = float('-inf')
class Solution:
def largestValues(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
... | low = float('-inf')
class Solution:
def largest_values(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
ret = []
if root is None:
return ret
q = collections.deque()
q.append(root)
while q:
acc = LOW
... |
class Solution(object):
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
roman_dict1 = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000}
roman_dict2 = {'IV':4, 'IX':9, 'XL':40, 'XC':90, 'CD':400, 'CM':900}
sum_var = 0
i = 0
wh... | class Solution(object):
def roman_to_int(self, s):
"""
:type s: str
:rtype: int
"""
roman_dict1 = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
roman_dict2 = {'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900}
sum_var = 0
... |
L3_attention_mse=[{"layer_T":4, "layer_S":1, "feature":"attention", "loss":"attention_mse", "weight":1},
{"layer_T":8, "layer_S":2, "feature":"attention", "loss":"attention_mse", "weight":1},
{"layer_T":12, "layer_S":3, "feature":"attention", "loss":"attention_mse", "weight":1}]
L... | l3_attention_mse = [{'layer_T': 4, 'layer_S': 1, 'feature': 'attention', 'loss': 'attention_mse', 'weight': 1}, {'layer_T': 8, 'layer_S': 2, 'feature': 'attention', 'loss': 'attention_mse', 'weight': 1}, {'layer_T': 12, 'layer_S': 3, 'feature': 'attention', 'loss': 'attention_mse', 'weight': 1}]
l3_attention_ce = [{'la... |
class TableEntryPJC:
def __init__(self, rli, wi, rlj, wj, rlij, wij):
self.rli = rli
self.rlj = rlj
self.rlij = rlij
self.wi = wi
self.wj = wj
self.wij = wij
def __str__(self):
res = ""
res = res + " " + str(self.rli) + " : " + str(self.wi) + "\n"... | class Tableentrypjc:
def __init__(self, rli, wi, rlj, wj, rlij, wij):
self.rli = rli
self.rlj = rlj
self.rlij = rlij
self.wi = wi
self.wj = wj
self.wij = wij
def __str__(self):
res = ''
res = res + ' ' + str(self.rli) + ' : ' + str(self.wi) + '\n... |
"""
The Datatable app is responsible for generating and returning
visualization data for specific configurations of dimensions and filters.
"""
| """
The Datatable app is responsible for generating and returning
visualization data for specific configurations of dimensions and filters.
""" |
def pagesNumberingWithInk(current, numberOfDigits):
currentNumberOfDigits = len(str(current))
while numberOfDigits >= currentNumberOfDigits:
numberOfDigits -= currentNumberOfDigits
current += 1
currentNumberOfDigits = len(str(current))
return current-1
if __name__ == '__main__':
input0 = [1, 21, 8, 21, 76, 8... | def pages_numbering_with_ink(current, numberOfDigits):
current_number_of_digits = len(str(current))
while numberOfDigits >= currentNumberOfDigits:
number_of_digits -= currentNumberOfDigits
current += 1
current_number_of_digits = len(str(current))
return current - 1
if __name__ == '__... |
class PrintHelper:
@staticmethod
def PrintBanner(printStr, sep='='):
bannerStr = sep * len(printStr)
print(bannerStr)
print(printStr)
print(bannerStr) | class Printhelper:
@staticmethod
def print_banner(printStr, sep='='):
banner_str = sep * len(printStr)
print(bannerStr)
print(printStr)
print(bannerStr) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This script allows to split an input tf.data.TFRecords dataset
# to training and test dataset using the input split proportions.
# Optionally, the user can request to get a validation dataset
# by passing a float value to the variable `valid_chunk`.
#
# Author: Davide Lo... | __all__ = ['dataset_split']
def dataset_split(dataset, tot_patches, training_chunk, test_chunk, valid_chunk=None):
"""
Function that splits the input data into training and test
datasets. The function expects at least two floating points
between 0.0 and 1.0 to define the proportions of the split.
A... |
bridgelist = []
with open('input.txt') as infile:
for line in infile.readlines():
i, o = line.strip().split('/')
i, o = int(i), int(o)
bridgelist.append((i,o,))
maxlen = 0
maxstrength = 0
def build_bridge(bridgelist, already_used=None, current_value=0, connector_used=0, current_length=0):
... | bridgelist = []
with open('input.txt') as infile:
for line in infile.readlines():
(i, o) = line.strip().split('/')
(i, o) = (int(i), int(o))
bridgelist.append((i, o))
maxlen = 0
maxstrength = 0
def build_bridge(bridgelist, already_used=None, current_value=0, connector_used=0, current_length... |
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def findSecondMinimumValue(self, root):
"""
:type root: TreeNode
:rtype: int
"""
f, s = se... | class Treenode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def find_second_minimum_value(self, root):
"""
:type root: TreeNode
:rtype: int
"""
(f, s) = self.find(root, root.val, root.va... |
__author__ = 'lrebuffi'
"""
=========
Associate
=========
Widgets for association rules.
"""
# Category description for the widget registry
NAME = "Wavepy - Diagnostic"
DESCRIPTION = "Widgets for WavePy - Diagnostic"
BACKGROUND = "#01DFA5" #"#A9F5BC"
ICON = "icons/wavepy.png"
PRIORITY = 0.2
| __author__ = 'lrebuffi'
'\n=========\nAssociate\n=========\n\nWidgets for association rules.\n\n'
name = 'Wavepy - Diagnostic'
description = 'Widgets for WavePy - Diagnostic'
background = '#01DFA5'
icon = 'icons/wavepy.png'
priority = 0.2 |
class UsernameConverters:
regex= '[a-zA-Z0-9]{5,20}'
def to_python(self,value):
return str(value)
def to_url(self,value):
return str(value)
class MobileConverter:
regex = '1[3-9]\d{9}'
def to_python(self,value):
return str(value)
def to_url(self,value):
retu... | class Usernameconverters:
regex = '[a-zA-Z0-9]{5,20}'
def to_python(self, value):
return str(value)
def to_url(self, value):
return str(value)
class Mobileconverter:
regex = '1[3-9]\\d{9}'
def to_python(self, value):
return str(value)
def to_url(self, value):
... |
c, d = None, None
def setup():
size(800, 800)
global c, d
c= color(random(255), random(255), random(255))
d= color(random(255), random(255), random(255))
def draw():
global c, d
for x in range(width): # loop through every x
p = lerpColor(c, d, 1.0 * x/width)
stroke(p)
line(x, 0, x, height)
... | (c, d) = (None, None)
def setup():
size(800, 800)
global c, d
c = color(random(255), random(255), random(255))
d = color(random(255), random(255), random(255))
def draw():
global c, d
for x in range(width):
p = lerp_color(c, d, 1.0 * x / width)
stroke(p)
line(x, 0, x, h... |
n,c = map(int,raw_input().split())
i = 0
while i<c :
if [char for char in str(n)][-1] == "0" :
n=n/10
else :
n-=1
i+=1
print(n) | (n, c) = map(int, raw_input().split())
i = 0
while i < c:
if [char for char in str(n)][-1] == '0':
n = n / 10
else:
n -= 1
i += 1
print(n) |
""" We are given a list schedule of employees, which represents the working time
for each employee. Each employee has a list of non-overlapping Intervals, and
these intervals are in sorted order. Return the list of finite intervals
representing common, positive-length free time for all employees, also in
... | """ We are given a list schedule of employees, which represents the working time
for each employee. Each employee has a list of non-overlapping Intervals, and
these intervals are in sorted order. Return the list of finite intervals
representing common, positive-length free time for all employees, also in
... |
def factorial(n) -> int:
if n == 0:
return 1
return n * factorial(n - 1)
if __name__ == "__main__":
print(factorial(0))
print(factorial(1))
print(factorial(2))
print(factorial(3))
print(factorial(4))
print(factorial(5))
print(factorial(9))
print(factorial(20))
| def factorial(n) -> int:
if n == 0:
return 1
return n * factorial(n - 1)
if __name__ == '__main__':
print(factorial(0))
print(factorial(1))
print(factorial(2))
print(factorial(3))
print(factorial(4))
print(factorial(5))
print(factorial(9))
print(factorial(20)) |
"""
Python script made/used by Sean Klein (smklein).
Used to quickly navigate between multiple repositories.
"""
home = "~"
prefix_dir = home + "/path/prefix"
dir_info =\
["CATEGORY:",
{"directory": prefix_dir + "/dirname",
"build": """
# Updates DEPS
make deps
# Actually builds sources. Default... | """
Python script made/used by Sean Klein (smklein).
Used to quickly navigate between multiple repositories.
"""
home = '~'
prefix_dir = home + '/path/prefix'
dir_info = ['CATEGORY:', {'directory': prefix_dir + '/dirname', 'build': '\n # Updates DEPS\n make deps\n # Actually builds sources. Defaults to ... |
# CPU: 0.06 s
for _ in range(int(input())):
tc_no, num = input().split()
try:
oct_num = int(num, 8)
except ValueError:
oct_num = 0
# Idk why but you have to convert num to int before printing (or else 'Wrong answer')
print(tc_no, oct_num, int(num), int(num, 16))
| for _ in range(int(input())):
(tc_no, num) = input().split()
try:
oct_num = int(num, 8)
except ValueError:
oct_num = 0
print(tc_no, oct_num, int(num), int(num, 16)) |
# -*- coding: utf-8 -*-
# This file is part of the Ingram Micro Cloud Blue Connect connect-cli.
# Copyright (c) 2019-2021 Ingram Micro. All Rights Reserved.
ITEMS_COLS_HEADERS = {
'A': 'ID',
'B': 'MPN',
'C': 'Action',
'D': 'Name',
'E': 'Description',
'F': 'Type',
'G': 'Precision',
'H':... | items_cols_headers = {'A': 'ID', 'B': 'MPN', 'C': 'Action', 'D': 'Name', 'E': 'Description', 'F': 'Type', 'G': 'Precision', 'H': 'Unit', 'I': 'Billing Period', 'J': 'Commitment', 'K': 'Status', 'L': 'Created', 'M': 'Modified'}
params_cols_headers = {'A': 'Verbose ID', 'B': 'ID', 'C': 'Action', 'D': 'Title', 'E': 'Descr... |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def maxDepth(root: TreeNode) -> int:
if not root:
return 0
height = 0
queue = [root]
while queue:
size = len(queue)
height += 1
stack = []
while siz... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def max_depth(root: TreeNode) -> int:
if not root:
return 0
height = 0
queue = [root]
while queue:
size = len(queue)
height += 1
stack = []
while s... |
"""EduuRobot Core!"""
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2021 Amano Team
__version__ = "2.0.0-beta"
| """EduuRobot Core!"""
__version__ = '2.0.0-beta' |
class PublishedEvent(object):
def __init__(self, draft, public):
self.draft = draft
self.public = public
| class Publishedevent(object):
def __init__(self, draft, public):
self.draft = draft
self.public = public |
"""
The Sims 4 Community Library is licensed under the Creative Commons Attribution 4.0 International public license (CC BY 4.0).
https://creativecommons.org/licenses/by/4.0/
https://creativecommons.org/licenses/by/4.0/legalcode
Copyright (c) COLONOLNUTTY
"""
class CommonDialogNavigationButtonTag:
""" Tags appli... | """
The Sims 4 Community Library is licensed under the Creative Commons Attribution 4.0 International public license (CC BY 4.0).
https://creativecommons.org/licenses/by/4.0/
https://creativecommons.org/licenses/by/4.0/legalcode
Copyright (c) COLONOLNUTTY
"""
class Commondialognavigationbuttontag:
""" Tags applie... |
# Carson (2111000) | Zenumist Society (261000010)
experiment = 3310
closedLab = 926120100
if sm.hasQuest(experiment):
control = sm.sendAskYesNo("Do you want to go to the closed laboratory and try controlling the Homun?")
if control:
sm.sendNext("Concentrate...! It won't be an easy task trying to cont... | experiment = 3310
closed_lab = 926120100
if sm.hasQuest(experiment):
control = sm.sendAskYesNo('Do you want to go to the closed laboratory and try controlling the Homun?')
if control:
sm.sendNext("Concentrate...! It won't be an easy task trying to control the Magic Pentragram that triggers Homun's rage.... |
t=int(input())
for i in range(0,t):
str=input()
c=0
for j in range(0,len(str)):
ch=str[j]
if(ch=='a' or ch=='e' or ch=='i' or ch=='o' or ch=='u' or ch=='A' or ch=='E' or ch=='I' or ch=='O' or ch=='U'):
c=c+(len(str)-j)*(j+1)
print(c) | t = int(input())
for i in range(0, t):
str = input()
c = 0
for j in range(0, len(str)):
ch = str[j]
if ch == 'a' or ch == 'e' or ch == 'i' or (ch == 'o') or (ch == 'u') or (ch == 'A') or (ch == 'E') or (ch == 'I') or (ch == 'O') or (ch == 'U'):
c = c + (len(str) - j) * (j + 1)
... |
class Solution:
def largestUniqueNumber(self, A: List[int]) -> int:
counter = Counter(A)
for num, freq in sorted(counter.items(), reverse = True):
if freq == 1:
return num
return -1 | class Solution:
def largest_unique_number(self, A: List[int]) -> int:
counter = counter(A)
for (num, freq) in sorted(counter.items(), reverse=True):
if freq == 1:
return num
return -1 |
class Solution:
def totalMoney(self, n: int) -> int:
# ind = 1
amount = 0
prevmon = 0
while n:
coin = prevmon + 1
for i in range(7):
amount += coin
coin += 1
n-=1
if n==0:
r... | class Solution:
def total_money(self, n: int) -> int:
amount = 0
prevmon = 0
while n:
coin = prevmon + 1
for i in range(7):
amount += coin
coin += 1
n -= 1
if n == 0:
return amount
... |
class Node:
def __init__(self, data):
self.data= data
self.left= None
self.right= None
"""
4
/ \
5 6
/ \ / \
7 None None None
/ \
None None
"""
root= Node(4)
root.left=5
root.rig... | class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
'\n 4\n / 5 6\n / \\ / 7 None None None\n / None None \n'
root = node(4)
root.left = 5
root.right = 6
root.l... |
# ------------------------------
#
#
# Description:
#
#
# Version: 1.0
# 01/19/20 by Jianfa
# ------------------------------
# Used for testing
if __name__ == "__main__":
test = Solution()
# ------------------------------
# Summary:
# | if __name__ == '__main__':
test = solution() |
#ERROR MESSAGES
ARGUMENTS_TYPE_LIST_OR_STRING_ERROR_MESSAGE= "Arguments should be of type List or String"
ARGUMENTS_TYPE_STRING_ERROR_MESSAGE = "Arguments should be of type String"
LABEL_ALREADY_PRESENT_ERROR_MESSAGE = "Class/Label: {} already present."
NO_LABEL_PRESENT_ERROR_MESSAGE = "Please add Class/Labels to the o... | arguments_type_list_or_string_error_message = 'Arguments should be of type List or String'
arguments_type_string_error_message = 'Arguments should be of type String'
label_already_present_error_message = 'Class/Label: {} already present.'
no_label_present_error_message = 'Please add Class/Labels to the object first usi... |
class Bacteria:
def __init__(self, id, type, age, life_counter, power, x, y):
self.id = id
self.type = type
self.age = age
self.life_counter = life_counter
self.power = power
self.x = x
self.y = y
# Create 3 instances of Bacteria
b1 = Bacteria(1, "Cocci", ... | class Bacteria:
def __init__(self, id, type, age, life_counter, power, x, y):
self.id = id
self.type = type
self.age = age
self.life_counter = life_counter
self.power = power
self.x = x
self.y = y
b1 = bacteria(1, 'Cocci', 4, 100, 8, 23, 35)
b2 = bacteria(2, ... |
#To add two numbers
a=int(input("Enter the 1st number"))
b=int(input("Enter the 2nd number"))
c=a+b
print("The sum of the two numbers:",c)
| a = int(input('Enter the 1st number'))
b = int(input('Enter the 2nd number'))
c = a + b
print('The sum of the two numbers:', c) |
# configure the dm text
def generate_dm_text(name):
return '''Hey {}, It great to connect
with you on twitter'''.format(name)
scheduler_time = 15 #in minutes
tw_username = "signosdazueira" #change this to yours
| def generate_dm_text(name):
return 'Hey {}, It great to connect\n\t\t\twith you on twitter'.format(name)
scheduler_time = 15
tw_username = 'signosdazueira' |
#!/usr/bin/env python3
def parse(line):
bound, char, password = line.split(' ')
low, high = bound.split('-')
low, high = int(low), int(high)
char = char[0]
return (low, high, char, password)
def is_valid(low, high, char, password):
low, high = low - 1, high - 1
low, high = password[low] ... | def parse(line):
(bound, char, password) = line.split(' ')
(low, high) = bound.split('-')
(low, high) = (int(low), int(high))
char = char[0]
return (low, high, char, password)
def is_valid(low, high, char, password):
(low, high) = (low - 1, high - 1)
(low, high) = (password[low] == char, pa... |
#Python program to clone or copy a list.
original_list = [10, 22, 44, 23, 4]
new_list = list(original_list)
print(original_list)
print(new_list) | original_list = [10, 22, 44, 23, 4]
new_list = list(original_list)
print(original_list)
print(new_list) |
def get_input():
"""
Wrap input in this method so that it can be wrapped with @patch in tests
:return:
"""
return input('') | def get_input():
"""
Wrap input in this method so that it can be wrapped with @patch in tests
:return:
"""
return input('') |
def find_price_ranges(candlestick_data, period_size):
"""Calculates historical price ranges for a given period duration.
For one period of bars ranges counts as:
1st range: (high price in period - first bar opening price) / first bar opening price - 1
2nd range: (first bar opening price - low price in ... | def find_price_ranges(candlestick_data, period_size):
"""Calculates historical price ranges for a given period duration.
For one period of bars ranges counts as:
1st range: (high price in period - first bar opening price) / first bar opening price - 1
2nd range: (first bar opening price - low price in ... |
class GeneratorError(Exception): pass
class ProgressionGenerator:
# diatonic triads for major keys
diatonic_triads = [
('C', 'Dm', 'Em', 'F', 'G', 'Am', 'Bdim'),
('G', 'Am', 'Bm', 'C', 'D', 'Em', 'F#dim'),
('D', 'Em', 'F#m', 'G', 'A', 'Bm', 'C#dim'),
('A', 'Bm', 'C#m', 'D', 'E', 'F#m', 'G#dim'),
('E', 'F#m... | class Generatorerror(Exception):
pass
class Progressiongenerator:
diatonic_triads = [('C', 'Dm', 'Em', 'F', 'G', 'Am', 'Bdim'), ('G', 'Am', 'Bm', 'C', 'D', 'Em', 'F#dim'), ('D', 'Em', 'F#m', 'G', 'A', 'Bm', 'C#dim'), ('A', 'Bm', 'C#m', 'D', 'E', 'F#m', 'G#dim'), ('E', 'F#m', 'G#m', 'A', 'B', 'C#m', 'D#dim'), (... |
"""Defines the Exceptions that can be raised from the DomainTools API"""
class ServiceException(Exception):
def __init__(self, code, reason):
self.code = code
self.reason = reason
super(ServiceException, self).__init__(str(reason))
class BadRequestException(ServiceException):
pass
... | """Defines the Exceptions that can be raised from the DomainTools API"""
class Serviceexception(Exception):
def __init__(self, code, reason):
self.code = code
self.reason = reason
super(ServiceException, self).__init__(str(reason))
class Badrequestexception(ServiceException):
pass
cl... |
x = int(input())
if (x > 0):
print("positivo")
elif (x < 0):
print("negativo")
else:
print("nulo")
| x = int(input())
if x > 0:
print('positivo')
elif x < 0:
print('negativo')
else:
print('nulo') |
# test order of closed over locals
# not that CPython seems to sort closed over variables (but not fast locals)
def f():
l1 = 1
l2 = 4
l3 = 3
l4 = 2
l5 = 5
def g():
return l1 + l4 + l3 + l2 + l5
def h():
return l1 + l2 + l3 + l4 + l5
| def f():
l1 = 1
l2 = 4
l3 = 3
l4 = 2
l5 = 5
def g():
return l1 + l4 + l3 + l2 + l5
def h():
return l1 + l2 + l3 + l4 + l5 |
EAA_EDUCATION_FACILITIES = {'buildings', 'education facilities - schools', 'facilities and infrastructure'}
EAA_EDUCATION_STATISTICS = {
'baseline population', 'census', 'demographics', 'development', 'early learning', 'economics',
'educational attainment', 'educators - teachers', 'gap analysis', 'government d... | eaa_education_facilities = {'buildings', 'education facilities - schools', 'facilities and infrastructure'}
eaa_education_statistics = {'baseline population', 'census', 'demographics', 'development', 'early learning', 'economics', 'educational attainment', 'educators - teachers', 'gap analysis', 'government data', 'ind... |
N = input().split()
m = int(N[0])
for i in range(round(m / 2, 0)):
for j in range(m):
print(N[-1], end='')
print()
| n = input().split()
m = int(N[0])
for i in range(round(m / 2, 0)):
for j in range(m):
print(N[-1], end='')
print() |
##############################################################################
# Copyright 2022-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#######################################################... | upload_handles = {}
class Fileuploader:
def __init__(self, context: str='default'):
self.upload_handles = get_upload_handles()
if context not in self.upload_handles:
raise runtime_error(f'No configuration found for {context}')
self.uploader = self.upload_handles[context]()
... |
# -*- coding: utf-8 -*-
"""Honeycomb test constants."""
class commands():
"""Plugin commands."""
RUN = "run"
LOGS = "logs"
SHOW = "show"
TEST = "test"
STOP = "stop"
LIST = "list"
STATUS = "status"
INSTALL = "install"
UNINSTALL = "uninstall"
CONFIGURE = "configure"
class ... | """Honeycomb test constants."""
class Commands:
"""Plugin commands."""
run = 'run'
logs = 'logs'
show = 'show'
test = 'test'
stop = 'stop'
list = 'list'
status = 'status'
install = 'install'
uninstall = 'uninstall'
configure = 'configure'
class Args:
"""Plugin arguments... |
"""The GLSL toolchain definition and implementation
"""
def _glsl_toolchain_impl(ctx):
# it is expected the the glslc target contains one and only one
# file that is the compiler.
glslc_executable = ""
if ctx.attr.is_windows:
glslc_executable = ctx.attr.glslc.files.to_list()[0].path
else:... | """The GLSL toolchain definition and implementation
"""
def _glsl_toolchain_impl(ctx):
glslc_executable = ''
if ctx.attr.is_windows:
glslc_executable = ctx.attr.glslc.files.to_list()[0].path
else:
glslc_executable = 'glslc'
toolchain_info = platform_common.ToolchainInfo(glslc=ctx.attr.g... |
# coding=UTF-8
## This class define a composite ply
class CompositePly:
def __init__(self,Material,Thickness,Orientation):
## the material of the ply (either IsoMaterial or OrthoMaterial)
self.Material = Material
## the thickness of the ply (m)
self.Thickness = Thickness
#... | class Compositeply:
def __init__(self, Material, Thickness, Orientation):
self.Material = Material
self.Thickness = Thickness
self.Orientation = Orientation
def get_material(self):
return self.Material
def get_thickness(self):
return self.Thickness
def get_ori... |
class AppTestClasses:
spaceconfig = dict(usemodules=['_multibytecodec'])
def setup_class(cls):
cls.w_IncrementalHzDecoder = cls.space.appexec([], """():
import _codecs_cn
from _multibytecodec import MultibyteIncrementalDecoder
class IncrementalHzDecoder(MultibyteInc... | class Apptestclasses:
spaceconfig = dict(usemodules=['_multibytecodec'])
def setup_class(cls):
cls.w_IncrementalHzDecoder = cls.space.appexec([], "():\n import _codecs_cn\n from _multibytecodec import MultibyteIncrementalDecoder\n\n class IncrementalHzDecoder(MultibyteI... |
"""T Gate"""
def t(index, vector):
return vector
| """T Gate"""
def t(index, vector):
return vector |
# Automatically generated file
# enum Z3_lbool
Z3_L_FALSE = -1
Z3_L_UNDEF = 0
Z3_L_TRUE = 1
# enum Z3_symbol_kind
Z3_INT_SYMBOL = 0
Z3_STRING_SYMBOL = 1
# enum Z3_parameter_kind
Z3_PARAMETER_INT = 0
Z3_PARAMETER_DOUBLE = 1
Z3_PARAMETER_RATIONAL = 2
Z3_PARAMETER_SYMBOL = 3
Z3_PARAMETER_SORT = 4
Z3_PA... | z3_l_false = -1
z3_l_undef = 0
z3_l_true = 1
z3_int_symbol = 0
z3_string_symbol = 1
z3_parameter_int = 0
z3_parameter_double = 1
z3_parameter_rational = 2
z3_parameter_symbol = 3
z3_parameter_sort = 4
z3_parameter_ast = 5
z3_parameter_func_decl = 6
z3_uninterpreted_sort = 0
z3_bool_sort = 1
z3_int_sort = 2
z3_real_sort... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@Creation: 22/06/2020 22:08
@Author: liang
@File: settings.py
"""
COLLECTION_NAME = 'demos' # non-environment dependent plain text data
API_ENV = '${API_ENV:dev}'
# environment dependent sensible data
MONGO_DB_URL = '${MONGO_DB_URL:mongodb://localhost:27017}'
TYP... | """
@Creation: 22/06/2020 22:08
@Author: liang
@File: settings.py
"""
collection_name = 'demos'
api_env = '${API_ENV:dev}'
mongo_db_url = '${MONGO_DB_URL:mongodb://localhost:27017}'
type_var = '${TYPE_VAR:125<int>}'
dict_var = '${DICT_VAR:{"name":"demo"}<dict>}'
list_var = '${LIST_VAR:a,b,c<list>}'
set_var = '${SET_VA... |
def f(x):
a = []
if x == 0:
return f(x)
while x > 0:
a.append(x)
print(x)
f(x-1)
f(3)
| def f(x):
a = []
if x == 0:
return f(x)
while x > 0:
a.append(x)
print(x)
f(x - 1)
f(3) |
def fimdejogo(ma, ve=0):
for l in range(0, 3):
for c in range(0, 3):
# linhas
if ma[l][0] == ma[l][1] and ma[l][1] == ma[l][2]:
let = ma[l][2]
return let
# Colunas
if ma[0][c] == ma[1][c] and ma[1][c] == ma[2][c]:
... | def fimdejogo(ma, ve=0):
for l in range(0, 3):
for c in range(0, 3):
if ma[l][0] == ma[l][1] and ma[l][1] == ma[l][2]:
let = ma[l][2]
return let
if ma[0][c] == ma[1][c] and ma[1][c] == ma[2][c]:
let = ma[2][c]
return let... |
class Provider(PhoneNumberProvider):
formats = ("%## ####", "%##-####", "%######", "0{{area_code}} %## ####", "0{{area_code}} %##-####", "0{{area_code}}-%##-####", "0{{area_code}} %######", "(0{{area_code}}) %## ####", "(0{{area_code}}) %##-####", "(0{{area_code}}) %######", "+64 {{area_code}} %## ####", "+64 {{area_c... | class Provider(PhoneNumberProvider):
formats = ('%## ####', '%##-####', '%######', '0{{area_code}} %## ####', '0{{area_code}} %##-####', '0{{area_code}}-%##-####', '0{{area_code}} %######', '(0{{area_code}}) %## ####', '(0{{area_code}}) %##-####', '(0{{area_code}}) %######', '+64 {{area_code}} %## ####', '+64 {{are... |
# No Bugs in Production (NBP) Library
# https://github.com/aenachescu/nbplib
#
# Licensed under the MIT License <http://opensource.org/licenses/MIT>.
# SPDX-License-Identifier: MIT
# Copyright (c) 2019-2020 Alin Enachescu <https://github.com/aenachescu>
#
# Permission is hereby granted, free of charge, to any person ob... | tests_config = [{'name': 'check_build_configuration', 'buildConfig': [{'config': '<any>:<any>:<any>:<any>', 'consoleOutputContains': 'linux ${compiler} ${standard} ${platform} ${sanitizer}'}]}, {'name': 'check_leak_sanitizer', 'consoleOutputContains': 'check_leak_sanitizer completed successfully', 'buildConfig': [{'con... |
class Solution:
def getRow(self, rowIndex):
"""
:type rowIndex: int
:rtype: List[int]
"""
res = [1] * (rowIndex+1)
for i in range(2, rowIndex+1):
for j in range(1, i):
res[i-j] += res[i-j-1]
return res
| class Solution:
def get_row(self, rowIndex):
"""
:type rowIndex: int
:rtype: List[int]
"""
res = [1] * (rowIndex + 1)
for i in range(2, rowIndex + 1):
for j in range(1, i):
res[i - j] += res[i - j - 1]
return res |
loaddata = LoadData("./unified/uw/train.conll", "./unified/uw/dev.conll", "./unified/uw/test.conll")
counter, counter_dev, counter_test = [],[],[]
a = loaddata.conllu_counter['train']
a = loaddata.counter_process(a)
for d in a:
counter.append(d)
for d in range(len(counter)):
counter[d].index=tuple([d])
b = lo... | loaddata = load_data('./unified/uw/train.conll', './unified/uw/dev.conll', './unified/uw/test.conll')
(counter, counter_dev, counter_test) = ([], [], [])
a = loaddata.conllu_counter['train']
a = loaddata.counter_process(a)
for d in a:
counter.append(d)
for d in range(len(counter)):
counter[d].index = tuple([d])... |
#
# PySNMP MIB module CISCO-WAN-PAR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-WAN-PAR-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:20:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_union, value_size_constraint, constraints_intersection) ... |
class Verbosity:
"""
The Digital DNA utility class to set verbosity.
"""
TEST = 0
MEMORY_ONLY = 1
FILE = 2
FILE_EXTENDED = 3
| class Verbosity:
"""
The Digital DNA utility class to set verbosity.
"""
test = 0
memory_only = 1
file = 2
file_extended = 3 |
# https://leetcode.com/problems/single-number/
def singleNumber(nums):
count = {}
for x in nums:
if x not in count:
count[x] = 1
else:
count[x] = count[x]+1
for x in count:
if count[x] ==1:
return x
print(s... | def single_number(nums):
count = {}
for x in nums:
if x not in count:
count[x] = 1
else:
count[x] = count[x] + 1
for x in count:
if count[x] == 1:
return x
print(single_number([4, 1, 2, 1, 2])) |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"draw_bg": "01_bbox_canvas.ipynb",
"draw_bounding_box": "01_bbox_canvas.ipynb",
"get_image_size": "01_bbox_canvas.ipynb",
"draw_img": "01_bbox_canvas.ipynb",
"points2bbox_c... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'draw_bg': '01_bbox_canvas.ipynb', 'draw_bounding_box': '01_bbox_canvas.ipynb', 'get_image_size': '01_bbox_canvas.ipynb', 'draw_img': '01_bbox_canvas.ipynb', 'points2bbox_coords': '01_bbox_canvas.ipynb', 'BBoxCanvas': '01_bbox_canvas.ipynb', 'draw_b... |
raio = float(input())
pi = 3.14159
area = round(pi * (pow(raio,2)),4)
print("A=%.4f" % area)
| raio = float(input())
pi = 3.14159
area = round(pi * pow(raio, 2), 4)
print('A=%.4f' % area) |
#!/usr/bin/env python
class CommitMgr(object):
def __init__():
pass
| class Commitmgr(object):
def __init__():
pass |
login_query = """
mutation {
login(
input: {
username: $username
password: $password
}
) {
user{
username
sessionExpiration
}
errors{
messages
}
mfaUrl
token
}
}
"""
| login_query = '\nmutation {\n login(\n input: {\n username: $username\n password: $password\n }\n ) {\n user{\n username\n sessionExpiration\n }\n errors{\n messages\n }\n mfaUrl\n token\n }\n}\n' |
print('Analisando emprestimos!!!')
print('=-=' * 20)
valor = float(input('Valor do imovel: R$'))
salario = float(input('Salario do cliente: R$'))
tempo = int(input('Tempo do emprestimo [anos]: '))
print('=-=' * 20)
if valor / (12 * tempo) >= salario * 30/100:
print(f'Seu emprestimo foi \033[31mNEGADO!')
else:
p... | print('Analisando emprestimos!!!')
print('=-=' * 20)
valor = float(input('Valor do imovel: R$'))
salario = float(input('Salario do cliente: R$'))
tempo = int(input('Tempo do emprestimo [anos]: '))
print('=-=' * 20)
if valor / (12 * tempo) >= salario * 30 / 100:
print(f'Seu emprestimo foi \x1b[31mNEGADO!')
else:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.