content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
NOTES = {
'notes': [
{'date': '2014-05-22T00:00:00Z', 'note': 'Second Note'},
{'date': '2014-05-21T14:02:45Z', 'note': 'First Note'}
]
}
SUBJECT = {
"subject": ['HB1-3840', 'H']
}
OWNER = {
"owner": "Owner"
}
EDITORIAL = {
"editor_group": "editorgroup",
"editor": "associate"
}... | notes = {'notes': [{'date': '2014-05-22T00:00:00Z', 'note': 'Second Note'}, {'date': '2014-05-21T14:02:45Z', 'note': 'First Note'}]}
subject = {'subject': ['HB1-3840', 'H']}
owner = {'owner': 'Owner'}
editorial = {'editor_group': 'editorgroup', 'editor': 'associate'}
seal = {'doaj_seal': True} |
def fatorial(n):
f = 1
while n != 0:
f *= n
n -= 1
return f
def dobro(n):
n *= 2
return n
def triplo(n):
n *= 3
return n
| def fatorial(n):
f = 1
while n != 0:
f *= n
n -= 1
return f
def dobro(n):
n *= 2
return n
def triplo(n):
n *= 3
return n |
#!/usr/bin/python3
# If F(a) is any function that can be defined as composition of bitwise XORs, ANDs and left shifts
# Then the dynac system x_(n+1) = F(x_n) is Turing complete
# Proof by simulation (rule110)
a = 1
while a:
print(bin(a))
a = a ^ (a << 1) ^ (a & (a << 1)) ^ (a & (a << 1) & (a << 2))
| a = 1
while a:
print(bin(a))
a = a ^ a << 1 ^ a & a << 1 ^ a & a << 1 & a << 2 |
load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps(omit_commons_codec = True):
JACKSON_VERS = "2.10.2"
maven_jar(
name = "scribejava-core",
artifact = "com.github.scribejava:scribejava-core:6.9.0",
sha1 = "ed761f450d8382f75787e8fee9ae52e7ec768747",
)
maven_j... | load('//tools/bzl:maven_jar.bzl', 'maven_jar')
def external_plugin_deps(omit_commons_codec=True):
jackson_vers = '2.10.2'
maven_jar(name='scribejava-core', artifact='com.github.scribejava:scribejava-core:6.9.0', sha1='ed761f450d8382f75787e8fee9ae52e7ec768747')
maven_jar(name='jackson-annotations', artifact... |
def load(h):
return ({'abbr': 0, 'code': 0, 'title': 'There is no appended list'},
{'abbr': 1,
'code': 1,
'title': 'Numbers define number of points corresponding to full coordinate '
'circles (i.e. parallels), coordinate values on each circle are '
... | def load(h):
return ({'abbr': 0, 'code': 0, 'title': 'There is no appended list'}, {'abbr': 1, 'code': 1, 'title': 'Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid... |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
seen = set()
curr = headA
while curr:
seen.add(curr)
... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def get_intersection_node(self, headA: ListNode, headB: ListNode) -> ListNode:
seen = set()
curr = headA
while curr:
seen.add(curr)
curr = curr.next
cur... |
# Copyright 2020 Plezentek, Inc. 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
#
# Unless required by applicable law or... | load('//sqlc/private:providers.bzl', 'SQLCRelease')
load('//sqlc/private/rules_go/lib:platforms.bzl', 'PLATFORMS')
def _sqlc_toolchain_impl(ctx):
release = ctx.attr.release[SQLCRelease]
cross_compile = ctx.attr.goos != release.goos or ctx.attr.goarch != release.goarch
return [platform_common.ToolchainInfo(... |
root = {
"general" : {
"display_viewer" : False,
#The visible GPUS will be restricted to the numbers listed here. The pytorch (cuda:0) numeration will start at 0
#This is a trick to get everything onto the wanted gpus because just setting cuda:4 in the function calls will
#not work... | root = {'general': {'display_viewer': False, 'cuda_visible_devices': '1', 'save_track_results': True}, 'data': {'selection_interval': [0, 10000], 'source': {'base_folder': '/u40/zhanr110/MTA_ext_short/test', 'cam_ids': [1]}}, 'detector': {'mmdetection_config': 'detectors/mmdetection/configs/mta/faster_rcnn_r50_mta.py',... |
i=input("Enter a string: ")
list = i.split()
list.sort()
for i in list:
print(i,end=' ')
| i = input('Enter a string: ')
list = i.split()
list.sort()
for i in list:
print(i, end=' ') |
def test_one_plus_one_is_two():
assert 1 + 1 == 2 #o assert espera que algo seja verdadeiro, se for falso o teste quebrou
def test_negative_1_plus_1_is_3():
assert 1 + 1 == 3
| def test_one_plus_one_is_two():
assert 1 + 1 == 2
def test_negative_1_plus_1_is_3():
assert 1 + 1 == 3 |
values = []
for i in range(9):
values.append(int(input('')))
max_value = 0
location = 0
for i in range(9):
if values[i] > max_value:
max_value = values[i]
location = i+1
print(max_value)
print(location) | values = []
for i in range(9):
values.append(int(input('')))
max_value = 0
location = 0
for i in range(9):
if values[i] > max_value:
max_value = values[i]
location = i + 1
print(max_value)
print(location) |
# OpenWeatherMap API Key
weather_api_key = "MyOpenWeatherMapAPIKey"
# Google API Key
g_key = "MyGoogleKey" | weather_api_key = 'MyOpenWeatherMapAPIKey'
g_key = 'MyGoogleKey' |
def attack():
pass
def defend():
pass
def pass_turn():
pass
def use_ability_One(kit):
pass
def use_ability_Two(kit):
pass
def end_Of_Battle():
pass | def attack():
pass
def defend():
pass
def pass_turn():
pass
def use_ability__one(kit):
pass
def use_ability__two(kit):
pass
def end__of__battle():
pass |
mail_settings = {
"MAIL_SERVER": 'smtp.gmail.com',
"MAIL_PORT": 465,
"MAIL_USE_TLS": False,
"MAIL_USE_SSL": True,
"MAIL_USERNAME": 'c003.teste.jp@gmail.com',
"MAIL_PASSWORD": 'C003.teste'
} | mail_settings = {'MAIL_SERVER': 'smtp.gmail.com', 'MAIL_PORT': 465, 'MAIL_USE_TLS': False, 'MAIL_USE_SSL': True, 'MAIL_USERNAME': 'c003.teste.jp@gmail.com', 'MAIL_PASSWORD': 'C003.teste'} |
class Solution:
def maxArea(self, height) -> int:
left=0
right=len(height)-1
res=min(height[left],height[right])*(right-left)
while right>left:
res=max(res,(right-left)*min(height[right],height[left]))
if height[left]<height[right]:
left+=1
... | class Solution:
def max_area(self, height) -> int:
left = 0
right = len(height) - 1
res = min(height[left], height[right]) * (right - left)
while right > left:
res = max(res, (right - left) * min(height[right], height[left]))
if height[left] < height[right]:
... |
# Copyright (c) 2021, Omid Erfanmanesh, All rights reserved.
class RuntimeMode:
TRAIN = 0
TUNING = 1
CROSS_VAL = 2
FEATURE_IMPORTANCE = 3
| class Runtimemode:
train = 0
tuning = 1
cross_val = 2
feature_importance = 3 |
#
# Example file for HelloWorld
#
def main():
print("Hello World")
name = input("What is your name? ")
print("Nice to meet you,", name)
if __name__ == "__main__":
main()
| def main():
print('Hello World')
name = input('What is your name? ')
print('Nice to meet you,', name)
if __name__ == '__main__':
main() |
class DispatchConfig:
def __init__(self, raw_config):
self.registered_commands = {}
for package in raw_config["handlers"]:
for command in package["commands"]:
self.registered_commands[command] = {
"class": package["class"],
"fullpat... | class Dispatchconfig:
def __init__(self, raw_config):
self.registered_commands = {}
for package in raw_config['handlers']:
for command in package['commands']:
self.registered_commands[command] = {'class': package['class'], 'fullpath': '.'.join([package['package'], packag... |
"set operations for multiple sequences"
def intersect(*args):
res = []
for x in args[0]: # scan the first list
for other in args[1:]: # for all other arguments
if x not in other: break # this item in each one?
else:
res.append(x) #... | """set operations for multiple sequences"""
def intersect(*args):
res = []
for x in args[0]:
for other in args[1:]:
if x not in other:
break
else:
res.append(x)
return res
def union(*args):
res = []
for seq in args:
for x in seq:
... |
msg_dict = {
'resource_not_found':
'The resource you specified was not found',
'invalid_gender':
"The gender you specified is invalid!!",
'many_invalid_fields':
'Some errors occured while validating some fields. Please check and try again',
'unique':
'The {} you inputted already exists',... | msg_dict = {'resource_not_found': 'The resource you specified was not found', 'invalid_gender': 'The gender you specified is invalid!!', 'many_invalid_fields': 'Some errors occured while validating some fields. Please check and try again', 'unique': 'The {} you inputted already exists', 'user_not_found': 'The user with... |
'''
- Leetcode problem: 23
- Difficulty: Hard
- Brief problem description:
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
Example:
Input:
[
1->4->5,
1->3->4,
2->6
]
Output: 1->1->2->3->4->4->5->6
- Solution Summary:
- Used Resources:
--- Bo Zhou
'''
# ... | """
- Leetcode problem: 23
- Difficulty: Hard
- Brief problem description:
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
Example:
Input:
[
1->4->5,
1->3->4,
2->6
]
Output: 1->1->2->3->4->4->5->6
- Solution Summary:
- Used Resources:
--- Bo Zhou
"""
cla... |
# Written by Ivan Sapozhkov and Denis Chagin <denis.chagin@emlid.com>
#
# Copyright (c) 2016, Emlid Limited
# All rights reserved.
#
# Redistribution and use in source and binary forms,
# with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code ... | def create_security(proto, key_mgmt, group):
if not proto:
return 'open'
if not key_mgmt:
if 'wep' in group:
return 'wep'
else:
return None
elif 'wpa-psk' in key_mgmt:
if proto == 'WPA':
return 'wpapsk'
elif proto == 'RSN':
... |
# Given a singly linked list, determine if it is a palindrome.
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
fast = slow = head
# find t... | class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def is_palindrome(self, head: ListNode) -> bool:
fast = slow = head
while fast and fast.next:
slow = slow.next
fast = fast.next.next
node = Non... |
with open("inputday3.txt") as f:
data = [x for x in f.read().split()]
gamma = ""
epsilon = ""
for b in range(0, len(data[0])):
one = 0
zero = 0
for c in range(0, len(data)):
if data[c][b] == '0':
zero += 1
else:
one += 1
if zero > one:
... | with open('inputday3.txt') as f:
data = [x for x in f.read().split()]
gamma = ''
epsilon = ''
for b in range(0, len(data[0])):
one = 0
zero = 0
for c in range(0, len(data)):
if data[c][b] == '0':
zero += 1
else:
one += 1
if zero > one:
gamma += '0'
... |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... | power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres... |
# type: ignore
__all__ = [
"readDatastoreImage",
"datastore",
]
def readDatastoreImage(*args):
raise NotImplementedError("readDatastoreImage")
def datastore(*args):
raise NotImplementedError("datastore")
| __all__ = ['readDatastoreImage', 'datastore']
def read_datastore_image(*args):
raise not_implemented_error('readDatastoreImage')
def datastore(*args):
raise not_implemented_error('datastore') |
# THIS FILE IS GENERATED FROM SCIPY SETUP.PY
short_version = '1.5.4'
version = '1.5.4'
full_version = '1.5.4'
git_revision = '19acfed431060aafaa963f7e530c95e70cd4b85c'
release = True
if not release:
version = full_version
| short_version = '1.5.4'
version = '1.5.4'
full_version = '1.5.4'
git_revision = '19acfed431060aafaa963f7e530c95e70cd4b85c'
release = True
if not release:
version = full_version |
#
# PySNMP MIB module ZYXEL-AclV2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-AclV2-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:43:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, single_value_constraint, constraints_intersection, value_range_constraint) ... |
class Temperature:
def __init__(self, kelvin=None, celsius=None, fahrenheit=None):
values = [x for x in [kelvin, celsius, fahrenheit] if x]
if len(values) < 1:
raise ValueError('Need argument')
if len(values) > 1:
raise ValueError('Only one argument')
if ce... | class Temperature:
def __init__(self, kelvin=None, celsius=None, fahrenheit=None):
values = [x for x in [kelvin, celsius, fahrenheit] if x]
if len(values) < 1:
raise value_error('Need argument')
if len(values) > 1:
raise value_error('Only one argument')
if ce... |
class Solution:
def coinChange(self, coins: List[int], amount: int) -> int:
M = float('inf')
# dynamic programming
dp = [0] + [M] * amount
for i in range(1, amount+1):
dp[i] = 1 + min([dp[i-c] for c in coins if i >= c] or [M])
return dp[-1] if dp[-1] < M else -1
| class Solution:
def coin_change(self, coins: List[int], amount: int) -> int:
m = float('inf')
dp = [0] + [M] * amount
for i in range(1, amount + 1):
dp[i] = 1 + min([dp[i - c] for c in coins if i >= c] or [M])
return dp[-1] if dp[-1] < M else -1 |
def removeLoop(head):
ptr = head
ptr2 = head
while True :
if ptr is None or ptr2 is None or ptr2.next is None :
return
ptr = ptr.next
ptr2 = ptr2.next.next
if ptr is ptr2 :
loopNode = ptr
break
ptr = loopNode.next
count = ... | def remove_loop(head):
ptr = head
ptr2 = head
while True:
if ptr is None or ptr2 is None or ptr2.next is None:
return
ptr = ptr.next
ptr2 = ptr2.next.next
if ptr is ptr2:
loop_node = ptr
break
ptr = loopNode.next
count = 1
while... |
students = []
def read_file():
try:
f = open("students.txt", "r")
for student in read_students(f):
students.append(student)
f.close()
except Exception:
print("Could not read file")
def read_students(f):
for line in f:
yield line
read_file()
print(stu... | students = []
def read_file():
try:
f = open('students.txt', 'r')
for student in read_students(f):
students.append(student)
f.close()
except Exception:
print('Could not read file')
def read_students(f):
for line in f:
yield line
read_file()
print(student... |
def extended_euclidean_algorithm(a, b):
# Initial s = 1
s = 1
list_s = []
list_t = []
# Algorithm
while b > 0:
# Find the remainder of a, b
r = a % b
if r > 0:
# The t expression
t = (r - (a * s)) // b
list_t.append(t)
list... | def extended_euclidean_algorithm(a, b):
s = 1
list_s = []
list_t = []
while b > 0:
r = a % b
if r > 0:
t = (r - a * s) // b
list_t.append(t)
list_s.append(s)
a = b
if r > 0:
b = r
else:
break
for i in... |
WIDTH = 20
HEIGHT = 14
TITLE = 'Click Ninja'
BACKGROUND = 'board'
def destroy(s):
sound('swoosh')
if s.name == 'taco':
score(50)
else:
score(5)
# draw a splatting image at the center position of the image
image('redsplat', center=s.event_pos, size=2).fade(1.0)
s.fade(0.25)
def ... | width = 20
height = 14
title = 'Click Ninja'
background = 'board'
def destroy(s):
sound('swoosh')
if s.name == 'taco':
score(50)
else:
score(5)
image('redsplat', center=s.event_pos, size=2).fade(1.0)
s.fade(0.25)
def failure(s):
score(-20)
if s.name == 'bomb':
s.des... |
DEPTH = 3
# Action
class Action:
top = [1, 0, 0, 0]
bottom = [0, 1, 0, 0]
left = [0, 0, 1, 0]
right = [0, 0, 0, 1]
actlist = [(-1, 0), (1, 0), (0, -1), (0, 1)]
mapAct = {
actlist[0]: top,
actlist[1]: bottom,
actlist[2]: left,
actlist[3]: right
}
def go(s... | depth = 3
class Action:
top = [1, 0, 0, 0]
bottom = [0, 1, 0, 0]
left = [0, 0, 1, 0]
right = [0, 0, 0, 1]
actlist = [(-1, 0), (1, 0), (0, -1), (0, 1)]
map_act = {actlist[0]: top, actlist[1]: bottom, actlist[2]: left, actlist[3]: right}
def go(state, action, board_height, board_width):
... |
def read_csv(root, file_name, keys):
with open('{root}private_static/csv/{file_name}.csv'.format(root=root, file_name=file_name)) as file:
data = file.read()
lines = data.split("\n")
return [dict(zip(keys, line.split(','))) for i, line in enumerate(lines) if i != 0]
| def read_csv(root, file_name, keys):
with open('{root}private_static/csv/{file_name}.csv'.format(root=root, file_name=file_name)) as file:
data = file.read()
lines = data.split('\n')
return [dict(zip(keys, line.split(','))) for (i, line) in enumerate(lines) if i != 0] |
# -*- coding: utf-8 -*-
'''
Copyright 2012 Rodrigo Pinheiro Matias <rodrigopmatias@gmail.com>
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 r... | """
Copyright 2012 Rodrigo Pinheiro Matias <rodrigopmatias@gmail.com>
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 la... |
def main():
# input
A = input()
# compute
# output
if A == 'a':
print(-1)
else:
print('a')
if __name__ == '__main__':
main()
| def main():
a = input()
if A == 'a':
print(-1)
else:
print('a')
if __name__ == '__main__':
main() |
## mv to //:WORKSPACE.bzl ocaml_configure
load("//ocaml/_bootstrap:ocaml.bzl", _ocaml_configure = "ocaml_configure")
# load("//ocaml/_bootstrap:obazl.bzl", _obazl_configure = "obazl_configure")
load("//ocaml/_rules:ocaml_repository.bzl" , _ocaml_repository = "ocaml_repository")
# load("//ocaml/_rules:opam_confi... | load('//ocaml/_bootstrap:ocaml.bzl', _ocaml_configure='ocaml_configure')
load('//ocaml/_rules:ocaml_repository.bzl', _ocaml_repository='ocaml_repository')
ocaml_configure = _ocaml_configure
ocaml_repository = _ocaml_repository |
class MetricsService:
def __init__(self, adc_data, metrics_data):
self._adc_data = adc_data
self._metrics_data = metrics_data
@property
def metrics_data(self):
return self._metrics_data
def update(self):
self._metrics_data.is_new_data_available = False
if self.... | class Metricsservice:
def __init__(self, adc_data, metrics_data):
self._adc_data = adc_data
self._metrics_data = metrics_data
@property
def metrics_data(self):
return self._metrics_data
def update(self):
self._metrics_data.is_new_data_available = False
if self.... |
#sum(iterable, start=0, /)
#Return the sum of a 'start' value (default: 0) plus an iterable of numbers
#When the iterable is empty, return the start value.
'''This function is intended specifically for use with numeric values and may
reject non-numeric types.'''
a = [1,3,5,7,9,4,6,2,8]
print(sum(a))
pr... | """This function is intended specifically for use with numeric values and may
reject non-numeric types."""
a = [1, 3, 5, 7, 9, 4, 6, 2, 8]
print(sum(a))
print(sum(a, start=4)) |
def find_accounts(search_text):
# perform search...
if not db_is_available:
return None
# returns a list of account IDs
return db_search(search_text)
accounts = find_accounts('python')
if accounts is None:
print("Error: DB not available")
else:
print("Accounts found: Would list them he... | def find_accounts(search_text):
if not db_is_available:
return None
return db_search(search_text)
accounts = find_accounts('python')
if accounts is None:
print('Error: DB not available')
else:
print('Accounts found: Would list them here...')
def db_search(search_text):
return [1, 11]
db_is_... |
fruits = ["orange", "banana", "apple", "avocado", "kiwi", "apricot",
"cherry", "grape", "coconut", "lemon", "mango", "peach",
"pear", "strawberry", "pineapple", "apple", "orange", "pear",
"grape", "banana"
]
filters = dict()
for key in fruits:
filters[key] = 1
result =... | fruits = ['orange', 'banana', 'apple', 'avocado', 'kiwi', 'apricot', 'cherry', 'grape', 'coconut', 'lemon', 'mango', 'peach', 'pear', 'strawberry', 'pineapple', 'apple', 'orange', 'pear', 'grape', 'banana']
filters = dict()
for key in fruits:
filters[key] = 1
result = set(filters.keys())
print(result) |
#module.py
def hello():
print("Hello!")
#if __name__=="__main__":
# print(__name__) | def hello():
print('Hello!') |
class IOEngine(object):
def __init__(self, node):
self.node = node
self.inputs = []
self.outputs = []
def release(self):
self.inputs = None
self.outputs = None
self.node = None
def updateInputs(self, names):
# remove prior outputs
for input... | class Ioengine(object):
def __init__(self, node):
self.node = node
self.inputs = []
self.outputs = []
def release(self):
self.inputs = None
self.outputs = None
self.node = None
def update_inputs(self, names):
for input_node in self.inputs:
... |
#
# Copyright (C) 2018 The Android Open Source Project
#
# 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 la... | model = model()
i1 = input('op1', 'TENSOR_FLOAT32', '{1, 3, 3, 2}')
f1 = input('op2', 'TENSOR_FLOAT32', '{1, 2, 2, 4}')
b1 = input('op3', 'TENSOR_FLOAT32', '{4}')
pad0 = int32_scalar('pad0', 0)
act = int32_scalar('act', 0)
stride = int32_scalar('stride', 1)
cm = int32_scalar('channelMultiplier', 2)
output = output('op4... |
class Check_Excessive_Current(object):
def __init__(self,chain_name,cf,handlers,irrigation_io,irrigation_hash_control,get_json_object):
self.get_json_object = get_json_object
cf.define_chain(chain_name, False )
#cf.insert.log("check_excessive_current")
cf.insert.ass... | class Check_Excessive_Current(object):
def __init__(self, chain_name, cf, handlers, irrigation_io, irrigation_hash_control, get_json_object):
self.get_json_object = get_json_object
cf.define_chain(chain_name, False)
cf.insert.assert_function_reset(self.check_excessive_current)
cf.in... |
indexWords = list()
def PreviousWord(_list, _word):
if _list[_list.index(_word)-1] :
return _list[_list.index(_word)-1]
else:
return
phrase = str(input())
phraseList = phrase.split(" ")
length = len(phraseList)
for item in phraseList :
item = item.strip()
if phrase != "" :
fo... | index_words = list()
def previous_word(_list, _word):
if _list[_list.index(_word) - 1]:
return _list[_list.index(_word) - 1]
else:
return
phrase = str(input())
phrase_list = phrase.split(' ')
length = len(phraseList)
for item in phraseList:
item = item.strip()
if phrase != '':
for i in ... |
city_country = {}
for _ in range(int(input())):
country, *cities = input().split()
for city in cities:
city_country[city] = country
for _ in range(int(input())):
print(city_country[input()]) | city_country = {}
for _ in range(int(input())):
(country, *cities) = input().split()
for city in cities:
city_country[city] = country
for _ in range(int(input())):
print(city_country[input()]) |
nume1 = int(input("Digite um numero"))
nume2 = int(input("Digite um numero"))
nume3 = int(input("Digite um numero"))
nume4 = int(input("Digite um numero"))
nume5 = int(input("Digite um numero"))
table = [nume1,nume2,nume3,nume4,nume5]
tableM = (float((nume1 + nume2 + nume3 + nume4 + nume5)))
print(float(tableM)) | nume1 = int(input('Digite um numero'))
nume2 = int(input('Digite um numero'))
nume3 = int(input('Digite um numero'))
nume4 = int(input('Digite um numero'))
nume5 = int(input('Digite um numero'))
table = [nume1, nume2, nume3, nume4, nume5]
table_m = float(nume1 + nume2 + nume3 + nume4 + nume5)
print(float(tableM)) |
class Solution:
def combinationSum(self, candidates, target):
def lookup(candidates, index, target, combine, result):
if target == 0:
result.append(combine)
return
if index >= len(candidates) and target > 0:
return
... | class Solution:
def combination_sum(self, candidates, target):
def lookup(candidates, index, target, combine, result):
if target == 0:
result.append(combine)
return
if index >= len(candidates) and target > 0:
return
if tar... |
# version of the graw package
__version__ = "0.1.0"
| __version__ = '0.1.0' |
'''
@author Gabriel Flores
Checks the primality of an integer.
'''
def is_prime(x):
'''
Checks the primality of an integer.
'''
sqrt = int(x ** (1/2))
for i in range(2, sqrt, 1):
if x % i == 0:
return False
return True
def main():
try:
print("\n\n")
a = int(input(" Enter an integer to check if ... | """
@author Gabriel Flores
Checks the primality of an integer.
"""
def is_prime(x):
"""
Checks the primality of an integer.
"""
sqrt = int(x ** (1 / 2))
for i in range(2, sqrt, 1):
if x % i == 0:
return False
return True
def main():
try:
print('\n\n')
a = i... |
def fibonacci_iterative(n):
previous = 0
current = 1
for i in range(n - 1):
current_old = current
current = previous + current
previous = current_old
return current
def fibonacci_recursive(n):
if n == 0 or n == 1:
return n
else:
return fibonacci_recursive... | def fibonacci_iterative(n):
previous = 0
current = 1
for i in range(n - 1):
current_old = current
current = previous + current
previous = current_old
return current
def fibonacci_recursive(n):
if n == 0 or n == 1:
return n
else:
return fibonacci_recursive... |
__all__ = [
'session',
'event',
'profile',
'consent',
'segment',
'source',
'rule',
'entity'
]
| __all__ = ['session', 'event', 'profile', 'consent', 'segment', 'source', 'rule', 'entity'] |
def global_alignment(seq1, seq2, score_matrix, penalty):
len1, len2 = len(seq1), len(seq2)
s = [[0] * (len2 + 1) for i in range(len1 + 1)]
backtrack = [[0] * (len2 + 1) for i in range(len1 + 1)]
for i in range(1, len1 + 1):
s[i][0] = - i * penalty
for j in range(1, len2 + 1):
s[0][j]... | def global_alignment(seq1, seq2, score_matrix, penalty):
(len1, len2) = (len(seq1), len(seq2))
s = [[0] * (len2 + 1) for i in range(len1 + 1)]
backtrack = [[0] * (len2 + 1) for i in range(len1 + 1)]
for i in range(1, len1 + 1):
s[i][0] = -i * penalty
for j in range(1, len2 + 1):
s[0]... |
def main(file: str) -> None:
depth = 0
distance = 0
aim = 0
with open(f"{file}.in") as f:
for line in f.readlines():
line = line.rstrip().split(" ")
command = line[0]
unit = int(line[1])
if command == "forward":
distance += unit
... | def main(file: str) -> None:
depth = 0
distance = 0
aim = 0
with open(f'{file}.in') as f:
for line in f.readlines():
line = line.rstrip().split(' ')
command = line[0]
unit = int(line[1])
if command == 'forward':
distance += unit
... |
# coding=utf8
class MetaSingleton(type):
def __init__(cls, *args):
type.__init__(cls, *args)
cls.instance = None
def __call__(cls, *args, **kwargs):
if not cls.instance:
cls.instance = type.__call__(cls, *args, **kwargs)
return cls.instance
| class Metasingleton(type):
def __init__(cls, *args):
type.__init__(cls, *args)
cls.instance = None
def __call__(cls, *args, **kwargs):
if not cls.instance:
cls.instance = type.__call__(cls, *args, **kwargs)
return cls.instance |
class Person:
olhos = 2
def __init__(self, *children, name=None, year=0):
self.year = year
self.name = name
self.children = list(children)
def cumprimentar(self):
return 'Hello'
@staticmethod
def metodo_estatico():
return 123
@classmethod
def metod... | class Person:
olhos = 2
def __init__(self, *children, name=None, year=0):
self.year = year
self.name = name
self.children = list(children)
def cumprimentar(self):
return 'Hello'
@staticmethod
def metodo_estatico():
return 123
@classmethod
def metod... |
class Animal:
def __init__(self):
self.name = ""
self.weight = 0
self.sound = ""
def setName(self, name):
self.name = name
def getName(self):
return self.name
def setWeight(self, weight):
self.weight = weight
def getWeight(self):
return sel... | class Animal:
def __init__(self):
self.name = ''
self.weight = 0
self.sound = ''
def set_name(self, name):
self.name = name
def get_name(self):
return self.name
def set_weight(self, weight):
self.weight = weight
def get_weight(self):
retur... |
#!/usr/bin/python3
lines = open("inputs/07.in", "r").readlines()
for i,line in enumerate(lines):
lines[i] = line.split("\n")[0]
l = lines.copy();
wires = {}
def func_set(p, i):
if p[0].isdigit():
wires[p[2]] = int(p[0])
lines.pop(i)
elif p[0] in wires.keys():
wires[p[2]] = wires[p... | lines = open('inputs/07.in', 'r').readlines()
for (i, line) in enumerate(lines):
lines[i] = line.split('\n')[0]
l = lines.copy()
wires = {}
def func_set(p, i):
if p[0].isdigit():
wires[p[2]] = int(p[0])
lines.pop(i)
elif p[0] in wires.keys():
wires[p[2]] = wires[p[0]]
lines.... |
#Variables
#Working with build 2234
saberPort = "/dev/ttyUSB0"
#Initializing Motorcontroller
saber = Runtime.start("saber", "Sabertooth")
saber.connect(saberPort)
sleep(1)
#Initializing Joystick
joystick = Runtime.start("joystick","Joystick")
print(joystick.getControllers())
python.subscribe("joystick","publishJoysti... | saber_port = '/dev/ttyUSB0'
saber = Runtime.start('saber', 'Sabertooth')
saber.connect(saberPort)
sleep(1)
joystick = Runtime.start('joystick', 'Joystick')
print(joystick.getControllers())
python.subscribe('joystick', 'publishJoystickInput')
joystick.setController(0)
for x in range(0, 100):
print('power', x)
sa... |
#===============================================================================
# Copyright 2020-2021 Intel Corporation
#
# 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.apa... | load('@onedal//dev/bazel:repos.bzl', 'repos')
micromkl_repo = repos.prebuilt_libs_repo_rule(includes=['include', '%{os}/include'], libs=['%{os}/lib/intel64/libdaal_mkl_thread.a', '%{os}/lib/intel64/libdaal_mkl_sequential.a', '%{os}/lib/intel64/libdaal_vmlipp_core.a'], build_template='@onedal//dev/bazel/deps:micromkl.tp... |
guests=int(input())
reservations=set([])
while guests!=0:
reservationCode=input()
reservations.add(reservationCode)
guests-=1
while True:
r=input()
if r!="END":
reservations.discard(r)
else:
print(len(reservations))
VIPS=[]; Regulars=[]
for e in reservations:
... | guests = int(input())
reservations = set([])
while guests != 0:
reservation_code = input()
reservations.add(reservationCode)
guests -= 1
while True:
r = input()
if r != 'END':
reservations.discard(r)
else:
print(len(reservations))
vips = []
regulars = []
f... |
class TestClass:
def __init__(self, list, name):
self.list = list
self.name = name
def func1():
print("func1 print something")
def func2():
print("func2 print something")
integer = 8
return integer
def func3():
print("func3 print something")
s = "func3"
return s
def f... | class Testclass:
def __init__(self, list, name):
self.list = list
self.name = name
def func1():
print('func1 print something')
def func2():
print('func2 print something')
integer = 8
return integer
def func3():
print('func3 print something')
s = 'func3'
return s
def ... |
# // ###########################################################################
# // Queries
# // ###########################################################################
# -> get a single cell of a df (use `iloc` with `row` + `col` as arguments)
df.iloc[0]['staticContextId']
# -> get one column as a list
allFunc... | df.iloc[0]['staticContextId']
all_function_names = staticContexts[['displayName']].to_numpy().flatten().tolist()
call_linked = staticTraces[~staticTraces['callId'].isin([0])]
df.drop(['A', 'B'], axis=1)
staticTraces.query(f'callId == {callId} or resultCallId == {callId}')
df.set_index('key').join(other.set_index('key')... |
def climbingLeaderboard(ranked, player):
ranked = sorted(list(set(ranked)), reverse=True)
ranks = []
# print(ranked)
for i in range(len(player)):
bi = 0
bs = len(ranked) - 1
index = 0
while (bi <= bs):
mid = (bi+bs) // 2
if (ranked[mid] > player... | def climbing_leaderboard(ranked, player):
ranked = sorted(list(set(ranked)), reverse=True)
ranks = []
for i in range(len(player)):
bi = 0
bs = len(ranked) - 1
index = 0
while bi <= bs:
mid = (bi + bs) // 2
if ranked[mid] > player[i]:
in... |
class Auth():
def __init__(self, client):
self.client = client
def get_profiles(self):
return self.client.get('/auth/api/profiles/', {'page_size': 10000})['results']
def get_groups(self):
return self.client.get('/auth/api/groups/')
def get_group_map(self):
return {gro... | class Auth:
def __init__(self, client):
self.client = client
def get_profiles(self):
return self.client.get('/auth/api/profiles/', {'page_size': 10000})['results']
def get_groups(self):
return self.client.get('/auth/api/groups/')
def get_group_map(self):
return {group... |
class Solution:
def kthFactor(self, n: int, k: int) -> int:
s1 = set()
s2 = set()
for i in range(1,int(n**0.5)+1):
if n%i ==0:
s1.add(i)
s2.add(int(n/i))
l = list(s1|s2)
l.sort()
if k > len(l):
return -1
... | class Solution:
def kth_factor(self, n: int, k: int) -> int:
s1 = set()
s2 = set()
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
s1.add(i)
s2.add(int(n / i))
l = list(s1 | s2)
l.sort()
if k > len(l):
retu... |
__title__ = 'The Onion Box'
__description__ = 'Dashboard to monitor Tor node operations.'
__version__ = '20.2'
__stamp__ = '20200119|095654'
| __title__ = 'The Onion Box'
__description__ = 'Dashboard to monitor Tor node operations.'
__version__ = '20.2'
__stamp__ = '20200119|095654' |
# This is the word list from where the answers for the hangman game will come from.
word_list = [
2015,
"Fred Swaniker",
"Rwanda and Mauritius",
2,
"Dr, Gaidi Faraj",
"Sila Ogidi",
"Madagascar",
94,
8,
"Mauritius"
]
# Here we are defining the variables 'Right'(for ... | word_list = [2015, 'Fred Swaniker', 'Rwanda and Mauritius', 2, 'Dr, Gaidi Faraj', 'Sila Ogidi', 'Madagascar', 94, 8, 'Mauritius']
right = 0
tries = 0
def greet(name):
print('Hello ' + name + ' welcome to hangman and good luck!')
user_name = input('What is your name?')
greet(user_name)
def alu(guess):
if guess... |
OS_MA_NFVO_IP = '192.168.1.197'
OS_USER_DOMAIN_NAME = 'Default'
OS_USERNAME = 'admin'
OS_PASSWORD = '0000'
OS_PROJECT_DOMAIN_NAME = 'Default'
OS_PROJECT_NAME = 'admin' | os_ma_nfvo_ip = '192.168.1.197'
os_user_domain_name = 'Default'
os_username = 'admin'
os_password = '0000'
os_project_domain_name = 'Default'
os_project_name = 'admin' |
class Solution:
def findDisappearedNumbers(self, nums: List[int]) -> List[int]:
if len(nums) < 1:
raise Exception("Invalid Array")
n = len(nums)
res = []
s = set()
for x in nums:
s.add(x)
for i in range(1, n + 1):
if i not in s:
... | class Solution:
def find_disappeared_numbers(self, nums: List[int]) -> List[int]:
if len(nums) < 1:
raise exception('Invalid Array')
n = len(nums)
res = []
s = set()
for x in nums:
s.add(x)
for i in range(1, n + 1):
if i not in s:
... |
'''
03 - Multiple arguments
In the previous exercise, the square brackets around imag in the documentation showed us that the
imag argument is optional. But Python also uses a different way to tell users about arguments being
optional.
Have a look at the documentation of sorted() by typing help(sorted) in the IPython... | """
03 - Multiple arguments
In the previous exercise, the square brackets around imag in the documentation showed us that the
imag argument is optional. But Python also uses a different way to tell users about arguments being
optional.
Have a look at the documentation of sorted() by typing help(sorted) in the IPython... |
parameters = {}
genome = {}
genome_stats = {}
genome_test_stats = []
brain = {}
cortical_list = []
cortical_map = {}
intercortical_mapping = []
block_dic = {}
upstream_neurons = {}
memory_list = {}
activity_stats = {}
temp_neuron_list = []
original_genome_id = []
fire_list = []
termination_flag = False
variation_counte... | parameters = {}
genome = {}
genome_stats = {}
genome_test_stats = []
brain = {}
cortical_list = []
cortical_map = {}
intercortical_mapping = []
block_dic = {}
upstream_neurons = {}
memory_list = {}
activity_stats = {}
temp_neuron_list = []
original_genome_id = []
fire_list = []
termination_flag = False
variation_counte... |
# --------------
# Code starts here
class_1 = ['Geoffrey Hinton' , 'Andrew Ng' , 'Sebastian Raschka' , 'Yoshua Bengio']
class_2 = ['Hilary Mason' , 'Carla Gentry' , 'Corinna Cortes']
new_class = class_1 + class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
del new_class[5]
print(new_class)
# Code... | class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio']
class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes']
new_class = class_1 + class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
del new_class[5]
print(new_class)
courses = {'Math': 65, 'English': 70, 'History'... |
n = int(input().strip())
items = [
int(A_temp)
for A_temp
in input().strip().split(' ')
]
items_map = {}
result = None
for i, item in enumerate(items):
if item not in items_map:
items_map[item] = [i]
else:
items_map[item].append(i)
for _, item_indexes in items_map.items():
it... | n = int(input().strip())
items = [int(A_temp) for a_temp in input().strip().split(' ')]
items_map = {}
result = None
for (i, item) in enumerate(items):
if item not in items_map:
items_map[item] = [i]
else:
items_map[item].append(i)
for (_, item_indexes) in items_map.items():
items_indexes_le... |
def compareMetaboliteDicts(d1, d2):
sorted_d1_keys = sorted(d1.keys())
sorted_d2_keys = sorted(d2.keys())
for i in range(len(sorted_d1_keys)):
if not compareMetabolites(sorted_d1_keys[i], sorted_d2_keys[i], naive=True):
return False
elif not d1[sorted_d1_keys[i]] == d2[sorted_... | def compare_metabolite_dicts(d1, d2):
sorted_d1_keys = sorted(d1.keys())
sorted_d2_keys = sorted(d2.keys())
for i in range(len(sorted_d1_keys)):
if not compare_metabolites(sorted_d1_keys[i], sorted_d2_keys[i], naive=True):
return False
elif not d1[sorted_d1_keys[i]] == d2[sorted_... |
problem_type = "segmentation"
dataset_name = "synthia_rand_cityscapes"
dataset_name2 = None
perc_mb2 = None
model_name = "resnetFCN"
freeze_layers_from = None
show_model = False
load_imageNet = True
load_pretrained = False
weights_file = "weights.hdf5"
train_model = True
test_model = True
pred_model = False
debug = Tru... | problem_type = 'segmentation'
dataset_name = 'synthia_rand_cityscapes'
dataset_name2 = None
perc_mb2 = None
model_name = 'resnetFCN'
freeze_layers_from = None
show_model = False
load_image_net = True
load_pretrained = False
weights_file = 'weights.hdf5'
train_model = True
test_model = True
pred_model = False
debug = Tr... |
{
"targets": [
{
"target_name": "cclust",
"sources": [ "./src/heatmap_clustering_js_module.cpp" ],
'dependencies': ['bonsaiclust']
},
{
'target_name': 'bonsaiclust',
'type': 'static_library',
'sources': [ 'src/cluster.c' ],
'cflags': ['-fPIC', '-I', '-pedantic', '... | {'targets': [{'target_name': 'cclust', 'sources': ['./src/heatmap_clustering_js_module.cpp'], 'dependencies': ['bonsaiclust']}, {'target_name': 'bonsaiclust', 'type': 'static_library', 'sources': ['src/cluster.c'], 'cflags': ['-fPIC', '-I', '-pedantic', '-Wall']}]} |
#!/usr/bin/env python3.8
table="".maketrans("0123456789","\N{Devanagari digit zero}\N{Devanagari digit one}"
"\N{Devanagari digit two}\N{Devanagari digit three}"
"\N{Devanagari digit four}\N{Devanagari digit five}"
"\N{Devanagari digit six}\N{Devanagari digit seven}"
"\N{Devanagari digit eight}\N{Devanagari digit nine... | table = ''.maketrans('0123456789', '०१२३४५६७८९')
print('0123456789'.translate(table)) |
__author__ = 'Riccardo Frigerio'
'''
Oggetto HOST
Attributi:
- mac_address: indirizzo MAC
- port: porta a cui e' collegato
- dpid: switch a cui e' collegato
'''
class Host(object):
def __init__(self, mac_address, port, dpid):
self.mac_address = mac_address
self.port = port
self.dpid = dpi... | __author__ = 'Riccardo Frigerio'
"\nOggetto HOST\nAttributi:\n- mac_address: indirizzo MAC\n- port: porta a cui e' collegato\n- dpid: switch a cui e' collegato\n"
class Host(object):
def __init__(self, mac_address, port, dpid):
self.mac_address = mac_address
self.port = port
self.dpid = dp... |
# nested loops = The "inner loop" will finish all of it's iterations before
# finishing one iteration of the "outer loop"
rows = int(input("How many rows?: "))
columns = int(input("How many columns?: "))
symbol = input("Enter a symbol to use: ")
#symbol = int(input("Enter a symbol to use: "))
for i in... | rows = int(input('How many rows?: '))
columns = int(input('How many columns?: '))
symbol = input('Enter a symbol to use: ')
for i in range(rows):
for j in range(columns):
print(symbol, end='')
print() |
_base_ = [
'../_base_/models/retinanet_r50_fpn.py',
'../_base_/datasets/coco_detection.py', '../_base_/default_runtime.py'
]
cudnn_benchmark = True
norm_cfg = dict(type='BN', requires_grad=True)
checkpoint = 'https://download.openmmlab.com/mmclassification/v0/efficientnet/efficientnet-b3_3rdparty_8xb32-aa_in1k... | _base_ = ['../_base_/models/retinanet_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/default_runtime.py']
cudnn_benchmark = True
norm_cfg = dict(type='BN', requires_grad=True)
checkpoint = 'https://download.openmmlab.com/mmclassification/v0/efficientnet/efficientnet-b3_3rdparty_8xb32-aa_in1k_20220119-5... |
'''
1. Write a Python program to access a specific item in a singly linked list using index value.
2. Write a Python program to set a new value of an item in a singly linked list using index value.
3. Write a Python program to delete the first item from a singly linked list.
'''
| """
1. Write a Python program to access a specific item in a singly linked list using index value.
2. Write a Python program to set a new value of an item in a singly linked list using index value.
3. Write a Python program to delete the first item from a singly linked list.
""" |
class Node:
left = right = None
def __init__(self, data):
self.data = data
def inorder(root):
if root is None:
return
inorder(root.left)
print(root.data, end=' ')
inorder(root.right)
def insert(root, key):
if root is None:
return Node(key)
if key < root.data:
... | class Node:
left = right = None
def __init__(self, data):
self.data = data
def inorder(root):
if root is None:
return
inorder(root.left)
print(root.data, end=' ')
inorder(root.right)
def insert(root, key):
if root is None:
return node(key)
if key < root.data:
... |
def something() -> None:
print("Andrew says: `something`.")
| def something() -> None:
print('Andrew says: `something`.') |
blacklist=set()
def get_blacklist():
return blacklist
def add_to_blacklist(jti):
return blacklist.add(jti)
| blacklist = set()
def get_blacklist():
return blacklist
def add_to_blacklist(jti):
return blacklist.add(jti) |
#unit
#mydict.py
class Dict(dict):
def __init__(self,**kw):
super(Dict,self).__init__(**kw)
def __getattr__(self,key):
try:
return self[key]
except KeyError:
raise AttributeError(r"'Dict' object han no attribute'%s'" %key)
def __setattr__(self,key,value):
self[key]=value
| class Dict(dict):
def __init__(self, **kw):
super(Dict, self).__init__(**kw)
def __getattr__(self, key):
try:
return self[key]
except KeyError:
raise attribute_error("'Dict' object han no attribute'%s'" % key)
def __setattr__(self, key, value):
self... |
#
# This is Seisflows
#
# See LICENCE file
#
###############################################################################
raise NotImplementedError
| raise NotImplementedError |
#Integer division
#You have a shop selling buns for $2.40 each. A customer comes in with $15, and would like to buy as many buns as possible.
#Complete the code to calculate how many buns the customer can afford.
#Note: Your customer won't be happy if you try to sell them part of a bun.
#Print only the result, any o... | bun_price = 2.4
money = 15
print(money // bun_price) |
# An algorithm to reconstruct the queue.
# Suppose you have a random list of people standing in a queue.
# Each person is described by a pair of integers (h,k), where h is the height of the person and k is the number of people in front of this person who have a height greater than or equal to h.
class Solution:
de... | class Solution:
def reconstruct_queue(self, people: List[List[int]]) -> List[List[int]]:
people = sorted(people, key=lambda x: (-x[0], x[1]))
ans = []
for pep in people:
ans.insert(pep[1], pep)
return ans |
# statements that used at the start of defenition or in statements without columns
defenition_statements = {
"DROP": "DROP",
"CREATE": "CREATE",
"TABLE": "TABLE",
"DATABASE": "DATABASE",
"SCHEMA": "SCHEMA",
"ALTER": "ALTER",
"TYPE": "TYPE",
"DOMAIN": "DOMAIN",
"REPLACE": "REPLACE",
... | defenition_statements = {'DROP': 'DROP', 'CREATE': 'CREATE', 'TABLE': 'TABLE', 'DATABASE': 'DATABASE', 'SCHEMA': 'SCHEMA', 'ALTER': 'ALTER', 'TYPE': 'TYPE', 'DOMAIN': 'DOMAIN', 'REPLACE': 'REPLACE', 'OR': 'OR', 'CLUSTERED': 'CLUSTERED', 'SEQUENCE': 'SEQUENCE', 'TABLESPACE': 'TABLESPACE'}
common_statements = {'INDEX': '... |
def kmp(P, T):
# Compute the start position (number of chars) of the longest suffix that matches a prefix,
# and store them into list K, the first element of K is set to be -1, the second
#
K = [] # K[t] store the value that when mismatch happens at t, should move Pattern P K[t] characters ahead
t ... | def kmp(P, T):
k = []
t = -1
K.append(t)
for k in range(1, len(P) + 1):
while t >= 0 and P[t] != P[k - 1]:
t = K[t]
t = t + 1
K.append(t)
print(K)
m = 0
for i in range(0, len(T)):
while m >= 0 and P[m] != T[i]:
m = K[m]
m = m + ... |
class _FuncStorage:
def __init__(self):
self._function_map = {}
def insert_function(self, name, function):
self._function_map[name] = function
def get_all_functions(self):
return self._function_map
| class _Funcstorage:
def __init__(self):
self._function_map = {}
def insert_function(self, name, function):
self._function_map[name] = function
def get_all_functions(self):
return self._function_map |
A=int(input("dame int"))
B=int(input("dame int"))
if(A>B):
print("A es mayor")
else:
print("B es mayor")
| a = int(input('dame int'))
b = int(input('dame int'))
if A > B:
print('A es mayor')
else:
print('B es mayor') |
# !/usr/bin/env python3
# Author: C.K
# Email: theck17@163.com
# DateTime:2021-03-15 00:07:14
# Description:
class Solution:
def threeSum(self, nums: List[int]) -> List[List[int]]:
result = set()
for i in range(0, len(nums) - 1):
# Reduce the problem to two sum(0)
two_sum =... | class Solution:
def three_sum(self, nums: List[int]) -> List[List[int]]:
result = set()
for i in range(0, len(nums) - 1):
two_sum = -nums[i]
cache = set()
for num in nums[i + 1:]:
remaining = two_sum - num
if remaining in cache:
... |
bluelabs_format_hints = {
'field-delimiter': ',',
'record-terminator': "\n",
'compression': 'GZIP',
'quoting': None,
'quotechar': '"',
'doublequote': False,
'escape': '\\',
'encoding': 'UTF8',
'dateformat': 'YYYY-MM-DD',
'timeonlyformat': 'HH24:MI:SS',
'datetimeformattz': 'YY... | bluelabs_format_hints = {'field-delimiter': ',', 'record-terminator': '\n', 'compression': 'GZIP', 'quoting': None, 'quotechar': '"', 'doublequote': False, 'escape': '\\', 'encoding': 'UTF8', 'dateformat': 'YYYY-MM-DD', 'timeonlyformat': 'HH24:MI:SS', 'datetimeformattz': 'YYYY-MM-DD HH:MI:SSOF', 'datetimeformat': 'YYYY... |
# FROM THE OP PAPER-ISH
MINI_BATCH_SIZE = 32
MEMORY_SIZE = 10**6
BUFFER_SIZE = 100
LHIST = 4
GAMMA = 0.99
UPDATE_FREQ_ONlINE = 4
UPDATE_TARGET = 2500 # This was 10**4 but is measured in actor steps, so it's divided update_freq_online
TEST_FREQ = 5*10**4 # Measure in updates
TEST_STEPS = 10**4
LEARNING_RATE = 0.00025
G_... | mini_batch_size = 32
memory_size = 10 ** 6
buffer_size = 100
lhist = 4
gamma = 0.99
update_freq_o_nl_ine = 4
update_target = 2500
test_freq = 5 * 10 ** 4
test_steps = 10 ** 4
learning_rate = 0.00025
g_momentum = 0.95
epsilon_init = 1.0
epsilon_final = 0.1
epsilon_test = 0.05
epsilon_life = 10 ** 6
replay_start = 5 * 10... |
# author: jamie
# email: jinjiedeng.jjd@gmail.com
def Priority (c):
if c == '&': return 3
elif c == '|': return 2
elif c == '^': return 1
elif c == '(': return 0
def InfixToPostfix (infix, postfix):
stack = []
for c in infix:
if c == '(':
stack.append('(')
elif c =... | def priority(c):
if c == '&':
return 3
elif c == '|':
return 2
elif c == '^':
return 1
elif c == '(':
return 0
def infix_to_postfix(infix, postfix):
stack = []
for c in infix:
if c == '(':
stack.append('(')
elif c == ')':
w... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.