content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Observable:
def __init__(self):
self.result = None
def callback(self, result):
self.result = result
def format_response(self):
results = []
for d in self.result.search.docs:
for idx, match in enumerate(d.matches):
score = match.score.value
if score <= 0.0:
continue
results.append(
{"match": match.text,
"id": match.parent_id,
"start": match.location[0],
"end": match.location[1],
"score": float(match.score.value)})
results = sorted(results, key=lambda x: x["score"])
return results
| class Observable:
def __init__(self):
self.result = None
def callback(self, result):
self.result = result
def format_response(self):
results = []
for d in self.result.search.docs:
for (idx, match) in enumerate(d.matches):
score = match.score.value
if score <= 0.0:
continue
results.append({'match': match.text, 'id': match.parent_id, 'start': match.location[0], 'end': match.location[1], 'score': float(match.score.value)})
results = sorted(results, key=lambda x: x['score'])
return results |
# Copyright 2014 Doug Latornell and The University of British Columbia
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Python packaging metadata for ECget.
"""
__all__ = [
'PROJECT', 'DESCRIPTION', 'VERSION', 'DEV_STATUS',
]
PROJECT = 'ECget'
DESCRIPTION = 'Get Environment Canada Weather & Hydrometric Data'
VERSION = '0.5'
DEV_STATUS = '4 - Beta'
| """Python packaging metadata for ECget.
"""
__all__ = ['PROJECT', 'DESCRIPTION', 'VERSION', 'DEV_STATUS']
project = 'ECget'
description = 'Get Environment Canada Weather & Hydrometric Data'
version = '0.5'
dev_status = '4 - Beta' |
# -*- coding: UTF-8 -*-
logger.info("Loading 1 objects to table notes_eventtype...")
# fields: id, name, remark, body
loader.save(create_notes_eventtype(1,['System note', 'System note', 'System note'],u'',['', '', '']))
loader.flush_deferred_objects()
| logger.info('Loading 1 objects to table notes_eventtype...')
loader.save(create_notes_eventtype(1, ['System note', 'System note', 'System note'], u'', ['', '', '']))
loader.flush_deferred_objects() |
expected_output = {
"bridge_domain": {
3051: {
"number_of_ports_in_all": 2,
"state": "UP",
"member_ports": [
"vfi VPLS-3051 neighbor 192.168.36.220 3051",
"GigabitEthernet0/0/3 service instance 3051",
],
"mac_table": {
"GigabitEthernet0/0/3.EFP3051": {
"pseudoport": "GigabitEthernet0/0/3.EFP3051",
"mac_address": {
"0000.A0FF.0118": {
"tag": "dynamic",
"age": 3441,
"aed": 0,
"mac_address": "0000.A0FF.0118",
"policy": "forward",
},
"0000.A0FF.0077": {
"tag": "dynamic",
"age": 3426,
"aed": 0,
"mac_address": "0000.A0FF.0077",
"policy": "forward",
},
"0000.A0FF.011C": {
"tag": "dynamic",
"age": 3442,
"aed": 0,
"mac_address": "0000.A0FF.011C",
"policy": "forward",
},
"0000.A0FF.001F": {
"tag": "dynamic",
"age": 3416,
"aed": 0,
"mac_address": "0000.A0FF.001F",
"policy": "forward",
},
"0000.A0FF.0068": {
"tag": "dynamic",
"age": 3424,
"aed": 0,
"mac_address": "0000.A0FF.0068",
"policy": "forward",
},
"0000.A0FF.00C5": {
"tag": "dynamic",
"age": 3433,
"aed": 0,
"mac_address": "0000.A0FF.00C5",
"policy": "forward",
},
"0000.A0FF.0108": {
"tag": "dynamic",
"age": 3440,
"aed": 0,
"mac_address": "0000.A0FF.0108",
"policy": "forward",
},
"0000.A0FF.0010": {
"tag": "dynamic",
"age": 3415,
"aed": 0,
"mac_address": "0000.A0FF.0010",
"policy": "forward",
},
"0000.A0FF.000F": {
"tag": "dynamic",
"age": 3415,
"aed": 0,
"mac_address": "0000.A0FF.000F",
"policy": "forward",
},
"0000.A0FF.007F": {
"tag": "dynamic",
"age": 3426,
"aed": 0,
"mac_address": "0000.A0FF.007F",
"policy": "forward",
},
"0000.A0FF.007B": {
"tag": "dynamic",
"age": 3426,
"aed": 0,
"mac_address": "0000.A0FF.007B",
"policy": "forward",
},
"0000.A0FF.0087": {
"tag": "dynamic",
"age": 3427,
"aed": 0,
"mac_address": "0000.A0FF.0087",
"policy": "forward",
},
"0000.A0FF.00AA": {
"tag": "dynamic",
"age": 3430,
"aed": 0,
"mac_address": "0000.A0FF.00AA",
"policy": "forward",
},
"0000.A0FF.012C": {
"tag": "dynamic",
"age": 3443,
"aed": 0,
"mac_address": "0000.A0FF.012C",
"policy": "forward",
},
"0000.A0FF.00D0": {
"tag": "dynamic",
"age": 3434,
"aed": 0,
"mac_address": "0000.A0FF.00D0",
"policy": "forward",
},
"0000.A0FF.00F6": {
"tag": "dynamic",
"age": 3438,
"aed": 0,
"mac_address": "0000.A0FF.00F6",
"policy": "forward",
},
"0000.A0FF.00F7": {
"tag": "dynamic",
"age": 3438,
"aed": 0,
"mac_address": "0000.A0FF.00F7",
"policy": "forward",
},
"0000.A0FF.00F2": {
"tag": "dynamic",
"age": 3438,
"aed": 0,
"mac_address": "0000.A0FF.00F2",
"policy": "forward",
},
"0000.A0FF.0129": {
"tag": "dynamic",
"age": 3443,
"aed": 0,
"mac_address": "0000.A0FF.0129",
"policy": "forward",
},
},
}
},
"aging_timer": 3600,
"bd_domain_id": 3051,
"split-horizon_group": {
"0": {
"num_of_ports": "1",
"interfaces": ["GigabitEthernet0/0/3 service instance 3051"],
}
},
"mac_learning_state": "Enabled",
}
}
}
| expected_output = {'bridge_domain': {3051: {'number_of_ports_in_all': 2, 'state': 'UP', 'member_ports': ['vfi VPLS-3051 neighbor 192.168.36.220 3051', 'GigabitEthernet0/0/3 service instance 3051'], 'mac_table': {'GigabitEthernet0/0/3.EFP3051': {'pseudoport': 'GigabitEthernet0/0/3.EFP3051', 'mac_address': {'0000.A0FF.0118': {'tag': 'dynamic', 'age': 3441, 'aed': 0, 'mac_address': '0000.A0FF.0118', 'policy': 'forward'}, '0000.A0FF.0077': {'tag': 'dynamic', 'age': 3426, 'aed': 0, 'mac_address': '0000.A0FF.0077', 'policy': 'forward'}, '0000.A0FF.011C': {'tag': 'dynamic', 'age': 3442, 'aed': 0, 'mac_address': '0000.A0FF.011C', 'policy': 'forward'}, '0000.A0FF.001F': {'tag': 'dynamic', 'age': 3416, 'aed': 0, 'mac_address': '0000.A0FF.001F', 'policy': 'forward'}, '0000.A0FF.0068': {'tag': 'dynamic', 'age': 3424, 'aed': 0, 'mac_address': '0000.A0FF.0068', 'policy': 'forward'}, '0000.A0FF.00C5': {'tag': 'dynamic', 'age': 3433, 'aed': 0, 'mac_address': '0000.A0FF.00C5', 'policy': 'forward'}, '0000.A0FF.0108': {'tag': 'dynamic', 'age': 3440, 'aed': 0, 'mac_address': '0000.A0FF.0108', 'policy': 'forward'}, '0000.A0FF.0010': {'tag': 'dynamic', 'age': 3415, 'aed': 0, 'mac_address': '0000.A0FF.0010', 'policy': 'forward'}, '0000.A0FF.000F': {'tag': 'dynamic', 'age': 3415, 'aed': 0, 'mac_address': '0000.A0FF.000F', 'policy': 'forward'}, '0000.A0FF.007F': {'tag': 'dynamic', 'age': 3426, 'aed': 0, 'mac_address': '0000.A0FF.007F', 'policy': 'forward'}, '0000.A0FF.007B': {'tag': 'dynamic', 'age': 3426, 'aed': 0, 'mac_address': '0000.A0FF.007B', 'policy': 'forward'}, '0000.A0FF.0087': {'tag': 'dynamic', 'age': 3427, 'aed': 0, 'mac_address': '0000.A0FF.0087', 'policy': 'forward'}, '0000.A0FF.00AA': {'tag': 'dynamic', 'age': 3430, 'aed': 0, 'mac_address': '0000.A0FF.00AA', 'policy': 'forward'}, '0000.A0FF.012C': {'tag': 'dynamic', 'age': 3443, 'aed': 0, 'mac_address': '0000.A0FF.012C', 'policy': 'forward'}, '0000.A0FF.00D0': {'tag': 'dynamic', 'age': 3434, 'aed': 0, 'mac_address': '0000.A0FF.00D0', 'policy': 'forward'}, '0000.A0FF.00F6': {'tag': 'dynamic', 'age': 3438, 'aed': 0, 'mac_address': '0000.A0FF.00F6', 'policy': 'forward'}, '0000.A0FF.00F7': {'tag': 'dynamic', 'age': 3438, 'aed': 0, 'mac_address': '0000.A0FF.00F7', 'policy': 'forward'}, '0000.A0FF.00F2': {'tag': 'dynamic', 'age': 3438, 'aed': 0, 'mac_address': '0000.A0FF.00F2', 'policy': 'forward'}, '0000.A0FF.0129': {'tag': 'dynamic', 'age': 3443, 'aed': 0, 'mac_address': '0000.A0FF.0129', 'policy': 'forward'}}}}, 'aging_timer': 3600, 'bd_domain_id': 3051, 'split-horizon_group': {'0': {'num_of_ports': '1', 'interfaces': ['GigabitEthernet0/0/3 service instance 3051']}}, 'mac_learning_state': 'Enabled'}}} |
# -*- coding: utf-8 -*-
"""
overholt
~~~~~~~~
overholt application package
"""
| """
overholt
~~~~~~~~
overholt application package
""" |
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'duplicate_names',
'type': 'shared_library',
'dependencies': [
'one/sub.gyp:one',
'two/sub.gyp:two',
],
},
],
}
| {'targets': [{'target_name': 'duplicate_names', 'type': 'shared_library', 'dependencies': ['one/sub.gyp:one', 'two/sub.gyp:two']}]} |
class FinnHubAPI:
TOKEN="yourTokenHere"
# Get a FinHubb API from
# https://finnhub.io/ | class Finnhubapi:
token = 'yourTokenHere' |
"""
Config for Reddit Giveaway
I need some configuration, so that the script itself is more reusable.
"""
SUBMISSION = '40idxl'
MATCH_TEXT = 'I would build'
| """
Config for Reddit Giveaway
I need some configuration, so that the script itself is more reusable.
"""
submission = '40idxl'
match_text = 'I would build' |
B = BLOCK_SIZE = 30
SURFACE_WIDTH = 300
SURFACE_HEIGHT = 600
S = [['.....',
'.....',
'..00.',
'.00..',
'.....'],
['.....',
'..0..',
'..00.',
'...0.',
'.....' ]]
Z = [['.....',
'.....',
'.00..',
'..00.',
'.....'],
['.....',
'..,0.',
'..00.',
'..0..',
'.....' ]]
I = [['.....',
'..0..',
'..0..',
'..0..',
'.....'],
['.....',
'.....',
'.000.',
'.....',
'.....' ]]
O = [['.....',
'.....',
'.00..',
'.00..',
'.....']]
J = [['.....',
'.....',
'.0...',
'.000.',
'.....'],
['.....',
'..00.',
'..0..',
'..0..',
'.....' ],
['.....',
'.000.',
'...0.',
'.....',
'.....' ],
['.....',
'..0..',
'..0..',
'.00..',
'.....' ],]
L = [['.....',
'...0.',
'.000.',
'.....',
'.....'],
['.....',
'..0..',
'..0..',
'..00.',
'.....'],
['.....',
'.....',
'.000.',
'.0...',
'.....'],
['.....',
'.00..',
'..0..',
'..0..',
'.....']]
T = [['.....',
'..0..',
'.000.',
'.....',
'.....'],
['.....',
'..0..',
'..00.',
'..0..',
'.....'],
['.....',
'.....',
'.000.',
'..0..',
'.....'],
['.....',
'..0..',
'.00..',
'..0..',
'.....']]
SHAPES = [S, Z, I, O, L, T]
# red green blue pink gray orange
SHAPES_FILL = ['#f44336', '#4CAF50', '#2196F3', '#F50057', '#607D8B', '#FF9800']
| b = block_size = 30
surface_width = 300
surface_height = 600
s = [['.....', '.....', '..00.', '.00..', '.....'], ['.....', '..0..', '..00.', '...0.', '.....']]
z = [['.....', '.....', '.00..', '..00.', '.....'], ['.....', '..,0.', '..00.', '..0..', '.....']]
i = [['.....', '..0..', '..0..', '..0..', '.....'], ['.....', '.....', '.000.', '.....', '.....']]
o = [['.....', '.....', '.00..', '.00..', '.....']]
j = [['.....', '.....', '.0...', '.000.', '.....'], ['.....', '..00.', '..0..', '..0..', '.....'], ['.....', '.000.', '...0.', '.....', '.....'], ['.....', '..0..', '..0..', '.00..', '.....']]
l = [['.....', '...0.', '.000.', '.....', '.....'], ['.....', '..0..', '..0..', '..00.', '.....'], ['.....', '.....', '.000.', '.0...', '.....'], ['.....', '.00..', '..0..', '..0..', '.....']]
t = [['.....', '..0..', '.000.', '.....', '.....'], ['.....', '..0..', '..00.', '..0..', '.....'], ['.....', '.....', '.000.', '..0..', '.....'], ['.....', '..0..', '.00..', '..0..', '.....']]
shapes = [S, Z, I, O, L, T]
shapes_fill = ['#f44336', '#4CAF50', '#2196F3', '#F50057', '#607D8B', '#FF9800'] |
lista = ('Lapis', 1.5, 'caneta', 2.5, 'caderno', 16.90, 'mochila', 67.99, 'livro', 37.89)
print('-'*40)
print(f'{"LISTA ESCOLAR":^40}')
print('-'*40)
for c in range(0, len(lista)):
if c % 2 == 0:
print(f'{lista[c]:.<30}', end=' ')
else:
print(f'R$ {lista[c]:.2f}')
print('-'*40)
| lista = ('Lapis', 1.5, 'caneta', 2.5, 'caderno', 16.9, 'mochila', 67.99, 'livro', 37.89)
print('-' * 40)
print(f"{'LISTA ESCOLAR':^40}")
print('-' * 40)
for c in range(0, len(lista)):
if c % 2 == 0:
print(f'{lista[c]:.<30}', end=' ')
else:
print(f'R$ {lista[c]:.2f}')
print('-' * 40) |
class WindowDatas():
def __init__(self):
self.previousWindow = None
self.nextWindow = None
self.finalWindow = None
self.accountDATA = None
self.actions= None
self.show= True
self.database = None | class Windowdatas:
def __init__(self):
self.previousWindow = None
self.nextWindow = None
self.finalWindow = None
self.accountDATA = None
self.actions = None
self.show = True
self.database = None |
# Flask Config Variables to be Auto-Loaded
config = {
'flask': {
'SECRET_KEY': b'!T3DxK;L1jJGYf$', # Please change. See Flask for requirements.
'TESTING': True,
'TEMPLATES_AUTO_RELOAD': True,
'SERVER_NAME': 'flask.mvc'
},
'templating': {
'template_folder': 'application/views',
'static_folder': 'public/assets'
}
}
| config = {'flask': {'SECRET_KEY': b'!T3DxK;L1jJGYf$', 'TESTING': True, 'TEMPLATES_AUTO_RELOAD': True, 'SERVER_NAME': 'flask.mvc'}, 'templating': {'template_folder': 'application/views', 'static_folder': 'public/assets'}} |
class FVTADD :
def __init__(self):
self.default = ''
def runTest(self,self) :
return TemplateTest.runTest(self)
def tearDown(self,self) :
return TemplateTest.tearDown(self)
def setUp(self,self) :
return TemplateTest.setUp(self)
def chkSetUpCondition(self,self,fv,sv_ret,ctl_ret,sw_ret) :
return TemplateTest.chkSetUpCondition(self,fv,sv_ret,ctl_ret,sw_ret)
| class Fvtadd:
def __init__(self):
self.default = ''
def run_test(self, self):
return TemplateTest.runTest(self)
def tear_down(self, self):
return TemplateTest.tearDown(self)
def set_up(self, self):
return TemplateTest.setUp(self)
def chk_set_up_condition(self, self, fv, sv_ret, ctl_ret, sw_ret):
return TemplateTest.chkSetUpCondition(self, fv, sv_ret, ctl_ret, sw_ret) |
class ITopBanner(Interface):
"""marker interface for Front Page"""
class IThemeSpecific(Interface):
"""marker interface for theme layer""" | class Itopbanner(Interface):
"""marker interface for Front Page"""
class Ithemespecific(Interface):
"""marker interface for theme layer""" |
#Your task is to complete this function
# function should strictly return a string else answer wont be printed
def multiplyStrings(str1, str2):
return str(int(str1) * int(str2))
| def multiply_strings(str1, str2):
return str(int(str1) * int(str2)) |
#!/usr/bin/env python
#
# Copyright (c) 2015 Pavel Lazar pavel.lazar (at) gmail.com
#
# The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED.
#####################################################################
class EngineClientError(Exception):
"""
An exception in the EE client.
"""
pass | class Engineclienterror(Exception):
"""
An exception in the EE client.
"""
pass |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# Prefixes
CONSOLE_LOG_PREFIX = "LanguageWorkerConsoleLog"
# Capabilities
RAW_HTTP_BODY_BYTES = "RawHttpBodyBytes"
TYPED_DATA_COLLECTION = "TypedDataCollection"
RPC_HTTP_BODY_ONLY = "RpcHttpBodyOnly"
RPC_HTTP_TRIGGER_METADATA_REMOVED = "RpcHttpTriggerMetadataRemoved"
# Debug Flags
PYAZURE_WEBHOST_DEBUG = "PYAZURE_WEBHOST_DEBUG"
# Feature Flags (app settings)
PYTHON_ROLLBACK_CWD_PATH = "PYTHON_ROLLBACK_CWD_PATH"
# External Site URLs
MODULE_NOT_FOUND_TS_URL = "https://aka.ms/functions-modulenotfound"
| console_log_prefix = 'LanguageWorkerConsoleLog'
raw_http_body_bytes = 'RawHttpBodyBytes'
typed_data_collection = 'TypedDataCollection'
rpc_http_body_only = 'RpcHttpBodyOnly'
rpc_http_trigger_metadata_removed = 'RpcHttpTriggerMetadataRemoved'
pyazure_webhost_debug = 'PYAZURE_WEBHOST_DEBUG'
python_rollback_cwd_path = 'PYTHON_ROLLBACK_CWD_PATH'
module_not_found_ts_url = 'https://aka.ms/functions-modulenotfound' |
n = int(input())
res = 0
for i in range(n):
res += int((input().strip())[:25])
print(str(res)[:10])
| n = int(input())
res = 0
for i in range(n):
res += int(input().strip()[:25])
print(str(res)[:10]) |
class Solution:
def numDecodings(self, s: str) -> int:
if not s or s[0] == '0': return 0
dp = [1, 1]
for i in range(2, len(s) + 1):
if '10' < s[i - 2: i] <= '26' and s[i - 1] != '0':
dp.append(dp[i - 1] + dp[i - 2])
elif s[i - 2: i] == '10' or s[i - 2: i] == '20':
dp.append(dp[i - 2])
elif s[i - 1] != '0':
dp.append(dp[i - 1])
else:
return 0
return dp[len(s)]
| class Solution:
def num_decodings(self, s: str) -> int:
if not s or s[0] == '0':
return 0
dp = [1, 1]
for i in range(2, len(s) + 1):
if '10' < s[i - 2:i] <= '26' and s[i - 1] != '0':
dp.append(dp[i - 1] + dp[i - 2])
elif s[i - 2:i] == '10' or s[i - 2:i] == '20':
dp.append(dp[i - 2])
elif s[i - 1] != '0':
dp.append(dp[i - 1])
else:
return 0
return dp[len(s)] |
version = "0.1.0" # Application version
class Signal(object):
"""
A "Observer" implementation.
Note: ONLY works with class methods.
Example:
from loremdb.common import Signal
class Observed(object):
def __init__(self):
self.changed = Signal()
self.val = 0
def increment(self):
self.val += 1
self.changed()
class Observer(object):
def __init__(self, observed):
self._observed = observed
self._observed.changed.register(self.change_callback)
def change_callback(self):
print "Signal received... Value now is "
+ str(self._observed.val)
observed = Observed()
observer = Observer(observed)
observed.increment() # Output: "Signal received... Value now is 1"
"""
def __init__(self):
self._slots = {}
def __call__(self, *args, **kwargs):
for key, func in self._slots.iteritems():
func.im_func(func.im_self, *args, **kwargs)
def register(self, slot):
self._slots[self._get_key(slot)] = slot
def unregister(self, slot):
key = self._get_key(slot)
if key in self._slots:
del self._slots[key]
def _get_key(self, slot):
return (slot.im_func, id(slot.im_self)) | version = '0.1.0'
class Signal(object):
"""
A "Observer" implementation.
Note: ONLY works with class methods.
Example:
from loremdb.common import Signal
class Observed(object):
def __init__(self):
self.changed = Signal()
self.val = 0
def increment(self):
self.val += 1
self.changed()
class Observer(object):
def __init__(self, observed):
self._observed = observed
self._observed.changed.register(self.change_callback)
def change_callback(self):
print "Signal received... Value now is "
+ str(self._observed.val)
observed = Observed()
observer = Observer(observed)
observed.increment() # Output: "Signal received... Value now is 1"
"""
def __init__(self):
self._slots = {}
def __call__(self, *args, **kwargs):
for (key, func) in self._slots.iteritems():
func.im_func(func.im_self, *args, **kwargs)
def register(self, slot):
self._slots[self._get_key(slot)] = slot
def unregister(self, slot):
key = self._get_key(slot)
if key in self._slots:
del self._slots[key]
def _get_key(self, slot):
return (slot.im_func, id(slot.im_self)) |
print("Welcome to the birthday dictionary. We know the birthdays of:")
birthdays = {"Albert Einstein": "03/14/1879", "Benjamin Franklin": "01/17/1706", "Ada Lovelace": "12/10/1815"}
for person in birthdays:
print(person)
name = input("Who's birthday do you want to look up? ")
if(name in birthdays):
print(name + "'s birthday is " + birthdays[name] + ".")
else:
print("Sorry, couldn't find that name") | print('Welcome to the birthday dictionary. We know the birthdays of:')
birthdays = {'Albert Einstein': '03/14/1879', 'Benjamin Franklin': '01/17/1706', 'Ada Lovelace': '12/10/1815'}
for person in birthdays:
print(person)
name = input("Who's birthday do you want to look up? ")
if name in birthdays:
print(name + "'s birthday is " + birthdays[name] + '.')
else:
print("Sorry, couldn't find that name") |
JAVA_LANGUAGE_LEVEL = "1.8"
KOTLIN_LANGUAGE_LEVEL = "1.3"
KOTLINC_VERSION = "1.3.41"
KOTLINC_ROOT = "https://github.com/JetBrains/kotlin/releases/download"
KOTLINC_SHA = "c44ab6866895606e408b60934ebe45d4befcbc33ea0e4ea73c4b3b89ad770132"
KOTLIN_RULES_VERSION = "legacy-modded-0_26_1-02"
KOTLIN_RULES_SHA = "245d0bc1511048aaf82afd0fa8a83e8c3b5afdff0ae4fbcae25e03bb2c6f1a1a"
MAVEN_REPOSITORY_RULES_VERSION = "master"
MAVEN_REPOSITORY_RULES_CHECKSUM = None
KOTLINC_RELEASE = {
"urls": [
"{root}/v{v}/kotlin-compiler-{v}.zip".format(root = KOTLINC_ROOT, v = KOTLINC_VERSION),
],
"sha256": KOTLINC_SHA,
}
| java_language_level = '1.8'
kotlin_language_level = '1.3'
kotlinc_version = '1.3.41'
kotlinc_root = 'https://github.com/JetBrains/kotlin/releases/download'
kotlinc_sha = 'c44ab6866895606e408b60934ebe45d4befcbc33ea0e4ea73c4b3b89ad770132'
kotlin_rules_version = 'legacy-modded-0_26_1-02'
kotlin_rules_sha = '245d0bc1511048aaf82afd0fa8a83e8c3b5afdff0ae4fbcae25e03bb2c6f1a1a'
maven_repository_rules_version = 'master'
maven_repository_rules_checksum = None
kotlinc_release = {'urls': ['{root}/v{v}/kotlin-compiler-{v}.zip'.format(root=KOTLINC_ROOT, v=KOTLINC_VERSION)], 'sha256': KOTLINC_SHA} |
"Listing of all e2e tests, used to set up their repositories in /WORKSPACE"
ALL_E2E = [
"bazel_managed_deps",
"fine_grained_symlinks",
"jasmine",
"karma",
"karma_stack_trace",
"karma_typescript",
"less",
"node_loader_no_preserve_symlinks",
"node_loader_preserve_symlinks",
"packages",
"stylus",
"symlinked_node_modules_npm",
"symlinked_node_modules_yarn",
"terser",
"ts_auto_deps",
"ts_devserver",
"typescript",
"webpack",
]
| """Listing of all e2e tests, used to set up their repositories in /WORKSPACE"""
all_e2_e = ['bazel_managed_deps', 'fine_grained_symlinks', 'jasmine', 'karma', 'karma_stack_trace', 'karma_typescript', 'less', 'node_loader_no_preserve_symlinks', 'node_loader_preserve_symlinks', 'packages', 'stylus', 'symlinked_node_modules_npm', 'symlinked_node_modules_yarn', 'terser', 'ts_auto_deps', 'ts_devserver', 'typescript', 'webpack'] |
# Ian McLoughlin
# A program that displays Fibonacci numbers using people's names.
# Exercise executed by Simona Vasiliauskaite
def fib(n):
"""This function returns the nth Fibonacci number."""
i = 0
j = 1
n = n - 1
while n >= 0:
i, j = j, i + j
n = n - 1
return i
name = "Vasiliauskaite"
first = name[0]
last = name[-1]
firstno = ord(first)
lastno = ord(last)
x = firstno + lastno
ans = fib(x)
print("My surname is", name)
print("The first letter", first, "is number", firstno)
print("The last letter", last, "is number", lastno)
print("Fibonacci number", x, "is", ans)
# Following text is the output for exercise 2 above
# My surname is Vasiliauskaite
# The first letter V is number 86
# The last letter e is number 101
# Fibonacci number 187 is 538522340430300790495419781092981030533
# What does ord() mean?
# Like a lot of the students here I didn't know what ord() command meant until I looked it up on Google.
# It makes sense now that all numbers, letters, characters etc have numeric codes and when I looked up the ASCII character set,
# the capital V and lower case e matched the output in visual code.
# Exercise 1 - My name is Simona, so the first and last letter of my name (S + A = 19 + 1) give the number 20.
# The 20th Fibonacci number is 6765.
| def fib(n):
"""This function returns the nth Fibonacci number."""
i = 0
j = 1
n = n - 1
while n >= 0:
(i, j) = (j, i + j)
n = n - 1
return i
name = 'Vasiliauskaite'
first = name[0]
last = name[-1]
firstno = ord(first)
lastno = ord(last)
x = firstno + lastno
ans = fib(x)
print('My surname is', name)
print('The first letter', first, 'is number', firstno)
print('The last letter', last, 'is number', lastno)
print('Fibonacci number', x, 'is', ans) |
# Copyright (c) 2021 Gerald E. Fux
#
# Licensed under the MIT License
"""
This module just defines what version of example_py_package we are currently
looking at.
"""
__version__ = '0.0.1'
| """
This module just defines what version of example_py_package we are currently
looking at.
"""
__version__ = '0.0.1' |
# Time: O(nlogn)
# Space: O(1)
class Solution(object):
def videoStitching(self, clips, T):
"""
:type clips: List[List[int]]
:type T: int
:rtype: int
"""
if T == 0:
return 0
result = 1
curr_reachable, reachable = 0, 0
clips.sort()
for left, right in clips:
if left > reachable:
break
elif left > curr_reachable:
curr_reachable = reachable
result += 1
reachable = max(reachable, right)
if reachable >= T:
return result
return -1
| class Solution(object):
def video_stitching(self, clips, T):
"""
:type clips: List[List[int]]
:type T: int
:rtype: int
"""
if T == 0:
return 0
result = 1
(curr_reachable, reachable) = (0, 0)
clips.sort()
for (left, right) in clips:
if left > reachable:
break
elif left > curr_reachable:
curr_reachable = reachable
result += 1
reachable = max(reachable, right)
if reachable >= T:
return result
return -1 |
base_api = "https://myanimelist.net/"
#Anime
anime = base_api + "api/animelist/"
search_anime = base_api + "api/anime/search.xml"
add_anime = anime + "add/{}.xml"
update_anime = anime + "update/{}.xml"
delete_anime = anime + "delete/{}.xml"
#Manga
manga = base_api + "api/mangalist/"
search_manga = base_api + "api/manga/search.xml"
add_manga = manga + "add/{}.xml"
update_manga = manga + "update/{}.xml"
delete_manga = manga + "delete/{}.xml"
#User Account
verify_user = base_api + "api/account/verify_credentials.xml"
user_list = base_api + "malappinfo.php" | base_api = 'https://myanimelist.net/'
anime = base_api + 'api/animelist/'
search_anime = base_api + 'api/anime/search.xml'
add_anime = anime + 'add/{}.xml'
update_anime = anime + 'update/{}.xml'
delete_anime = anime + 'delete/{}.xml'
manga = base_api + 'api/mangalist/'
search_manga = base_api + 'api/manga/search.xml'
add_manga = manga + 'add/{}.xml'
update_manga = manga + 'update/{}.xml'
delete_manga = manga + 'delete/{}.xml'
verify_user = base_api + 'api/account/verify_credentials.xml'
user_list = base_api + 'malappinfo.php' |
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Untitled16.ipynb",
"provenance": [],
"collapsed_sections": [],
"authorship_tag": "ABX9TyOm2YDBa+1KtqbwxKRFb+3Y",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/singhsani/opencv/blob/master/birthdaya.py\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"metadata": {
"id": "9vJ4YHkwbo3n",
"outputId": "328a9b9e-941c-49f6-b207-e00fdc845145",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 238
}
},
"source": [
"bday={}\n",
"while True:\n",
" print('Enter the name (blank to quit)')\n",
" name=input()\n",
" if name=='':\n",
" break\n",
" if name in bday:\n",
" print(bday[name])\n",
" print(' ---------------Happy birthday----------------- ')\n",
" print(' ',name,' ')\n",
" else:\n",
" print('enter the birthdate')\n",
" date=input()\n",
" bday[name]=date;\n",
" print('Birthdate is update')\n",
"print('Congrate , You are out of Program !!!!!!!!!!!!')\n"
],
"execution_count": 5,
"outputs": [
{
"output_type": "stream",
"text": [
"Enter the name (blank to quit)\n",
"rajni\n",
"enter the name with birthdate\n",
"10-may-2000\n",
"Birthdate is update\n",
"Enter the name (blank to quit)\n",
"rajni\n",
"10-may-2000\n",
" ---------------Happy birthday----------------- \n",
" rajni \n",
"Enter the name (blank to quit)\n",
"\n",
"Congrate , You are out of Program !!!!!!!!!!!!\n"
],
"name": "stdout"
}
]
}
]
} | {'nbformat': 4, 'nbformat_minor': 0, 'metadata': {'colab': {'name': 'Untitled16.ipynb', 'provenance': [], 'collapsed_sections': [], 'authorship_tag': 'ABX9TyOm2YDBa+1KtqbwxKRFb+3Y', 'include_colab_link': true}, 'kernelspec': {'name': 'python3', 'display_name': 'Python 3'}}, 'cells': [{'cell_type': 'markdown', 'metadata': {'id': 'view-in-github', 'colab_type': 'text'}, 'source': ['<a href="https://colab.research.google.com/github/singhsani/opencv/blob/master/birthdaya.py" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>']}, {'cell_type': 'code', 'metadata': {'id': '9vJ4YHkwbo3n', 'outputId': '328a9b9e-941c-49f6-b207-e00fdc845145', 'colab': {'base_uri': 'https://localhost:8080/', 'height': 238}}, 'source': ['bday={}\n', 'while True:\n', " print('Enter the name (blank to quit)')\n", ' name=input()\n', " if name=='':\n", ' break\n', ' if name in bday:\n', ' print(bday[name])\n', " print(' ---------------Happy birthday----------------- ')\n", " print(' ',name,' ')\n", ' else:\n', " print('enter the birthdate')\n", ' date=input()\n', ' bday[name]=date;\n', " print('Birthdate is update')\n", "print('Congrate , You are out of Program !!!!!!!!!!!!')\n"], 'execution_count': 5, 'outputs': [{'output_type': 'stream', 'text': ['Enter the name (blank to quit)\n', 'rajni\n', 'enter the name with birthdate\n', '10-may-2000\n', 'Birthdate is update\n', 'Enter the name (blank to quit)\n', 'rajni\n', '10-may-2000\n', ' ---------------Happy birthday----------------- \n', ' rajni \n', 'Enter the name (blank to quit)\n', '\n', 'Congrate , You are out of Program !!!!!!!!!!!!\n'], 'name': 'stdout'}]}]} |
#WAP to accept the following data in a dictionary:
#Item_Name, CP, SP
#Displaying
#Item_Name, Profit or Loss
#The program should continue as long as the user wishes to.
itemInt = int(input("Enter number of items to be stored: "))
x = "y"
shopping = dict()
while x == "y" or x == "Y":
Item_name = input("Enter the Item Name: ")
cp = int(input("Enter the Cost Price: "))
sp = int(input("Enter the Selling price: "))
shopping[Item_name] = [cp, sp, sp-cp]
print("\n\nITEM_NAME\tCOST_PRICE\tSELLING_PRICE\tPROFIT_or_LOSS")
for k in shopping:
print(k,'\t\t', shopping[k])
UserChoice = str(input("Would you like to continue?: Y or N"))
if UserChoice == "y" or UserChoice == "Y":
continue
else:
break
| item_int = int(input('Enter number of items to be stored: '))
x = 'y'
shopping = dict()
while x == 'y' or x == 'Y':
item_name = input('Enter the Item Name: ')
cp = int(input('Enter the Cost Price: '))
sp = int(input('Enter the Selling price: '))
shopping[Item_name] = [cp, sp, sp - cp]
print('\n\nITEM_NAME\tCOST_PRICE\tSELLING_PRICE\tPROFIT_or_LOSS')
for k in shopping:
print(k, '\t\t', shopping[k])
user_choice = str(input('Would you like to continue?: Y or N'))
if UserChoice == 'y' or UserChoice == 'Y':
continue
else:
break |
class Group(object):
def __init__(self, _name):
self.name = _name
self.groups = []
self.users = []
def add_group(self, group):
self.groups.append(group)
def add_user(self, user):
self.users.append(user)
def get_groups(self):
return self.groups
def get_users(self):
return self.users
def get_name(self):
return self.name
parent = Group("parent")
child = Group("child")
sub_child = Group("subchild")
sub_child_user = "sub_child_user"
sub_child.add_user(sub_child_user)
child.add_group(sub_child)
parent.add_group(child)
def is_user_in_group(user, group):
"""
Return True if user is in the group, False otherwise.
Args:
user(str): user name/id
group(class:Group): group to check user membership against
"""
groups = group.get_groups()
users = group.get_users()
if user in users:
return True
for single_group in groups:
return is_user_in_group(user, single_group)
return False
print("--- Test 1 ---")
print(is_user_in_group('sub_child_user', sub_child))
# True
print("--- Test 2 ---")
print(is_user_in_group('sub_child_user', child))
# True
print("--- Test 3 ---")
print(is_user_in_group('sub_child_user', parent))
# True
print("--- Test 4 ---")
print(is_user_in_group('some_other_child_user', sub_child))
# False
print("--- Test 5 ---")
print(is_user_in_group('some_other_child_user', child))
# False
print("--- Test 6 ---")
print(is_user_in_group('some_other_child_user', parent))
# False
| class Group(object):
def __init__(self, _name):
self.name = _name
self.groups = []
self.users = []
def add_group(self, group):
self.groups.append(group)
def add_user(self, user):
self.users.append(user)
def get_groups(self):
return self.groups
def get_users(self):
return self.users
def get_name(self):
return self.name
parent = group('parent')
child = group('child')
sub_child = group('subchild')
sub_child_user = 'sub_child_user'
sub_child.add_user(sub_child_user)
child.add_group(sub_child)
parent.add_group(child)
def is_user_in_group(user, group):
"""
Return True if user is in the group, False otherwise.
Args:
user(str): user name/id
group(class:Group): group to check user membership against
"""
groups = group.get_groups()
users = group.get_users()
if user in users:
return True
for single_group in groups:
return is_user_in_group(user, single_group)
return False
print('--- Test 1 ---')
print(is_user_in_group('sub_child_user', sub_child))
print('--- Test 2 ---')
print(is_user_in_group('sub_child_user', child))
print('--- Test 3 ---')
print(is_user_in_group('sub_child_user', parent))
print('--- Test 4 ---')
print(is_user_in_group('some_other_child_user', sub_child))
print('--- Test 5 ---')
print(is_user_in_group('some_other_child_user', child))
print('--- Test 6 ---')
print(is_user_in_group('some_other_child_user', parent)) |
#carriers [ x ]
# substrates [ x ]
guanine_mods = {'G_to_m7G' : {'name' : '7-methylguanosine', 'input' : 'G', 'output' : 'm7G',
'machines' : {'RlmL_dim' : {'proteins' : {'b0948' : 'RlmKL'},
'RNA_position_substrates' :{'rRNA' : {2069 : {'LSU/23S/prokaryotic':1}}},
'carriers' : None
},
'enzyme_new_RmtB' : {'proteins' : {'bnum' : 'RmtB'}, #warning: important not found
'RNA_position_substrates' : {'rRNA' :{1405 : {'SSU/16S/prokaryotic' : 1}}},
'carriers' : None
},
'RsmG_mono' : {'proteins' : {'b3740' : 'RsmG'},
'RNA_position_substrates' :{'rRNA' : {527 : {'SSU/16S/prokaryotic' : 1}}},
'carriers' : None
},
'YggH_mono' : {'proteins' : {'b2960' : 'TrmB'},
'RNA_position_substrates' : {'tRNA' :{46 : {'b3853' : 1, #trna alaT (UGC)
'b3276' : 1,#trna alaU (UGC)
'b0203' : 1 , #trna alaV (UGC)
'b2397' : 1, #trna alaW (GGC)
'b2396' : 1, #trna alaX (GGC)
'b2692' : 1 , # trna ArgZ (ACG)
'b2691' : 1 ,#trna ArgQ (ACG)
'b2694' : 1 ,#trna ArgV (ACG)
'b2693' : 1 ,#trna ArgY (ACG)
'b3796' : 1 ,#trna ArgX (CCG)
'b1984' : 1 , #trna asnW (GUU)
'b1989' : 1 , #trna asnV (GUU)
'b1986' : 1 , #trna asnU (GUU)
'b1977' : 1 , #trna asnT (GUU)
'b0216': 1, #trna aspV (GUC)
'b0206': 1, #trna aspU (GUC)
'b3760': 1, #trna aspT (GUC)
'b4165' : 1 , #trna glyY (GCC)
'b4164' : 1 , #trna glyX (GCC)
'b1911' : 1 , #trna glyW (GCC)
'b4163' : 1 , #trna glyV (GCC)
'b3797' : 1, #trna HisR (GUG)
'b2652' : 1, #trna ileY (CAU)
'b3069' : 1, #trna ileX (CAU)
'b0202' : 1, #trna ileV (GAU)
'b3277' : 1, #trna ileU (GAU)
'b3852' : 1, #trna ileT (GAU)
'b0749' : 1, #trna lysQ (UUU) #mnm5s2U
'b0743' : 1, #trna lysT (UUU) #mnm5s2U
'b2404' : 1, #trna lysV (UUU) #mnm5s2U
'b0747' : 1, #trna lysY (UUU) #mnm5s2U
'b0745' : 1, #trna lysW (UUU) #mnm5s2U
'b0748' : 1, #trna lysZ (UUU) #mnm5s2U
'b0666' : 1, #trna metU (CAU)
'b0673' : 1, #trna metT (CAU)
'b2967' : 1, #trna pheV (GAA)
'b4134' : 1, #trna pheU (GAA)
'b3273' : 1, #trna thrV (GGU)
'b3979' : 1, #trna thrT (GGU)
'b3761' : 1, #trna trpT (CCA)
'b1665' : 1, #trna valV (GAC)
'b1666' : 1, #trna valW (GAC)
'b0744' : 1, #trna valT (UAC)
'b2401' : 1, #trna valU (UAC)
'b2402' : 1, #trna valX (UAC)
'b2403' : 1, #trna valY (UAC)
'b0746' : 1 #rna valZ (UAC)
}}
},
'carriers' : None
}
},
'metabolites' : {'amet_c' : -1,
'ahcys_c' : 1} #may be missing 'h_c' : 1
},
'G_to_m2G' : {'name' : 'N2-methylguanosine', 'input' : 'G', 'output' : 'm2G',
'machines' : {'RlmG_mono' : {'proteins' : {'b3084' : 'RmlG'},
'RNA_position_substrates' : {'rRNA' :{1835 : {'LSU/23S/prokaryotic' : 1}}},
'carriers' : None
},
'RlmL_dim' : {'proteins' : {'b0948' : 'RlmL'},
'RNA_position_substrates' :{'rRNA' : {2445 : {'LSU/23S/prokaryotic' : 1} }},
'carriers' : None
},
'RsmC_mono' : {'proteins' : {'b4371' : 'RsmC'},
'RNA_position_substrates' : {'rRNA' :{1207 : {'SSU/16S/prokaryotic' : 1}}},
'carriers' : None
},
'RsmD_mono' : {'proteins' : {'b3465' : 'RsmD'},
'RNA_position_substrates' : {'rRNA' :{966 : {'SSU/16S/prokaryotic' : 1}}},
'carriers' : None
},
'RsmJ_MONOMER' : {'proteins' : {'b3497' : 'RsmJ '},#important: not im model
'RNA_position_substrates' : {'rRNA' :{1516 : {'SSU/16S/prokaryotic' : 1}}},
'carriers' : None
}
},
'metabolites' : {'amet_c' : -1,
'ahcys_c' : 1,
'h_c' : 1}
},
'G_to_Gm' : {'name' : '2-O-methylguanosine', 'input' : 'G', 'output' : 'Gm',
'machines' : {'RlmB_dim' : {'proteins' : {'b4180' : 'RlmB'},
'RNA_position_substrates' : {'rRNA' :{2251 : {'LSU/23S/prokaryotic': 1}}},
'carriers' : None
},
'TrmH_dim' : {'proteins' : {'b3651' : 'TrmH'},
'RNA_position_substrates' : {'tRNA' :{18 : {'b0668' : 1 , #trna glnW (UUG)
'b0670' : 1 , #trna glnU (UUG)
'b0664' : 1 , #trna glnX (CUG)
'b0665' : 1 , #trna glnV (CUG)
'b2652' : 1, #trna ileY (CAU)
'b3069' : 1, #trna ileX (CAU)
'b1909' : 1 , #trna leuZ (UAA)
'b4369' : 1 , #trna leuP (CAG)
'b4370' : 1 , #trna leuQ (CAG)
'b3798' : 1 , #trna leuT (CAG)
'b4368' : 1 , #trna leu (CAG)
'b3174' : 1 , #trna leuU (GAG)
'b0666' : 1, #trna metU (CAU)
'b0673' : 1, #trna metT (CAU)
'b0971' : 1 , #trna serT (UGA)
'b1975' : 1 , #trna serU (CGA)
'b0883' : 1 , #trna serW (GGA)
'b1032' : 1 , #trna serX (GGA)
'b1230' : 1 , #trna tyrV (GUA)
'b3977' : 1 , #trna tyrU (GUA)
'b1231' : 1} #trna tyrT (GUA)
}},
'carriers' : None
}
},
'metabolites' : {'amet_c' : -1,
'ahcys_c' : 1,
'h_c' : 1}
},
'G_to_m1G' : {'name' : '1-methylguanosine', 'input' : 'G', 'output' : 'm1G',
'machines' : {'RrmA_dim_mod_2:zn2' : {'proteins' : {'b1822' : 'RlmA1'},
'RNA_position_substrates' :{'rRNA':{745 :{'LSU/23S/prokaryotic':1}}},
'carriers' : None
},
'TrmD_dim' : {'proteins' : {'b2607' : 'TrmD'},
'RNA_position_substrates' : {'tRNA' :{37 : { 'b4369' : 1 , #trna leuP (CAG)
'b4370' : 1 , #trna leuQ (CAG)
'b3798' : 1 , #trna leuT (CAG)
'b4368' : 1 , #trna leuV (CAG)
'b3174' : 1 , #trna leuU (GAG)
'b0672' : 1 , #trna leuW (UAG)
'b3799' : 1 , #trna proM (UGG)
'b2189' : 1 , #trna proL (GGG)
'b3545' : 1 , #trna proK (CGG)
'b3796' : 1 }
}},#trna ArgX (CCG)
'carriers' : None
}
},
'metabolites' : {'amet_c' : -1,
'ahcys_c' : 1,
'h_c' : 1}
},
'G_to_preq1tRNA' : {'name' : '7-aminomethyl-7-deazaguanosine',
'input' : 'G',
'output' : 'preq1tRNA',
'machines' : {'Tgt_hexa_mod_6:zn2' : {'proteins' : {'b0406' : 'Tgt'},
'RNA_position_substrates' : {'tRNA' :{34 : {'all' : 1}}},
'carriers' : None
}
},
'metabolites' : {'preq1_c' : -1,
'gua_c' : 1}
},
###################################end##############################################
####################################################################################
'preq1tRNA_to_oQtRNA' : {'name' : 'epoxyqueuosine',
'input' : 'preq1tRNA',
'output' : 'oQtRNA',
'machines' : {'QueA_mono' : {'proteins' : {'b0405' : 'QueA'},
'RNA_position_substrates' : {'tRNA' :{34 : {'all' : 1}}},
'carriers' : None
}
},
'metabolites' : {'amet_c' : -1,
'ade_c' : 1,
'met__L_c' : 1,
'h_c' : 1}
},
###################################end##############################################
####################################################################################
'oQtRNA_to_QtRNA' : {'name' : 'queuosine',
'input' : 'oQtRNA',
'output' : 'QtRNA',
'machines' : {'QueG_mono_mod_adocbl' : {'proteins' : {'b4166' : 'QueG'},
'RNA_position_substrates' : {'tRNA' :{34 : {'all' : 1}}},
'carriers' : None
}
},
'metabolites' : {'h2o_c' : 1}
#oxidized e acceptor : 1
#reduced e acceptor : -1}
},
###################################end##############################################
####################################################################################
'QtRNA_to_gluQtRNA' : {'name' : 'glutamyl-queuosine',
'input' : 'QtRNA',
'output' : 'gluQtRNA',
'machines' : {'YadB_mono' : {'proteins' : {'b0144' : 'GluQRS'},
#important: not in model
'RNA_position_substrates' : {'tRNA' :{34 : { 'b0216': 1, #trna aspV (GUC)
'b0206': 1, #trna aspU (GUC)
'b3760': 1}}}, #trna aspT (GUC)
'carriers' : None
}
},
'metabolites' : {'atp_c' : 1,
'glu__L_c' : -1,
'amp_c' : 1,
'ppi_c' : 1,
'h_c' : 2}
}
}
| guanine_mods = {'G_to_m7G': {'name': '7-methylguanosine', 'input': 'G', 'output': 'm7G', 'machines': {'RlmL_dim': {'proteins': {'b0948': 'RlmKL'}, 'RNA_position_substrates': {'rRNA': {2069: {'LSU/23S/prokaryotic': 1}}}, 'carriers': None}, 'enzyme_new_RmtB': {'proteins': {'bnum': 'RmtB'}, 'RNA_position_substrates': {'rRNA': {1405: {'SSU/16S/prokaryotic': 1}}}, 'carriers': None}, 'RsmG_mono': {'proteins': {'b3740': 'RsmG'}, 'RNA_position_substrates': {'rRNA': {527: {'SSU/16S/prokaryotic': 1}}}, 'carriers': None}, 'YggH_mono': {'proteins': {'b2960': 'TrmB'}, 'RNA_position_substrates': {'tRNA': {46: {'b3853': 1, 'b3276': 1, 'b0203': 1, 'b2397': 1, 'b2396': 1, 'b2692': 1, 'b2691': 1, 'b2694': 1, 'b2693': 1, 'b3796': 1, 'b1984': 1, 'b1989': 1, 'b1986': 1, 'b1977': 1, 'b0216': 1, 'b0206': 1, 'b3760': 1, 'b4165': 1, 'b4164': 1, 'b1911': 1, 'b4163': 1, 'b3797': 1, 'b2652': 1, 'b3069': 1, 'b0202': 1, 'b3277': 1, 'b3852': 1, 'b0749': 1, 'b0743': 1, 'b2404': 1, 'b0747': 1, 'b0745': 1, 'b0748': 1, 'b0666': 1, 'b0673': 1, 'b2967': 1, 'b4134': 1, 'b3273': 1, 'b3979': 1, 'b3761': 1, 'b1665': 1, 'b1666': 1, 'b0744': 1, 'b2401': 1, 'b2402': 1, 'b2403': 1, 'b0746': 1}}}, 'carriers': None}}, 'metabolites': {'amet_c': -1, 'ahcys_c': 1}}, 'G_to_m2G': {'name': 'N2-methylguanosine', 'input': 'G', 'output': 'm2G', 'machines': {'RlmG_mono': {'proteins': {'b3084': 'RmlG'}, 'RNA_position_substrates': {'rRNA': {1835: {'LSU/23S/prokaryotic': 1}}}, 'carriers': None}, 'RlmL_dim': {'proteins': {'b0948': 'RlmL'}, 'RNA_position_substrates': {'rRNA': {2445: {'LSU/23S/prokaryotic': 1}}}, 'carriers': None}, 'RsmC_mono': {'proteins': {'b4371': 'RsmC'}, 'RNA_position_substrates': {'rRNA': {1207: {'SSU/16S/prokaryotic': 1}}}, 'carriers': None}, 'RsmD_mono': {'proteins': {'b3465': 'RsmD'}, 'RNA_position_substrates': {'rRNA': {966: {'SSU/16S/prokaryotic': 1}}}, 'carriers': None}, 'RsmJ_MONOMER': {'proteins': {'b3497': 'RsmJ '}, 'RNA_position_substrates': {'rRNA': {1516: {'SSU/16S/prokaryotic': 1}}}, 'carriers': None}}, 'metabolites': {'amet_c': -1, 'ahcys_c': 1, 'h_c': 1}}, 'G_to_Gm': {'name': '2-O-methylguanosine', 'input': 'G', 'output': 'Gm', 'machines': {'RlmB_dim': {'proteins': {'b4180': 'RlmB'}, 'RNA_position_substrates': {'rRNA': {2251: {'LSU/23S/prokaryotic': 1}}}, 'carriers': None}, 'TrmH_dim': {'proteins': {'b3651': 'TrmH'}, 'RNA_position_substrates': {'tRNA': {18: {'b0668': 1, 'b0670': 1, 'b0664': 1, 'b0665': 1, 'b2652': 1, 'b3069': 1, 'b1909': 1, 'b4369': 1, 'b4370': 1, 'b3798': 1, 'b4368': 1, 'b3174': 1, 'b0666': 1, 'b0673': 1, 'b0971': 1, 'b1975': 1, 'b0883': 1, 'b1032': 1, 'b1230': 1, 'b3977': 1, 'b1231': 1}}}, 'carriers': None}}, 'metabolites': {'amet_c': -1, 'ahcys_c': 1, 'h_c': 1}}, 'G_to_m1G': {'name': '1-methylguanosine', 'input': 'G', 'output': 'm1G', 'machines': {'RrmA_dim_mod_2:zn2': {'proteins': {'b1822': 'RlmA1'}, 'RNA_position_substrates': {'rRNA': {745: {'LSU/23S/prokaryotic': 1}}}, 'carriers': None}, 'TrmD_dim': {'proteins': {'b2607': 'TrmD'}, 'RNA_position_substrates': {'tRNA': {37: {'b4369': 1, 'b4370': 1, 'b3798': 1, 'b4368': 1, 'b3174': 1, 'b0672': 1, 'b3799': 1, 'b2189': 1, 'b3545': 1, 'b3796': 1}}}, 'carriers': None}}, 'metabolites': {'amet_c': -1, 'ahcys_c': 1, 'h_c': 1}}, 'G_to_preq1tRNA': {'name': '7-aminomethyl-7-deazaguanosine', 'input': 'G', 'output': 'preq1tRNA', 'machines': {'Tgt_hexa_mod_6:zn2': {'proteins': {'b0406': 'Tgt'}, 'RNA_position_substrates': {'tRNA': {34: {'all': 1}}}, 'carriers': None}}, 'metabolites': {'preq1_c': -1, 'gua_c': 1}}, 'preq1tRNA_to_oQtRNA': {'name': 'epoxyqueuosine', 'input': 'preq1tRNA', 'output': 'oQtRNA', 'machines': {'QueA_mono': {'proteins': {'b0405': 'QueA'}, 'RNA_position_substrates': {'tRNA': {34: {'all': 1}}}, 'carriers': None}}, 'metabolites': {'amet_c': -1, 'ade_c': 1, 'met__L_c': 1, 'h_c': 1}}, 'oQtRNA_to_QtRNA': {'name': 'queuosine', 'input': 'oQtRNA', 'output': 'QtRNA', 'machines': {'QueG_mono_mod_adocbl': {'proteins': {'b4166': 'QueG'}, 'RNA_position_substrates': {'tRNA': {34: {'all': 1}}}, 'carriers': None}}, 'metabolites': {'h2o_c': 1}}, 'QtRNA_to_gluQtRNA': {'name': 'glutamyl-queuosine', 'input': 'QtRNA', 'output': 'gluQtRNA', 'machines': {'YadB_mono': {'proteins': {'b0144': 'GluQRS'}, 'RNA_position_substrates': {'tRNA': {34: {'b0216': 1, 'b0206': 1, 'b3760': 1}}}, 'carriers': None}}, 'metabolites': {'atp_c': 1, 'glu__L_c': -1, 'amp_c': 1, 'ppi_c': 1, 'h_c': 2}}} |
doc = dict(
__class__="""Performs k-means clustering on an H2O dataset.""",
)
examples = dict(
categorical_encoding="""
>>> prostate = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")
>>> predictors = ["AGE", "RACE", "DPROS", "DCAPS", "PSA", "VOL", "GLEASON"]
>>> train, valid = prostate.split_frame(ratios = [.8], seed = 1234)
>>> encoding = "one_hot_explicit"
>>> pros_km = H2OKMeansEstimator(categorical_encoding = encoding,
... seed = 1234)
>>> pros_km.train(x = predictors,
... training_frame = train,
... validation_frame = valid)
>>> pros_km.scoring_history()
""",
estimate_k="""
>>> iris = h2o.import_file("http://h2o-public-test-data.s3.amazonaws.com/smalldata/iris/iris_wheader.csv")
>>> iris['class'] = iris['class'].asfactor()
>>> predictors = iris.columns[:-1]
>>> train, valid = iris.split_frame(ratios = [.8], seed = 1234)
>>> iris_kmeans = H2OKMeansEstimator(k = 10,
... estimate_k = True,
... standardize = False,
... seed = 1234)
>>> iris_kmeans.train(x = predictors,
... training_frame = train,
... validation_frame=valid)
>>> iris_kmeans.scoring_history()
""",
export_checkpoints_dir="""
>>> import tempfile
>>> from os import listdir
>>> airlines = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/airlines/allyears2k_headers.zip", destination_frame="air.hex")
>>> predictors = ["DayofMonth", "DayOfWeek"]
>>> checkpoints_dir = tempfile.mkdtemp()
>>> air_km = H2OKMeansEstimator(export_checkpoints_dir = checkpoints_dir,
... seed = 1234)
>>> air_km.train(x = predictors, training_frame = airlines)
>>> len(listdir(checkpoints_dir))
""",
fold_assignment="""
>>> ozone = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/glm_test/ozone.csv")
>>> predictors = ["radiation","temperature","wind"]
>>> train, valid = ozone.split_frame(ratios = [.8], seed = 1234)
>>> ozone_km = H2OKMeansEstimator(fold_assignment = "Random",
... nfolds = 5,
... seed = 1234)
>>> ozone_km.train(x = predictors,
... training_frame = train,
... validation_frame = valid)
>>> ozone_km.scoring_history()
""",
fold_column="""
>>> cars = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/junit/cars_20mpg.csv")
>>> predictors = ["displacement","power","weight","acceleration","year"]
>>> fold_numbers = cars.kfold_column(n_folds = 5, seed = 1234)
>>> fold_numbers.set_names(["fold_numbers"])
>>> cars = cars.cbind(fold_numbers)
>>> print(cars['fold_numbers'])
>>> cars_km = H2OKMeansEstimator(seed = 1234)
>>> cars_km.train(x = predictors,
... training_frame = cars,
... fold_column = "fold_numbers")
>>> cars_km.scoring_history()
""",
ignore_const_cols="""
>>> cars = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/junit/cars_20mpg.csv")
>>> predictors = ["displacement","power","weight","acceleration","year"]
>>> cars["const_1"] = 6
>>> cars["const_2"] = 7
>>> train, valid = cars.split_frame(ratios = [.8], seed = 1234)
>>> cars_km = H2OKMeansEstimator(ignore_const_cols = True,
... seed = 1234)
>>> cars_km.train(x = predictors,
... training_frame = train,
... validation_frame = valid)
>>> cars_km.scoring_history()
""",
init="""
>>> seeds = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/flow_examples/seeds_dataset.txt")
>>> predictors = seeds.columns[0:7]
>>> train, valid = seeds.split_frame(ratios = [.8], seed = 1234)
>>> seeds_km = H2OKMeansEstimator(k = 3,
... init='Furthest',
... seed = 1234)
>>> seeds_km.train(x = predictors,
... training_frame = train,
... validation_frame= valid)
>>> seeds_km.scoring_history()
""",
k="""
>>> seeds = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/flow_examples/seeds_dataset.txt")
>>> predictors = seeds.columns[0:7]
>>> train, valid = seeds.split_frame(ratios = [.8], seed = 1234)
>>> seeds_km = H2OKMeansEstimator(k = 3, seed = 1234)
>>> seeds_km.train(x = predictors,
... training_frame = train,
... validation_frame=valid)
>>> seeds_km.scoring_history()
""",
keep_cross_validation_fold_assignment="""
>>> ozone = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/glm_test/ozone.csv")
>>> predictors = ["radiation","temperature","wind"]
>>> train, valid = ozone.split_frame(ratios = [.8], seed = 1234)
>>> ozone_km = H2OKMeansEstimator(keep_cross_validation_fold_assignment = True,
... nfolds = 5,
... seed = 1234)
>>> ozone_km.train(x = predictors,
... training_frame = train)
>>> ozone_km.scoring_history()
""",
keep_cross_validation_models="""
>>> ozone = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/glm_test/ozone.csv")
>>> predictors = ["radiation","temperature","wind"]
>>> train, valid = ozone.split_frame(ratios = [.8], seed = 1234)
>>> ozone_km = H2OKMeansEstimator(keep_cross_validation_models = True,
... nfolds = 5,
... seed = 1234)
>>> ozone_km.train(x = predictors,
... training_frame = train,
... validation_frame = valid)
>>> ozone_km.scoring_history()
""",
max_iterations="""
>>> benign = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/logreg/benign.csv")
>>> predictors = ["AGMT","FNDX","HIGD","DEG","CHK",
... "AGP1","AGMN","LIV","AGLP"]
>>> train, valid = benign.split_frame(ratios = [.8], seed = 1234)
>>> benign_km = H2OKMeansEstimator(max_iterations = 50)
>>> benign_km.train(x = predictors,
... training_frame = train,
... validation_frame = valid)
>>> benign_km.scoring_history()
""",
max_runtime_secs="""
>>> benign = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/logreg/benign.csv")
>>> predictors = ["AGMT","FNDX","HIGD","DEG","CHK",
... "AGP1","AGMN","LIV","AGLP"]
>>> train, valid = benign.split_frame(ratios = [.8], seed = 1234)
>>> benign_km = H2OKMeansEstimator(max_runtime_secs = 10,
... seed = 1234)
>>> benign_km.train(x = predictors,
... training_frame = train,
... validation_frame = valid)
>>> benign_km.scoring_history()
""",
nfolds="""
>>> benign = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/logreg/benign.csv")
>>> predictors = ["AGMT","FNDX","HIGD","DEG","CHK",
... "AGP1","AGMN","LIV","AGLP"]
>>> train, valid = benign.split_frame(ratios = [.8], seed = 1234)
>>> benign_km = H2OKMeansEstimator(nfolds = 5, seed = 1234)
>>> benign_km.train(x = predictors,
... training_frame = train,
... validation_frame = valid)
>>> benign_km.scoring_history()
""",
score_each_iteration="""
>>> benign = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/logreg/benign.csv")
>>> predictors = ["AGMT","FNDX","HIGD","DEG","CHK",
... "AGP1","AGMN","LIV","AGLP"]
>>> train, valid = benign.split_frame(ratios = [.8], seed = 1234)
>>> benign_km = H2OKMeansEstimator(score_each_iteration = True,
... seed = 1234)
>>> benign_km.train(x = predictors,
... training_frame = train,
... validation_frame = valid)
>>> benign_km.scoring_history()
""",
seed="""
>>> prostate = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")
>>> predictors = ["AGE", "RACE", "DPROS", "DCAPS", "PSA", "VOL", "GLEASON"]
>>> train, valid = prostate.split_frame(ratios = [.8], seed = 1234)
>>> pros_w_seed = H2OKMeansEstimator(seed = 1234)
>>> pros_w_seed.train(x = predictors,
... training_frame = train,
... validation_frame = valid)
>>> pros_wo_seed = H2OKMeansEstimator()
>>> pros_wo_seed.train(x = predictors,
... training_frame = train,
... validation_frame = valid)
>>> pros_w_seed.scoring_history()
>>> pros_wo_seed.scoring_history()
""",
standardize="""
>>> boston = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/gbm_test/BostonHousing.csv")
>>> predictors = boston.columns[:-1]
>>> boston['chas'] = boston['chas'].asfactor()
>>> train, valid = boston.split_frame(ratios = [.8])
>>> boston_km = H2OKMeansEstimator(standardize = True)
>>> boston_km.train(x = predictors,
... training_frame = train,
... validation_frame = valid)
>>> boston_km.scoring_history()
""",
training_frame="""
>>> prostate = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")
>>> predictors = ["AGE", "RACE", "DPROS", "DCAPS",
... "PSA", "VOL", "GLEASON"]
>>> train, valid = prostate.split_frame(ratios = [.8], seed = 1234)
>>> pros_km = H2OKMeansEstimator(seed = 1234)
>>> pros_km.train(x = predictors,
... training_frame = train,
... validation_frame = valid)
>>> pros_km.scoring_history()
""",
user_points="""
>>> iris = h2o.import_file("http://h2o-public-test-data.s3.amazonaws.com/smalldata/iris/iris_wheader.csv")
>>> iris['class'] = iris['class'].asfactor()
>>> predictors = iris.columns[:-1]
>>> train, valid = iris.split_frame(ratios = [.8], seed = 1234)
>>> point1 = [4.9,3.0,1.4,0.2]
>>> point2 = [5.6,2.5,3.9,1.1]
>>> point3 = [6.5,3.0,5.2,2.0]
>>> points = h2o.H2OFrame([point1, point2, point3])
>>> iris_km = H2OKMeansEstimator(k = 3,
... user_points = points,
... seed = 1234)
>>> iris_km.train(x=predictors,
... training_frame=iris,
... validation_frame=valid)
>>> iris_kmeans.tot_withinss(valid = True)
""",
validation_frame="""
>>> prostate = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")
>>> predictors = ["AGE", "RACE", "DPROS", "DCAPS",
... "PSA", "VOL", "GLEASON"]
>>> train, valid = prostate.split_frame(ratios = [.8], seed = 1234)
>>> pros_km = H2OKMeansEstimator(seed = 1234)
>>> pros_km.train(x = predictors,
... training_frame = train,
... validation_frame = valid)
>>> pros_km.scoring_history()
""",
keep_cross_validation_predictions="""
>>> prostate = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")
>>> predictors = ["AGE", "RACE", "DPROS", "DCAPS",
... "PSA", "VOL", "GLEASON"]
>>> train, valid = prostate.split_frame(ratios = [.8], seed = 1234)
>>> pros_km = H2OKMeansEstimator(keep_cross_validation_predictions = True,
... nfolds = 5,
... seed = 1234)
>>> pros_km.train(x = predictors,
... training_frame = train,
... validation_frame = valid)
>>> pros_km.scoring_history()
"""
)
| doc = dict(__class__='Performs k-means clustering on an H2O dataset.')
examples = dict(categorical_encoding='\n>>> prostate = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")\n>>> predictors = ["AGE", "RACE", "DPROS", "DCAPS", "PSA", "VOL", "GLEASON"]\n>>> train, valid = prostate.split_frame(ratios = [.8], seed = 1234)\n>>> encoding = "one_hot_explicit"\n>>> pros_km = H2OKMeansEstimator(categorical_encoding = encoding,\n... seed = 1234)\n>>> pros_km.train(x = predictors,\n... training_frame = train,\n... validation_frame = valid)\n>>> pros_km.scoring_history()\n', estimate_k='\n>>> iris = h2o.import_file("http://h2o-public-test-data.s3.amazonaws.com/smalldata/iris/iris_wheader.csv")\n>>> iris[\'class\'] = iris[\'class\'].asfactor()\n>>> predictors = iris.columns[:-1]\n>>> train, valid = iris.split_frame(ratios = [.8], seed = 1234)\n>>> iris_kmeans = H2OKMeansEstimator(k = 10,\n... estimate_k = True,\n... standardize = False,\n... seed = 1234)\n>>> iris_kmeans.train(x = predictors,\n... training_frame = train,\n... validation_frame=valid)\n>>> iris_kmeans.scoring_history()\n', export_checkpoints_dir='\n>>> import tempfile\n>>> from os import listdir\n>>> airlines = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/airlines/allyears2k_headers.zip", destination_frame="air.hex")\n>>> predictors = ["DayofMonth", "DayOfWeek"]\n>>> checkpoints_dir = tempfile.mkdtemp()\n>>> air_km = H2OKMeansEstimator(export_checkpoints_dir = checkpoints_dir,\n... seed = 1234)\n>>> air_km.train(x = predictors, training_frame = airlines)\n>>> len(listdir(checkpoints_dir))\n', fold_assignment='\n>>> ozone = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/glm_test/ozone.csv")\n>>> predictors = ["radiation","temperature","wind"]\n>>> train, valid = ozone.split_frame(ratios = [.8], seed = 1234)\n>>> ozone_km = H2OKMeansEstimator(fold_assignment = "Random",\n... nfolds = 5,\n... seed = 1234)\n>>> ozone_km.train(x = predictors,\n... training_frame = train,\n... validation_frame = valid)\n>>> ozone_km.scoring_history()\n', fold_column='\n>>> cars = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/junit/cars_20mpg.csv")\n>>> predictors = ["displacement","power","weight","acceleration","year"]\n>>> fold_numbers = cars.kfold_column(n_folds = 5, seed = 1234)\n>>> fold_numbers.set_names(["fold_numbers"])\n>>> cars = cars.cbind(fold_numbers)\n>>> print(cars[\'fold_numbers\'])\n>>> cars_km = H2OKMeansEstimator(seed = 1234)\n>>> cars_km.train(x = predictors,\n... training_frame = cars,\n... fold_column = "fold_numbers")\n>>> cars_km.scoring_history()\n', ignore_const_cols='\n>>> cars = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/junit/cars_20mpg.csv")\n>>> predictors = ["displacement","power","weight","acceleration","year"]\n>>> cars["const_1"] = 6\n>>> cars["const_2"] = 7\n>>> train, valid = cars.split_frame(ratios = [.8], seed = 1234)\n>>> cars_km = H2OKMeansEstimator(ignore_const_cols = True,\n... seed = 1234)\n>>> cars_km.train(x = predictors,\n... training_frame = train,\n... validation_frame = valid)\n>>> cars_km.scoring_history()\n', init='\n>>> seeds = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/flow_examples/seeds_dataset.txt")\n>>> predictors = seeds.columns[0:7]\n>>> train, valid = seeds.split_frame(ratios = [.8], seed = 1234)\n>>> seeds_km = H2OKMeansEstimator(k = 3,\n... init=\'Furthest\',\n... seed = 1234)\n>>> seeds_km.train(x = predictors,\n... training_frame = train,\n... validation_frame= valid)\n>>> seeds_km.scoring_history()\n', k='\n>>> seeds = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/flow_examples/seeds_dataset.txt")\n>>> predictors = seeds.columns[0:7]\n>>> train, valid = seeds.split_frame(ratios = [.8], seed = 1234)\n>>> seeds_km = H2OKMeansEstimator(k = 3, seed = 1234)\n>>> seeds_km.train(x = predictors,\n... training_frame = train,\n... validation_frame=valid)\n>>> seeds_km.scoring_history()\n', keep_cross_validation_fold_assignment='\n>>> ozone = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/glm_test/ozone.csv")\n>>> predictors = ["radiation","temperature","wind"]\n>>> train, valid = ozone.split_frame(ratios = [.8], seed = 1234)\n>>> ozone_km = H2OKMeansEstimator(keep_cross_validation_fold_assignment = True,\n... nfolds = 5,\n... seed = 1234)\n>>> ozone_km.train(x = predictors,\n... training_frame = train)\n>>> ozone_km.scoring_history()\n', keep_cross_validation_models='\n>>> ozone = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/glm_test/ozone.csv")\n>>> predictors = ["radiation","temperature","wind"]\n>>> train, valid = ozone.split_frame(ratios = [.8], seed = 1234)\n>>> ozone_km = H2OKMeansEstimator(keep_cross_validation_models = True,\n... nfolds = 5,\n... seed = 1234)\n>>> ozone_km.train(x = predictors,\n... training_frame = train,\n... validation_frame = valid)\n>>> ozone_km.scoring_history()\n', max_iterations='\n>>> benign = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/logreg/benign.csv")\n>>> predictors = ["AGMT","FNDX","HIGD","DEG","CHK",\n... "AGP1","AGMN","LIV","AGLP"]\n>>> train, valid = benign.split_frame(ratios = [.8], seed = 1234)\n>>> benign_km = H2OKMeansEstimator(max_iterations = 50)\n>>> benign_km.train(x = predictors,\n... training_frame = train,\n... validation_frame = valid)\n>>> benign_km.scoring_history()\n', max_runtime_secs='\n>>> benign = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/logreg/benign.csv")\n>>> predictors = ["AGMT","FNDX","HIGD","DEG","CHK",\n... "AGP1","AGMN","LIV","AGLP"]\n>>> train, valid = benign.split_frame(ratios = [.8], seed = 1234)\n>>> benign_km = H2OKMeansEstimator(max_runtime_secs = 10,\n... seed = 1234)\n>>> benign_km.train(x = predictors,\n... training_frame = train,\n... validation_frame = valid)\n>>> benign_km.scoring_history()\n', nfolds='\n>>> benign = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/logreg/benign.csv")\n>>> predictors = ["AGMT","FNDX","HIGD","DEG","CHK",\n... "AGP1","AGMN","LIV","AGLP"]\n>>> train, valid = benign.split_frame(ratios = [.8], seed = 1234)\n>>> benign_km = H2OKMeansEstimator(nfolds = 5, seed = 1234)\n>>> benign_km.train(x = predictors,\n... training_frame = train,\n... validation_frame = valid)\n>>> benign_km.scoring_history()\n', score_each_iteration='\n>>> benign = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/logreg/benign.csv")\n>>> predictors = ["AGMT","FNDX","HIGD","DEG","CHK",\n... "AGP1","AGMN","LIV","AGLP"]\n>>> train, valid = benign.split_frame(ratios = [.8], seed = 1234)\n>>> benign_km = H2OKMeansEstimator(score_each_iteration = True,\n... seed = 1234)\n>>> benign_km.train(x = predictors,\n... training_frame = train,\n... validation_frame = valid)\n>>> benign_km.scoring_history()\n', seed='\n>>> prostate = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")\n>>> predictors = ["AGE", "RACE", "DPROS", "DCAPS", "PSA", "VOL", "GLEASON"]\n>>> train, valid = prostate.split_frame(ratios = [.8], seed = 1234)\n>>> pros_w_seed = H2OKMeansEstimator(seed = 1234)\n>>> pros_w_seed.train(x = predictors,\n... training_frame = train,\n... validation_frame = valid)\n>>> pros_wo_seed = H2OKMeansEstimator()\n>>> pros_wo_seed.train(x = predictors,\n... training_frame = train,\n... validation_frame = valid)\n>>> pros_w_seed.scoring_history()\n>>> pros_wo_seed.scoring_history()\n', standardize='\n>>> boston = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/gbm_test/BostonHousing.csv")\n>>> predictors = boston.columns[:-1]\n>>> boston[\'chas\'] = boston[\'chas\'].asfactor()\n>>> train, valid = boston.split_frame(ratios = [.8])\n>>> boston_km = H2OKMeansEstimator(standardize = True)\n>>> boston_km.train(x = predictors,\n... training_frame = train,\n... validation_frame = valid)\n>>> boston_km.scoring_history()\n', training_frame='\n>>> prostate = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")\n>>> predictors = ["AGE", "RACE", "DPROS", "DCAPS",\n... "PSA", "VOL", "GLEASON"]\n>>> train, valid = prostate.split_frame(ratios = [.8], seed = 1234)\n>>> pros_km = H2OKMeansEstimator(seed = 1234)\n>>> pros_km.train(x = predictors,\n... training_frame = train,\n... validation_frame = valid)\n>>> pros_km.scoring_history()\n', user_points='\n>>> iris = h2o.import_file("http://h2o-public-test-data.s3.amazonaws.com/smalldata/iris/iris_wheader.csv")\n>>> iris[\'class\'] = iris[\'class\'].asfactor()\n>>> predictors = iris.columns[:-1]\n>>> train, valid = iris.split_frame(ratios = [.8], seed = 1234)\n>>> point1 = [4.9,3.0,1.4,0.2]\n>>> point2 = [5.6,2.5,3.9,1.1]\n>>> point3 = [6.5,3.0,5.2,2.0]\n>>> points = h2o.H2OFrame([point1, point2, point3])\n>>> iris_km = H2OKMeansEstimator(k = 3,\n... user_points = points,\n... seed = 1234)\n>>> iris_km.train(x=predictors,\n... training_frame=iris,\n... validation_frame=valid)\n>>> iris_kmeans.tot_withinss(valid = True)\n', validation_frame='\n>>> prostate = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")\n>>> predictors = ["AGE", "RACE", "DPROS", "DCAPS",\n... "PSA", "VOL", "GLEASON"]\n>>> train, valid = prostate.split_frame(ratios = [.8], seed = 1234)\n>>> pros_km = H2OKMeansEstimator(seed = 1234)\n>>> pros_km.train(x = predictors,\n... training_frame = train,\n... validation_frame = valid)\n>>> pros_km.scoring_history()\n', keep_cross_validation_predictions='\n>>> prostate = h2o.import_file("http://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv")\n>>> predictors = ["AGE", "RACE", "DPROS", "DCAPS",\n... "PSA", "VOL", "GLEASON"]\n>>> train, valid = prostate.split_frame(ratios = [.8], seed = 1234)\n>>> pros_km = H2OKMeansEstimator(keep_cross_validation_predictions = True,\n... nfolds = 5,\n... seed = 1234)\n>>> pros_km.train(x = predictors,\n... training_frame = train,\n... validation_frame = valid)\n>>> pros_km.scoring_history()\n') |
list1=[]
limit=int(input('Enter the size of list'))
for i in range(1,limit+1,1):
items=input('Enter the items of list:')
list1.append(items)
for i in list1:
print(i)
del list1[0]
print(list1)
| list1 = []
limit = int(input('Enter the size of list'))
for i in range(1, limit + 1, 1):
items = input('Enter the items of list:')
list1.append(items)
for i in list1:
print(i)
del list1[0]
print(list1) |
def get_me():
print('hi')
if __name__ == '__main__':
# This is executed you run via terminal
print('Running other_module.py...')
| def get_me():
print('hi')
if __name__ == '__main__':
print('Running other_module.py...') |
options = {0 : "zero",
1 : "sqr",
4 : "sqr",
9 : "sqr",
2 : "even",
3 : "prime",
5 : "prime",
7 : "prime",
}
def zero():
print ("You typed zero.\n")
def sqr():
print ("n is a perfect square\n")
def even():
print ("n is an even number\n")
def prime():
print ("n is a prime number\n")
num = int(input ("Enter a number contained in the dictionary: "))
try:
options[num]()
except:
print ("Error!") | options = {0: 'zero', 1: 'sqr', 4: 'sqr', 9: 'sqr', 2: 'even', 3: 'prime', 5: 'prime', 7: 'prime'}
def zero():
print('You typed zero.\n')
def sqr():
print('n is a perfect square\n')
def even():
print('n is an even number\n')
def prime():
print('n is a prime number\n')
num = int(input('Enter a number contained in the dictionary: '))
try:
options[num]()
except:
print('Error!') |
"""
TESTS:
Test consistency between modular forms and modular symbols Eisenstein
series charpolys, which are computed in completely separate ways. ::
sage: for N in range(25,33):
....: m = ModularForms(N)
....: e = m.eisenstein_subspace()
....: f = e.hecke_polynomial(2)
....: g = ModularSymbols(N).eisenstein_submodule().hecke_polynomial(2)
....: print("{} {}".format(N, f == g))
25 True
26 True
27 True
28 True
29 True
30 True
31 True
32 True
Another similar consistency check::
sage: for N in range(1,26):
....: eps = (N > 2 and DirichletGroup(N,QQ).0) or N
....: m = ModularForms(eps)
....: e = m.eisenstein_subspace()
....: f = e.hecke_polynomial(2)
....: g = ModularSymbols(eps).eisenstein_submodule().hecke_polynomial(2)
....: print("{} {}".format(N, f == g))
1 True
2 True
3 True
4 True
5 True
6 True
7 True
8 True
9 True
10 True
11 True
12 True
13 True
14 True
15 True
16 True
17 True
18 True
19 True
20 True
21 True
22 True
23 True
24 True
25 True
We check that bug :trac:`8541` (traced to a linear algebra problem) is fixed::
sage: f = CuspForms(DirichletGroup(5).0,5).0
sage: f[15]
30*zeta4 - 210
"""
| """
TESTS:
Test consistency between modular forms and modular symbols Eisenstein
series charpolys, which are computed in completely separate ways. ::
sage: for N in range(25,33):
....: m = ModularForms(N)
....: e = m.eisenstein_subspace()
....: f = e.hecke_polynomial(2)
....: g = ModularSymbols(N).eisenstein_submodule().hecke_polynomial(2)
....: print("{} {}".format(N, f == g))
25 True
26 True
27 True
28 True
29 True
30 True
31 True
32 True
Another similar consistency check::
sage: for N in range(1,26):
....: eps = (N > 2 and DirichletGroup(N,QQ).0) or N
....: m = ModularForms(eps)
....: e = m.eisenstein_subspace()
....: f = e.hecke_polynomial(2)
....: g = ModularSymbols(eps).eisenstein_submodule().hecke_polynomial(2)
....: print("{} {}".format(N, f == g))
1 True
2 True
3 True
4 True
5 True
6 True
7 True
8 True
9 True
10 True
11 True
12 True
13 True
14 True
15 True
16 True
17 True
18 True
19 True
20 True
21 True
22 True
23 True
24 True
25 True
We check that bug :trac:`8541` (traced to a linear algebra problem) is fixed::
sage: f = CuspForms(DirichletGroup(5).0,5).0
sage: f[15]
30*zeta4 - 210
""" |
model_imp = DecisionTreeClassifier(random_state=22)
model_imp.fit(X_Smote_train,Y_Smote_train)
importance = model_imp.feature_importances_
for i,v in enumerate(importance):
print('Feature: %0d, Score: %.5f' % (i,v))
plt.bar([x for x in range(len(importance))], importance)
plt.show()
np.where(importance>0.015)
X_Smote_train_rid = X_Smote_train.iloc[:, [0, 2, 3, 4, 5, 6, 8, 9, 27, 28, 32, 33, 41,
42, 44, 45, 53, 64, 78, 79, 81, 84, 85, 86, 87, 90,
91, 95, 97, 100]]
X_test_rid = X_compl_test.iloc[:, [0, 2, 3, 4, 5, 6, 8, 9, 27, 28, 32, 33, 41,
42, 44, 45, 53, 64, 78, 79, 81, 84, 85, 86, 87, 90,
91, 95, 97, 100]]
class_tree=DecisionTreeClassifier(random_state=22)
param = {'max_depth':range(1, 6), 'min_samples_split':range(2,30), 'min_samples_leaf':range(2,25)}
grid = GridSearchCV(class_tree, param, cv=5)
grid.fit(X_Smote_train_rid, Y_Smote_train)
print(grid.best_params_)
mod_tree=DecisionTreeClassifier(max_depth=5,min_samples_split=8,min_samples_leaf=2,random_state=22)
mod_tree.fit(X_Smote_train_rid, Y_Smote_train)
text_representation = tree.export_text(mod_tree)
print(text_representation)
fig1 = plt.figure(figsize=(25,20))
_ = tree.plot_tree(mod_tree,feature_names=list(X_Smote_train_rid.columns),filled=True)
y_train_pred = mod_tree.predict(X_Smote_train_rid)
print(classification_report(Y_Smote_train, y_train_pred))
y_test_pred = mod_tree.predict(X_test_rid)
print(classification_report(Y_unica_test, y_test_pred))
| model_imp = decision_tree_classifier(random_state=22)
model_imp.fit(X_Smote_train, Y_Smote_train)
importance = model_imp.feature_importances_
for (i, v) in enumerate(importance):
print('Feature: %0d, Score: %.5f' % (i, v))
plt.bar([x for x in range(len(importance))], importance)
plt.show()
np.where(importance > 0.015)
x__smote_train_rid = X_Smote_train.iloc[:, [0, 2, 3, 4, 5, 6, 8, 9, 27, 28, 32, 33, 41, 42, 44, 45, 53, 64, 78, 79, 81, 84, 85, 86, 87, 90, 91, 95, 97, 100]]
x_test_rid = X_compl_test.iloc[:, [0, 2, 3, 4, 5, 6, 8, 9, 27, 28, 32, 33, 41, 42, 44, 45, 53, 64, 78, 79, 81, 84, 85, 86, 87, 90, 91, 95, 97, 100]]
class_tree = decision_tree_classifier(random_state=22)
param = {'max_depth': range(1, 6), 'min_samples_split': range(2, 30), 'min_samples_leaf': range(2, 25)}
grid = grid_search_cv(class_tree, param, cv=5)
grid.fit(X_Smote_train_rid, Y_Smote_train)
print(grid.best_params_)
mod_tree = decision_tree_classifier(max_depth=5, min_samples_split=8, min_samples_leaf=2, random_state=22)
mod_tree.fit(X_Smote_train_rid, Y_Smote_train)
text_representation = tree.export_text(mod_tree)
print(text_representation)
fig1 = plt.figure(figsize=(25, 20))
_ = tree.plot_tree(mod_tree, feature_names=list(X_Smote_train_rid.columns), filled=True)
y_train_pred = mod_tree.predict(X_Smote_train_rid)
print(classification_report(Y_Smote_train, y_train_pred))
y_test_pred = mod_tree.predict(X_test_rid)
print(classification_report(Y_unica_test, y_test_pred)) |
class Solution:
"""
Level0: []
level1: [1] [2] [3]
level2: [1,2] [1,3] [2,1] [2,3] [3,1] [3,2]
level3: [1,2,3] [1,3,2] [2,1,3][2,3,1] [3,1,2][3,2,1]
"""
def permute(self, nums: List[int]) -> List[List[int]]:
visited = set()
res = []
self.backtracking(res, visited, [], nums)
return res
def backtracking(self, res, visited, subset, nums):
if len(subset) == len(nums):
res.append(subset)
for i in range(len(nums)):
if i not in visited:
visited.add(i)
self.backtracking(res, visited, subset + [nums[i]], nums)
visited.remove(i) | class Solution:
"""
Level0: []
level1: [1] [2] [3]
level2: [1,2] [1,3] [2,1] [2,3] [3,1] [3,2]
level3: [1,2,3] [1,3,2] [2,1,3][2,3,1] [3,1,2][3,2,1]
"""
def permute(self, nums: List[int]) -> List[List[int]]:
visited = set()
res = []
self.backtracking(res, visited, [], nums)
return res
def backtracking(self, res, visited, subset, nums):
if len(subset) == len(nums):
res.append(subset)
for i in range(len(nums)):
if i not in visited:
visited.add(i)
self.backtracking(res, visited, subset + [nums[i]], nums)
visited.remove(i) |
n1 = int
n2 = int
n3 = int
n4 = int
n5 = int
n6 = int
n7 = int
n8 = int
n9 = int
n = int(input("Digite un Numero: "))
n1 = n*1
n2 = n*2
n3 = n*3
n4 = n*4
n5 = n*5
n6 = n*6
n7 = n*7
n8 = n*8
n9 = n*9
n10 = n*10
print ("El calculo Uno es: ", n1)
print ("El calculo dos es: ", n2)
print ("El calculo tres es: ", n3)
print ("El calculo cuatro es: ", n4)
print ("El calculo cinco es: ", n5)
print ("El calculo seis es: ", n6)
print ("El calculo siete es: ", n7)
print ("El calculo ocho es: ", n8)
print ("El calculo nueve es: ", n9)
print ("El calculo diez es: ", n10)
| n1 = int
n2 = int
n3 = int
n4 = int
n5 = int
n6 = int
n7 = int
n8 = int
n9 = int
n = int(input('Digite un Numero: '))
n1 = n * 1
n2 = n * 2
n3 = n * 3
n4 = n * 4
n5 = n * 5
n6 = n * 6
n7 = n * 7
n8 = n * 8
n9 = n * 9
n10 = n * 10
print('El calculo Uno es: ', n1)
print('El calculo dos es: ', n2)
print('El calculo tres es: ', n3)
print('El calculo cuatro es: ', n4)
print('El calculo cinco es: ', n5)
print('El calculo seis es: ', n6)
print('El calculo siete es: ', n7)
print('El calculo ocho es: ', n8)
print('El calculo nueve es: ', n9)
print('El calculo diez es: ', n10) |
# QUICK SORT
# BEST: O(nlogn) time, O(logn) space
# AVERAGE: O(nlogn) time, O(logn) space
# WORST: O(n^2) time, O(logn) space
def quickSort(array):
# Write your code here.
partition(array, 0, len(array) - 1)
return array
def partition(array, low, high):
if low < high:
print("Inside partition")
pivot = quickSortHelper(array, low, high)
print("low",low,"high",high,"pivot",pivot)
partition(array, low, pivot - 1)
partition(array, pivot + 1, high)
def quickSortHelper(array, low, high):
print("Quicksorthelper")
pivot = array[low]
left = low + 1
right = high
while right >= left:
if array[left] > pivot and array[right] < pivot:
swap(array, left, right)
left += 1
right -= 1
elif array[left] <= pivot:
left += 1
elif array[right] >= pivot:
right -= 1
swap(array, low, right)
return right
def swap(array, one, two):
array[one], array[two] = array[two], array[one]
# BEST: O(nlogn) time, O(logn) space
# AVERAGE: O(nlogn) time, O(logn) space
# WORST: O(n^2) time, O(logn) space
def quickSort(array):
# Write your code here.
quickSortHelper(array, 0, len(array) - 1)
return array
def quickSortHelper(array, low, high):
print("Quicksorthelper")
if low >= high:
return
pivot = array[low]
left = low + 1
right = high
while right >= left:
if array[left] > pivot and array[right] < pivot:
swap(array, left, right)
if array[left] <= pivot:
left += 1
if array[right] >= pivot:
right -= 1
swap(array, low, right)
leftSubArrayIsSmaller = right - 1 - low < high - (right + 1)
if leftSubArrayIsSmaller:
quickSortHelper(array, low, right - 1)
quickSortHelper(array, right + 1, high)
else:
quickSortHelper(array, right + 1, high)
quickSortHelper(array, low, right - 1)
def swap(array, one, two):
array[one], array[two] = array[two], array[one]
| def quick_sort(array):
partition(array, 0, len(array) - 1)
return array
def partition(array, low, high):
if low < high:
print('Inside partition')
pivot = quick_sort_helper(array, low, high)
print('low', low, 'high', high, 'pivot', pivot)
partition(array, low, pivot - 1)
partition(array, pivot + 1, high)
def quick_sort_helper(array, low, high):
print('Quicksorthelper')
pivot = array[low]
left = low + 1
right = high
while right >= left:
if array[left] > pivot and array[right] < pivot:
swap(array, left, right)
left += 1
right -= 1
elif array[left] <= pivot:
left += 1
elif array[right] >= pivot:
right -= 1
swap(array, low, right)
return right
def swap(array, one, two):
(array[one], array[two]) = (array[two], array[one])
def quick_sort(array):
quick_sort_helper(array, 0, len(array) - 1)
return array
def quick_sort_helper(array, low, high):
print('Quicksorthelper')
if low >= high:
return
pivot = array[low]
left = low + 1
right = high
while right >= left:
if array[left] > pivot and array[right] < pivot:
swap(array, left, right)
if array[left] <= pivot:
left += 1
if array[right] >= pivot:
right -= 1
swap(array, low, right)
left_sub_array_is_smaller = right - 1 - low < high - (right + 1)
if leftSubArrayIsSmaller:
quick_sort_helper(array, low, right - 1)
quick_sort_helper(array, right + 1, high)
else:
quick_sort_helper(array, right + 1, high)
quick_sort_helper(array, low, right - 1)
def swap(array, one, two):
(array[one], array[two]) = (array[two], array[one]) |
#!/usr/bin/python3
def list_division(my_list_1, my_list_2, list_length):
"divides element by element 2 lists"
i = result = 0
list = []
for i in range(list_length):
try:
result = (my_list_1[i] / my_list_2[i])
except TypeError:
result = 0
print("wrong type")
except ZeroDivisionError:
result = 0
print("division by 0")
except IndexError:
result = 0
print("out of range")
finally:
list.append(result)
return list
| def list_division(my_list_1, my_list_2, list_length):
"""divides element by element 2 lists"""
i = result = 0
list = []
for i in range(list_length):
try:
result = my_list_1[i] / my_list_2[i]
except TypeError:
result = 0
print('wrong type')
except ZeroDivisionError:
result = 0
print('division by 0')
except IndexError:
result = 0
print('out of range')
finally:
list.append(result)
return list |
"""
Given an array of values, determine whether a subset of the array adds up to a target
sum.
This problem is NP-Complete. However, it can be solved in pseudo-polynomial time, as
shown below. Pseudo-polynomial means that the complexity is determined by the actual
value of the input (in this case, the target number) and not the length of the input.
Even if there are few elements in the array, if the target value is large, this solution
is infeasible.
"""
def _preprocess(arr, target):
"""
Initializes a table which will store subset sums obtainable by the elements that
have been previous considered.
"""
result = [[False] * (target + 1) for _ in range(len(arr) + 1)]
result[0][0] = True
# Go through each element in the array, and update the table with all the new
# values that can now be attained through its inclusion.
for i, _ in enumerate(arr):
previous = result[i]
current = result[i + 1]
for value in range(target + 1):
# A dynamic value is one that can obtained by adding a previously attainable
# value to the current value.
dynamic_value = value - arr[i]
if previous[value] or (dynamic_value >= 0 and previous[dynamic_value]):
current[value] = True
return result
def dynamic_subset_sum(arr, target):
"""
time: O(nm)
space: O(nm)
where m == target and n is the length of the array
"""
arr.sort()
table = _preprocess(arr, target)
# The target value must be true on the final row, if it is attainable.
if not table[-1][-1]:
return False
result = []
value = target
row = len(arr)
# Gather the values that add up to the sum. If the desired value is True on the
# current row, but unattainable in the previous, then the element associated with
# the current row must be necessary for attaining the target sum.
while row > 0:
if not table[row - 1][value]:
result.append(arr[row - 1])
value -= arr[row - 1]
row -= 1
return result
| """
Given an array of values, determine whether a subset of the array adds up to a target
sum.
This problem is NP-Complete. However, it can be solved in pseudo-polynomial time, as
shown below. Pseudo-polynomial means that the complexity is determined by the actual
value of the input (in this case, the target number) and not the length of the input.
Even if there are few elements in the array, if the target value is large, this solution
is infeasible.
"""
def _preprocess(arr, target):
"""
Initializes a table which will store subset sums obtainable by the elements that
have been previous considered.
"""
result = [[False] * (target + 1) for _ in range(len(arr) + 1)]
result[0][0] = True
for (i, _) in enumerate(arr):
previous = result[i]
current = result[i + 1]
for value in range(target + 1):
dynamic_value = value - arr[i]
if previous[value] or (dynamic_value >= 0 and previous[dynamic_value]):
current[value] = True
return result
def dynamic_subset_sum(arr, target):
"""
time: O(nm)
space: O(nm)
where m == target and n is the length of the array
"""
arr.sort()
table = _preprocess(arr, target)
if not table[-1][-1]:
return False
result = []
value = target
row = len(arr)
while row > 0:
if not table[row - 1][value]:
result.append(arr[row - 1])
value -= arr[row - 1]
row -= 1
return result |
print('How old are you?') #ask the age
my_Age = input() # input age
if int(my_Age) < 18: # age comparision
print('You are not on age')
elif int(my_Age) >= 18:
print('You are on age')
if int(my_Age) >= 100:
print('You are a vampire or maybe inmortal')
if int(my_Age) >= 500:
print('You are inmortal')
while int(my_Age) < 18: # annoying part
print('HAHA You cant buy beer!!!')
my_Age = int(my_Age) + 1
else:
print('You are not human then!')
# I left reading the book in chapter 2 | 'Break Stataments' | print('How old are you?')
my__age = input()
if int(my_Age) < 18:
print('You are not on age')
elif int(my_Age) >= 18:
print('You are on age')
if int(my_Age) >= 100:
print('You are a vampire or maybe inmortal')
if int(my_Age) >= 500:
print('You are inmortal')
while int(my_Age) < 18:
print('HAHA You cant buy beer!!!')
my__age = int(my_Age) + 1
else:
print('You are not human then!') |
# https://github.com/tensorflow/tensorflow/issues/2169
# MAX Unpooling in tensorflow
# Solution from fabianbormann:
# Limitations:
# 1. //, argmax run ONLY on GPUs.
def unravel_argmax(argmax, shape):
output_list = []
output_list.append(argmax // (shape[2] * shape[3]))
output_list.append(argmax % (shape[2] * shape[3]) // shape[3])
return tf.stack(output_list)
def unpool_layer2x2(x, raveled_argmax, out_shape):
argmax = unravel_argmax(raveled_argmax, tf.to_int64(out_shape))
output = tf.zeros([out_shape[1], out_shape[2], out_shape[3]])
height = tf.shape(output)[0]
width = tf.shape(output)[1]
channels = tf.shape(output)[2]
t1 = tf.to_int64(tf.range(channels))
t1 = tf.tile(t1, [((width + 1) // 2) * ((height + 1) // 2)])
t1 = tf.reshape(t1, [-1, channels])
t1 = tf.transpose(t1, perm=[1, 0])
t1 = tf.reshape(t1, [channels, (height + 1) // 2, (width + 1) // 2, 1])
t2 = tf.squeeze(argmax)
t2 = tf.stack((t2[0], t2[1]), axis=0)
t2 = tf.transpose(t2, perm=[3, 1, 2, 0])
t = tf.concat([t2, t1], 3)
indices = tf.reshape(t, [((height + 1) // 2) * ((width + 1) // 2) * channels, 3])
x1 = tf.squeeze(x)
x1 = tf.reshape(x1, [-1, channels])
x1 = tf.transpose(x1, perm=[1, 0])
values = tf.reshape(x1, [-1])
delta = tf.SparseTensor(indices, values, tf.to_int64(tf.shape(output)))
return tf.expand_dims(tf.sparse_tensor_to_dense(tf.sparse_reorder(delta)), 0)
# test max unpooling solution from fabianbormann
x = tf.placeholder(tf.float32, shape=(1, None, None, None))
pool_1, argmax_1 = tf.nn.max_pool_with_argmax(x, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME', name='pool1')
pool_2, argmax_2 = tf.nn.max_pool_with_argmax(pool_1, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME', name='pool1')
pool_3, argmax_3 = tf.nn.max_pool_with_argmax(pool_2, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME', name='pool1')
pool_4, argmax_4 = tf.nn.max_pool_with_argmax(pool_3, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME', name='pool1')
pool_5, argmax_5 = tf.nn.max_pool_with_argmax(pool_4, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME', name='pool1')
unpool_5 = unpool_layer2x2(pool_5, argmax_5, tf.shape(pool_4))
unpool_4 = unpool_layer2x2(unpool_5, argmax_4, tf.shape(pool_3))
unpool_3 = unpool_layer2x2(unpool_4, argmax_3, tf.shape(pool_2))
unpool_2 = unpool_layer2x2(unpool_3, argmax_2, tf.shape(pool_1))
unpool_1 = unpool_layer2x2(unpool_2, argmax_1, tf.shape(x))
session = tf.InteractiveSession()
session.run(tf.global_variables_initializer())
image = np.float32(cv2.imread('../data/dressthuy.JPG'))
tests = [
pool_1.eval(feed_dict={x: [image]}),
pool_2.eval(feed_dict={x: [image]}),
pool_3.eval(feed_dict={x: [image]}),
pool_4.eval(feed_dict={x: [image]}),
pool_5.eval(feed_dict={x: [image]}),
unpool_5.eval(feed_dict={x: [image]}),
unpool_4.eval(feed_dict={x: [image]}),
unpool_3.eval(feed_dict={x: [image]}),
unpool_2.eval(feed_dict={x: [image]}),
unpool_1.eval(feed_dict={x: [image]})
]
session.close()
for test in tests:
print(test.shape)
for test in tests:
plt.figure()
plt.imshow(np.uint8(test[0]), interpolation='none')
plt.show()
| def unravel_argmax(argmax, shape):
output_list = []
output_list.append(argmax // (shape[2] * shape[3]))
output_list.append(argmax % (shape[2] * shape[3]) // shape[3])
return tf.stack(output_list)
def unpool_layer2x2(x, raveled_argmax, out_shape):
argmax = unravel_argmax(raveled_argmax, tf.to_int64(out_shape))
output = tf.zeros([out_shape[1], out_shape[2], out_shape[3]])
height = tf.shape(output)[0]
width = tf.shape(output)[1]
channels = tf.shape(output)[2]
t1 = tf.to_int64(tf.range(channels))
t1 = tf.tile(t1, [(width + 1) // 2 * ((height + 1) // 2)])
t1 = tf.reshape(t1, [-1, channels])
t1 = tf.transpose(t1, perm=[1, 0])
t1 = tf.reshape(t1, [channels, (height + 1) // 2, (width + 1) // 2, 1])
t2 = tf.squeeze(argmax)
t2 = tf.stack((t2[0], t2[1]), axis=0)
t2 = tf.transpose(t2, perm=[3, 1, 2, 0])
t = tf.concat([t2, t1], 3)
indices = tf.reshape(t, [(height + 1) // 2 * ((width + 1) // 2) * channels, 3])
x1 = tf.squeeze(x)
x1 = tf.reshape(x1, [-1, channels])
x1 = tf.transpose(x1, perm=[1, 0])
values = tf.reshape(x1, [-1])
delta = tf.SparseTensor(indices, values, tf.to_int64(tf.shape(output)))
return tf.expand_dims(tf.sparse_tensor_to_dense(tf.sparse_reorder(delta)), 0)
x = tf.placeholder(tf.float32, shape=(1, None, None, None))
(pool_1, argmax_1) = tf.nn.max_pool_with_argmax(x, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME', name='pool1')
(pool_2, argmax_2) = tf.nn.max_pool_with_argmax(pool_1, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME', name='pool1')
(pool_3, argmax_3) = tf.nn.max_pool_with_argmax(pool_2, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME', name='pool1')
(pool_4, argmax_4) = tf.nn.max_pool_with_argmax(pool_3, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME', name='pool1')
(pool_5, argmax_5) = tf.nn.max_pool_with_argmax(pool_4, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME', name='pool1')
unpool_5 = unpool_layer2x2(pool_5, argmax_5, tf.shape(pool_4))
unpool_4 = unpool_layer2x2(unpool_5, argmax_4, tf.shape(pool_3))
unpool_3 = unpool_layer2x2(unpool_4, argmax_3, tf.shape(pool_2))
unpool_2 = unpool_layer2x2(unpool_3, argmax_2, tf.shape(pool_1))
unpool_1 = unpool_layer2x2(unpool_2, argmax_1, tf.shape(x))
session = tf.InteractiveSession()
session.run(tf.global_variables_initializer())
image = np.float32(cv2.imread('../data/dressthuy.JPG'))
tests = [pool_1.eval(feed_dict={x: [image]}), pool_2.eval(feed_dict={x: [image]}), pool_3.eval(feed_dict={x: [image]}), pool_4.eval(feed_dict={x: [image]}), pool_5.eval(feed_dict={x: [image]}), unpool_5.eval(feed_dict={x: [image]}), unpool_4.eval(feed_dict={x: [image]}), unpool_3.eval(feed_dict={x: [image]}), unpool_2.eval(feed_dict={x: [image]}), unpool_1.eval(feed_dict={x: [image]})]
session.close()
for test in tests:
print(test.shape)
for test in tests:
plt.figure()
plt.imshow(np.uint8(test[0]), interpolation='none')
plt.show() |
#Task No. 02
print('3rd graph')
graph_3 = {7:[11,8],2:[],3:[8,10],11:[2,9,10],5:[11],9:[],8:[9]}
keys_3 = list(graph_3.keys())
##
##for i in range(len(keys_3)):
## temp = graph_3.get(keys_3[i])
## print(str(keys_3[i]) + ' is connected with ' + str(temp) + ' and has degree of ' + str(len(temp)))
for i in graph_3:
In = 0;
for j in graph_3:
if (i in graph_3[j]):
In = In + 1
print(i, ' is connected with ', str(graph_3[i]),' and has out-degree ',str(len(graph_3[i])),' and in-degree ',str(In))
graph_4 = {'A':['B'],'B':['C','D','E'],'C':['E'],'D':['E'],'E':['F'],'F':[],'G':['D']}
keys_4 = list(graph_4.keys())
##for i in range(len(keys_4)):
## temp = graph_4.get(keys_4[i])
## print(str(keys_4[i]) + ' is connected with ' + str(temp) + ' and has degree of ' + str(len(temp)))
print('4th graph')
for i in graph_4:
In = 0;
for j in graph_4:
if (i in graph_4[j]):
In = In + 1
print(i, ' is connected with ', str(graph_4[i]),' and has out-degree ',str(len(graph_4[i])),' and in-degree ',str(In))
| print('3rd graph')
graph_3 = {7: [11, 8], 2: [], 3: [8, 10], 11: [2, 9, 10], 5: [11], 9: [], 8: [9]}
keys_3 = list(graph_3.keys())
for i in graph_3:
in = 0
for j in graph_3:
if i in graph_3[j]:
in = In + 1
print(i, ' is connected with ', str(graph_3[i]), ' and has out-degree ', str(len(graph_3[i])), ' and in-degree ', str(In))
graph_4 = {'A': ['B'], 'B': ['C', 'D', 'E'], 'C': ['E'], 'D': ['E'], 'E': ['F'], 'F': [], 'G': ['D']}
keys_4 = list(graph_4.keys())
print('4th graph')
for i in graph_4:
in = 0
for j in graph_4:
if i in graph_4[j]:
in = In + 1
print(i, ' is connected with ', str(graph_4[i]), ' and has out-degree ', str(len(graph_4[i])), ' and in-degree ', str(In)) |
print('Hello World')
name = input('Please enter your name: ')
print('Welcome', name)
input1 = int(input('Please enter a number: '))
input2 = int(input('Please enter another number: '))
value = input1 + input2
print(f'The result of {input1} + {input2} is', value)
print('The type of the value is', type(value))
input_string1 = input('Please enter a string: ')
input_string2 = input('Please enter another string: ')
value = input_string1 + input_string2
print('The new value is', value)
print('The type of the value is now', type(value))
title = 'Data Processing App Version' + str(1.0)
print(f'The title of this app is {title}')
user = None
print('user:', user)
print('user is None:', user is None)
print('user is not None:', user is not None)
print('The type of the user', type(user))
| print('Hello World')
name = input('Please enter your name: ')
print('Welcome', name)
input1 = int(input('Please enter a number: '))
input2 = int(input('Please enter another number: '))
value = input1 + input2
print(f'The result of {input1} + {input2} is', value)
print('The type of the value is', type(value))
input_string1 = input('Please enter a string: ')
input_string2 = input('Please enter another string: ')
value = input_string1 + input_string2
print('The new value is', value)
print('The type of the value is now', type(value))
title = 'Data Processing App Version' + str(1.0)
print(f'The title of this app is {title}')
user = None
print('user:', user)
print('user is None:', user is None)
print('user is not None:', user is not None)
print('The type of the user', type(user)) |
class Solution:
def maxProfit(self, prices, fee):
N = len(prices)
if N < 2:
return 0
ans = 0
minimum = prices[0]
for i in range(1, N):
if prices[i] < minimum:
minimum = prices[i]
elif prices[i] > minimum + fee:
ans += prices[i] - fee - minimum
minimum = prices[i] - fee
return ans
| class Solution:
def max_profit(self, prices, fee):
n = len(prices)
if N < 2:
return 0
ans = 0
minimum = prices[0]
for i in range(1, N):
if prices[i] < minimum:
minimum = prices[i]
elif prices[i] > minimum + fee:
ans += prices[i] - fee - minimum
minimum = prices[i] - fee
return ans |
ARGUMENT_PROCESS_NAME = 'process_name'
ARGUMENT_FLOW_NAME = 'flow_name'
ARGUMENT_STEP_NAME = 'step_name'
ARGUMENT_TIMEPERIOD = 'timeperiod'
ARGUMENT_START_TIMEPERIOD = 'start_timeperiod'
ARGUMENT_END_TIMEPERIOD = 'end_timeperiod'
ARGUMENT_UNIT_OF_WORK_TYPE = 'unit_of_work_type' # whether the unit_of_work is TYPE_MANAGED or TYPE_FREERUN
# Argument is present in uow.arguments dictionary
ARGUMENT_RUN_MODE = 'run_mode'
RUN_MODE_RUN_ONE = 'run_mode_run_one'
RUN_MODE_RUN_FROM = 'run_mode_run_from'
STEP_NAME_START = 'start'
STEP_NAME_FINISH = 'finish'
COLLECTION_STEP = 'step'
COLLECTION_FLOW = 'flow'
SECONDS_IN_CENTURY = 6108600000
| argument_process_name = 'process_name'
argument_flow_name = 'flow_name'
argument_step_name = 'step_name'
argument_timeperiod = 'timeperiod'
argument_start_timeperiod = 'start_timeperiod'
argument_end_timeperiod = 'end_timeperiod'
argument_unit_of_work_type = 'unit_of_work_type'
argument_run_mode = 'run_mode'
run_mode_run_one = 'run_mode_run_one'
run_mode_run_from = 'run_mode_run_from'
step_name_start = 'start'
step_name_finish = 'finish'
collection_step = 'step'
collection_flow = 'flow'
seconds_in_century = 6108600000 |
class Plot(object):
def __init__(self):
pass
def __call__(self):
pass
| class Plot(object):
def __init__(self):
pass
def __call__(self):
pass |
#
# PySNMP MIB module EQLEXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EQLEXT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:05:18 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
eqlExt, = mibBuilder.importSymbols("APENT-MIB", "eqlExt")
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion, ValueSizeConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion", "ValueSizeConstraint", "ValueRangeConstraint")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Gauge32, ObjectIdentity, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, MibIdentifier, NotificationType, ModuleIdentity, Unsigned32, Counter64, Bits, iso, Counter32, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "ObjectIdentity", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "MibIdentifier", "NotificationType", "ModuleIdentity", "Unsigned32", "Counter64", "Bits", "iso", "Counter32", "TimeTicks")
DisplayString, TextualConvention, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention", "RowStatus")
apEqlExtMib = ModuleIdentity((1, 3, 6, 1, 4, 1, 2467, 1, 42, 1))
if mibBuilder.loadTexts: apEqlExtMib.setLastUpdated('9710092000Z')
if mibBuilder.loadTexts: apEqlExtMib.setOrganization('ArrowPoint Communications Inc.')
if mibBuilder.loadTexts: apEqlExtMib.setContactInfo(' Postal: ArrowPoint Communications Inc. 50 Nagog Park Acton, Massachusetts 01720 Tel: +1 978-206-3000 option 1 E-Mail: support@arrowpoint.com')
if mibBuilder.loadTexts: apEqlExtMib.setDescription('The MIB module used to describe the ArrowPoint Communications (E)xtension (Q)ualification (L)ists')
apEqlTable = MibTable((1, 3, 6, 1, 4, 1, 2467, 1, 42, 2), )
if mibBuilder.loadTexts: apEqlTable.setStatus('current')
if mibBuilder.loadTexts: apEqlTable.setDescription('A list of extension qualifier lists')
apEqlEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2467, 1, 42, 2, 1), ).setIndexNames((0, "EQLEXT-MIB", "apEqlName"))
if mibBuilder.loadTexts: apEqlEntry.setStatus('current')
if mibBuilder.loadTexts: apEqlEntry.setDescription('A group of information uniquely identifying an EQL. One entry exists for each EQL')
apEqlName = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 42, 2, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 31))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: apEqlName.setStatus('current')
if mibBuilder.loadTexts: apEqlName.setDescription('The name of the EQL')
apEqlDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 42, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: apEqlDescription.setStatus('current')
if mibBuilder.loadTexts: apEqlDescription.setDescription('An EQL description')
apEqlStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 42, 2, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: apEqlStatus.setStatus('current')
if mibBuilder.loadTexts: apEqlStatus.setDescription('Status entry for this row ')
apEqlExtTable = MibTable((1, 3, 6, 1, 4, 1, 2467, 1, 42, 3), )
if mibBuilder.loadTexts: apEqlExtTable.setStatus('current')
if mibBuilder.loadTexts: apEqlExtTable.setDescription('A list of extensions associated with an EQL')
apEqlExtEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2467, 1, 42, 3, 1), ).setIndexNames((0, "EQLEXT-MIB", "apEqlName"), (0, "EQLEXT-MIB", "apEqlExtName"))
if mibBuilder.loadTexts: apEqlExtEntry.setStatus('current')
if mibBuilder.loadTexts: apEqlExtEntry.setDescription('Information uniquely identifying an extension within an EQL')
apEqlExtName = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 42, 3, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 7))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: apEqlExtName.setStatus('current')
if mibBuilder.loadTexts: apEqlExtName.setDescription('The extension')
apEqlExtDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 42, 3, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 64))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: apEqlExtDescription.setStatus('current')
if mibBuilder.loadTexts: apEqlExtDescription.setDescription('A description of this extension')
apEqlExtStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 2467, 1, 42, 3, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: apEqlExtStatus.setStatus('current')
if mibBuilder.loadTexts: apEqlExtStatus.setDescription('Status entry for this row ')
mibBuilder.exportSymbols("EQLEXT-MIB", apEqlExtStatus=apEqlExtStatus, apEqlExtDescription=apEqlExtDescription, apEqlExtMib=apEqlExtMib, apEqlName=apEqlName, apEqlExtTable=apEqlExtTable, apEqlDescription=apEqlDescription, apEqlExtName=apEqlExtName, apEqlEntry=apEqlEntry, apEqlTable=apEqlTable, PYSNMP_MODULE_ID=apEqlExtMib, apEqlStatus=apEqlStatus, apEqlExtEntry=apEqlExtEntry)
| (eql_ext,) = mibBuilder.importSymbols('APENT-MIB', 'eqlExt')
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, constraints_union, value_size_constraint, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'SingleValueConstraint', 'ConstraintsUnion', 'ValueSizeConstraint', 'ValueRangeConstraint')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(gauge32, object_identity, ip_address, mib_scalar, mib_table, mib_table_row, mib_table_column, integer32, mib_identifier, notification_type, module_identity, unsigned32, counter64, bits, iso, counter32, time_ticks) = mibBuilder.importSymbols('SNMPv2-SMI', 'Gauge32', 'ObjectIdentity', 'IpAddress', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Integer32', 'MibIdentifier', 'NotificationType', 'ModuleIdentity', 'Unsigned32', 'Counter64', 'Bits', 'iso', 'Counter32', 'TimeTicks')
(display_string, textual_convention, row_status) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention', 'RowStatus')
ap_eql_ext_mib = module_identity((1, 3, 6, 1, 4, 1, 2467, 1, 42, 1))
if mibBuilder.loadTexts:
apEqlExtMib.setLastUpdated('9710092000Z')
if mibBuilder.loadTexts:
apEqlExtMib.setOrganization('ArrowPoint Communications Inc.')
if mibBuilder.loadTexts:
apEqlExtMib.setContactInfo(' Postal: ArrowPoint Communications Inc. 50 Nagog Park Acton, Massachusetts 01720 Tel: +1 978-206-3000 option 1 E-Mail: support@arrowpoint.com')
if mibBuilder.loadTexts:
apEqlExtMib.setDescription('The MIB module used to describe the ArrowPoint Communications (E)xtension (Q)ualification (L)ists')
ap_eql_table = mib_table((1, 3, 6, 1, 4, 1, 2467, 1, 42, 2))
if mibBuilder.loadTexts:
apEqlTable.setStatus('current')
if mibBuilder.loadTexts:
apEqlTable.setDescription('A list of extension qualifier lists')
ap_eql_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2467, 1, 42, 2, 1)).setIndexNames((0, 'EQLEXT-MIB', 'apEqlName'))
if mibBuilder.loadTexts:
apEqlEntry.setStatus('current')
if mibBuilder.loadTexts:
apEqlEntry.setDescription('A group of information uniquely identifying an EQL. One entry exists for each EQL')
ap_eql_name = mib_table_column((1, 3, 6, 1, 4, 1, 2467, 1, 42, 2, 1, 1), display_string().subtype(subtypeSpec=value_size_constraint(1, 31))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
apEqlName.setStatus('current')
if mibBuilder.loadTexts:
apEqlName.setDescription('The name of the EQL')
ap_eql_description = mib_table_column((1, 3, 6, 1, 4, 1, 2467, 1, 42, 2, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
apEqlDescription.setStatus('current')
if mibBuilder.loadTexts:
apEqlDescription.setDescription('An EQL description')
ap_eql_status = mib_table_column((1, 3, 6, 1, 4, 1, 2467, 1, 42, 2, 1, 3), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
apEqlStatus.setStatus('current')
if mibBuilder.loadTexts:
apEqlStatus.setDescription('Status entry for this row ')
ap_eql_ext_table = mib_table((1, 3, 6, 1, 4, 1, 2467, 1, 42, 3))
if mibBuilder.loadTexts:
apEqlExtTable.setStatus('current')
if mibBuilder.loadTexts:
apEqlExtTable.setDescription('A list of extensions associated with an EQL')
ap_eql_ext_entry = mib_table_row((1, 3, 6, 1, 4, 1, 2467, 1, 42, 3, 1)).setIndexNames((0, 'EQLEXT-MIB', 'apEqlName'), (0, 'EQLEXT-MIB', 'apEqlExtName'))
if mibBuilder.loadTexts:
apEqlExtEntry.setStatus('current')
if mibBuilder.loadTexts:
apEqlExtEntry.setDescription('Information uniquely identifying an extension within an EQL')
ap_eql_ext_name = mib_table_column((1, 3, 6, 1, 4, 1, 2467, 1, 42, 3, 1, 1), display_string().subtype(subtypeSpec=value_size_constraint(1, 7))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
apEqlExtName.setStatus('current')
if mibBuilder.loadTexts:
apEqlExtName.setDescription('The extension')
ap_eql_ext_description = mib_table_column((1, 3, 6, 1, 4, 1, 2467, 1, 42, 3, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(1, 64))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
apEqlExtDescription.setStatus('current')
if mibBuilder.loadTexts:
apEqlExtDescription.setDescription('A description of this extension')
ap_eql_ext_status = mib_table_column((1, 3, 6, 1, 4, 1, 2467, 1, 42, 3, 1, 3), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
apEqlExtStatus.setStatus('current')
if mibBuilder.loadTexts:
apEqlExtStatus.setDescription('Status entry for this row ')
mibBuilder.exportSymbols('EQLEXT-MIB', apEqlExtStatus=apEqlExtStatus, apEqlExtDescription=apEqlExtDescription, apEqlExtMib=apEqlExtMib, apEqlName=apEqlName, apEqlExtTable=apEqlExtTable, apEqlDescription=apEqlDescription, apEqlExtName=apEqlExtName, apEqlEntry=apEqlEntry, apEqlTable=apEqlTable, PYSNMP_MODULE_ID=apEqlExtMib, apEqlStatus=apEqlStatus, apEqlExtEntry=apEqlExtEntry) |
#Open file
file = open('inputs\input4.txt')
data = file.read().split('\n\n')
file.close()
#Clean input
dataClean = []
for x in data:
dataClean.append(x.split()) #Split with no argument splits on whitespace
#Solution 1
reqFields = ['byr','iyr','eyr','hgt','hcl','ecl','pid']
valid = 0
for passport in dataClean:
reqsMet = 0
for field in passport:
field = field.split(':')
if field[0] in reqFields:
reqsMet += 1
if reqsMet == 7:
valid += 1
print(valid)
#Solution 2
reqFields = ['byr','iyr','eyr','hgt','hcl','ecl','pid']
validEcl = ['amb','blu','brn','gry','grn','hzl','oth']
validHcl = '0123456789abcdef'
valid = 0
for passport in dataClean:
reqsMet = 0
for field in passport:
field = field.split(':')
if field[0] == reqFields[0]: #byr field
if int(field[1]) <= 2002 and int(field[1]) >= 1920:
reqsMet += 1
elif field[0] == reqFields[1]: #iyr field
if int(field[1]) <= 2020 and int(field[1]) >= 2010:
reqsMet += 1
elif field[0] == reqFields[2]: #eyr field
if int(field[1]) <= 2030 and int(field[1]) >= 2020:
reqsMet += 1
elif field[0] == reqFields[3]: #hgt field (sketchyy)
if 'cm' in field[1]:
field[1] = field[1].split('c')
elif 'in' in field[1]:
field[1] = field[1].split('i')
if field[1][1] == 'n':
if int(field[1][0]) <= 76 and (int(field[1][0]) >= 59):
reqsMet += 1
elif field[1][1] == 'm':
if int(field[1][0]) <= 193 and (int(field[1][0]) >= 150):
reqsMet += 1
elif field[0] == reqFields[4]: #hcl field
validHclChars = 0
for c in field[1][1:]:
if c in validHcl:
validHclChars += 1
if field[1][0] == '#' and (validHclChars == 6):
reqsMet += 1
elif field[0] == reqFields[5]: #ecl field
if field[1] in validEcl:
reqsMet += 1
elif field[0] == reqFields[6]: #pid field
if field[1].isnumeric() and (len(field[1]) == 9):
reqsMet += 1
if reqsMet == 7:
valid += 1
print(valid)
| file = open('inputs\\input4.txt')
data = file.read().split('\n\n')
file.close()
data_clean = []
for x in data:
dataClean.append(x.split())
req_fields = ['byr', 'iyr', 'eyr', 'hgt', 'hcl', 'ecl', 'pid']
valid = 0
for passport in dataClean:
reqs_met = 0
for field in passport:
field = field.split(':')
if field[0] in reqFields:
reqs_met += 1
if reqsMet == 7:
valid += 1
print(valid)
req_fields = ['byr', 'iyr', 'eyr', 'hgt', 'hcl', 'ecl', 'pid']
valid_ecl = ['amb', 'blu', 'brn', 'gry', 'grn', 'hzl', 'oth']
valid_hcl = '0123456789abcdef'
valid = 0
for passport in dataClean:
reqs_met = 0
for field in passport:
field = field.split(':')
if field[0] == reqFields[0]:
if int(field[1]) <= 2002 and int(field[1]) >= 1920:
reqs_met += 1
elif field[0] == reqFields[1]:
if int(field[1]) <= 2020 and int(field[1]) >= 2010:
reqs_met += 1
elif field[0] == reqFields[2]:
if int(field[1]) <= 2030 and int(field[1]) >= 2020:
reqs_met += 1
elif field[0] == reqFields[3]:
if 'cm' in field[1]:
field[1] = field[1].split('c')
elif 'in' in field[1]:
field[1] = field[1].split('i')
if field[1][1] == 'n':
if int(field[1][0]) <= 76 and int(field[1][0]) >= 59:
reqs_met += 1
elif field[1][1] == 'm':
if int(field[1][0]) <= 193 and int(field[1][0]) >= 150:
reqs_met += 1
elif field[0] == reqFields[4]:
valid_hcl_chars = 0
for c in field[1][1:]:
if c in validHcl:
valid_hcl_chars += 1
if field[1][0] == '#' and validHclChars == 6:
reqs_met += 1
elif field[0] == reqFields[5]:
if field[1] in validEcl:
reqs_met += 1
elif field[0] == reqFields[6]:
if field[1].isnumeric() and len(field[1]) == 9:
reqs_met += 1
if reqsMet == 7:
valid += 1
print(valid) |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
class Math():
def addition(value1, value2):
if not isinstance(value1, int) and not isinstance(value2, int):
return 'Invalid input'
else:
return value1 + value2
def soustraction (value1, value2):
if not isinstance(value1, int) and not isinstance(value2, int):
return 'Invalid input'
else:
return value1 - value2 | """
"""
class Math:
def addition(value1, value2):
if not isinstance(value1, int) and (not isinstance(value2, int)):
return 'Invalid input'
else:
return value1 + value2
def soustraction(value1, value2):
if not isinstance(value1, int) and (not isinstance(value2, int)):
return 'Invalid input'
else:
return value1 - value2 |
""" focli exceptions """
class FoliException(Exception):
""" Base exception """
def __init__(self, message):
self.message = message
class FoliStopNameException(FoliException):
""" Stop name error """
class FoliServerException(FoliException):
""" Stop name error """
class FoliParseDataError(FoliException):
""" Error parsing data """
class FoliTerminalException(FoliException):
""" Error getting terminal info """
| """ focli exceptions """
class Foliexception(Exception):
""" Base exception """
def __init__(self, message):
self.message = message
class Folistopnameexception(FoliException):
""" Stop name error """
class Foliserverexception(FoliException):
""" Stop name error """
class Foliparsedataerror(FoliException):
""" Error parsing data """
class Foliterminalexception(FoliException):
""" Error getting terminal info """ |
def get_input(file):
with open(file, 'rt', encoding='utf8') as f:
lines = [line.strip() for line in f]
p1_cars = get_player_cards(lines, 1)
p2_cars = get_player_cards(lines, 2)
return p1_cars, p2_cars
def get_player_cards(lines, player):
start = lines.index(f'Player {player}:') + 1
end = lines.index('')
if end < start:
end = len(lines)
cards = lines[start:end]
cards = list(map(lambda x: int(x), cards))
return cards
def play_round(p1_cards, p2_cards, round_):
print(f'-- Round {round_} --')
print(f"Player 1's deck: {p1_cards}") # The first position in the deck is the top card
print(f"Player 2's deck: {p2_cards}")
p1_card = p1_cards.pop(0)
print(f"Player 1 plays: {p1_card}")
p2_card = p2_cards.pop(0)
print(f"Player 2 plays: {p2_card}")
if p1_card > p2_card:
print("Player 1 wins the round!\n")
p1_cards.append(p1_card)
p1_cards.append(p2_card)
else:
print("Player 2 wins the round!\n")
p2_cards.append(p2_card)
p2_cards.append(p1_card)
def calculate_score(cards):
score = 0
for i, v in enumerate(cards):
score += v * (len(cards) - i)
return score
def main():
p1_cards, p2_cards = get_input('input.txt')
round_ = 1
while p1_cards and p2_cards:
play_round(p1_cards, p2_cards, round_)
round_ += 1
print("== Post-game results ==")
print(f"Player 1's deck: {p1_cards}")
print(f"Player 2's deck: {p2_cards}")
cards = p1_cards if p1_cards else p2_cards
score = calculate_score(cards)
print(f"\nThe final score is: {score}")
main() # The final score is: 33772 (correct)
| def get_input(file):
with open(file, 'rt', encoding='utf8') as f:
lines = [line.strip() for line in f]
p1_cars = get_player_cards(lines, 1)
p2_cars = get_player_cards(lines, 2)
return (p1_cars, p2_cars)
def get_player_cards(lines, player):
start = lines.index(f'Player {player}:') + 1
end = lines.index('')
if end < start:
end = len(lines)
cards = lines[start:end]
cards = list(map(lambda x: int(x), cards))
return cards
def play_round(p1_cards, p2_cards, round_):
print(f'-- Round {round_} --')
print(f"Player 1's deck: {p1_cards}")
print(f"Player 2's deck: {p2_cards}")
p1_card = p1_cards.pop(0)
print(f'Player 1 plays: {p1_card}')
p2_card = p2_cards.pop(0)
print(f'Player 2 plays: {p2_card}')
if p1_card > p2_card:
print('Player 1 wins the round!\n')
p1_cards.append(p1_card)
p1_cards.append(p2_card)
else:
print('Player 2 wins the round!\n')
p2_cards.append(p2_card)
p2_cards.append(p1_card)
def calculate_score(cards):
score = 0
for (i, v) in enumerate(cards):
score += v * (len(cards) - i)
return score
def main():
(p1_cards, p2_cards) = get_input('input.txt')
round_ = 1
while p1_cards and p2_cards:
play_round(p1_cards, p2_cards, round_)
round_ += 1
print('== Post-game results ==')
print(f"Player 1's deck: {p1_cards}")
print(f"Player 2's deck: {p2_cards}")
cards = p1_cards if p1_cards else p2_cards
score = calculate_score(cards)
print(f'\nThe final score is: {score}')
main() |
__all__ = [
"int_to_bytes",
"bytes_to_int",
"bytes_to_hex",
"hex_to_bytes"
]
def bytes_to_hex(src: bytes, with0x: bool = True, max_length: int = None) -> str:
if max_length is not None:
assert len(src) <= max_length, f"input bytes length is too long ({len(src)} > {max_length})"
res = src.hex()
if max_length is not None:
res = res.zfill(max_length)
if with0x:
res = "0x" + res
return res
def hex_to_bytes(src: str, length: int = None) -> bytes:
if src.startswith("0x"):
src = src[2:]
if length is not None:
src = src.lstrip("0")
assert len(src) <= length, f"input length is too long ({len(src)} > {length})"
if len(src) < length:
src = src.zfill(length)
return bytes.fromhex(src)
def int_to_bytes(x: int) -> bytes:
length = (x.bit_length() + 7) // 8
return x.to_bytes(length, "big")
def bytes_to_int(bs: bytes) -> int:
return int.from_bytes(bs, "big")
| __all__ = ['int_to_bytes', 'bytes_to_int', 'bytes_to_hex', 'hex_to_bytes']
def bytes_to_hex(src: bytes, with0x: bool=True, max_length: int=None) -> str:
if max_length is not None:
assert len(src) <= max_length, f'input bytes length is too long ({len(src)} > {max_length})'
res = src.hex()
if max_length is not None:
res = res.zfill(max_length)
if with0x:
res = '0x' + res
return res
def hex_to_bytes(src: str, length: int=None) -> bytes:
if src.startswith('0x'):
src = src[2:]
if length is not None:
src = src.lstrip('0')
assert len(src) <= length, f'input length is too long ({len(src)} > {length})'
if len(src) < length:
src = src.zfill(length)
return bytes.fromhex(src)
def int_to_bytes(x: int) -> bytes:
length = (x.bit_length() + 7) // 8
return x.to_bytes(length, 'big')
def bytes_to_int(bs: bytes) -> int:
return int.from_bytes(bs, 'big') |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Assignment 3 Binary Search Tree."""
class NullBinaryTreeNode(object):
"""Null object pattern for a BST."""
SINGLETON = None
def __new__(cls):
"""__new__."""
if NullBinaryTreeNode.SINGLETON is not None:
return NullBinaryTreeNode.SINGLETON
NullBinaryTreeNode.SINGLETON = super(
NullBinaryTreeNode, cls).__new__(cls)
return NullBinaryTreeNode.SINGLETON
def __init__(self):
"""__init__."""
pass
def __bool__(self):
"""__bool__."""
return False
def __nonzero__(self):
"""__nonzero__."""
return False
def __gt__(self, other):
"""__gt__."""
return False
def __lt__(self, other):
"""__lt__."""
return False
def __ge__(self, other):
"""__ge__."""
return False
def __le__(self, other):
"""__le__."""
return False
def __eq__(self, other):
"""__eq__."""
return False
def __ne__(self, other):
"""__ne__."""
return False
def __contains__(self, key):
"""__contains__."""
return False
def __getitem__(self, key):
"""__getitem__."""
raise KeyError("Element {K} not found".format(K=key))
@property
def parent(self):
"""parent."""
return NullBinaryTreeNode.SINGLETON
@property
def left(self):
"""left."""
return NullBinaryTreeNode.SINGLETON
@property
def right(self):
"""right."""
return NullBinaryTreeNode.SINGLETON
@parent.setter
def parent(self, other):
"""parent."""
return
@left.setter
def left(self, other):
"""left."""
return
@right.setter
def right(self, other):
"""right."""
return
def replace_child(self, child, replacement):
"""replace_child."""
return
def delete(self, key):
"""delete."""
raise KeyError("Element {K} not found".format(K=key))
def add(self, key, data):
"""add."""
return BinaryTreeNode(key=key, data=data)
def inorder(self):
"""inorder."""
return iter(())
def preorder(self):
"""preorder."""
return iter(())
def postorder(self):
"""postorder."""
return iter(())
def height(self, height=0):
"""height."""
return height
class BinaryTreeNode(object):
"""A BST Node."""
def __init__(
self,
data=None,
key=None,
left=NullBinaryTreeNode(),
right=NullBinaryTreeNode(),
parent=NullBinaryTreeNode()):
"""__init__."""
super(BinaryTreeNode, self).__init__()
self.key = key
self.data = data
self.left = left
self.right = right
self.parent = parent
def add(self, key, data):
"""add."""
if self == key:
self.data = data
elif self > key:
self.left = self.left.add(key, data)
self.left.parent = self
elif self < key:
self.right = self.right.add(key, data)
self.right.parent = self
return self
def inorder(self):
"""inorder."""
yield from self.left.inorder()
yield self.key, self.data
yield from self.right.inorder()
def postorder(self):
"""postorder."""
yield from self.left.postorder()
yield from self.right.postorder()
yield self.key, self.data
def preorder(self):
"""preorder."""
yield self.key, self.data
yield from self.left.preorder()
yield from self.right.preorder()
def height(self, height=-1):
"""height."""
height += 1
left_height = self.left.height(height)
right_height = self.right.height(height)
return max(left_height, right_height)
def __getitem__(self, key):
"""__getitem__."""
if self == key:
return self.data
elif self > key:
return self.left[key]
else:
return self.right[key]
def replace_child(self, child, replacement):
"""replace_child."""
if self.left is child:
self.left = replacement
else:
self.right = replacement
def delete(self, key):
"""delete."""
if self > key:
self.left.delete(key)
return self
if self < key:
self.right.delete(key)
return self
if self.left and self.right:
replacement = self.right.pop_minimum()
self.parent.replace_child(self, replacement)
replacement.parent = self.parent
if self.left is not replacement:
replacement.left = self.left
if self.right is not replacement.right:
replacement.right = self.right
return replacement
elif self.left and not self.right:
self.parent.replace_child(self, self.left)
self.left.parent = self.parent
return self.left
elif not self.left and self.right:
self.parent.replace_child(self, self.right)
self.right.parent = self.parent
return self.right
else:
self.parent.replace_child(self, self.right)
return self.right
def pop_minimum(self):
"""pop_minimum."""
if self.left:
return self.left.pop_minimum()
self.parent.replace_child(self, self.left)
self.right.parent = self.parent
return self
def __contains__(self, item):
"""__contains__."""
if self == item:
return True
if self < item:
return item in self.right
if self > item:
return item in self.left
def __eq__(self, other):
"""__eq__."""
if isinstance(other, BinaryTreeNode):
return self.key == other.key
return self.key == other
def __ne__(self, other):
"""__ne__."""
return not self == other
def __gt__(self, other):
"""__gt__."""
if isinstance(other, BinaryTreeNode):
return self.key > other.key
return self.key > other
def __lt__(self, other):
"""__lt__."""
if isinstance(other, BinaryTreeNode):
return self.key < other.key
return self.key < other
def __ge__(self, other):
"""__ge__."""
if isinstance(other, BinaryTreeNode):
return self.key >= other.key
return self.key >= other
def __le__(self, other):
"""__le__."""
if isinstance(other, BinaryTreeNode):
return self.key < other.key
return self.key <= other
class BinarySearchTreeDict(object):
"""Binary Search Tree Dictionary."""
def __init__(self):
"""__init__."""
super(BinarySearchTreeDict, self).__init__()
self.root = NullBinaryTreeNode()
self.size = 0
@property
def height(self):
"""height."""
return self.root.height()
def inorder_keys(self):
"""inorder_keys."""
return (k for k, _ in self.items())
def postorder_keys(self):
"""postorder_keys."""
return (k for k, _ in self.root.postorder())
def preorder_keys(self):
"""preorder_keys."""
return (k for k, _ in self.root.preorder())
def items(self):
"""items."""
return self.root.inorder()
def __getitem__(self, key):
"""__getitem__."""
return self.root[key]
def __setitem__(self, key, value):
"""__setitem__."""
if key not in self:
self.size += 1
self.root = self.root.add(key, value)
def __delitem__(self, key):
"""__delitem__."""
self.root = self.root.delete(key)
self.size -= 1
def __contains__(self, key):
"""__contains__."""
return key in self.root
def __len__(self):
"""__len__."""
return self.size
def __str__(self):
"""__str__."""
return (
"Inorder: " + ", ".join(str(k) for k in self.inorder_keys()) +
"\n" +
"Preorder: " + ", ".join(str(k) for k in self.preorder_keys())
)
def __repr__(self):
"""__repr__."""
return str(self)
def display(self):
"""display."""
print(self)
| """Assignment 3 Binary Search Tree."""
class Nullbinarytreenode(object):
"""Null object pattern for a BST."""
singleton = None
def __new__(cls):
"""__new__."""
if NullBinaryTreeNode.SINGLETON is not None:
return NullBinaryTreeNode.SINGLETON
NullBinaryTreeNode.SINGLETON = super(NullBinaryTreeNode, cls).__new__(cls)
return NullBinaryTreeNode.SINGLETON
def __init__(self):
"""__init__."""
pass
def __bool__(self):
"""__bool__."""
return False
def __nonzero__(self):
"""__nonzero__."""
return False
def __gt__(self, other):
"""__gt__."""
return False
def __lt__(self, other):
"""__lt__."""
return False
def __ge__(self, other):
"""__ge__."""
return False
def __le__(self, other):
"""__le__."""
return False
def __eq__(self, other):
"""__eq__."""
return False
def __ne__(self, other):
"""__ne__."""
return False
def __contains__(self, key):
"""__contains__."""
return False
def __getitem__(self, key):
"""__getitem__."""
raise key_error('Element {K} not found'.format(K=key))
@property
def parent(self):
"""parent."""
return NullBinaryTreeNode.SINGLETON
@property
def left(self):
"""left."""
return NullBinaryTreeNode.SINGLETON
@property
def right(self):
"""right."""
return NullBinaryTreeNode.SINGLETON
@parent.setter
def parent(self, other):
"""parent."""
return
@left.setter
def left(self, other):
"""left."""
return
@right.setter
def right(self, other):
"""right."""
return
def replace_child(self, child, replacement):
"""replace_child."""
return
def delete(self, key):
"""delete."""
raise key_error('Element {K} not found'.format(K=key))
def add(self, key, data):
"""add."""
return binary_tree_node(key=key, data=data)
def inorder(self):
"""inorder."""
return iter(())
def preorder(self):
"""preorder."""
return iter(())
def postorder(self):
"""postorder."""
return iter(())
def height(self, height=0):
"""height."""
return height
class Binarytreenode(object):
"""A BST Node."""
def __init__(self, data=None, key=None, left=null_binary_tree_node(), right=null_binary_tree_node(), parent=null_binary_tree_node()):
"""__init__."""
super(BinaryTreeNode, self).__init__()
self.key = key
self.data = data
self.left = left
self.right = right
self.parent = parent
def add(self, key, data):
"""add."""
if self == key:
self.data = data
elif self > key:
self.left = self.left.add(key, data)
self.left.parent = self
elif self < key:
self.right = self.right.add(key, data)
self.right.parent = self
return self
def inorder(self):
"""inorder."""
yield from self.left.inorder()
yield (self.key, self.data)
yield from self.right.inorder()
def postorder(self):
"""postorder."""
yield from self.left.postorder()
yield from self.right.postorder()
yield (self.key, self.data)
def preorder(self):
"""preorder."""
yield (self.key, self.data)
yield from self.left.preorder()
yield from self.right.preorder()
def height(self, height=-1):
"""height."""
height += 1
left_height = self.left.height(height)
right_height = self.right.height(height)
return max(left_height, right_height)
def __getitem__(self, key):
"""__getitem__."""
if self == key:
return self.data
elif self > key:
return self.left[key]
else:
return self.right[key]
def replace_child(self, child, replacement):
"""replace_child."""
if self.left is child:
self.left = replacement
else:
self.right = replacement
def delete(self, key):
"""delete."""
if self > key:
self.left.delete(key)
return self
if self < key:
self.right.delete(key)
return self
if self.left and self.right:
replacement = self.right.pop_minimum()
self.parent.replace_child(self, replacement)
replacement.parent = self.parent
if self.left is not replacement:
replacement.left = self.left
if self.right is not replacement.right:
replacement.right = self.right
return replacement
elif self.left and (not self.right):
self.parent.replace_child(self, self.left)
self.left.parent = self.parent
return self.left
elif not self.left and self.right:
self.parent.replace_child(self, self.right)
self.right.parent = self.parent
return self.right
else:
self.parent.replace_child(self, self.right)
return self.right
def pop_minimum(self):
"""pop_minimum."""
if self.left:
return self.left.pop_minimum()
self.parent.replace_child(self, self.left)
self.right.parent = self.parent
return self
def __contains__(self, item):
"""__contains__."""
if self == item:
return True
if self < item:
return item in self.right
if self > item:
return item in self.left
def __eq__(self, other):
"""__eq__."""
if isinstance(other, BinaryTreeNode):
return self.key == other.key
return self.key == other
def __ne__(self, other):
"""__ne__."""
return not self == other
def __gt__(self, other):
"""__gt__."""
if isinstance(other, BinaryTreeNode):
return self.key > other.key
return self.key > other
def __lt__(self, other):
"""__lt__."""
if isinstance(other, BinaryTreeNode):
return self.key < other.key
return self.key < other
def __ge__(self, other):
"""__ge__."""
if isinstance(other, BinaryTreeNode):
return self.key >= other.key
return self.key >= other
def __le__(self, other):
"""__le__."""
if isinstance(other, BinaryTreeNode):
return self.key < other.key
return self.key <= other
class Binarysearchtreedict(object):
"""Binary Search Tree Dictionary."""
def __init__(self):
"""__init__."""
super(BinarySearchTreeDict, self).__init__()
self.root = null_binary_tree_node()
self.size = 0
@property
def height(self):
"""height."""
return self.root.height()
def inorder_keys(self):
"""inorder_keys."""
return (k for (k, _) in self.items())
def postorder_keys(self):
"""postorder_keys."""
return (k for (k, _) in self.root.postorder())
def preorder_keys(self):
"""preorder_keys."""
return (k for (k, _) in self.root.preorder())
def items(self):
"""items."""
return self.root.inorder()
def __getitem__(self, key):
"""__getitem__."""
return self.root[key]
def __setitem__(self, key, value):
"""__setitem__."""
if key not in self:
self.size += 1
self.root = self.root.add(key, value)
def __delitem__(self, key):
"""__delitem__."""
self.root = self.root.delete(key)
self.size -= 1
def __contains__(self, key):
"""__contains__."""
return key in self.root
def __len__(self):
"""__len__."""
return self.size
def __str__(self):
"""__str__."""
return 'Inorder: ' + ', '.join((str(k) for k in self.inorder_keys())) + '\n' + 'Preorder: ' + ', '.join((str(k) for k in self.preorder_keys()))
def __repr__(self):
"""__repr__."""
return str(self)
def display(self):
"""display."""
print(self) |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 3 11:19:30 2019
@author: DEVANSH JAIN
"""
x=input('Enter first number')
y=input('Second Number')
z=x+y
print(z) | """
Created on Tue Dec 3 11:19:30 2019
@author: DEVANSH JAIN
"""
x = input('Enter first number')
y = input('Second Number')
z = x + y
print(z) |
class Solution:
def longestPalindrome(self, s: str) -> str:
lst = []
for ch in s:
lst.append('#')
lst.append(ch)
lst.append('#')
S = ''.join(lst)
def helper(S):
mx = 0
n = len(S)
P = [0] * n
c = 0
r = 0
ans = ""
for i, ch in enumerate(S):
mirror = 2 * c - i
if i < r:
P[i] = min(P[mirror], r - i)
lo = i - (P[i] + 1)
hi = i + (P[i] + 1)
while lo >= 0 and hi < n and S[lo] == S[hi]:
lo -= 1
hi += 1
P[i] += 1
if i + P[i] > r:
r = i + P[i]
c = i
if P[i] > mx:
mx = P[i]
ans = S[i - P[i]:i + P[i] + 1]
return ans
return ''.join(ch for ch in helper(S) if ch != '#')
| class Solution:
def longest_palindrome(self, s: str) -> str:
lst = []
for ch in s:
lst.append('#')
lst.append(ch)
lst.append('#')
s = ''.join(lst)
def helper(S):
mx = 0
n = len(S)
p = [0] * n
c = 0
r = 0
ans = ''
for (i, ch) in enumerate(S):
mirror = 2 * c - i
if i < r:
P[i] = min(P[mirror], r - i)
lo = i - (P[i] + 1)
hi = i + (P[i] + 1)
while lo >= 0 and hi < n and (S[lo] == S[hi]):
lo -= 1
hi += 1
P[i] += 1
if i + P[i] > r:
r = i + P[i]
c = i
if P[i] > mx:
mx = P[i]
ans = S[i - P[i]:i + P[i] + 1]
return ans
return ''.join((ch for ch in helper(S) if ch != '#')) |
LOG_DIR = "/tmp/mylogdir"
def write_message(filename, message):
try:
path = os.path.join(LOG_DIR, filename)
with open(path, 'a') as writer:
writer.write(message)
except OSError as error:
print('Unable to write log message to {}: {}'.format(path, error))
| log_dir = '/tmp/mylogdir'
def write_message(filename, message):
try:
path = os.path.join(LOG_DIR, filename)
with open(path, 'a') as writer:
writer.write(message)
except OSError as error:
print('Unable to write log message to {}: {}'.format(path, error)) |
#!/usr/bin/env python3
n1 = int(input("Enter 1st subject degree: "))
n2 = int(input("Enter 2nd subject degree: "))
n3 = int(input("Enter 3rd subject degree: "))
if n1 >= 50 and n2 >= 50 and n3 >= 50:
print("Pass")
else:
print("Fail")
| n1 = int(input('Enter 1st subject degree: '))
n2 = int(input('Enter 2nd subject degree: '))
n3 = int(input('Enter 3rd subject degree: '))
if n1 >= 50 and n2 >= 50 and (n3 >= 50):
print('Pass')
else:
print('Fail') |
class Solution(object):
# O(N^2) solution TLE
# def maxArea(self, height):
# """
# :type height: List[int]
# :rtype: int
# """
# maxcap = 0
# length = len(height)
# for left in range(length - 1):
# for right in range(left + 1, length):
# tmpcap = height[left] * (right - left) if height[left] <= height[right] else height[right] * (right - left)
# if maxcap < tmpcap:
# maxcap = tmpcap
# return maxcap
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
maxcap = 0
left, right = 0, len(height)-1
while left < right:
curcap = min(height[left], height[right]) * (right - left)
if curcap > maxcap:
maxcap = curcap
if height[left] < height[right]:
left += 1
else:
right -= 1
return maxcap
if __name__ == '__main__':
testcase = [[1,2,4,5,6,2,2,3]]
s = Solution()
for t in testcase:
print('{0}: {1}'.format(t, s.maxArea(t))) | class Solution(object):
def max_area(self, height):
"""
:type height: List[int]
:rtype: int
"""
maxcap = 0
(left, right) = (0, len(height) - 1)
while left < right:
curcap = min(height[left], height[right]) * (right - left)
if curcap > maxcap:
maxcap = curcap
if height[left] < height[right]:
left += 1
else:
right -= 1
return maxcap
if __name__ == '__main__':
testcase = [[1, 2, 4, 5, 6, 2, 2, 3]]
s = solution()
for t in testcase:
print('{0}: {1}'.format(t, s.maxArea(t))) |
# Python3
def bishopAndPawn(bishop, pawn):
getPos = lambda s: ('abcdefgh'.index(s[0]), '12345678'.index(s[1]))
bishopPos = getPos(bishop)
pawnPos = getPos(pawn)
return abs(bishopPos[0] - pawnPos[0]) == abs(bishopPos[1] - pawnPos[1])
| def bishop_and_pawn(bishop, pawn):
get_pos = lambda s: ('abcdefgh'.index(s[0]), '12345678'.index(s[1]))
bishop_pos = get_pos(bishop)
pawn_pos = get_pos(pawn)
return abs(bishopPos[0] - pawnPos[0]) == abs(bishopPos[1] - pawnPos[1]) |
"""
Instructions:
1. Create a class named ReversedString that inherits from StringOperations class
2. Implement the function reverse
3. reverse function should be a one liner function that returns the reverse string to_be_reversed
4. Instantiate the class ReversedString
5. Print to show your function implementation result
"""
class StringOperations:
def reverse(self, *, to_be_reversed: str ):return to_be_reversed[::-1]
class ReversedString (StringOperations):
def init(self):
super().reverse()
message = ReversedString.reverse(self=None,to_be_reversed="!nohtyP ot emocleW")
#The output = Welcome to Python!
print(message)
| """
Instructions:
1. Create a class named ReversedString that inherits from StringOperations class
2. Implement the function reverse
3. reverse function should be a one liner function that returns the reverse string to_be_reversed
4. Instantiate the class ReversedString
5. Print to show your function implementation result
"""
class Stringoperations:
def reverse(self, *, to_be_reversed: str):
return to_be_reversed[::-1]
class Reversedstring(StringOperations):
def init(self):
super().reverse()
message = ReversedString.reverse(self=None, to_be_reversed='!nohtyP ot emocleW')
print(message) |
class Solution:
# @param A : integer
# @param B : integer
# @return an integer
def gcd(self,A, B):
if(B==0):
return A
return self.gcd(B,A%B)
| class Solution:
def gcd(self, A, B):
if B == 0:
return A
return self.gcd(B, A % B) |
class Solution:
# @param A : list of strings
# @return a strings
def longestCommonPrefix(self, A):
A.sort()
minLen = min(len(A[0]), len(A[len(A) - 1]))
prefix = ''
for i in range(minLen):
if A[0][i] == A[len(A) - 1][i]:
prefix += A[0][i]
else:
break
return str(prefix)
print(Solution().longestCommonPrefix(A=["abcdefgh", "aefghijk", "abcefgh"]))
| class Solution:
def longest_common_prefix(self, A):
A.sort()
min_len = min(len(A[0]), len(A[len(A) - 1]))
prefix = ''
for i in range(minLen):
if A[0][i] == A[len(A) - 1][i]:
prefix += A[0][i]
else:
break
return str(prefix)
print(solution().longestCommonPrefix(A=['abcdefgh', 'aefghijk', 'abcefgh'])) |
k = int(input())
q = input()
cut = [0]
topset = set([q[0]])
for i in range(1, len(q)):
if len(cut) == k:
break
if q[i] not in topset:
cut.append(i)
topset.add(q[i])
if len(cut) < k:
print('NO')
else:
print('YES')
for i in range(k-1):
print(q[cut[i]:cut[i+1]])
print(q[cut[-1]:])
| k = int(input())
q = input()
cut = [0]
topset = set([q[0]])
for i in range(1, len(q)):
if len(cut) == k:
break
if q[i] not in topset:
cut.append(i)
topset.add(q[i])
if len(cut) < k:
print('NO')
else:
print('YES')
for i in range(k - 1):
print(q[cut[i]:cut[i + 1]])
print(q[cut[-1]:]) |
def new():
return {}
def to_map(raw_metadata):
return {tuple(md['breadcrumb']): md['metadata'] for md in raw_metadata}
def to_list(compiled_metadata):
return [{'breadcrumb': k, 'metadata': v} for k, v in compiled_metadata.items()]
def delete(compiled_metadata, breadcrumb, k):
del compiled_metadata[breadcrumb][k]
def write(compiled_metadata, breadcrumb, k, val):
if val is None:
raise Exception()
if breadcrumb in compiled_metadata:
compiled_metadata.get(breadcrumb).update({k: val})
else:
compiled_metadata[breadcrumb] = {k: val}
return compiled_metadata
def get(compiled_metadata, breadcrumb, k):
return compiled_metadata.get(breadcrumb, {}).get(k)
| def new():
return {}
def to_map(raw_metadata):
return {tuple(md['breadcrumb']): md['metadata'] for md in raw_metadata}
def to_list(compiled_metadata):
return [{'breadcrumb': k, 'metadata': v} for (k, v) in compiled_metadata.items()]
def delete(compiled_metadata, breadcrumb, k):
del compiled_metadata[breadcrumb][k]
def write(compiled_metadata, breadcrumb, k, val):
if val is None:
raise exception()
if breadcrumb in compiled_metadata:
compiled_metadata.get(breadcrumb).update({k: val})
else:
compiled_metadata[breadcrumb] = {k: val}
return compiled_metadata
def get(compiled_metadata, breadcrumb, k):
return compiled_metadata.get(breadcrumb, {}).get(k) |
"""Top-level package for ICBC Test to Anki."""
__author__ = """genzj"""
__email__ = 'zj0512@gmail.com'
__version__ = '0.1.0'
| """Top-level package for ICBC Test to Anki."""
__author__ = 'genzj'
__email__ = 'zj0512@gmail.com'
__version__ = '0.1.0' |
batch_sizes = [4, 16, 128]
def get_iterations(starting_size, batch_size, compute_budget):
compute_budget_without_starting_size = compute_budget - starting_size
iterations_without_start = compute_budget_without_starting_size // batch_size
if (iterations_without_start) == 0:
raise Exception(f"Compute budget is not compatible with batch_size {batch_size} and starting_size {starting_size}")
return iterations_without_start
number_of_reruns = 5
generators = ['monte-carlo', 'sobol']
def make_prefix_main(*, batch_size,
starting_size,
rerun,
generator):
return '{generator}_{batch_size}_{starting_size}_{rerun}'.format(
batch_size=batch_size, starting_size=starting_size,
rerun=rerun,
generator=generator)
def make_prefix_competitor(*, batch_size,
starting_size,
rerun,
iteration,
generator):
return 'competitor_{generator}_{batch_size}_{starting_size}_{rerun}_{iteration}'.format(
batch_size=batch_size, starting_size=starting_size,
rerun=rerun,
iteration=iteration,
generator=generator)
def get_objective_filename(*, batch_size,
starting_size,
rerun,
iteration,
generator):
return "{}objective_{}.txt".format(make_prefix_main(batch_size=batch_size,
generator=generator,
starting_size=starting_size,
rerun=rerun),
iteration)
def get_competitor_objective_filename(*, batch_size,
starting_size,
rerun,
iteration,
pass_number,
generator):
return "{}objective_{}.txt".format(make_prefix_competitor(batch_size=batch_size,
starting_size=starting_size,
rerun=rerun,
generator=generator,
iteration=iteration),
pass_number)
def make_starting_sizes(batch_size, compute_budget):
starting_sizes = [batch_size]
while 2 * batch_size < compute_budget:
starting_sizes.append(2 * batch_size)
batch_size = 2 * batch_size
return starting_sizes
| batch_sizes = [4, 16, 128]
def get_iterations(starting_size, batch_size, compute_budget):
compute_budget_without_starting_size = compute_budget - starting_size
iterations_without_start = compute_budget_without_starting_size // batch_size
if iterations_without_start == 0:
raise exception(f'Compute budget is not compatible with batch_size {batch_size} and starting_size {starting_size}')
return iterations_without_start
number_of_reruns = 5
generators = ['monte-carlo', 'sobol']
def make_prefix_main(*, batch_size, starting_size, rerun, generator):
return '{generator}_{batch_size}_{starting_size}_{rerun}'.format(batch_size=batch_size, starting_size=starting_size, rerun=rerun, generator=generator)
def make_prefix_competitor(*, batch_size, starting_size, rerun, iteration, generator):
return 'competitor_{generator}_{batch_size}_{starting_size}_{rerun}_{iteration}'.format(batch_size=batch_size, starting_size=starting_size, rerun=rerun, iteration=iteration, generator=generator)
def get_objective_filename(*, batch_size, starting_size, rerun, iteration, generator):
return '{}objective_{}.txt'.format(make_prefix_main(batch_size=batch_size, generator=generator, starting_size=starting_size, rerun=rerun), iteration)
def get_competitor_objective_filename(*, batch_size, starting_size, rerun, iteration, pass_number, generator):
return '{}objective_{}.txt'.format(make_prefix_competitor(batch_size=batch_size, starting_size=starting_size, rerun=rerun, generator=generator, iteration=iteration), pass_number)
def make_starting_sizes(batch_size, compute_budget):
starting_sizes = [batch_size]
while 2 * batch_size < compute_budget:
starting_sizes.append(2 * batch_size)
batch_size = 2 * batch_size
return starting_sizes |
# noinspection PyUnusedLocal
# skus = unicode string
def checkout(skus):
"""
I am assuming products are sepereted by commas
and their quantity follows as an int sperated with an asterisk
e.g. skus="A*3,B*1"
the server tests will reveal the input string's format after the penalty
I also have no information on the offers for multiple items
"""
price_catalogue = {
'A': 50,
'B': 30,
'C': 20,
'D': 15,
'E': 40
}
basket = {
'A': 0,
'B': 0,
'C': 0,
'D': 0,
'E': 0,
}
cost = 0
for product in skus:
if product in price_catalogue.keys():
basket[product] += 1
else:
return -1
offered = basket['E'] / 2 # python 2 integer division
if basket['B'] >= offered:
basket['B'] -= offered
else:
basket['B'] = 0
for product, quantity in basket.iteritems():
if product == 'A':
if quantity >= 5:
remainder = quantity % 5
discounted = quantity / 5
cost += discounted * 200
quantity -= (discounted * 5)
remainder = quantity % 3
discounted = quantity / 3
cost += discounted * 130 + remainder * 50
elif product == 'B':
remainder = quantity % 2
discounted = quantity / 2
cost += discounted * 45 + remainder * 30
else:
cost += basket[product] * price_catalogue[product]
return cost
| def checkout(skus):
"""
I am assuming products are sepereted by commas
and their quantity follows as an int sperated with an asterisk
e.g. skus="A*3,B*1"
the server tests will reveal the input string's format after the penalty
I also have no information on the offers for multiple items
"""
price_catalogue = {'A': 50, 'B': 30, 'C': 20, 'D': 15, 'E': 40}
basket = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0}
cost = 0
for product in skus:
if product in price_catalogue.keys():
basket[product] += 1
else:
return -1
offered = basket['E'] / 2
if basket['B'] >= offered:
basket['B'] -= offered
else:
basket['B'] = 0
for (product, quantity) in basket.iteritems():
if product == 'A':
if quantity >= 5:
remainder = quantity % 5
discounted = quantity / 5
cost += discounted * 200
quantity -= discounted * 5
remainder = quantity % 3
discounted = quantity / 3
cost += discounted * 130 + remainder * 50
elif product == 'B':
remainder = quantity % 2
discounted = quantity / 2
cost += discounted * 45 + remainder * 30
else:
cost += basket[product] * price_catalogue[product]
return cost |
class DebuggerInterface:
def is_debug_mode_enabled(self) -> bool:
"""Determines if debug mode is enabled for the application.
The value is based on the configurations.
Returns
-------
bool
True, if debug mode is enabled.
"""
raise NotImplementedError
| class Debuggerinterface:
def is_debug_mode_enabled(self) -> bool:
"""Determines if debug mode is enabled for the application.
The value is based on the configurations.
Returns
-------
bool
True, if debug mode is enabled.
"""
raise NotImplementedError |
text = input("Text: ")
letters = 0
for letter in text:
if letter.isalpha():
letters += 1
# Assign words to 1 if user actually typed a word at the start but not a space
words = 1 if (len(text) > 0 and text[0] != ' ') else 0
print(words)
print(letters)
| text = input('Text: ')
letters = 0
for letter in text:
if letter.isalpha():
letters += 1
words = 1 if len(text) > 0 and text[0] != ' ' else 0
print(words)
print(letters) |
class MonteCarlo(object):
def __init__(self, board, **kwargs):
# Takes an instance of a Board and optionally some keyword
# arguments. Initializes the list of game states and the
# statistics tables.
milliseconds = kwargs.get('calculation_ms', 10)
self.calculation_time_ms = datatime.timedelta(milliseconds = milliseconds)
# check that this amount of moves
self.max_moves = kwargs.get('max_moves', 10)
self.board = board
self.states = []
def update(self, state):
# Takes a game state, and appends it to the history.
self.states.append(state)
def get_play(self):
# Causes the AI to calculate the best move from the
# current game state and return it.
begin = datetime.datetime.utcnow()
while datetime.datetime.utcnow() - begin < self.calculation_time_ms:
self.run_simulation()
def run_simulation(self):
# Plays out a "random" game from the current position,
# then updates the statistics tables with the result.
states_copy = self.states[:]
# get last state
current_state = states_copy[-1]
for _ in range(self.max_moves):
legal_plays = self.board.legal_plays(states_copy)
play = choice(legal_plays)
new_state = self.board.next_state(state, play)
states_copy.append(new_state)
current_state = new_state
winner = self.board.winner(states_copy)
if winner:
break | class Montecarlo(object):
def __init__(self, board, **kwargs):
milliseconds = kwargs.get('calculation_ms', 10)
self.calculation_time_ms = datatime.timedelta(milliseconds=milliseconds)
self.max_moves = kwargs.get('max_moves', 10)
self.board = board
self.states = []
def update(self, state):
self.states.append(state)
def get_play(self):
begin = datetime.datetime.utcnow()
while datetime.datetime.utcnow() - begin < self.calculation_time_ms:
self.run_simulation()
def run_simulation(self):
states_copy = self.states[:]
current_state = states_copy[-1]
for _ in range(self.max_moves):
legal_plays = self.board.legal_plays(states_copy)
play = choice(legal_plays)
new_state = self.board.next_state(state, play)
states_copy.append(new_state)
current_state = new_state
winner = self.board.winner(states_copy)
if winner:
break |
print("Welcome to Python")
print("Welcome to Python")
print("Welcome to Python")
print("Welcome to Python")
print("Welcome to Python")
| print('Welcome to Python')
print('Welcome to Python')
print('Welcome to Python')
print('Welcome to Python')
print('Welcome to Python') |
def test_win10(helpers):
caps = {}
caps['browserName'] = 'internet explorer'
caps['platform'] = 'Windows 10'
caps['version'] = '11'
driver = helpers.start_driver(caps)
helpers.validate_google(driver)
def test_late_win7(helpers):
caps = {}
caps['browserName'] = 'internet explorer'
caps['platform'] = 'Windows 7'
caps['version'] = '11'
driver = helpers.start_driver(caps)
helpers.validate_google(driver)
def test_early_win7(helpers):
caps = {}
caps['browserName'] = 'internet explorer'
caps['platform'] = 'Windows 7'
caps['version'] = '9'
driver = helpers.start_driver(caps)
helpers.validate_google(driver)
| def test_win10(helpers):
caps = {}
caps['browserName'] = 'internet explorer'
caps['platform'] = 'Windows 10'
caps['version'] = '11'
driver = helpers.start_driver(caps)
helpers.validate_google(driver)
def test_late_win7(helpers):
caps = {}
caps['browserName'] = 'internet explorer'
caps['platform'] = 'Windows 7'
caps['version'] = '11'
driver = helpers.start_driver(caps)
helpers.validate_google(driver)
def test_early_win7(helpers):
caps = {}
caps['browserName'] = 'internet explorer'
caps['platform'] = 'Windows 7'
caps['version'] = '9'
driver = helpers.start_driver(caps)
helpers.validate_google(driver) |
#The provided code stub reads two integers from STDIN, a and b. Add code to print three lines where:
#1.The first line contains the sum of the two numbers.
#2.The second line contains the difference of the two numbers (first - second).
#3.The third line contains the product of the two numbers.
#code
a=int(raw_input())
b=int(raw_input())
print(a+b)
print(a-b)
print(a*b)
| a = int(raw_input())
b = int(raw_input())
print(a + b)
print(a - b)
print(a * b) |
"""
These routines only appear to be used by the peering_speed tests.
"""
def gen_args(name, args):
"""
Called from argify to generate arguments.
"""
usage = [""]
usage += [name + ':']
usage += \
[" {key}: <{usage}> ({default})".format(
key=key, usage=_usage, default=default)
for (key, _usage, default, _) in args]
usage.append('')
usage.append(name + ':')
usage += \
[" {key}: {default}".format(
key = key, default = default)
for (key, _, default, _) in args]
usage = '\n'.join(' ' + i for i in usage)
def ret(config):
"""
return an object with attributes set from args.
"""
class Object(object):
"""
simple object
"""
pass
obj = Object()
for (key, usage, default, conv) in args:
if key in config:
setattr(obj, key, conv(config[key]))
else:
setattr(obj, key, conv(default))
return obj
return usage, ret
def argify(name, args):
"""
Object used as a decorator for the peering speed tests.
See peering_spee_test.py
"""
(usage, config_func) = gen_args(name, args)
def ret1(f):
"""
Wrapper to handle doc and usage information
"""
def ret2(**kwargs):
"""
Call f (the parameter passed to ret1)
"""
config = kwargs.get('config', {})
if config is None:
config = {}
kwargs['config'] = config_func(config)
return f(**kwargs)
ret2.__doc__ = f.__doc__ + usage
return ret2
return ret1
| """
These routines only appear to be used by the peering_speed tests.
"""
def gen_args(name, args):
"""
Called from argify to generate arguments.
"""
usage = ['']
usage += [name + ':']
usage += [' {key}: <{usage}> ({default})'.format(key=key, usage=_usage, default=default) for (key, _usage, default, _) in args]
usage.append('')
usage.append(name + ':')
usage += [' {key}: {default}'.format(key=key, default=default) for (key, _, default, _) in args]
usage = '\n'.join((' ' + i for i in usage))
def ret(config):
"""
return an object with attributes set from args.
"""
class Object(object):
"""
simple object
"""
pass
obj = object()
for (key, usage, default, conv) in args:
if key in config:
setattr(obj, key, conv(config[key]))
else:
setattr(obj, key, conv(default))
return obj
return (usage, ret)
def argify(name, args):
"""
Object used as a decorator for the peering speed tests.
See peering_spee_test.py
"""
(usage, config_func) = gen_args(name, args)
def ret1(f):
"""
Wrapper to handle doc and usage information
"""
def ret2(**kwargs):
"""
Call f (the parameter passed to ret1)
"""
config = kwargs.get('config', {})
if config is None:
config = {}
kwargs['config'] = config_func(config)
return f(**kwargs)
ret2.__doc__ = f.__doc__ + usage
return ret2
return ret1 |
def route_allow_all(*args, **kwargs):
return args, kwargs
def route_defarg(reqarg, defarg=1):
return defarg
def route_json_dict(jsondict, dbg=False):
pass
def route_validator(alphanum, filepath, key, novalidation):
"""
put descriptive docstring here
"""
pass
def route_min(count):
"""
put descriptive docstring here
"""
pass
def test_switch(pos1, opt1=None, dbg=False):
pass
| def route_allow_all(*args, **kwargs):
return (args, kwargs)
def route_defarg(reqarg, defarg=1):
return defarg
def route_json_dict(jsondict, dbg=False):
pass
def route_validator(alphanum, filepath, key, novalidation):
"""
put descriptive docstring here
"""
pass
def route_min(count):
"""
put descriptive docstring here
"""
pass
def test_switch(pos1, opt1=None, dbg=False):
pass |
class Jugador():
def __init__(self, nombre):
self.nombre = nombre
def __str__(self):
return self.nombre
def elegirTargetsDeLaPartida(self, partida):
"""Recibe el estado del juego, NO LO MODIFICA (dummy/copy/simulacion)
Devuelve todos los turnos a jugar"""
raise NotImplementedError | class Jugador:
def __init__(self, nombre):
self.nombre = nombre
def __str__(self):
return self.nombre
def elegir_targets_de_la_partida(self, partida):
"""Recibe el estado del juego, NO LO MODIFICA (dummy/copy/simulacion)
Devuelve todos los turnos a jugar"""
raise NotImplementedError |
"""
Problem Statement
Given arrival and departure times of trains on a single day in a railway platform,
find out the minimum number of platforms required so that no train has to wait for
the other(s) to leave. In other words, when a train is about to arrive, at least
one platform must be available to accommodate it.
You will be given arrival and departure times both in the form of a list. The size
of both the lists will be equal, with each common index representing the same train.
Note: Time hh:mm would be written as integer hhmm for e.g. 9:30 would be written as
930. Similarly, 13:45 would be given as 1345
Example:
Input: A schedule of 6 trains:
arrival = [900, 940, 950, 1100, 1500, 1800]
departure = [910, 1200, 1120, 1130, 1900, 2000]
Expected output: Minimum number of platforms required = 3
"""
def min_platforms(arrival, departure):
"""
:param: arrival - list of arrival time
:param: departure - list of departure time
TODO - complete this method and return the minimum number of platforms (int) required
so that no train has to wait for other(s) to leave
"""
if len(arrival) != len(departure):
return -1
arrival.sort()
departure.sort()
platform_required = 1
max_platform_required = 1
i = 1
j = 0
while i < len(arrival) and j < len(departure):
if arrival[i] < departure[j]:
platform_required += 1
i += 1
if platform_required > max_platform_required:
max_platform_required = platform_required
else:
platform_required -= 1
j += 1
return max_platform_required
def test_function(test_case):
arrival = test_case[0]
departure = test_case[1]
solution = test_case[2]
output = min_platforms(arrival, departure)
if output == solution:
print("Pass")
else:
print("Fail")
if __name__ == '__main__':
# Test 1
arrival = [900, 940, 950, 1100, 1500, 1800]
departure = [910, 1200, 1120, 1130, 1900, 2000]
test_case = [arrival, departure, 3]
test_function(test_case)
# Test 2
arrival = [200, 210, 300, 320, 350, 500]
departure = [230, 340, 320, 430, 400, 520]
test_case = [arrival, departure, 2]
test_function(test_case) | """
Problem Statement
Given arrival and departure times of trains on a single day in a railway platform,
find out the minimum number of platforms required so that no train has to wait for
the other(s) to leave. In other words, when a train is about to arrive, at least
one platform must be available to accommodate it.
You will be given arrival and departure times both in the form of a list. The size
of both the lists will be equal, with each common index representing the same train.
Note: Time hh:mm would be written as integer hhmm for e.g. 9:30 would be written as
930. Similarly, 13:45 would be given as 1345
Example:
Input: A schedule of 6 trains:
arrival = [900, 940, 950, 1100, 1500, 1800]
departure = [910, 1200, 1120, 1130, 1900, 2000]
Expected output: Minimum number of platforms required = 3
"""
def min_platforms(arrival, departure):
"""
:param: arrival - list of arrival time
:param: departure - list of departure time
TODO - complete this method and return the minimum number of platforms (int) required
so that no train has to wait for other(s) to leave
"""
if len(arrival) != len(departure):
return -1
arrival.sort()
departure.sort()
platform_required = 1
max_platform_required = 1
i = 1
j = 0
while i < len(arrival) and j < len(departure):
if arrival[i] < departure[j]:
platform_required += 1
i += 1
if platform_required > max_platform_required:
max_platform_required = platform_required
else:
platform_required -= 1
j += 1
return max_platform_required
def test_function(test_case):
arrival = test_case[0]
departure = test_case[1]
solution = test_case[2]
output = min_platforms(arrival, departure)
if output == solution:
print('Pass')
else:
print('Fail')
if __name__ == '__main__':
arrival = [900, 940, 950, 1100, 1500, 1800]
departure = [910, 1200, 1120, 1130, 1900, 2000]
test_case = [arrival, departure, 3]
test_function(test_case)
arrival = [200, 210, 300, 320, 350, 500]
departure = [230, 340, 320, 430, 400, 520]
test_case = [arrival, departure, 2]
test_function(test_case) |
def main():
f = [line.rstrip("\n") for line in open("Data.txt")]
map_ = [list(line) for line in f]
info = []
for i in range(len(map_)):
for j in range(len(map_[0])):
if map_[i][j] == "v":
info.append([i, j, "down", "left"])
map_[i][j] = "|"
elif map_[i][j] == ">":
info.append([i, j, "right", "left"])
map_[i][j] = "-"
elif map_[i][j] == "^":
info.append([i, j, "up", "left"])
map_[i][j] = "|"
elif map_[i][j] == "<":
info.append([i, j, "left", "left"])
map_[i][j] = "-"
done = False
while not done:
info.sort()
for i in info:
y, x = i[0], i[1]
if i[2] == "down":
if map_[y + 1][x] == "/":
i[2] = "left"
elif map_[y + 1][x] == "\\":
i[2] = "right"
elif map_[y + 1][x] == "+":
if i[3] == "left":
i[2] = "right"
i[3] = "straight"
elif i[3] == "straight":
i[2] = "down"
i[3] = "right"
elif i[3] == "right":
i[2] = "left"
i[3] = "left"
positions = [info_[0:2] for info_ in info]
i[0] += 1
if [y + 1, x] in positions:
print(x, y + 1)
done = True
break
elif i[2] == "right":
if map_[y][x + 1] == "/":
i[2] = "up"
elif map_[y][x + 1] == "\\":
i[2] = "down"
elif map_[y][x + 1] == "+":
if i[3] == "left":
i[2] = "up"
i[3] = "straight"
elif i[3] == "straight":
i[2] = "right"
i[3] = "right"
elif i[3] == "right":
i[2] = "down"
i[3] = "left"
positions = [info_[0:2] for info_ in info]
i[1] += 1
if [y, x + 1] in positions:
print(x + 1, y)
done = True
break
elif i[2] == "up":
if map_[y - 1][x] == "/":
i[2] = "right"
elif map_[y - 1][x] == "\\":
i[2] = "left"
elif map_[y - 1][x] == "+":
if i[3] == "left":
i[2] = "left"
i[3] = "straight"
elif i[3] == "straight":
i[2] = "up"
i[3] = "right"
elif i[3] == "right":
i[2] = "right"
i[3] = "left"
positions = [info_[0:2] for info_ in info]
i[0] -= 1
if [y - 1, x] in positions:
print(x, y - 1)
done = True
break
elif i[2] == "left":
if map_[y][x - 1] == "/":
i[2] = "down"
elif map_[y][x - 1] == "\\":
i[2] = "up"
elif map_[y][x - 1] == "+":
if i[3] == "left":
i[2] = "down"
i[3] = "straight"
elif i[3] == "straight":
i[2] = "left"
i[3] = "right"
elif i[3] == "right":
i[2] = "up"
i[3] = "left"
positions = [info_[0:2] for info_ in info]
i[1] -= 1
if [y, x - 1] in positions:
print(x - 1, y)
done = True
break
if __name__ == "__main__":
main()
| def main():
f = [line.rstrip('\n') for line in open('Data.txt')]
map_ = [list(line) for line in f]
info = []
for i in range(len(map_)):
for j in range(len(map_[0])):
if map_[i][j] == 'v':
info.append([i, j, 'down', 'left'])
map_[i][j] = '|'
elif map_[i][j] == '>':
info.append([i, j, 'right', 'left'])
map_[i][j] = '-'
elif map_[i][j] == '^':
info.append([i, j, 'up', 'left'])
map_[i][j] = '|'
elif map_[i][j] == '<':
info.append([i, j, 'left', 'left'])
map_[i][j] = '-'
done = False
while not done:
info.sort()
for i in info:
(y, x) = (i[0], i[1])
if i[2] == 'down':
if map_[y + 1][x] == '/':
i[2] = 'left'
elif map_[y + 1][x] == '\\':
i[2] = 'right'
elif map_[y + 1][x] == '+':
if i[3] == 'left':
i[2] = 'right'
i[3] = 'straight'
elif i[3] == 'straight':
i[2] = 'down'
i[3] = 'right'
elif i[3] == 'right':
i[2] = 'left'
i[3] = 'left'
positions = [info_[0:2] for info_ in info]
i[0] += 1
if [y + 1, x] in positions:
print(x, y + 1)
done = True
break
elif i[2] == 'right':
if map_[y][x + 1] == '/':
i[2] = 'up'
elif map_[y][x + 1] == '\\':
i[2] = 'down'
elif map_[y][x + 1] == '+':
if i[3] == 'left':
i[2] = 'up'
i[3] = 'straight'
elif i[3] == 'straight':
i[2] = 'right'
i[3] = 'right'
elif i[3] == 'right':
i[2] = 'down'
i[3] = 'left'
positions = [info_[0:2] for info_ in info]
i[1] += 1
if [y, x + 1] in positions:
print(x + 1, y)
done = True
break
elif i[2] == 'up':
if map_[y - 1][x] == '/':
i[2] = 'right'
elif map_[y - 1][x] == '\\':
i[2] = 'left'
elif map_[y - 1][x] == '+':
if i[3] == 'left':
i[2] = 'left'
i[3] = 'straight'
elif i[3] == 'straight':
i[2] = 'up'
i[3] = 'right'
elif i[3] == 'right':
i[2] = 'right'
i[3] = 'left'
positions = [info_[0:2] for info_ in info]
i[0] -= 1
if [y - 1, x] in positions:
print(x, y - 1)
done = True
break
elif i[2] == 'left':
if map_[y][x - 1] == '/':
i[2] = 'down'
elif map_[y][x - 1] == '\\':
i[2] = 'up'
elif map_[y][x - 1] == '+':
if i[3] == 'left':
i[2] = 'down'
i[3] = 'straight'
elif i[3] == 'straight':
i[2] = 'left'
i[3] = 'right'
elif i[3] == 'right':
i[2] = 'up'
i[3] = 'left'
positions = [info_[0:2] for info_ in info]
i[1] -= 1
if [y, x - 1] in positions:
print(x - 1, y)
done = True
break
if __name__ == '__main__':
main() |
def escape_librtmp(value):
if isinstance(value, bool):
value = "1" if value else "0"
if isinstance(value, int):
value = str(value)
# librtmp expects some characters to be escaped
value = value.replace("\\", "\\5c")
value = value.replace(" ", "\\20")
value = value.replace('"', "\\22")
return value
def stream_to_url(stream):
stream_type = type(stream).shortname()
if stream_type in ("hls", "http"):
url = stream.url
elif stream_type == "rtmp":
params = [stream.params.pop("rtmp", "")]
stream_params = dict(stream.params)
if "swfVfy" in stream.params:
stream_params["swfUrl"] = stream.params["swfVfy"]
stream_params["swfVfy"] = True
if "swfhash" in stream.params:
stream_params["swfVfy"] = True
stream_params.pop("swfhash", None)
stream_params.pop("swfsize", None)
for key, value in stream_params.items():
if isinstance(value, list):
for svalue in value:
params.append("{0}={1}".format(key, escape_librtmp(svalue)))
else:
params.append("{0}={1}".format(key, escape_librtmp(value)))
url = " ".join(params)
else:
url = None
return url
| def escape_librtmp(value):
if isinstance(value, bool):
value = '1' if value else '0'
if isinstance(value, int):
value = str(value)
value = value.replace('\\', '\\5c')
value = value.replace(' ', '\\20')
value = value.replace('"', '\\22')
return value
def stream_to_url(stream):
stream_type = type(stream).shortname()
if stream_type in ('hls', 'http'):
url = stream.url
elif stream_type == 'rtmp':
params = [stream.params.pop('rtmp', '')]
stream_params = dict(stream.params)
if 'swfVfy' in stream.params:
stream_params['swfUrl'] = stream.params['swfVfy']
stream_params['swfVfy'] = True
if 'swfhash' in stream.params:
stream_params['swfVfy'] = True
stream_params.pop('swfhash', None)
stream_params.pop('swfsize', None)
for (key, value) in stream_params.items():
if isinstance(value, list):
for svalue in value:
params.append('{0}={1}'.format(key, escape_librtmp(svalue)))
else:
params.append('{0}={1}'.format(key, escape_librtmp(value)))
url = ' '.join(params)
else:
url = None
return url |
coordinates_E0E1E1 = ((125, 114),
(126, 93), (126, 114), (126, 130), (126, 132), (127, 92), (127, 93), (127, 104), (127, 114), (127, 115), (127, 130), (128, 91), (128, 92), (128, 102), (128, 104), (128, 114), (128, 117), (128, 119), (128, 131), (128, 132), (129, 91), (129, 101), (129, 114), (129, 119), (129, 131), (129, 132), (130, 86), (130, 87), (130, 88), (130, 91), (130, 114), (130, 116), (130, 118), (130, 131), (130, 133), (131, 82), (131, 84), (131, 85), (131, 90), (131, 115), (131, 118), (131, 131), (132, 87), (132, 90), (132, 116), (132, 118), (132, 132), (133, 89), (133, 91), (133, 117), (133, 119), (133, 130), (133, 131), (134, 90), (134, 91), (134, 118), (134, 119), (134, 130), (135, 90), (135, 91), (135, 101), (135, 106), (135, 108), (135, 119), (135, 121), (135, 122), (135, 125), (135, 129), (135, 130), (135, 138), (136, 91), (136, 92), (136, 102),
(136, 104), (136, 105), (136, 109), (136, 119), (136, 126), (136, 129), (136, 138), (137, 91), (137, 92), (137, 104), (137, 107), (137, 108), (137, 120), (137, 122), (137, 123), (137, 124), (137, 125), (137, 128), (137, 136), (137, 137), (138, 90), (138, 92), (138, 106), (138, 108), (138, 109), (138, 112), (138, 120), (138, 122), (138, 123), (138, 124), (138, 125), (138, 127), (138, 135), (138, 136), (139, 90), (139, 93), (139, 107), (139, 109), (139, 110), (139, 113), (139, 120), (139, 122), (139, 123), (139, 124), (139, 125), (139, 127), (139, 134), (139, 135), (140, 89), (140, 91), (140, 93), (140, 107), (140, 114), (140, 115), (140, 118), (140, 119), (140, 120), (140, 121), (140, 122), (140, 123), (140, 124), (140, 125), (140, 127), (140, 133), (140, 135), (141, 88), (141, 94), (141, 108), (141, 110), (141, 111), (141, 112), (141, 116),
(141, 117), (141, 120), (141, 121), (141, 122), (141, 123), (141, 124), (141, 125), (141, 126), (141, 128), (141, 132), (141, 135), (142, 86), (142, 87), (142, 88), (142, 89), (142, 90), (142, 91), (142, 92), (142, 93), (142, 95), (142, 108), (142, 114), (142, 118), (142, 119), (142, 120), (142, 121), (142, 122), (142, 123), (142, 124), (142, 125), (142, 126), (142, 127), (142, 130), (142, 131), (142, 133), (142, 135), (143, 85), (143, 94), (143, 96), (143, 115), (143, 117), (143, 118), (143, 119), (143, 120), (143, 121), (143, 122), (143, 123), (143, 124), (143, 125), (143, 126), (143, 127), (143, 128), (143, 132), (143, 133), (143, 134), (143, 136), (144, 97), (144, 99), (144, 101), (144, 115), (144, 117), (144, 118), (144, 119), (144, 120), (144, 121), (144, 122), (144, 123), (144, 124), (144, 125), (144, 126), (144, 127), (144, 128),
(144, 129), (144, 130), (144, 131), (144, 132), (144, 133), (144, 134), (144, 135), (144, 138), (145, 98), (145, 100), (145, 102), (145, 114), (145, 115), (145, 116), (145, 117), (145, 118), (145, 119), (145, 120), (145, 121), (145, 122), (145, 123), (145, 124), (145, 125), (145, 126), (145, 127), (145, 128), (145, 129), (145, 130), (145, 131), (145, 132), (145, 133), (145, 134), (145, 136), (146, 114), (146, 116), (146, 117), (146, 118), (146, 119), (146, 120), (146, 121), (146, 122), (146, 123), (146, 124), (146, 125), (146, 126), (146, 127), (146, 128), (146, 129), (146, 130), (146, 131), (146, 132), (146, 133), (146, 135), (147, 114), (147, 116), (147, 117), (147, 118), (147, 119), (147, 120), (147, 121), (147, 122), (147, 123), (147, 124), (147, 125), (147, 126), (147, 127), (147, 128), (147, 129), (147, 130), (147, 131), (147, 132), (147, 134),
(148, 114), (148, 116), (148, 117), (148, 118), (148, 119), (148, 120), (148, 121), (148, 122), (148, 123), (148, 124), (148, 125), (148, 126), (148, 127), (148, 128), (148, 129), (148, 130), (148, 131), (148, 132), (148, 134), (149, 115), (149, 117), (149, 118), (149, 119), (149, 120), (149, 121), (149, 122), (149, 123), (149, 124), (149, 125), (149, 126), (149, 127), (149, 128), (149, 129), (149, 130), (149, 131), (149, 132), (149, 134), (150, 116), (150, 118), (150, 119), (150, 120), (150, 121), (150, 122), (150, 123), (150, 124), (150, 125), (150, 126), (150, 127), (150, 128), (150, 129), (150, 130), (150, 131), (150, 132), (150, 134), (151, 95), (151, 116), (151, 117), (151, 118), (151, 119), (151, 120), (151, 121), (151, 122), (151, 123), (151, 124), (151, 125), (151, 126), (151, 127), (151, 128), (151, 129), (151, 130), (151, 131), (151, 132),
(151, 133), (151, 134), (151, 135), (151, 136), (151, 137), (151, 138), (151, 140), (152, 95), (152, 96), (152, 117), (152, 119), (152, 120), (152, 121), (152, 122), (152, 123), (152, 124), (152, 125), (152, 126), (152, 127), (152, 128), (152, 129), (152, 130), (152, 131), (152, 132), (152, 133), (152, 134), (152, 135), (152, 138), (152, 140), (153, 96), (153, 99), (153, 117), (153, 119), (153, 120), (153, 121), (153, 122), (153, 123), (153, 124), (153, 125), (153, 126), (153, 127), (153, 128), (153, 129), (153, 130), (153, 131), (153, 132), (153, 134), (154, 97), (154, 100), (154, 101), (154, 105), (154, 108), (154, 116), (154, 118), (154, 119), (154, 120), (154, 121), (154, 122), (154, 123), (154, 124), (154, 125), (154, 126), (154, 127), (154, 128), (154, 129), (154, 130), (154, 131), (154, 132), (154, 134), (155, 99), (155, 104), (155, 109),
(155, 114), (155, 117), (155, 118), (155, 119), (155, 120), (155, 121), (155, 122), (155, 123), (155, 124), (155, 125), (155, 126), (155, 127), (155, 128), (155, 129), (155, 130), (155, 131), (155, 132), (155, 134), (156, 98), (156, 105), (156, 107), (156, 108), (156, 111), (156, 112), (156, 113), (156, 122), (156, 123), (156, 124), (156, 125), (156, 126), (156, 127), (156, 128), (156, 129), (156, 130), (156, 131), (156, 134), (157, 105), (157, 107), (157, 108), (157, 109), (157, 115), (157, 116), (157, 117), (157, 118), (157, 119), (157, 120), (157, 123), (157, 124), (157, 125), (157, 126), (157, 127), (157, 128), (157, 129), (157, 132), (157, 133), (157, 135), (158, 105), (158, 106), (158, 107), (158, 108), (158, 109), (158, 110), (158, 113), (158, 122), (158, 123), (158, 124), (158, 125), (158, 126), (158, 127), (158, 128), (158, 130), (158, 131),
(158, 136), (159, 106), (159, 108), (159, 109), (159, 111), (159, 123), (159, 125), (159, 126), (159, 127), (159, 129), (160, 106), (160, 108), (160, 110), (160, 123), (160, 125), (160, 126), (160, 128), (161, 106), (161, 109), (161, 123), (161, 125), (161, 127), (162, 107), (162, 109), (162, 123), (162, 125), (162, 127), (163, 107), (163, 109), (163, 122), (163, 124), (163, 126), (163, 137), (164, 107), (164, 122), (164, 124), (164, 126), (164, 137), (165, 108), (165, 122), (165, 125), (166, 122), (166, 125), (167, 122), (167, 124), (168, 122), (168, 123), )
coordinates_E1E1E1 = ((77, 124),
(77, 125), (78, 123), (78, 126), (79, 110), (79, 126), (80, 104), (80, 106), (80, 111), (80, 124), (80, 127), (80, 139), (81, 104), (81, 107), (81, 110), (81, 112), (81, 125), (81, 127), (81, 139), (82, 104), (82, 106), (82, 109), (82, 110), (82, 111), (82, 113), (82, 125), (82, 127), (82, 139), (83, 103), (83, 105), (83, 106), (83, 107), (83, 108), (83, 109), (83, 110), (83, 111), (83, 112), (83, 114), (83, 127), (83, 139), (84, 103), (84, 105), (84, 106), (84, 107), (84, 108), (84, 109), (84, 110), (84, 111), (84, 112), (84, 113), (84, 126), (84, 127), (84, 139), (85, 103), (85, 105), (85, 106), (85, 107), (85, 108), (85, 109), (85, 110), (85, 111), (85, 112), (85, 113), (85, 115), (85, 126), (85, 127), (85, 139), (85, 140), (86, 103), (86, 105), (86, 110), (86, 111), (86, 112),
(86, 113), (86, 114), (86, 116), (86, 126), (86, 127), (86, 139), (86, 141), (87, 103), (87, 107), (87, 108), (87, 109), (87, 110), (87, 111), (87, 112), (87, 113), (87, 114), (87, 115), (87, 117), (87, 125), (87, 128), (87, 139), (87, 141), (88, 102), (88, 105), (88, 110), (88, 112), (88, 113), (88, 114), (88, 115), (88, 116), (88, 118), (88, 124), (88, 126), (88, 128), (88, 139), (88, 140), (89, 102), (89, 104), (89, 110), (89, 113), (89, 114), (89, 115), (89, 116), (89, 117), (89, 120), (89, 121), (89, 122), (89, 125), (89, 126), (89, 127), (89, 129), (89, 139), (90, 102), (90, 111), (90, 114), (90, 115), (90, 116), (90, 124), (90, 125), (90, 126), (90, 127), (90, 128), (90, 130), (90, 138), (90, 139), (91, 101), (91, 113), (91, 117), (91, 118), (91, 120), (91, 121), (91, 122),
(91, 123), (91, 124), (91, 125), (91, 126), (91, 127), (91, 128), (91, 129), (91, 131), (91, 132), (91, 136), (91, 138), (92, 100), (92, 114), (92, 119), (92, 121), (92, 122), (92, 123), (92, 124), (92, 125), (92, 126), (92, 127), (92, 128), (92, 129), (92, 130), (92, 133), (92, 134), (92, 135), (92, 138), (93, 99), (93, 120), (93, 122), (93, 123), (93, 124), (93, 125), (93, 126), (93, 127), (93, 128), (93, 129), (93, 130), (93, 131), (93, 132), (93, 133), (93, 135), (93, 139), (94, 98), (94, 121), (94, 123), (94, 124), (94, 125), (94, 126), (94, 127), (94, 128), (94, 129), (94, 130), (94, 131), (94, 132), (94, 133), (94, 134), (94, 137), (94, 141), (95, 94), (95, 97), (95, 121), (95, 123), (95, 124), (95, 125), (95, 126), (95, 127), (95, 128), (95, 129), (95, 130), (95, 131),
(95, 132), (95, 133), (95, 135), (95, 139), (95, 141), (96, 89), (96, 121), (96, 123), (96, 124), (96, 125), (96, 126), (96, 127), (96, 128), (96, 129), (96, 130), (96, 131), (96, 132), (96, 134), (97, 107), (97, 109), (97, 110), (97, 111), (97, 113), (97, 121), (97, 123), (97, 124), (97, 125), (97, 126), (97, 127), (97, 128), (97, 129), (97, 130), (97, 131), (97, 133), (98, 106), (98, 114), (98, 120), (98, 122), (98, 123), (98, 124), (98, 125), (98, 126), (98, 127), (98, 128), (98, 129), (98, 130), (98, 131), (98, 133), (99, 105), (99, 110), (99, 111), (99, 112), (99, 113), (99, 116), (99, 120), (99, 122), (99, 123), (99, 124), (99, 125), (99, 126), (99, 127), (99, 128), (99, 129), (99, 130), (99, 131), (99, 133), (100, 104), (100, 107), (100, 108), (100, 109), (100, 112), (100, 113),
(100, 114), (100, 117), (100, 118), (100, 120), (100, 121), (100, 122), (100, 123), (100, 124), (100, 125), (100, 126), (100, 127), (100, 128), (100, 129), (100, 130), (100, 132), (101, 103), (101, 106), (101, 110), (101, 113), (101, 114), (101, 115), (101, 116), (101, 120), (101, 121), (101, 122), (101, 123), (101, 124), (101, 125), (101, 126), (101, 127), (101, 128), (101, 129), (101, 130), (101, 132), (102, 101), (102, 105), (102, 112), (102, 114), (102, 115), (102, 116), (102, 117), (102, 118), (102, 119), (102, 120), (102, 121), (102, 122), (102, 123), (102, 124), (102, 125), (102, 126), (102, 127), (102, 128), (102, 129), (102, 130), (102, 132), (103, 94), (103, 96), (103, 97), (103, 98), (103, 99), (103, 100), (103, 101), (103, 102), (103, 103), (103, 113), (103, 115), (103, 116), (103, 117), (103, 118), (103, 119), (103, 120), (103, 121),
(103, 122), (103, 123), (103, 124), (103, 125), (103, 126), (103, 127), (103, 128), (103, 132), (104, 83), (104, 94), (104, 100), (104, 113), (104, 115), (104, 116), (104, 117), (104, 118), (104, 119), (104, 120), (104, 124), (104, 125), (104, 126), (104, 127), (104, 130), (104, 132), (105, 83), (105, 94), (105, 96), (105, 98), (105, 113), (105, 115), (105, 116), (105, 117), (105, 118), (105, 119), (105, 121), (105, 122), (105, 125), (105, 126), (105, 128), (105, 132), (106, 82), (106, 84), (106, 94), (106, 97), (106, 113), (106, 116), (106, 117), (106, 120), (106, 124), (106, 127), (106, 132), (107, 82), (107, 84), (107, 94), (107, 96), (107, 114), (107, 116), (107, 119), (107, 125), (107, 127), (108, 82), (108, 84), (108, 95), (108, 116), (108, 118), (108, 125), (108, 126), (108, 133), (109, 81), (109, 85), (109, 93), (109, 94),
(109, 116), (109, 117), (109, 125), (109, 126), (109, 133), (110, 81), (110, 83), (110, 84), (110, 86), (110, 93), (110, 94), (110, 115), (110, 116), (110, 126), (110, 133), (111, 85), (111, 93), (111, 94), (111, 114), (111, 115), (111, 124), (111, 126), (112, 87), (112, 88), (112, 93), (112, 94), (112, 100), (112, 113), (112, 114), (112, 123), (112, 126), (112, 134), (113, 88), (113, 90), (113, 91), (113, 93), (113, 94), (113, 99), (113, 112), (113, 113), (113, 123), (113, 127), (113, 134), (114, 89), (114, 96), (114, 98), (114, 111), (114, 112), (114, 122), (114, 124), (114, 125), (114, 127), (114, 134), (115, 90), (115, 92), (115, 93), (115, 94), (115, 95), (115, 96), (115, 98), (115, 110), (115, 112), (115, 127), (116, 91), (116, 98), (116, 110), (116, 112), (116, 127), (117, 98), (117, 109), (117, 112), (118, 98),
(118, 109), (118, 112), (119, 108), (119, 109), )
coordinates_771286 = ((142, 125),
(143, 125), )
coordinates_781286 = ((102, 125),
(103, 126), (104, 125), )
coordinates_DCF8A4 = ((104, 152),
(105, 152), (105, 162), (108, 161), (109, 161), (110, 161), (111, 161), (112, 160), (113, 160), (114, 159), (115, 159), (116, 159), (117, 158), (118, 157), )
coordinates_DBF8A4 = ((132, 157),
(133, 157), (134, 158), (135, 158), (135, 159), (136, 159), (137, 160), (138, 160), (139, 160), (140, 160), (145, 152), (150, 162), (151, 162), )
coordinates_60CC60 = ((81, 159),
(81, 162), (82, 156), (82, 163), (83, 154), (83, 155), (83, 159), (83, 160), (83, 161), (83, 163), (84, 153), (84, 156), (84, 157), (84, 158), (84, 159), (84, 160), (84, 161), (84, 162), (84, 164), (85, 153), (85, 155), (85, 156), (85, 157), (85, 158), (85, 159), (85, 160), (85, 161), (85, 162), (85, 163), (85, 165), (86, 153), (86, 155), (86, 156), (86, 157), (86, 158), (86, 159), (86, 160), (86, 161), (86, 162), (86, 163), (86, 164), (86, 166), (87, 152), (87, 153), (87, 154), (87, 155), (87, 156), (87, 157), (87, 158), (87, 159), (87, 160), (87, 161), (87, 162), (87, 163), (87, 164), (87, 165), (87, 167), (88, 150), (88, 153), (88, 154), (88, 155), (88, 156), (88, 157), (88, 158), (88, 159), (88, 160), (88, 161), (88, 162), (88, 163), (88, 164), (88, 165), (88, 166), (88, 169),
(89, 150), (89, 152), (89, 153), (89, 154), (89, 155), (89, 156), (89, 157), (89, 158), (89, 159), (89, 160), (89, 161), (89, 162), (89, 163), (89, 164), (89, 165), (89, 166), (89, 167), (89, 170), (90, 150), (90, 152), (90, 153), (90, 154), (90, 155), (90, 156), (90, 157), (90, 158), (90, 159), (90, 160), (90, 161), (90, 162), (90, 163), (90, 164), (90, 165), (90, 166), (90, 167), (90, 168), (90, 170), (91, 150), (91, 152), (91, 153), (91, 154), (91, 155), (91, 156), (91, 157), (91, 158), (91, 159), (91, 160), (91, 161), (91, 162), (91, 163), (91, 164), (91, 165), (91, 166), (91, 167), (91, 168), (91, 170), (92, 149), (92, 151), (92, 152), (92, 153), (92, 154), (92, 155), (92, 156), (92, 157), (92, 158), (92, 159), (92, 160), (92, 161), (92, 162), (92, 163), (92, 164), (92, 165),
(92, 166), (92, 167), (92, 168), (92, 170), (93, 149), (93, 151), (93, 152), (93, 153), (93, 154), (93, 155), (93, 156), (93, 157), (93, 158), (93, 159), (93, 160), (93, 161), (93, 162), (93, 163), (93, 164), (93, 165), (93, 166), (93, 167), (93, 168), (93, 169), (93, 171), (94, 148), (94, 150), (94, 151), (94, 152), (94, 153), (94, 154), (94, 155), (94, 156), (94, 157), (94, 158), (94, 159), (94, 160), (94, 161), (94, 162), (94, 163), (94, 164), (94, 165), (94, 166), (94, 167), (94, 168), (94, 169), (94, 171), (95, 148), (95, 150), (95, 151), (95, 152), (95, 153), (95, 154), (95, 155), (95, 156), (95, 157), (95, 158), (95, 159), (95, 160), (95, 161), (95, 162), (95, 163), (95, 164), (95, 165), (95, 166), (95, 167), (95, 168), (95, 169), (95, 170), (95, 172), (96, 148), (96, 150),
(96, 151), (96, 152), (96, 153), (96, 154), (96, 155), (96, 156), (96, 157), (96, 158), (96, 159), (96, 160), (96, 161), (96, 162), (96, 163), (96, 164), (96, 165), (96, 166), (96, 167), (96, 168), (96, 169), (96, 170), (96, 172), (97, 148), (97, 150), (97, 151), (97, 152), (97, 153), (97, 154), (97, 155), (97, 156), (97, 157), (97, 158), (97, 159), (97, 160), (97, 161), (97, 162), (97, 164), (97, 165), (97, 166), (97, 167), (97, 168), (97, 169), (97, 170), (97, 171), (97, 173), (98, 147), (98, 149), (98, 150), (98, 151), (98, 152), (98, 153), (98, 154), (98, 155), (98, 156), (98, 157), (98, 158), (98, 159), (98, 160), (98, 161), (98, 162), (98, 164), (98, 165), (98, 166), (98, 167), (98, 168), (98, 169), (98, 170), (98, 171), (98, 173), (99, 147), (99, 149), (99, 150), (99, 151),
(99, 152), (99, 153), (99, 154), (99, 155), (99, 156), (99, 157), (99, 158), (99, 159), (99, 160), (99, 161), (99, 164), (99, 166), (99, 167), (99, 168), (99, 169), (99, 170), (99, 171), (99, 173), (100, 147), (100, 149), (100, 150), (100, 151), (100, 154), (100, 155), (100, 156), (100, 157), (100, 158), (100, 159), (100, 161), (100, 164), (100, 166), (100, 167), (100, 168), (100, 169), (100, 170), (100, 171), (100, 172), (100, 174), (101, 146), (101, 148), (101, 149), (101, 150), (101, 151), (101, 153), (101, 154), (101, 155), (101, 156), (101, 157), (101, 158), (101, 159), (101, 161), (101, 164), (101, 166), (101, 167), (101, 168), (101, 169), (101, 170), (101, 171), (101, 172), (101, 174), (102, 146), (102, 148), (102, 149), (102, 151), (102, 154), (102, 156), (102, 157), (102, 158), (102, 159), (102, 161), (102, 164), (102, 166),
(102, 167), (102, 168), (102, 169), (102, 170), (102, 171), (102, 172), (102, 174), (103, 146), (103, 148), (103, 149), (103, 150), (103, 154), (103, 156), (103, 157), (103, 158), (103, 159), (103, 161), (103, 164), (103, 166), (103, 167), (103, 168), (103, 169), (103, 170), (103, 171), (103, 172), (103, 174), (104, 145), (104, 147), (104, 149), (104, 150), (104, 154), (104, 156), (104, 157), (104, 158), (104, 160), (104, 164), (104, 166), (104, 167), (104, 168), (104, 169), (104, 170), (104, 171), (104, 172), (104, 174), (105, 145), (105, 147), (105, 149), (105, 154), (105, 156), (105, 157), (105, 158), (105, 160), (105, 164), (105, 166), (105, 167), (105, 168), (105, 169), (105, 170), (105, 171), (105, 172), (105, 174), (106, 145), (106, 147), (106, 149), (106, 154), (106, 156), (106, 157), (106, 158), (106, 160), (106, 164), (106, 166), (106, 167),
(106, 168), (106, 169), (106, 170), (106, 171), (106, 172), (106, 174), (107, 145), (107, 147), (107, 149), (107, 153), (107, 155), (107, 156), (107, 157), (107, 158), (107, 160), (107, 163), (107, 165), (107, 166), (107, 167), (107, 168), (107, 169), (107, 170), (107, 171), (107, 172), (107, 174), (108, 144), (108, 146), (108, 147), (108, 149), (108, 153), (108, 155), (108, 156), (108, 157), (108, 159), (108, 163), (108, 165), (108, 166), (108, 167), (108, 168), (108, 169), (108, 170), (108, 171), (108, 172), (108, 174), (109, 144), (109, 146), (109, 147), (109, 148), (109, 149), (109, 153), (109, 154), (109, 155), (109, 156), (109, 157), (109, 159), (109, 163), (109, 165), (109, 166), (109, 167), (109, 168), (109, 169), (109, 170), (109, 171), (109, 173), (110, 144), (110, 146), (110, 147), (110, 148), (110, 149), (110, 150), (110, 153), (110, 154),
(110, 155), (110, 156), (110, 157), (110, 159), (110, 163), (110, 165), (110, 166), (110, 167), (110, 168), (110, 169), (110, 170), (110, 171), (110, 173), (111, 143), (111, 145), (111, 146), (111, 147), (111, 148), (111, 149), (111, 150), (111, 152), (111, 153), (111, 154), (111, 155), (111, 156), (111, 158), (111, 163), (111, 165), (111, 166), (111, 167), (111, 168), (111, 169), (111, 170), (111, 171), (111, 173), (112, 142), (112, 144), (112, 145), (112, 146), (112, 147), (112, 148), (112, 149), (112, 150), (112, 151), (112, 152), (112, 153), (112, 154), (112, 155), (112, 156), (112, 158), (112, 163), (112, 165), (112, 166), (112, 167), (112, 168), (112, 169), (112, 170), (112, 171), (112, 173), (113, 140), (113, 143), (113, 144), (113, 145), (113, 146), (113, 147), (113, 148), (113, 149), (113, 150), (113, 151), (113, 152), (113, 153), (113, 154),
(113, 155), (113, 156), (113, 158), (113, 162), (113, 164), (113, 165), (113, 166), (113, 167), (113, 168), (113, 169), (113, 170), (113, 171), (113, 173), (114, 140), (114, 142), (114, 143), (114, 144), (114, 145), (114, 146), (114, 147), (114, 148), (114, 149), (114, 150), (114, 151), (114, 152), (114, 153), (114, 154), (114, 155), (114, 157), (114, 162), (114, 164), (114, 165), (114, 166), (114, 167), (114, 168), (114, 169), (114, 170), (114, 171), (114, 173), (115, 140), (115, 142), (115, 143), (115, 144), (115, 145), (115, 146), (115, 147), (115, 148), (115, 149), (115, 150), (115, 151), (115, 152), (115, 153), (115, 154), (115, 155), (115, 157), (115, 161), (115, 163), (115, 164), (115, 165), (115, 166), (115, 167), (115, 168), (115, 169), (115, 170), (115, 171), (115, 173), (116, 140), (116, 142), (116, 143), (116, 144), (116, 145), (116, 146),
(116, 147), (116, 148), (116, 149), (116, 150), (116, 151), (116, 152), (116, 153), (116, 154), (116, 156), (116, 161), (116, 163), (116, 164), (116, 165), (116, 166), (116, 167), (116, 168), (116, 169), (116, 170), (116, 172), (117, 140), (117, 147), (117, 148), (117, 149), (117, 150), (117, 151), (117, 152), (117, 153), (117, 155), (117, 160), (117, 161), (117, 162), (117, 163), (117, 164), (117, 165), (117, 166), (117, 167), (117, 168), (117, 169), (117, 170), (117, 172), (118, 140), (118, 142), (118, 143), (118, 144), (118, 145), (118, 146), (118, 148), (118, 149), (118, 150), (118, 151), (118, 152), (118, 154), (118, 160), (118, 162), (118, 163), (118, 164), (118, 165), (118, 166), (118, 167), (118, 168), (118, 169), (118, 171), (119, 152), (119, 154), (119, 159), (119, 161), (119, 162), (119, 163), (119, 164), (119, 165), (119, 166), (119, 167),
(119, 168), (119, 169), (119, 171), (120, 148), (120, 150), (120, 152), (120, 153), (120, 154), (120, 155), (120, 158), (120, 160), (120, 161), (120, 162), (120, 163), (120, 164), (120, 165), (120, 166), (120, 167), (120, 168), (120, 170), (121, 152), (121, 154), (121, 159), (121, 160), (121, 161), (121, 162), (121, 163), (121, 164), (121, 165), (121, 166), (121, 167), (121, 168), (121, 170), (122, 152), (122, 169), (123, 153), (123, 155), (123, 156), (123, 157), (123, 158), (123, 159), (123, 160), (123, 161), (123, 162), (123, 163), (123, 164), (123, 165), (123, 166), (123, 168), )
coordinates_5FCC60 = ((125, 166),
(126, 155), (126, 157), (126, 158), (126, 159), (126, 160), (126, 161), (126, 162), (126, 163), (126, 164), (126, 166), (127, 154), (128, 149), (128, 151), (128, 152), (128, 155), (128, 156), (128, 157), (128, 158), (128, 159), (128, 160), (128, 161), (128, 162), (128, 163), (128, 164), (128, 165), (128, 166), (128, 170), (129, 148), (129, 153), (129, 154), (129, 155), (129, 156), (129, 157), (129, 158), (129, 159), (129, 160), (129, 161), (129, 162), (129, 163), (129, 164), (129, 165), (129, 166), (129, 167), (129, 168), (129, 170), (130, 145), (130, 146), (130, 149), (130, 150), (130, 151), (130, 152), (130, 153), (130, 154), (130, 155), (130, 156), (130, 157), (130, 158), (130, 159), (130, 160), (130, 161), (130, 162), (130, 163), (130, 164), (130, 165), (130, 166), (130, 167), (130, 168), (130, 169), (130, 171), (131, 141), (131, 142), (131, 143),
(131, 144), (131, 148), (131, 149), (131, 150), (131, 151), (131, 152), (131, 153), (131, 154), (131, 155), (131, 156), (131, 157), (131, 158), (131, 159), (131, 160), (131, 161), (131, 162), (131, 163), (131, 164), (131, 165), (131, 166), (131, 167), (131, 168), (131, 169), (131, 171), (132, 142), (132, 145), (132, 146), (132, 147), (132, 148), (132, 149), (132, 150), (132, 151), (132, 152), (132, 153), (132, 154), (132, 155), (132, 156), (132, 157), (132, 158), (132, 159), (132, 160), (132, 161), (132, 162), (132, 163), (132, 164), (132, 165), (132, 166), (132, 167), (132, 168), (132, 169), (132, 171), (133, 142), (133, 144), (133, 145), (133, 146), (133, 147), (133, 148), (133, 149), (133, 150), (133, 151), (133, 152), (133, 153), (133, 154), (133, 155), (133, 156), (133, 157), (133, 158), (133, 159), (133, 160), (133, 161), (133, 162), (133, 163),
(133, 164), (133, 165), (133, 166), (133, 167), (133, 168), (133, 169), (133, 170), (133, 172), (134, 142), (134, 144), (134, 145), (134, 146), (134, 147), (134, 148), (134, 149), (134, 150), (134, 151), (134, 152), (134, 153), (134, 154), (134, 155), (134, 156), (134, 157), (134, 158), (134, 159), (134, 160), (134, 161), (134, 162), (134, 163), (134, 164), (134, 165), (134, 166), (134, 167), (134, 168), (134, 169), (134, 170), (134, 172), (135, 142), (135, 144), (135, 145), (135, 146), (135, 147), (135, 148), (135, 149), (135, 150), (135, 151), (135, 152), (135, 153), (135, 154), (135, 155), (135, 156), (135, 157), (135, 158), (135, 159), (135, 160), (135, 161), (135, 162), (135, 163), (135, 164), (135, 165), (135, 166), (135, 167), (135, 168), (135, 169), (135, 170), (135, 172), (136, 142), (136, 144), (136, 145), (136, 146), (136, 147), (136, 148),
(136, 149), (136, 150), (136, 151), (136, 152), (136, 153), (136, 154), (136, 155), (136, 156), (136, 157), (136, 158), (136, 159), (136, 160), (136, 161), (136, 162), (136, 163), (136, 164), (136, 165), (136, 166), (136, 167), (136, 168), (136, 169), (136, 170), (136, 172), (137, 142), (137, 144), (137, 145), (137, 146), (137, 147), (137, 148), (137, 149), (137, 150), (137, 151), (137, 152), (137, 153), (137, 154), (137, 155), (137, 156), (137, 157), (137, 158), (137, 159), (137, 160), (137, 161), (137, 162), (137, 163), (137, 164), (137, 165), (137, 166), (137, 167), (137, 168), (137, 169), (137, 170), (137, 171), (137, 173), (138, 143), (138, 145), (138, 146), (138, 147), (138, 148), (138, 149), (138, 150), (138, 151), (138, 152), (138, 153), (138, 154), (138, 155), (138, 156), (138, 157), (138, 158), (138, 159), (138, 160), (138, 161), (138, 162),
(138, 163), (138, 164), (138, 165), (138, 166), (138, 167), (138, 168), (138, 169), (138, 170), (138, 171), (138, 173), (139, 143), (139, 145), (139, 146), (139, 147), (139, 148), (139, 149), (139, 150), (139, 151), (139, 152), (139, 153), (139, 154), (139, 155), (139, 156), (139, 157), (139, 158), (139, 159), (139, 160), (139, 161), (139, 162), (139, 163), (139, 164), (139, 165), (139, 166), (139, 167), (139, 168), (139, 169), (139, 170), (139, 171), (139, 173), (140, 143), (140, 145), (140, 146), (140, 147), (140, 148), (140, 149), (140, 150), (140, 151), (140, 152), (140, 153), (140, 154), (140, 155), (140, 156), (140, 157), (140, 158), (140, 159), (140, 160), (140, 161), (140, 162), (140, 163), (140, 164), (140, 165), (140, 166), (140, 167), (140, 168), (140, 169), (140, 170), (140, 171), (140, 173), (141, 143), (141, 145), (141, 146), (141, 147),
(141, 148), (141, 149), (141, 150), (141, 151), (141, 152), (141, 153), (141, 154), (141, 155), (141, 156), (141, 157), (141, 158), (141, 159), (141, 160), (141, 161), (141, 162), (141, 163), (141, 164), (141, 165), (141, 166), (141, 167), (141, 168), (141, 169), (141, 170), (141, 171), (141, 172), (141, 174), (142, 144), (142, 146), (142, 147), (142, 148), (142, 149), (142, 150), (142, 151), (142, 152), (142, 153), (142, 154), (142, 155), (142, 156), (142, 157), (142, 158), (142, 159), (142, 160), (142, 161), (142, 162), (142, 163), (142, 164), (142, 165), (142, 166), (142, 167), (142, 168), (142, 169), (142, 170), (142, 171), (142, 172), (142, 174), (143, 144), (143, 146), (143, 147), (143, 148), (143, 149), (143, 150), (143, 151), (143, 152), (143, 153), (143, 154), (143, 155), (143, 156), (143, 157), (143, 158), (143, 159), (143, 160), (143, 161),
(143, 162), (143, 163), (143, 164), (143, 165), (143, 166), (143, 167), (143, 168), (143, 169), (143, 170), (143, 171), (143, 172), (143, 174), (144, 144), (144, 146), (144, 147), (144, 148), (144, 149), (144, 150), (144, 151), (144, 152), (144, 153), (144, 154), (144, 155), (144, 156), (144, 157), (144, 158), (144, 159), (144, 160), (144, 161), (144, 162), (144, 163), (144, 164), (144, 165), (144, 166), (144, 167), (144, 168), (144, 169), (144, 170), (144, 171), (144, 172), (144, 174), (145, 144), (145, 146), (145, 147), (145, 148), (145, 149), (145, 150), (145, 151), (145, 152), (145, 153), (145, 154), (145, 155), (145, 156), (145, 157), (145, 158), (145, 159), (145, 160), (145, 161), (145, 162), (145, 163), (145, 164), (145, 165), (145, 166), (145, 167), (145, 168), (145, 169), (145, 170), (145, 171), (145, 172), (145, 174), (146, 144), (146, 146),
(146, 147), (146, 148), (146, 149), (146, 150), (146, 151), (146, 152), (146, 153), (146, 154), (146, 155), (146, 156), (146, 157), (146, 158), (146, 159), (146, 160), (146, 161), (146, 162), (146, 163), (146, 164), (146, 165), (146, 166), (146, 167), (146, 168), (146, 169), (146, 170), (146, 171), (146, 173), (147, 145), (147, 147), (147, 148), (147, 149), (147, 150), (147, 151), (147, 152), (147, 153), (147, 154), (147, 155), (147, 156), (147, 157), (147, 158), (147, 159), (147, 160), (147, 161), (147, 162), (147, 163), (147, 164), (147, 165), (147, 166), (147, 167), (147, 168), (147, 169), (147, 170), (147, 171), (147, 173), (148, 146), (148, 148), (148, 149), (148, 150), (148, 151), (148, 152), (148, 153), (148, 154), (148, 155), (148, 156), (148, 157), (148, 158), (148, 159), (148, 160), (148, 161), (148, 162), (148, 163), (148, 164), (148, 165),
(148, 166), (148, 167), (148, 168), (148, 169), (148, 170), (148, 171), (148, 173), (149, 145), (149, 147), (149, 148), (149, 149), (149, 150), (149, 151), (149, 152), (149, 153), (149, 154), (149, 155), (149, 156), (149, 157), (149, 158), (149, 159), (149, 160), (149, 161), (149, 162), (149, 163), (149, 164), (149, 165), (149, 166), (149, 167), (149, 168), (149, 169), (149, 170), (149, 171), (149, 173), (150, 145), (150, 147), (150, 148), (150, 149), (150, 150), (150, 151), (150, 152), (150, 153), (150, 154), (150, 155), (150, 156), (150, 157), (150, 158), (150, 159), (150, 160), (150, 161), (150, 162), (150, 163), (150, 164), (150, 165), (150, 166), (150, 167), (150, 168), (150, 169), (150, 170), (150, 171), (150, 173), (151, 146), (151, 148), (151, 149), (151, 150), (151, 151), (151, 152), (151, 153), (151, 154), (151, 155), (151, 156), (151, 157),
(151, 158), (151, 159), (151, 160), (151, 161), (151, 162), (151, 163), (151, 164), (151, 165), (151, 166), (151, 167), (151, 168), (151, 169), (151, 170), (151, 172), (152, 147), (152, 149), (152, 150), (152, 151), (152, 152), (152, 153), (152, 154), (152, 155), (152, 156), (152, 157), (152, 158), (152, 159), (152, 160), (152, 161), (152, 162), (152, 163), (152, 164), (152, 165), (152, 166), (152, 167), (152, 168), (152, 169), (152, 170), (152, 172), (153, 147), (153, 149), (153, 150), (153, 151), (153, 152), (153, 153), (153, 154), (153, 155), (153, 156), (153, 157), (153, 158), (153, 159), (153, 160), (153, 161), (153, 162), (153, 163), (153, 164), (153, 165), (153, 166), (153, 167), (153, 168), (153, 169), (153, 171), (154, 147), (154, 149), (154, 150), (154, 151), (154, 152), (154, 153), (154, 154), (154, 155), (154, 156), (154, 157), (154, 158),
(154, 159), (154, 160), (154, 161), (154, 162), (154, 163), (154, 164), (154, 165), (154, 166), (154, 167), (154, 168), (154, 169), (154, 171), (155, 147), (155, 149), (155, 150), (155, 151), (155, 152), (155, 153), (155, 154), (155, 155), (155, 156), (155, 157), (155, 158), (155, 159), (155, 160), (155, 161), (155, 162), (155, 163), (155, 164), (155, 165), (155, 166), (155, 167), (155, 168), (155, 170), (156, 147), (156, 149), (156, 150), (156, 151), (156, 152), (156, 153), (156, 154), (156, 155), (156, 156), (156, 157), (156, 158), (156, 159), (156, 160), (156, 161), (156, 162), (156, 163), (156, 164), (156, 165), (156, 166), (156, 167), (156, 169), (157, 148), (157, 150), (157, 151), (157, 152), (157, 153), (157, 154), (157, 155), (157, 156), (157, 157), (157, 158), (157, 159), (157, 160), (157, 161), (157, 162), (157, 163), (157, 164), (157, 165),
(157, 166), (157, 167), (157, 169), (158, 149), (158, 151), (158, 152), (158, 153), (158, 154), (158, 155), (158, 156), (158, 157), (158, 158), (158, 159), (158, 160), (158, 161), (158, 162), (158, 163), (158, 164), (158, 165), (158, 166), (158, 168), (159, 150), (159, 152), (159, 153), (159, 154), (159, 155), (159, 156), (159, 157), (159, 158), (159, 159), (159, 160), (159, 161), (159, 162), (159, 163), (159, 164), (159, 165), (159, 166), (159, 168), (160, 150), (160, 152), (160, 153), (160, 154), (160, 155), (160, 156), (160, 157), (160, 158), (160, 159), (160, 160), (160, 161), (160, 162), (160, 163), (160, 164), (160, 165), (160, 167), (161, 151), (161, 153), (161, 154), (161, 155), (161, 156), (161, 157), (161, 158), (161, 159), (161, 160), (161, 161), (161, 162), (161, 163), (161, 164), (161, 166), (162, 151), (162, 153), (162, 154), (162, 155),
(162, 156), (162, 157), (162, 160), (162, 161), (162, 162), (162, 163), (162, 166), (163, 152), (163, 153), (163, 154), (163, 155), (163, 156), (163, 158), (163, 159), (163, 165), (164, 152), (164, 154), (164, 155), (164, 156), (164, 160), (164, 161), (164, 163), (165, 152), (165, 154), (165, 156), (166, 153), (166, 155), (167, 154), (167, 155), )
coordinates_F4DEB3 = ((130, 78),
(130, 79), (131, 78), (131, 80), (132, 77), (132, 80), (133, 77), (133, 79), (133, 80), (133, 82), (133, 83), (133, 84), (133, 85), (134, 77), (134, 79), (134, 80), (134, 87), (134, 97), (135, 77), (135, 79), (135, 80), (135, 81), (135, 82), (135, 83), (135, 84), (135, 85), (135, 88), (135, 94), (135, 96), (136, 77), (136, 79), (136, 80), (136, 81), (136, 82), (136, 83), (136, 84), (136, 85), (136, 86), (136, 87), (136, 94), (136, 96), (137, 77), (137, 79), (137, 80), (137, 81), (137, 82), (137, 83), (137, 84), (137, 85), (137, 86), (137, 87), (137, 89), (137, 94), (137, 96), (138, 77), (138, 82), (138, 83), (138, 84), (138, 85), (138, 86), (138, 88), (138, 96), (139, 79), (139, 80), (139, 81), (139, 82), (139, 83), (139, 84), (139, 85), (139, 87), (139, 95), (139, 97), (140, 83),
(140, 86), (140, 96), (140, 97), (141, 83), (141, 85), (141, 97), (142, 82), (142, 84), (143, 81), (143, 83), (144, 80), (144, 82), (144, 83), (144, 87), (144, 89), (144, 90), (144, 91), (144, 92), (145, 80), (145, 83), (145, 86), (145, 89), (145, 93), (145, 95), (146, 80), (146, 82), (146, 84), (146, 87), (146, 96), (147, 83), (147, 85), )
coordinates_26408B = ((123, 88),
(123, 90), (123, 91), (123, 92), (123, 93), (123, 94), (123, 95), (124, 86), (124, 93), (124, 96), (124, 97), (124, 98), (124, 99), (124, 100), (124, 101), (124, 102), (124, 103), (124, 104), (124, 105), (124, 106), (124, 108), (125, 85), (125, 88), (125, 89), (125, 91), (125, 94), (125, 95), (125, 108), (126, 84), (126, 86), (126, 87), (126, 88), (126, 90), (126, 95), (126, 97), (126, 98), (126, 99), (126, 100), (126, 101), (126, 102), (126, 103), (126, 104), (126, 105), (126, 106), (126, 108), (127, 81), (127, 89), (127, 95), (127, 97), (127, 98), (127, 99), (127, 100), (127, 101), (127, 102), (127, 103), (127, 104), (127, 105), (127, 106), (127, 108), (128, 80), (128, 84), (128, 85), (128, 86), (128, 87), (128, 94), (128, 96), (128, 97), (128, 98), (128, 99), (128, 100), (128, 101), (128, 102), (128, 103),
(128, 104), (128, 105), (128, 108), (129, 81), (129, 83), (129, 94), (129, 97), (129, 98), (129, 99), (129, 100), (129, 101), (129, 102), (129, 103), (129, 107), (130, 93), (130, 96), (130, 105), (131, 94), (131, 97), (131, 99), (131, 100), (131, 101), (131, 103), (133, 93), )
coordinates_F5DEB3 = ((94, 106),
(95, 105), (95, 106), (96, 104), (97, 103), (97, 105), (98, 103), (99, 81), (99, 83), (99, 101), (99, 102), (100, 80), (100, 85), (100, 97), (100, 98), (100, 99), (100, 101), (101, 80), (101, 82), (101, 86), (101, 93), (101, 94), (101, 95), (101, 96), (101, 97), (101, 98), (101, 100), (102, 79), (102, 81), (102, 83), (102, 86), (102, 91), (102, 92), (103, 79), (103, 81), (103, 82), (103, 85), (103, 86), (103, 90), (103, 92), (104, 79), (104, 81), (104, 85), (104, 86), (104, 90), (104, 92), (105, 78), (105, 81), (105, 86), (105, 90), (106, 78), (106, 80), (106, 86), (106, 90), (106, 91), (107, 78), (107, 80), (107, 86), (107, 90), (107, 91), (108, 77), (108, 79), (108, 87), (108, 91), (109, 77), (109, 79), (109, 87), (109, 91), (110, 77), (110, 79), (110, 88), (110, 91), (111, 77),
(111, 79), (111, 89), (111, 91), (112, 77), (112, 79), (113, 77), (113, 79), (114, 77), (114, 79), (115, 77), (115, 78), )
coordinates_016400 = ((123, 130),
(123, 132), (123, 133), (124, 132), (124, 134), (124, 135), (124, 136), (124, 138), (125, 134), (126, 134), (126, 136), (126, 137), (126, 139), (127, 134), (127, 136), (127, 137), (127, 139), (128, 134), (128, 136), (128, 137), (128, 139), (129, 135), (129, 137), (129, 139), (130, 135), (130, 137), (130, 139), (131, 135), (131, 137), (131, 139), (132, 134), (132, 136), (132, 140), (133, 133), (133, 135), (133, 138), (133, 140), (134, 133), (134, 136), (134, 140), (135, 132), (135, 135), (135, 140), (136, 131), (136, 134), (136, 140), (137, 130), (137, 133), (137, 140), (138, 129), (138, 133), (138, 139), (138, 140), (139, 129), (139, 132), (139, 138), (139, 141), (140, 130), (140, 137), (140, 139), (140, 141), (141, 137), (141, 139), (141, 141), (142, 138), (142, 141), (143, 139), (143, 141), (144, 140), (144, 142), (145, 142), (146, 137), (146, 140),
(146, 142), (147, 137), (147, 139), (148, 136), )
coordinates_CC5B45 = ((147, 89),
(147, 91), (147, 92), (147, 93), (147, 94), (148, 87), (148, 97), (149, 86), (149, 89), (149, 90), (149, 91), (149, 92), (149, 93), (149, 94), (149, 95), (149, 97), (150, 86), (150, 88), (150, 89), (150, 90), (150, 91), (150, 92), (150, 93), (150, 96), (150, 97), (151, 86), (151, 88), (151, 89), (151, 90), (151, 91), (151, 93), (152, 86), (152, 88), (152, 89), (152, 90), (152, 91), (152, 93), (153, 86), (153, 88), (153, 89), (153, 90), (153, 91), (153, 92), (153, 94), (154, 87), (154, 89), (154, 90), (154, 91), (154, 92), (154, 94), (155, 87), (155, 89), (155, 90), (155, 91), (155, 92), (155, 93), (155, 95), (156, 88), (156, 90), (156, 91), (156, 92), (156, 94), (156, 96), (157, 88), (157, 90), (157, 91), (157, 96), (158, 89), (158, 94), (158, 96), (159, 90), (159, 91), )
coordinates_27408B = ((104, 105),
(105, 102), (105, 105), (106, 100), (106, 105), (107, 98), (107, 99), (107, 102), (107, 103), (107, 105), (108, 97), (108, 100), (108, 101), (108, 102), (108, 103), (108, 105), (109, 97), (109, 102), (109, 103), (109, 104), (109, 106), (110, 96), (110, 100), (110, 101), (110, 102), (110, 103), (110, 104), (110, 106), (111, 96), (111, 98), (111, 102), (111, 104), (111, 106), (112, 82), (112, 96), (112, 97), (112, 102), (112, 104), (112, 106), (113, 81), (113, 85), (113, 102), (113, 105), (114, 81), (114, 83), (114, 86), (114, 101), (114, 103), (114, 105), (115, 80), (115, 82), (115, 83), (115, 84), (115, 85), (115, 87), (115, 100), (115, 102), (115, 104), (116, 81), (116, 82), (116, 83), (116, 84), (116, 85), (116, 86), (116, 88), (116, 100), (116, 102), (116, 104), (117, 78), (117, 81), (117, 82), (117, 83), (117, 84),
(117, 85), (117, 86), (117, 87), (117, 90), (117, 93), (117, 96), (117, 100), (117, 103), (118, 78), (118, 82), (118, 83), (118, 84), (118, 85), (118, 86), (118, 87), (118, 88), (118, 91), (118, 96), (118, 100), (118, 103), (119, 81), (119, 83), (119, 84), (119, 85), (119, 86), (119, 87), (119, 88), (119, 89), (119, 92), (119, 93), (119, 95), (119, 97), (119, 100), (119, 103), (120, 82), (120, 86), (120, 90), (120, 95), (120, 102), (121, 83), (121, 85), (121, 88), (121, 89), (121, 95), (121, 97), (121, 98), (121, 99), (121, 100), (121, 102), (122, 102), )
coordinates_006400 = ((105, 134),
(105, 136), (105, 137), (105, 138), (105, 139), (105, 140), (105, 141), (105, 143), (106, 130), (106, 134), (107, 129), (107, 131), (107, 135), (107, 137), (107, 138), (107, 139), (107, 140), (107, 142), (108, 128), (108, 131), (108, 135), (108, 137), (108, 138), (108, 139), (108, 140), (108, 142), (109, 128), (109, 131), (109, 135), (109, 137), (109, 138), (109, 139), (109, 140), (109, 142), (110, 128), (110, 131), (110, 135), (110, 137), (110, 141), (111, 128), (111, 131), (111, 136), (111, 138), (111, 140), (112, 129), (112, 131), (112, 136), (113, 129), (113, 131), (113, 136), (113, 137), (114, 129), (114, 132), (114, 136), (115, 129), (115, 132), (115, 136), (115, 138), (116, 122), (116, 125), (116, 129), (116, 131), (116, 133), (116, 136), (116, 138), (117, 122), (117, 126), (117, 129), (117, 131), (117, 132), (117, 135), (117, 136), (117, 138),
(118, 121), (118, 123), (118, 124), (118, 125), (118, 127), (118, 128), (118, 130), (118, 133), (118, 136), (118, 138), (119, 121), (119, 124), (119, 126), (119, 130), (119, 134), (120, 120), (120, 121), (120, 124), (120, 130), (121, 119), (121, 122), (121, 125), (121, 126), (121, 127), (121, 128), (121, 130), (122, 119), (122, 121), (122, 122), (122, 123), )
coordinates_CD5B45 = ((75, 103),
(75, 105), (75, 106), (75, 108), (76, 102), (76, 108), (77, 101), (77, 103), (77, 108), (78, 101), (78, 104), (78, 105), (78, 106), (78, 108), (79, 101), (79, 103), (80, 101), (80, 102), (81, 95), (81, 96), (81, 100), (81, 102), (82, 93), (82, 94), (82, 100), (82, 101), (83, 92), (83, 95), (83, 96), (83, 98), (83, 101), (84, 91), (84, 93), (84, 94), (84, 95), (84, 96), (84, 97), (84, 99), (84, 101), (85, 89), (85, 92), (85, 93), (85, 94), (85, 95), (85, 96), (85, 97), (85, 98), (85, 99), (85, 101), (86, 88), (86, 91), (86, 92), (86, 93), (86, 94), (86, 95), (86, 96), (86, 97), (86, 98), (86, 100), (87, 88), (87, 90), (87, 91), (87, 92), (87, 93), (87, 94), (87, 95), (87, 96), (87, 97), (87, 98), (87, 100), (88, 87), (88, 89), (88, 90),
(88, 91), (88, 92), (88, 93), (88, 94), (88, 95), (88, 96), (88, 97), (88, 98), (88, 100), (89, 87), (89, 89), (89, 90), (89, 91), (89, 92), (89, 93), (89, 94), (89, 95), (89, 96), (89, 97), (89, 98), (89, 100), (89, 108), (90, 87), (90, 89), (90, 90), (90, 91), (90, 92), (90, 93), (90, 94), (90, 95), (90, 96), (90, 97), (90, 99), (90, 105), (90, 108), (91, 87), (91, 89), (91, 90), (91, 91), (91, 92), (91, 93), (91, 94), (91, 95), (91, 96), (91, 99), (91, 104), (91, 107), (92, 86), (92, 88), (92, 89), (92, 90), (92, 91), (92, 92), (92, 93), (92, 98), (92, 103), (92, 107), (93, 84), (93, 87), (93, 88), (93, 89), (93, 90), (93, 91), (93, 92), (93, 95), (93, 102), (93, 105), (94, 83), (94, 86), (94, 87), (94, 88), (94, 89),
(94, 90), (94, 91), (94, 93), (94, 101), (94, 104), (95, 83), (95, 85), (95, 86), (95, 87), (95, 88), (95, 89), (95, 90), (95, 92), (95, 100), (95, 103), (96, 84), (96, 86), (96, 87), (96, 88), (96, 89), (96, 90), (96, 91), (96, 92), (96, 99), (96, 102), (97, 84), (97, 87), (97, 88), (97, 89), (97, 90), (97, 91), (97, 92), (97, 93), (97, 94), (97, 95), (97, 96), (97, 97), (97, 101), (98, 85), (98, 89), (98, 90), (98, 91), (98, 97), (98, 99), (99, 87), (99, 92), (99, 93), (99, 94), (99, 95), (100, 89), (100, 91), )
coordinates_6395ED = ((124, 124),
(124, 126), (124, 128), (125, 123), (125, 128), (126, 122), (126, 124), (126, 125), (126, 126), (126, 128), (127, 122), (127, 124), (127, 125), (127, 126), (127, 128), (128, 121), (128, 123), (128, 124), (128, 125), (128, 126), (128, 128), (129, 121), (129, 123), (129, 124), (129, 125), (129, 126), (129, 127), (129, 129), (130, 121), (130, 123), (130, 124), (130, 125), (130, 126), (130, 127), (130, 129), (131, 121), (131, 125), (131, 126), (131, 127), (131, 129), (132, 123), (132, 124), (132, 126), (132, 128), (133, 121), (133, 122), (133, 125), (133, 128), (134, 126), (134, 127), )
coordinates_00FFFE = ((148, 142),
(149, 138), (149, 139), (149, 140), (149, 143), (150, 142), (150, 143), (151, 142), (151, 144), (152, 142), (152, 144), (153, 142), (153, 143), (153, 145), (154, 136), (154, 138), (154, 139), (154, 140), (154, 142), (154, 143), (154, 145), (155, 138), (155, 141), (155, 142), (155, 143), (155, 145), (156, 140), (156, 142), (156, 143), (156, 145), (157, 141), (157, 144), (158, 142), (158, 144), (159, 143), (159, 144), )
coordinates_B4E7FA = ((120, 140),
(120, 142), (120, 143), (120, 144), (120, 146), (121, 141), (122, 143), (122, 144), (122, 146), (122, 147), (123, 145), (123, 147), (124, 146), (124, 147), (125, 146), (125, 147), (126, 145), (126, 147), (127, 143), (127, 147), (128, 141), (128, 144), (128, 146), (129, 141), (129, 143), )
coordinates_F98072 = ((124, 110),
(125, 110), (125, 112), (125, 116), (125, 118), (125, 121), (126, 110), (126, 112), (126, 117), (126, 119), (127, 110), (128, 110), (129, 109), (129, 111), (130, 108), (130, 110), (130, 112), (131, 107), (131, 109), (131, 110), (131, 112), (132, 105), (132, 110), (132, 111), (133, 102), (133, 106), (133, 107), (133, 108), (133, 111), (133, 112), (134, 102), (134, 104), (134, 110), (134, 112), (134, 113), (134, 115), (135, 111), (135, 113), (135, 114), (135, 116), (136, 112), (136, 115), (136, 117), (137, 113), (137, 118), (138, 114), (138, 116), (138, 118), )
coordinates_97FB98 = ((156, 137),
(157, 137), (157, 138), (158, 138), (158, 139), (159, 138), (159, 140), (160, 121), (160, 130), (160, 131), (160, 133), (160, 134), (160, 135), (160, 136), (160, 137), (160, 138), (160, 139), (160, 141), (161, 121), (161, 130), (161, 138), (161, 139), (161, 140), (161, 144), (162, 129), (162, 131), (162, 132), (162, 133), (162, 134), (162, 135), (162, 136), (162, 137), (162, 138), (162, 139), (162, 140), (162, 141), (163, 120), (163, 129), (163, 131), (163, 132), (163, 133), (163, 134), (163, 135), (163, 136), (163, 137), (163, 138), (163, 139), (163, 140), (163, 143), (164, 119), (164, 120), (164, 128), (164, 130), (164, 131), (164, 132), (164, 133), (164, 134), (164, 135), (164, 136), (164, 137), (164, 138), (164, 139), (164, 141), (165, 120), (165, 128), (165, 129), (165, 130), (165, 131), (165, 132), (165, 133), (165, 134), (165, 135), (165, 136),
(165, 137), (165, 138), (165, 139), (165, 141), (166, 118), (166, 120), (166, 127), (166, 129), (166, 130), (166, 133), (166, 134), (166, 135), (166, 136), (166, 137), (166, 138), (166, 140), (167, 117), (167, 120), (167, 126), (167, 128), (167, 129), (167, 132), (167, 135), (167, 136), (167, 137), (167, 138), (167, 140), (168, 116), (168, 118), (168, 120), (168, 126), (168, 128), (168, 130), (168, 133), (168, 134), (168, 140), (169, 116), (169, 118), (169, 120), (169, 125), (169, 127), (169, 130), (169, 135), (169, 136), (169, 137), (169, 138), (169, 140), (170, 116), (170, 118), (170, 119), (170, 120), (170, 122), (170, 123), (170, 126), (170, 129), (171, 116), (171, 127), (171, 128), (172, 118), (172, 120), (172, 121), (172, 122), (172, 123), (172, 124), (172, 125), )
coordinates_323287 = ((148, 108),
(149, 105), (149, 109), (150, 103), (150, 108), (150, 110), (151, 99), (151, 101), (151, 106), (151, 107), (151, 111), (152, 101), (152, 104), (152, 105), (152, 108), (152, 112), (153, 102), (153, 103), (153, 110), (153, 114), (154, 111), (154, 112), (156, 101), (156, 102), (157, 100), (157, 103), (158, 98), (158, 101), (158, 103), (159, 98), (159, 100), (159, 101), (159, 103), (160, 99), (160, 100), (160, 101), (160, 102), (160, 104), (160, 113), (160, 115), (160, 116), (160, 117), (160, 119), (161, 98), (161, 100), (161, 101), (161, 102), (161, 104), (161, 112), (161, 119), (162, 98), (162, 102), (162, 104), (162, 111), (162, 113), (162, 114), (162, 115), (162, 116), (162, 118), (163, 99), (163, 103), (163, 105), (163, 111), (163, 113), (163, 114), (163, 115), (163, 116), (163, 118), (164, 102), (164, 105), (164, 111), (164, 113), (164, 114),
(164, 115), (164, 117), (165, 103), (165, 105), (165, 111), (165, 113), (165, 114), (165, 116), (166, 104), (166, 106), (166, 110), (166, 111), (166, 112), (166, 113), (166, 115), (167, 104), (167, 110), (167, 111), (167, 112), (167, 113), (167, 115), (168, 105), (168, 109), (168, 110), (168, 111), (168, 112), (168, 114), (169, 105), (169, 114), (170, 106), (170, 108), (170, 109), (170, 110), (170, 111), (170, 112), )
coordinates_6495ED = ((107, 121),
(108, 120), (108, 123), (109, 119), (109, 121), (109, 123), (110, 118), (110, 120), (110, 122), (111, 117), (111, 120), (111, 122), (112, 116), (112, 118), (112, 119), (112, 121), (113, 115), (113, 118), (113, 120), (114, 114), (114, 117), (114, 118), (114, 120), (115, 114), (115, 116), (115, 117), (115, 119), (116, 114), (116, 116), (116, 117), (116, 119), (117, 114), (117, 116), (117, 118), (118, 114), (118, 116), (118, 118), (119, 117), (120, 115), (120, 117), (121, 116), (121, 117), (122, 117), )
coordinates_01FFFF = ((90, 141),
(90, 143), (90, 144), (90, 145), (90, 146), (90, 147), (91, 140), (92, 140), (92, 143), (92, 144), (92, 146), (93, 142), (93, 144), (93, 146), (94, 143), (94, 146), (95, 143), (95, 146), (96, 137), (96, 142), (96, 144), (96, 146), (97, 136), (97, 138), (97, 139), (97, 140), (97, 141), (97, 143), (97, 145), (98, 135), (98, 137), (98, 142), (98, 143), (98, 145), (99, 135), (99, 137), (99, 138), (99, 139), (99, 140), (99, 141), (99, 142), (99, 143), (99, 145), (100, 135), (100, 137), (100, 138), (100, 139), (100, 140), (100, 141), (100, 142), (100, 143), (100, 144), (100, 145), (101, 134), (101, 136), (101, 137), (101, 138), (101, 139), (101, 140), (101, 141), (101, 142), (101, 144), (102, 134), (102, 144), (103, 134), (103, 136), (103, 137), (103, 138), (103, 139), (103, 140), (103, 141), (103, 143), )
coordinates_FA8072 = ((102, 108),
(103, 107), (103, 110), (104, 107), (104, 111), (105, 107), (105, 109), (105, 111), (106, 107), (106, 109), (106, 111), (107, 108), (107, 111), (108, 108), (108, 110), (108, 111), (108, 112), (109, 108), (109, 110), (109, 111), (110, 108), (110, 110), (110, 113), (111, 108), (111, 112), (112, 108), (112, 111), (113, 108), (113, 110), (114, 107), (114, 109), (115, 107), (115, 108), (116, 106), (117, 106), (117, 107), (118, 105), (118, 107), (119, 105), (119, 106), (120, 106), (120, 111), (120, 113), (121, 104), (121, 109), (121, 114), (122, 104), (122, 106), (122, 107), (122, 108), (122, 109), (122, 110), (122, 111), (122, 112), (122, 113), (122, 115), )
coordinates_98FB98 = ((75, 132),
(75, 134), (75, 135), (76, 136), (76, 137), (76, 138), (77, 133), (77, 135), (77, 140), (77, 141), (77, 142), (77, 144), (78, 133), (78, 135), (78, 136), (78, 137), (78, 139), (78, 145), (79, 133), (79, 135), (79, 136), (79, 137), (79, 141), (79, 142), (79, 143), (79, 146), (80, 134), (80, 137), (80, 141), (80, 143), (80, 144), (80, 146), (81, 134), (81, 137), (81, 141), (81, 143), (81, 144), (81, 146), (82, 133), (82, 136), (82, 141), (82, 143), (82, 144), (82, 145), (82, 147), (83, 133), (83, 136), (83, 141), (83, 143), (83, 144), (83, 145), (83, 147), (84, 132), (84, 134), (84, 136), (84, 141), (84, 143), (84, 144), (84, 145), (84, 147), (85, 132), (85, 134), (85, 135), (85, 137), (85, 142), (85, 144), (85, 145), (85, 147), (86, 133), (86, 135), (86, 137), (86, 143), (86, 145),
(86, 147), (87, 134), (87, 137), (87, 143), (87, 147), (88, 134), (88, 137), (88, 142), (88, 144), (88, 146), (89, 135), (89, 136), )
coordinates_FEC0CB = ((133, 99),
(133, 100), (134, 99), (135, 99), (136, 99), (137, 98), (137, 100), (138, 98), (138, 102), (139, 100), (139, 104), (140, 100), (140, 102), (140, 105), (141, 99), (141, 103), (141, 104), (141, 105), (142, 98), (142, 99), (142, 100), (142, 101), (142, 104), (142, 106), (143, 103), (143, 106), (143, 110), (143, 112), (144, 104), (144, 106), (144, 108), (144, 109), (144, 113), (145, 104), (145, 110), (145, 112), (146, 104), (146, 106), (146, 107), (146, 108), (146, 110), (146, 112), (147, 99), (147, 101), (147, 104), (147, 105), (147, 109), (147, 112), (148, 100), (148, 103), (148, 110), (148, 112), (149, 101), (149, 111), (149, 113), (150, 112), (150, 114), (151, 114), )
coordinates_333287 = ((72, 118),
(72, 120), (72, 121), (73, 117), (73, 122), (73, 123), (73, 124), (73, 125), (73, 127), (74, 110), (74, 112), (74, 116), (74, 118), (74, 119), (74, 120), (74, 128), (75, 110), (75, 113), (75, 114), (75, 117), (75, 118), (75, 122), (75, 124), (75, 125), (75, 129), (76, 110), (76, 112), (76, 116), (76, 118), (76, 122), (76, 127), (76, 130), (77, 110), (77, 113), (77, 114), (77, 115), (77, 116), (77, 117), (77, 119), (77, 128), (78, 112), (78, 114), (78, 115), (78, 116), (78, 117), (78, 118), (78, 120), (78, 128), (78, 131), (79, 113), (79, 115), (79, 116), (79, 117), (79, 118), (79, 119), (79, 121), (79, 129), (79, 131), (80, 114), (80, 116), (80, 117), (80, 118), (80, 119), (80, 120), (80, 122), (80, 129), (80, 131), (81, 115), (81, 117), (81, 118), (81, 119), (81, 120), (81, 122),
(81, 129), (81, 131), (82, 117), (82, 118), (82, 119), (82, 120), (82, 121), (82, 123), (82, 129), (82, 131), (83, 116), (83, 118), (83, 119), (83, 120), (83, 121), (83, 123), (83, 129), (83, 130), (84, 117), (84, 119), (84, 120), (84, 121), (84, 122), (84, 123), (84, 124), (84, 130), (85, 118), (85, 120), (85, 121), (85, 122), (85, 124), (85, 130), (86, 119), (86, 123), (86, 130), (87, 120), (87, 122), (87, 130), (87, 131), (88, 130), (88, 132), (89, 131), (89, 133), (91, 109), (91, 110), (92, 111), (93, 113), (94, 116), (94, 118), (95, 118), (95, 119), )
coordinates_FFC0CB = ((94, 108),
(94, 110), (94, 111), (95, 108), (95, 110), (95, 111), (95, 112), (95, 114), (96, 115), (96, 116), (97, 116), (97, 118), (98, 118), )
| coordinates_e0_e1_e1 = ((125, 114), (126, 93), (126, 114), (126, 130), (126, 132), (127, 92), (127, 93), (127, 104), (127, 114), (127, 115), (127, 130), (128, 91), (128, 92), (128, 102), (128, 104), (128, 114), (128, 117), (128, 119), (128, 131), (128, 132), (129, 91), (129, 101), (129, 114), (129, 119), (129, 131), (129, 132), (130, 86), (130, 87), (130, 88), (130, 91), (130, 114), (130, 116), (130, 118), (130, 131), (130, 133), (131, 82), (131, 84), (131, 85), (131, 90), (131, 115), (131, 118), (131, 131), (132, 87), (132, 90), (132, 116), (132, 118), (132, 132), (133, 89), (133, 91), (133, 117), (133, 119), (133, 130), (133, 131), (134, 90), (134, 91), (134, 118), (134, 119), (134, 130), (135, 90), (135, 91), (135, 101), (135, 106), (135, 108), (135, 119), (135, 121), (135, 122), (135, 125), (135, 129), (135, 130), (135, 138), (136, 91), (136, 92), (136, 102), (136, 104), (136, 105), (136, 109), (136, 119), (136, 126), (136, 129), (136, 138), (137, 91), (137, 92), (137, 104), (137, 107), (137, 108), (137, 120), (137, 122), (137, 123), (137, 124), (137, 125), (137, 128), (137, 136), (137, 137), (138, 90), (138, 92), (138, 106), (138, 108), (138, 109), (138, 112), (138, 120), (138, 122), (138, 123), (138, 124), (138, 125), (138, 127), (138, 135), (138, 136), (139, 90), (139, 93), (139, 107), (139, 109), (139, 110), (139, 113), (139, 120), (139, 122), (139, 123), (139, 124), (139, 125), (139, 127), (139, 134), (139, 135), (140, 89), (140, 91), (140, 93), (140, 107), (140, 114), (140, 115), (140, 118), (140, 119), (140, 120), (140, 121), (140, 122), (140, 123), (140, 124), (140, 125), (140, 127), (140, 133), (140, 135), (141, 88), (141, 94), (141, 108), (141, 110), (141, 111), (141, 112), (141, 116), (141, 117), (141, 120), (141, 121), (141, 122), (141, 123), (141, 124), (141, 125), (141, 126), (141, 128), (141, 132), (141, 135), (142, 86), (142, 87), (142, 88), (142, 89), (142, 90), (142, 91), (142, 92), (142, 93), (142, 95), (142, 108), (142, 114), (142, 118), (142, 119), (142, 120), (142, 121), (142, 122), (142, 123), (142, 124), (142, 125), (142, 126), (142, 127), (142, 130), (142, 131), (142, 133), (142, 135), (143, 85), (143, 94), (143, 96), (143, 115), (143, 117), (143, 118), (143, 119), (143, 120), (143, 121), (143, 122), (143, 123), (143, 124), (143, 125), (143, 126), (143, 127), (143, 128), (143, 132), (143, 133), (143, 134), (143, 136), (144, 97), (144, 99), (144, 101), (144, 115), (144, 117), (144, 118), (144, 119), (144, 120), (144, 121), (144, 122), (144, 123), (144, 124), (144, 125), (144, 126), (144, 127), (144, 128), (144, 129), (144, 130), (144, 131), (144, 132), (144, 133), (144, 134), (144, 135), (144, 138), (145, 98), (145, 100), (145, 102), (145, 114), (145, 115), (145, 116), (145, 117), (145, 118), (145, 119), (145, 120), (145, 121), (145, 122), (145, 123), (145, 124), (145, 125), (145, 126), (145, 127), (145, 128), (145, 129), (145, 130), (145, 131), (145, 132), (145, 133), (145, 134), (145, 136), (146, 114), (146, 116), (146, 117), (146, 118), (146, 119), (146, 120), (146, 121), (146, 122), (146, 123), (146, 124), (146, 125), (146, 126), (146, 127), (146, 128), (146, 129), (146, 130), (146, 131), (146, 132), (146, 133), (146, 135), (147, 114), (147, 116), (147, 117), (147, 118), (147, 119), (147, 120), (147, 121), (147, 122), (147, 123), (147, 124), (147, 125), (147, 126), (147, 127), (147, 128), (147, 129), (147, 130), (147, 131), (147, 132), (147, 134), (148, 114), (148, 116), (148, 117), (148, 118), (148, 119), (148, 120), (148, 121), (148, 122), (148, 123), (148, 124), (148, 125), (148, 126), (148, 127), (148, 128), (148, 129), (148, 130), (148, 131), (148, 132), (148, 134), (149, 115), (149, 117), (149, 118), (149, 119), (149, 120), (149, 121), (149, 122), (149, 123), (149, 124), (149, 125), (149, 126), (149, 127), (149, 128), (149, 129), (149, 130), (149, 131), (149, 132), (149, 134), (150, 116), (150, 118), (150, 119), (150, 120), (150, 121), (150, 122), (150, 123), (150, 124), (150, 125), (150, 126), (150, 127), (150, 128), (150, 129), (150, 130), (150, 131), (150, 132), (150, 134), (151, 95), (151, 116), (151, 117), (151, 118), (151, 119), (151, 120), (151, 121), (151, 122), (151, 123), (151, 124), (151, 125), (151, 126), (151, 127), (151, 128), (151, 129), (151, 130), (151, 131), (151, 132), (151, 133), (151, 134), (151, 135), (151, 136), (151, 137), (151, 138), (151, 140), (152, 95), (152, 96), (152, 117), (152, 119), (152, 120), (152, 121), (152, 122), (152, 123), (152, 124), (152, 125), (152, 126), (152, 127), (152, 128), (152, 129), (152, 130), (152, 131), (152, 132), (152, 133), (152, 134), (152, 135), (152, 138), (152, 140), (153, 96), (153, 99), (153, 117), (153, 119), (153, 120), (153, 121), (153, 122), (153, 123), (153, 124), (153, 125), (153, 126), (153, 127), (153, 128), (153, 129), (153, 130), (153, 131), (153, 132), (153, 134), (154, 97), (154, 100), (154, 101), (154, 105), (154, 108), (154, 116), (154, 118), (154, 119), (154, 120), (154, 121), (154, 122), (154, 123), (154, 124), (154, 125), (154, 126), (154, 127), (154, 128), (154, 129), (154, 130), (154, 131), (154, 132), (154, 134), (155, 99), (155, 104), (155, 109), (155, 114), (155, 117), (155, 118), (155, 119), (155, 120), (155, 121), (155, 122), (155, 123), (155, 124), (155, 125), (155, 126), (155, 127), (155, 128), (155, 129), (155, 130), (155, 131), (155, 132), (155, 134), (156, 98), (156, 105), (156, 107), (156, 108), (156, 111), (156, 112), (156, 113), (156, 122), (156, 123), (156, 124), (156, 125), (156, 126), (156, 127), (156, 128), (156, 129), (156, 130), (156, 131), (156, 134), (157, 105), (157, 107), (157, 108), (157, 109), (157, 115), (157, 116), (157, 117), (157, 118), (157, 119), (157, 120), (157, 123), (157, 124), (157, 125), (157, 126), (157, 127), (157, 128), (157, 129), (157, 132), (157, 133), (157, 135), (158, 105), (158, 106), (158, 107), (158, 108), (158, 109), (158, 110), (158, 113), (158, 122), (158, 123), (158, 124), (158, 125), (158, 126), (158, 127), (158, 128), (158, 130), (158, 131), (158, 136), (159, 106), (159, 108), (159, 109), (159, 111), (159, 123), (159, 125), (159, 126), (159, 127), (159, 129), (160, 106), (160, 108), (160, 110), (160, 123), (160, 125), (160, 126), (160, 128), (161, 106), (161, 109), (161, 123), (161, 125), (161, 127), (162, 107), (162, 109), (162, 123), (162, 125), (162, 127), (163, 107), (163, 109), (163, 122), (163, 124), (163, 126), (163, 137), (164, 107), (164, 122), (164, 124), (164, 126), (164, 137), (165, 108), (165, 122), (165, 125), (166, 122), (166, 125), (167, 122), (167, 124), (168, 122), (168, 123))
coordinates_e1_e1_e1 = ((77, 124), (77, 125), (78, 123), (78, 126), (79, 110), (79, 126), (80, 104), (80, 106), (80, 111), (80, 124), (80, 127), (80, 139), (81, 104), (81, 107), (81, 110), (81, 112), (81, 125), (81, 127), (81, 139), (82, 104), (82, 106), (82, 109), (82, 110), (82, 111), (82, 113), (82, 125), (82, 127), (82, 139), (83, 103), (83, 105), (83, 106), (83, 107), (83, 108), (83, 109), (83, 110), (83, 111), (83, 112), (83, 114), (83, 127), (83, 139), (84, 103), (84, 105), (84, 106), (84, 107), (84, 108), (84, 109), (84, 110), (84, 111), (84, 112), (84, 113), (84, 126), (84, 127), (84, 139), (85, 103), (85, 105), (85, 106), (85, 107), (85, 108), (85, 109), (85, 110), (85, 111), (85, 112), (85, 113), (85, 115), (85, 126), (85, 127), (85, 139), (85, 140), (86, 103), (86, 105), (86, 110), (86, 111), (86, 112), (86, 113), (86, 114), (86, 116), (86, 126), (86, 127), (86, 139), (86, 141), (87, 103), (87, 107), (87, 108), (87, 109), (87, 110), (87, 111), (87, 112), (87, 113), (87, 114), (87, 115), (87, 117), (87, 125), (87, 128), (87, 139), (87, 141), (88, 102), (88, 105), (88, 110), (88, 112), (88, 113), (88, 114), (88, 115), (88, 116), (88, 118), (88, 124), (88, 126), (88, 128), (88, 139), (88, 140), (89, 102), (89, 104), (89, 110), (89, 113), (89, 114), (89, 115), (89, 116), (89, 117), (89, 120), (89, 121), (89, 122), (89, 125), (89, 126), (89, 127), (89, 129), (89, 139), (90, 102), (90, 111), (90, 114), (90, 115), (90, 116), (90, 124), (90, 125), (90, 126), (90, 127), (90, 128), (90, 130), (90, 138), (90, 139), (91, 101), (91, 113), (91, 117), (91, 118), (91, 120), (91, 121), (91, 122), (91, 123), (91, 124), (91, 125), (91, 126), (91, 127), (91, 128), (91, 129), (91, 131), (91, 132), (91, 136), (91, 138), (92, 100), (92, 114), (92, 119), (92, 121), (92, 122), (92, 123), (92, 124), (92, 125), (92, 126), (92, 127), (92, 128), (92, 129), (92, 130), (92, 133), (92, 134), (92, 135), (92, 138), (93, 99), (93, 120), (93, 122), (93, 123), (93, 124), (93, 125), (93, 126), (93, 127), (93, 128), (93, 129), (93, 130), (93, 131), (93, 132), (93, 133), (93, 135), (93, 139), (94, 98), (94, 121), (94, 123), (94, 124), (94, 125), (94, 126), (94, 127), (94, 128), (94, 129), (94, 130), (94, 131), (94, 132), (94, 133), (94, 134), (94, 137), (94, 141), (95, 94), (95, 97), (95, 121), (95, 123), (95, 124), (95, 125), (95, 126), (95, 127), (95, 128), (95, 129), (95, 130), (95, 131), (95, 132), (95, 133), (95, 135), (95, 139), (95, 141), (96, 89), (96, 121), (96, 123), (96, 124), (96, 125), (96, 126), (96, 127), (96, 128), (96, 129), (96, 130), (96, 131), (96, 132), (96, 134), (97, 107), (97, 109), (97, 110), (97, 111), (97, 113), (97, 121), (97, 123), (97, 124), (97, 125), (97, 126), (97, 127), (97, 128), (97, 129), (97, 130), (97, 131), (97, 133), (98, 106), (98, 114), (98, 120), (98, 122), (98, 123), (98, 124), (98, 125), (98, 126), (98, 127), (98, 128), (98, 129), (98, 130), (98, 131), (98, 133), (99, 105), (99, 110), (99, 111), (99, 112), (99, 113), (99, 116), (99, 120), (99, 122), (99, 123), (99, 124), (99, 125), (99, 126), (99, 127), (99, 128), (99, 129), (99, 130), (99, 131), (99, 133), (100, 104), (100, 107), (100, 108), (100, 109), (100, 112), (100, 113), (100, 114), (100, 117), (100, 118), (100, 120), (100, 121), (100, 122), (100, 123), (100, 124), (100, 125), (100, 126), (100, 127), (100, 128), (100, 129), (100, 130), (100, 132), (101, 103), (101, 106), (101, 110), (101, 113), (101, 114), (101, 115), (101, 116), (101, 120), (101, 121), (101, 122), (101, 123), (101, 124), (101, 125), (101, 126), (101, 127), (101, 128), (101, 129), (101, 130), (101, 132), (102, 101), (102, 105), (102, 112), (102, 114), (102, 115), (102, 116), (102, 117), (102, 118), (102, 119), (102, 120), (102, 121), (102, 122), (102, 123), (102, 124), (102, 125), (102, 126), (102, 127), (102, 128), (102, 129), (102, 130), (102, 132), (103, 94), (103, 96), (103, 97), (103, 98), (103, 99), (103, 100), (103, 101), (103, 102), (103, 103), (103, 113), (103, 115), (103, 116), (103, 117), (103, 118), (103, 119), (103, 120), (103, 121), (103, 122), (103, 123), (103, 124), (103, 125), (103, 126), (103, 127), (103, 128), (103, 132), (104, 83), (104, 94), (104, 100), (104, 113), (104, 115), (104, 116), (104, 117), (104, 118), (104, 119), (104, 120), (104, 124), (104, 125), (104, 126), (104, 127), (104, 130), (104, 132), (105, 83), (105, 94), (105, 96), (105, 98), (105, 113), (105, 115), (105, 116), (105, 117), (105, 118), (105, 119), (105, 121), (105, 122), (105, 125), (105, 126), (105, 128), (105, 132), (106, 82), (106, 84), (106, 94), (106, 97), (106, 113), (106, 116), (106, 117), (106, 120), (106, 124), (106, 127), (106, 132), (107, 82), (107, 84), (107, 94), (107, 96), (107, 114), (107, 116), (107, 119), (107, 125), (107, 127), (108, 82), (108, 84), (108, 95), (108, 116), (108, 118), (108, 125), (108, 126), (108, 133), (109, 81), (109, 85), (109, 93), (109, 94), (109, 116), (109, 117), (109, 125), (109, 126), (109, 133), (110, 81), (110, 83), (110, 84), (110, 86), (110, 93), (110, 94), (110, 115), (110, 116), (110, 126), (110, 133), (111, 85), (111, 93), (111, 94), (111, 114), (111, 115), (111, 124), (111, 126), (112, 87), (112, 88), (112, 93), (112, 94), (112, 100), (112, 113), (112, 114), (112, 123), (112, 126), (112, 134), (113, 88), (113, 90), (113, 91), (113, 93), (113, 94), (113, 99), (113, 112), (113, 113), (113, 123), (113, 127), (113, 134), (114, 89), (114, 96), (114, 98), (114, 111), (114, 112), (114, 122), (114, 124), (114, 125), (114, 127), (114, 134), (115, 90), (115, 92), (115, 93), (115, 94), (115, 95), (115, 96), (115, 98), (115, 110), (115, 112), (115, 127), (116, 91), (116, 98), (116, 110), (116, 112), (116, 127), (117, 98), (117, 109), (117, 112), (118, 98), (118, 109), (118, 112), (119, 108), (119, 109))
coordinates_771286 = ((142, 125), (143, 125))
coordinates_781286 = ((102, 125), (103, 126), (104, 125))
coordinates_dcf8_a4 = ((104, 152), (105, 152), (105, 162), (108, 161), (109, 161), (110, 161), (111, 161), (112, 160), (113, 160), (114, 159), (115, 159), (116, 159), (117, 158), (118, 157))
coordinates_dbf8_a4 = ((132, 157), (133, 157), (134, 158), (135, 158), (135, 159), (136, 159), (137, 160), (138, 160), (139, 160), (140, 160), (145, 152), (150, 162), (151, 162))
coordinates_60_cc60 = ((81, 159), (81, 162), (82, 156), (82, 163), (83, 154), (83, 155), (83, 159), (83, 160), (83, 161), (83, 163), (84, 153), (84, 156), (84, 157), (84, 158), (84, 159), (84, 160), (84, 161), (84, 162), (84, 164), (85, 153), (85, 155), (85, 156), (85, 157), (85, 158), (85, 159), (85, 160), (85, 161), (85, 162), (85, 163), (85, 165), (86, 153), (86, 155), (86, 156), (86, 157), (86, 158), (86, 159), (86, 160), (86, 161), (86, 162), (86, 163), (86, 164), (86, 166), (87, 152), (87, 153), (87, 154), (87, 155), (87, 156), (87, 157), (87, 158), (87, 159), (87, 160), (87, 161), (87, 162), (87, 163), (87, 164), (87, 165), (87, 167), (88, 150), (88, 153), (88, 154), (88, 155), (88, 156), (88, 157), (88, 158), (88, 159), (88, 160), (88, 161), (88, 162), (88, 163), (88, 164), (88, 165), (88, 166), (88, 169), (89, 150), (89, 152), (89, 153), (89, 154), (89, 155), (89, 156), (89, 157), (89, 158), (89, 159), (89, 160), (89, 161), (89, 162), (89, 163), (89, 164), (89, 165), (89, 166), (89, 167), (89, 170), (90, 150), (90, 152), (90, 153), (90, 154), (90, 155), (90, 156), (90, 157), (90, 158), (90, 159), (90, 160), (90, 161), (90, 162), (90, 163), (90, 164), (90, 165), (90, 166), (90, 167), (90, 168), (90, 170), (91, 150), (91, 152), (91, 153), (91, 154), (91, 155), (91, 156), (91, 157), (91, 158), (91, 159), (91, 160), (91, 161), (91, 162), (91, 163), (91, 164), (91, 165), (91, 166), (91, 167), (91, 168), (91, 170), (92, 149), (92, 151), (92, 152), (92, 153), (92, 154), (92, 155), (92, 156), (92, 157), (92, 158), (92, 159), (92, 160), (92, 161), (92, 162), (92, 163), (92, 164), (92, 165), (92, 166), (92, 167), (92, 168), (92, 170), (93, 149), (93, 151), (93, 152), (93, 153), (93, 154), (93, 155), (93, 156), (93, 157), (93, 158), (93, 159), (93, 160), (93, 161), (93, 162), (93, 163), (93, 164), (93, 165), (93, 166), (93, 167), (93, 168), (93, 169), (93, 171), (94, 148), (94, 150), (94, 151), (94, 152), (94, 153), (94, 154), (94, 155), (94, 156), (94, 157), (94, 158), (94, 159), (94, 160), (94, 161), (94, 162), (94, 163), (94, 164), (94, 165), (94, 166), (94, 167), (94, 168), (94, 169), (94, 171), (95, 148), (95, 150), (95, 151), (95, 152), (95, 153), (95, 154), (95, 155), (95, 156), (95, 157), (95, 158), (95, 159), (95, 160), (95, 161), (95, 162), (95, 163), (95, 164), (95, 165), (95, 166), (95, 167), (95, 168), (95, 169), (95, 170), (95, 172), (96, 148), (96, 150), (96, 151), (96, 152), (96, 153), (96, 154), (96, 155), (96, 156), (96, 157), (96, 158), (96, 159), (96, 160), (96, 161), (96, 162), (96, 163), (96, 164), (96, 165), (96, 166), (96, 167), (96, 168), (96, 169), (96, 170), (96, 172), (97, 148), (97, 150), (97, 151), (97, 152), (97, 153), (97, 154), (97, 155), (97, 156), (97, 157), (97, 158), (97, 159), (97, 160), (97, 161), (97, 162), (97, 164), (97, 165), (97, 166), (97, 167), (97, 168), (97, 169), (97, 170), (97, 171), (97, 173), (98, 147), (98, 149), (98, 150), (98, 151), (98, 152), (98, 153), (98, 154), (98, 155), (98, 156), (98, 157), (98, 158), (98, 159), (98, 160), (98, 161), (98, 162), (98, 164), (98, 165), (98, 166), (98, 167), (98, 168), (98, 169), (98, 170), (98, 171), (98, 173), (99, 147), (99, 149), (99, 150), (99, 151), (99, 152), (99, 153), (99, 154), (99, 155), (99, 156), (99, 157), (99, 158), (99, 159), (99, 160), (99, 161), (99, 164), (99, 166), (99, 167), (99, 168), (99, 169), (99, 170), (99, 171), (99, 173), (100, 147), (100, 149), (100, 150), (100, 151), (100, 154), (100, 155), (100, 156), (100, 157), (100, 158), (100, 159), (100, 161), (100, 164), (100, 166), (100, 167), (100, 168), (100, 169), (100, 170), (100, 171), (100, 172), (100, 174), (101, 146), (101, 148), (101, 149), (101, 150), (101, 151), (101, 153), (101, 154), (101, 155), (101, 156), (101, 157), (101, 158), (101, 159), (101, 161), (101, 164), (101, 166), (101, 167), (101, 168), (101, 169), (101, 170), (101, 171), (101, 172), (101, 174), (102, 146), (102, 148), (102, 149), (102, 151), (102, 154), (102, 156), (102, 157), (102, 158), (102, 159), (102, 161), (102, 164), (102, 166), (102, 167), (102, 168), (102, 169), (102, 170), (102, 171), (102, 172), (102, 174), (103, 146), (103, 148), (103, 149), (103, 150), (103, 154), (103, 156), (103, 157), (103, 158), (103, 159), (103, 161), (103, 164), (103, 166), (103, 167), (103, 168), (103, 169), (103, 170), (103, 171), (103, 172), (103, 174), (104, 145), (104, 147), (104, 149), (104, 150), (104, 154), (104, 156), (104, 157), (104, 158), (104, 160), (104, 164), (104, 166), (104, 167), (104, 168), (104, 169), (104, 170), (104, 171), (104, 172), (104, 174), (105, 145), (105, 147), (105, 149), (105, 154), (105, 156), (105, 157), (105, 158), (105, 160), (105, 164), (105, 166), (105, 167), (105, 168), (105, 169), (105, 170), (105, 171), (105, 172), (105, 174), (106, 145), (106, 147), (106, 149), (106, 154), (106, 156), (106, 157), (106, 158), (106, 160), (106, 164), (106, 166), (106, 167), (106, 168), (106, 169), (106, 170), (106, 171), (106, 172), (106, 174), (107, 145), (107, 147), (107, 149), (107, 153), (107, 155), (107, 156), (107, 157), (107, 158), (107, 160), (107, 163), (107, 165), (107, 166), (107, 167), (107, 168), (107, 169), (107, 170), (107, 171), (107, 172), (107, 174), (108, 144), (108, 146), (108, 147), (108, 149), (108, 153), (108, 155), (108, 156), (108, 157), (108, 159), (108, 163), (108, 165), (108, 166), (108, 167), (108, 168), (108, 169), (108, 170), (108, 171), (108, 172), (108, 174), (109, 144), (109, 146), (109, 147), (109, 148), (109, 149), (109, 153), (109, 154), (109, 155), (109, 156), (109, 157), (109, 159), (109, 163), (109, 165), (109, 166), (109, 167), (109, 168), (109, 169), (109, 170), (109, 171), (109, 173), (110, 144), (110, 146), (110, 147), (110, 148), (110, 149), (110, 150), (110, 153), (110, 154), (110, 155), (110, 156), (110, 157), (110, 159), (110, 163), (110, 165), (110, 166), (110, 167), (110, 168), (110, 169), (110, 170), (110, 171), (110, 173), (111, 143), (111, 145), (111, 146), (111, 147), (111, 148), (111, 149), (111, 150), (111, 152), (111, 153), (111, 154), (111, 155), (111, 156), (111, 158), (111, 163), (111, 165), (111, 166), (111, 167), (111, 168), (111, 169), (111, 170), (111, 171), (111, 173), (112, 142), (112, 144), (112, 145), (112, 146), (112, 147), (112, 148), (112, 149), (112, 150), (112, 151), (112, 152), (112, 153), (112, 154), (112, 155), (112, 156), (112, 158), (112, 163), (112, 165), (112, 166), (112, 167), (112, 168), (112, 169), (112, 170), (112, 171), (112, 173), (113, 140), (113, 143), (113, 144), (113, 145), (113, 146), (113, 147), (113, 148), (113, 149), (113, 150), (113, 151), (113, 152), (113, 153), (113, 154), (113, 155), (113, 156), (113, 158), (113, 162), (113, 164), (113, 165), (113, 166), (113, 167), (113, 168), (113, 169), (113, 170), (113, 171), (113, 173), (114, 140), (114, 142), (114, 143), (114, 144), (114, 145), (114, 146), (114, 147), (114, 148), (114, 149), (114, 150), (114, 151), (114, 152), (114, 153), (114, 154), (114, 155), (114, 157), (114, 162), (114, 164), (114, 165), (114, 166), (114, 167), (114, 168), (114, 169), (114, 170), (114, 171), (114, 173), (115, 140), (115, 142), (115, 143), (115, 144), (115, 145), (115, 146), (115, 147), (115, 148), (115, 149), (115, 150), (115, 151), (115, 152), (115, 153), (115, 154), (115, 155), (115, 157), (115, 161), (115, 163), (115, 164), (115, 165), (115, 166), (115, 167), (115, 168), (115, 169), (115, 170), (115, 171), (115, 173), (116, 140), (116, 142), (116, 143), (116, 144), (116, 145), (116, 146), (116, 147), (116, 148), (116, 149), (116, 150), (116, 151), (116, 152), (116, 153), (116, 154), (116, 156), (116, 161), (116, 163), (116, 164), (116, 165), (116, 166), (116, 167), (116, 168), (116, 169), (116, 170), (116, 172), (117, 140), (117, 147), (117, 148), (117, 149), (117, 150), (117, 151), (117, 152), (117, 153), (117, 155), (117, 160), (117, 161), (117, 162), (117, 163), (117, 164), (117, 165), (117, 166), (117, 167), (117, 168), (117, 169), (117, 170), (117, 172), (118, 140), (118, 142), (118, 143), (118, 144), (118, 145), (118, 146), (118, 148), (118, 149), (118, 150), (118, 151), (118, 152), (118, 154), (118, 160), (118, 162), (118, 163), (118, 164), (118, 165), (118, 166), (118, 167), (118, 168), (118, 169), (118, 171), (119, 152), (119, 154), (119, 159), (119, 161), (119, 162), (119, 163), (119, 164), (119, 165), (119, 166), (119, 167), (119, 168), (119, 169), (119, 171), (120, 148), (120, 150), (120, 152), (120, 153), (120, 154), (120, 155), (120, 158), (120, 160), (120, 161), (120, 162), (120, 163), (120, 164), (120, 165), (120, 166), (120, 167), (120, 168), (120, 170), (121, 152), (121, 154), (121, 159), (121, 160), (121, 161), (121, 162), (121, 163), (121, 164), (121, 165), (121, 166), (121, 167), (121, 168), (121, 170), (122, 152), (122, 169), (123, 153), (123, 155), (123, 156), (123, 157), (123, 158), (123, 159), (123, 160), (123, 161), (123, 162), (123, 163), (123, 164), (123, 165), (123, 166), (123, 168))
coordinates_5_fcc60 = ((125, 166), (126, 155), (126, 157), (126, 158), (126, 159), (126, 160), (126, 161), (126, 162), (126, 163), (126, 164), (126, 166), (127, 154), (128, 149), (128, 151), (128, 152), (128, 155), (128, 156), (128, 157), (128, 158), (128, 159), (128, 160), (128, 161), (128, 162), (128, 163), (128, 164), (128, 165), (128, 166), (128, 170), (129, 148), (129, 153), (129, 154), (129, 155), (129, 156), (129, 157), (129, 158), (129, 159), (129, 160), (129, 161), (129, 162), (129, 163), (129, 164), (129, 165), (129, 166), (129, 167), (129, 168), (129, 170), (130, 145), (130, 146), (130, 149), (130, 150), (130, 151), (130, 152), (130, 153), (130, 154), (130, 155), (130, 156), (130, 157), (130, 158), (130, 159), (130, 160), (130, 161), (130, 162), (130, 163), (130, 164), (130, 165), (130, 166), (130, 167), (130, 168), (130, 169), (130, 171), (131, 141), (131, 142), (131, 143), (131, 144), (131, 148), (131, 149), (131, 150), (131, 151), (131, 152), (131, 153), (131, 154), (131, 155), (131, 156), (131, 157), (131, 158), (131, 159), (131, 160), (131, 161), (131, 162), (131, 163), (131, 164), (131, 165), (131, 166), (131, 167), (131, 168), (131, 169), (131, 171), (132, 142), (132, 145), (132, 146), (132, 147), (132, 148), (132, 149), (132, 150), (132, 151), (132, 152), (132, 153), (132, 154), (132, 155), (132, 156), (132, 157), (132, 158), (132, 159), (132, 160), (132, 161), (132, 162), (132, 163), (132, 164), (132, 165), (132, 166), (132, 167), (132, 168), (132, 169), (132, 171), (133, 142), (133, 144), (133, 145), (133, 146), (133, 147), (133, 148), (133, 149), (133, 150), (133, 151), (133, 152), (133, 153), (133, 154), (133, 155), (133, 156), (133, 157), (133, 158), (133, 159), (133, 160), (133, 161), (133, 162), (133, 163), (133, 164), (133, 165), (133, 166), (133, 167), (133, 168), (133, 169), (133, 170), (133, 172), (134, 142), (134, 144), (134, 145), (134, 146), (134, 147), (134, 148), (134, 149), (134, 150), (134, 151), (134, 152), (134, 153), (134, 154), (134, 155), (134, 156), (134, 157), (134, 158), (134, 159), (134, 160), (134, 161), (134, 162), (134, 163), (134, 164), (134, 165), (134, 166), (134, 167), (134, 168), (134, 169), (134, 170), (134, 172), (135, 142), (135, 144), (135, 145), (135, 146), (135, 147), (135, 148), (135, 149), (135, 150), (135, 151), (135, 152), (135, 153), (135, 154), (135, 155), (135, 156), (135, 157), (135, 158), (135, 159), (135, 160), (135, 161), (135, 162), (135, 163), (135, 164), (135, 165), (135, 166), (135, 167), (135, 168), (135, 169), (135, 170), (135, 172), (136, 142), (136, 144), (136, 145), (136, 146), (136, 147), (136, 148), (136, 149), (136, 150), (136, 151), (136, 152), (136, 153), (136, 154), (136, 155), (136, 156), (136, 157), (136, 158), (136, 159), (136, 160), (136, 161), (136, 162), (136, 163), (136, 164), (136, 165), (136, 166), (136, 167), (136, 168), (136, 169), (136, 170), (136, 172), (137, 142), (137, 144), (137, 145), (137, 146), (137, 147), (137, 148), (137, 149), (137, 150), (137, 151), (137, 152), (137, 153), (137, 154), (137, 155), (137, 156), (137, 157), (137, 158), (137, 159), (137, 160), (137, 161), (137, 162), (137, 163), (137, 164), (137, 165), (137, 166), (137, 167), (137, 168), (137, 169), (137, 170), (137, 171), (137, 173), (138, 143), (138, 145), (138, 146), (138, 147), (138, 148), (138, 149), (138, 150), (138, 151), (138, 152), (138, 153), (138, 154), (138, 155), (138, 156), (138, 157), (138, 158), (138, 159), (138, 160), (138, 161), (138, 162), (138, 163), (138, 164), (138, 165), (138, 166), (138, 167), (138, 168), (138, 169), (138, 170), (138, 171), (138, 173), (139, 143), (139, 145), (139, 146), (139, 147), (139, 148), (139, 149), (139, 150), (139, 151), (139, 152), (139, 153), (139, 154), (139, 155), (139, 156), (139, 157), (139, 158), (139, 159), (139, 160), (139, 161), (139, 162), (139, 163), (139, 164), (139, 165), (139, 166), (139, 167), (139, 168), (139, 169), (139, 170), (139, 171), (139, 173), (140, 143), (140, 145), (140, 146), (140, 147), (140, 148), (140, 149), (140, 150), (140, 151), (140, 152), (140, 153), (140, 154), (140, 155), (140, 156), (140, 157), (140, 158), (140, 159), (140, 160), (140, 161), (140, 162), (140, 163), (140, 164), (140, 165), (140, 166), (140, 167), (140, 168), (140, 169), (140, 170), (140, 171), (140, 173), (141, 143), (141, 145), (141, 146), (141, 147), (141, 148), (141, 149), (141, 150), (141, 151), (141, 152), (141, 153), (141, 154), (141, 155), (141, 156), (141, 157), (141, 158), (141, 159), (141, 160), (141, 161), (141, 162), (141, 163), (141, 164), (141, 165), (141, 166), (141, 167), (141, 168), (141, 169), (141, 170), (141, 171), (141, 172), (141, 174), (142, 144), (142, 146), (142, 147), (142, 148), (142, 149), (142, 150), (142, 151), (142, 152), (142, 153), (142, 154), (142, 155), (142, 156), (142, 157), (142, 158), (142, 159), (142, 160), (142, 161), (142, 162), (142, 163), (142, 164), (142, 165), (142, 166), (142, 167), (142, 168), (142, 169), (142, 170), (142, 171), (142, 172), (142, 174), (143, 144), (143, 146), (143, 147), (143, 148), (143, 149), (143, 150), (143, 151), (143, 152), (143, 153), (143, 154), (143, 155), (143, 156), (143, 157), (143, 158), (143, 159), (143, 160), (143, 161), (143, 162), (143, 163), (143, 164), (143, 165), (143, 166), (143, 167), (143, 168), (143, 169), (143, 170), (143, 171), (143, 172), (143, 174), (144, 144), (144, 146), (144, 147), (144, 148), (144, 149), (144, 150), (144, 151), (144, 152), (144, 153), (144, 154), (144, 155), (144, 156), (144, 157), (144, 158), (144, 159), (144, 160), (144, 161), (144, 162), (144, 163), (144, 164), (144, 165), (144, 166), (144, 167), (144, 168), (144, 169), (144, 170), (144, 171), (144, 172), (144, 174), (145, 144), (145, 146), (145, 147), (145, 148), (145, 149), (145, 150), (145, 151), (145, 152), (145, 153), (145, 154), (145, 155), (145, 156), (145, 157), (145, 158), (145, 159), (145, 160), (145, 161), (145, 162), (145, 163), (145, 164), (145, 165), (145, 166), (145, 167), (145, 168), (145, 169), (145, 170), (145, 171), (145, 172), (145, 174), (146, 144), (146, 146), (146, 147), (146, 148), (146, 149), (146, 150), (146, 151), (146, 152), (146, 153), (146, 154), (146, 155), (146, 156), (146, 157), (146, 158), (146, 159), (146, 160), (146, 161), (146, 162), (146, 163), (146, 164), (146, 165), (146, 166), (146, 167), (146, 168), (146, 169), (146, 170), (146, 171), (146, 173), (147, 145), (147, 147), (147, 148), (147, 149), (147, 150), (147, 151), (147, 152), (147, 153), (147, 154), (147, 155), (147, 156), (147, 157), (147, 158), (147, 159), (147, 160), (147, 161), (147, 162), (147, 163), (147, 164), (147, 165), (147, 166), (147, 167), (147, 168), (147, 169), (147, 170), (147, 171), (147, 173), (148, 146), (148, 148), (148, 149), (148, 150), (148, 151), (148, 152), (148, 153), (148, 154), (148, 155), (148, 156), (148, 157), (148, 158), (148, 159), (148, 160), (148, 161), (148, 162), (148, 163), (148, 164), (148, 165), (148, 166), (148, 167), (148, 168), (148, 169), (148, 170), (148, 171), (148, 173), (149, 145), (149, 147), (149, 148), (149, 149), (149, 150), (149, 151), (149, 152), (149, 153), (149, 154), (149, 155), (149, 156), (149, 157), (149, 158), (149, 159), (149, 160), (149, 161), (149, 162), (149, 163), (149, 164), (149, 165), (149, 166), (149, 167), (149, 168), (149, 169), (149, 170), (149, 171), (149, 173), (150, 145), (150, 147), (150, 148), (150, 149), (150, 150), (150, 151), (150, 152), (150, 153), (150, 154), (150, 155), (150, 156), (150, 157), (150, 158), (150, 159), (150, 160), (150, 161), (150, 162), (150, 163), (150, 164), (150, 165), (150, 166), (150, 167), (150, 168), (150, 169), (150, 170), (150, 171), (150, 173), (151, 146), (151, 148), (151, 149), (151, 150), (151, 151), (151, 152), (151, 153), (151, 154), (151, 155), (151, 156), (151, 157), (151, 158), (151, 159), (151, 160), (151, 161), (151, 162), (151, 163), (151, 164), (151, 165), (151, 166), (151, 167), (151, 168), (151, 169), (151, 170), (151, 172), (152, 147), (152, 149), (152, 150), (152, 151), (152, 152), (152, 153), (152, 154), (152, 155), (152, 156), (152, 157), (152, 158), (152, 159), (152, 160), (152, 161), (152, 162), (152, 163), (152, 164), (152, 165), (152, 166), (152, 167), (152, 168), (152, 169), (152, 170), (152, 172), (153, 147), (153, 149), (153, 150), (153, 151), (153, 152), (153, 153), (153, 154), (153, 155), (153, 156), (153, 157), (153, 158), (153, 159), (153, 160), (153, 161), (153, 162), (153, 163), (153, 164), (153, 165), (153, 166), (153, 167), (153, 168), (153, 169), (153, 171), (154, 147), (154, 149), (154, 150), (154, 151), (154, 152), (154, 153), (154, 154), (154, 155), (154, 156), (154, 157), (154, 158), (154, 159), (154, 160), (154, 161), (154, 162), (154, 163), (154, 164), (154, 165), (154, 166), (154, 167), (154, 168), (154, 169), (154, 171), (155, 147), (155, 149), (155, 150), (155, 151), (155, 152), (155, 153), (155, 154), (155, 155), (155, 156), (155, 157), (155, 158), (155, 159), (155, 160), (155, 161), (155, 162), (155, 163), (155, 164), (155, 165), (155, 166), (155, 167), (155, 168), (155, 170), (156, 147), (156, 149), (156, 150), (156, 151), (156, 152), (156, 153), (156, 154), (156, 155), (156, 156), (156, 157), (156, 158), (156, 159), (156, 160), (156, 161), (156, 162), (156, 163), (156, 164), (156, 165), (156, 166), (156, 167), (156, 169), (157, 148), (157, 150), (157, 151), (157, 152), (157, 153), (157, 154), (157, 155), (157, 156), (157, 157), (157, 158), (157, 159), (157, 160), (157, 161), (157, 162), (157, 163), (157, 164), (157, 165), (157, 166), (157, 167), (157, 169), (158, 149), (158, 151), (158, 152), (158, 153), (158, 154), (158, 155), (158, 156), (158, 157), (158, 158), (158, 159), (158, 160), (158, 161), (158, 162), (158, 163), (158, 164), (158, 165), (158, 166), (158, 168), (159, 150), (159, 152), (159, 153), (159, 154), (159, 155), (159, 156), (159, 157), (159, 158), (159, 159), (159, 160), (159, 161), (159, 162), (159, 163), (159, 164), (159, 165), (159, 166), (159, 168), (160, 150), (160, 152), (160, 153), (160, 154), (160, 155), (160, 156), (160, 157), (160, 158), (160, 159), (160, 160), (160, 161), (160, 162), (160, 163), (160, 164), (160, 165), (160, 167), (161, 151), (161, 153), (161, 154), (161, 155), (161, 156), (161, 157), (161, 158), (161, 159), (161, 160), (161, 161), (161, 162), (161, 163), (161, 164), (161, 166), (162, 151), (162, 153), (162, 154), (162, 155), (162, 156), (162, 157), (162, 160), (162, 161), (162, 162), (162, 163), (162, 166), (163, 152), (163, 153), (163, 154), (163, 155), (163, 156), (163, 158), (163, 159), (163, 165), (164, 152), (164, 154), (164, 155), (164, 156), (164, 160), (164, 161), (164, 163), (165, 152), (165, 154), (165, 156), (166, 153), (166, 155), (167, 154), (167, 155))
coordinates_f4_deb3 = ((130, 78), (130, 79), (131, 78), (131, 80), (132, 77), (132, 80), (133, 77), (133, 79), (133, 80), (133, 82), (133, 83), (133, 84), (133, 85), (134, 77), (134, 79), (134, 80), (134, 87), (134, 97), (135, 77), (135, 79), (135, 80), (135, 81), (135, 82), (135, 83), (135, 84), (135, 85), (135, 88), (135, 94), (135, 96), (136, 77), (136, 79), (136, 80), (136, 81), (136, 82), (136, 83), (136, 84), (136, 85), (136, 86), (136, 87), (136, 94), (136, 96), (137, 77), (137, 79), (137, 80), (137, 81), (137, 82), (137, 83), (137, 84), (137, 85), (137, 86), (137, 87), (137, 89), (137, 94), (137, 96), (138, 77), (138, 82), (138, 83), (138, 84), (138, 85), (138, 86), (138, 88), (138, 96), (139, 79), (139, 80), (139, 81), (139, 82), (139, 83), (139, 84), (139, 85), (139, 87), (139, 95), (139, 97), (140, 83), (140, 86), (140, 96), (140, 97), (141, 83), (141, 85), (141, 97), (142, 82), (142, 84), (143, 81), (143, 83), (144, 80), (144, 82), (144, 83), (144, 87), (144, 89), (144, 90), (144, 91), (144, 92), (145, 80), (145, 83), (145, 86), (145, 89), (145, 93), (145, 95), (146, 80), (146, 82), (146, 84), (146, 87), (146, 96), (147, 83), (147, 85))
coordinates_26408_b = ((123, 88), (123, 90), (123, 91), (123, 92), (123, 93), (123, 94), (123, 95), (124, 86), (124, 93), (124, 96), (124, 97), (124, 98), (124, 99), (124, 100), (124, 101), (124, 102), (124, 103), (124, 104), (124, 105), (124, 106), (124, 108), (125, 85), (125, 88), (125, 89), (125, 91), (125, 94), (125, 95), (125, 108), (126, 84), (126, 86), (126, 87), (126, 88), (126, 90), (126, 95), (126, 97), (126, 98), (126, 99), (126, 100), (126, 101), (126, 102), (126, 103), (126, 104), (126, 105), (126, 106), (126, 108), (127, 81), (127, 89), (127, 95), (127, 97), (127, 98), (127, 99), (127, 100), (127, 101), (127, 102), (127, 103), (127, 104), (127, 105), (127, 106), (127, 108), (128, 80), (128, 84), (128, 85), (128, 86), (128, 87), (128, 94), (128, 96), (128, 97), (128, 98), (128, 99), (128, 100), (128, 101), (128, 102), (128, 103), (128, 104), (128, 105), (128, 108), (129, 81), (129, 83), (129, 94), (129, 97), (129, 98), (129, 99), (129, 100), (129, 101), (129, 102), (129, 103), (129, 107), (130, 93), (130, 96), (130, 105), (131, 94), (131, 97), (131, 99), (131, 100), (131, 101), (131, 103), (133, 93))
coordinates_f5_deb3 = ((94, 106), (95, 105), (95, 106), (96, 104), (97, 103), (97, 105), (98, 103), (99, 81), (99, 83), (99, 101), (99, 102), (100, 80), (100, 85), (100, 97), (100, 98), (100, 99), (100, 101), (101, 80), (101, 82), (101, 86), (101, 93), (101, 94), (101, 95), (101, 96), (101, 97), (101, 98), (101, 100), (102, 79), (102, 81), (102, 83), (102, 86), (102, 91), (102, 92), (103, 79), (103, 81), (103, 82), (103, 85), (103, 86), (103, 90), (103, 92), (104, 79), (104, 81), (104, 85), (104, 86), (104, 90), (104, 92), (105, 78), (105, 81), (105, 86), (105, 90), (106, 78), (106, 80), (106, 86), (106, 90), (106, 91), (107, 78), (107, 80), (107, 86), (107, 90), (107, 91), (108, 77), (108, 79), (108, 87), (108, 91), (109, 77), (109, 79), (109, 87), (109, 91), (110, 77), (110, 79), (110, 88), (110, 91), (111, 77), (111, 79), (111, 89), (111, 91), (112, 77), (112, 79), (113, 77), (113, 79), (114, 77), (114, 79), (115, 77), (115, 78))
coordinates_016400 = ((123, 130), (123, 132), (123, 133), (124, 132), (124, 134), (124, 135), (124, 136), (124, 138), (125, 134), (126, 134), (126, 136), (126, 137), (126, 139), (127, 134), (127, 136), (127, 137), (127, 139), (128, 134), (128, 136), (128, 137), (128, 139), (129, 135), (129, 137), (129, 139), (130, 135), (130, 137), (130, 139), (131, 135), (131, 137), (131, 139), (132, 134), (132, 136), (132, 140), (133, 133), (133, 135), (133, 138), (133, 140), (134, 133), (134, 136), (134, 140), (135, 132), (135, 135), (135, 140), (136, 131), (136, 134), (136, 140), (137, 130), (137, 133), (137, 140), (138, 129), (138, 133), (138, 139), (138, 140), (139, 129), (139, 132), (139, 138), (139, 141), (140, 130), (140, 137), (140, 139), (140, 141), (141, 137), (141, 139), (141, 141), (142, 138), (142, 141), (143, 139), (143, 141), (144, 140), (144, 142), (145, 142), (146, 137), (146, 140), (146, 142), (147, 137), (147, 139), (148, 136))
coordinates_cc5_b45 = ((147, 89), (147, 91), (147, 92), (147, 93), (147, 94), (148, 87), (148, 97), (149, 86), (149, 89), (149, 90), (149, 91), (149, 92), (149, 93), (149, 94), (149, 95), (149, 97), (150, 86), (150, 88), (150, 89), (150, 90), (150, 91), (150, 92), (150, 93), (150, 96), (150, 97), (151, 86), (151, 88), (151, 89), (151, 90), (151, 91), (151, 93), (152, 86), (152, 88), (152, 89), (152, 90), (152, 91), (152, 93), (153, 86), (153, 88), (153, 89), (153, 90), (153, 91), (153, 92), (153, 94), (154, 87), (154, 89), (154, 90), (154, 91), (154, 92), (154, 94), (155, 87), (155, 89), (155, 90), (155, 91), (155, 92), (155, 93), (155, 95), (156, 88), (156, 90), (156, 91), (156, 92), (156, 94), (156, 96), (157, 88), (157, 90), (157, 91), (157, 96), (158, 89), (158, 94), (158, 96), (159, 90), (159, 91))
coordinates_27408_b = ((104, 105), (105, 102), (105, 105), (106, 100), (106, 105), (107, 98), (107, 99), (107, 102), (107, 103), (107, 105), (108, 97), (108, 100), (108, 101), (108, 102), (108, 103), (108, 105), (109, 97), (109, 102), (109, 103), (109, 104), (109, 106), (110, 96), (110, 100), (110, 101), (110, 102), (110, 103), (110, 104), (110, 106), (111, 96), (111, 98), (111, 102), (111, 104), (111, 106), (112, 82), (112, 96), (112, 97), (112, 102), (112, 104), (112, 106), (113, 81), (113, 85), (113, 102), (113, 105), (114, 81), (114, 83), (114, 86), (114, 101), (114, 103), (114, 105), (115, 80), (115, 82), (115, 83), (115, 84), (115, 85), (115, 87), (115, 100), (115, 102), (115, 104), (116, 81), (116, 82), (116, 83), (116, 84), (116, 85), (116, 86), (116, 88), (116, 100), (116, 102), (116, 104), (117, 78), (117, 81), (117, 82), (117, 83), (117, 84), (117, 85), (117, 86), (117, 87), (117, 90), (117, 93), (117, 96), (117, 100), (117, 103), (118, 78), (118, 82), (118, 83), (118, 84), (118, 85), (118, 86), (118, 87), (118, 88), (118, 91), (118, 96), (118, 100), (118, 103), (119, 81), (119, 83), (119, 84), (119, 85), (119, 86), (119, 87), (119, 88), (119, 89), (119, 92), (119, 93), (119, 95), (119, 97), (119, 100), (119, 103), (120, 82), (120, 86), (120, 90), (120, 95), (120, 102), (121, 83), (121, 85), (121, 88), (121, 89), (121, 95), (121, 97), (121, 98), (121, 99), (121, 100), (121, 102), (122, 102))
coordinates_006400 = ((105, 134), (105, 136), (105, 137), (105, 138), (105, 139), (105, 140), (105, 141), (105, 143), (106, 130), (106, 134), (107, 129), (107, 131), (107, 135), (107, 137), (107, 138), (107, 139), (107, 140), (107, 142), (108, 128), (108, 131), (108, 135), (108, 137), (108, 138), (108, 139), (108, 140), (108, 142), (109, 128), (109, 131), (109, 135), (109, 137), (109, 138), (109, 139), (109, 140), (109, 142), (110, 128), (110, 131), (110, 135), (110, 137), (110, 141), (111, 128), (111, 131), (111, 136), (111, 138), (111, 140), (112, 129), (112, 131), (112, 136), (113, 129), (113, 131), (113, 136), (113, 137), (114, 129), (114, 132), (114, 136), (115, 129), (115, 132), (115, 136), (115, 138), (116, 122), (116, 125), (116, 129), (116, 131), (116, 133), (116, 136), (116, 138), (117, 122), (117, 126), (117, 129), (117, 131), (117, 132), (117, 135), (117, 136), (117, 138), (118, 121), (118, 123), (118, 124), (118, 125), (118, 127), (118, 128), (118, 130), (118, 133), (118, 136), (118, 138), (119, 121), (119, 124), (119, 126), (119, 130), (119, 134), (120, 120), (120, 121), (120, 124), (120, 130), (121, 119), (121, 122), (121, 125), (121, 126), (121, 127), (121, 128), (121, 130), (122, 119), (122, 121), (122, 122), (122, 123))
coordinates_cd5_b45 = ((75, 103), (75, 105), (75, 106), (75, 108), (76, 102), (76, 108), (77, 101), (77, 103), (77, 108), (78, 101), (78, 104), (78, 105), (78, 106), (78, 108), (79, 101), (79, 103), (80, 101), (80, 102), (81, 95), (81, 96), (81, 100), (81, 102), (82, 93), (82, 94), (82, 100), (82, 101), (83, 92), (83, 95), (83, 96), (83, 98), (83, 101), (84, 91), (84, 93), (84, 94), (84, 95), (84, 96), (84, 97), (84, 99), (84, 101), (85, 89), (85, 92), (85, 93), (85, 94), (85, 95), (85, 96), (85, 97), (85, 98), (85, 99), (85, 101), (86, 88), (86, 91), (86, 92), (86, 93), (86, 94), (86, 95), (86, 96), (86, 97), (86, 98), (86, 100), (87, 88), (87, 90), (87, 91), (87, 92), (87, 93), (87, 94), (87, 95), (87, 96), (87, 97), (87, 98), (87, 100), (88, 87), (88, 89), (88, 90), (88, 91), (88, 92), (88, 93), (88, 94), (88, 95), (88, 96), (88, 97), (88, 98), (88, 100), (89, 87), (89, 89), (89, 90), (89, 91), (89, 92), (89, 93), (89, 94), (89, 95), (89, 96), (89, 97), (89, 98), (89, 100), (89, 108), (90, 87), (90, 89), (90, 90), (90, 91), (90, 92), (90, 93), (90, 94), (90, 95), (90, 96), (90, 97), (90, 99), (90, 105), (90, 108), (91, 87), (91, 89), (91, 90), (91, 91), (91, 92), (91, 93), (91, 94), (91, 95), (91, 96), (91, 99), (91, 104), (91, 107), (92, 86), (92, 88), (92, 89), (92, 90), (92, 91), (92, 92), (92, 93), (92, 98), (92, 103), (92, 107), (93, 84), (93, 87), (93, 88), (93, 89), (93, 90), (93, 91), (93, 92), (93, 95), (93, 102), (93, 105), (94, 83), (94, 86), (94, 87), (94, 88), (94, 89), (94, 90), (94, 91), (94, 93), (94, 101), (94, 104), (95, 83), (95, 85), (95, 86), (95, 87), (95, 88), (95, 89), (95, 90), (95, 92), (95, 100), (95, 103), (96, 84), (96, 86), (96, 87), (96, 88), (96, 89), (96, 90), (96, 91), (96, 92), (96, 99), (96, 102), (97, 84), (97, 87), (97, 88), (97, 89), (97, 90), (97, 91), (97, 92), (97, 93), (97, 94), (97, 95), (97, 96), (97, 97), (97, 101), (98, 85), (98, 89), (98, 90), (98, 91), (98, 97), (98, 99), (99, 87), (99, 92), (99, 93), (99, 94), (99, 95), (100, 89), (100, 91))
coordinates_6395_ed = ((124, 124), (124, 126), (124, 128), (125, 123), (125, 128), (126, 122), (126, 124), (126, 125), (126, 126), (126, 128), (127, 122), (127, 124), (127, 125), (127, 126), (127, 128), (128, 121), (128, 123), (128, 124), (128, 125), (128, 126), (128, 128), (129, 121), (129, 123), (129, 124), (129, 125), (129, 126), (129, 127), (129, 129), (130, 121), (130, 123), (130, 124), (130, 125), (130, 126), (130, 127), (130, 129), (131, 121), (131, 125), (131, 126), (131, 127), (131, 129), (132, 123), (132, 124), (132, 126), (132, 128), (133, 121), (133, 122), (133, 125), (133, 128), (134, 126), (134, 127))
coordinates_00_fffe = ((148, 142), (149, 138), (149, 139), (149, 140), (149, 143), (150, 142), (150, 143), (151, 142), (151, 144), (152, 142), (152, 144), (153, 142), (153, 143), (153, 145), (154, 136), (154, 138), (154, 139), (154, 140), (154, 142), (154, 143), (154, 145), (155, 138), (155, 141), (155, 142), (155, 143), (155, 145), (156, 140), (156, 142), (156, 143), (156, 145), (157, 141), (157, 144), (158, 142), (158, 144), (159, 143), (159, 144))
coordinates_b4_e7_fa = ((120, 140), (120, 142), (120, 143), (120, 144), (120, 146), (121, 141), (122, 143), (122, 144), (122, 146), (122, 147), (123, 145), (123, 147), (124, 146), (124, 147), (125, 146), (125, 147), (126, 145), (126, 147), (127, 143), (127, 147), (128, 141), (128, 144), (128, 146), (129, 141), (129, 143))
coordinates_f98072 = ((124, 110), (125, 110), (125, 112), (125, 116), (125, 118), (125, 121), (126, 110), (126, 112), (126, 117), (126, 119), (127, 110), (128, 110), (129, 109), (129, 111), (130, 108), (130, 110), (130, 112), (131, 107), (131, 109), (131, 110), (131, 112), (132, 105), (132, 110), (132, 111), (133, 102), (133, 106), (133, 107), (133, 108), (133, 111), (133, 112), (134, 102), (134, 104), (134, 110), (134, 112), (134, 113), (134, 115), (135, 111), (135, 113), (135, 114), (135, 116), (136, 112), (136, 115), (136, 117), (137, 113), (137, 118), (138, 114), (138, 116), (138, 118))
coordinates_97_fb98 = ((156, 137), (157, 137), (157, 138), (158, 138), (158, 139), (159, 138), (159, 140), (160, 121), (160, 130), (160, 131), (160, 133), (160, 134), (160, 135), (160, 136), (160, 137), (160, 138), (160, 139), (160, 141), (161, 121), (161, 130), (161, 138), (161, 139), (161, 140), (161, 144), (162, 129), (162, 131), (162, 132), (162, 133), (162, 134), (162, 135), (162, 136), (162, 137), (162, 138), (162, 139), (162, 140), (162, 141), (163, 120), (163, 129), (163, 131), (163, 132), (163, 133), (163, 134), (163, 135), (163, 136), (163, 137), (163, 138), (163, 139), (163, 140), (163, 143), (164, 119), (164, 120), (164, 128), (164, 130), (164, 131), (164, 132), (164, 133), (164, 134), (164, 135), (164, 136), (164, 137), (164, 138), (164, 139), (164, 141), (165, 120), (165, 128), (165, 129), (165, 130), (165, 131), (165, 132), (165, 133), (165, 134), (165, 135), (165, 136), (165, 137), (165, 138), (165, 139), (165, 141), (166, 118), (166, 120), (166, 127), (166, 129), (166, 130), (166, 133), (166, 134), (166, 135), (166, 136), (166, 137), (166, 138), (166, 140), (167, 117), (167, 120), (167, 126), (167, 128), (167, 129), (167, 132), (167, 135), (167, 136), (167, 137), (167, 138), (167, 140), (168, 116), (168, 118), (168, 120), (168, 126), (168, 128), (168, 130), (168, 133), (168, 134), (168, 140), (169, 116), (169, 118), (169, 120), (169, 125), (169, 127), (169, 130), (169, 135), (169, 136), (169, 137), (169, 138), (169, 140), (170, 116), (170, 118), (170, 119), (170, 120), (170, 122), (170, 123), (170, 126), (170, 129), (171, 116), (171, 127), (171, 128), (172, 118), (172, 120), (172, 121), (172, 122), (172, 123), (172, 124), (172, 125))
coordinates_323287 = ((148, 108), (149, 105), (149, 109), (150, 103), (150, 108), (150, 110), (151, 99), (151, 101), (151, 106), (151, 107), (151, 111), (152, 101), (152, 104), (152, 105), (152, 108), (152, 112), (153, 102), (153, 103), (153, 110), (153, 114), (154, 111), (154, 112), (156, 101), (156, 102), (157, 100), (157, 103), (158, 98), (158, 101), (158, 103), (159, 98), (159, 100), (159, 101), (159, 103), (160, 99), (160, 100), (160, 101), (160, 102), (160, 104), (160, 113), (160, 115), (160, 116), (160, 117), (160, 119), (161, 98), (161, 100), (161, 101), (161, 102), (161, 104), (161, 112), (161, 119), (162, 98), (162, 102), (162, 104), (162, 111), (162, 113), (162, 114), (162, 115), (162, 116), (162, 118), (163, 99), (163, 103), (163, 105), (163, 111), (163, 113), (163, 114), (163, 115), (163, 116), (163, 118), (164, 102), (164, 105), (164, 111), (164, 113), (164, 114), (164, 115), (164, 117), (165, 103), (165, 105), (165, 111), (165, 113), (165, 114), (165, 116), (166, 104), (166, 106), (166, 110), (166, 111), (166, 112), (166, 113), (166, 115), (167, 104), (167, 110), (167, 111), (167, 112), (167, 113), (167, 115), (168, 105), (168, 109), (168, 110), (168, 111), (168, 112), (168, 114), (169, 105), (169, 114), (170, 106), (170, 108), (170, 109), (170, 110), (170, 111), (170, 112))
coordinates_6495_ed = ((107, 121), (108, 120), (108, 123), (109, 119), (109, 121), (109, 123), (110, 118), (110, 120), (110, 122), (111, 117), (111, 120), (111, 122), (112, 116), (112, 118), (112, 119), (112, 121), (113, 115), (113, 118), (113, 120), (114, 114), (114, 117), (114, 118), (114, 120), (115, 114), (115, 116), (115, 117), (115, 119), (116, 114), (116, 116), (116, 117), (116, 119), (117, 114), (117, 116), (117, 118), (118, 114), (118, 116), (118, 118), (119, 117), (120, 115), (120, 117), (121, 116), (121, 117), (122, 117))
coordinates_01_ffff = ((90, 141), (90, 143), (90, 144), (90, 145), (90, 146), (90, 147), (91, 140), (92, 140), (92, 143), (92, 144), (92, 146), (93, 142), (93, 144), (93, 146), (94, 143), (94, 146), (95, 143), (95, 146), (96, 137), (96, 142), (96, 144), (96, 146), (97, 136), (97, 138), (97, 139), (97, 140), (97, 141), (97, 143), (97, 145), (98, 135), (98, 137), (98, 142), (98, 143), (98, 145), (99, 135), (99, 137), (99, 138), (99, 139), (99, 140), (99, 141), (99, 142), (99, 143), (99, 145), (100, 135), (100, 137), (100, 138), (100, 139), (100, 140), (100, 141), (100, 142), (100, 143), (100, 144), (100, 145), (101, 134), (101, 136), (101, 137), (101, 138), (101, 139), (101, 140), (101, 141), (101, 142), (101, 144), (102, 134), (102, 144), (103, 134), (103, 136), (103, 137), (103, 138), (103, 139), (103, 140), (103, 141), (103, 143))
coordinates_fa8072 = ((102, 108), (103, 107), (103, 110), (104, 107), (104, 111), (105, 107), (105, 109), (105, 111), (106, 107), (106, 109), (106, 111), (107, 108), (107, 111), (108, 108), (108, 110), (108, 111), (108, 112), (109, 108), (109, 110), (109, 111), (110, 108), (110, 110), (110, 113), (111, 108), (111, 112), (112, 108), (112, 111), (113, 108), (113, 110), (114, 107), (114, 109), (115, 107), (115, 108), (116, 106), (117, 106), (117, 107), (118, 105), (118, 107), (119, 105), (119, 106), (120, 106), (120, 111), (120, 113), (121, 104), (121, 109), (121, 114), (122, 104), (122, 106), (122, 107), (122, 108), (122, 109), (122, 110), (122, 111), (122, 112), (122, 113), (122, 115))
coordinates_98_fb98 = ((75, 132), (75, 134), (75, 135), (76, 136), (76, 137), (76, 138), (77, 133), (77, 135), (77, 140), (77, 141), (77, 142), (77, 144), (78, 133), (78, 135), (78, 136), (78, 137), (78, 139), (78, 145), (79, 133), (79, 135), (79, 136), (79, 137), (79, 141), (79, 142), (79, 143), (79, 146), (80, 134), (80, 137), (80, 141), (80, 143), (80, 144), (80, 146), (81, 134), (81, 137), (81, 141), (81, 143), (81, 144), (81, 146), (82, 133), (82, 136), (82, 141), (82, 143), (82, 144), (82, 145), (82, 147), (83, 133), (83, 136), (83, 141), (83, 143), (83, 144), (83, 145), (83, 147), (84, 132), (84, 134), (84, 136), (84, 141), (84, 143), (84, 144), (84, 145), (84, 147), (85, 132), (85, 134), (85, 135), (85, 137), (85, 142), (85, 144), (85, 145), (85, 147), (86, 133), (86, 135), (86, 137), (86, 143), (86, 145), (86, 147), (87, 134), (87, 137), (87, 143), (87, 147), (88, 134), (88, 137), (88, 142), (88, 144), (88, 146), (89, 135), (89, 136))
coordinates_fec0_cb = ((133, 99), (133, 100), (134, 99), (135, 99), (136, 99), (137, 98), (137, 100), (138, 98), (138, 102), (139, 100), (139, 104), (140, 100), (140, 102), (140, 105), (141, 99), (141, 103), (141, 104), (141, 105), (142, 98), (142, 99), (142, 100), (142, 101), (142, 104), (142, 106), (143, 103), (143, 106), (143, 110), (143, 112), (144, 104), (144, 106), (144, 108), (144, 109), (144, 113), (145, 104), (145, 110), (145, 112), (146, 104), (146, 106), (146, 107), (146, 108), (146, 110), (146, 112), (147, 99), (147, 101), (147, 104), (147, 105), (147, 109), (147, 112), (148, 100), (148, 103), (148, 110), (148, 112), (149, 101), (149, 111), (149, 113), (150, 112), (150, 114), (151, 114))
coordinates_333287 = ((72, 118), (72, 120), (72, 121), (73, 117), (73, 122), (73, 123), (73, 124), (73, 125), (73, 127), (74, 110), (74, 112), (74, 116), (74, 118), (74, 119), (74, 120), (74, 128), (75, 110), (75, 113), (75, 114), (75, 117), (75, 118), (75, 122), (75, 124), (75, 125), (75, 129), (76, 110), (76, 112), (76, 116), (76, 118), (76, 122), (76, 127), (76, 130), (77, 110), (77, 113), (77, 114), (77, 115), (77, 116), (77, 117), (77, 119), (77, 128), (78, 112), (78, 114), (78, 115), (78, 116), (78, 117), (78, 118), (78, 120), (78, 128), (78, 131), (79, 113), (79, 115), (79, 116), (79, 117), (79, 118), (79, 119), (79, 121), (79, 129), (79, 131), (80, 114), (80, 116), (80, 117), (80, 118), (80, 119), (80, 120), (80, 122), (80, 129), (80, 131), (81, 115), (81, 117), (81, 118), (81, 119), (81, 120), (81, 122), (81, 129), (81, 131), (82, 117), (82, 118), (82, 119), (82, 120), (82, 121), (82, 123), (82, 129), (82, 131), (83, 116), (83, 118), (83, 119), (83, 120), (83, 121), (83, 123), (83, 129), (83, 130), (84, 117), (84, 119), (84, 120), (84, 121), (84, 122), (84, 123), (84, 124), (84, 130), (85, 118), (85, 120), (85, 121), (85, 122), (85, 124), (85, 130), (86, 119), (86, 123), (86, 130), (87, 120), (87, 122), (87, 130), (87, 131), (88, 130), (88, 132), (89, 131), (89, 133), (91, 109), (91, 110), (92, 111), (93, 113), (94, 116), (94, 118), (95, 118), (95, 119))
coordinates_ffc0_cb = ((94, 108), (94, 110), (94, 111), (95, 108), (95, 110), (95, 111), (95, 112), (95, 114), (96, 115), (96, 116), (97, 116), (97, 118), (98, 118)) |
# Be sure to update these values if you decide to run this bot!
APP_NAME = "Boston Snowbot"
REPO_URL = "https://github.com/molly/snowbot"
# Precipitation probability above which we will add snowfall to prediction
PROBABILITY_THRESHOLD = 0
# Get these values from hitting this URL with your latitude and longitude:
# https://www.weather.gov/documentation/services-web-api#/default/get_points__point_
OFFICE = "BOX" # resp["properties"]["officeId"]
GRID_X = 70 # resp["properties"]["gridX"]
GRID_Y = 76 # resp["properties"]["gridY"]
TIMEZONE = "US/Eastern"
# If your bot isn't reporting Boston weather, set this to False or this will make no
# sense
ENABLE_FRENCH_TOAST = True
# Delay between tweeting toast level gif if the above is set to True
TOAST_GIF_DELAY = 24 * 60 * 60 # 24 hours
# GIF to tweet if the french toast level is "severe"
SEVERE_TOAST_GIF = "https://t.co/Bs8UzBRswG"
| app_name = 'Boston Snowbot'
repo_url = 'https://github.com/molly/snowbot'
probability_threshold = 0
office = 'BOX'
grid_x = 70
grid_y = 76
timezone = 'US/Eastern'
enable_french_toast = True
toast_gif_delay = 24 * 60 * 60
severe_toast_gif = 'https://t.co/Bs8UzBRswG' |
# Given two lists of equal sizes, sum all the corresponding index elements and return a new list.
# Lis1 = [1,2,3,4,5] List2=[6,7,8,9,0]
# new list output = [7, 9, 11,13,5]
def sum_index_elements(alist, blist):
new_list = []
for a in range(len(alist)):
new_list.append(alist[a]+blist[a])
return new_list
test_code = sum_index_elements([2,3,1,4,2], [1,4,2,4,2])
print(test_code)
| def sum_index_elements(alist, blist):
new_list = []
for a in range(len(alist)):
new_list.append(alist[a] + blist[a])
return new_list
test_code = sum_index_elements([2, 3, 1, 4, 2], [1, 4, 2, 4, 2])
print(test_code) |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Bazel rules for building and packaging OCPDiag tests"""
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_pkg//:providers.bzl", "PackageFilegroupInfo", "PackageFilesInfo", "PackageSymlinkInfo")
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
_OCPDIAG_WORKSPACE = "ocpdiag"
def _parse_label(label):
"""Parse a label into (package, name).
Args:
label: string in relative or absolute form.
Returns:
Pair of strings: package, relative_name
Raises:
ValueError for malformed label (does not do an exhaustive validation)
"""
if label.startswith("//"):
label = label[2:] # drop the leading //
colon_split = label.split(":")
if len(colon_split) == 1: # no ":" in label
pkg = label
_, _, target = label.rpartition("/")
else:
pkg, target = colon_split # fails if len(colon_split) != 2
else:
colon_split = label.split(":")
if len(colon_split) == 1: # no ":" in label
pkg, target = native.package_name(), label
else:
pkg2, target = colon_split # fails if len(colon_split) != 2
pkg = native.package_name() + ("/" + pkg2 if pkg2 else "")
return pkg, target
def _descriptor_set_impl(ctx):
"""Create a FileDescriptorSet with the transitive inclusions of the passed protos.
Emulates the output of `protoc --include_imports --descriptor_set_out=$@`
In Bazel that would require recompiling protoc, so use the existing ProtoInfo.
"""
output = ctx.actions.declare_file(ctx.attr.name + "-transitive-descriptor-set.proto.bin")
descriptors = depset(transitive = [
dep[ProtoInfo].transitive_descriptor_sets
for dep in ctx.attr.deps
])
ctx.actions.run_shell(
outputs = [output],
inputs = descriptors,
arguments = [file.path for file in descriptors.to_list()],
command = "cat $@ >%s" % output.path,
)
return DefaultInfo(
files = depset([output]),
runfiles = ctx.runfiles(files = [output]),
)
descriptor_set = rule(
attrs = {"deps": attr.label_list(providers = [ProtoInfo])},
implementation = _descriptor_set_impl,
)
_DEFAULT_PROTO = "@com_google_protobuf//:empty_proto"
def ocpdiag_test_pkg(
name,
binary,
params_proto = _DEFAULT_PROTO,
json_defaults = None,
**kwargs):
"""Packages a ocpdiag binary into a self-extracting launcher.
Args:
name: Name of the launcher.
binary: Executable program for the ocpdiag test; must include all data deps.
params_proto: proto_library rule for the input parameters.
json_defaults: Optional JSON file with default values for the params.
**kwargs: Additional args to pass to the shell binary rule.
"""
descriptors = "_ocpdiag_test_pkg_%s_descriptors" % name
descriptor_set(
name = descriptors,
deps = [params_proto],
visibility = ["//visibility:private"],
)
launcher = "_ocpdiag_test_pkg_%s_launcher" % name
ocpdiag_launcher(
name = launcher,
binary = binary,
descriptors = ":%s" % descriptors,
defaults = json_defaults,
visibility = ["//visibility:private"],
)
ocpdiag_sar_name = name
create_ocpdiag_sar(ocpdiag_sar_name, ":" + launcher)
def join_paths(path, *others):
return paths.normalize(paths.join(path, *others))
def runpath(ctx, file):
return join_paths(
ctx.workspace_name,
file.owner.workspace_root,
file.short_path,
)
def valid(items):
return [item for item in items if item]
def _launcher_gen_impl(ctx):
template = """#!/bin/sh
export RUNFILES=${{RUNFILES:-$0.runfiles}}
exec {launcher} {binary} {descriptor} {defaults} "$@"
"""
prefix = '"${RUNFILES}/%s"'
script = template.format(
launcher = prefix % runpath(ctx, ctx.executable._launcher),
binary = prefix % runpath(ctx, ctx.executable.binary),
descriptor = prefix % runpath(ctx, ctx.file.descriptor),
defaults = prefix % runpath(ctx, ctx.file.defaults) if ctx.attr.defaults else "",
)
shfile = ctx.actions.declare_file(ctx.attr.name + ".sh")
ctx.actions.write(shfile, script, is_executable = True)
deps = valid([ctx.attr._launcher, ctx.attr.binary, ctx.attr.descriptor, ctx.attr.defaults])
runfiles = ctx.runfiles(valid([ctx.file.descriptor, ctx.file.defaults]))
for dep in deps:
runfiles = runfiles.merge(dep[DefaultInfo].default_runfiles)
return [DefaultInfo(
files = depset([shfile]),
runfiles = runfiles,
)]
_launcher_gen = rule(
implementation = _launcher_gen_impl,
attrs = {
"binary": attr.label(mandatory = True, executable = True, cfg = "target"),
"descriptor": attr.label(mandatory = True, allow_single_file = True),
"defaults": attr.label(allow_single_file = True),
"_launcher": attr.label(
default = "//ocpdiag/core/params:ocpdiag_launcher",
executable = True,
cfg = "target",
),
},
)
def ocpdiag_launcher(name, binary, descriptors, defaults, **kwargs):
script = "_%s_ocpdiag_launcher_script" % name
_launcher_gen(
name = script,
binary = binary,
descriptor = descriptors,
defaults = defaults,
visibility = ["//visibility:private"],
)
native.sh_binary(
name = name,
srcs = [":%s" % script],
**kwargs
)
def _create_sar(ctx):
sar_header = "_ocpdiag_test_pkg_%s_sar_header.sh" % ctx.label.name
sar_header_file = ctx.actions.declare_file(sar_header)
sar_contents = """#!/bin/sh -e
RUNFILES=$(
CMD=$(basename $0)
DIR=${TMPDIR:-/tmp}
EXEC=$(mktemp $DIR/$CMD.XXX); chmod a+x $EXEC
if ! $EXEC >/dev/null 2>&1; then
DIR=${XDG_RUNTIME_DIR:?"No Executable Run Dir"}
fi
rm $EXEC
mktemp -d $DIR/$CMD.XXX
)
chmod 0755 $RUNFILES
FIFO=$RUNFILES/.running; mkfifo $FIFO
(trap "" INT TERM; cat $FIFO; rm -rf $RUNFILES)&
exec 8>$FIFO 9<&0 <$0
until [ "$l" = "+" ]; do
read l
done
tar xmz -C $RUNFILES
exec <&9 9<&- $RUNFILES/%s "${@}"
exit
+\n""" % (ctx.executable.exec.basename)
ctx.actions.write(output = sar_header_file, content = sar_contents)
sar_output = ctx.actions.declare_file(ctx.label.name)
if len(ctx.attr.srcs) != 1:
fail("ocpdiag_self_extracting_archive srcs only accepts one argument in 'srcs', got %s" % len(ctx.attr.srcs))
tar_file = ctx.attr.srcs[0][DefaultInfo].files.to_list()[0]
ctx.actions.run_shell(
inputs = [sar_header_file, tar_file],
outputs = [sar_output],
command = "cat %s %s > %s" % (sar_header_file.path, tar_file.path, sar_output.path),
)
return DefaultInfo(
files = depset([sar_output]),
executable = sar_output,
)
ocpdiag_self_extracting_archive = rule(
implementation = _create_sar,
attrs = {
"srcs": attr.label_list(
mandatory = True,
doc = "Source tarball to package as SAR payload.",
),
"exec": attr.label(
mandatory = True,
doc = "Binary rule to execute from the passed tarball",
executable = True,
cfg = "target",
),
},
executable = True,
)
def make_relative_path(src, tgt):
return ("../" * src.count("/")) + tgt
def _pkg_runfiles_impl(ctx):
runfiles = ctx.runfiles()
files = [] # List of depsets, for deduplication.
binaries = [] # List of executables
for src in [s[DefaultInfo] for s in ctx.attr.srcs]:
runfiles = runfiles.merge(src.default_runfiles)
files.append(src.files)
if src.files_to_run:
binaries.append(src.files_to_run.executable)
runfiles_files = runfiles.files.to_list()
regular_files = depset(direct = binaries, transitive = files).to_list()
empty_file = ctx.actions.declare_file(ctx.attr.name + ".empty")
ctx.actions.write(empty_file, "")
workspace_prefix = join_paths(ctx.attr.runfiles_prefix, ctx.workspace_name)
manifest = PackageFilegroupInfo(
pkg_files = [(files_info, ctx.label) for files_info in [
# Add runfiles to the local workspace.
PackageFilesInfo(dest_src_map = {
join_paths(workspace_prefix, file.owner.workspace_root, file.short_path): file
for file in runfiles_files
}),
# Add regular files to root of the package.
PackageFilesInfo(dest_src_map = {
file.basename: file
for file in regular_files
}),
# Add empty runfiles.
PackageFilesInfo(dest_src_map = {
join_paths(workspace_prefix, file): empty_file
for file in runfiles.empty_filenames.to_list()
}),
]],
# Declare runfiles symlinks
pkg_symlinks = [(sym_info, ctx.label) for sym_info in [
PackageSymlinkInfo(
destination = join_paths(workspace_prefix, sym.path),
target = make_relative_path(sym.path, sym.target_file.short_path),
)
for sym in runfiles.symlinks.to_list()
] + [
# Add top-level symlinks to external repos' runfiles.
PackageSymlinkInfo(
destination = join_paths(ctx.attr.runfiles_prefix, name),
target = join_paths(ctx.workspace_name, path),
)
for name, path in {
file.owner.workspace_name: file.owner.workspace_root
for file in runfiles_files
if file.owner.workspace_root
}.items()
]],
pkg_dirs = [], # pkg_* rules do not gracefully handle empty fields.
)
return [
manifest,
DefaultInfo(files = depset([empty_file], transitive = files + [runfiles.files])),
]
pkg_tar_runfiles = rule(
implementation = _pkg_runfiles_impl,
provides = [PackageFilegroupInfo],
attrs = {
"srcs": attr.label_list(
mandatory = True,
doc = "Target to include in the tarball.",
),
"runfiles_prefix": attr.string(
doc = "Path prefix for the runfiles directory",
default = ".",
),
},
)
def create_ocpdiag_sar(name, launcher, **kwargs):
""" Bundles a ocpdiag diag into a self-extracting archive.
Args:
name: Name of the ocpdiag_test_pkg, will also be the sar output name
launcher: Executable to be bundled into the SAR
**kwargs: Any arguments to be forwarded to gentar or the self-extracting archive generator
"""
# Extract just the executable name, discarding the path.
launcher_path = _parse_label(launcher)[1]
runfiles = "_%s_runfiles" % name
pkg_tar_runfiles(
name = runfiles,
srcs = [launcher],
runfiles_prefix = launcher_path + ".runfiles",
visibility = ["//visibility:private"],
)
tar_name = "_%s_test_tar" % name
pkg_tar(
name = tar_name,
srcs = [":" + runfiles],
extension = "tgz",
visibility = ["//visibility:private"],
)
ocpdiag_self_extracting_archive(
name = name,
srcs = [":" + tar_name],
exec = launcher,
**kwargs
)
| """Bazel rules for building and packaging OCPDiag tests"""
load('@rules_pkg//:pkg.bzl', 'pkg_tar')
load('@rules_pkg//:providers.bzl', 'PackageFilegroupInfo', 'PackageFilesInfo', 'PackageSymlinkInfo')
load('@bazel_skylib//lib:paths.bzl', 'paths')
load('@rules_proto//proto:defs.bzl', 'ProtoInfo')
_ocpdiag_workspace = 'ocpdiag'
def _parse_label(label):
"""Parse a label into (package, name).
Args:
label: string in relative or absolute form.
Returns:
Pair of strings: package, relative_name
Raises:
ValueError for malformed label (does not do an exhaustive validation)
"""
if label.startswith('//'):
label = label[2:]
colon_split = label.split(':')
if len(colon_split) == 1:
pkg = label
(_, _, target) = label.rpartition('/')
else:
(pkg, target) = colon_split
else:
colon_split = label.split(':')
if len(colon_split) == 1:
(pkg, target) = (native.package_name(), label)
else:
(pkg2, target) = colon_split
pkg = native.package_name() + ('/' + pkg2 if pkg2 else '')
return (pkg, target)
def _descriptor_set_impl(ctx):
"""Create a FileDescriptorSet with the transitive inclusions of the passed protos.
Emulates the output of `protoc --include_imports --descriptor_set_out=$@`
In Bazel that would require recompiling protoc, so use the existing ProtoInfo.
"""
output = ctx.actions.declare_file(ctx.attr.name + '-transitive-descriptor-set.proto.bin')
descriptors = depset(transitive=[dep[ProtoInfo].transitive_descriptor_sets for dep in ctx.attr.deps])
ctx.actions.run_shell(outputs=[output], inputs=descriptors, arguments=[file.path for file in descriptors.to_list()], command='cat $@ >%s' % output.path)
return default_info(files=depset([output]), runfiles=ctx.runfiles(files=[output]))
descriptor_set = rule(attrs={'deps': attr.label_list(providers=[ProtoInfo])}, implementation=_descriptor_set_impl)
_default_proto = '@com_google_protobuf//:empty_proto'
def ocpdiag_test_pkg(name, binary, params_proto=_DEFAULT_PROTO, json_defaults=None, **kwargs):
"""Packages a ocpdiag binary into a self-extracting launcher.
Args:
name: Name of the launcher.
binary: Executable program for the ocpdiag test; must include all data deps.
params_proto: proto_library rule for the input parameters.
json_defaults: Optional JSON file with default values for the params.
**kwargs: Additional args to pass to the shell binary rule.
"""
descriptors = '_ocpdiag_test_pkg_%s_descriptors' % name
descriptor_set(name=descriptors, deps=[params_proto], visibility=['//visibility:private'])
launcher = '_ocpdiag_test_pkg_%s_launcher' % name
ocpdiag_launcher(name=launcher, binary=binary, descriptors=':%s' % descriptors, defaults=json_defaults, visibility=['//visibility:private'])
ocpdiag_sar_name = name
create_ocpdiag_sar(ocpdiag_sar_name, ':' + launcher)
def join_paths(path, *others):
return paths.normalize(paths.join(path, *others))
def runpath(ctx, file):
return join_paths(ctx.workspace_name, file.owner.workspace_root, file.short_path)
def valid(items):
return [item for item in items if item]
def _launcher_gen_impl(ctx):
template = '#!/bin/sh\n export RUNFILES=${{RUNFILES:-$0.runfiles}}\n exec {launcher} {binary} {descriptor} {defaults} "$@"\n '
prefix = '"${RUNFILES}/%s"'
script = template.format(launcher=prefix % runpath(ctx, ctx.executable._launcher), binary=prefix % runpath(ctx, ctx.executable.binary), descriptor=prefix % runpath(ctx, ctx.file.descriptor), defaults=prefix % runpath(ctx, ctx.file.defaults) if ctx.attr.defaults else '')
shfile = ctx.actions.declare_file(ctx.attr.name + '.sh')
ctx.actions.write(shfile, script, is_executable=True)
deps = valid([ctx.attr._launcher, ctx.attr.binary, ctx.attr.descriptor, ctx.attr.defaults])
runfiles = ctx.runfiles(valid([ctx.file.descriptor, ctx.file.defaults]))
for dep in deps:
runfiles = runfiles.merge(dep[DefaultInfo].default_runfiles)
return [default_info(files=depset([shfile]), runfiles=runfiles)]
_launcher_gen = rule(implementation=_launcher_gen_impl, attrs={'binary': attr.label(mandatory=True, executable=True, cfg='target'), 'descriptor': attr.label(mandatory=True, allow_single_file=True), 'defaults': attr.label(allow_single_file=True), '_launcher': attr.label(default='//ocpdiag/core/params:ocpdiag_launcher', executable=True, cfg='target')})
def ocpdiag_launcher(name, binary, descriptors, defaults, **kwargs):
script = '_%s_ocpdiag_launcher_script' % name
_launcher_gen(name=script, binary=binary, descriptor=descriptors, defaults=defaults, visibility=['//visibility:private'])
native.sh_binary(name=name, srcs=[':%s' % script], **kwargs)
def _create_sar(ctx):
sar_header = '_ocpdiag_test_pkg_%s_sar_header.sh' % ctx.label.name
sar_header_file = ctx.actions.declare_file(sar_header)
sar_contents = '#!/bin/sh -e\nRUNFILES=$(\n CMD=$(basename $0)\n DIR=${TMPDIR:-/tmp}\n EXEC=$(mktemp $DIR/$CMD.XXX); chmod a+x $EXEC\n if ! $EXEC >/dev/null 2>&1; then\n DIR=${XDG_RUNTIME_DIR:?"No Executable Run Dir"}\n fi\n rm $EXEC\n mktemp -d $DIR/$CMD.XXX\n)\nchmod 0755 $RUNFILES\nFIFO=$RUNFILES/.running; mkfifo $FIFO\n(trap "" INT TERM; cat $FIFO; rm -rf $RUNFILES)&\nexec 8>$FIFO 9<&0 <$0\nuntil [ "$l" = "+" ]; do\n read l\ndone\ntar xmz -C $RUNFILES\nexec <&9 9<&- $RUNFILES/%s "${@}"\nexit\n+\n' % ctx.executable.exec.basename
ctx.actions.write(output=sar_header_file, content=sar_contents)
sar_output = ctx.actions.declare_file(ctx.label.name)
if len(ctx.attr.srcs) != 1:
fail("ocpdiag_self_extracting_archive srcs only accepts one argument in 'srcs', got %s" % len(ctx.attr.srcs))
tar_file = ctx.attr.srcs[0][DefaultInfo].files.to_list()[0]
ctx.actions.run_shell(inputs=[sar_header_file, tar_file], outputs=[sar_output], command='cat %s %s > %s' % (sar_header_file.path, tar_file.path, sar_output.path))
return default_info(files=depset([sar_output]), executable=sar_output)
ocpdiag_self_extracting_archive = rule(implementation=_create_sar, attrs={'srcs': attr.label_list(mandatory=True, doc='Source tarball to package as SAR payload.'), 'exec': attr.label(mandatory=True, doc='Binary rule to execute from the passed tarball', executable=True, cfg='target')}, executable=True)
def make_relative_path(src, tgt):
return '../' * src.count('/') + tgt
def _pkg_runfiles_impl(ctx):
runfiles = ctx.runfiles()
files = []
binaries = []
for src in [s[DefaultInfo] for s in ctx.attr.srcs]:
runfiles = runfiles.merge(src.default_runfiles)
files.append(src.files)
if src.files_to_run:
binaries.append(src.files_to_run.executable)
runfiles_files = runfiles.files.to_list()
regular_files = depset(direct=binaries, transitive=files).to_list()
empty_file = ctx.actions.declare_file(ctx.attr.name + '.empty')
ctx.actions.write(empty_file, '')
workspace_prefix = join_paths(ctx.attr.runfiles_prefix, ctx.workspace_name)
manifest = package_filegroup_info(pkg_files=[(files_info, ctx.label) for files_info in [package_files_info(dest_src_map={join_paths(workspace_prefix, file.owner.workspace_root, file.short_path): file for file in runfiles_files}), package_files_info(dest_src_map={file.basename: file for file in regular_files}), package_files_info(dest_src_map={join_paths(workspace_prefix, file): empty_file for file in runfiles.empty_filenames.to_list()})]], pkg_symlinks=[(sym_info, ctx.label) for sym_info in [package_symlink_info(destination=join_paths(workspace_prefix, sym.path), target=make_relative_path(sym.path, sym.target_file.short_path)) for sym in runfiles.symlinks.to_list()] + [package_symlink_info(destination=join_paths(ctx.attr.runfiles_prefix, name), target=join_paths(ctx.workspace_name, path)) for (name, path) in {file.owner.workspace_name: file.owner.workspace_root for file in runfiles_files if file.owner.workspace_root}.items()]], pkg_dirs=[])
return [manifest, default_info(files=depset([empty_file], transitive=files + [runfiles.files]))]
pkg_tar_runfiles = rule(implementation=_pkg_runfiles_impl, provides=[PackageFilegroupInfo], attrs={'srcs': attr.label_list(mandatory=True, doc='Target to include in the tarball.'), 'runfiles_prefix': attr.string(doc='Path prefix for the runfiles directory', default='.')})
def create_ocpdiag_sar(name, launcher, **kwargs):
""" Bundles a ocpdiag diag into a self-extracting archive.
Args:
name: Name of the ocpdiag_test_pkg, will also be the sar output name
launcher: Executable to be bundled into the SAR
**kwargs: Any arguments to be forwarded to gentar or the self-extracting archive generator
"""
launcher_path = _parse_label(launcher)[1]
runfiles = '_%s_runfiles' % name
pkg_tar_runfiles(name=runfiles, srcs=[launcher], runfiles_prefix=launcher_path + '.runfiles', visibility=['//visibility:private'])
tar_name = '_%s_test_tar' % name
pkg_tar(name=tar_name, srcs=[':' + runfiles], extension='tgz', visibility=['//visibility:private'])
ocpdiag_self_extracting_archive(name=name, srcs=[':' + tar_name], exec=launcher, **kwargs) |
class LinearCongruentialGenerator:
mul = 1103515245 # a, 0 < a < m
inc = 12345 # c, 0 <= c < m
mod = 2 ** 31 # m, 0 < m
def __init__(self, seed):
self.seed_ = seed % self.mod # X[0], 0 <= X[0] < m
def rand(self):
# X[n + 1] = (a * X[n] + c) mod m
self.seed_ = (self.seed_ * self.mul + self.inc) % self.mod
return self.seed_
| class Linearcongruentialgenerator:
mul = 1103515245
inc = 12345
mod = 2 ** 31
def __init__(self, seed):
self.seed_ = seed % self.mod
def rand(self):
self.seed_ = (self.seed_ * self.mul + self.inc) % self.mod
return self.seed_ |
#Search in a 2D Matrix
class Solution(object):
def searchMatrix(self, matrix, target):
if not len(matrix) or not len(matrix[0]):
return False
m, n = len(matrix) , len(matrix[0])
#Start adaptive search from left bottom corner
x,y = m-1 , 0
while True:
if x < 0 or y >= n:
break
current = matrix[x][y]
if target < current:
#target is smaller ---> go up
x -= 1
elif target > current:
#target is greater ----> go to right
y += 1
else: return True #hit the target
return False
| class Solution(object):
def search_matrix(self, matrix, target):
if not len(matrix) or not len(matrix[0]):
return False
(m, n) = (len(matrix), len(matrix[0]))
(x, y) = (m - 1, 0)
while True:
if x < 0 or y >= n:
break
current = matrix[x][y]
if target < current:
x -= 1
elif target > current:
y += 1
else:
return True
return False |
"""This problem was asked by Pinterest.
Given a binary tree, write a function to determine whether the tree is a
mirror image of itself.
Two trees are a mirror image if their root values are the same and the
left subtree is a mirror image of the right subtree.
""" | """This problem was asked by Pinterest.
Given a binary tree, write a function to determine whether the tree is a
mirror image of itself.
Two trees are a mirror image if their root values are the same and the
left subtree is a mirror image of the right subtree.
""" |
alphabet = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
direction = input("Type 'encode' to encrypt, type 'decode' to decrypt:\n")
text = input("Type your message:\n").lower()
shift = int(input("Type the shift number:\n"))
# TODO-1: Create a function called 'encrypt' that takes the 'text' and 'shift' as inputs.
def encrypt(text, shift):
encrypted_text = ""
for letter in text:
if not letter in alphabet:
encrypted_text += letter
continue
letter_index = alphabet.index(letter)
encrypted_letter_index = (letter_index + shift) % (len(alphabet) - 1)
encrypted_letter = alphabet[encrypted_letter_index]
encrypted_text += encrypted_letter
return encrypted_text
def decrypt(text, shift):
return encrypt(text, -shift)
if direction == "encrypt":
print(encrypt(text, shift))
elif direction == "decrypt":
print(decrypt(text, shift))
| alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
direction = input("Type 'encode' to encrypt, type 'decode' to decrypt:\n")
text = input('Type your message:\n').lower()
shift = int(input('Type the shift number:\n'))
def encrypt(text, shift):
encrypted_text = ''
for letter in text:
if not letter in alphabet:
encrypted_text += letter
continue
letter_index = alphabet.index(letter)
encrypted_letter_index = (letter_index + shift) % (len(alphabet) - 1)
encrypted_letter = alphabet[encrypted_letter_index]
encrypted_text += encrypted_letter
return encrypted_text
def decrypt(text, shift):
return encrypt(text, -shift)
if direction == 'encrypt':
print(encrypt(text, shift))
elif direction == 'decrypt':
print(decrypt(text, shift)) |
class Solution:
def checkInclusion(self, s1: str, s2: str) -> bool:
w_size = len(s1)
n = len(s2)
if n<w_size:
return False
rem_counts = collections.defaultdict(int)
for i in range(w_size):
if rem_counts[s1[i]] == -1:
rem_counts.pop(s1[i])
else:
rem_counts[s1[i]] += 1
if rem_counts[s2[i]] == 1:
rem_counts.pop(s2[i])
else:
rem_counts[s2[i]] -= 1
if not rem_counts:
return True
window_start = 0
for window_end in range(w_size, n):
if rem_counts[s2[window_end]] == 1:
rem_counts.pop(s2[window_end])
else:
rem_counts[s2[window_end]] -= 1
if rem_counts[s2[window_start]] == -1:
rem_counts.pop(s2[window_start])
else:
rem_counts[s2[window_start]] += 1
if not rem_counts:
return True
window_start += 1
return False
| class Solution:
def check_inclusion(self, s1: str, s2: str) -> bool:
w_size = len(s1)
n = len(s2)
if n < w_size:
return False
rem_counts = collections.defaultdict(int)
for i in range(w_size):
if rem_counts[s1[i]] == -1:
rem_counts.pop(s1[i])
else:
rem_counts[s1[i]] += 1
if rem_counts[s2[i]] == 1:
rem_counts.pop(s2[i])
else:
rem_counts[s2[i]] -= 1
if not rem_counts:
return True
window_start = 0
for window_end in range(w_size, n):
if rem_counts[s2[window_end]] == 1:
rem_counts.pop(s2[window_end])
else:
rem_counts[s2[window_end]] -= 1
if rem_counts[s2[window_start]] == -1:
rem_counts.pop(s2[window_start])
else:
rem_counts[s2[window_start]] += 1
if not rem_counts:
return True
window_start += 1
return False |
class Product(object):
def __init__(self, name, base_price):
self.name = name
self.base_price = base_price
def get_price(self, item_quantities):
return item_quantities[self.name] * self.base_price
class DiscountedProduct(Product):
def __init__(self, name, base_price, offers = ()):
super(DiscountedProduct, self).__init__(name, base_price)
self.offers = offers
def get_price(self, item_quantities):
n = item_quantities.get(self.name, 0)
nx = []
px = []
for offer in self.offers[::-1]:
ni = n // offer[0]
nx.append(ni)
px.append(offer[1])
n -= ni * offer[0]
nx.append(n)
px.append(self.base_price)
return sum([nx * px for nx, px in zip(nx, px)])
class BProduct(Product):
def get_price(self, item_quantities):
nb = item_quantities.get('B', 0)
ne = item_quantities.get('E', 0)
nb = max(0, nb - ne // 2)
nb2 = nb // 2
nb1 = nb % 2
return nb2 * 45 + nb1 * self.base_price
class MProduct(Product):
def get_price(self, item_quantities):
nm = item_quantities.get('M', 0)
nn = item_quantities.get('N', 0)
nm = max(0, nm - nn // 3)
return nm * self.base_price
class QProduct(Product):
def get_price(self, item_quantities):
nq = item_quantities.get('Q', 0)
nr = item_quantities.get('R', 0)
nq = max(0, nq - nr // 3)
nq3 = nq // 3
nq1 = nq % 3
print(nq)
return nq3 * 80 + nq1 * self.base_price
A = DiscountedProduct('A', 50, ((3, 130), (5, 200)))
B = BProduct('B', 30)
C = Product('C', 20)
D = Product('D', 15)
E = Product('E', 40)
F = DiscountedProduct('F', 10, offers = ((3, 20),))
G = Product('G', 20)
H = DiscountedProduct('H', 10, offers=((5, 45), (10, 80)))
I = Product('I', 35)
J = Product('J', 60)
K = DiscountedProduct('K', 70, offers=((2, 120),))
L = Product('L', 90)
M = MProduct('M', 15)
N = Product('N', 40)
O = Product('O', 10)
P = DiscountedProduct('P', 50, ((5, 200),))
Q = QProduct('Q', 30)
R = Product('R', 50)
S = Product('S', 20)
T = Product('T', 20)
U = DiscountedProduct('U', 40, ((4, 120),))
V = DiscountedProduct('V', 50, ((2, 90), (3, 130)))
W = Product('W', 20)
X = Product('X', 17)
Y = Product('Y', 20)
Z = Product('Z', 21)
products = {
'A': A,
'B': B,
'C': C,
'D': D,
'E': E,
'F': F,
'G': G,
'H': H,
'I': I,
'J': J,
'K': K,
'L': L,
'M': M,
'N': N,
'O': O,
'P': P,
'Q': Q,
'R': R,
'S': S,
'T': T,
'U': U,
'V': V,
'W': W,
'X': X,
'Y': Y,
'Z': Z,
}
| class Product(object):
def __init__(self, name, base_price):
self.name = name
self.base_price = base_price
def get_price(self, item_quantities):
return item_quantities[self.name] * self.base_price
class Discountedproduct(Product):
def __init__(self, name, base_price, offers=()):
super(DiscountedProduct, self).__init__(name, base_price)
self.offers = offers
def get_price(self, item_quantities):
n = item_quantities.get(self.name, 0)
nx = []
px = []
for offer in self.offers[::-1]:
ni = n // offer[0]
nx.append(ni)
px.append(offer[1])
n -= ni * offer[0]
nx.append(n)
px.append(self.base_price)
return sum([nx * px for (nx, px) in zip(nx, px)])
class Bproduct(Product):
def get_price(self, item_quantities):
nb = item_quantities.get('B', 0)
ne = item_quantities.get('E', 0)
nb = max(0, nb - ne // 2)
nb2 = nb // 2
nb1 = nb % 2
return nb2 * 45 + nb1 * self.base_price
class Mproduct(Product):
def get_price(self, item_quantities):
nm = item_quantities.get('M', 0)
nn = item_quantities.get('N', 0)
nm = max(0, nm - nn // 3)
return nm * self.base_price
class Qproduct(Product):
def get_price(self, item_quantities):
nq = item_quantities.get('Q', 0)
nr = item_quantities.get('R', 0)
nq = max(0, nq - nr // 3)
nq3 = nq // 3
nq1 = nq % 3
print(nq)
return nq3 * 80 + nq1 * self.base_price
a = discounted_product('A', 50, ((3, 130), (5, 200)))
b = b_product('B', 30)
c = product('C', 20)
d = product('D', 15)
e = product('E', 40)
f = discounted_product('F', 10, offers=((3, 20),))
g = product('G', 20)
h = discounted_product('H', 10, offers=((5, 45), (10, 80)))
i = product('I', 35)
j = product('J', 60)
k = discounted_product('K', 70, offers=((2, 120),))
l = product('L', 90)
m = m_product('M', 15)
n = product('N', 40)
o = product('O', 10)
p = discounted_product('P', 50, ((5, 200),))
q = q_product('Q', 30)
r = product('R', 50)
s = product('S', 20)
t = product('T', 20)
u = discounted_product('U', 40, ((4, 120),))
v = discounted_product('V', 50, ((2, 90), (3, 130)))
w = product('W', 20)
x = product('X', 17)
y = product('Y', 20)
z = product('Z', 21)
products = {'A': A, 'B': B, 'C': C, 'D': D, 'E': E, 'F': F, 'G': G, 'H': H, 'I': I, 'J': J, 'K': K, 'L': L, 'M': M, 'N': N, 'O': O, 'P': P, 'Q': Q, 'R': R, 'S': S, 'T': T, 'U': U, 'V': V, 'W': W, 'X': X, 'Y': Y, 'Z': Z} |
def lengthN(n, cache):
count = 1
while n > 1:
if len(cache) >= n:
count = count + cache[n-1]
break
if n % 2:
n = 3*n + 1
else:
n /= 2
count += 1
cache[int(n)-1] = count
return count, cache
if __name__ == '__main__':
n = int(input())
lengths = []
cache = [1]
for i in range(1, n+1):
count, cache = lengthN(i, cache)
lengths.append(count)
print(lengths) | def length_n(n, cache):
count = 1
while n > 1:
if len(cache) >= n:
count = count + cache[n - 1]
break
if n % 2:
n = 3 * n + 1
else:
n /= 2
count += 1
cache[int(n) - 1] = count
return (count, cache)
if __name__ == '__main__':
n = int(input())
lengths = []
cache = [1]
for i in range(1, n + 1):
(count, cache) = length_n(i, cache)
lengths.append(count)
print(lengths) |
class Solution:
def permuteUnique(self, nums: List[int]) -> List[List[int]]:
results = []
def Combination(permutation, counter):
if len(permutation) == len(nums):
results.append(list(permutation))
return
for num in counter:
if counter[num] > 0:
permutation.append(num)
counter[num] -= 1
Combination(permutation, counter)
permutation.pop()
counter[num] += 1
Combination([], Counter(nums))
return results | class Solution:
def permute_unique(self, nums: List[int]) -> List[List[int]]:
results = []
def combination(permutation, counter):
if len(permutation) == len(nums):
results.append(list(permutation))
return
for num in counter:
if counter[num] > 0:
permutation.append(num)
counter[num] -= 1
combination(permutation, counter)
permutation.pop()
counter[num] += 1
combination([], counter(nums))
return results |
#using this for test values for config
class TestConfig:
host = "irc.rizon.net"
port = 6667
nickname = "testNickName8462"
username = "testUserName8462"
hostname = "testHostName8462"
servername = "testServerName8462"
realname = "testRealName8462"
| class Testconfig:
host = 'irc.rizon.net'
port = 6667
nickname = 'testNickName8462'
username = 'testUserName8462'
hostname = 'testHostName8462'
servername = 'testServerName8462'
realname = 'testRealName8462' |
# Copyright (C) 2020 The Dagger Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Macros for building compiler tests."""
def compiler_test(name, size = "large", compiler_deps = None, **kwargs):
"""Generates a java_test that tests java compilation with the given compiler deps.
This macro separates the compiler dependencies from the test dependencies to avoid
1-version violations. For example, this often happens when the java_test uses java
dependencies but the compiler test expects the android version of the dependencies.
Args:
name: The name of the java_test.
size: The size of the test (default "large" since this test does disk I/O).
compiler_deps: The deps needed during compilation.
**kwargs: The parameters to pass to the generated java_test.
Returns:
None
"""
# This JAR is loaded at runtime and contains the dependencies used by the compiler during tests.
# We separate these dependencies from the java_test dependencies to avoid 1 version violations.
native.java_binary(
name = name + "_compiler_deps",
testonly = 1,
tags = ["notap"],
visibility = ["//visibility:private"],
main_class = "Object.class",
runtime_deps = compiler_deps,
)
# Add the compiler deps jar, generated above, to the test's data.
kwargs["data"] = kwargs.get("data", []) + [name + "_compiler_deps_deploy.jar"]
# Add a dep to allow usage of CompilerTests.
kwargs["deps"] = kwargs.get("deps", []) + ["//java/dagger/testing/compile"]
native.java_test(name = name, size = size, **kwargs)
| """Macros for building compiler tests."""
def compiler_test(name, size='large', compiler_deps=None, **kwargs):
"""Generates a java_test that tests java compilation with the given compiler deps.
This macro separates the compiler dependencies from the test dependencies to avoid
1-version violations. For example, this often happens when the java_test uses java
dependencies but the compiler test expects the android version of the dependencies.
Args:
name: The name of the java_test.
size: The size of the test (default "large" since this test does disk I/O).
compiler_deps: The deps needed during compilation.
**kwargs: The parameters to pass to the generated java_test.
Returns:
None
"""
native.java_binary(name=name + '_compiler_deps', testonly=1, tags=['notap'], visibility=['//visibility:private'], main_class='Object.class', runtime_deps=compiler_deps)
kwargs['data'] = kwargs.get('data', []) + [name + '_compiler_deps_deploy.jar']
kwargs['deps'] = kwargs.get('deps', []) + ['//java/dagger/testing/compile']
native.java_test(name=name, size=size, **kwargs) |
load("@rules_python//python:defs.bzl", "py_test")
load("@bazel_skylib//rules:write_file.bzl", "write_file")
# End to end "Shell" test that a breakpoint can resolve a location
# Consider just allow running a breakpoint without crashing
# It does the following
# 1. Take the (compiled) application and boot up a sim matching the SDK and
# Xcode version
# 2. Set a breakpoint given the `set_cmd`
# 3. When it stops on the breakpoint, it validates the `variable` matches the
# `expected_value`
def ios_lldb_breakpoint_po_test(name, application, set_cmd, variable, sdk, device, expected_value = None, lldbinit = None, **kwargs):
test_spec = struct(
variable_name = variable,
substrs = (["variable_result: " + variable + " = " + expected_value] if expected_value else []),
)
_check_cmd(set_cmd)
initcmds = [
set_cmd,
# Ensure that the platform dir is set correctly here - "platform shell pwd"
"command script import --allow-reload $(location @build_bazel_rules_ios//rules/test/lldb:breakpoint.py)",
"breakpoint command add --python-function breakpoint.breakpoint_info_fn 1",
"continue",
]
_ios_breakpoint_test_wrapper(name, application, initcmds, test_spec, sdk, device, lldbinit = lldbinit, **kwargs)
def _lldbinit_impl(ctx):
# Resolve the file expanding variables
cmd_tuple = ctx.resolve_command(command = ctx.attr.content, expand_locations = True)
if len(cmd_tuple) < 1:
fail("Unexpected resolution", cmd_tuple)
content = cmd_tuple[1][2]
ctx.actions.write(
output = ctx.outputs.out,
content = content,
)
files = depset(direct = [ctx.outputs.out])
runfiles = ctx.runfiles(files = [ctx.outputs.out])
is_executable = False
if is_executable:
return [DefaultInfo(files = files, runfiles = runfiles, executable = ctx.outputs.out)]
else:
return [DefaultInfo(files = files, runfiles = runfiles)]
_lldbinit = rule(
implementation = _lldbinit_impl,
attrs = {
"content": attr.string(mandatory = True),
"out": attr.output(mandatory = True),
"deps": attr.label_list(mandatory = False, allow_files = True),
},
doc = "Setup an lldbinit file",
)
def _check_cmd(set_cmd):
# This is not super robust but atleast it fails fast
if (set_cmd.startswith("br ") or set_cmd.startswith("breakpoint ")) == False:
fail(
"set_cmd needs some breakpoint set to do anything - got:",
set_cmd,
)
# Similar as above but just verify if cmds return successfully. `cmds` is an
# array of LLDB commands that run when `set_cmd` is hit
def ios_lldb_breakpoint_command_test(name, application, set_cmd, cmds, sdk, device, match_substrs = [], lldbinit = None, **kwargs):
test_spec = struct(
br_hit_commands = cmds,
substrs = match_substrs,
)
_check_cmd(set_cmd)
initcmds = [
set_cmd,
# Ensure that the platform dir is set correctly here - "platform shell pwd"
"command script import --allow-reload $(location @build_bazel_rules_ios//rules/test/lldb:breakpoint.py)",
"breakpoint command add --python-function breakpoint.breakpoint_cmd_fn 1",
"continue",
]
_ios_breakpoint_test_wrapper(name, application, initcmds, test_spec, sdk, device, lldbinit = lldbinit, **kwargs)
def _ios_breakpoint_test_wrapper(name, application, cmds, test_spec, sdk, device, lldbinit, **kwargs):
write_file(
name = name + "_test_spec",
out = name + ".test_spec.json",
content = [test_spec.to_json()],
)
lldbinit_deps = ["@build_bazel_rules_ios//rules/test/lldb:breakpoint.py"]
if lldbinit:
cmds = ["command source $(execpath " + lldbinit + ")"] + cmds
lldbinit_deps.append(lldbinit)
_lldbinit(
name = name + "_lldbinit",
out = name + ".lldbinit",
content = "\n".join(cmds),
deps = lldbinit_deps,
visibility = ["//visibility:public"],
)
py_test(
name = name,
main = "@build_bazel_rules_ios//rules/test/lldb:lldb_breakpoint_test_main.py",
srcs = [
"@build_bazel_rules_ios//rules/test/lldb:lldb_breakpoint_test_main.py",
],
args = [
"--app",
"$(execpath " + application + ").app",
# Consider finding a way to better express this for github CI -
# it's tied into the xcode_version right now. We could move this to
# an idiom of a "test_runner" or the likes
"--sdk",
sdk,
"--device",
"'" + device + "'",
"--spec",
"$(execpath " + name + "_test_spec" + ")",
"--lldbinit",
"$(execpath " + name + "_lldbinit" + ")",
],
deps = ["@build_bazel_rules_ios//rules/test/lldb:lldb_test"],
data = [
application,
name + "_test_spec",
name + "_lldbinit",
] + ([lldbinit] if lldbinit else []),
**kwargs
)
| load('@rules_python//python:defs.bzl', 'py_test')
load('@bazel_skylib//rules:write_file.bzl', 'write_file')
def ios_lldb_breakpoint_po_test(name, application, set_cmd, variable, sdk, device, expected_value=None, lldbinit=None, **kwargs):
test_spec = struct(variable_name=variable, substrs=['variable_result: ' + variable + ' = ' + expected_value] if expected_value else [])
_check_cmd(set_cmd)
initcmds = [set_cmd, 'command script import --allow-reload $(location @build_bazel_rules_ios//rules/test/lldb:breakpoint.py)', 'breakpoint command add --python-function breakpoint.breakpoint_info_fn 1', 'continue']
_ios_breakpoint_test_wrapper(name, application, initcmds, test_spec, sdk, device, lldbinit=lldbinit, **kwargs)
def _lldbinit_impl(ctx):
cmd_tuple = ctx.resolve_command(command=ctx.attr.content, expand_locations=True)
if len(cmd_tuple) < 1:
fail('Unexpected resolution', cmd_tuple)
content = cmd_tuple[1][2]
ctx.actions.write(output=ctx.outputs.out, content=content)
files = depset(direct=[ctx.outputs.out])
runfiles = ctx.runfiles(files=[ctx.outputs.out])
is_executable = False
if is_executable:
return [default_info(files=files, runfiles=runfiles, executable=ctx.outputs.out)]
else:
return [default_info(files=files, runfiles=runfiles)]
_lldbinit = rule(implementation=_lldbinit_impl, attrs={'content': attr.string(mandatory=True), 'out': attr.output(mandatory=True), 'deps': attr.label_list(mandatory=False, allow_files=True)}, doc='Setup an lldbinit file')
def _check_cmd(set_cmd):
if (set_cmd.startswith('br ') or set_cmd.startswith('breakpoint ')) == False:
fail('set_cmd needs some breakpoint set to do anything - got:', set_cmd)
def ios_lldb_breakpoint_command_test(name, application, set_cmd, cmds, sdk, device, match_substrs=[], lldbinit=None, **kwargs):
test_spec = struct(br_hit_commands=cmds, substrs=match_substrs)
_check_cmd(set_cmd)
initcmds = [set_cmd, 'command script import --allow-reload $(location @build_bazel_rules_ios//rules/test/lldb:breakpoint.py)', 'breakpoint command add --python-function breakpoint.breakpoint_cmd_fn 1', 'continue']
_ios_breakpoint_test_wrapper(name, application, initcmds, test_spec, sdk, device, lldbinit=lldbinit, **kwargs)
def _ios_breakpoint_test_wrapper(name, application, cmds, test_spec, sdk, device, lldbinit, **kwargs):
write_file(name=name + '_test_spec', out=name + '.test_spec.json', content=[test_spec.to_json()])
lldbinit_deps = ['@build_bazel_rules_ios//rules/test/lldb:breakpoint.py']
if lldbinit:
cmds = ['command source $(execpath ' + lldbinit + ')'] + cmds
lldbinit_deps.append(lldbinit)
_lldbinit(name=name + '_lldbinit', out=name + '.lldbinit', content='\n'.join(cmds), deps=lldbinit_deps, visibility=['//visibility:public'])
py_test(name=name, main='@build_bazel_rules_ios//rules/test/lldb:lldb_breakpoint_test_main.py', srcs=['@build_bazel_rules_ios//rules/test/lldb:lldb_breakpoint_test_main.py'], args=['--app', '$(execpath ' + application + ').app', '--sdk', sdk, '--device', "'" + device + "'", '--spec', '$(execpath ' + name + '_test_spec' + ')', '--lldbinit', '$(execpath ' + name + '_lldbinit' + ')'], deps=['@build_bazel_rules_ios//rules/test/lldb:lldb_test'], data=[application, name + '_test_spec', name + '_lldbinit'] + ([lldbinit] if lldbinit else []), **kwargs) |
"""
Tests for qal.common
:copyright: Copyright 2010-2014 by Nicklas Boerjesson
:license: BSD, see LICENSE for details.
"""
| """
Tests for qal.common
:copyright: Copyright 2010-2014 by Nicklas Boerjesson
:license: BSD, see LICENSE for details.
""" |
phonebook = {
"John" : 938477566,
"Jack" : 938377264,
"Jill" : 947662781
}
# Add "Jake" to the phonebook with the phone number 938273443, and remove Jill from the phonebook
phonebook["Jake"] = 938273443
del phonebook["Jill"]
# testing code
if "Jake" in phonebook:
print("Jake is listed in the phonebook.")
if "Jill" not in phonebook:
print("Jill is not listed in the phonebook.")
# Iterating over dictionaries
for name, number in phonebook.items():
print("Phone number of %s is %d" % (name, number))
# Converting a list to a dictionary
sample_list = ['a', 'b', 'c', 'd', 'e']
print(dict(zip(sample_list[::2], sample_list[1::2]))) | phonebook = {'John': 938477566, 'Jack': 938377264, 'Jill': 947662781}
phonebook['Jake'] = 938273443
del phonebook['Jill']
if 'Jake' in phonebook:
print('Jake is listed in the phonebook.')
if 'Jill' not in phonebook:
print('Jill is not listed in the phonebook.')
for (name, number) in phonebook.items():
print('Phone number of %s is %d' % (name, number))
sample_list = ['a', 'b', 'c', 'd', 'e']
print(dict(zip(sample_list[::2], sample_list[1::2]))) |
"""
Given a binary search tree and the lowest and highest boundaries as L and R,
trim the tree so that all its elements lies in [L, R] (R >= L).
You might need to change the root of the tree, so the result should
return the new root of the trimmed binary search tree.
Example 1:
Input:
1
/ \
0 2
L = 1
R = 2
Output:
1
\
2
"""
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
"""
Runtime: 52 ms, faster than 97.09% of Python3.
Memory Usage: 17.3 MB, less than 37.78% of Python3.
Algorithm:
When node.val > R, we know that the trimmed binary tree must occur
to the left of the node. Similarly, when node.val < L, the trimmed
binary tree occurs to the right of the node. Otherwise, we will trim
both sides of the tree.
Time Complexity: O(N), where N is the total number of nodes in the given tree.
Space Complexity: O(N). Call stack of our recursion as large as the number of nodes.
"""
def trimBST(self, root: TreeNode, L: int, R: int) -> TreeNode:
def trim(node):
if not node:
return None
elif node.val > R:
return trim(node.left)
elif node.val < L:
return trim(node.right)
else:
node.left = trim(node.left)
node.right = trim(node.right)
return node
return trim(root)
class Solution2:
"""
Runtime: 56 ms, faster than 90.50% of Python3.
Memory Usage: 17.3 MB, less than 45.37% of Python3.
Recursive approach.
"""
def trimBST(self, root: TreeNode, L: int, R: int) -> TreeNode:
if root is None:
return None
left = self.trimBST(root.left, L, R)
right = self.trimBST(root.right, L, R)
if L <= root.val <= R:
root.left, root.right = left, right
return root
return left if left is not None else right
if __name__ == "__main__":
s = Solution()
s2 = Solution2()
tn_L = TreeNode(0)
tn_R = TreeNode(2)
tn_root = TreeNode(1)
tn_root.left = tn_L
tn_root.right = tn_R
root = s.trimBST(tn_root, 1, 2)
assert root.val == 1
assert root.left is None
assert root.right.val == 2
root = s2.trimBST(tn_root, 1, 2)
assert root.val == 1
assert root.left is None
assert root.right.val == 2
| """
Given a binary search tree and the lowest and highest boundaries as L and R,
trim the tree so that all its elements lies in [L, R] (R >= L).
You might need to change the root of the tree, so the result should
return the new root of the trimmed binary search tree.
Example 1:
Input:
1
/ 0 2
L = 1
R = 2
Output:
1
2
"""
class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
"""
Runtime: 52 ms, faster than 97.09% of Python3.
Memory Usage: 17.3 MB, less than 37.78% of Python3.
Algorithm:
When node.val > R, we know that the trimmed binary tree must occur
to the left of the node. Similarly, when node.val < L, the trimmed
binary tree occurs to the right of the node. Otherwise, we will trim
both sides of the tree.
Time Complexity: O(N), where N is the total number of nodes in the given tree.
Space Complexity: O(N). Call stack of our recursion as large as the number of nodes.
"""
def trim_bst(self, root: TreeNode, L: int, R: int) -> TreeNode:
def trim(node):
if not node:
return None
elif node.val > R:
return trim(node.left)
elif node.val < L:
return trim(node.right)
else:
node.left = trim(node.left)
node.right = trim(node.right)
return node
return trim(root)
class Solution2:
"""
Runtime: 56 ms, faster than 90.50% of Python3.
Memory Usage: 17.3 MB, less than 45.37% of Python3.
Recursive approach.
"""
def trim_bst(self, root: TreeNode, L: int, R: int) -> TreeNode:
if root is None:
return None
left = self.trimBST(root.left, L, R)
right = self.trimBST(root.right, L, R)
if L <= root.val <= R:
(root.left, root.right) = (left, right)
return root
return left if left is not None else right
if __name__ == '__main__':
s = solution()
s2 = solution2()
tn_l = tree_node(0)
tn_r = tree_node(2)
tn_root = tree_node(1)
tn_root.left = tn_L
tn_root.right = tn_R
root = s.trimBST(tn_root, 1, 2)
assert root.val == 1
assert root.left is None
assert root.right.val == 2
root = s2.trimBST(tn_root, 1, 2)
assert root.val == 1
assert root.left is None
assert root.right.val == 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.