content
stringlengths 7
1.05M
| fixed_cases
stringlengths 1
1.28M
|
---|---|
def shortest_path(sx, sy, maze):
w = len(maze[0])
h = len(maze)
board = [[None for i in range(w)] for i in range(h)]
board[sx][sy] = 1
arr = [(sx, sy)]
while arr:
x, y = arr.pop(0)
for i in [[1, 0], [-1, 0], [0, -1], [0, 1]]:
nx, ny = x + i[0], y + i[1]
if 0 <= nx < h and 0 <= ny < w:
if board[nx][ny] is None:
board[nx][ny] = board[x][y] + 1
if maze[nx][ny] == 1:
continue
arr.append((nx, ny))
return board
def solution(maze):
w = len(maze[0])
h = len(maze)
tb = shortest_path(0, 0, maze)
bt = shortest_path(h-1, w-1, maze)
board = []
ans = 2 ** 32-1
for i in range(h):
for j in range(w):
if tb[i][j] and bt[i][j]:
ans = min(tb[i][j] + bt[i][j] - 1, ans)
return ans
|
def shortest_path(sx, sy, maze):
w = len(maze[0])
h = len(maze)
board = [[None for i in range(w)] for i in range(h)]
board[sx][sy] = 1
arr = [(sx, sy)]
while arr:
(x, y) = arr.pop(0)
for i in [[1, 0], [-1, 0], [0, -1], [0, 1]]:
(nx, ny) = (x + i[0], y + i[1])
if 0 <= nx < h and 0 <= ny < w:
if board[nx][ny] is None:
board[nx][ny] = board[x][y] + 1
if maze[nx][ny] == 1:
continue
arr.append((nx, ny))
return board
def solution(maze):
w = len(maze[0])
h = len(maze)
tb = shortest_path(0, 0, maze)
bt = shortest_path(h - 1, w - 1, maze)
board = []
ans = 2 ** 32 - 1
for i in range(h):
for j in range(w):
if tb[i][j] and bt[i][j]:
ans = min(tb[i][j] + bt[i][j] - 1, ans)
return ans
|
# -----------------------------------------------------------------------------
# Copyright (c) 2013-2022, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#
# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
# -----------------------------------------------------------------------------
# numpy._pytesttester is unconditionally imported by numpy.core, thus we can not exclude _pytesttester (which would be
# preferred). Anyway, we can avoid importing pytest, which pulls in anotehr 150+ modules. See
# https://github.com/numpy/numpy/issues/17183
excludedimports = ["pytest"]
|
excludedimports = ['pytest']
|
def bytes(b):
""" Print bytes in a humanized way """
def humanize(b, base, suffices=[]):
bb = int(b)
for suffix in suffices:
if bb < base:
break
bb /= float(base)
return "%.2f %s" % (bb, suffix)
print("Base 1024: ", humanize(
b, 1024, ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB']))
print("Base 1000: ", humanize(
b, 1000, ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB']))
|
def bytes(b):
""" Print bytes in a humanized way """
def humanize(b, base, suffices=[]):
bb = int(b)
for suffix in suffices:
if bb < base:
break
bb /= float(base)
return '%.2f %s' % (bb, suffix)
print('Base 1024: ', humanize(b, 1024, ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB']))
print('Base 1000: ', humanize(b, 1000, ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB']))
|
""" Merge Sort Algorithm: Divide and Conquer Algorithm"""
"""Implementation: Merging two sorted arrays"""
def merge_sort(arr1, arr2):
n1 = len(arr1)
n2 = len(arr2)
index1, index2 = 0, 0
while index1 < n1 and index2 < n2:
if arr1[index1] <= arr2[index2]:
print(arr1[index1], end=" ")
index1 += 1
else:
print(arr2[index2], end=" ")
index2 += 1
while index1 < n1:
print(arr1[index1], end=" ")
index1 += 1
while index2 < n2:
print(arr2[index2], end=" ")
index2 += 1
""" Merge function of merge sort """
def merge_func(arr, low, mid, high) -> list:
n1 = mid - low + 1
n2 = high - mid
left = [0] * n1
right = [0] * n2
for i in range(n1):
left[i] = arr[low+i]
for j in range(n2):
right[j] = arr[mid+j+1]
index1, index2, index3 = 0, 0, 0
while index1 < n1 and index2 < n2:
if left[index1] <= right[index2]:
arr[index3] = left[index1]
index1 += 1
else:
arr[index3] = right[index2]
index2 += 1
index3 += 1
while index1 < n1:
arr[index3] = left[index1]
index3 += 1
index1 += 1
while index2 < n2:
arr[index3] = right[index2]
index3 += 1
index2 += 1
return arr
def main():
arr_input = [1, 2, 5, 10]
arr_input2 = [3, 4, 8, 9]
arr_input3 = [5, 8, 12, 14, 7]
#merge_sort(arr_input, arr_input2)
print("")
a2 = merge_func(arr_input3, 0, 3, 4)
print(a2)
# Using the special variable
# __name__
if __name__ == "__main__":
main()
|
""" Merge Sort Algorithm: Divide and Conquer Algorithm"""
'Implementation: Merging two sorted arrays'
def merge_sort(arr1, arr2):
n1 = len(arr1)
n2 = len(arr2)
(index1, index2) = (0, 0)
while index1 < n1 and index2 < n2:
if arr1[index1] <= arr2[index2]:
print(arr1[index1], end=' ')
index1 += 1
else:
print(arr2[index2], end=' ')
index2 += 1
while index1 < n1:
print(arr1[index1], end=' ')
index1 += 1
while index2 < n2:
print(arr2[index2], end=' ')
index2 += 1
' Merge function of merge sort '
def merge_func(arr, low, mid, high) -> list:
n1 = mid - low + 1
n2 = high - mid
left = [0] * n1
right = [0] * n2
for i in range(n1):
left[i] = arr[low + i]
for j in range(n2):
right[j] = arr[mid + j + 1]
(index1, index2, index3) = (0, 0, 0)
while index1 < n1 and index2 < n2:
if left[index1] <= right[index2]:
arr[index3] = left[index1]
index1 += 1
else:
arr[index3] = right[index2]
index2 += 1
index3 += 1
while index1 < n1:
arr[index3] = left[index1]
index3 += 1
index1 += 1
while index2 < n2:
arr[index3] = right[index2]
index3 += 1
index2 += 1
return arr
def main():
arr_input = [1, 2, 5, 10]
arr_input2 = [3, 4, 8, 9]
arr_input3 = [5, 8, 12, 14, 7]
print('')
a2 = merge_func(arr_input3, 0, 3, 4)
print(a2)
if __name__ == '__main__':
main()
|
#!/usr/bin/env python
""" generated source for module Mapping """
class Mapping(object):
""" generated source for class Mapping """
key = []
def __init__(self):
""" generated source for method __init__ """
self.key = ["#"]*26
@classmethod
def fromTranslation(self, cipher, translation):
""" generated source for method __init___0 """
newKey = ["#"]*26
for i in range(len(translation)):
newKey[ord(cipher[i]) - ord('A')] = translation[i]
return newKey[:]
def getKey(self):
""" generated source for method getKey """
return self.key
def setKey(self, newKey):
""" generated source for method setKey """
self.key = newKey
|
""" generated source for module Mapping """
class Mapping(object):
""" generated source for class Mapping """
key = []
def __init__(self):
""" generated source for method __init__ """
self.key = ['#'] * 26
@classmethod
def from_translation(self, cipher, translation):
""" generated source for method __init___0 """
new_key = ['#'] * 26
for i in range(len(translation)):
newKey[ord(cipher[i]) - ord('A')] = translation[i]
return newKey[:]
def get_key(self):
""" generated source for method getKey """
return self.key
def set_key(self, newKey):
""" generated source for method setKey """
self.key = newKey
|
# 1
# Answer: Programming language
# 2
# Answer: B
# 3
print("Hi")
# 4
# Answer: quit()
# 5
# Answer: 6
# 6
# Answer: B
# 7
# Answer: - 10 +
# 8
# Answer: >>> 1 / 0
# 9
# Answer: A
# 10
# Answer: 15.0
# 11
# Answer: 3
# 12
# Answer: A
# 13
# Answer: \"something\"
# 14
# Answer: input
# 15
# Answer: "World"
# 16
# Answer: D
# 17
# Answer: 777
# 18
# Answer: A
# 19
# Answer: A
# 20
# Answer: B
# 21
# Answer: 7
# 22
# Answer: A
# 23
# Answer: 20
# 24
# Answer: 12
# 25
# Answer: aaa
# 26
# Answer: A
# 27
# Answer: C
# 28
# Answer: B
# 29
# Answer: 82
# 30
# Answer: 2
|
print('Hi')
|
#!/usr/bin/env python3
# vim: set fileencoding=utf-8 fileformat=unix expandtab :
"""__setup__.py -- metadata for xdwlib, A DocuWorks library for Python.
Copyright (C) 2010 HAYASHI Hideki <[email protected]> All rights reserved.
This software is subject to the provisions of the Zope Public License,
Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
FOR A PARTICULAR PURPOSE.
"""
__author__ = "HAYASHI Hideki"
__copyright__ = "Copyright (C) 2010 HAYASHI Hideki <[email protected]>"
__license__ = "ZPL 2.1"
__version__ = "3.9.6.1"
__email__ = "[email protected]"
__status__ = "Beta"
__all__ = ("__author__", "__copyright__", "__license__", "__version__",
"__email__", "__status__")
|
"""__setup__.py -- metadata for xdwlib, A DocuWorks library for Python.
Copyright (C) 2010 HAYASHI Hideki <[email protected]> All rights reserved.
This software is subject to the provisions of the Zope Public License,
Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
FOR A PARTICULAR PURPOSE.
"""
__author__ = 'HAYASHI Hideki'
__copyright__ = 'Copyright (C) 2010 HAYASHI Hideki <[email protected]>'
__license__ = 'ZPL 2.1'
__version__ = '3.9.6.1'
__email__ = '[email protected]'
__status__ = 'Beta'
__all__ = ('__author__', '__copyright__', '__license__', '__version__', '__email__', '__status__')
|
#!/usr/bin/env python
NAME = 'BIG-IP Local Traffic Manager (F5 Networks)'
def is_waf(self):
if self.matchcookie(r'^BIGipServer'):
return True
elif self.matchheader(('X-Cnection', r'^close$'), attack=True):
return True
else:
return False
|
name = 'BIG-IP Local Traffic Manager (F5 Networks)'
def is_waf(self):
if self.matchcookie('^BIGipServer'):
return True
elif self.matchheader(('X-Cnection', '^close$'), attack=True):
return True
else:
return False
|
print("ma petite chaine en or", end='')
|
print('ma petite chaine en or', end='')
|
# function for insertion sort
def Insertion_Sort(list):
for i in range(1, len(list)):
temp = list[i]
j = i - 1
while j >= 0 and list[j] > temp:
list[j + 1] = list[j]
j -= 1
list[j + 1] = temp
# function to print list
def Print_list(list):
for i in range(0, len(list)):
print(list[i],end=" ")
print()
num = int(input())
list = []
for i in range(0, num):
list.append(int(input()))
Insertion_Sort(list)
Print_list(list)
'''
Input :
num = 6
array = [1, 6, 3, 3, 5, 2]
Output :
[1, 2, 3, 3, 5, 6]
'''
|
def insertion__sort(list):
for i in range(1, len(list)):
temp = list[i]
j = i - 1
while j >= 0 and list[j] > temp:
list[j + 1] = list[j]
j -= 1
list[j + 1] = temp
def print_list(list):
for i in range(0, len(list)):
print(list[i], end=' ')
print()
num = int(input())
list = []
for i in range(0, num):
list.append(int(input()))
insertion__sort(list)
print_list(list)
'\nInput :\nnum = 6\narray = [1, 6, 3, 3, 5, 2]\n\nOutput :\n[1, 2, 3, 3, 5, 6]\n'
|
def cleanupFile(file_path):
with open(file_path,'r') as f:
with open("data/transactions.csv",'w') as f1:
next(f) # skip header line
for line in f:
f1.write(line)
def getDateParts(date_string):
year = ''
month = ''
day = ''
date_parts = date_string.split('-')
if (len(date_parts) > 2):
year = date_parts[0]
month = date_parts[1]
day = date_parts[2]
return year, month, day
def dollarStringToNumber(dollar_string):
numeric_value = 0.0
# float conversion doesn't like commas so remove them
dollar_string = dollar_string.replace(',', '')
# remove $ and any leading +/- character
parts = dollar_string.split('$')
if (len(parts) > 1):
value_string = parts[1]
numeric_value = float(value_string)
return numeric_value
|
def cleanup_file(file_path):
with open(file_path, 'r') as f:
with open('data/transactions.csv', 'w') as f1:
next(f)
for line in f:
f1.write(line)
def get_date_parts(date_string):
year = ''
month = ''
day = ''
date_parts = date_string.split('-')
if len(date_parts) > 2:
year = date_parts[0]
month = date_parts[1]
day = date_parts[2]
return (year, month, day)
def dollar_string_to_number(dollar_string):
numeric_value = 0.0
dollar_string = dollar_string.replace(',', '')
parts = dollar_string.split('$')
if len(parts) > 1:
value_string = parts[1]
numeric_value = float(value_string)
return numeric_value
|
#calculation of power using recursion
def exponentOfNumber(base,power):
if power == 0:
return 1
else:
return base * exponentOfNumber(base,power-1)
print("Enter only positive numbers below: ",)
print("Enter a base: ")
number = int(input())
print("Enter a power: ")
exponent = int(input())
result = exponentOfNumber(number,exponent)
print(number,"raised to the power of",exponent,"is",result)
|
def exponent_of_number(base, power):
if power == 0:
return 1
else:
return base * exponent_of_number(base, power - 1)
print('Enter only positive numbers below: ')
print('Enter a base: ')
number = int(input())
print('Enter a power: ')
exponent = int(input())
result = exponent_of_number(number, exponent)
print(number, 'raised to the power of', exponent, 'is', result)
|
def sma():
pass
def ema():
pass
|
def sma():
pass
def ema():
pass
|
dict1={'Influenza':['Relenza','B 0 D'],'Swine Flu':['Symmetrel','B L D'],'Cholera':['Ciprofloxacin','B 0 D'],'Typhoid':['Azithromycin','B L D'],'Sunstroke':['Barbiturates','0 0 D'],'Common cold':['Ibuprufen','B 0 D'],'Whooping Cough':['Erthromycin','B 0 D'],'Gastroentritis':['Gelusil','B 0 D'],'Conjunctivitus':['Romycin','B 0 D'],'Dehydration':['ORS','B L D'],'Asthama':['Terbutaline','B L D'],'Cardiac arrest':['Adrenaline','B 0 D'],'Malaria':['Doxycyline','B L D'],'Anaemia':['Hydroxyurea','B 0 D'],'Pneumonia':['Ibuprofen','B 0 D'],'Arthritis':['Lubrijoint 750','B 0 D'],'Depression':['Sleeping Pills','B L D'],'Food poisoning':['Norflox','B 0 D'],'Migraine':['Crocin','B 0 D'],'Insomnia':['Sleeping Pills','B 0 D']}
{'Influenza':'Relenza','Swine Flu':'Symmetrel','Cholera':'Ciprofloxacin','Typhoid':'Azithromycin','Sunstroke':'Barbiturates','Common cold':'Ibuprufen','Whooping Cough':'Erthromycin','Gastroentritis':'Gelusil','Conjunctivitus':'Romycin','Dehydration':'ORS','Asthama':'Terbutaline','Cardiac arrest':'Adrenaline','Malaria':'Doxycyline','Anaemia':'Hydroxyurea','Pneumonia':'Ibuprofen','Arthritis':'Lubrijoint 750','Depression':'Sleeping Pills','Food poisoning':'Norflox','Migraine':'Crocin','Insomnia':'Sleeping Pills'}
dict1={'Influenza':['Relenza','After Breakfast 0 After Dinner'],'Swine Flu':['Symmetrel','After Breakfast After Lunch After Dinner'],'Cholera':['Ciprofloxacin','After Breakfast 0 After Dinner'],'Typhoid':['Azithromycin','After Breakfast After Lunch After Dinner'],'Sunstroke':['After Breakfastarbiturates','0 0 After Dinner'],'Common cold':['Ibuprufen','After Breakfast 0 After Dinner'],'Whooping Cough':['Erthromycin','After Breakfast 0 After Dinner'],'Gastroentritis':['Gelusil','After Breakfast 0 After Dinner'],'Conjunctivitus':['Romycin','After Breakfast 0 After Dinner'],'Dehydration':['ORS','After Breakfast After Lunch After Dinner'],'Asthama':['Terbutaline','After Breakfast After Lunch After Dinner'],'Cardiac arrest':['Adrenaline','After Breakfast 0 After Dinner'],'Malaria':['Doxycyline','B After Lunch After Dinner'],'Anaemia':['Hydroxyurea','After Breakfast 0 After Dinner'],'Pneumonia':['Ibuprofen','After Breakfast 0 After Dinner'],'Arthritis':['Lubrijoint 750','After Breakfast 0 After Dinner'],'Depression':['Sleeping Pills','After Breakfast After Lunch After Dinner'],'Food poisoning':['Norflox','After Breakfast 0 After Dinner'],'Migraine':['Crocin','After Breakfast 0 After Dinner'],'Insomnia':['Sleeping Pills','After Breakfast 0 After Dinner']}
|
dict1 = {'Influenza': ['Relenza', 'B 0 D'], 'Swine Flu': ['Symmetrel', 'B L D'], 'Cholera': ['Ciprofloxacin', 'B 0 D'], 'Typhoid': ['Azithromycin', 'B L D'], 'Sunstroke': ['Barbiturates', '0 0 D'], 'Common cold': ['Ibuprufen', 'B 0 D'], 'Whooping Cough': ['Erthromycin', 'B 0 D'], 'Gastroentritis': ['Gelusil', 'B 0 D'], 'Conjunctivitus': ['Romycin', 'B 0 D'], 'Dehydration': ['ORS', 'B L D'], 'Asthama': ['Terbutaline', 'B L D'], 'Cardiac arrest': ['Adrenaline', 'B 0 D'], 'Malaria': ['Doxycyline', 'B L D'], 'Anaemia': ['Hydroxyurea', 'B 0 D'], 'Pneumonia': ['Ibuprofen', 'B 0 D'], 'Arthritis': ['Lubrijoint 750', 'B 0 D'], 'Depression': ['Sleeping Pills', 'B L D'], 'Food poisoning': ['Norflox', 'B 0 D'], 'Migraine': ['Crocin', 'B 0 D'], 'Insomnia': ['Sleeping Pills', 'B 0 D']}
{'Influenza': 'Relenza', 'Swine Flu': 'Symmetrel', 'Cholera': 'Ciprofloxacin', 'Typhoid': 'Azithromycin', 'Sunstroke': 'Barbiturates', 'Common cold': 'Ibuprufen', 'Whooping Cough': 'Erthromycin', 'Gastroentritis': 'Gelusil', 'Conjunctivitus': 'Romycin', 'Dehydration': 'ORS', 'Asthama': 'Terbutaline', 'Cardiac arrest': 'Adrenaline', 'Malaria': 'Doxycyline', 'Anaemia': 'Hydroxyurea', 'Pneumonia': 'Ibuprofen', 'Arthritis': 'Lubrijoint 750', 'Depression': 'Sleeping Pills', 'Food poisoning': 'Norflox', 'Migraine': 'Crocin', 'Insomnia': 'Sleeping Pills'}
dict1 = {'Influenza': ['Relenza', 'After Breakfast 0 After Dinner'], 'Swine Flu': ['Symmetrel', 'After Breakfast After Lunch After Dinner'], 'Cholera': ['Ciprofloxacin', 'After Breakfast 0 After Dinner'], 'Typhoid': ['Azithromycin', 'After Breakfast After Lunch After Dinner'], 'Sunstroke': ['After Breakfastarbiturates', '0 0 After Dinner'], 'Common cold': ['Ibuprufen', 'After Breakfast 0 After Dinner'], 'Whooping Cough': ['Erthromycin', 'After Breakfast 0 After Dinner'], 'Gastroentritis': ['Gelusil', 'After Breakfast 0 After Dinner'], 'Conjunctivitus': ['Romycin', 'After Breakfast 0 After Dinner'], 'Dehydration': ['ORS', 'After Breakfast After Lunch After Dinner'], 'Asthama': ['Terbutaline', 'After Breakfast After Lunch After Dinner'], 'Cardiac arrest': ['Adrenaline', 'After Breakfast 0 After Dinner'], 'Malaria': ['Doxycyline', 'B After Lunch After Dinner'], 'Anaemia': ['Hydroxyurea', 'After Breakfast 0 After Dinner'], 'Pneumonia': ['Ibuprofen', 'After Breakfast 0 After Dinner'], 'Arthritis': ['Lubrijoint 750', 'After Breakfast 0 After Dinner'], 'Depression': ['Sleeping Pills', 'After Breakfast After Lunch After Dinner'], 'Food poisoning': ['Norflox', 'After Breakfast 0 After Dinner'], 'Migraine': ['Crocin', 'After Breakfast 0 After Dinner'], 'Insomnia': ['Sleeping Pills', 'After Breakfast 0 After Dinner']}
|
"""
The Program receives from the USER
a university EVALUATION in LETTERS (for example: A+, C-, F, etc.)
and returns (displaying it) the corresponding evaluation in POINTS.
"""
# START Definition of FUNCTIONS
def letterGradeValida(letter):
if len(letter) == 1:
if (65 <= ord(letter[0].upper()) <= 68) or (letter[0].upper() == "F"):
return True
elif len(letter) == 2:
if (65 <= ord(letter[0].upper()) <= 68):
if (letter[1] == "+") or (letter[1] == "-"):
return True
return False
def letterGradeToPoints(letter):
letterGrade = {"A+": 4.0, "A": 4.0, "A-": 3.7, "B+": 3.3,
"B": 3.0, "B-": 2.7, "C+": 2.3, "C": 2.0, "C-": 1.7,
"D+": 1.3, "D": 1.0, "F": 0}
return letterGrade.get(letter.upper())
# END Definition of FUNCTIONS
# Acquisition and Control of the DATA entered by the USER
letter = input("Enter the LETTER GRADE (A, A+, A-, etc): ")
letterGradeValidated = letterGradeValida(letter)
while not(letterGradeValidated):
print("Incorrect entry. Try again.")
letter = input("Enter the LETTER GRADE (A, A+, A-, etc): ")
letterGradeValidated = letterGradeValida(letter)
# Identification LETTER GRADE -> GRADE POINTS
gradePoints = letterGradeToPoints(letter)
# Displaying the RESULTS
print("The GRADE POINTS of the letter grade \"" + letter.upper() +
"\" is " + str(gradePoints))
|
"""
The Program receives from the USER
a university EVALUATION in LETTERS (for example: A+, C-, F, etc.)
and returns (displaying it) the corresponding evaluation in POINTS.
"""
def letter_grade_valida(letter):
if len(letter) == 1:
if 65 <= ord(letter[0].upper()) <= 68 or letter[0].upper() == 'F':
return True
elif len(letter) == 2:
if 65 <= ord(letter[0].upper()) <= 68:
if letter[1] == '+' or letter[1] == '-':
return True
return False
def letter_grade_to_points(letter):
letter_grade = {'A+': 4.0, 'A': 4.0, 'A-': 3.7, 'B+': 3.3, 'B': 3.0, 'B-': 2.7, 'C+': 2.3, 'C': 2.0, 'C-': 1.7, 'D+': 1.3, 'D': 1.0, 'F': 0}
return letterGrade.get(letter.upper())
letter = input('Enter the LETTER GRADE (A, A+, A-, etc): ')
letter_grade_validated = letter_grade_valida(letter)
while not letterGradeValidated:
print('Incorrect entry. Try again.')
letter = input('Enter the LETTER GRADE (A, A+, A-, etc): ')
letter_grade_validated = letter_grade_valida(letter)
grade_points = letter_grade_to_points(letter)
print('The GRADE POINTS of the letter grade "' + letter.upper() + '" is ' + str(gradePoints))
|
def solve(captcha, step):
result = 0
for i in range(len(captcha)):
if captcha[i] == captcha[(i + step) % len(captcha)]:
result += int(captcha[i])
return result
if __name__ == '__main__':
solve_part1 = lambda captcha: solve(captcha, 1)
solve_part2 = lambda captcha: solve(captcha, len(captcha) // 2)
with open('day1.in') as file:
captcha = file.read()
print(f'Solution to Part 1: {solve_part1(captcha)}')
print(f'Solution to Part 2: {solve_part2(captcha)}')
|
def solve(captcha, step):
result = 0
for i in range(len(captcha)):
if captcha[i] == captcha[(i + step) % len(captcha)]:
result += int(captcha[i])
return result
if __name__ == '__main__':
solve_part1 = lambda captcha: solve(captcha, 1)
solve_part2 = lambda captcha: solve(captcha, len(captcha) // 2)
with open('day1.in') as file:
captcha = file.read()
print(f'Solution to Part 1: {solve_part1(captcha)}')
print(f'Solution to Part 2: {solve_part2(captcha)}')
|
print ('{0:.3f}'.format(1.0/3))
print('{0} / {1} = {2:.3f}'.format(3, 4,3/4 ))
# fill with underscores (_) with the text centered
# (^) to 11 width '___hello___'
print ('{0:_^9}'.format('hello'))
def variable(name=''):
print('{0:*^12}'.format(name))
variable()
print('{0:*^12}'.format('sendra'))
variable()
# keyword-based
print ('{name} read {book} now.'.format(name='My Lovely Friend Sendra', book='A Byte of Python'))
|
print('{0:.3f}'.format(1.0 / 3))
print('{0} / {1} = {2:.3f}'.format(3, 4, 3 / 4))
print('{0:_^9}'.format('hello'))
def variable(name=''):
print('{0:*^12}'.format(name))
variable()
print('{0:*^12}'.format('sendra'))
variable()
print('{name} read {book} now.'.format(name='My Lovely Friend Sendra', book='A Byte of Python'))
|
INH = "Inherent" # The 'address' is inherent in the opcode. e.g. ABX
INT = "Interregister" # An pseudo-addressing for an immediate operand which specified registers for the EXG and TFR instructions
IMM = "Immediate" # Operand immediately follows the opcode. A literal. Could be 8-bit (LDA), 16-bit (LDD), or 32-bit (LDQ)
DIR = "PageDirect" # An 8-bit offset pointer from the base of the direct page, as defined by the DP register. Also known as just 'Direct'.
IDX = "Indexed" # Relative to the address in a base register (an index register or stack pointer)
EXT = "ExtendedDirect" # A 16-bit pointer to a memory location. Also known as just 'Extended'.
REL8 = "Relative8 8-bit" # Program counter relative
REL16 = "Relative8 16-bit" # Program counter relative
# What about what Leventhal calls 'Register Addressing'. e.g. EXG X,U
|
inh = 'Inherent'
int = 'Interregister'
imm = 'Immediate'
dir = 'PageDirect'
idx = 'Indexed'
ext = 'ExtendedDirect'
rel8 = 'Relative8 8-bit'
rel16 = 'Relative8 16-bit'
|
"""Question 3: Accept string from a user and display only those characters
which are present at an even index number."""
def evenIndexNumber(palabra):
print("Printing only even index chars")
for i in range(0, len(palabra), 2):
print("index[", i, "]", palabra[i:i+1])
word=input("Enter String ")
print("Original String is", word)
evenIndexNumber(word)
|
"""Question 3: Accept string from a user and display only those characters
which are present at an even index number."""
def even_index_number(palabra):
print('Printing only even index chars')
for i in range(0, len(palabra), 2):
print('index[', i, ']', palabra[i:i + 1])
word = input('Enter String ')
print('Original String is', word)
even_index_number(word)
|
'''
Given a number A. Find the fatorial of the number.
Problem Constraints
1 <= A <= 100
'''
def factorial(A: int) -> int:
if A <= 1:
return 1
return (A * factorial(A-1))
if __name__ == "__main__":
A = 3
print(factorial(A))
|
"""
Given a number A. Find the fatorial of the number.
Problem Constraints
1 <= A <= 100
"""
def factorial(A: int) -> int:
if A <= 1:
return 1
return A * factorial(A - 1)
if __name__ == '__main__':
a = 3
print(factorial(A))
|
i = 125874
while True:
if sorted(str(i)) == sorted(str(i * 2)) == sorted(str(i * 3)) == sorted(str(i * 4)) == sorted(str(i * 5)) == sorted(str(i * 6)):
break
else:
i += 1
print(i)
|
i = 125874
while True:
if sorted(str(i)) == sorted(str(i * 2)) == sorted(str(i * 3)) == sorted(str(i * 4)) == sorted(str(i * 5)) == sorted(str(i * 6)):
break
else:
i += 1
print(i)
|
#!/usr/bin/env python3
a = ["uno", "dos", "tres"]
b = [f"{i:#04d} {e}" for i,e in enumerate(a)]
print(b)
|
a = ['uno', 'dos', 'tres']
b = [f'{i:#04d} {e}' for (i, e) in enumerate(a)]
print(b)
|
def test_app_is_created(app):
assert app.name == 'care_api.app'
def test_request_returns_404(client):
assert client.get('/url_not_found').status_code == 404
|
def test_app_is_created(app):
assert app.name == 'care_api.app'
def test_request_returns_404(client):
assert client.get('/url_not_found').status_code == 404
|
def pi_nks(limit: int) -> float:
pi: float = 3.0
s: int = 1
for i in range(2, limit, 2):
pi += (s*4/(i*(i+1)*(i+2)))
s = s*(-1)
return pi
def pi_gls(limit: int) -> float:
pi: float = 0.0
s: int = 1
for i in range(1, limit, 2):
pi += (s*(4/i))
s = s*(-1)
return pi
if __name__ == "__main__":
LIMIT: int = 100
print(f"NKS: {pi_nks(limit=LIMIT):.13f}")
print(f"GLS: {pi_gls(limit=LIMIT):.13f}")
|
def pi_nks(limit: int) -> float:
pi: float = 3.0
s: int = 1
for i in range(2, limit, 2):
pi += s * 4 / (i * (i + 1) * (i + 2))
s = s * -1
return pi
def pi_gls(limit: int) -> float:
pi: float = 0.0
s: int = 1
for i in range(1, limit, 2):
pi += s * (4 / i)
s = s * -1
return pi
if __name__ == '__main__':
limit: int = 100
print(f'NKS: {pi_nks(limit=LIMIT):.13f}')
print(f'GLS: {pi_gls(limit=LIMIT):.13f}')
|
#
# Script for converting collected NR data into
# the format for comparison with the simulations
#
def clean_and_save(file1, file2, cx, cy, ech):
''' Remove rows with character ech from
the data in file1 column cy and corresponding
rows in cx, then save to file2. Column numbering
starts with 0. '''
with open(file1, 'r') as fin, open(file2, 'w') as fout:
# Skip the header
next(fin)
for line in fin:
temp = line.strip().split()
if temp[cy] == ech:
continue
else:
fout.write((' ').join([temp[cx], temp[cy], '\n']))
# Input
data_file = 'input_data/New_Rochelle_covid_data.txt'
no_entry_mark = '?'
# Number of active cases
clean_and_save(data_file, 'output/real_active_w_time.txt', 1, 2, no_entry_mark)
# Total number of cases
clean_and_save(data_file, 'output/real_tot_cases_w_time.txt', 1, 3, no_entry_mark)
# Number of deaths in the county
clean_and_save(data_file, 'output/real_tot_deaths_county_w_time.txt', 1, 4, no_entry_mark)
|
def clean_and_save(file1, file2, cx, cy, ech):
""" Remove rows with character ech from
the data in file1 column cy and corresponding
rows in cx, then save to file2. Column numbering
starts with 0. """
with open(file1, 'r') as fin, open(file2, 'w') as fout:
next(fin)
for line in fin:
temp = line.strip().split()
if temp[cy] == ech:
continue
else:
fout.write(' '.join([temp[cx], temp[cy], '\n']))
data_file = 'input_data/New_Rochelle_covid_data.txt'
no_entry_mark = '?'
clean_and_save(data_file, 'output/real_active_w_time.txt', 1, 2, no_entry_mark)
clean_and_save(data_file, 'output/real_tot_cases_w_time.txt', 1, 3, no_entry_mark)
clean_and_save(data_file, 'output/real_tot_deaths_county_w_time.txt', 1, 4, no_entry_mark)
|
# Set to 1 or 2 to show what we send and receive from the SMTP server
SMTP_DEBUG = 0
SMTP_HOST = ''
SMTP_PORT = 465
SMTP_FROM_ADDRESSES = ()
SMTP_TO_ADDRESS = ''
# these two can also be set by the environment variables with the same name
SMTP_USERNAME = ''
SMTP_PASSWORD = ''
IMAP_HOSTNAME = ''
IMAP_USERNAME = ''
IMAP_PASSWORD = ''
IMAP_LIST_FOLDER = 'INBOX'
CHECK_ACCEPT_AGE_SECONDS = 3600
|
smtp_debug = 0
smtp_host = ''
smtp_port = 465
smtp_from_addresses = ()
smtp_to_address = ''
smtp_username = ''
smtp_password = ''
imap_hostname = ''
imap_username = ''
imap_password = ''
imap_list_folder = 'INBOX'
check_accept_age_seconds = 3600
|
"""
Messages dictionary
==================
This module takes care of logging, using levels ERROR|DEBUG. Other levels could be added in the future
This is to make it easier to translate the language of this tool and to centralize the logging behavior
> Ignacio Tamayo, TSP, 2016
> Version 1.4
> Date: Sept 2016
"""
"""
..licence::
vIOS (vCDN Infrastructure Optimization Simulator)
Copyright (c) 2016 Telecom SudParis - RST Department
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
AdminPageTitle = 'vIOSimulator - DB Management'
Errors_updating_POPs = "There were some errors while updating the POPs"
Errors_updating_Metrics = "There were some errors while updating the Metrics from the POPs"
Error_building_Topologie = "There were some errors while building the Topologie graph"
Errors_random_links = "There were some errors while creating random Links"
ERROR_creating_Demands = "ERROR creating random demands"
ERROR_consuming_Demands = "ERROR calculating capacity consumed by demands"
Exception_drawing_Topologie = "Exception ocurred while drawing the Topologie"
ERROR_creating_Demands = "ERROR creating random demands"
ERROR_optimizing = "ERROR while optimizing"
Updated_Topo_Random = "Topologie updated with random links"
Updated_Graph = "Updated graph"
Created_Demands = "Demands generated randomly"
Updated_POPs = "Information updated from OpenStack Controllers"
Optimized = "Optimal migrations calculated"
Missing_Elements_to_Build_Model = "Missing elements to build an OMAC/HMAC Model (Locations and Network Links)"
NoPOPs = "There are no POPs found in the DB"
NovCDNs = "There are no vCDNs found in the DB"
POP_not_found = "POP not found in DB"
vCDN_not_found = "vCDN not found in DB"
NoDemands = "There are no demands registered in the DB"
NoNetworkLinks = "There are no Network Links registered in the DB"
Error_executing = "Error executing the selected operations"
Executing = "Executing the operations in background"
QoE_reset = "QoE Value was reset, no change was done to the Demands"
Adjusted_Demands = "The Demands' BW were adjusted for the QoE value"
ERROR_adjusting_Demands = "Unable to adjust the Demands' BW for the QoE value"
###
### Optimizer.py
###
Create_Random_Topologie = "Creating a Random Topologie"
Consuming_Demands = "Consuming Demands BW on topologie capacity"
Random_Graph_Created = "A Random Topologie Graph has been created"
Updated_NetworkLinks = "The Network Links have been replaced by the random topologie"
Updated_ClientLocations = "The Client Groups have been distributed in the new topologie"
Exception_updating_Infrastructure = "Exception ocurred while updating the Infrastructure Topologie"
Exception_updating_Demand = "Exception ocurred while creating random Demands"
Exception_optimizing = "Exception ocurred while executing the Optimization"
CreatingRandomDemands_D_probaF_amplitudeD = "Creating random %d Demands, p=%f, amplitude=%d "
Created_D_Demands = "Created %d random demands "
Updated__D_OpenStack_Metrics = "Updated OpenStack Metrics for %d instances"
Invalid_Demand_Client_S_vCDN_S_POP_S = "Invalid demand from ClientGroup '%s' for vCDN '%s' at POP '%s' "
No_OMAC_Optimize = "Unable to perform OMAC optimization"
Deleted_Demands = "Demands deleted from the DB"
Deleted_Migrations = "Migrations deleted from the DB"
Updated_Demands_QosBW = "Updated the demanded QoSBW based on vCDN information"
HMAC_optimized = "Finished running HMAC"
OMAC_optimized = "Created OMAC CPLEX data file"
Optimized_F = "Optimization executed in %f seconds"
Exception_Building_Model = "Exception ocurred while building the OMAC/HMAC Model"
Updated_MigrationCost_MigrationId_D = "Migration cost updated for Migration %d"
Create_Random_Demands = "Creating Random Demands"
Updating_OpenStack = "Updating the OpenStack POP information"
Updating_OpenStack_Metrics = "Updating the OpenStack Metrics information for all Tenants"
Connected_POP_S = "Connected to POP '%s'"
Optimizating = "Running the Optimization algorithm"
Exception_Model_POPS = "Exception ocurred while placing the POPs in the OMAC/HMAC Model"
NoClients = "There are no ClientGroups found in the DB"
Exception_Model_Clients = "Exception ocurred while placing the Clients in the OMAC/HMAC Model"
Exception_updating_Topologie = "Exception ocurred while updating the Topologie"
Exception_Metrics_Tenant_S_POP_S = "Unable to get Metrics for Tenant %s in POP %s "
Created_Hypervisor_S_POP_S = " Created hypervisor '%s' for POP '%s' "
Created_Flavor_S_POP_S = " Created flavor '%s' for POP '%s' "
Updated_Hypervisor_S_POP_S = " Updated hypervisor %s for POP %s"
Updated_Flavor_S_POP_S = " Updated flavor %s for Pop %s"
Exception_Update_Hypervisor_S_POP_S = "Exception ocurred while updating the hypervisor '%s' on POP '%s'"
Exception_Update_vCDN_S_POP_S = "Exception ocurred while updating the vCDN '%s' on POP '%s'"
Exception_Update_Flavor_S_POP_S = "Exception ocurred while updating the flavors '%s' on POP '%s' "
Getting_Metric_Pop_D_tenant_S = "Obtaining metrics from POP '%s' for vCDN '%s'"
NoConnect_Pop_S = "Unable to connect and login to POP '%s' "
Exception_Simulating = "Exception occured while running the simulation"
Updated_Pop_S = "Updated information from POP '%s'"
Updated_Tenants_Pop_S = "Updated Tenants instances from POP '%s' "
Updated_Metrics_Pop_S = "Updated Tenants metrics from POP '%s'"
Updated_Metric_Instance_D = "Updated Metrics of Instance ID %s"
Added_Metric_Instance_D = "Added Metrics for Instance ID %s"
Found_Instance_S_at_POP_S_LimitsInstances_D = "Found instance of %s at Pop %s with %d VMs "
Deleted_Instance_S_at_POP_S = "Deleted instance of %s at Pop %s "
Added_Instance_S_at_POP_S = "Added instance of %s at Pop %s "
Updated_Instance_S_at_POP_S = "Updated instance of %s at Pop %s"
NoModel = "There is no Model to work with"
NoInstances = "No Instances were found"
NoMigrations = "No Migrations were found"
NoRedirectsSelected = "No Redirections selected"
NoMigrationsSelected = "No Migrations selected"
NoInstantiationsSelected = "No Instantiations selected"
ConnectDB_S = "Connecting to DB with url '%s' "
Simulate_Migration_vCDN_S_from_POP_S_to_POP_S = "Simulate Migration of vcdn '%s' from POP '%s' to POP '%s'"
Simulate_Redirection_vCDN_S_from_POP_S_to_POP_S = "Simulate Redirection of vcdn '%s' from POP '%s' to POP '%s'"
Simulate_Instantiation_vCDN_S_on_POP_S = "Simulate Instantiation of vcdn '%s' on POP '%s' "
Simulating_Instantiations = "Simulating the Instantiations"
Simulated_D_Instantiations = "Simulated %d Instantiations in the Model"
Simulating_Redirections = "Simulating the Redirections"
Simulated_D_Redirections = "Simulated %d Redirections in the Model"
Simulating_Migrations = "Simulating the Migrations"
Simulated_D_Migrations = "Simulated %d Migrations in the Model"
Adjusting_Instances_Demands = "Adjusting the Instances and Demands to the selected changes"
Adjusting_Model = "Adjusting the Model's Graph to reflect the simulated Instances"
Running_Demands = "Running the simulated Demands"
Deleted_Redirections = "Deleted the previous Redirections"
Executing_D_Migrations = "Executing %d Migrations"
Executing_D_Instantiations = "Executing %d Instantiations"
Migrating_vCDN_S_fromPOP_S_toPOP_S = "Migrating vCDN '%s' from POP '%s' to POP '%s'"
Migrating_Server_S_vCDN_S_POP_S = "Migrating Server '%s' of vCDN '%s 'from POP '%s'"
Unable_Thread = "Unable to create Thread for the operation"
NoInstanceForvCDN = "There are no Instances of the vCDN to clone"
NoInstanceForvCDN_S = "There are no Instances of vCDN '%s' to clone from"
Created_Snapshot_Server_S_POP_S = "Created an Snapshot of Server '%s' in POP '%s'"
Created_Server_S_vCDN_S_POP_S = "Created server '%s' of vCDN '%s' in POP '%s' "
Deleted_Server_S_vCDN_S_POP_S = "Deleted server '%s' of vCDN '%s' in POP '%s' "
QuotaLimit = "Servers quota full, not allowed to start more servers."
NotDeleted_Server_S_vCDN_S_POP_S = "Server '%s' of vCDN '%s' in POP '%s' was not deleted after Migration "
NotResumed_Server_S_POP_S = "Server '%s' in POP '%s' was not resumed after snapshpt "
downloadedImageFile_S = "Downloaded the IMG file in '%s' "
uploadedImageFile_S = "Uploaded the IMG file in '%s' "
Exception_Cloning_Server_S_POP_S_POP_S = "Exception occured when cloning server '%s' from POP '%s' to POP '%s'"
Error_migrating = "Unable to gather Migrations Information to execute"
Error_instantiating = "Unable to gather Instantiation Information to execute"
Invalid_QoE_Value = "Invalid QoE value"
Invalid_QoE_Model = "Invalid QoE model"
QoE_outOfModel = "The QoE value is out of the Model boundaries"
Updating_Demand_BW_QoE_F = "Updating the Demands BW to match a QoE = %f "
Updating_Demand_BW_x_F = "Updating the Demands BW by a factor of %f "
Updated_Demand_BW = "Updated the Demands BW "
###
### OptimizationModels.py
###
Building_Model = "Building a new Model"
Added_Node_S = "Added node %s "
Added_Link_S_to_S_of_D = "Added link from %s to %s, %d Mbps"
Added_Pop_S_in_S = "Added pop %s to node %s"
Added_Client_S_in_S = "Added clientGroup %s to node %s"
Draw_File_S = "Graph drawn to file %s"
Client_S_requests_S_from_S_BW_D = "Demand from ClientGroup at %s requesting vCDN %s from Pop %s with BW %d"
Migration_to_POP_S = "Migration to Pop %s"
NeedeBW_D_more_LinkBW_D = "The needed BW %d Mbps is more than the available link %d Mbps"
Built_Model_D_locations_D_links = "A new model was built with %d locations and %d links "
Added_D_POPs = "Added %d POPs to the Model"
Added_D_Clients = "Added %d ClientGroups to the Model"
RandomGraph_locationsD_maxCapaD = "Creating random Graph for %d locations with maxCapacity=%d "
RandomGraph_locationsD = "Created random Graph of %d nodes"
Migration_condition_BWNeeded_D_GomuriCap_D_PopCap_PopCanHost_S = "Migration condition: DemandedBW=%d LinkBW=%d PopBW=%d PopCanHost=%s"
ShortestPath_S = "The SPT for this demand is '%s' "
Migrate_vCDN_S_srcPOP_S_dstPOP_S = "Migrate vCDN '%s' from POP '%s' to POP '%s' "
Migrate_vCDN_S_srcPOP_S_dstPOP_S_RedirectionBW = "Migrating vCDN '%s' from POP '%s' to POP '%s' would cause Redirections that saturate the link "
HMAC_optimized_D_migrations_D_invalidDemands = "HMAC optimization determined %d migrations and %d invalid demands"
ClientLocation_S_requests_S_from_S_TotalBW_F = "Clients located in '%s' request vCDN '%s' from POP '%s', needing %.2f Mbps of BW"
Migration_path_D_Hops_F_BW = "Migration path of %d hops and %.2f Mbps minimal BW"
Migration_Condition_Hold_B_NetCapacity_D_Mbps = "The Migration was rejected because HoldvCDN = %s and Remaining BW in POP is %d Mbps"
Scale_Condition_NetCapacity_D_Mbps = "The Scaling was rejected because Remaining BW in POP is %d Mbps"
Migration_check_PopSrc_S_PopDts_S = "Checking possible migration from POP '%s' to POP '%s'"
Graph_Topologie_Consume_Demands = "Consuming a Topologie Graph with a set of demands"
Graph_Capacity_Consume_Demands = "Consuming a Capacity Graph with a set of demands"
Graph_Consume_D_Demands = "Consumed %d Demands from the Graph"
Exception_Consuming_Demand_D_Graph = "Exception while consuming Demand %d on a Topologie Graph"
Exception_Removing_Demand_D_Graph = "Exception while returning Demand %d on a Topologie Graph"
Exception_Migrating_vCDN_S_PopSrc_S_PopDts_S = "Exception occured while calculating migration of vCDN '%s' from POP '%s' to POP '%s'"
Redirect_Demand_Client_S_vCDN_S_srcPOP_S_dstPOP_S = "Scale-out and redirect Demands of clientGroup '%s' for vCDN '%s' from POP '%s' to POP '%s'"
Demand_id_D_isValid = "Demand %d has a valid Instace, unable to simulate an Instantiation"
Redirect_D_invalid = "Redirect %d is invalid; could be a Migration"
Errors_simulating = "Some error occured while executing the simulation"
Removing_Simulated_Redirects = "Removing the Demands from the previous path before redirection"
Consuming_Simulated_Redirects = "Adding the Demands on the simulated path after redirection"
Exception_Consuming_Fake_Demand = "Exception occured while Consuming a simulated Demand"
ClientLocation_S_requests_from_S_TotalBW_F = "Consuming fake Demand of ClientGroup at '%s' to POP '%s' with BW '%.2f'"
Deleted_Fake_Instace_POP_S_vCDN_S = "Deleting Fake Instance in POP '%s' of vCDN '%s'"
Added_Fake_Instace_POP_S_vCDN_S = "Adding Fake Instance in POP '%s' of vCDN '%s'"
Update_Fake_Demand_fromPOP_S_toPOP_S = "Update of Demand from POP '%s' to POP '%s'"
Unable_Write_File_S = "Unable to write the file '%s'"
OMAC_DAT_S = "OMAC .dat file was created in '%s'"
###
### OpenStackConnection.py
###
AuthOS_url_S_user_s_tenant_S = "Authenticating to URL %s as User '%s' of Tenant '%s'"
AuthOS_region_S = "Authenticating to Region '%s'"
Exception_Nova_url_S_region_S_user_S_tenant_S = "Unable to authenticate to Nova Service via URL %s in Region '%s' as User '%s' of Tenant '%s'"
Exception_Ceilometer_url_S_region_S_user_S_tenant_S = "Unable to authenticate to Ceilometer Service via URL %s in Region '%s' as User '%s' of Tenant '%s'"
Exception_Glance_url_S_region_S_user_S_tenant_S = "Unable to authenticate to Glance Service via URL %s in Region '%s' as User '%s' of Tenant '%s'"
LastSample_S_at_S = "Last sample of meter '%s' at '%s' "
CollectSamples_S_since_S = "Collecting stats of meter '%s' since '%s' "
Meter_Stats_minD_maxD_avgD = "Values collected are: Min=%d Max=%d Avg=%d "
NoMetrics_Meter_S = "No Metric collected for meter '%s' "
Authenticated = "Authenticated"
Migrating_Instance_vCDN_S_POP_S_POP_S = "Migrating Instance of vCDN %s from POP %s to POP %s"
Instantiating_Instance_vCDN_S_POP_S = "Instantiating vCDN %s on POP %s"
Instantiation_ended_Instance_vCDN_S_POP_S = "Instantiation of vCDN %s on POP %s has finished"
Migration_ended_Instance_vCDN_S_POP_S_POP_S = "Migration of vCDN %s from POP %s to POP %s has finished"
Exception_Migrating_Server_S_POP_S_POP_S = "Exception occured while migrating a Server Id %s from POP %s to POP %s"
NoConnect_Pops = "Unable to connect to the POPs to perform the Migration"
NoDownload_ImgFile_S = "Unable to download the image file %s"
NoUpload_ImgFile_S = "Unable to upload the image file %s"
NoWritable_S = "The location %s is not writable"
NoServerCreated_vCDN_S_POP_S = "Unable to start a new Server in POP '%s' for vCDN '%s'"
Invalid_Server_Parameters_S = "Invalid parameters for creating a Server: %s"
ServerId_S_NotFound = "Unable to find a server with id = '%s'"
ImageId_S_NotFound = "Unable to find an image with id = '%s'"
|
"""
Messages dictionary
==================
This module takes care of logging, using levels ERROR|DEBUG. Other levels could be added in the future
This is to make it easier to translate the language of this tool and to centralize the logging behavior
> Ignacio Tamayo, TSP, 2016
> Version 1.4
> Date: Sept 2016
"""
'\n..licence::\n\n\tvIOS (vCDN Infrastructure Optimization Simulator)\n\n\tCopyright (c) 2016 Telecom SudParis - RST Department\n\n\tPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n\tThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n\tTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'
admin_page_title = 'vIOSimulator - DB Management'
errors_updating_po_ps = 'There were some errors while updating the POPs'
errors_updating__metrics = 'There were some errors while updating the Metrics from the POPs'
error_building__topologie = 'There were some errors while building the Topologie graph'
errors_random_links = 'There were some errors while creating random Links'
error_creating__demands = 'ERROR creating random demands'
error_consuming__demands = 'ERROR calculating capacity consumed by demands'
exception_drawing__topologie = 'Exception ocurred while drawing the Topologie'
error_creating__demands = 'ERROR creating random demands'
error_optimizing = 'ERROR while optimizing'
updated__topo__random = 'Topologie updated with random links'
updated__graph = 'Updated graph'
created__demands = 'Demands generated randomly'
updated_po_ps = 'Information updated from OpenStack Controllers'
optimized = 'Optimal migrations calculated'
missing__elements_to__build__model = 'Missing elements to build an OMAC/HMAC Model (Locations and Network Links)'
no_po_ps = 'There are no POPs found in the DB'
nov_cd_ns = 'There are no vCDNs found in the DB'
pop_not_found = 'POP not found in DB'
v_cdn_not_found = 'vCDN not found in DB'
no_demands = 'There are no demands registered in the DB'
no_network_links = 'There are no Network Links registered in the DB'
error_executing = 'Error executing the selected operations'
executing = 'Executing the operations in background'
qo_e_reset = 'QoE Value was reset, no change was done to the Demands'
adjusted__demands = "The Demands' BW were adjusted for the QoE value"
error_adjusting__demands = "Unable to adjust the Demands' BW for the QoE value"
create__random__topologie = 'Creating a Random Topologie'
consuming__demands = 'Consuming Demands BW on topologie capacity'
random__graph__created = 'A Random Topologie Graph has been created'
updated__network_links = 'The Network Links have been replaced by the random topologie'
updated__client_locations = 'The Client Groups have been distributed in the new topologie'
exception_updating__infrastructure = 'Exception ocurred while updating the Infrastructure Topologie'
exception_updating__demand = 'Exception ocurred while creating random Demands'
exception_optimizing = 'Exception ocurred while executing the Optimization'
creating_random_demands_d_proba_f_amplitude_d = 'Creating random %d Demands, p=%f, amplitude=%d '
created_d__demands = 'Created %d random demands '
updated__d__open_stack__metrics = 'Updated OpenStack Metrics for %d instances'
invalid__demand__client_s_v_cdn_s_pop_s = "Invalid demand from ClientGroup '%s' for vCDN '%s' at POP '%s' "
no_omac__optimize = 'Unable to perform OMAC optimization'
deleted__demands = 'Demands deleted from the DB'
deleted__migrations = 'Migrations deleted from the DB'
updated__demands__qos_bw = 'Updated the demanded QoSBW based on vCDN information'
hmac_optimized = 'Finished running HMAC'
omac_optimized = 'Created OMAC CPLEX data file'
optimized_f = 'Optimization executed in %f seconds'
exception__building__model = 'Exception ocurred while building the OMAC/HMAC Model'
updated__migration_cost__migration_id_d = 'Migration cost updated for Migration %d'
create__random__demands = 'Creating Random Demands'
updating__open_stack = 'Updating the OpenStack POP information'
updating__open_stack__metrics = 'Updating the OpenStack Metrics information for all Tenants'
connected_pop_s = "Connected to POP '%s'"
optimizating = 'Running the Optimization algorithm'
exception__model_pops = 'Exception ocurred while placing the POPs in the OMAC/HMAC Model'
no_clients = 'There are no ClientGroups found in the DB'
exception__model__clients = 'Exception ocurred while placing the Clients in the OMAC/HMAC Model'
exception_updating__topologie = 'Exception ocurred while updating the Topologie'
exception__metrics__tenant_s_pop_s = 'Unable to get Metrics for Tenant %s in POP %s '
created__hypervisor_s_pop_s = " Created hypervisor '%s' for POP '%s' "
created__flavor_s_pop_s = " Created flavor '%s' for POP '%s' "
updated__hypervisor_s_pop_s = ' Updated hypervisor %s for POP %s'
updated__flavor_s_pop_s = ' Updated flavor %s for Pop %s'
exception__update__hypervisor_s_pop_s = "Exception ocurred while updating the hypervisor '%s' on POP '%s'"
exception__update_v_cdn_s_pop_s = "Exception ocurred while updating the vCDN '%s' on POP '%s'"
exception__update__flavor_s_pop_s = "Exception ocurred while updating the flavors '%s' on POP '%s' "
getting__metric__pop_d_tenant_s = "Obtaining metrics from POP '%s' for vCDN '%s'"
no_connect__pop_s = "Unable to connect and login to POP '%s' "
exception__simulating = 'Exception occured while running the simulation'
updated__pop_s = "Updated information from POP '%s'"
updated__tenants__pop_s = "Updated Tenants instances from POP '%s' "
updated__metrics__pop_s = "Updated Tenants metrics from POP '%s'"
updated__metric__instance_d = 'Updated Metrics of Instance ID %s'
added__metric__instance_d = 'Added Metrics for Instance ID %s'
found__instance_s_at_pop_s__limits_instances_d = 'Found instance of %s at Pop %s with %d VMs '
deleted__instance_s_at_pop_s = 'Deleted instance of %s at Pop %s '
added__instance_s_at_pop_s = 'Added instance of %s at Pop %s '
updated__instance_s_at_pop_s = 'Updated instance of %s at Pop %s'
no_model = 'There is no Model to work with'
no_instances = 'No Instances were found'
no_migrations = 'No Migrations were found'
no_redirects_selected = 'No Redirections selected'
no_migrations_selected = 'No Migrations selected'
no_instantiations_selected = 'No Instantiations selected'
connect_db_s = "Connecting to DB with url '%s' "
simulate__migration_v_cdn_s_from_pop_s_to_pop_s = "Simulate Migration of vcdn '%s' from POP '%s' to POP '%s'"
simulate__redirection_v_cdn_s_from_pop_s_to_pop_s = "Simulate Redirection of vcdn '%s' from POP '%s' to POP '%s'"
simulate__instantiation_v_cdn_s_on_pop_s = "Simulate Instantiation of vcdn '%s' on POP '%s' "
simulating__instantiations = 'Simulating the Instantiations'
simulated_d__instantiations = 'Simulated %d Instantiations in the Model'
simulating__redirections = 'Simulating the Redirections'
simulated_d__redirections = 'Simulated %d Redirections in the Model'
simulating__migrations = 'Simulating the Migrations'
simulated_d__migrations = 'Simulated %d Migrations in the Model'
adjusting__instances__demands = 'Adjusting the Instances and Demands to the selected changes'
adjusting__model = "Adjusting the Model's Graph to reflect the simulated Instances"
running__demands = 'Running the simulated Demands'
deleted__redirections = 'Deleted the previous Redirections'
executing_d__migrations = 'Executing %d Migrations'
executing_d__instantiations = 'Executing %d Instantiations'
migrating_v_cdn_s_from_pop_s_to_pop_s = "Migrating vCDN '%s' from POP '%s' to POP '%s'"
migrating__server_s_v_cdn_s_pop_s = "Migrating Server '%s' of vCDN '%s 'from POP '%s'"
unable__thread = 'Unable to create Thread for the operation'
no_instance_forv_cdn = 'There are no Instances of the vCDN to clone'
no_instance_forv_cdn_s = "There are no Instances of vCDN '%s' to clone from"
created__snapshot__server_s_pop_s = "Created an Snapshot of Server '%s' in POP '%s'"
created__server_s_v_cdn_s_pop_s = "Created server '%s' of vCDN '%s' in POP '%s' "
deleted__server_s_v_cdn_s_pop_s = "Deleted server '%s' of vCDN '%s' in POP '%s' "
quota_limit = 'Servers quota full, not allowed to start more servers.'
not_deleted__server_s_v_cdn_s_pop_s = "Server '%s' of vCDN '%s' in POP '%s' was not deleted after Migration "
not_resumed__server_s_pop_s = "Server '%s' in POP '%s' was not resumed after snapshpt "
downloaded_image_file_s = "Downloaded the IMG file in '%s' "
uploaded_image_file_s = "Uploaded the IMG file in '%s' "
exception__cloning__server_s_pop_s_pop_s = "Exception occured when cloning server '%s' from POP '%s' to POP '%s'"
error_migrating = 'Unable to gather Migrations Information to execute'
error_instantiating = 'Unable to gather Instantiation Information to execute'
invalid__qo_e__value = 'Invalid QoE value'
invalid__qo_e__model = 'Invalid QoE model'
qo_e_out_of_model = 'The QoE value is out of the Model boundaries'
updating__demand_bw__qo_e_f = 'Updating the Demands BW to match a QoE = %f '
updating__demand_bw_x_f = 'Updating the Demands BW by a factor of %f '
updated__demand_bw = 'Updated the Demands BW '
building__model = 'Building a new Model'
added__node_s = 'Added node %s '
added__link_s_to_s_of_d = 'Added link from %s to %s, %d Mbps'
added__pop_s_in_s = 'Added pop %s to node %s'
added__client_s_in_s = 'Added clientGroup %s to node %s'
draw__file_s = 'Graph drawn to file %s'
client_s_requests_s_from_s_bw_d = 'Demand from ClientGroup at %s requesting vCDN %s from Pop %s with BW %d'
migration_to_pop_s = 'Migration to Pop %s'
neede_bw_d_more__link_bw_d = 'The needed BW %d Mbps is more than the available link %d Mbps'
built__model_d_locations_d_links = 'A new model was built with %d locations and %d links '
added_d_po_ps = 'Added %d POPs to the Model'
added_d__clients = 'Added %d ClientGroups to the Model'
random_graph_locations_d_max_capa_d = 'Creating random Graph for %d locations with maxCapacity=%d '
random_graph_locations_d = 'Created random Graph of %d nodes'
migration_condition_bw_needed_d__gomuri_cap_d__pop_cap__pop_can_host_s = 'Migration condition: DemandedBW=%d LinkBW=%d PopBW=%d PopCanHost=%s'
shortest_path_s = "The SPT for this demand is '%s' "
migrate_v_cdn_s_src_pop_s_dst_pop_s = "Migrate vCDN '%s' from POP '%s' to POP '%s' "
migrate_v_cdn_s_src_pop_s_dst_pop_s__redirection_bw = "Migrating vCDN '%s' from POP '%s' to POP '%s' would cause Redirections that saturate the link "
hmac_optimized_d_migrations_d_invalid_demands = 'HMAC optimization determined %d migrations and %d invalid demands'
client_location_s_requests_s_from_s__total_bw_f = "Clients located in '%s' request vCDN '%s' from POP '%s', needing %.2f Mbps of BW"
migration_path_d__hops_f_bw = 'Migration path of %d hops and %.2f Mbps minimal BW'
migration__condition__hold_b__net_capacity_d__mbps = 'The Migration was rejected because HoldvCDN = %s and Remaining BW in POP is %d Mbps'
scale__condition__net_capacity_d__mbps = 'The Scaling was rejected because Remaining BW in POP is %d Mbps'
migration_check__pop_src_s__pop_dts_s = "Checking possible migration from POP '%s' to POP '%s'"
graph__topologie__consume__demands = 'Consuming a Topologie Graph with a set of demands'
graph__capacity__consume__demands = 'Consuming a Capacity Graph with a set of demands'
graph__consume_d__demands = 'Consumed %d Demands from the Graph'
exception__consuming__demand_d__graph = 'Exception while consuming Demand %d on a Topologie Graph'
exception__removing__demand_d__graph = 'Exception while returning Demand %d on a Topologie Graph'
exception__migrating_v_cdn_s__pop_src_s__pop_dts_s = "Exception occured while calculating migration of vCDN '%s' from POP '%s' to POP '%s'"
redirect__demand__client_s_v_cdn_s_src_pop_s_dst_pop_s = "Scale-out and redirect Demands of clientGroup '%s' for vCDN '%s' from POP '%s' to POP '%s'"
demand_id_d_is_valid = 'Demand %d has a valid Instace, unable to simulate an Instantiation'
redirect_d_invalid = 'Redirect %d is invalid; could be a Migration'
errors_simulating = 'Some error occured while executing the simulation'
removing__simulated__redirects = 'Removing the Demands from the previous path before redirection'
consuming__simulated__redirects = 'Adding the Demands on the simulated path after redirection'
exception__consuming__fake__demand = 'Exception occured while Consuming a simulated Demand'
client_location_s_requests_from_s__total_bw_f = "Consuming fake Demand of ClientGroup at '%s' to POP '%s' with BW '%.2f'"
deleted__fake__instace_pop_s_v_cdn_s = "Deleting Fake Instance in POP '%s' of vCDN '%s'"
added__fake__instace_pop_s_v_cdn_s = "Adding Fake Instance in POP '%s' of vCDN '%s'"
update__fake__demand_from_pop_s_to_pop_s = "Update of Demand from POP '%s' to POP '%s'"
unable__write__file_s = "Unable to write the file '%s'"
omac_dat_s = "OMAC .dat file was created in '%s'"
auth_os_url_s_user_s_tenant_s = "Authenticating to URL %s as User '%s' of Tenant '%s'"
auth_os_region_s = "Authenticating to Region '%s'"
exception__nova_url_s_region_s_user_s_tenant_s = "Unable to authenticate to Nova Service via URL %s in Region '%s' as User '%s' of Tenant '%s'"
exception__ceilometer_url_s_region_s_user_s_tenant_s = "Unable to authenticate to Ceilometer Service via URL %s in Region '%s' as User '%s' of Tenant '%s'"
exception__glance_url_s_region_s_user_s_tenant_s = "Unable to authenticate to Glance Service via URL %s in Region '%s' as User '%s' of Tenant '%s'"
last_sample_s_at_s = "Last sample of meter '%s' at '%s' "
collect_samples_s_since_s = "Collecting stats of meter '%s' since '%s' "
meter__stats_min_d_max_d_avg_d = 'Values collected are: Min=%d Max=%d Avg=%d '
no_metrics__meter_s = "No Metric collected for meter '%s' "
authenticated = 'Authenticated'
migrating__instance_v_cdn_s_pop_s_pop_s = 'Migrating Instance of vCDN %s from POP %s to POP %s'
instantiating__instance_v_cdn_s_pop_s = 'Instantiating vCDN %s on POP %s'
instantiation_ended__instance_v_cdn_s_pop_s = 'Instantiation of vCDN %s on POP %s has finished'
migration_ended__instance_v_cdn_s_pop_s_pop_s = 'Migration of vCDN %s from POP %s to POP %s has finished'
exception__migrating__server_s_pop_s_pop_s = 'Exception occured while migrating a Server Id %s from POP %s to POP %s'
no_connect__pops = 'Unable to connect to the POPs to perform the Migration'
no_download__img_file_s = 'Unable to download the image file %s'
no_upload__img_file_s = 'Unable to upload the image file %s'
no_writable_s = 'The location %s is not writable'
no_server_created_v_cdn_s_pop_s = "Unable to start a new Server in POP '%s' for vCDN '%s'"
invalid__server__parameters_s = 'Invalid parameters for creating a Server: %s'
server_id_s__not_found = "Unable to find a server with id = '%s'"
image_id_s__not_found = "Unable to find an image with id = '%s'"
|
class Memorability_Prediction:
def mem_calculation(frame1):
#print ("Inside mem_calculation function")
start_time1 = time.time()
resized_image = caffe.io.resize_image(frame1,[227,227])
net1.blobs['data'].data[...] = transformer1.preprocess('data', resized_image)
value = net1.forward()
value = value['fc8-euclidean']
end_time1 = time.time()
execution_time1 = end_time1 - start_time1
#print ("*********** \t Execution Time in Memobarility = ", execution_time1, " secs \t***********")
return value[0][0]
|
class Memorability_Prediction:
def mem_calculation(frame1):
start_time1 = time.time()
resized_image = caffe.io.resize_image(frame1, [227, 227])
net1.blobs['data'].data[...] = transformer1.preprocess('data', resized_image)
value = net1.forward()
value = value['fc8-euclidean']
end_time1 = time.time()
execution_time1 = end_time1 - start_time1
return value[0][0]
|
#
# PySNMP MIB module ZYXEL-OAM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-OAM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:45:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint")
ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex")
EnabledStatus, = mibBuilder.importSymbols("P-BRIDGE-MIB", "EnabledStatus")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
ModuleIdentity, NotificationType, Counter64, TimeTicks, iso, Counter32, Gauge32, ObjectIdentity, IpAddress, MibIdentifier, Unsigned32, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "NotificationType", "Counter64", "TimeTicks", "iso", "Counter32", "Gauge32", "ObjectIdentity", "IpAddress", "MibIdentifier", "Unsigned32", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
esMgmt, = mibBuilder.importSymbols("ZYXEL-ES-SMI", "esMgmt")
zyxelOam = ModuleIdentity((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56))
if mibBuilder.loadTexts: zyxelOam.setLastUpdated('201207010000Z')
if mibBuilder.loadTexts: zyxelOam.setOrganization('Enterprise Solution ZyXEL')
zyxelOamSetup = MibIdentifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1))
zyOamState = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 1), EnabledStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: zyOamState.setStatus('current')
zyxelOamPortTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 2), )
if mibBuilder.loadTexts: zyxelOamPortTable.setStatus('current')
zyxelOamPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: zyxelOamPortEntry.setStatus('current')
zyOamPortFunctionsSupported = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 2, 1, 1), Bits().clone(namedValues=NamedValues(("unidirectionalSupport", 0), ("loopbackSupport", 1), ("eventSupport", 2), ("variableSupport", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: zyOamPortFunctionsSupported.setStatus('current')
mibBuilder.exportSymbols("ZYXEL-OAM-MIB", zyxelOam=zyxelOam, zyOamState=zyOamState, PYSNMP_MODULE_ID=zyxelOam, zyxelOamPortEntry=zyxelOamPortEntry, zyxelOamSetup=zyxelOamSetup, zyxelOamPortTable=zyxelOamPortTable, zyOamPortFunctionsSupported=zyOamPortFunctionsSupported)
|
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, constraints_intersection, single_value_constraint, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint')
(if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex')
(enabled_status,) = mibBuilder.importSymbols('P-BRIDGE-MIB', 'EnabledStatus')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(module_identity, notification_type, counter64, time_ticks, iso, counter32, gauge32, object_identity, ip_address, mib_identifier, unsigned32, integer32, mib_scalar, mib_table, mib_table_row, mib_table_column, bits) = mibBuilder.importSymbols('SNMPv2-SMI', 'ModuleIdentity', 'NotificationType', 'Counter64', 'TimeTicks', 'iso', 'Counter32', 'Gauge32', 'ObjectIdentity', 'IpAddress', 'MibIdentifier', 'Unsigned32', 'Integer32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Bits')
(display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention')
(es_mgmt,) = mibBuilder.importSymbols('ZYXEL-ES-SMI', 'esMgmt')
zyxel_oam = module_identity((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56))
if mibBuilder.loadTexts:
zyxelOam.setLastUpdated('201207010000Z')
if mibBuilder.loadTexts:
zyxelOam.setOrganization('Enterprise Solution ZyXEL')
zyxel_oam_setup = mib_identifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1))
zy_oam_state = mib_scalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 1), enabled_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
zyOamState.setStatus('current')
zyxel_oam_port_table = mib_table((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 2))
if mibBuilder.loadTexts:
zyxelOamPortTable.setStatus('current')
zyxel_oam_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 2, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'))
if mibBuilder.loadTexts:
zyxelOamPortEntry.setStatus('current')
zy_oam_port_functions_supported = mib_table_column((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 56, 1, 2, 1, 1), bits().clone(namedValues=named_values(('unidirectionalSupport', 0), ('loopbackSupport', 1), ('eventSupport', 2), ('variableSupport', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
zyOamPortFunctionsSupported.setStatus('current')
mibBuilder.exportSymbols('ZYXEL-OAM-MIB', zyxelOam=zyxelOam, zyOamState=zyOamState, PYSNMP_MODULE_ID=zyxelOam, zyxelOamPortEntry=zyxelOamPortEntry, zyxelOamSetup=zyxelOamSetup, zyxelOamPortTable=zyxelOamPortTable, zyOamPortFunctionsSupported=zyOamPortFunctionsSupported)
|
def to_xyz(self):
"""Performs the corrdinate change and stores the resulting field in a VectorField object.
Parameters
----------
self : VectorField
a VectorField object
Returns
-------
a VectorField object
"""
# Dynamic import to avoid loop
module = __import__("SciDataTool.Classes.VectorField", fromlist=["VectorField"])
VectorField = getattr(module, "VectorField")
if "comp_x" in self.components or "comp_y" in self.components:
return self.copy()
else:
# Coordinate transform
arg_list = [
axis.name
if axis.name in ["freqs", "wavenumber"]
else axis.name + "[smallestperiod]"
for axis in self.components["radial"].axes
]
result = self.get_xyz_along(*arg_list, is_squeeze=False)
# Store in new VectorField
comp_dict = dict()
Comp_x = self.components["radial"].copy()
Comp_x.name = (
self.components["radial"].name.lower().replace("radial ", "")
+ " along x-axis"
)
Comp_x.symbol = self.components["radial"].symbol.replace("_r", "_x")
Comp_x.values = result["comp_x"]
comp_dict["comp_x"] = Comp_x
Comp_y = self.components["radial"].copy()
Comp_y.name = (
self.components["radial"].name.lower().replace("radial ", "")
+ " along y-axis"
)
Comp_y.symbol = self.components["radial"].symbol.replace("_r", "_y")
Comp_y.values = result["comp_y"]
comp_dict["comp_y"] = Comp_y
if "axial" in self.components:
Comp_z = self.components["axial"].copy()
comp_dict["comp_z"] = Comp_z
return VectorField(name=self.name, symbol=self.symbol, components=comp_dict)
|
def to_xyz(self):
"""Performs the corrdinate change and stores the resulting field in a VectorField object.
Parameters
----------
self : VectorField
a VectorField object
Returns
-------
a VectorField object
"""
module = __import__('SciDataTool.Classes.VectorField', fromlist=['VectorField'])
vector_field = getattr(module, 'VectorField')
if 'comp_x' in self.components or 'comp_y' in self.components:
return self.copy()
else:
arg_list = [axis.name if axis.name in ['freqs', 'wavenumber'] else axis.name + '[smallestperiod]' for axis in self.components['radial'].axes]
result = self.get_xyz_along(*arg_list, is_squeeze=False)
comp_dict = dict()
comp_x = self.components['radial'].copy()
Comp_x.name = self.components['radial'].name.lower().replace('radial ', '') + ' along x-axis'
Comp_x.symbol = self.components['radial'].symbol.replace('_r', '_x')
Comp_x.values = result['comp_x']
comp_dict['comp_x'] = Comp_x
comp_y = self.components['radial'].copy()
Comp_y.name = self.components['radial'].name.lower().replace('radial ', '') + ' along y-axis'
Comp_y.symbol = self.components['radial'].symbol.replace('_r', '_y')
Comp_y.values = result['comp_y']
comp_dict['comp_y'] = Comp_y
if 'axial' in self.components:
comp_z = self.components['axial'].copy()
comp_dict['comp_z'] = Comp_z
return vector_field(name=self.name, symbol=self.symbol, components=comp_dict)
|
class ToolVariables:
@classmethod
def ExcheckUpdate(cls):
cls.INTAG = "ExCheck"
return cls
|
class Toolvariables:
@classmethod
def excheck_update(cls):
cls.INTAG = 'ExCheck'
return cls
|
test = {
'name': 'q1_2',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> mean_based_estimator(np.array([1, 2, 3])) is not None
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> int(np.round(mean_based_estimator(np.array([1, 2, 3]))))
4
""",
'hidden': False,
'locked': False
}
],
'scored': True,
'setup': '',
'teardown': '',
'type': 'doctest'
}
]
}
|
test = {'name': 'q1_2', 'points': 1, 'suites': [{'cases': [{'code': '\n >>> mean_based_estimator(np.array([1, 2, 3])) is not None\n True\n ', 'hidden': False, 'locked': False}, {'code': '\n >>> int(np.round(mean_based_estimator(np.array([1, 2, 3]))))\n 4\n ', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest'}]}
|
class ScheduleItem:
def __init__(item, task):
item.task = task
item.start_time = None
item.end_time = None
item.child_start_time = None
item.pred_task = None
item.duration = task.duration
item.total_effort = None
item.who = ''
class Schedule:
def __init__(schedule, target, schedule_items, critical_path, items_by_resource):
schedule.target = target if isinstance(target, ScheduleItem) else schedule_items[target.__qualname__]
schedule.items = schedule_items
schedule.critical_path = critical_path
schedule.items_by_resource = items_by_resource
schedule.duration = schedule.target.end_time
schedule.outdir = None
|
class Scheduleitem:
def __init__(item, task):
item.task = task
item.start_time = None
item.end_time = None
item.child_start_time = None
item.pred_task = None
item.duration = task.duration
item.total_effort = None
item.who = ''
class Schedule:
def __init__(schedule, target, schedule_items, critical_path, items_by_resource):
schedule.target = target if isinstance(target, ScheduleItem) else schedule_items[target.__qualname__]
schedule.items = schedule_items
schedule.critical_path = critical_path
schedule.items_by_resource = items_by_resource
schedule.duration = schedule.target.end_time
schedule.outdir = None
|
#%%
class Book:
def __init__(self,author,name,pageNum):
self.__author = author
self.__name = name
self.__pageNum = pageNum
def getAuthor(self):
return self.__author
def getName(self):
return self.__name
def getPageNum(self):
return self.__pageNum
def __str__(self):
return "Author is: " + self.__author + " book name: " + self.__name + " number of pages: " + str(self.__pageNum)
def __len__(self):
return self.__pageNum
def __del__(self):
print("The book {} has deleted!".format(self.__name))
x = Book("Jon Duckett","HTML & CSS",460)
print(x)
del x
#%%
|
class Book:
def __init__(self, author, name, pageNum):
self.__author = author
self.__name = name
self.__pageNum = pageNum
def get_author(self):
return self.__author
def get_name(self):
return self.__name
def get_page_num(self):
return self.__pageNum
def __str__(self):
return 'Author is: ' + self.__author + ' book name: ' + self.__name + ' number of pages: ' + str(self.__pageNum)
def __len__(self):
return self.__pageNum
def __del__(self):
print('The book {} has deleted!'.format(self.__name))
x = book('Jon Duckett', 'HTML & CSS', 460)
print(x)
del x
|
# ---------------------------------------------------------------------------------------------
# Copyright (c) Akash Nag. All rights reserved.
# Licensed under the MIT License. See LICENSE.md in the project root for license information.
# ---------------------------------------------------------------------------------------------
# This module implements the CursorPosition abstraction
class CursorPosition:
def __init__(self, y, x):
self.y = y
self.x = x
# returns a string representation of the cursor position for the user
def __str__(self):
return "(" + str(self.y+1) + "," + str(self.x+1) + ")"
# returns the string representation for internal use
def __repr__(self):
return "(" + str(self.y) + "," + str(self.x) + ")"
|
class Cursorposition:
def __init__(self, y, x):
self.y = y
self.x = x
def __str__(self):
return '(' + str(self.y + 1) + ',' + str(self.x + 1) + ')'
def __repr__(self):
return '(' + str(self.y) + ',' + str(self.x) + ')'
|
N = int(input())
M = int(input())
res = list()
for x in range(N, M+1):
cnt = 0
if x > 1:
for i in range(2, x):
if x % i == 0:
cnt += 1
break
if cnt == 0:
res.append(x)
if len(res) > 0:
print(sum(res))
print(min(res))
else:
print(-1)
|
n = int(input())
m = int(input())
res = list()
for x in range(N, M + 1):
cnt = 0
if x > 1:
for i in range(2, x):
if x % i == 0:
cnt += 1
break
if cnt == 0:
res.append(x)
if len(res) > 0:
print(sum(res))
print(min(res))
else:
print(-1)
|
# Application settings
# Flask settings
DEBUG = False
# Flask-restplus settings
RESTPLUS_MASK_SWAGGER = False
SWAGGER_UI_DOC_EXPANSION = 'none'
# API metadata
API_TITLE = 'MAX Breast Cancer Mitosis Detector'
API_DESC = 'Predict the probability of the input image containing mitosis.'
API_VERSION = '0.1'
# default model
MODEL_NAME = 'MAX Breast Cancer Mitosis Detector'
DEFAULT_MODEL_PATH = 'assets/deep_histopath_model.hdf5'
MODEL_LICENSE = "Custom" # TODO - what are we going to release this as?
MODEL_META_DATA = {
'id': '{}'.format(MODEL_NAME.lower()),
'name': '{} Keras Model'.format(MODEL_NAME),
'description': '{} Keras model trained on TUPAC16 data to detect mitosis'.format(MODEL_NAME),
'type': 'image_classification',
'license': '{}'.format(MODEL_LICENSE)
}
|
debug = False
restplus_mask_swagger = False
swagger_ui_doc_expansion = 'none'
api_title = 'MAX Breast Cancer Mitosis Detector'
api_desc = 'Predict the probability of the input image containing mitosis.'
api_version = '0.1'
model_name = 'MAX Breast Cancer Mitosis Detector'
default_model_path = 'assets/deep_histopath_model.hdf5'
model_license = 'Custom'
model_meta_data = {'id': '{}'.format(MODEL_NAME.lower()), 'name': '{} Keras Model'.format(MODEL_NAME), 'description': '{} Keras model trained on TUPAC16 data to detect mitosis'.format(MODEL_NAME), 'type': 'image_classification', 'license': '{}'.format(MODEL_LICENSE)}
|
#
# @lc app=leetcode id=1431 lang=python3
#
# [1431] Kids With the Greatest Number of Candies
#
# @lc code=start
class Solution:
def kidsWithCandies(self, candies: List[int], extra_candies: int) -> List[bool]:
max_candies = max(candies)
return [i + extra_candies >= max_candies for i in candies]
# @lc code=end
|
class Solution:
def kids_with_candies(self, candies: List[int], extra_candies: int) -> List[bool]:
max_candies = max(candies)
return [i + extra_candies >= max_candies for i in candies]
|
"""
This module contains all files for a django deployment 'site'.
When called via the manage.py command, this folder is used as regular django setup.
"""
|
"""
This module contains all files for a django deployment 'site'.
When called via the manage.py command, this folder is used as regular django setup.
"""
|
# -*- coding: utf-8 -*-
"""
This package implements various parameterisations of properties from the
litterature with relevance in chemistry.
"""
|
"""
This package implements various parameterisations of properties from the
litterature with relevance in chemistry.
"""
|
def repeated_n_times(nums):
# nums.length == 2 * n
n = len(nums) // 2
for num in nums:
if nums.count(num) == n:
return num
print(repeated_n_times([1, 2, 3, 3]))
print(repeated_n_times([2, 1, 2, 5, 3, 2]))
print(repeated_n_times([5, 1, 5, 2, 5, 3, 5, 4]))
|
def repeated_n_times(nums):
n = len(nums) // 2
for num in nums:
if nums.count(num) == n:
return num
print(repeated_n_times([1, 2, 3, 3]))
print(repeated_n_times([2, 1, 2, 5, 3, 2]))
print(repeated_n_times([5, 1, 5, 2, 5, 3, 5, 4]))
|
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
# See:
# https://docs.microsoft.com/en-us/windows/win32/eventlog/event-types
# https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-reporteventa#parameters
# https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-even/1ed850f9-a1fe-4567-a371-02683c6ed3cb
#
# However, event viewer & the C api do not show the constants from above, but rather return these:
# https://docs.microsoft.com/en-us/windows/win32/wes/eventmanifestschema-leveltype-complextype#remarks
EVENT_TYPES = {
'success': 4,
'error': 2,
'warning': 3,
'information': 4,
'success audit': 4,
'failure audit': 2,
}
|
event_types = {'success': 4, 'error': 2, 'warning': 3, 'information': 4, 'success audit': 4, 'failure audit': 2}
|
@outputSchema('vals: {(val:chararray)}')
def convert(the_input):
# This converts the indeterminate number of vals into a bag.
out = []
for map in the_input:
out.append(map)
return out
|
@output_schema('vals: {(val:chararray)}')
def convert(the_input):
out = []
for map in the_input:
out.append(map)
return out
|
"""Settings for depicting LaTex figures"""
class Figure:
"""Figure class for depicting HTML and LaTeX.
:param path:
The path to an image
:type path:
str
:param title:
The caption of the figure
:param title:
str
:param label:
The label of the label
:param label:
str
"""
def __init__(self, path: str, title: str, label: str) -> None:
self.path: str = path
self.title: str = title
self.label: str = label
def _repr_html_(self) -> str:
return f'<img src="{self.path}" height="264" width="391" />'
def _repr_latex_(self) -> str:
return '\n'.join((
r'\begin{figure}[H]',
r' \centering',
r' \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}'
f'{{{self.path}}}',
fr' \caption{{{self.title}}}\label{{fig:{self.label}}}',
r'\end{figure}',
))
|
"""Settings for depicting LaTex figures"""
class Figure:
"""Figure class for depicting HTML and LaTeX.
:param path:
The path to an image
:type path:
str
:param title:
The caption of the figure
:param title:
str
:param label:
The label of the label
:param label:
str
"""
def __init__(self, path: str, title: str, label: str) -> None:
self.path: str = path
self.title: str = title
self.label: str = label
def _repr_html_(self) -> str:
return f'<img src="{self.path}" height="264" width="391" />'
def _repr_latex_(self) -> str:
return '\n'.join(('\\begin{figure}[H]', ' \\centering', f' \\adjustimage{{max size={{0.9\\linewidth}}{{0.9\\paperheight}}}}{{{self.path}}}', f' \\caption{{{self.title}}}\\label{{fig:{self.label}}}', '\\end{figure}'))
|
class Solution:
def recurse(self, n, stack, cur_open) :
if n == 0 :
self.ans.append(stack+')'*cur_open)
return
for i in range(cur_open+1) :
self.recurse(n-1, stack+(')'*i)+'(', cur_open-i+1)
# @param A : integer
# @return a list of strings
def generateParenthesis(self, A):
if A <= 0 :
return []
self.ans = []
self.recurse(A, "", 0)
return self.ans
|
class Solution:
def recurse(self, n, stack, cur_open):
if n == 0:
self.ans.append(stack + ')' * cur_open)
return
for i in range(cur_open + 1):
self.recurse(n - 1, stack + ')' * i + '(', cur_open - i + 1)
def generate_parenthesis(self, A):
if A <= 0:
return []
self.ans = []
self.recurse(A, '', 0)
return self.ans
|
class Solution:
def rangeBitwiseAnd(self, left: int, right: int) -> int:
i = 0 # how many bit right shifted
while left != right:
left >>= 1
right >>= 1
i += 1
return left << i
# TESTS
for left, right, expected in [
(5, 7, 4),
(0, 1, 0),
(26, 30, 24),
]:
sol = Solution()
actual = sol.rangeBitwiseAnd(left, right)
print("Bitwise AND of all numbers in range", f"[{left}, {right}] ->", actual)
assert actual == expected
|
class Solution:
def range_bitwise_and(self, left: int, right: int) -> int:
i = 0
while left != right:
left >>= 1
right >>= 1
i += 1
return left << i
for (left, right, expected) in [(5, 7, 4), (0, 1, 0), (26, 30, 24)]:
sol = solution()
actual = sol.rangeBitwiseAnd(left, right)
print('Bitwise AND of all numbers in range', f'[{left}, {right}] ->', actual)
assert actual == expected
|
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"plot_sequence": "10_core_overview.ipynb",
"plot_sequence_1d": "10_core_overview.ipynb",
"get_alphabet": "11_core_elements.ipynb",
"get_element_counts": "11_core_elements.ipynb",
"get_first_positions": "11_core_elements.ipynb",
"get_element_frequency": "11_core_elements.ipynb",
"plot_element_counts": "11_core_elements.ipynb",
"get_subsequences": "12_core_subsequences.ipynb",
"get_ndistinct_subsequences": "12_core_subsequences.ipynb",
"get_unique_ngrams": "13_core_ngrams.ipynb",
"get_all_ngrams": "13_core_ngrams.ipynb",
"get_ngram_universe": "13_core_ngrams.ipynb",
"get_ngram_counts": "13_core_ngrams.ipynb",
"plot_ngram_counts": "13_core_ngrams.ipynb",
"get_transitions": "14_core_transitions.ipynb",
"get_ntransitions": "14_core_transitions.ipynb",
"get_transition_matrix": "14_core_transitions.ipynb",
"plot_transition_matrix": "14_core_transitions.ipynb",
"get_spells": "15_core_spells.ipynb",
"get_longest_spell": "15_core_spells.ipynb",
"get_spell_durations": "15_core_spells.ipynb",
"is_recurrent": "16_core_statistics.ipynb",
"get_entropy": "16_core_statistics.ipynb",
"get_turbulence": "16_core_statistics.ipynb",
"get_complexity": "16_core_statistics.ipynb",
"get_routine": "16_core_statistics.ipynb",
"plot_sequences": "20_multi_overview.ipynb",
"are_recurrent": "21_multi_attributes.ipynb",
"get_summary_statistic": "21_multi_attributes.ipynb",
"get_routine_scores": "21_multi_attributes.ipynb",
"get_synchrony": "21_multi_attributes.ipynb",
"get_sequence_frequencies": "21_multi_attributes.ipynb",
"get_motif": "22_multi_derivatives.ipynb",
"get_modal_state": "22_multi_derivatives.ipynb",
"get_optimal_distance": "23_multi_edit_distances.ipynb",
"get_levenshtein_distance": "23_multi_edit_distances.ipynb",
"get_hamming_distance": "23_multi_edit_distances.ipynb",
"get_combinatorial_distance": "24_multi_nonalignment.ipynb"}
modules = ["core/__init__.py",
"core/elements.py",
"core/subsequences.py",
"core/ngrams.py",
"core/transitions.py",
"core/spells.py",
"core/statistics.py",
"multi/__init__.py",
"multi/attributes.py",
"multi/derivatives.py",
"multi/editdistances.py",
"multi/nonalignment.py"]
doc_url = "https://pysan-dev.github.io/pysan/"
git_url = "https://github.com/pysan-dev/pysan/tree/master/"
def custom_doc_links(name): return None
|
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'plot_sequence': '10_core_overview.ipynb', 'plot_sequence_1d': '10_core_overview.ipynb', 'get_alphabet': '11_core_elements.ipynb', 'get_element_counts': '11_core_elements.ipynb', 'get_first_positions': '11_core_elements.ipynb', 'get_element_frequency': '11_core_elements.ipynb', 'plot_element_counts': '11_core_elements.ipynb', 'get_subsequences': '12_core_subsequences.ipynb', 'get_ndistinct_subsequences': '12_core_subsequences.ipynb', 'get_unique_ngrams': '13_core_ngrams.ipynb', 'get_all_ngrams': '13_core_ngrams.ipynb', 'get_ngram_universe': '13_core_ngrams.ipynb', 'get_ngram_counts': '13_core_ngrams.ipynb', 'plot_ngram_counts': '13_core_ngrams.ipynb', 'get_transitions': '14_core_transitions.ipynb', 'get_ntransitions': '14_core_transitions.ipynb', 'get_transition_matrix': '14_core_transitions.ipynb', 'plot_transition_matrix': '14_core_transitions.ipynb', 'get_spells': '15_core_spells.ipynb', 'get_longest_spell': '15_core_spells.ipynb', 'get_spell_durations': '15_core_spells.ipynb', 'is_recurrent': '16_core_statistics.ipynb', 'get_entropy': '16_core_statistics.ipynb', 'get_turbulence': '16_core_statistics.ipynb', 'get_complexity': '16_core_statistics.ipynb', 'get_routine': '16_core_statistics.ipynb', 'plot_sequences': '20_multi_overview.ipynb', 'are_recurrent': '21_multi_attributes.ipynb', 'get_summary_statistic': '21_multi_attributes.ipynb', 'get_routine_scores': '21_multi_attributes.ipynb', 'get_synchrony': '21_multi_attributes.ipynb', 'get_sequence_frequencies': '21_multi_attributes.ipynb', 'get_motif': '22_multi_derivatives.ipynb', 'get_modal_state': '22_multi_derivatives.ipynb', 'get_optimal_distance': '23_multi_edit_distances.ipynb', 'get_levenshtein_distance': '23_multi_edit_distances.ipynb', 'get_hamming_distance': '23_multi_edit_distances.ipynb', 'get_combinatorial_distance': '24_multi_nonalignment.ipynb'}
modules = ['core/__init__.py', 'core/elements.py', 'core/subsequences.py', 'core/ngrams.py', 'core/transitions.py', 'core/spells.py', 'core/statistics.py', 'multi/__init__.py', 'multi/attributes.py', 'multi/derivatives.py', 'multi/editdistances.py', 'multi/nonalignment.py']
doc_url = 'https://pysan-dev.github.io/pysan/'
git_url = 'https://github.com/pysan-dev/pysan/tree/master/'
def custom_doc_links(name):
return None
|
print("Challenges 38: WAF program to print the number of prime numbers which are less than or equal to a given integer.")
n = 7
nums = range(2, n+1)
num_of_divisors = 0
counter = 0
for x in nums:
for i in range(1, x+1):
if x % i == 0:
num_of_divisors += 1
if num_of_divisors == 2:
counter += 1
num_of_divisors = 0
print(counter)
|
print('Challenges 38: WAF program to print the number of prime numbers which are less than or equal to a given integer.')
n = 7
nums = range(2, n + 1)
num_of_divisors = 0
counter = 0
for x in nums:
for i in range(1, x + 1):
if x % i == 0:
num_of_divisors += 1
if num_of_divisors == 2:
counter += 1
num_of_divisors = 0
print(counter)
|
def n_to_triangularno_stevilo(n):
stevilo = 0
a = 1
for i in range(n):
stevilo += a
a += 1
return stevilo
def prvo_triangularno_stevilo_Z_vec_kot_k_delitelji(k):
j = 0
n = 0
stevilo_deliteljev = 0
while stevilo_deliteljev <= k:
stevilo_deliteljev = 0
j += 1
n = n_to_triangularno_stevilo(j)
i = 1
while i <= n**0.5:
if n % i == 0:
stevilo_deliteljev += 1
i += 1
stevilo_deliteljev *= 2
return n
print(prvo_triangularno_stevilo_Z_vec_kot_k_delitelji(500))
|
def n_to_triangularno_stevilo(n):
stevilo = 0
a = 1
for i in range(n):
stevilo += a
a += 1
return stevilo
def prvo_triangularno_stevilo_z_vec_kot_k_delitelji(k):
j = 0
n = 0
stevilo_deliteljev = 0
while stevilo_deliteljev <= k:
stevilo_deliteljev = 0
j += 1
n = n_to_triangularno_stevilo(j)
i = 1
while i <= n ** 0.5:
if n % i == 0:
stevilo_deliteljev += 1
i += 1
stevilo_deliteljev *= 2
return n
print(prvo_triangularno_stevilo_z_vec_kot_k_delitelji(500))
|
# mock.py
# Test tools for mocking and patching.
# Copyright (C) 2007 Michael Foord
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# mock 0.3.1
# http://www.voidspace.org.uk/python/mock.html
# Released subject to the BSD License
# Please see http://www.voidspace.org.uk/python/license.shtml
# Scripts maintained at http://www.voidspace.org.uk/python/index.shtml
# Comments, suggestions and bug reports welcome.
__all__ = (
'Mock',
'patch',
'sentinel',
'__version__'
)
__version__ = '0.3.1'
class Mock(object):
def __init__(self, methods=None, spec=None, name=None, parent=None):
self._parent = parent
self._name = name
if spec is not None and methods is None:
methods = [member for member in dir(spec) if not
(member.startswith('__') and member.endswith('__'))]
self._methods = methods
self.reset()
def reset(self):
self.called = False
self.return_value = None
self.call_args = None
self.call_count = 0
self.call_args_list = []
self.method_calls = []
self._children = {}
def __call__(self, *args, **keywargs):
self.called = True
self.call_count += 1
self.call_args = (args, keywargs)
self.call_args_list.append((args, keywargs))
parent = self._parent
name = self._name
while parent is not None:
parent.method_calls.append((name, args, keywargs))
if parent._parent is None:
break
name = parent._name + '.' + name
parent = parent._parent
return self.return_value
def __getattr__(self, name):
if self._methods is not None and name not in self._methods:
raise AttributeError("object has no attribute '%s'" % name)
if name not in self._children:
self._children[name] = Mock(parent=self, name=name)
return self._children[name]
def _importer(name):
mod = __import__(name)
components = name.split('.')
for comp in components[1:]:
mod = getattr(mod, comp)
return mod
def patch(target, attribute, new=None):
if isinstance(target, basestring):
target = _importer(target)
def patcher(func):
original = getattr(target, attribute)
if hasattr(func, 'restore_list'):
func.restore_list.append((target, attribute, original))
func.patch_list.append((target, attribute, new))
return func
func.restore_list = [(target, attribute, original)]
func.patch_list = [(target, attribute, new)]
def patched(*args, **keywargs):
for target, attribute, new in func.patch_list:
if new is None:
new = Mock()
args += (new,)
setattr(target, attribute, new)
try:
return func(*args, **keywargs)
finally:
for target, attribute, original in func.restore_list:
setattr(target, attribute, original)
patched.__name__ = func.__name__
return patched
return patcher
class SentinelObject(object):
def __init__(self, name):
self.name = name
def __repr__(self):
return '<SentinelObject "%s">' % self.name
class Sentinel(object):
def __init__(self):
self._sentinels = {}
def __getattr__(self, name):
return self._sentinels.setdefault(name, SentinelObject(name))
sentinel = Sentinel()
|
__all__ = ('Mock', 'patch', 'sentinel', '__version__')
__version__ = '0.3.1'
class Mock(object):
def __init__(self, methods=None, spec=None, name=None, parent=None):
self._parent = parent
self._name = name
if spec is not None and methods is None:
methods = [member for member in dir(spec) if not (member.startswith('__') and member.endswith('__'))]
self._methods = methods
self.reset()
def reset(self):
self.called = False
self.return_value = None
self.call_args = None
self.call_count = 0
self.call_args_list = []
self.method_calls = []
self._children = {}
def __call__(self, *args, **keywargs):
self.called = True
self.call_count += 1
self.call_args = (args, keywargs)
self.call_args_list.append((args, keywargs))
parent = self._parent
name = self._name
while parent is not None:
parent.method_calls.append((name, args, keywargs))
if parent._parent is None:
break
name = parent._name + '.' + name
parent = parent._parent
return self.return_value
def __getattr__(self, name):
if self._methods is not None and name not in self._methods:
raise attribute_error("object has no attribute '%s'" % name)
if name not in self._children:
self._children[name] = mock(parent=self, name=name)
return self._children[name]
def _importer(name):
mod = __import__(name)
components = name.split('.')
for comp in components[1:]:
mod = getattr(mod, comp)
return mod
def patch(target, attribute, new=None):
if isinstance(target, basestring):
target = _importer(target)
def patcher(func):
original = getattr(target, attribute)
if hasattr(func, 'restore_list'):
func.restore_list.append((target, attribute, original))
func.patch_list.append((target, attribute, new))
return func
func.restore_list = [(target, attribute, original)]
func.patch_list = [(target, attribute, new)]
def patched(*args, **keywargs):
for (target, attribute, new) in func.patch_list:
if new is None:
new = mock()
args += (new,)
setattr(target, attribute, new)
try:
return func(*args, **keywargs)
finally:
for (target, attribute, original) in func.restore_list:
setattr(target, attribute, original)
patched.__name__ = func.__name__
return patched
return patcher
class Sentinelobject(object):
def __init__(self, name):
self.name = name
def __repr__(self):
return '<SentinelObject "%s">' % self.name
class Sentinel(object):
def __init__(self):
self._sentinels = {}
def __getattr__(self, name):
return self._sentinels.setdefault(name, sentinel_object(name))
sentinel = sentinel()
|
"""Decorators used for adding functionality to the library."""
def downcast_field(property_name, default_value = None):
"""A decorator function for handling downcasting."""
def store_downcast_field_value(class_reference):
"""Store the key map."""
setattr(class_reference, "__deserialize_downcast_field__", property_name)
setattr(class_reference, "__deserialize_downcast_field_default_value__", default_value)
return class_reference
return store_downcast_field_value
def _get_downcast_field(class_reference):
"""Get the downcast field name if set, None otherwise."""
return getattr(class_reference, "__deserialize_downcast_field__", None)
def _get_downcast_field_default_value(class_reference):
"""Get the defualt value used for downcast field, None by default."""
return getattr(class_reference, "__deserialize_downcast_field_default_value__", None)
def downcast_identifier(super_class, identifier):
"""A decorator function for storing downcast identifiers."""
def store_key_map(class_reference):
"""Store the downcast map."""
if not hasattr(super_class, "__deserialize_downcast_map__"):
setattr(super_class, "__deserialize_downcast_map__", {})
super_class.__deserialize_downcast_map__[identifier] = class_reference
return class_reference
return store_key_map
def _get_downcast_class(super_class, identifier):
"""Get the downcast identifier for the given class and super class, returning None if not set"""
if not hasattr(super_class, "__deserialize_downcast_map__"):
return None
return super_class.__deserialize_downcast_map__.get(identifier)
def allow_downcast_fallback():
"""A decorator function for setting that downcast fallback to dicts is allowed."""
def store(class_reference):
"""Store the allowance flag."""
setattr(class_reference, "__deserialize_downcast_allow_fallback__", True)
return class_reference
return store
def _allows_downcast_fallback(super_class):
"""Get the whether downcast can fallback to a dict or not"""
return getattr(super_class, "__deserialize_downcast_allow_fallback__", False)
def downcast_proxy(source_property, target_property):
"""A decorator function for setting up a downcasting proxy, source_property will be used as downcast_field for target_property."""
def store_downcast_proxy(class_reference):
"""Create downcast proxy mapping and add the properties mapping to it."""
if not hasattr(class_reference, "__deserialize_downcast_proxy_map__"):
setattr(class_reference, "__deserialize_downcast_proxy_map__", {})
class_reference.__deserialize_downcast_proxy_map__[target_property] = source_property
return store_downcast_proxy
def _get_downcast_proxy(class_reference, property):
"""Get downcast proxy for property in class_reference, None if not set."""
if not hasattr(class_reference, "__deserialize_downcast_proxy_map__"):
return None
return class_reference.__deserialize_downcast_proxy_map__.get(property, None)
|
"""Decorators used for adding functionality to the library."""
def downcast_field(property_name, default_value=None):
"""A decorator function for handling downcasting."""
def store_downcast_field_value(class_reference):
"""Store the key map."""
setattr(class_reference, '__deserialize_downcast_field__', property_name)
setattr(class_reference, '__deserialize_downcast_field_default_value__', default_value)
return class_reference
return store_downcast_field_value
def _get_downcast_field(class_reference):
"""Get the downcast field name if set, None otherwise."""
return getattr(class_reference, '__deserialize_downcast_field__', None)
def _get_downcast_field_default_value(class_reference):
"""Get the defualt value used for downcast field, None by default."""
return getattr(class_reference, '__deserialize_downcast_field_default_value__', None)
def downcast_identifier(super_class, identifier):
"""A decorator function for storing downcast identifiers."""
def store_key_map(class_reference):
"""Store the downcast map."""
if not hasattr(super_class, '__deserialize_downcast_map__'):
setattr(super_class, '__deserialize_downcast_map__', {})
super_class.__deserialize_downcast_map__[identifier] = class_reference
return class_reference
return store_key_map
def _get_downcast_class(super_class, identifier):
"""Get the downcast identifier for the given class and super class, returning None if not set"""
if not hasattr(super_class, '__deserialize_downcast_map__'):
return None
return super_class.__deserialize_downcast_map__.get(identifier)
def allow_downcast_fallback():
"""A decorator function for setting that downcast fallback to dicts is allowed."""
def store(class_reference):
"""Store the allowance flag."""
setattr(class_reference, '__deserialize_downcast_allow_fallback__', True)
return class_reference
return store
def _allows_downcast_fallback(super_class):
"""Get the whether downcast can fallback to a dict or not"""
return getattr(super_class, '__deserialize_downcast_allow_fallback__', False)
def downcast_proxy(source_property, target_property):
"""A decorator function for setting up a downcasting proxy, source_property will be used as downcast_field for target_property."""
def store_downcast_proxy(class_reference):
"""Create downcast proxy mapping and add the properties mapping to it."""
if not hasattr(class_reference, '__deserialize_downcast_proxy_map__'):
setattr(class_reference, '__deserialize_downcast_proxy_map__', {})
class_reference.__deserialize_downcast_proxy_map__[target_property] = source_property
return store_downcast_proxy
def _get_downcast_proxy(class_reference, property):
"""Get downcast proxy for property in class_reference, None if not set."""
if not hasattr(class_reference, '__deserialize_downcast_proxy_map__'):
return None
return class_reference.__deserialize_downcast_proxy_map__.get(property, None)
|
a = 10
def f():
global a
a = 100
def ober():
b = 100
def unter():
nonlocal b
b = 1000
def unterunter():
nonlocal b
b = 10000
unterunter()
unter()
print(b)
ober()
def xyz(x):
return x * x
z = lambda x: x * x
print(z(3))
myList = [10,20,30,40,50]
def s(x):
return -x
myList = sorted(myList,key= lambda x:-x)
print(myList)
|
a = 10
def f():
global a
a = 100
def ober():
b = 100
def unter():
nonlocal b
b = 1000
def unterunter():
nonlocal b
b = 10000
unterunter()
unter()
print(b)
ober()
def xyz(x):
return x * x
z = lambda x: x * x
print(z(3))
my_list = [10, 20, 30, 40, 50]
def s(x):
return -x
my_list = sorted(myList, key=lambda x: -x)
print(myList)
|
# Responsible for giving targets to the Quadrocopter control lopp
class HighLevelLogic:
def __init__(self, control_loop, state_provider):
self.controllers
self.flightmode = FlightModeLanded()
self.control_loop = control_loop
state_provider.registerListener(self)
# Tells all systems that time has passed.
# timeDelta is the time since the last update call in seconds
def update(self, timedelta):
# check if we need to change the flight mode
newmode = self.flightmode.update(timedelta)
if newmode.name != self.flightmode.name:
print("HighLevelLogic: changing FlightMode from %s to %s" % (self.flightmode.name, newmode.name))
self.flightmode = newmode
# TODO: do we need to update the control loop?
# will be called by State Provider whenever a new sensor reading is ready
# timeDelta is the time since the last newState call in seconds
def new_sensor_reading(self, timedelta, state):
target_state = self.flightmode.calculate_target_state(state)
self.control_loop.setTargetState(target_state)
class FlightMode:
def __init__(self):
self.timeInState = 0
def update(self, time_delta):
self.timeInState += time_delta
return self._update(time_delta)
class FlightModeLanded(FlightMode):
def __init__(self):
self.name = "FlightModeLanded"
def _update(self, timedelta):
if self.timeInState > 2.0:
return FlightModeRiseTo1m()
return self
def calculate_target_state(self, current_state):
# no need to react to anything
return self
class FlightModeRiseTo1m(FlightMode):
def __init__(self):
# TODO: start motors
self.name = "FlightModeRiseTo1m"
def _update(self, timedelta):
if self.timeInState > 3.0:
return FlightModeHover()
return self
def calculate_target_state(self, current_state):
# no need to react to anything
return self
class FlightModeHover(FlightMode):
def __init__(self):
self.name = "FlightModeHover"
def _update(self, timedelta):
if self.timeInState > 5.0:
return FlightModeGoDown()
return self
def calculate_target_state(self, current_state):
# no need to react to anything
return self
class FlightModeGoDown(FlightMode):
def __init__(self):
self.name = "FlightModeGoDown"
def _update(self, timedelta):
if self.timeInState > 7.0:
return FlightModeLanded()
return self
def calculate_target_state(self, current_state):
# no need to react to anything
return self
|
class Highlevellogic:
def __init__(self, control_loop, state_provider):
self.controllers
self.flightmode = flight_mode_landed()
self.control_loop = control_loop
state_provider.registerListener(self)
def update(self, timedelta):
newmode = self.flightmode.update(timedelta)
if newmode.name != self.flightmode.name:
print('HighLevelLogic: changing FlightMode from %s to %s' % (self.flightmode.name, newmode.name))
self.flightmode = newmode
def new_sensor_reading(self, timedelta, state):
target_state = self.flightmode.calculate_target_state(state)
self.control_loop.setTargetState(target_state)
class Flightmode:
def __init__(self):
self.timeInState = 0
def update(self, time_delta):
self.timeInState += time_delta
return self._update(time_delta)
class Flightmodelanded(FlightMode):
def __init__(self):
self.name = 'FlightModeLanded'
def _update(self, timedelta):
if self.timeInState > 2.0:
return flight_mode_rise_to1m()
return self
def calculate_target_state(self, current_state):
return self
class Flightmoderiseto1M(FlightMode):
def __init__(self):
self.name = 'FlightModeRiseTo1m'
def _update(self, timedelta):
if self.timeInState > 3.0:
return flight_mode_hover()
return self
def calculate_target_state(self, current_state):
return self
class Flightmodehover(FlightMode):
def __init__(self):
self.name = 'FlightModeHover'
def _update(self, timedelta):
if self.timeInState > 5.0:
return flight_mode_go_down()
return self
def calculate_target_state(self, current_state):
return self
class Flightmodegodown(FlightMode):
def __init__(self):
self.name = 'FlightModeGoDown'
def _update(self, timedelta):
if self.timeInState > 7.0:
return flight_mode_landed()
return self
def calculate_target_state(self, current_state):
return self
|
keyb = '`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;\'ZXCVBNM,./'
while True:
try:
frase = input()
decod = ''
for c in frase:
if c == ' ':
decod += c
else:
decod += keyb[keyb.index(c)-1]
print(decod)
except EOFError:
break
|
keyb = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./"
while True:
try:
frase = input()
decod = ''
for c in frase:
if c == ' ':
decod += c
else:
decod += keyb[keyb.index(c) - 1]
print(decod)
except EOFError:
break
|
outputs = []
## Test Constructor
output = """PROFILING Command: ['./testConstructor ']
PrecisionTuner: MODE PROFILING
PrecisionTuner: MODE PROFILING
"""
outputs.append(output)
output = """Error no callstacks\n"""
outputs.append(output)
output = """Strategy Command: ['./testConstructor ']
Strategy: 1, STEP reached: NoOccurence
No more strategy to test.\n"""
outputs.append(output)
## Test Exp
output = """PROFILING Command: ['./testExp ']
PrecisionTuner: MODE PROFILING
SUCCESS: 23.1039\n\n"""
outputs.append(output)
output = """No more strategy to generate.
"""
outputs.append(output)
output = """Strategy Command: ['./testExp ']
Strategy: 1, STEP reached: NoOccurence
No more strategy to test.
"""
outputs.append(output)
## Test Header
output = """PROFILING Command: ['./testHeader ']
PrecisionTuner: MODE PROFILING
"""
outputs.append(output)
output = """Error no callstacks
"""
outputs.append(output)
output = """Strategy Command: ['./testHeader ']
Strategy: 1, STEP reached: NoOccurence
No more strategy to test.
"""
outputs.append(output)
## Test MathFunctions
output = """PROFILING Command: ['./testMathFunctions ']
PrecisionTuner: MODE PROFILING
THRESHOLD=0.100000, reference=1911391536333.537109 a=1911391536333.537109
SUCCESS
"""
outputs.append(output)
output = """No more strategy to generate.
"""
outputs.append(output)
output = """Strategy Command: ['./testMathFunctions ']
Strategy: 1, STEP reached: NoOccurence
No more strategy to test.\n"""
outputs.append(output)
|
outputs = []
output = "PROFILING Command: ['./testConstructor ']\nPrecisionTuner: MODE PROFILING\nPrecisionTuner: MODE PROFILING\n\n"
outputs.append(output)
output = 'Error no callstacks\n'
outputs.append(output)
output = "Strategy Command: ['./testConstructor ']\nStrategy: 1, STEP reached: NoOccurence\nNo more strategy to test.\n"
outputs.append(output)
output = "PROFILING Command: ['./testExp ']\nPrecisionTuner: MODE PROFILING\nSUCCESS: 23.1039\n\n"
outputs.append(output)
output = 'No more strategy to generate.\n'
outputs.append(output)
output = "Strategy Command: ['./testExp ']\nStrategy: 1, STEP reached: NoOccurence\nNo more strategy to test.\n"
outputs.append(output)
output = "PROFILING Command: ['./testHeader ']\nPrecisionTuner: MODE PROFILING\n\n"
outputs.append(output)
output = 'Error no callstacks\n'
outputs.append(output)
output = "Strategy Command: ['./testHeader ']\nStrategy: 1, STEP reached: NoOccurence\nNo more strategy to test.\n"
outputs.append(output)
output = "PROFILING Command: ['./testMathFunctions ']\nPrecisionTuner: MODE PROFILING\nTHRESHOLD=0.100000, reference=1911391536333.537109 a=1911391536333.537109\nSUCCESS\n\n"
outputs.append(output)
output = 'No more strategy to generate.\n'
outputs.append(output)
output = "Strategy Command: ['./testMathFunctions ']\nStrategy: 1, STEP reached: NoOccurence\nNo more strategy to test.\n"
outputs.append(output)
|
# Bubble Sort
def bubble_sort(array: list) -> tuple:
""""will return the sorted array, and number of swaps"""
total_swaps = 0
for i in range(len(array)):
swaps = 0
for j in range(len(array) - 1):
if array[j] > array[j + 1]:
array[j], array[j + 1] = array[j + 1], array[j]
swaps += 1
total_swaps += 1
if swaps == 0:
break
return array, total_swaps
_ = int(input())
array = list(map(int, input().split()))
array, total_swaps = bubble_sort(array)
print(f'Array is sorted in {total_swaps} swaps.')
print(f'First Element: {array[0]}')
print(f'Last Element: {array[-1]}')
|
def bubble_sort(array: list) -> tuple:
""""will return the sorted array, and number of swaps"""
total_swaps = 0
for i in range(len(array)):
swaps = 0
for j in range(len(array) - 1):
if array[j] > array[j + 1]:
(array[j], array[j + 1]) = (array[j + 1], array[j])
swaps += 1
total_swaps += 1
if swaps == 0:
break
return (array, total_swaps)
_ = int(input())
array = list(map(int, input().split()))
(array, total_swaps) = bubble_sort(array)
print(f'Array is sorted in {total_swaps} swaps.')
print(f'First Element: {array[0]}')
print(f'Last Element: {array[-1]}')
|
# 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.
"""A helper library for coverage_test.py - coverage is added to this library."""
def simple_func(a):
return 2 * a
def if_func(a):
x = a
if x:
return 2
else:
return 3
def cmp_less(a, b):
return a < b
def cmp_greater(a, b):
return a > b
def cmp_const_less(a):
return 1 < a
def cmp_const_less_inverted(a):
return a < 1
def regex_match(re_obj, a):
re_obj.match(a)
|
"""A helper library for coverage_test.py - coverage is added to this library."""
def simple_func(a):
return 2 * a
def if_func(a):
x = a
if x:
return 2
else:
return 3
def cmp_less(a, b):
return a < b
def cmp_greater(a, b):
return a > b
def cmp_const_less(a):
return 1 < a
def cmp_const_less_inverted(a):
return a < 1
def regex_match(re_obj, a):
re_obj.match(a)
|
def fun(n):
fact = 1
for i in range(1,n+1):
fact = fact * i
return fact
n= int(input())
k = fun(n)
j = fun(n//2)
l = j//(n//2)
print(((k//(j**2))*(l**2))//2)
|
def fun(n):
fact = 1
for i in range(1, n + 1):
fact = fact * i
return fact
n = int(input())
k = fun(n)
j = fun(n // 2)
l = j // (n // 2)
print(k // j ** 2 * l ** 2 // 2)
|
palavras = ("Aprender", "Programar", "Linguagem", "Python", "Curso", "Gratis", "Estudar", "Praticar", "Trabalhar ", "Mercado", "Programar", "Futuro")
for vol in palavras:
print(f"\nNa palavra {vol.upper()} temos", end=" ")
for letra in vol:
if letra.lower() in "aeiou":
print(letra, end=" ")
|
palavras = ('Aprender', 'Programar', 'Linguagem', 'Python', 'Curso', 'Gratis', 'Estudar', 'Praticar', 'Trabalhar ', 'Mercado', 'Programar', 'Futuro')
for vol in palavras:
print(f'\nNa palavra {vol.upper()} temos', end=' ')
for letra in vol:
if letra.lower() in 'aeiou':
print(letra, end=' ')
|
# a = int(input('Numerador: ')) # se tentarmos colocar uma letra aqui vai da erro de valor ValueError
# b = int(input('Denominador: ')) # se colocar 0 aqui vai acontecer uma excecao ZeroDivisionError - divisao por zero
# r = a/b
# print(f'A divisao de {a} por {b} vale = {r}')
# para tratar erros a gente usa o comando try, except, else
try: # o python vai tentar realizar este comando
a = int(input('Numerador: '))
b = int(input('Denominador: '))
r = a / b # caso aconteca qualquer erro de valor ou divisao por 0, etc.. Ele vai pular para o comando except
except Exception as erro: # poderia colocar apenas except: , porem criou uma variavel para demonstrar o erro que ta aparecendo
print(f'Erro encontrado = {erro.__class__}') # mostrar a classe do erro
else: # Se a operacao de try der certo ele vai realizar o comando else tambem, comando opcional
print(f'O resultado foi = {r}')
finally:
print('Volte sempre! Obrigado!') # o finally vai acontecer sempre independente de o try der certo ou errado, comando opcional
|
try:
a = int(input('Numerador: '))
b = int(input('Denominador: '))
r = a / b
except Exception as erro:
print(f'Erro encontrado = {erro.__class__}')
else:
print(f'O resultado foi = {r}')
finally:
print('Volte sempre! Obrigado!')
|
class Color(APIObject, IDisposable):
"""
Represents a color in Autodesk Revit.
Color(red: Byte,green: Byte,blue: Byte)
"""
def Dispose(self):
""" Dispose(self: APIObject,A_0: bool) """
pass
def ReleaseManagedResources(self, *args):
""" ReleaseManagedResources(self: APIObject) """
pass
def ReleaseUnmanagedResources(self, *args):
""" ReleaseUnmanagedResources(self: APIObject) """
pass
def __enter__(self, *args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self, *args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self, red, green, blue):
""" __new__(cls: type,red: Byte,green: Byte,blue: Byte) """
pass
Blue = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get the blue channel of the color. Setting a channel is obsolete in Autodesk Revit 2013. Please create a new color instead.
Get: Blue(self: Color) -> Byte
Set: Blue(self: Color)=value
"""
Green = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get the green channel of the color. Setting a channel is obsolete in Autodesk Revit 2013. Please create a new color instead.
Get: Green(self: Color) -> Byte
Set: Green(self: Color)=value
"""
IsValid = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Identifies if the color represents a valid color,or an uninitialized/invalid value.
Get: IsValid(self: Color) -> bool
"""
Red = property(lambda self: object(), lambda self, v: None, lambda self: None)
"""Get the red channel of the color. Setting a channel is obsolete in Autodesk Revit 2013. Please create a new color instead.
Get: Red(self: Color) -> Byte
Set: Red(self: Color)=value
"""
InvalidColorValue = None
|
class Color(APIObject, IDisposable):
"""
Represents a color in Autodesk Revit.
Color(red: Byte,green: Byte,blue: Byte)
"""
def dispose(self):
""" Dispose(self: APIObject,A_0: bool) """
pass
def release_managed_resources(self, *args):
""" ReleaseManagedResources(self: APIObject) """
pass
def release_unmanaged_resources(self, *args):
""" ReleaseUnmanagedResources(self: APIObject) """
pass
def __enter__(self, *args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self, *args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self, red, green, blue):
""" __new__(cls: type,red: Byte,green: Byte,blue: Byte) """
pass
blue = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get the blue channel of the color. Setting a channel is obsolete in Autodesk Revit 2013. Please create a new color instead.\n\n\n\nGet: Blue(self: Color) -> Byte\n\n\n\nSet: Blue(self: Color)=value\n\n'
green = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get the green channel of the color. Setting a channel is obsolete in Autodesk Revit 2013. Please create a new color instead.\n\n\n\nGet: Green(self: Color) -> Byte\n\n\n\nSet: Green(self: Color)=value\n\n'
is_valid = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Identifies if the color represents a valid color,or an uninitialized/invalid value.\n\n\n\nGet: IsValid(self: Color) -> bool\n\n\n\n'
red = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get the red channel of the color. Setting a channel is obsolete in Autodesk Revit 2013. Please create a new color instead.\n\n\n\nGet: Red(self: Color) -> Byte\n\n\n\nSet: Red(self: Color)=value\n\n'
invalid_color_value = None
|
class Solution:
def numTilings(self, n: int) -> int:
mod = 1_000_000_000 + 7
f = [[0 for i in range(1 << 2)] for i in range(2)]
f[0][(1 << 2) - 1] = 1
o0 = 0
o1 = 1
for i in range(n):
f[o1][0] = f[o0][(1 << 2) - 1]
f[o1][1] = (f[o0][0] + f[o0][2]) % mod
f[o1][2] = (f[o0][0] + f[o0][1]) % mod
f[o1][(1 << 2) - 1] = (f[o0][0] + f[o0][1] + f[o0][2] + f[o0][(1 << 2) - 1]) % mod
o0 = o1
o1 ^= 1
return f[o0][(1 << 2) - 1]
|
class Solution:
def num_tilings(self, n: int) -> int:
mod = 1000000000 + 7
f = [[0 for i in range(1 << 2)] for i in range(2)]
f[0][(1 << 2) - 1] = 1
o0 = 0
o1 = 1
for i in range(n):
f[o1][0] = f[o0][(1 << 2) - 1]
f[o1][1] = (f[o0][0] + f[o0][2]) % mod
f[o1][2] = (f[o0][0] + f[o0][1]) % mod
f[o1][(1 << 2) - 1] = (f[o0][0] + f[o0][1] + f[o0][2] + f[o0][(1 << 2) - 1]) % mod
o0 = o1
o1 ^= 1
return f[o0][(1 << 2) - 1]
|
"""Constants that define time formats"""
F1 = '%Y-%m-%dT%H:%M:%S'
F2 = '%Y-%m-%d'
|
"""Constants that define time formats"""
f1 = '%Y-%m-%dT%H:%M:%S'
f2 = '%Y-%m-%d'
|
def escreva(texto):
tam = len(texto) + 4
print('~' * tam)
print(f' {texto}')
print('~' * tam)
escreva(str(input('Digite um texto: ')))
|
def escreva(texto):
tam = len(texto) + 4
print('~' * tam)
print(f' {texto}')
print('~' * tam)
escreva(str(input('Digite um texto: ')))
|
"""Media files location specifications."""
def workflow_step_media_location(instance, filename):
"""Return the location of a stored media file for a Workflow Step."""
workflow_id = instance.workflow_step.workflow.id
step_id = instance.workflow_step_id
ui_identifier = instance.ui_identifier
file_extension = filename.rpartition(".")[2]
return f"workflow_system/workflows/{workflow_id}/steps/{step_id}/{ui_identifier}.{file_extension}"
def collection_image_location(instance, filename):
"""Return the location of a stored media file for a Workflow Collection."""
collection_id = instance.id
image_type = instance.type
file_extension = filename.rpartition(".")[2]
return f"workflow_system/collections/{collection_id}/{image_type}.{file_extension}"
def workflow_image_location(instance, filename):
"""Return the location of a stored media file for a Workflow."""
workflow_id = instance.id
image_type = instance.type
file_extension = filename.rpartition(".")[2]
return f"workflow_system/workflows/{workflow_id}/{image_type}.{file_extension}"
def author_media_location(instance, filename):
"""Return the location of a stored media file for an Author."""
author_id = instance.id
image_type = filename.rpartition(".")[2]
return f"workflow_system/authors/{author_id}/profileImage.{image_type}"
|
"""Media files location specifications."""
def workflow_step_media_location(instance, filename):
"""Return the location of a stored media file for a Workflow Step."""
workflow_id = instance.workflow_step.workflow.id
step_id = instance.workflow_step_id
ui_identifier = instance.ui_identifier
file_extension = filename.rpartition('.')[2]
return f'workflow_system/workflows/{workflow_id}/steps/{step_id}/{ui_identifier}.{file_extension}'
def collection_image_location(instance, filename):
"""Return the location of a stored media file for a Workflow Collection."""
collection_id = instance.id
image_type = instance.type
file_extension = filename.rpartition('.')[2]
return f'workflow_system/collections/{collection_id}/{image_type}.{file_extension}'
def workflow_image_location(instance, filename):
"""Return the location of a stored media file for a Workflow."""
workflow_id = instance.id
image_type = instance.type
file_extension = filename.rpartition('.')[2]
return f'workflow_system/workflows/{workflow_id}/{image_type}.{file_extension}'
def author_media_location(instance, filename):
"""Return the location of a stored media file for an Author."""
author_id = instance.id
image_type = filename.rpartition('.')[2]
return f'workflow_system/authors/{author_id}/profileImage.{image_type}'
|
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# normal recursive solution
# this recursive solution will call more methods which cause Time Limit Exceed
class Solution1:
# @param {TreeNode} root
# @return {integer}
def maxDepth(self, root):
if root is None:
return 0
if self.left is None and self.right is None:
return 1
elif self.left is not None and self.right is not None:
return self.maxDepth(self.left) + 1 if self.maxDepth(self.left) > \
self.maxDepth(self.right) else self.maxDepth(self.right) + 1
elif self.left is not None:
return self.maxDepth(self.left) + 1
elif self.rigith is not None:
return self.maxDepth(self.right) + 1
# recursive solution with only two methods call
# This is a cleaner solution with only two methods
# This is passed in the leetcode
class Solution2:
# @param {TreeNode} root
# @return {integer}
def maxDepth(self, root):
if root is None:
return 0
leftDepth = self.maxDepth(root.left)
rightDepth = self.maxDepth(root.right)
return leftDepth + 1 if leftDepth > rightDepth else rightDepth + 1
|
class Solution1:
def max_depth(self, root):
if root is None:
return 0
if self.left is None and self.right is None:
return 1
elif self.left is not None and self.right is not None:
return self.maxDepth(self.left) + 1 if self.maxDepth(self.left) > self.maxDepth(self.right) else self.maxDepth(self.right) + 1
elif self.left is not None:
return self.maxDepth(self.left) + 1
elif self.rigith is not None:
return self.maxDepth(self.right) + 1
class Solution2:
def max_depth(self, root):
if root is None:
return 0
left_depth = self.maxDepth(root.left)
right_depth = self.maxDepth(root.right)
return leftDepth + 1 if leftDepth > rightDepth else rightDepth + 1
|
url = 'http://127.0.0.1:3001/post'
dapr_url = "http://localhost:3500/v1.0/invoke/dp-61c2cb20562850d49d47d1c7-executorapp/method/health"
# dapr_url = "http://localhost:3500/v1.0/healthz"
# res = requests.post(dapr_url, json.dumps({'a': random.random() * 1000}))
# res = requests.get(dapr_url, )
#
#
#
# print(res.text)
# print(res.status_code)
# INFO[0000] *----/v1.0/invoke/{id}/method/{method:*}
# INFO[0000] GET----/v1.0/state/{storeName}/{key}
# INFO[0000] DELETE----/v1.0/state/{storeName}/{key}
# INFO[0000] PUT----/v1.0/state/{storeName}
# INFO[0000] PUT----/v1.0/state/{storeName}/bulk
# INFO[0000] PUT----/v1.0/state/{storeName}/transaction
# INFO[0000] POST----/v1.0/state/{storeName}
# INFO[0000] POST----/v1.0/state/{storeName}/bulk
# INFO[0000] POST----/v1.0/state/{storeName}/transaction
# INFO[0000] POST----/v1.0-alpha1/state/{storeName}/query
# INFO[0000] PUT----/v1.0-alpha1/state/{storeName}/query
# INFO[0000] GET----/v1.0/secrets/{secretStoreName}/bulk
# INFO[0000] GET----/v1.0/secrets/{secretStoreName}/{key}
# INFO[0000] POST----/v1.0/publish/{pubsubname}/{topic:*}
# INFO[0000] PUT----/v1.0/publish/{pubsubname}/{topic:*}
# INFO[0000] POST----/v1.0/bindings/{name}
# INFO[0000] PUT----/v1.0/bindings/{name}
# INFO[0000] GET----/v1.0/healthz
# INFO[0000] GET----/v1.0/healthz/outbound
# INFO[0000] GET----/v1.0/actors/{actorType}/{actorId}/method/{method}
# INFO[0000] GET----/v1.0/actors/{actorType}/{actorId}/state/{key}
# INFO[0000] GET----/v1.0/actors/{actorType}/{actorId}/reminders/{name}
# INFO[0000] POST----/v1.0/actors/{actorType}/{actorId}/state
# INFO[0000] POST----/v1.0/actors/{actorType}/{actorId}/method/{method}
# INFO[0000] POST----/v1.0/actors/{actorType}/{actorId}/reminders/{name}
# INFO[0000] POST----/v1.0/actors/{actorType}/{actorId}/timers/{name}
# INFO[0000] PUT----/v1.0/actors/{actorType}/{actorId}/state
# INFO[0000] PUT----/v1.0/actors/{actorType}/{actorId}/method/{method}
# INFO[0000] PUT----/v1.0/actors/{actorType}/{actorId}/reminders/{name}
# INFO[0000] PUT----/v1.0/actors/{actorType}/{actorId}/timers/{name}
# INFO[0000] DELETE----/v1.0/actors/{actorType}/{actorId}/method/{method}
# INFO[0000] DELETE----/v1.0/actors/{actorType}/{actorId}/reminders/{name}
# INFO[0000] DELETE----/v1.0/actors/{actorType}/{actorId}/timers/{name}
# INFO[0000] *----/{method:*}
# INFO[0000] GET----/v1.0/metadata
# INFO[0000] PUT----/v1.0/metadata/{key}
# INFO[0000] POST----/v1.0/shutdown
|
url = 'http://127.0.0.1:3001/post'
dapr_url = 'http://localhost:3500/v1.0/invoke/dp-61c2cb20562850d49d47d1c7-executorapp/method/health'
|
#!/usr/bin/env python
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
command += testshade("-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_c_float_v_floatarray.tif test_splineinverse_c_float_v_floatarray")
command += testshade("-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_c_float_u_floatarray.tif test_splineinverse_c_float_u_floatarray")
command += testshade("-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_c_float_c_floatarray.tif test_splineinverse_c_float_c_floatarray")
outputs.append ("splineinverse_c_float_v_floatarray.tif")
outputs.append ("splineinverse_c_float_u_floatarray.tif")
outputs.append ("splineinverse_c_float_c_floatarray.tif")
command += testshade("-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_u_float_v_floatarray.tif test_splineinverse_u_float_v_floatarray")
command += testshade("-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_u_float_u_floatarray.tif test_splineinverse_u_float_u_floatarray")
command += testshade("-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_u_float_c_floatarray.tif test_splineinverse_u_float_c_floatarray")
outputs.append ("splineinverse_u_float_v_floatarray.tif")
outputs.append ("splineinverse_u_float_u_floatarray.tif")
outputs.append ("splineinverse_u_float_c_floatarray.tif")
command += testshade("-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_v_float_v_floatarray.tif test_splineinverse_v_float_v_floatarray")
command += testshade("-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_v_float_u_floatarray.tif test_splineinverse_v_float_u_floatarray")
command += testshade("-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_v_float_c_floatarray.tif test_splineinverse_v_float_c_floatarray")
outputs.append ("splineinverse_v_float_v_floatarray.tif")
outputs.append ("splineinverse_v_float_u_floatarray.tif")
outputs.append ("splineinverse_v_float_c_floatarray.tif")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_c_float_v_floatarray.tif test_deriv_splineinverse_c_float_v_floatarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_c_float_u_floatarray.tif test_deriv_splineinverse_c_float_u_floatarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_c_float_c_floatarray.tif test_deriv_splineinverse_c_float_c_floatarray")
outputs.append ("deriv_splineinverse_c_float_v_floatarray.tif")
outputs.append ("deriv_splineinverse_c_float_u_floatarray.tif")
outputs.append ("deriv_splineinverse_c_float_c_floatarray.tif")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_u_float_v_floatarray.tif test_deriv_splineinverse_u_float_v_floatarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_u_float_u_floatarray.tif test_deriv_splineinverse_u_float_u_floatarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_u_float_c_floatarray.tif test_deriv_splineinverse_u_float_c_floatarray")
outputs.append ("deriv_splineinverse_u_float_v_floatarray.tif")
outputs.append ("deriv_splineinverse_u_float_u_floatarray.tif")
outputs.append ("deriv_splineinverse_u_float_c_floatarray.tif")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_v_float_v_floatarray.tif test_deriv_splineinverse_v_float_v_floatarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_v_float_u_floatarray.tif test_deriv_splineinverse_v_float_u_floatarray")
command += testshade("--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_v_float_c_floatarray.tif test_deriv_splineinverse_v_float_c_floatarray")
outputs.append ("deriv_splineinverse_v_float_v_floatarray.tif")
outputs.append ("deriv_splineinverse_v_float_u_floatarray.tif")
outputs.append ("deriv_splineinverse_v_float_c_floatarray.tif")
# expect a few LSB failures
failthresh = 0.008
failpercent = 3
|
command += testshade('-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_c_float_v_floatarray.tif test_splineinverse_c_float_v_floatarray')
command += testshade('-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_c_float_u_floatarray.tif test_splineinverse_c_float_u_floatarray')
command += testshade('-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_c_float_c_floatarray.tif test_splineinverse_c_float_c_floatarray')
outputs.append('splineinverse_c_float_v_floatarray.tif')
outputs.append('splineinverse_c_float_u_floatarray.tif')
outputs.append('splineinverse_c_float_c_floatarray.tif')
command += testshade('-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_u_float_v_floatarray.tif test_splineinverse_u_float_v_floatarray')
command += testshade('-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_u_float_u_floatarray.tif test_splineinverse_u_float_u_floatarray')
command += testshade('-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_u_float_c_floatarray.tif test_splineinverse_u_float_c_floatarray')
outputs.append('splineinverse_u_float_v_floatarray.tif')
outputs.append('splineinverse_u_float_u_floatarray.tif')
outputs.append('splineinverse_u_float_c_floatarray.tif')
command += testshade('-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_v_float_v_floatarray.tif test_splineinverse_v_float_v_floatarray')
command += testshade('-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_v_float_u_floatarray.tif test_splineinverse_v_float_u_floatarray')
command += testshade('-t 1 -g 64 64 --center -od uint8 -o Fout splineinverse_v_float_c_floatarray.tif test_splineinverse_v_float_c_floatarray')
outputs.append('splineinverse_v_float_v_floatarray.tif')
outputs.append('splineinverse_v_float_u_floatarray.tif')
outputs.append('splineinverse_v_float_c_floatarray.tif')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_c_float_v_floatarray.tif test_deriv_splineinverse_c_float_v_floatarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_c_float_u_floatarray.tif test_deriv_splineinverse_c_float_u_floatarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_c_float_c_floatarray.tif test_deriv_splineinverse_c_float_c_floatarray')
outputs.append('deriv_splineinverse_c_float_v_floatarray.tif')
outputs.append('deriv_splineinverse_c_float_u_floatarray.tif')
outputs.append('deriv_splineinverse_c_float_c_floatarray.tif')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_u_float_v_floatarray.tif test_deriv_splineinverse_u_float_v_floatarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_u_float_u_floatarray.tif test_deriv_splineinverse_u_float_u_floatarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_u_float_c_floatarray.tif test_deriv_splineinverse_u_float_c_floatarray')
outputs.append('deriv_splineinverse_u_float_v_floatarray.tif')
outputs.append('deriv_splineinverse_u_float_u_floatarray.tif')
outputs.append('deriv_splineinverse_u_float_c_floatarray.tif')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_v_float_v_floatarray.tif test_deriv_splineinverse_v_float_v_floatarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_v_float_u_floatarray.tif test_deriv_splineinverse_v_float_u_floatarray')
command += testshade('--vary_udxdy --vary_vdxdy -t 1 -g 64 64 --center -od uint8 -o ValDxDyOut deriv_splineinverse_v_float_c_floatarray.tif test_deriv_splineinverse_v_float_c_floatarray')
outputs.append('deriv_splineinverse_v_float_v_floatarray.tif')
outputs.append('deriv_splineinverse_v_float_u_floatarray.tif')
outputs.append('deriv_splineinverse_v_float_c_floatarray.tif')
failthresh = 0.008
failpercent = 3
|
# src: https://github.com/dchest/tweetnacl-js/blob/acab4d4883e7a0be0b230df7b42c0bbd25210d39/nacl.js
__pragma__("js", "{}", r"""
(function(nacl) {
'use strict';
// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
// Public domain.
//
// Implementation derived from TweetNaCl version 20140427.
// See for details: http://tweetnacl.cr.yp.to/
var u64 = function(h, l) { this.hi = h|0 >>> 0; this.lo = l|0 >>> 0; };
var gf = function(init) {
var i, r = new Float64Array(16);
if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
return r;
};
// Pluggable, initialized in high-level API below.
var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
var _0 = new Uint8Array(16);
var _9 = new Uint8Array(32); _9[0] = 9;
var gf0 = gf(),
gf1 = gf([1]),
_121665 = gf([0xdb41, 1]),
D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
function L32(x, c) { return (x << c) | (x >>> (32 - c)); }
function ld32(x, i) {
var u = x[i+3] & 0xff;
u = (u<<8)|(x[i+2] & 0xff);
u = (u<<8)|(x[i+1] & 0xff);
return (u<<8)|(x[i+0] & 0xff);
}
function dl64(x, i) {
var h = (x[i] << 24) | (x[i+1] << 16) | (x[i+2] << 8) | x[i+3];
var l = (x[i+4] << 24) | (x[i+5] << 16) | (x[i+6] << 8) | x[i+7];
return new u64(h, l);
}
function st32(x, j, u) {
var i;
for (i = 0; i < 4; i++) { x[j+i] = u & 255; u >>>= 8; }
}
function ts64(x, i, u) {
x[i] = (u.hi >> 24) & 0xff;
x[i+1] = (u.hi >> 16) & 0xff;
x[i+2] = (u.hi >> 8) & 0xff;
x[i+3] = u.hi & 0xff;
x[i+4] = (u.lo >> 24) & 0xff;
x[i+5] = (u.lo >> 16) & 0xff;
x[i+6] = (u.lo >> 8) & 0xff;
x[i+7] = u.lo & 0xff;
}
function vn(x, xi, y, yi, n) {
var i,d = 0;
for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
return (1 & ((d - 1) >>> 8)) - 1;
}
function crypto_verify_16(x, xi, y, yi) {
return vn(x,xi,y,yi,16);
}
function crypto_verify_32(x, xi, y, yi) {
return vn(x,xi,y,yi,32);
}
function core(out,inp,k,c,h) {
var w = new Uint32Array(16), x = new Uint32Array(16),
y = new Uint32Array(16), t = new Uint32Array(4);
var i, j, m;
for (i = 0; i < 4; i++) {
x[5*i] = ld32(c, 4*i);
x[1+i] = ld32(k, 4*i);
x[6+i] = ld32(inp, 4*i);
x[11+i] = ld32(k, 16+4*i);
}
for (i = 0; i < 16; i++) y[i] = x[i];
for (i = 0; i < 20; i++) {
for (j = 0; j < 4; j++) {
for (m = 0; m < 4; m++) t[m] = x[(5*j+4*m)%16];
t[1] ^= L32((t[0]+t[3])|0, 7);
t[2] ^= L32((t[1]+t[0])|0, 9);
t[3] ^= L32((t[2]+t[1])|0,13);
t[0] ^= L32((t[3]+t[2])|0,18);
for (m = 0; m < 4; m++) w[4*j+(j+m)%4] = t[m];
}
for (m = 0; m < 16; m++) x[m] = w[m];
}
if (h) {
for (i = 0; i < 16; i++) x[i] = (x[i] + y[i]) | 0;
for (i = 0; i < 4; i++) {
x[5*i] = (x[5*i] - ld32(c, 4*i)) | 0;
x[6+i] = (x[6+i] - ld32(inp, 4*i)) | 0;
}
for (i = 0; i < 4; i++) {
st32(out,4*i,x[5*i]);
st32(out,16+4*i,x[6+i]);
}
} else {
for (i = 0; i < 16; i++) st32(out, 4 * i, (x[i] + y[i]) | 0);
}
}
function crypto_core_salsa20(out,inp,k,c) {
core(out,inp,k,c,false);
return 0;
}
function crypto_core_hsalsa20(out,inp,k,c) {
core(out,inp,k,c,true);
return 0;
}
var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
// "expand 32-byte k"
function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
var z = new Uint8Array(16), x = new Uint8Array(64);
var u, i;
if (!b) return 0;
for (i = 0; i < 16; i++) z[i] = 0;
for (i = 0; i < 8; i++) z[i] = n[i];
while (b >= 64) {
crypto_core_salsa20(x,z,k,sigma);
for (i = 0; i < 64; i++) c[cpos+i] = (m?m[mpos+i]:0) ^ x[i];
u = 1;
for (i = 8; i < 16; i++) {
u = u + (z[i] & 0xff) | 0;
z[i] = u & 0xff;
u >>>= 8;
}
b -= 64;
cpos += 64;
if (m) mpos += 64;
}
if (b > 0) {
crypto_core_salsa20(x,z,k,sigma);
for (i = 0; i < b; i++) c[cpos+i] = (m?m[mpos+i]:0) ^ x[i];
}
return 0;
}
function crypto_stream_salsa20(c,cpos,d,n,k) {
return crypto_stream_salsa20_xor(c,cpos,null,0,d,n,k);
}
function crypto_stream(c,cpos,d,n,k) {
var s = new Uint8Array(32);
crypto_core_hsalsa20(s,n,k,sigma);
return crypto_stream_salsa20(c,cpos,d,n.subarray(16),s);
}
function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
var s = new Uint8Array(32);
crypto_core_hsalsa20(s,n,k,sigma);
return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,n.subarray(16),s);
}
function add1305(h, c) {
var j, u = 0;
for (j = 0; j < 17; j++) {
u = (u + ((h[j] + c[j]) | 0)) | 0;
h[j] = u & 255;
u >>>= 8;
}
}
var minusp = new Uint32Array([
5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252
]);
function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
var s, i, j, u;
var x = new Uint32Array(17), r = new Uint32Array(17),
h = new Uint32Array(17), c = new Uint32Array(17),
g = new Uint32Array(17);
for (j = 0; j < 17; j++) r[j]=h[j]=0;
for (j = 0; j < 16; j++) r[j]=k[j];
r[3]&=15;
r[4]&=252;
r[7]&=15;
r[8]&=252;
r[11]&=15;
r[12]&=252;
r[15]&=15;
while (n > 0) {
for (j = 0; j < 17; j++) c[j] = 0;
for (j = 0; (j < 16) && (j < n); ++j) c[j] = m[mpos+j];
c[j] = 1;
mpos += j; n -= j;
add1305(h,c);
for (i = 0; i < 17; i++) {
x[i] = 0;
for (j = 0; j < 17; j++) x[i] = (x[i] + (h[j] * ((j <= i) ? r[i - j] : ((320 * r[i + 17 - j])|0))) | 0) | 0;
}
for (i = 0; i < 17; i++) h[i] = x[i];
u = 0;
for (j = 0; j < 16; j++) {
u = (u + h[j]) | 0;
h[j] = u & 255;
u >>>= 8;
}
u = (u + h[16]) | 0; h[16] = u & 3;
u = (5 * (u >>> 2)) | 0;
for (j = 0; j < 16; j++) {
u = (u + h[j]) | 0;
h[j] = u & 255;
u >>>= 8;
}
u = (u + h[16]) | 0; h[16] = u;
}
for (j = 0; j < 17; j++) g[j] = h[j];
add1305(h,minusp);
s = (-(h[16] >>> 7) | 0);
for (j = 0; j < 17; j++) h[j] ^= s & (g[j] ^ h[j]);
for (j = 0; j < 16; j++) c[j] = k[j + 16];
c[16] = 0;
add1305(h,c);
for (j = 0; j < 16; j++) out[outpos+j] = h[j];
return 0;
}
function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
var x = new Uint8Array(16);
crypto_onetimeauth(x,0,m,mpos,n,k);
return crypto_verify_16(h,hpos,x,0);
}
function crypto_secretbox(c,m,d,n,k) {
var i;
if (d < 32) return -1;
crypto_stream_xor(c,0,m,0,d,n,k);
crypto_onetimeauth(c, 16, c, 32, d - 32, c);
for (i = 0; i < 16; i++) c[i] = 0;
return 0;
}
function crypto_secretbox_open(m,c,d,n,k) {
var i;
var x = new Uint8Array(32);
if (d < 32) return -1;
crypto_stream(x,0,32,n,k);
if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
crypto_stream_xor(m,0,c,0,d,n,k);
for (i = 0; i < 32; i++) m[i] = 0;
return 0;
}
function set25519(r, a) {
var i;
for (i = 0; i < 16; i++) r[i] = a[i]|0;
}
function car25519(o) {
var c;
var i;
for (i = 0; i < 16; i++) {
o[i] += 65536;
c = Math.floor(o[i] / 65536);
o[(i+1)*(i<15?1:0)] += c - 1 + 37 * (c-1) * (i===15?1:0);
o[i] -= (c * 65536);
}
}
function sel25519(p, q, b) {
var t, c = ~(b-1);
for (var i = 0; i < 16; i++) {
t = c & (p[i] ^ q[i]);
p[i] ^= t;
q[i] ^= t;
}
}
function pack25519(o, n) {
var i, j, b;
var m = gf(), t = gf();
for (i = 0; i < 16; i++) t[i] = n[i];
car25519(t);
car25519(t);
car25519(t);
for (j = 0; j < 2; j++) {
m[0] = t[0] - 0xffed;
for (i = 1; i < 15; i++) {
m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
m[i-1] &= 0xffff;
}
m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
b = (m[15]>>16) & 1;
m[14] &= 0xffff;
sel25519(t, m, 1-b);
}
for (i = 0; i < 16; i++) {
o[2*i] = t[i] & 0xff;
o[2*i+1] = t[i]>>8;
}
}
function neq25519(a, b) {
var c = new Uint8Array(32), d = new Uint8Array(32);
pack25519(c, a);
pack25519(d, b);
return crypto_verify_32(c, 0, d, 0);
}
function par25519(a) {
var d = new Uint8Array(32);
pack25519(d, a);
return d[0] & 1;
}
function unpack25519(o, n) {
var i;
for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
o[15] &= 0x7fff;
}
function A(o, a, b) {
var i;
for (i = 0; i < 16; i++) o[i] = (a[i] + b[i])|0;
}
function Z(o, a, b) {
var i;
for (i = 0; i < 16; i++) o[i] = (a[i] - b[i])|0;
}
function M(o, a, b) {
var i, j, t = new Float64Array(31);
for (i = 0; i < 31; i++) t[i] = 0;
for (i = 0; i < 16; i++) {
for (j = 0; j < 16; j++) {
t[i+j] += a[i] * b[j];
}
}
for (i = 0; i < 15; i++) {
t[i] += 38 * t[i+16];
}
for (i = 0; i < 16; i++) o[i] = t[i];
car25519(o);
car25519(o);
}
function S(o, a) {
M(o, a, a);
}
function inv25519(o, i) {
var c = gf();
var a;
for (a = 0; a < 16; a++) c[a] = i[a];
for (a = 253; a >= 0; a--) {
S(c, c);
if(a !== 2 && a !== 4) M(c, c, i);
}
for (a = 0; a < 16; a++) o[a] = c[a];
}
function pow2523(o, i) {
var c = gf();
var a;
for (a = 0; a < 16; a++) c[a] = i[a];
for (a = 250; a >= 0; a--) {
S(c, c);
if(a !== 1) M(c, c, i);
}
for (a = 0; a < 16; a++) o[a] = c[a];
}
function crypto_scalarmult(q, n, p) {
var z = new Uint8Array(32);
var x = new Float64Array(80), r, i;
var a = gf(), b = gf(), c = gf(),
d = gf(), e = gf(), f = gf();
for (i = 0; i < 31; i++) z[i] = n[i];
z[31]=(n[31]&127)|64;
z[0]&=248;
unpack25519(x,p);
for (i = 0; i < 16; i++) {
b[i]=x[i];
d[i]=a[i]=c[i]=0;
}
a[0]=d[0]=1;
for (i=254; i>=0; --i) {
r=(z[i>>>3]>>>(i&7))&1;
sel25519(a,b,r);
sel25519(c,d,r);
A(e,a,c);
Z(a,a,c);
A(c,b,d);
Z(b,b,d);
S(d,e);
S(f,a);
M(a,c,a);
M(c,b,e);
A(e,a,c);
Z(a,a,c);
S(b,a);
Z(c,d,f);
M(a,c,_121665);
A(a,a,d);
M(c,c,a);
M(a,d,f);
M(d,b,x);
S(b,e);
sel25519(a,b,r);
sel25519(c,d,r);
}
for (i = 0; i < 16; i++) {
x[i+16]=a[i];
x[i+32]=c[i];
x[i+48]=b[i];
x[i+64]=d[i];
}
var x32 = x.subarray(32);
var x16 = x.subarray(16);
inv25519(x32,x32);
M(x16,x16,x32);
pack25519(q,x16);
return 0;
}
function crypto_scalarmult_base(q, n) {
return crypto_scalarmult(q, n, _9);
}
function crypto_box_keypair(y, x) {
randombytes(x, 32);
return crypto_scalarmult_base(y, x);
}
function crypto_box_beforenm(k, y, x) {
var s = new Uint8Array(32);
crypto_scalarmult(s, x, y);
return crypto_core_hsalsa20(k, _0, s, sigma);
}
var crypto_box_afternm = crypto_secretbox;
var crypto_box_open_afternm = crypto_secretbox_open;
function crypto_box(c, m, d, n, y, x) {
var k = new Uint8Array(32);
crypto_box_beforenm(k, y, x);
return crypto_box_afternm(c, m, d, n, k);
}
function crypto_box_open(m, c, d, n, y, x) {
var k = new Uint8Array(32);
crypto_box_beforenm(k, y, x);
return crypto_box_open_afternm(m, c, d, n, k);
}
function add64() {
var a = 0, b = 0, c = 0, d = 0, m16 = 65535, l, h, i;
for (i = 0; i < arguments.length; i++) {
l = arguments[i].lo;
h = arguments[i].hi;
a += (l & m16); b += (l >>> 16);
c += (h & m16); d += (h >>> 16);
}
b += (a >>> 16);
c += (b >>> 16);
d += (c >>> 16);
return new u64((c & m16) | (d << 16), (a & m16) | (b << 16));
}
function shr64(x, c) {
return new u64((x.hi >>> c), (x.lo >>> c) | (x.hi << (32 - c)));
}
function xor64() {
var l = 0, h = 0, i;
for (i = 0; i < arguments.length; i++) {
l ^= arguments[i].lo;
h ^= arguments[i].hi;
}
return new u64(h, l);
}
function R(x, c) {
var h, l, c1 = 32 - c;
if (c < 32) {
h = (x.hi >>> c) | (x.lo << c1);
l = (x.lo >>> c) | (x.hi << c1);
} else if (c < 64) {
h = (x.lo >>> c) | (x.hi << c1);
l = (x.hi >>> c) | (x.lo << c1);
}
return new u64(h, l);
}
function Ch(x, y, z) {
var h = (x.hi & y.hi) ^ (~x.hi & z.hi),
l = (x.lo & y.lo) ^ (~x.lo & z.lo);
return new u64(h, l);
}
function Maj(x, y, z) {
var h = (x.hi & y.hi) ^ (x.hi & z.hi) ^ (y.hi & z.hi),
l = (x.lo & y.lo) ^ (x.lo & z.lo) ^ (y.lo & z.lo);
return new u64(h, l);
}
function Sigma0(x) { return xor64(R(x,28), R(x,34), R(x,39)); }
function Sigma1(x) { return xor64(R(x,14), R(x,18), R(x,41)); }
function sigma0(x) { return xor64(R(x, 1), R(x, 8), shr64(x,7)); }
function sigma1(x) { return xor64(R(x,19), R(x,61), shr64(x,6)); }
var K = [
new u64(0x428a2f98, 0xd728ae22), new u64(0x71374491, 0x23ef65cd),
new u64(0xb5c0fbcf, 0xec4d3b2f), new u64(0xe9b5dba5, 0x8189dbbc),
new u64(0x3956c25b, 0xf348b538), new u64(0x59f111f1, 0xb605d019),
new u64(0x923f82a4, 0xaf194f9b), new u64(0xab1c5ed5, 0xda6d8118),
new u64(0xd807aa98, 0xa3030242), new u64(0x12835b01, 0x45706fbe),
new u64(0x243185be, 0x4ee4b28c), new u64(0x550c7dc3, 0xd5ffb4e2),
new u64(0x72be5d74, 0xf27b896f), new u64(0x80deb1fe, 0x3b1696b1),
new u64(0x9bdc06a7, 0x25c71235), new u64(0xc19bf174, 0xcf692694),
new u64(0xe49b69c1, 0x9ef14ad2), new u64(0xefbe4786, 0x384f25e3),
new u64(0x0fc19dc6, 0x8b8cd5b5), new u64(0x240ca1cc, 0x77ac9c65),
new u64(0x2de92c6f, 0x592b0275), new u64(0x4a7484aa, 0x6ea6e483),
new u64(0x5cb0a9dc, 0xbd41fbd4), new u64(0x76f988da, 0x831153b5),
new u64(0x983e5152, 0xee66dfab), new u64(0xa831c66d, 0x2db43210),
new u64(0xb00327c8, 0x98fb213f), new u64(0xbf597fc7, 0xbeef0ee4),
new u64(0xc6e00bf3, 0x3da88fc2), new u64(0xd5a79147, 0x930aa725),
new u64(0x06ca6351, 0xe003826f), new u64(0x14292967, 0x0a0e6e70),
new u64(0x27b70a85, 0x46d22ffc), new u64(0x2e1b2138, 0x5c26c926),
new u64(0x4d2c6dfc, 0x5ac42aed), new u64(0x53380d13, 0x9d95b3df),
new u64(0x650a7354, 0x8baf63de), new u64(0x766a0abb, 0x3c77b2a8),
new u64(0x81c2c92e, 0x47edaee6), new u64(0x92722c85, 0x1482353b),
new u64(0xa2bfe8a1, 0x4cf10364), new u64(0xa81a664b, 0xbc423001),
new u64(0xc24b8b70, 0xd0f89791), new u64(0xc76c51a3, 0x0654be30),
new u64(0xd192e819, 0xd6ef5218), new u64(0xd6990624, 0x5565a910),
new u64(0xf40e3585, 0x5771202a), new u64(0x106aa070, 0x32bbd1b8),
new u64(0x19a4c116, 0xb8d2d0c8), new u64(0x1e376c08, 0x5141ab53),
new u64(0x2748774c, 0xdf8eeb99), new u64(0x34b0bcb5, 0xe19b48a8),
new u64(0x391c0cb3, 0xc5c95a63), new u64(0x4ed8aa4a, 0xe3418acb),
new u64(0x5b9cca4f, 0x7763e373), new u64(0x682e6ff3, 0xd6b2b8a3),
new u64(0x748f82ee, 0x5defb2fc), new u64(0x78a5636f, 0x43172f60),
new u64(0x84c87814, 0xa1f0ab72), new u64(0x8cc70208, 0x1a6439ec),
new u64(0x90befffa, 0x23631e28), new u64(0xa4506ceb, 0xde82bde9),
new u64(0xbef9a3f7, 0xb2c67915), new u64(0xc67178f2, 0xe372532b),
new u64(0xca273ece, 0xea26619c), new u64(0xd186b8c7, 0x21c0c207),
new u64(0xeada7dd6, 0xcde0eb1e), new u64(0xf57d4f7f, 0xee6ed178),
new u64(0x06f067aa, 0x72176fba), new u64(0x0a637dc5, 0xa2c898a6),
new u64(0x113f9804, 0xbef90dae), new u64(0x1b710b35, 0x131c471b),
new u64(0x28db77f5, 0x23047d84), new u64(0x32caab7b, 0x40c72493),
new u64(0x3c9ebe0a, 0x15c9bebc), new u64(0x431d67c4, 0x9c100d4c),
new u64(0x4cc5d4be, 0xcb3e42b6), new u64(0x597f299c, 0xfc657e2a),
new u64(0x5fcb6fab, 0x3ad6faec), new u64(0x6c44198c, 0x4a475817)
];
function crypto_hashblocks(x, m, n) {
var z = [], b = [], a = [], w = [], t, i, j;
for (i = 0; i < 8; i++) z[i] = a[i] = dl64(x, 8*i);
var pos = 0;
while (n >= 128) {
for (i = 0; i < 16; i++) w[i] = dl64(m, 8*i+pos);
for (i = 0; i < 80; i++) {
for (j = 0; j < 8; j++) b[j] = a[j];
t = add64(a[7], Sigma1(a[4]), Ch(a[4], a[5], a[6]), K[i], w[i%16]);
b[7] = add64(t, Sigma0(a[0]), Maj(a[0], a[1], a[2]));
b[3] = add64(b[3], t);
for (j = 0; j < 8; j++) a[(j+1)%8] = b[j];
if (i%16 === 15) {
for (j = 0; j < 16; j++) {
w[j] = add64(w[j], w[(j+9)%16], sigma0(w[(j+1)%16]), sigma1(w[(j+14)%16]));
}
}
}
for (i = 0; i < 8; i++) {
a[i] = add64(a[i], z[i]);
z[i] = a[i];
}
pos += 128;
n -= 128;
}
for (i = 0; i < 8; i++) ts64(x, 8*i, z[i]);
return n;
}
var iv = new Uint8Array([
0x6a,0x09,0xe6,0x67,0xf3,0xbc,0xc9,0x08,
0xbb,0x67,0xae,0x85,0x84,0xca,0xa7,0x3b,
0x3c,0x6e,0xf3,0x72,0xfe,0x94,0xf8,0x2b,
0xa5,0x4f,0xf5,0x3a,0x5f,0x1d,0x36,0xf1,
0x51,0x0e,0x52,0x7f,0xad,0xe6,0x82,0xd1,
0x9b,0x05,0x68,0x8c,0x2b,0x3e,0x6c,0x1f,
0x1f,0x83,0xd9,0xab,0xfb,0x41,0xbd,0x6b,
0x5b,0xe0,0xcd,0x19,0x13,0x7e,0x21,0x79
]);
function crypto_hash(out, m, n) {
var h = new Uint8Array(64), x = new Uint8Array(256);
var i, b = n;
for (i = 0; i < 64; i++) h[i] = iv[i];
crypto_hashblocks(h, m, n);
n %= 128;
for (i = 0; i < 256; i++) x[i] = 0;
for (i = 0; i < n; i++) x[i] = m[b-n+i];
x[n] = 128;
n = 256-128*(n<112?1:0);
x[n-9] = 0;
ts64(x, n-8, new u64((b / 0x20000000) | 0, b << 3));
crypto_hashblocks(h, x, n);
for (i = 0; i < 64; i++) out[i] = h[i];
return 0;
}
function add(p, q) {
var a = gf(), b = gf(), c = gf(),
d = gf(), e = gf(), f = gf(),
g = gf(), h = gf(), t = gf();
Z(a, p[1], p[0]);
Z(t, q[1], q[0]);
M(a, a, t);
A(b, p[0], p[1]);
A(t, q[0], q[1]);
M(b, b, t);
M(c, p[3], q[3]);
M(c, c, D2);
M(d, p[2], q[2]);
A(d, d, d);
Z(e, b, a);
Z(f, d, c);
A(g, d, c);
A(h, b, a);
M(p[0], e, f);
M(p[1], h, g);
M(p[2], g, f);
M(p[3], e, h);
}
function cswap(p, q, b) {
var i;
for (i = 0; i < 4; i++) {
sel25519(p[i], q[i], b);
}
}
function pack(r, p) {
var tx = gf(), ty = gf(), zi = gf();
inv25519(zi, p[2]);
M(tx, p[0], zi);
M(ty, p[1], zi);
pack25519(r, ty);
r[31] ^= par25519(tx) << 7;
}
function scalarmult(p, q, s) {
var b, i;
set25519(p[0], gf0);
set25519(p[1], gf1);
set25519(p[2], gf1);
set25519(p[3], gf0);
for (i = 255; i >= 0; --i) {
b = (s[(i/8)|0] >> (i&7)) & 1;
cswap(p, q, b);
add(q, p);
add(p, p);
cswap(p, q, b);
}
}
function scalarbase(p, s) {
var q = [gf(), gf(), gf(), gf()];
set25519(q[0], X);
set25519(q[1], Y);
set25519(q[2], gf1);
M(q[3], X, Y);
scalarmult(p, q, s);
}
function crypto_sign_keypair(pk, sk, seeded) {
var d = new Uint8Array(64);
var p = [gf(), gf(), gf(), gf()];
var i;
if (!seeded) randombytes(sk, 32);
crypto_hash(d, sk, 32);
d[0] &= 248;
d[31] &= 127;
d[31] |= 64;
scalarbase(p, d);
pack(pk, p);
for (i = 0; i < 32; i++) sk[i+32] = pk[i];
return 0;
}
var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]);
function modL(r, x) {
var carry, i, j, k;
for (i = 63; i >= 32; --i) {
carry = 0;
for (j = i - 32, k = i - 12; j < k; ++j) {
x[j] += carry - 16 * x[i] * L[j - (i - 32)];
carry = (x[j] + 128) >> 8;
x[j] -= carry * 256;
}
x[j] += carry;
x[i] = 0;
}
carry = 0;
for (j = 0; j < 32; j++) {
x[j] += carry - (x[31] >> 4) * L[j];
carry = x[j] >> 8;
x[j] &= 255;
}
for (j = 0; j < 32; j++) x[j] -= carry * L[j];
for (i = 0; i < 32; i++) {
x[i+1] += x[i] >> 8;
r[i] = x[i] & 255;
}
}
function reduce(r) {
var x = new Float64Array(64), i;
for (i = 0; i < 64; i++) x[i] = r[i];
for (i = 0; i < 64; i++) r[i] = 0;
modL(r, x);
}
// Note: difference from C - smlen returned, not passed as argument.
function crypto_sign(sm, m, n, sk) {
var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
var i, j, x = new Float64Array(64);
var p = [gf(), gf(), gf(), gf()];
crypto_hash(d, sk, 32);
d[0] &= 248;
d[31] &= 127;
d[31] |= 64;
var smlen = n + 64;
for (i = 0; i < n; i++) sm[64 + i] = m[i];
for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
crypto_hash(r, sm.subarray(32), n+32);
reduce(r);
scalarbase(p, r);
pack(sm, p);
for (i = 32; i < 64; i++) sm[i] = sk[i];
crypto_hash(h, sm, n + 64);
reduce(h);
for (i = 0; i < 64; i++) x[i] = 0;
for (i = 0; i < 32; i++) x[i] = r[i];
for (i = 0; i < 32; i++) {
for (j = 0; j < 32; j++) {
x[i+j] += h[i] * d[j];
}
}
modL(sm.subarray(32), x);
return smlen;
}
function unpackneg(r, p) {
var t = gf(), chk = gf(), num = gf(),
den = gf(), den2 = gf(), den4 = gf(),
den6 = gf();
set25519(r[2], gf1);
unpack25519(r[1], p);
S(num, r[1]);
M(den, num, D);
Z(num, num, r[2]);
A(den, r[2], den);
S(den2, den);
S(den4, den2);
M(den6, den4, den2);
M(t, den6, num);
M(t, t, den);
pow2523(t, t);
M(t, t, num);
M(t, t, den);
M(t, t, den);
M(r[0], t, den);
S(chk, r[0]);
M(chk, chk, den);
if (neq25519(chk, num)) M(r[0], r[0], I);
S(chk, r[0]);
M(chk, chk, den);
if (neq25519(chk, num)) return -1;
if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
M(r[3], r[0], r[1]);
return 0;
}
function crypto_sign_open(m, sm, n, pk) {
var i, mlen;
var t = new Uint8Array(32), h = new Uint8Array(64);
var p = [gf(), gf(), gf(), gf()],
q = [gf(), gf(), gf(), gf()];
mlen = -1;
if (n < 64) return -1;
if (unpackneg(q, pk)) return -1;
for (i = 0; i < n; i++) m[i] = sm[i];
for (i = 0; i < 32; i++) m[i+32] = pk[i];
crypto_hash(h, m, n);
reduce(h);
scalarmult(p, q, h);
scalarbase(q, sm.subarray(32));
add(p, q);
pack(t, p);
n -= 64;
if (crypto_verify_32(sm, 0, t, 0)) {
for (i = 0; i < n; i++) m[i] = 0;
return -1;
}
for (i = 0; i < n; i++) m[i] = sm[i + 64];
mlen = n;
return mlen;
}
var crypto_secretbox_KEYBYTES = 32,
crypto_secretbox_NONCEBYTES = 24,
crypto_secretbox_ZEROBYTES = 32,
crypto_secretbox_BOXZEROBYTES = 16,
crypto_scalarmult_BYTES = 32,
crypto_scalarmult_SCALARBYTES = 32,
crypto_box_PUBLICKEYBYTES = 32,
crypto_box_SECRETKEYBYTES = 32,
crypto_box_BEFORENMBYTES = 32,
crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
crypto_sign_BYTES = 64,
crypto_sign_PUBLICKEYBYTES = 32,
crypto_sign_SECRETKEYBYTES = 64,
crypto_sign_SEEDBYTES = 32,
crypto_hash_BYTES = 64;
nacl.lowlevel = {
crypto_core_hsalsa20: crypto_core_hsalsa20,
crypto_stream_xor: crypto_stream_xor,
crypto_stream: crypto_stream,
crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
crypto_stream_salsa20: crypto_stream_salsa20,
crypto_onetimeauth: crypto_onetimeauth,
crypto_onetimeauth_verify: crypto_onetimeauth_verify,
crypto_verify_16: crypto_verify_16,
crypto_verify_32: crypto_verify_32,
crypto_secretbox: crypto_secretbox,
crypto_secretbox_open: crypto_secretbox_open,
crypto_scalarmult: crypto_scalarmult,
crypto_scalarmult_base: crypto_scalarmult_base,
crypto_box_beforenm: crypto_box_beforenm,
crypto_box_afternm: crypto_box_afternm,
crypto_box: crypto_box,
crypto_box_open: crypto_box_open,
crypto_box_keypair: crypto_box_keypair,
crypto_hash: crypto_hash,
crypto_sign: crypto_sign,
crypto_sign_keypair: crypto_sign_keypair,
crypto_sign_open: crypto_sign_open,
crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
crypto_sign_BYTES: crypto_sign_BYTES,
crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
crypto_hash_BYTES: crypto_hash_BYTES
};
/* High-level API */
function checkLengths(k, n) {
if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
}
function checkBoxLengths(pk, sk) {
if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
}
function checkArrayTypes() {
for (var i = 0; i < arguments.length; i++) {
if (!(arguments[i] instanceof Uint8Array))
throw new TypeError('unexpected type, use Uint8Array');
}
}
function cleanup(arr) {
for (var i = 0; i < arr.length; i++) arr[i] = 0;
}
nacl.randomBytes = function(n) {
var b = new Uint8Array(n);
randombytes(b, n);
return b;
};
nacl.secretbox = function(msg, nonce, key) {
checkArrayTypes(msg, nonce, key);
checkLengths(key, nonce);
var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
var c = new Uint8Array(m.length);
for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
crypto_secretbox(c, m, m.length, nonce, key);
return c.subarray(crypto_secretbox_BOXZEROBYTES);
};
nacl.secretbox.open = function(box, nonce, key) {
checkArrayTypes(box, nonce, key);
checkLengths(key, nonce);
var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
var m = new Uint8Array(c.length);
for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
if (c.length < 32) return null;
if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
return m.subarray(crypto_secretbox_ZEROBYTES);
};
nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
nacl.scalarMult = function(n, p) {
checkArrayTypes(n, p);
if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
var q = new Uint8Array(crypto_scalarmult_BYTES);
crypto_scalarmult(q, n, p);
return q;
};
nacl.scalarMult.base = function(n) {
checkArrayTypes(n);
if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
var q = new Uint8Array(crypto_scalarmult_BYTES);
crypto_scalarmult_base(q, n);
return q;
};
nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
nacl.box = function(msg, nonce, publicKey, secretKey) {
var k = nacl.box.before(publicKey, secretKey);
return nacl.secretbox(msg, nonce, k);
};
nacl.box.before = function(publicKey, secretKey) {
checkArrayTypes(publicKey, secretKey);
checkBoxLengths(publicKey, secretKey);
var k = new Uint8Array(crypto_box_BEFORENMBYTES);
crypto_box_beforenm(k, publicKey, secretKey);
return k;
};
nacl.box.after = nacl.secretbox;
nacl.box.open = function(msg, nonce, publicKey, secretKey) {
var k = nacl.box.before(publicKey, secretKey);
return nacl.secretbox.open(msg, nonce, k);
};
nacl.box.open.after = nacl.secretbox.open;
nacl.box.keyPair = function() {
var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
crypto_box_keypair(pk, sk);
return {publicKey: pk, secretKey: sk};
};
nacl.box.keyPair.fromSecretKey = function(secretKey) {
checkArrayTypes(secretKey);
if (secretKey.length !== crypto_box_SECRETKEYBYTES)
throw new Error('bad secret key size');
var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
crypto_scalarmult_base(pk, secretKey);
return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
};
nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
nacl.box.nonceLength = crypto_box_NONCEBYTES;
nacl.box.overheadLength = nacl.secretbox.overheadLength;
nacl.sign = function(msg, secretKey) {
checkArrayTypes(msg, secretKey);
if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
throw new Error('bad secret key size');
var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
crypto_sign(signedMsg, msg, msg.length, secretKey);
return signedMsg;
};
nacl.sign.open = function(signedMsg, publicKey) {
checkArrayTypes(signedMsg, publicKey);
if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
throw new Error('bad public key size');
var tmp = new Uint8Array(signedMsg.length);
var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
if (mlen < 0) return null;
var m = new Uint8Array(mlen);
for (var i = 0; i < m.length; i++) m[i] = tmp[i];
return m;
};
nacl.sign.detached = function(msg, secretKey) {
var signedMsg = nacl.sign(msg, secretKey);
var sig = new Uint8Array(crypto_sign_BYTES);
for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
return sig;
};
nacl.sign.detached.verify = function(msg, sig, publicKey) {
checkArrayTypes(msg, sig, publicKey);
if (sig.length !== crypto_sign_BYTES)
throw new Error('bad signature size');
if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
throw new Error('bad public key size');
var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
var m = new Uint8Array(crypto_sign_BYTES + msg.length);
var i;
for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
};
nacl.sign.keyPair = function() {
var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
crypto_sign_keypair(pk, sk);
return {publicKey: pk, secretKey: sk};
};
nacl.sign.keyPair.fromSecretKey = function(secretKey) {
checkArrayTypes(secretKey);
if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
throw new Error('bad secret key size');
var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
};
nacl.sign.keyPair.fromSeed = function(seed) {
checkArrayTypes(seed);
if (seed.length !== crypto_sign_SEEDBYTES)
throw new Error('bad seed size');
var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
for (var i = 0; i < 32; i++) sk[i] = seed[i];
crypto_sign_keypair(pk, sk, true);
return {publicKey: pk, secretKey: sk};
};
nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
nacl.sign.seedLength = crypto_sign_SEEDBYTES;
nacl.sign.signatureLength = crypto_sign_BYTES;
nacl.hash = function(msg) {
checkArrayTypes(msg);
var h = new Uint8Array(crypto_hash_BYTES);
crypto_hash(h, msg, msg.length);
return h;
};
nacl.hash.hashLength = crypto_hash_BYTES;
nacl.verify = function(x, y) {
checkArrayTypes(x, y);
// Zero length arguments are considered not equal.
if (x.length === 0 || y.length === 0) return false;
if (x.length !== y.length) return false;
return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
};
nacl.setPRNG = function(fn) {
randombytes = fn;
};
(function() {
// Initialize PRNG if environment provides CSPRNG.
// If not, methods calling randombytes will throw.
var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
if (crypto && crypto.getRandomValues) {
// Browsers.
var QUOTA = 65536;
nacl.setPRNG(function(x, n) {
var i, v = new Uint8Array(n);
for (i = 0; i < n; i += QUOTA) {
crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
}
for (i = 0; i < n; i++) x[i] = v[i];
cleanup(v);
});
} else if (typeof require !== 'undefined') {
// Node.js.
crypto = require('crypto');
if (crypto && crypto.randomBytes) {
nacl.setPRNG(function(x, n) {
var i, v = crypto.randomBytes(n);
for (i = 0; i < n; i++) x[i] = v[i];
cleanup(v);
});
}
}
})();
})(typeof module !== 'undefined' && module.exports ? module.exports : (self._nacl = self._nacl || {}));
""")
__pragma__("js", "{}","""
export const api = self._nacl;
""")
|
__pragma__('js', '{}', '\n(function(nacl) {\n\'use strict\';\n\n// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.\n// Public domain.\n//\n// Implementation derived from TweetNaCl version 20140427.\n// See for details: http://tweetnacl.cr.yp.to/\n\nvar u64 = function(h, l) { this.hi = h|0 >>> 0; this.lo = l|0 >>> 0; };\nvar gf = function(init) {\n var i, r = new Float64Array(16);\n if (init) for (i = 0; i < init.length; i++) r[i] = init[i];\n return r;\n};\n\n// Pluggable, initialized in high-level API below.\nvar randombytes = function(/* x, n */) { throw new Error(\'no PRNG\'); };\n\nvar _0 = new Uint8Array(16);\nvar _9 = new Uint8Array(32); _9[0] = 9;\n\nvar gf0 = gf(),\n gf1 = gf([1]),\n _121665 = gf([0xdb41, 1]),\n D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),\n D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),\n X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),\n Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),\n I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);\n\nfunction L32(x, c) { return (x << c) | (x >>> (32 - c)); }\n\nfunction ld32(x, i) {\n var u = x[i+3] & 0xff;\n u = (u<<8)|(x[i+2] & 0xff);\n u = (u<<8)|(x[i+1] & 0xff);\n return (u<<8)|(x[i+0] & 0xff);\n}\n\nfunction dl64(x, i) {\n var h = (x[i] << 24) | (x[i+1] << 16) | (x[i+2] << 8) | x[i+3];\n var l = (x[i+4] << 24) | (x[i+5] << 16) | (x[i+6] << 8) | x[i+7];\n return new u64(h, l);\n}\n\nfunction st32(x, j, u) {\n var i;\n for (i = 0; i < 4; i++) { x[j+i] = u & 255; u >>>= 8; }\n}\n\nfunction ts64(x, i, u) {\n x[i] = (u.hi >> 24) & 0xff;\n x[i+1] = (u.hi >> 16) & 0xff;\n x[i+2] = (u.hi >> 8) & 0xff;\n x[i+3] = u.hi & 0xff;\n x[i+4] = (u.lo >> 24) & 0xff;\n x[i+5] = (u.lo >> 16) & 0xff;\n x[i+6] = (u.lo >> 8) & 0xff;\n x[i+7] = u.lo & 0xff;\n}\n\nfunction vn(x, xi, y, yi, n) {\n var i,d = 0;\n for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];\n return (1 & ((d - 1) >>> 8)) - 1;\n}\n\nfunction crypto_verify_16(x, xi, y, yi) {\n return vn(x,xi,y,yi,16);\n}\n\nfunction crypto_verify_32(x, xi, y, yi) {\n return vn(x,xi,y,yi,32);\n}\n\nfunction core(out,inp,k,c,h) {\n var w = new Uint32Array(16), x = new Uint32Array(16),\n y = new Uint32Array(16), t = new Uint32Array(4);\n var i, j, m;\n\n for (i = 0; i < 4; i++) {\n x[5*i] = ld32(c, 4*i);\n x[1+i] = ld32(k, 4*i);\n x[6+i] = ld32(inp, 4*i);\n x[11+i] = ld32(k, 16+4*i);\n }\n\n for (i = 0; i < 16; i++) y[i] = x[i];\n\n for (i = 0; i < 20; i++) {\n for (j = 0; j < 4; j++) {\n for (m = 0; m < 4; m++) t[m] = x[(5*j+4*m)%16];\n t[1] ^= L32((t[0]+t[3])|0, 7);\n t[2] ^= L32((t[1]+t[0])|0, 9);\n t[3] ^= L32((t[2]+t[1])|0,13);\n t[0] ^= L32((t[3]+t[2])|0,18);\n for (m = 0; m < 4; m++) w[4*j+(j+m)%4] = t[m];\n }\n for (m = 0; m < 16; m++) x[m] = w[m];\n }\n\n if (h) {\n for (i = 0; i < 16; i++) x[i] = (x[i] + y[i]) | 0;\n for (i = 0; i < 4; i++) {\n x[5*i] = (x[5*i] - ld32(c, 4*i)) | 0;\n x[6+i] = (x[6+i] - ld32(inp, 4*i)) | 0;\n }\n for (i = 0; i < 4; i++) {\n st32(out,4*i,x[5*i]);\n st32(out,16+4*i,x[6+i]);\n }\n } else {\n for (i = 0; i < 16; i++) st32(out, 4 * i, (x[i] + y[i]) | 0);\n }\n}\n\nfunction crypto_core_salsa20(out,inp,k,c) {\n core(out,inp,k,c,false);\n return 0;\n}\n\nfunction crypto_core_hsalsa20(out,inp,k,c) {\n core(out,inp,k,c,true);\n return 0;\n}\n\nvar sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);\n // "expand 32-byte k"\n\nfunction crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {\n var z = new Uint8Array(16), x = new Uint8Array(64);\n var u, i;\n if (!b) return 0;\n for (i = 0; i < 16; i++) z[i] = 0;\n for (i = 0; i < 8; i++) z[i] = n[i];\n while (b >= 64) {\n crypto_core_salsa20(x,z,k,sigma);\n for (i = 0; i < 64; i++) c[cpos+i] = (m?m[mpos+i]:0) ^ x[i];\n u = 1;\n for (i = 8; i < 16; i++) {\n u = u + (z[i] & 0xff) | 0;\n z[i] = u & 0xff;\n u >>>= 8;\n }\n b -= 64;\n cpos += 64;\n if (m) mpos += 64;\n }\n if (b > 0) {\n crypto_core_salsa20(x,z,k,sigma);\n for (i = 0; i < b; i++) c[cpos+i] = (m?m[mpos+i]:0) ^ x[i];\n }\n return 0;\n}\n\nfunction crypto_stream_salsa20(c,cpos,d,n,k) {\n return crypto_stream_salsa20_xor(c,cpos,null,0,d,n,k);\n}\n\nfunction crypto_stream(c,cpos,d,n,k) {\n var s = new Uint8Array(32);\n crypto_core_hsalsa20(s,n,k,sigma);\n return crypto_stream_salsa20(c,cpos,d,n.subarray(16),s);\n}\n\nfunction crypto_stream_xor(c,cpos,m,mpos,d,n,k) {\n var s = new Uint8Array(32);\n crypto_core_hsalsa20(s,n,k,sigma);\n return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,n.subarray(16),s);\n}\n\nfunction add1305(h, c) {\n var j, u = 0;\n for (j = 0; j < 17; j++) {\n u = (u + ((h[j] + c[j]) | 0)) | 0;\n h[j] = u & 255;\n u >>>= 8;\n }\n}\n\nvar minusp = new Uint32Array([\n 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252\n]);\n\nfunction crypto_onetimeauth(out, outpos, m, mpos, n, k) {\n var s, i, j, u;\n var x = new Uint32Array(17), r = new Uint32Array(17),\n h = new Uint32Array(17), c = new Uint32Array(17),\n g = new Uint32Array(17);\n for (j = 0; j < 17; j++) r[j]=h[j]=0;\n for (j = 0; j < 16; j++) r[j]=k[j];\n r[3]&=15;\n r[4]&=252;\n r[7]&=15;\n r[8]&=252;\n r[11]&=15;\n r[12]&=252;\n r[15]&=15;\n\n while (n > 0) {\n for (j = 0; j < 17; j++) c[j] = 0;\n for (j = 0; (j < 16) && (j < n); ++j) c[j] = m[mpos+j];\n c[j] = 1;\n mpos += j; n -= j;\n add1305(h,c);\n for (i = 0; i < 17; i++) {\n x[i] = 0;\n for (j = 0; j < 17; j++) x[i] = (x[i] + (h[j] * ((j <= i) ? r[i - j] : ((320 * r[i + 17 - j])|0))) | 0) | 0;\n }\n for (i = 0; i < 17; i++) h[i] = x[i];\n u = 0;\n for (j = 0; j < 16; j++) {\n u = (u + h[j]) | 0;\n h[j] = u & 255;\n u >>>= 8;\n }\n u = (u + h[16]) | 0; h[16] = u & 3;\n u = (5 * (u >>> 2)) | 0;\n for (j = 0; j < 16; j++) {\n u = (u + h[j]) | 0;\n h[j] = u & 255;\n u >>>= 8;\n }\n u = (u + h[16]) | 0; h[16] = u;\n }\n\n for (j = 0; j < 17; j++) g[j] = h[j];\n add1305(h,minusp);\n s = (-(h[16] >>> 7) | 0);\n for (j = 0; j < 17; j++) h[j] ^= s & (g[j] ^ h[j]);\n\n for (j = 0; j < 16; j++) c[j] = k[j + 16];\n c[16] = 0;\n add1305(h,c);\n for (j = 0; j < 16; j++) out[outpos+j] = h[j];\n return 0;\n}\n\nfunction crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {\n var x = new Uint8Array(16);\n crypto_onetimeauth(x,0,m,mpos,n,k);\n return crypto_verify_16(h,hpos,x,0);\n}\n\nfunction crypto_secretbox(c,m,d,n,k) {\n var i;\n if (d < 32) return -1;\n crypto_stream_xor(c,0,m,0,d,n,k);\n crypto_onetimeauth(c, 16, c, 32, d - 32, c);\n for (i = 0; i < 16; i++) c[i] = 0;\n return 0;\n}\n\nfunction crypto_secretbox_open(m,c,d,n,k) {\n var i;\n var x = new Uint8Array(32);\n if (d < 32) return -1;\n crypto_stream(x,0,32,n,k);\n if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;\n crypto_stream_xor(m,0,c,0,d,n,k);\n for (i = 0; i < 32; i++) m[i] = 0;\n return 0;\n}\n\nfunction set25519(r, a) {\n var i;\n for (i = 0; i < 16; i++) r[i] = a[i]|0;\n}\n\nfunction car25519(o) {\n var c;\n var i;\n for (i = 0; i < 16; i++) {\n o[i] += 65536;\n c = Math.floor(o[i] / 65536);\n o[(i+1)*(i<15?1:0)] += c - 1 + 37 * (c-1) * (i===15?1:0);\n o[i] -= (c * 65536);\n }\n}\n\nfunction sel25519(p, q, b) {\n var t, c = ~(b-1);\n for (var i = 0; i < 16; i++) {\n t = c & (p[i] ^ q[i]);\n p[i] ^= t;\n q[i] ^= t;\n }\n}\n\nfunction pack25519(o, n) {\n var i, j, b;\n var m = gf(), t = gf();\n for (i = 0; i < 16; i++) t[i] = n[i];\n car25519(t);\n car25519(t);\n car25519(t);\n for (j = 0; j < 2; j++) {\n m[0] = t[0] - 0xffed;\n for (i = 1; i < 15; i++) {\n m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);\n m[i-1] &= 0xffff;\n }\n m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);\n b = (m[15]>>16) & 1;\n m[14] &= 0xffff;\n sel25519(t, m, 1-b);\n }\n for (i = 0; i < 16; i++) {\n o[2*i] = t[i] & 0xff;\n o[2*i+1] = t[i]>>8;\n }\n}\n\nfunction neq25519(a, b) {\n var c = new Uint8Array(32), d = new Uint8Array(32);\n pack25519(c, a);\n pack25519(d, b);\n return crypto_verify_32(c, 0, d, 0);\n}\n\nfunction par25519(a) {\n var d = new Uint8Array(32);\n pack25519(d, a);\n return d[0] & 1;\n}\n\nfunction unpack25519(o, n) {\n var i;\n for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);\n o[15] &= 0x7fff;\n}\n\nfunction A(o, a, b) {\n var i;\n for (i = 0; i < 16; i++) o[i] = (a[i] + b[i])|0;\n}\n\nfunction Z(o, a, b) {\n var i;\n for (i = 0; i < 16; i++) o[i] = (a[i] - b[i])|0;\n}\n\nfunction M(o, a, b) {\n var i, j, t = new Float64Array(31);\n for (i = 0; i < 31; i++) t[i] = 0;\n for (i = 0; i < 16; i++) {\n for (j = 0; j < 16; j++) {\n t[i+j] += a[i] * b[j];\n }\n }\n for (i = 0; i < 15; i++) {\n t[i] += 38 * t[i+16];\n }\n for (i = 0; i < 16; i++) o[i] = t[i];\n car25519(o);\n car25519(o);\n}\n\nfunction S(o, a) {\n M(o, a, a);\n}\n\nfunction inv25519(o, i) {\n var c = gf();\n var a;\n for (a = 0; a < 16; a++) c[a] = i[a];\n for (a = 253; a >= 0; a--) {\n S(c, c);\n if(a !== 2 && a !== 4) M(c, c, i);\n }\n for (a = 0; a < 16; a++) o[a] = c[a];\n}\n\nfunction pow2523(o, i) {\n var c = gf();\n var a;\n for (a = 0; a < 16; a++) c[a] = i[a];\n for (a = 250; a >= 0; a--) {\n S(c, c);\n if(a !== 1) M(c, c, i);\n }\n for (a = 0; a < 16; a++) o[a] = c[a];\n}\n\nfunction crypto_scalarmult(q, n, p) {\n var z = new Uint8Array(32);\n var x = new Float64Array(80), r, i;\n var a = gf(), b = gf(), c = gf(),\n d = gf(), e = gf(), f = gf();\n for (i = 0; i < 31; i++) z[i] = n[i];\n z[31]=(n[31]&127)|64;\n z[0]&=248;\n unpack25519(x,p);\n for (i = 0; i < 16; i++) {\n b[i]=x[i];\n d[i]=a[i]=c[i]=0;\n }\n a[0]=d[0]=1;\n for (i=254; i>=0; --i) {\n r=(z[i>>>3]>>>(i&7))&1;\n sel25519(a,b,r);\n sel25519(c,d,r);\n A(e,a,c);\n Z(a,a,c);\n A(c,b,d);\n Z(b,b,d);\n S(d,e);\n S(f,a);\n M(a,c,a);\n M(c,b,e);\n A(e,a,c);\n Z(a,a,c);\n S(b,a);\n Z(c,d,f);\n M(a,c,_121665);\n A(a,a,d);\n M(c,c,a);\n M(a,d,f);\n M(d,b,x);\n S(b,e);\n sel25519(a,b,r);\n sel25519(c,d,r);\n }\n for (i = 0; i < 16; i++) {\n x[i+16]=a[i];\n x[i+32]=c[i];\n x[i+48]=b[i];\n x[i+64]=d[i];\n }\n var x32 = x.subarray(32);\n var x16 = x.subarray(16);\n inv25519(x32,x32);\n M(x16,x16,x32);\n pack25519(q,x16);\n return 0;\n}\n\nfunction crypto_scalarmult_base(q, n) {\n return crypto_scalarmult(q, n, _9);\n}\n\nfunction crypto_box_keypair(y, x) {\n randombytes(x, 32);\n return crypto_scalarmult_base(y, x);\n}\n\nfunction crypto_box_beforenm(k, y, x) {\n var s = new Uint8Array(32);\n crypto_scalarmult(s, x, y);\n return crypto_core_hsalsa20(k, _0, s, sigma);\n}\n\nvar crypto_box_afternm = crypto_secretbox;\nvar crypto_box_open_afternm = crypto_secretbox_open;\n\nfunction crypto_box(c, m, d, n, y, x) {\n var k = new Uint8Array(32);\n crypto_box_beforenm(k, y, x);\n return crypto_box_afternm(c, m, d, n, k);\n}\n\nfunction crypto_box_open(m, c, d, n, y, x) {\n var k = new Uint8Array(32);\n crypto_box_beforenm(k, y, x);\n return crypto_box_open_afternm(m, c, d, n, k);\n}\n\nfunction add64() {\n var a = 0, b = 0, c = 0, d = 0, m16 = 65535, l, h, i;\n for (i = 0; i < arguments.length; i++) {\n l = arguments[i].lo;\n h = arguments[i].hi;\n a += (l & m16); b += (l >>> 16);\n c += (h & m16); d += (h >>> 16);\n }\n\n b += (a >>> 16);\n c += (b >>> 16);\n d += (c >>> 16);\n\n return new u64((c & m16) | (d << 16), (a & m16) | (b << 16));\n}\n\nfunction shr64(x, c) {\n return new u64((x.hi >>> c), (x.lo >>> c) | (x.hi << (32 - c)));\n}\n\nfunction xor64() {\n var l = 0, h = 0, i;\n for (i = 0; i < arguments.length; i++) {\n l ^= arguments[i].lo;\n h ^= arguments[i].hi;\n }\n return new u64(h, l);\n}\n\nfunction R(x, c) {\n var h, l, c1 = 32 - c;\n if (c < 32) {\n h = (x.hi >>> c) | (x.lo << c1);\n l = (x.lo >>> c) | (x.hi << c1);\n } else if (c < 64) {\n h = (x.lo >>> c) | (x.hi << c1);\n l = (x.hi >>> c) | (x.lo << c1);\n }\n return new u64(h, l);\n}\n\nfunction Ch(x, y, z) {\n var h = (x.hi & y.hi) ^ (~x.hi & z.hi),\n l = (x.lo & y.lo) ^ (~x.lo & z.lo);\n return new u64(h, l);\n}\n\nfunction Maj(x, y, z) {\n var h = (x.hi & y.hi) ^ (x.hi & z.hi) ^ (y.hi & z.hi),\n l = (x.lo & y.lo) ^ (x.lo & z.lo) ^ (y.lo & z.lo);\n return new u64(h, l);\n}\n\nfunction Sigma0(x) { return xor64(R(x,28), R(x,34), R(x,39)); }\nfunction Sigma1(x) { return xor64(R(x,14), R(x,18), R(x,41)); }\nfunction sigma0(x) { return xor64(R(x, 1), R(x, 8), shr64(x,7)); }\nfunction sigma1(x) { return xor64(R(x,19), R(x,61), shr64(x,6)); }\n\nvar K = [\n new u64(0x428a2f98, 0xd728ae22), new u64(0x71374491, 0x23ef65cd),\n new u64(0xb5c0fbcf, 0xec4d3b2f), new u64(0xe9b5dba5, 0x8189dbbc),\n new u64(0x3956c25b, 0xf348b538), new u64(0x59f111f1, 0xb605d019),\n new u64(0x923f82a4, 0xaf194f9b), new u64(0xab1c5ed5, 0xda6d8118),\n new u64(0xd807aa98, 0xa3030242), new u64(0x12835b01, 0x45706fbe),\n new u64(0x243185be, 0x4ee4b28c), new u64(0x550c7dc3, 0xd5ffb4e2),\n new u64(0x72be5d74, 0xf27b896f), new u64(0x80deb1fe, 0x3b1696b1),\n new u64(0x9bdc06a7, 0x25c71235), new u64(0xc19bf174, 0xcf692694),\n new u64(0xe49b69c1, 0x9ef14ad2), new u64(0xefbe4786, 0x384f25e3),\n new u64(0x0fc19dc6, 0x8b8cd5b5), new u64(0x240ca1cc, 0x77ac9c65),\n new u64(0x2de92c6f, 0x592b0275), new u64(0x4a7484aa, 0x6ea6e483),\n new u64(0x5cb0a9dc, 0xbd41fbd4), new u64(0x76f988da, 0x831153b5),\n new u64(0x983e5152, 0xee66dfab), new u64(0xa831c66d, 0x2db43210),\n new u64(0xb00327c8, 0x98fb213f), new u64(0xbf597fc7, 0xbeef0ee4),\n new u64(0xc6e00bf3, 0x3da88fc2), new u64(0xd5a79147, 0x930aa725),\n new u64(0x06ca6351, 0xe003826f), new u64(0x14292967, 0x0a0e6e70),\n new u64(0x27b70a85, 0x46d22ffc), new u64(0x2e1b2138, 0x5c26c926),\n new u64(0x4d2c6dfc, 0x5ac42aed), new u64(0x53380d13, 0x9d95b3df),\n new u64(0x650a7354, 0x8baf63de), new u64(0x766a0abb, 0x3c77b2a8),\n new u64(0x81c2c92e, 0x47edaee6), new u64(0x92722c85, 0x1482353b),\n new u64(0xa2bfe8a1, 0x4cf10364), new u64(0xa81a664b, 0xbc423001),\n new u64(0xc24b8b70, 0xd0f89791), new u64(0xc76c51a3, 0x0654be30),\n new u64(0xd192e819, 0xd6ef5218), new u64(0xd6990624, 0x5565a910),\n new u64(0xf40e3585, 0x5771202a), new u64(0x106aa070, 0x32bbd1b8),\n new u64(0x19a4c116, 0xb8d2d0c8), new u64(0x1e376c08, 0x5141ab53),\n new u64(0x2748774c, 0xdf8eeb99), new u64(0x34b0bcb5, 0xe19b48a8),\n new u64(0x391c0cb3, 0xc5c95a63), new u64(0x4ed8aa4a, 0xe3418acb),\n new u64(0x5b9cca4f, 0x7763e373), new u64(0x682e6ff3, 0xd6b2b8a3),\n new u64(0x748f82ee, 0x5defb2fc), new u64(0x78a5636f, 0x43172f60),\n new u64(0x84c87814, 0xa1f0ab72), new u64(0x8cc70208, 0x1a6439ec),\n new u64(0x90befffa, 0x23631e28), new u64(0xa4506ceb, 0xde82bde9),\n new u64(0xbef9a3f7, 0xb2c67915), new u64(0xc67178f2, 0xe372532b),\n new u64(0xca273ece, 0xea26619c), new u64(0xd186b8c7, 0x21c0c207),\n new u64(0xeada7dd6, 0xcde0eb1e), new u64(0xf57d4f7f, 0xee6ed178),\n new u64(0x06f067aa, 0x72176fba), new u64(0x0a637dc5, 0xa2c898a6),\n new u64(0x113f9804, 0xbef90dae), new u64(0x1b710b35, 0x131c471b),\n new u64(0x28db77f5, 0x23047d84), new u64(0x32caab7b, 0x40c72493),\n new u64(0x3c9ebe0a, 0x15c9bebc), new u64(0x431d67c4, 0x9c100d4c),\n new u64(0x4cc5d4be, 0xcb3e42b6), new u64(0x597f299c, 0xfc657e2a),\n new u64(0x5fcb6fab, 0x3ad6faec), new u64(0x6c44198c, 0x4a475817)\n];\n\nfunction crypto_hashblocks(x, m, n) {\n var z = [], b = [], a = [], w = [], t, i, j;\n\n for (i = 0; i < 8; i++) z[i] = a[i] = dl64(x, 8*i);\n\n var pos = 0;\n while (n >= 128) {\n for (i = 0; i < 16; i++) w[i] = dl64(m, 8*i+pos);\n for (i = 0; i < 80; i++) {\n for (j = 0; j < 8; j++) b[j] = a[j];\n t = add64(a[7], Sigma1(a[4]), Ch(a[4], a[5], a[6]), K[i], w[i%16]);\n b[7] = add64(t, Sigma0(a[0]), Maj(a[0], a[1], a[2]));\n b[3] = add64(b[3], t);\n for (j = 0; j < 8; j++) a[(j+1)%8] = b[j];\n if (i%16 === 15) {\n for (j = 0; j < 16; j++) {\n w[j] = add64(w[j], w[(j+9)%16], sigma0(w[(j+1)%16]), sigma1(w[(j+14)%16]));\n }\n }\n }\n\n for (i = 0; i < 8; i++) {\n a[i] = add64(a[i], z[i]);\n z[i] = a[i];\n }\n\n pos += 128;\n n -= 128;\n }\n\n for (i = 0; i < 8; i++) ts64(x, 8*i, z[i]);\n return n;\n}\n\nvar iv = new Uint8Array([\n 0x6a,0x09,0xe6,0x67,0xf3,0xbc,0xc9,0x08,\n 0xbb,0x67,0xae,0x85,0x84,0xca,0xa7,0x3b,\n 0x3c,0x6e,0xf3,0x72,0xfe,0x94,0xf8,0x2b,\n 0xa5,0x4f,0xf5,0x3a,0x5f,0x1d,0x36,0xf1,\n 0x51,0x0e,0x52,0x7f,0xad,0xe6,0x82,0xd1,\n 0x9b,0x05,0x68,0x8c,0x2b,0x3e,0x6c,0x1f,\n 0x1f,0x83,0xd9,0xab,0xfb,0x41,0xbd,0x6b,\n 0x5b,0xe0,0xcd,0x19,0x13,0x7e,0x21,0x79\n]);\n\nfunction crypto_hash(out, m, n) {\n var h = new Uint8Array(64), x = new Uint8Array(256);\n var i, b = n;\n\n for (i = 0; i < 64; i++) h[i] = iv[i];\n\n crypto_hashblocks(h, m, n);\n n %= 128;\n\n for (i = 0; i < 256; i++) x[i] = 0;\n for (i = 0; i < n; i++) x[i] = m[b-n+i];\n x[n] = 128;\n\n n = 256-128*(n<112?1:0);\n x[n-9] = 0;\n ts64(x, n-8, new u64((b / 0x20000000) | 0, b << 3));\n crypto_hashblocks(h, x, n);\n\n for (i = 0; i < 64; i++) out[i] = h[i];\n\n return 0;\n}\n\nfunction add(p, q) {\n var a = gf(), b = gf(), c = gf(),\n d = gf(), e = gf(), f = gf(),\n g = gf(), h = gf(), t = gf();\n\n Z(a, p[1], p[0]);\n Z(t, q[1], q[0]);\n M(a, a, t);\n A(b, p[0], p[1]);\n A(t, q[0], q[1]);\n M(b, b, t);\n M(c, p[3], q[3]);\n M(c, c, D2);\n M(d, p[2], q[2]);\n A(d, d, d);\n Z(e, b, a);\n Z(f, d, c);\n A(g, d, c);\n A(h, b, a);\n\n M(p[0], e, f);\n M(p[1], h, g);\n M(p[2], g, f);\n M(p[3], e, h);\n}\n\nfunction cswap(p, q, b) {\n var i;\n for (i = 0; i < 4; i++) {\n sel25519(p[i], q[i], b);\n }\n}\n\nfunction pack(r, p) {\n var tx = gf(), ty = gf(), zi = gf();\n inv25519(zi, p[2]);\n M(tx, p[0], zi);\n M(ty, p[1], zi);\n pack25519(r, ty);\n r[31] ^= par25519(tx) << 7;\n}\n\nfunction scalarmult(p, q, s) {\n var b, i;\n set25519(p[0], gf0);\n set25519(p[1], gf1);\n set25519(p[2], gf1);\n set25519(p[3], gf0);\n for (i = 255; i >= 0; --i) {\n b = (s[(i/8)|0] >> (i&7)) & 1;\n cswap(p, q, b);\n add(q, p);\n add(p, p);\n cswap(p, q, b);\n }\n}\n\nfunction scalarbase(p, s) {\n var q = [gf(), gf(), gf(), gf()];\n set25519(q[0], X);\n set25519(q[1], Y);\n set25519(q[2], gf1);\n M(q[3], X, Y);\n scalarmult(p, q, s);\n}\n\nfunction crypto_sign_keypair(pk, sk, seeded) {\n var d = new Uint8Array(64);\n var p = [gf(), gf(), gf(), gf()];\n var i;\n\n if (!seeded) randombytes(sk, 32);\n crypto_hash(d, sk, 32);\n d[0] &= 248;\n d[31] &= 127;\n d[31] |= 64;\n\n scalarbase(p, d);\n pack(pk, p);\n\n for (i = 0; i < 32; i++) sk[i+32] = pk[i];\n return 0;\n}\n\nvar L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]);\n\nfunction modL(r, x) {\n var carry, i, j, k;\n for (i = 63; i >= 32; --i) {\n carry = 0;\n for (j = i - 32, k = i - 12; j < k; ++j) {\n x[j] += carry - 16 * x[i] * L[j - (i - 32)];\n carry = (x[j] + 128) >> 8;\n x[j] -= carry * 256;\n }\n x[j] += carry;\n x[i] = 0;\n }\n carry = 0;\n for (j = 0; j < 32; j++) {\n x[j] += carry - (x[31] >> 4) * L[j];\n carry = x[j] >> 8;\n x[j] &= 255;\n }\n for (j = 0; j < 32; j++) x[j] -= carry * L[j];\n for (i = 0; i < 32; i++) {\n x[i+1] += x[i] >> 8;\n r[i] = x[i] & 255;\n }\n}\n\nfunction reduce(r) {\n var x = new Float64Array(64), i;\n for (i = 0; i < 64; i++) x[i] = r[i];\n for (i = 0; i < 64; i++) r[i] = 0;\n modL(r, x);\n}\n\n// Note: difference from C - smlen returned, not passed as argument.\nfunction crypto_sign(sm, m, n, sk) {\n var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);\n var i, j, x = new Float64Array(64);\n var p = [gf(), gf(), gf(), gf()];\n\n crypto_hash(d, sk, 32);\n d[0] &= 248;\n d[31] &= 127;\n d[31] |= 64;\n\n var smlen = n + 64;\n for (i = 0; i < n; i++) sm[64 + i] = m[i];\n for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];\n\n crypto_hash(r, sm.subarray(32), n+32);\n reduce(r);\n scalarbase(p, r);\n pack(sm, p);\n\n for (i = 32; i < 64; i++) sm[i] = sk[i];\n crypto_hash(h, sm, n + 64);\n reduce(h);\n\n for (i = 0; i < 64; i++) x[i] = 0;\n for (i = 0; i < 32; i++) x[i] = r[i];\n for (i = 0; i < 32; i++) {\n for (j = 0; j < 32; j++) {\n x[i+j] += h[i] * d[j];\n }\n }\n\n modL(sm.subarray(32), x);\n return smlen;\n}\n\nfunction unpackneg(r, p) {\n var t = gf(), chk = gf(), num = gf(),\n den = gf(), den2 = gf(), den4 = gf(),\n den6 = gf();\n\n set25519(r[2], gf1);\n unpack25519(r[1], p);\n S(num, r[1]);\n M(den, num, D);\n Z(num, num, r[2]);\n A(den, r[2], den);\n\n S(den2, den);\n S(den4, den2);\n M(den6, den4, den2);\n M(t, den6, num);\n M(t, t, den);\n\n pow2523(t, t);\n M(t, t, num);\n M(t, t, den);\n M(t, t, den);\n M(r[0], t, den);\n\n S(chk, r[0]);\n M(chk, chk, den);\n if (neq25519(chk, num)) M(r[0], r[0], I);\n\n S(chk, r[0]);\n M(chk, chk, den);\n if (neq25519(chk, num)) return -1;\n\n if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);\n\n M(r[3], r[0], r[1]);\n return 0;\n}\n\nfunction crypto_sign_open(m, sm, n, pk) {\n var i, mlen;\n var t = new Uint8Array(32), h = new Uint8Array(64);\n var p = [gf(), gf(), gf(), gf()],\n q = [gf(), gf(), gf(), gf()];\n\n mlen = -1;\n if (n < 64) return -1;\n\n if (unpackneg(q, pk)) return -1;\n\n for (i = 0; i < n; i++) m[i] = sm[i];\n for (i = 0; i < 32; i++) m[i+32] = pk[i];\n crypto_hash(h, m, n);\n reduce(h);\n scalarmult(p, q, h);\n\n scalarbase(q, sm.subarray(32));\n add(p, q);\n pack(t, p);\n\n n -= 64;\n if (crypto_verify_32(sm, 0, t, 0)) {\n for (i = 0; i < n; i++) m[i] = 0;\n return -1;\n }\n\n for (i = 0; i < n; i++) m[i] = sm[i + 64];\n mlen = n;\n return mlen;\n}\n\nvar crypto_secretbox_KEYBYTES = 32,\n crypto_secretbox_NONCEBYTES = 24,\n crypto_secretbox_ZEROBYTES = 32,\n crypto_secretbox_BOXZEROBYTES = 16,\n crypto_scalarmult_BYTES = 32,\n crypto_scalarmult_SCALARBYTES = 32,\n crypto_box_PUBLICKEYBYTES = 32,\n crypto_box_SECRETKEYBYTES = 32,\n crypto_box_BEFORENMBYTES = 32,\n crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,\n crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,\n crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,\n crypto_sign_BYTES = 64,\n crypto_sign_PUBLICKEYBYTES = 32,\n crypto_sign_SECRETKEYBYTES = 64,\n crypto_sign_SEEDBYTES = 32,\n crypto_hash_BYTES = 64;\n\nnacl.lowlevel = {\n crypto_core_hsalsa20: crypto_core_hsalsa20,\n crypto_stream_xor: crypto_stream_xor,\n crypto_stream: crypto_stream,\n crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,\n crypto_stream_salsa20: crypto_stream_salsa20,\n crypto_onetimeauth: crypto_onetimeauth,\n crypto_onetimeauth_verify: crypto_onetimeauth_verify,\n crypto_verify_16: crypto_verify_16,\n crypto_verify_32: crypto_verify_32,\n crypto_secretbox: crypto_secretbox,\n crypto_secretbox_open: crypto_secretbox_open,\n crypto_scalarmult: crypto_scalarmult,\n crypto_scalarmult_base: crypto_scalarmult_base,\n crypto_box_beforenm: crypto_box_beforenm,\n crypto_box_afternm: crypto_box_afternm,\n crypto_box: crypto_box,\n crypto_box_open: crypto_box_open,\n crypto_box_keypair: crypto_box_keypair,\n crypto_hash: crypto_hash,\n crypto_sign: crypto_sign,\n crypto_sign_keypair: crypto_sign_keypair,\n crypto_sign_open: crypto_sign_open,\n\n crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,\n crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,\n crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,\n crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,\n crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,\n crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,\n crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,\n crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,\n crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,\n crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,\n crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,\n crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,\n crypto_sign_BYTES: crypto_sign_BYTES,\n crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,\n crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,\n crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,\n crypto_hash_BYTES: crypto_hash_BYTES\n};\n\n/* High-level API */\n\nfunction checkLengths(k, n) {\n if (k.length !== crypto_secretbox_KEYBYTES) throw new Error(\'bad key size\');\n if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error(\'bad nonce size\');\n}\n\nfunction checkBoxLengths(pk, sk) {\n if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error(\'bad public key size\');\n if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error(\'bad secret key size\');\n}\n\nfunction checkArrayTypes() {\n for (var i = 0; i < arguments.length; i++) {\n if (!(arguments[i] instanceof Uint8Array))\n throw new TypeError(\'unexpected type, use Uint8Array\');\n }\n}\n\nfunction cleanup(arr) {\n for (var i = 0; i < arr.length; i++) arr[i] = 0;\n}\n\nnacl.randomBytes = function(n) {\n var b = new Uint8Array(n);\n randombytes(b, n);\n return b;\n};\n\nnacl.secretbox = function(msg, nonce, key) {\n checkArrayTypes(msg, nonce, key);\n checkLengths(key, nonce);\n var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);\n var c = new Uint8Array(m.length);\n for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];\n crypto_secretbox(c, m, m.length, nonce, key);\n return c.subarray(crypto_secretbox_BOXZEROBYTES);\n};\n\nnacl.secretbox.open = function(box, nonce, key) {\n checkArrayTypes(box, nonce, key);\n checkLengths(key, nonce);\n var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);\n var m = new Uint8Array(c.length);\n for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];\n if (c.length < 32) return null;\n if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;\n return m.subarray(crypto_secretbox_ZEROBYTES);\n};\n\nnacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;\nnacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;\nnacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;\n\nnacl.scalarMult = function(n, p) {\n checkArrayTypes(n, p);\n if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error(\'bad n size\');\n if (p.length !== crypto_scalarmult_BYTES) throw new Error(\'bad p size\');\n var q = new Uint8Array(crypto_scalarmult_BYTES);\n crypto_scalarmult(q, n, p);\n return q;\n};\n\nnacl.scalarMult.base = function(n) {\n checkArrayTypes(n);\n if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error(\'bad n size\');\n var q = new Uint8Array(crypto_scalarmult_BYTES);\n crypto_scalarmult_base(q, n);\n return q;\n};\n\nnacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;\nnacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;\n\nnacl.box = function(msg, nonce, publicKey, secretKey) {\n var k = nacl.box.before(publicKey, secretKey);\n return nacl.secretbox(msg, nonce, k);\n};\n\nnacl.box.before = function(publicKey, secretKey) {\n checkArrayTypes(publicKey, secretKey);\n checkBoxLengths(publicKey, secretKey);\n var k = new Uint8Array(crypto_box_BEFORENMBYTES);\n crypto_box_beforenm(k, publicKey, secretKey);\n return k;\n};\n\nnacl.box.after = nacl.secretbox;\n\nnacl.box.open = function(msg, nonce, publicKey, secretKey) {\n var k = nacl.box.before(publicKey, secretKey);\n return nacl.secretbox.open(msg, nonce, k);\n};\n\nnacl.box.open.after = nacl.secretbox.open;\n\nnacl.box.keyPair = function() {\n var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);\n var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);\n crypto_box_keypair(pk, sk);\n return {publicKey: pk, secretKey: sk};\n};\n\nnacl.box.keyPair.fromSecretKey = function(secretKey) {\n checkArrayTypes(secretKey);\n if (secretKey.length !== crypto_box_SECRETKEYBYTES)\n throw new Error(\'bad secret key size\');\n var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);\n crypto_scalarmult_base(pk, secretKey);\n return {publicKey: pk, secretKey: new Uint8Array(secretKey)};\n};\n\nnacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;\nnacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;\nnacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;\nnacl.box.nonceLength = crypto_box_NONCEBYTES;\nnacl.box.overheadLength = nacl.secretbox.overheadLength;\n\nnacl.sign = function(msg, secretKey) {\n checkArrayTypes(msg, secretKey);\n if (secretKey.length !== crypto_sign_SECRETKEYBYTES)\n throw new Error(\'bad secret key size\');\n var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);\n crypto_sign(signedMsg, msg, msg.length, secretKey);\n return signedMsg;\n};\n\nnacl.sign.open = function(signedMsg, publicKey) {\n checkArrayTypes(signedMsg, publicKey);\n if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)\n throw new Error(\'bad public key size\');\n var tmp = new Uint8Array(signedMsg.length);\n var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);\n if (mlen < 0) return null;\n var m = new Uint8Array(mlen);\n for (var i = 0; i < m.length; i++) m[i] = tmp[i];\n return m;\n};\n\nnacl.sign.detached = function(msg, secretKey) {\n var signedMsg = nacl.sign(msg, secretKey);\n var sig = new Uint8Array(crypto_sign_BYTES);\n for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];\n return sig;\n};\n\nnacl.sign.detached.verify = function(msg, sig, publicKey) {\n checkArrayTypes(msg, sig, publicKey);\n if (sig.length !== crypto_sign_BYTES)\n throw new Error(\'bad signature size\');\n if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)\n throw new Error(\'bad public key size\');\n var sm = new Uint8Array(crypto_sign_BYTES + msg.length);\n var m = new Uint8Array(crypto_sign_BYTES + msg.length);\n var i;\n for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];\n for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];\n return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);\n};\n\nnacl.sign.keyPair = function() {\n var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);\n var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);\n crypto_sign_keypair(pk, sk);\n return {publicKey: pk, secretKey: sk};\n};\n\nnacl.sign.keyPair.fromSecretKey = function(secretKey) {\n checkArrayTypes(secretKey);\n if (secretKey.length !== crypto_sign_SECRETKEYBYTES)\n throw new Error(\'bad secret key size\');\n var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);\n for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];\n return {publicKey: pk, secretKey: new Uint8Array(secretKey)};\n};\n\nnacl.sign.keyPair.fromSeed = function(seed) {\n checkArrayTypes(seed);\n if (seed.length !== crypto_sign_SEEDBYTES)\n throw new Error(\'bad seed size\');\n var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);\n var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);\n for (var i = 0; i < 32; i++) sk[i] = seed[i];\n crypto_sign_keypair(pk, sk, true);\n return {publicKey: pk, secretKey: sk};\n};\n\nnacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;\nnacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;\nnacl.sign.seedLength = crypto_sign_SEEDBYTES;\nnacl.sign.signatureLength = crypto_sign_BYTES;\n\nnacl.hash = function(msg) {\n checkArrayTypes(msg);\n var h = new Uint8Array(crypto_hash_BYTES);\n crypto_hash(h, msg, msg.length);\n return h;\n};\n\nnacl.hash.hashLength = crypto_hash_BYTES;\n\nnacl.verify = function(x, y) {\n checkArrayTypes(x, y);\n // Zero length arguments are considered not equal.\n if (x.length === 0 || y.length === 0) return false;\n if (x.length !== y.length) return false;\n return (vn(x, 0, y, 0, x.length) === 0) ? true : false;\n};\n\nnacl.setPRNG = function(fn) {\n randombytes = fn;\n};\n\n(function() {\n // Initialize PRNG if environment provides CSPRNG.\n // If not, methods calling randombytes will throw.\n var crypto = typeof self !== \'undefined\' ? (self.crypto || self.msCrypto) : null;\n if (crypto && crypto.getRandomValues) {\n // Browsers.\n var QUOTA = 65536;\n nacl.setPRNG(function(x, n) {\n var i, v = new Uint8Array(n);\n for (i = 0; i < n; i += QUOTA) {\n crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));\n }\n for (i = 0; i < n; i++) x[i] = v[i];\n cleanup(v);\n });\n } else if (typeof require !== \'undefined\') {\n // Node.js.\n crypto = require(\'crypto\');\n if (crypto && crypto.randomBytes) {\n nacl.setPRNG(function(x, n) {\n var i, v = crypto.randomBytes(n);\n for (i = 0; i < n; i++) x[i] = v[i];\n cleanup(v);\n });\n }\n }\n})();\n\n})(typeof module !== \'undefined\' && module.exports ? module.exports : (self._nacl = self._nacl || {}));\n')
__pragma__('js', '{}', '\nexport const api = self._nacl;\n')
|
"""
N : 1 * 2 * 3 * .... * N
"""
def factorial(n: int) -> int:
result = 1
for i in range(1, n + 1):
result *= i
return result
"""
nPr = n! / (n - r)!
"""
def permutation(n: int, r: int) -> int:
return factorial(n) // factorial(n - r)
# return 24 // factorial(n - r)
# return 24 // factorial(2)
# return 24 // 2
# return 12
# nCr = nPr / r!
def combination(n: int, r: int) -> int:
return permutation(n, r) // factorial(r)
print(combination(4, 0))
print(combination(4, 1))
print(combination(4, 2))
print(combination(4, 3))
print(combination(4, 4))
|
"""
N : 1 * 2 * 3 * .... * N
"""
def factorial(n: int) -> int:
result = 1
for i in range(1, n + 1):
result *= i
return result
'\nnPr = n! / (n - r)!\n'
def permutation(n: int, r: int) -> int:
return factorial(n) // factorial(n - r)
def combination(n: int, r: int) -> int:
return permutation(n, r) // factorial(r)
print(combination(4, 0))
print(combination(4, 1))
print(combination(4, 2))
print(combination(4, 3))
print(combination(4, 4))
|
'''
Example:
import dk
cfg = dk.load_config(config_path='~/donkeycar/donkeycar/parts/RLConfig.py')
print(cfg.CAMERA_RESOLUTION)
'''
MODE_COMPLEX_LANE_FOLLOW = 0
MODE_SIMPLE_LINE_FOLLOW = 1
MODE_STEER_THROTTLE = MODE_COMPLEX_LANE_FOLLOW
# MODE_STEER_THROTTLE = MODE_SIMPLE_LINE_FOLLOW
PARTIAL_NN_CNT = 45000
# SWITCH_TO_NN = 45000
# SWITCH_TO_NN = 15000
# SWITCH_TO_NN = 9000
# SWITCH_TO_NN = 6000
# SWITCH_TO_NN = 300
# SWITCH_TO_NN = 10
# SWITCH_TO_NN = 100
# SWITCH_TO_NN = 150
# SWITCH_TO_NN = 7500
# SWITCH_TO_NN = 3000
SWITCH_TO_NN = 1000
UPDATE_NN = 1000
# UPDATE_NN = 100
SAVE_NN = 1000
THROTTLE_CONSTANT = 0
# THROTTLE_CONSTANT = .3
STATE_EMERGENCY_STOP = 0
STATE_NN = 1
STATE_OPENCV = 2
STATE_MODEL_TRANSFER_STARTED = 3
STATE_MODEL_PREPARE_NN = 4
STATE_MODEL_WEIGHTS_SET = 5
STATE_PARTIAL_NN = 6
STATE_TRIAL_NN = 7
EMERGENCY_STOP = 0.000001
SIM_EMERGENCY_STOP = -1000
# DISABLE_EMERGENCY_STOP = True
DISABLE_EMERGENCY_STOP = False
# USE_COLOR = False
USE_COLOR = True
# HSV
# Note: The YELLOW/WHITE parameters are longer used and are now dynamically computed
# from simulation:
# line_color_y: [[84, 107, 148], [155, 190, 232]]
# line_color_w: [[32, 70, 101], [240, 240, 248]]
# COLOR_YELLOW = [[20, 80, 100], [35, 255, 255]]
# COLOR_YELLOW = [[20, 0, 100], [30, 255, 255]]
# COLOR_YELLOW = [[20, 40, 70], [70, 89, 95]]
COLOR_YELLOW = [[84, 107, 148], [155, 190, 232]]
# COLOR_YELLOW = 50, 75, 83
# using saturation 40 for WHITE
# COLOR_WHITE = [[0,0,255-40],[255,40,255]]
# COLOR_WHITE = [[50,0,80],[155,10,100]]
COLOR_WHITE = [[32, 70, 101], [240, 240, 248]]
# COLOR_WHITE = 72,2, 90]
TURNADJ = .02
# DESIREDPPF = 35
DESIREDPPF = 20
# MAXBATADJ = .10
# BATADJ = .001
MAXBATADJ = .000 # simulation doesn't have battery
BATADJ = .000 # simulation doesn't have battery
RL_MODEL_PATH = "~/d2/models/rlpilot"
RL_STATE_PATH = "~/d2/models/"
MAXBATCNT = 1000
# MINMINTHROT = 0.035 # for Sim
MINMINTHROT = 0.05 # for Sim
# OPTFLOWTHRESH = 0.75 # for Sim
OPTFLOWTHRESH = 0.14 # for Sim
OPTFLOWINCR = 0.01 # for Sim
# OPTFLOWINCR = 0.01 # for Sim
# MINMINTHROT = 25 # real car
# MINMINTHROT = 29 # real car
# OPTFLOWTHRESH = 0.40 # real
# OPTFLOWINCR = 0.001
# MAX_ACCEL = 10
MAX_ACCEL = 3
# CHECK_THROTTLE_THRESH = 20
CHECK_THROTTLE_THRESH = 40
MAXLANEWIDTH = 400 # should be much smaller
MIN_DIST_FROM_CENTER = 20
# client to server
MSG_NONE = -1
MSG_GET_WEIGHTS = 1
MSG_STATE_ANGLE_THROTTLE_REWARD_ROI = 2
# server to client
MSG_RESULT = 4
MSG_WEIGHTS = 5
MSG_EMERGENCY_STOP = 6
# control1 to control2
MSG_ROI = 7
# control2 to control1
MSG_ANGLE_THROTTLE_REWARD = 8
# RLPi States
RLPI_READY1 = 1
RLPI_READY2 = 2
RLPI_OPENCV = 1
RLPI_TRIAL_NN = 2
RLPI_NN = 3
# PORT_RLPI = "10.0.0.5:5557"
# PORT_RLPI = "localhost:5557"
# PORT_CONTROLPI = "localhost:5558"
PORT_RLPI = 5557
PORT_CONTROLPI = 5558
PORT_CONTROLPI2 = None
PORT_CONTROLPI2RL = None
# PORT_CONTROLPI2 = 5556
# PORT_CONTROLPI2RL = 5555
# Original reward for throttle was too high. Reduce.
# THROTTLE_INCREMENT = .4
# THROTTLE_BOOST = .1
THROTTLE_INCREMENT = .3
THROTTLE_BOOST = .05
REWARD_BATCH_MIN = 3
REWARD_BATCH_MAX = 10
REWARD_BATCH_END = 50
REWARD_BATCH_BEGIN = 500
# pass angle bin back and forth; based on 15 bins
ANGLE_INCREMENT = (1/15)
SAVE_MOVIE = False
# SAVE_MOVIE = True
TEST_TUB = "/home/ros/d2/data/tub_18_18-08-18"
MOVIE_LOC = "/tmp/movie4"
# to make movie from jpg in MOVIE_LOC use something like:
# ffmpeg -framerate 4 -i /tmp/movie4/1%03d_cam-image_array_.jpg -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p output.mp4
# INIT_STEER_FRAMES = 25
INIT_STEER_FRAMES = 125
# For PPO
Q_LEN_THRESH = 200
Q_LEN_MAX = 250
# Almost all initial batches were under 20
Q_FIT_BATCH_LEN_THRESH = 50
# Very short batches to compute rewards are likely "car resets"
# maybe should be 5
Q_MIN_ACTUAL_BATCH_LEN = 4
RWD_LOW = 10
RWD_HIGH = 500
RWD_HIGH_THRESH = 3
DISCOUNT_FACTOR = .8
|
"""
Example:
import dk
cfg = dk.load_config(config_path='~/donkeycar/donkeycar/parts/RLConfig.py')
print(cfg.CAMERA_RESOLUTION)
"""
mode_complex_lane_follow = 0
mode_simple_line_follow = 1
mode_steer_throttle = MODE_COMPLEX_LANE_FOLLOW
partial_nn_cnt = 45000
switch_to_nn = 1000
update_nn = 1000
save_nn = 1000
throttle_constant = 0
state_emergency_stop = 0
state_nn = 1
state_opencv = 2
state_model_transfer_started = 3
state_model_prepare_nn = 4
state_model_weights_set = 5
state_partial_nn = 6
state_trial_nn = 7
emergency_stop = 1e-06
sim_emergency_stop = -1000
disable_emergency_stop = False
use_color = True
color_yellow = [[84, 107, 148], [155, 190, 232]]
color_white = [[32, 70, 101], [240, 240, 248]]
turnadj = 0.02
desiredppf = 20
maxbatadj = 0.0
batadj = 0.0
rl_model_path = '~/d2/models/rlpilot'
rl_state_path = '~/d2/models/'
maxbatcnt = 1000
minminthrot = 0.05
optflowthresh = 0.14
optflowincr = 0.01
max_accel = 3
check_throttle_thresh = 40
maxlanewidth = 400
min_dist_from_center = 20
msg_none = -1
msg_get_weights = 1
msg_state_angle_throttle_reward_roi = 2
msg_result = 4
msg_weights = 5
msg_emergency_stop = 6
msg_roi = 7
msg_angle_throttle_reward = 8
rlpi_ready1 = 1
rlpi_ready2 = 2
rlpi_opencv = 1
rlpi_trial_nn = 2
rlpi_nn = 3
port_rlpi = 5557
port_controlpi = 5558
port_controlpi2 = None
port_controlpi2_rl = None
throttle_increment = 0.3
throttle_boost = 0.05
reward_batch_min = 3
reward_batch_max = 10
reward_batch_end = 50
reward_batch_begin = 500
angle_increment = 1 / 15
save_movie = False
test_tub = '/home/ros/d2/data/tub_18_18-08-18'
movie_loc = '/tmp/movie4'
init_steer_frames = 125
q_len_thresh = 200
q_len_max = 250
q_fit_batch_len_thresh = 50
q_min_actual_batch_len = 4
rwd_low = 10
rwd_high = 500
rwd_high_thresh = 3
discount_factor = 0.8
|
def build_filter(args):
return Filter(args)
class Filter:
def __init__(self, args):
pass
def file_data_filter(self, file_data):
file_ctx = file_data["file_ctx"]
if not file_ctx.isbinary():
file_data["data"] = file_data["data"].replace(b"\r\n", b"\n")
|
def build_filter(args):
return filter(args)
class Filter:
def __init__(self, args):
pass
def file_data_filter(self, file_data):
file_ctx = file_data['file_ctx']
if not file_ctx.isbinary():
file_data['data'] = file_data['data'].replace(b'\r\n', b'\n')
|
print(round(1.23,1))
print(round(1.2345, 3))
# Negative numbers round the ones, tens, hundreds and so on..
print(round(123124123, -1))
print(round(54213, -2))
# Round is not neccessary for display reasons. use format instead
x = 1.8913479812313
print("value is {:0.3f}".format(x))
|
print(round(1.23, 1))
print(round(1.2345, 3))
print(round(123124123, -1))
print(round(54213, -2))
x = 1.8913479812313
print('value is {:0.3f}'.format(x))
|
def get_emails():
while True:
email_info = input().split(' ')
if email_info[0] == 'Stop':
break
sender, receiver, content = email_info
email = Email(sender, receiver, content)
emails.append(email)
class Email:
def __init__(self, sender, receiver, content):
self.sender = sender
self.receiver = receiver
self.content = content
self.is_sent = False
def send(self):
self.is_sent = True
def get_info(self):
return f'{self.sender} says to {self.receiver}: {self.content}. Sent: {self.is_sent}'
emails = []
get_emails()
email_indices = map(int, input().split(', '))
for i in email_indices:
emails[i].send()
[print(email.get_info()) for email in emails]
|
def get_emails():
while True:
email_info = input().split(' ')
if email_info[0] == 'Stop':
break
(sender, receiver, content) = email_info
email = email(sender, receiver, content)
emails.append(email)
class Email:
def __init__(self, sender, receiver, content):
self.sender = sender
self.receiver = receiver
self.content = content
self.is_sent = False
def send(self):
self.is_sent = True
def get_info(self):
return f'{self.sender} says to {self.receiver}: {self.content}. Sent: {self.is_sent}'
emails = []
get_emails()
email_indices = map(int, input().split(', '))
for i in email_indices:
emails[i].send()
[print(email.get_info()) for email in emails]
|
pattern_zero=[0.0, 0.017538265306, 0.03443877551, 0.035714285714, 0.050701530612, 0.05325255102, 0.066326530612, 0.070153061224, 0.071428571429, 0.08131377551, 0.086415816327, 0.088966836735, 0.095663265306, 0.102040816327, 0.105867346939, 0.107142857143, 0.109375, 0.117028061224, 0.122130102041, 0.122448979592, 0.124681122449, 0.13137755102, 0.134885204082, 0.137755102041, 0.141581632653, 0.142857142857, 0.145089285714, 0.146683673469, 0.152742346939, 0.157844387755, 0.158163265306, 0.160395408163, 0.167091836735, 0.168367346939, 0.170599489796, 0.173469387755, 0.177295918367, 0.17825255102, 0.178571428571, 0.180803571429, 0.182397959184, 0.1875, 0.188456632653, 0.193558673469, 0.19387755102, 0.196109693878, 0.202806122449, 0.204081632653, 0.20631377551, 0.209183673469, 0.211415816327, 0.213010204082, 0.213966836735, 0.214285714286, 0.216517857143, 0.218112244898, 0.223214285714, 0.224170918367, 0.229272959184, 0.229591836735, 0.231823979592, 0.234375, 0.238520408163, 0.239795918367, 0.242028061224, 0.244897959184, 0.247130102041, 0.248724489796, 0.249681122449, 0.25, 0.252232142857, 0.253826530612, 0.258928571429, 0.259885204082, 0.264987244898, 0.265306122449, 0.267538265306, 0.270089285714, 0.274234693878, 0.275510204082, 0.277742346939, 0.280612244898, 0.282844387755, 0.28443877551, 0.285395408163, 0.285714285714, 0.287946428571, 0.289540816327, 0.294642857143, 0.295599489796, 0.300701530612, 0.301020408163, 0.30325255102, 0.305803571429, 0.309948979592, 0.311224489796, 0.313456632653, 0.316326530612, 0.318558673469, 0.320153061224, 0.321109693878, 0.321428571429, 0.323660714286, 0.325255102041, 0.330357142857, 0.33131377551, 0.336415816327, 0.336734693878, 0.338966836735, 0.341517857143, 0.345663265306, 0.34693877551, 0.349170918367, 0.352040816327, 0.354272959184, 0.355867346939, 0.356823979592, 0.357142857143, 0.359375, 0.360969387755, 0.366071428571, 0.367028061224, 0.372130102041, 0.372448979592, 0.374681122449, 0.377232142857, 0.38137755102, 0.382653061224, 0.384885204082, 0.387755102041, 0.389987244898, 0.391581632653, 0.392538265306, 0.392857142857, 0.395089285714, 0.396683673469, 0.401785714286, 0.402742346939, 0.407844387755, 0.408163265306, 0.410395408163, 0.412946428571, 0.417091836735, 0.418367346939, 0.420599489796, 0.423469387755, 0.425701530612, 0.427295918367, 0.42825255102, 0.428571428571, 0.430803571429, 0.432397959184, 0.4375, 0.438456632653, 0.443558673469, 0.44387755102, 0.446109693878, 0.448660714286, 0.452806122449, 0.454081632653, 0.45631377551, 0.459183673469, 0.461415816327, 0.463010204082, 0.463966836735, 0.464285714286, 0.466517857143, 0.468112244898, 0.473214285714, 0.474170918367, 0.479272959184, 0.479591836735, 0.481823979592, 0.484375, 0.488520408163, 0.489795918367, 0.492028061224, 0.494897959184, 0.497130102041, 0.498724489796, 0.499681122449, 0.5, 0.502232142857, 0.503826530612, 0.508928571429, 0.509885204082, 0.514987244898, 0.515306122449, 0.517538265306, 0.520089285714, 0.524234693878, 0.525510204082, 0.527742346939, 0.530612244898, 0.532844387755, 0.53443877551, 0.535395408163, 0.535714285714, 0.537946428571, 0.539540816327, 0.544642857143, 0.545599489796, 0.550701530612, 0.551020408163, 0.55325255102, 0.555803571429, 0.559948979592, 0.561224489796, 0.563456632653, 0.566326530612, 0.568558673469, 0.570153061224, 0.571109693878, 0.571428571429, 0.573660714286, 0.575255102041, 0.580357142857, 0.58131377551, 0.586415816327, 0.586734693878, 0.588966836735, 0.591517857143, 0.595663265306, 0.59693877551, 0.599170918367, 0.602040816327, 0.604272959184, 0.605867346939, 0.606823979592, 0.607142857143, 0.609375, 0.610969387755, 0.616071428571, 0.617028061224, 0.622130102041, 0.622448979592, 0.624681122449, 0.627232142857, 0.63137755102, 0.632653061224, 0.634885204082, 0.637755102041, 0.639987244898, 0.641581632653, 0.642538265306, 0.642857142857, 0.645089285714, 0.646683673469, 0.651785714286, 0.652742346939, 0.657844387755, 0.658163265306, 0.660395408163, 0.662946428571, 0.667091836735, 0.668367346939, 0.670599489796, 0.673469387755, 0.675701530612, 0.677295918367, 0.67825255102, 0.678571428571, 0.680803571429, 0.682397959184, 0.6875, 0.688456632653, 0.693558673469, 0.69387755102, 0.696109693878, 0.698660714286, 0.702806122449, 0.704081632653, 0.70631377551, 0.709183673469, 0.711415816327, 0.713010204082, 0.713966836735, 0.714285714286, 0.716517857143, 0.718112244898, 0.723214285714, 0.724170918367, 0.729272959184, 0.729591836735, 0.731823979592, 0.734375, 0.738520408163, 0.739795918367, 0.742028061224, 0.744897959184, 0.747130102041, 0.748724489796, 0.749681122449, 0.75, 0.752232142857, 0.753826530612, 0.758928571429, 0.759885204082, 0.764987244898, 0.765306122449, 0.767538265306, 0.770089285714, 0.774234693878, 0.775510204082, 0.777742346939, 0.780612244898, 0.782844387755, 0.78443877551, 0.785395408163, 0.785714285714, 0.787946428571, 0.789540816327, 0.794642857143, 0.795599489796, 0.800701530612, 0.801020408163, 0.80325255102, 0.805803571429, 0.809948979592, 0.811224489796, 0.813456632653, 0.816326530612, 0.818558673469, 0.820153061224, 0.821109693878, 0.821428571429, 0.823660714286, 0.825255102041, 0.830357142857, 0.83131377551, 0.836415816327, 0.836734693878, 0.838966836735, 0.841517857143, 0.845663265306, 0.84693877551, 0.849170918367, 0.852040816327, 0.854272959184, 0.855867346939, 0.856823979592, 0.857142857143, 0.859375, 0.860969387755, 0.866071428571, 0.867028061224, 0.872130102041, 0.872448979592, 0.874681122449, 0.877232142857, 0.88137755102, 0.882653061224, 0.884885204082, 0.887755102041, 0.889987244898, 0.891581632653, 0.892538265306, 0.892857142857, 0.895089285714, 0.896683673469, 0.901785714286, 0.902742346939, 0.907844387755, 0.908163265306, 0.910395408163, 0.912946428571, 0.917091836735, 0.918367346939, 0.920599489796, 0.923469387755, 0.925701530612, 0.927295918367, 0.92825255102, 0.928571428571, 0.930803571429, 0.932397959184, 0.9375, 0.938456632653, 0.943558673469, 0.94387755102, 0.946109693878, 0.948660714286, 0.952806122449, 0.954081632653, 0.95631377551, 0.959183673469, 0.961415816327, 0.963010204082, 0.963966836735, 0.964285714286, 0.966517857143, 0.968112244898, 0.973214285714, 0.974170918367, 0.979272959184, 0.979591836735, 0.981823979592, 0.984375, 0.988520408163, 0.989795918367, 0.992028061224, 0.994897959184, 0.997130102041, 0.998724489796, 0.999681122449]
pattern_odd=[0.0, 0.002232142857, 0.003826530612, 0.008928571429, 0.009885204082, 0.014987244898, 0.015306122449, 0.017538265306, 0.020089285714, 0.024234693878, 0.025510204082, 0.027742346939, 0.030612244898, 0.032844387755, 0.03443877551, 0.035395408163, 0.035714285714, 0.037946428571, 0.039540816327, 0.044642857143, 0.045599489796, 0.050701530612, 0.051020408163, 0.05325255102, 0.055803571429, 0.059948979592, 0.061224489796, 0.063456632653, 0.066326530612, 0.068558673469, 0.070153061224, 0.071109693878, 0.071428571429, 0.073660714286, 0.075255102041, 0.080357142857, 0.08131377551, 0.086415816327, 0.086734693878, 0.088966836735, 0.091517857143, 0.095663265306, 0.09693877551, 0.099170918367, 0.102040816327, 0.104272959184, 0.105867346939, 0.106823979592, 0.107142857143, 0.109375, 0.110969387755, 0.116071428571, 0.117028061224, 0.122130102041, 0.122448979592, 0.124681122449, 0.127232142857, 0.13137755102, 0.132653061224, 0.134885204082, 0.137755102041, 0.139987244898, 0.141581632653, 0.142538265306, 0.142857142857, 0.145089285714, 0.146683673469, 0.151785714286, 0.152742346939, 0.157844387755, 0.158163265306, 0.160395408163, 0.162946428571, 0.167091836735, 0.168367346939, 0.170599489796, 0.173469387755, 0.175701530612, 0.177295918367, 0.17825255102, 0.178571428571, 0.180803571429, 0.182397959184, 0.1875, 0.188456632653, 0.193558673469, 0.19387755102, 0.196109693878, 0.198660714286, 0.202806122449, 0.204081632653, 0.20631377551, 0.209183673469, 0.211415816327, 0.213010204082, 0.213966836735, 0.214285714286, 0.216517857143, 0.218112244898, 0.223214285714, 0.224170918367, 0.229272959184, 0.229591836735, 0.231823979592, 0.234375, 0.238520408163, 0.239795918367, 0.242028061224, 0.244897959184, 0.247130102041, 0.248724489796, 0.249681122449, 0.25, 0.252232142857, 0.253826530612, 0.258928571429, 0.259885204082, 0.264987244898, 0.265306122449, 0.267538265306, 0.270089285714, 0.274234693878, 0.275510204082, 0.277742346939, 0.280612244898, 0.282844387755, 0.28443877551, 0.285395408163, 0.285714285714, 0.287946428571, 0.289540816327, 0.294642857143, 0.295599489796, 0.300701530612, 0.301020408163, 0.30325255102, 0.305803571429, 0.309948979592, 0.311224489796, 0.313456632653, 0.316326530612, 0.318558673469, 0.320153061224, 0.321109693878, 0.321428571429, 0.323660714286, 0.325255102041, 0.330357142857, 0.33131377551, 0.336415816327, 0.336734693878, 0.338966836735, 0.341517857143, 0.345663265306, 0.34693877551, 0.349170918367, 0.352040816327, 0.354272959184, 0.355867346939, 0.356823979592, 0.357142857143, 0.359375, 0.360969387755, 0.366071428571, 0.367028061224, 0.372130102041, 0.372448979592, 0.374681122449, 0.377232142857, 0.38137755102, 0.382653061224, 0.384885204082, 0.387755102041, 0.389987244898, 0.391581632653, 0.392538265306, 0.392857142857, 0.395089285714, 0.396683673469, 0.401785714286, 0.402742346939, 0.407844387755, 0.408163265306, 0.410395408163, 0.412946428571, 0.417091836735, 0.418367346939, 0.420599489796, 0.423469387755, 0.425701530612, 0.427295918367, 0.42825255102, 0.428571428571, 0.430803571429, 0.432397959184, 0.4375, 0.438456632653, 0.443558673469, 0.44387755102, 0.446109693878, 0.448660714286, 0.452806122449, 0.454081632653, 0.45631377551, 0.459183673469, 0.461415816327, 0.463010204082, 0.463966836735, 0.464285714286, 0.466517857143, 0.468112244898, 0.473214285714, 0.474170918367, 0.479272959184, 0.479591836735, 0.481823979592, 0.484375, 0.488520408163, 0.489795918367, 0.492028061224, 0.494897959184, 0.497130102041, 0.498724489796, 0.499681122449, 0.5, 0.502232142857, 0.503826530612, 0.508928571429, 0.509885204082, 0.514987244898, 0.515306122449, 0.517538265306, 0.520089285714, 0.524234693878, 0.525510204082, 0.527742346939, 0.530612244898, 0.532844387755, 0.53443877551, 0.535395408163, 0.535714285714, 0.537946428571, 0.539540816327, 0.544642857143, 0.545599489796, 0.550701530612, 0.551020408163, 0.55325255102, 0.555803571429, 0.559948979592, 0.561224489796, 0.563456632653, 0.566326530612, 0.568558673469, 0.570153061224, 0.571109693878, 0.571428571429, 0.573660714286, 0.575255102041, 0.580357142857, 0.58131377551, 0.586415816327, 0.586734693878, 0.588966836735, 0.591517857143, 0.595663265306, 0.59693877551, 0.599170918367, 0.602040816327, 0.604272959184, 0.605867346939, 0.606823979592, 0.607142857143, 0.609375, 0.610969387755, 0.616071428571, 0.617028061224, 0.622130102041, 0.622448979592, 0.624681122449, 0.627232142857, 0.63137755102, 0.632653061224, 0.634885204082, 0.637755102041, 0.639987244898, 0.641581632653, 0.642538265306, 0.642857142857, 0.645089285714, 0.646683673469, 0.651785714286, 0.652742346939, 0.657844387755, 0.658163265306, 0.660395408163, 0.662946428571, 0.667091836735, 0.668367346939, 0.670599489796, 0.673469387755, 0.675701530612, 0.677295918367, 0.67825255102, 0.678571428571, 0.680803571429, 0.682397959184, 0.6875, 0.688456632653, 0.693558673469, 0.69387755102, 0.696109693878, 0.698660714286, 0.702806122449, 0.704081632653, 0.70631377551, 0.709183673469, 0.711415816327, 0.713010204082, 0.713966836735, 0.714285714286, 0.716517857143, 0.718112244898, 0.723214285714, 0.724170918367, 0.729272959184, 0.729591836735, 0.731823979592, 0.734375, 0.738520408163, 0.739795918367, 0.742028061224, 0.744897959184, 0.747130102041, 0.748724489796, 0.749681122449, 0.75, 0.752232142857, 0.753826530612, 0.758928571429, 0.759885204082, 0.764987244898, 0.765306122449, 0.767538265306, 0.770089285714, 0.774234693878, 0.775510204082, 0.777742346939, 0.780612244898, 0.782844387755, 0.78443877551, 0.785395408163, 0.785714285714, 0.787946428571, 0.789540816327, 0.794642857143, 0.795599489796, 0.800701530612, 0.801020408163, 0.80325255102, 0.805803571429, 0.809948979592, 0.811224489796, 0.813456632653, 0.816326530612, 0.818558673469, 0.820153061224, 0.821109693878, 0.821428571429, 0.823660714286, 0.825255102041, 0.830357142857, 0.83131377551, 0.836415816327, 0.836734693878, 0.838966836735, 0.841517857143, 0.845663265306, 0.84693877551, 0.849170918367, 0.852040816327, 0.854272959184, 0.855867346939, 0.856823979592, 0.857142857143, 0.859375, 0.860969387755, 0.866071428571, 0.867028061224, 0.872130102041, 0.872448979592, 0.874681122449, 0.877232142857, 0.88137755102, 0.882653061224, 0.884885204082, 0.887755102041, 0.889987244898, 0.891581632653, 0.892538265306, 0.892857142857, 0.895089285714, 0.896683673469, 0.901785714286, 0.902742346939, 0.907844387755, 0.908163265306, 0.910395408163, 0.912946428571, 0.917091836735, 0.918367346939, 0.920599489796, 0.923469387755, 0.925701530612, 0.927295918367, 0.92825255102, 0.928571428571, 0.930803571429, 0.932397959184, 0.9375, 0.938456632653, 0.943558673469, 0.94387755102, 0.946109693878, 0.948660714286, 0.952806122449, 0.954081632653, 0.95631377551, 0.959183673469, 0.961415816327, 0.963010204082, 0.963966836735, 0.964285714286, 0.966517857143, 0.968112244898, 0.973214285714, 0.974170918367, 0.979272959184, 0.979591836735, 0.981823979592, 0.984375, 0.988520408163, 0.989795918367, 0.992028061224, 0.994897959184, 0.997130102041, 0.998724489796, 0.999681122449]
pattern_even=[0.0, 0.002232142857, 0.003826530612, 0.008928571429, 0.009885204082, 0.014987244898, 0.015306122449, 0.017538265306, 0.020089285714, 0.024234693878, 0.025510204082, 0.027742346939, 0.030612244898, 0.032844387755, 0.03443877551, 0.035395408163, 0.035714285714, 0.037946428571, 0.039540816327, 0.044642857143, 0.045599489796, 0.050701530612, 0.051020408163, 0.05325255102, 0.055803571429, 0.059948979592, 0.061224489796, 0.063456632653, 0.066326530612, 0.068558673469, 0.070153061224, 0.071109693878, 0.071428571429, 0.073660714286, 0.075255102041, 0.080357142857, 0.08131377551, 0.086415816327, 0.086734693878, 0.088966836735, 0.091517857143, 0.095663265306, 0.09693877551, 0.099170918367, 0.102040816327, 0.104272959184, 0.105867346939, 0.106823979592, 0.107142857143, 0.109375, 0.110969387755, 0.116071428571, 0.117028061224, 0.122130102041, 0.122448979592, 0.124681122449, 0.127232142857, 0.13137755102, 0.132653061224, 0.134885204082, 0.137755102041, 0.139987244898, 0.141581632653, 0.142538265306, 0.142857142857, 0.145089285714, 0.146683673469, 0.151785714286, 0.152742346939, 0.157844387755, 0.158163265306, 0.160395408163, 0.162946428571, 0.167091836735, 0.168367346939, 0.170599489796, 0.173469387755, 0.175701530612, 0.177295918367, 0.17825255102, 0.178571428571, 0.180803571429, 0.182397959184, 0.1875, 0.188456632653, 0.193558673469, 0.19387755102, 0.196109693878, 0.198660714286, 0.202806122449, 0.204081632653, 0.20631377551, 0.209183673469, 0.211415816327, 0.213010204082, 0.213966836735, 0.214285714286, 0.216517857143, 0.218112244898, 0.223214285714, 0.224170918367, 0.229272959184, 0.229591836735, 0.231823979592, 0.234375, 0.238520408163, 0.239795918367, 0.242028061224, 0.244897959184, 0.247130102041, 0.248724489796, 0.249681122449, 0.25, 0.252232142857, 0.253826530612, 0.258928571429, 0.259885204082, 0.264987244898, 0.265306122449, 0.267538265306, 0.270089285714, 0.274234693878, 0.275510204082, 0.277742346939, 0.280612244898, 0.282844387755, 0.28443877551, 0.285395408163, 0.285714285714, 0.287946428571, 0.289540816327, 0.294642857143, 0.295599489796, 0.300701530612, 0.301020408163, 0.30325255102, 0.305803571429, 0.309948979592, 0.311224489796, 0.313456632653, 0.316326530612, 0.318558673469, 0.320153061224, 0.321109693878, 0.321428571429, 0.323660714286, 0.325255102041, 0.330357142857, 0.33131377551, 0.336415816327, 0.336734693878, 0.338966836735, 0.341517857143, 0.345663265306, 0.34693877551, 0.349170918367, 0.352040816327, 0.354272959184, 0.355867346939, 0.356823979592, 0.357142857143, 0.359375, 0.360969387755, 0.366071428571, 0.367028061224, 0.372130102041, 0.372448979592, 0.374681122449, 0.377232142857, 0.38137755102, 0.382653061224, 0.384885204082, 0.387755102041, 0.389987244898, 0.391581632653, 0.392538265306, 0.392857142857, 0.395089285714, 0.396683673469, 0.401785714286, 0.402742346939, 0.407844387755, 0.408163265306, 0.410395408163, 0.412946428571, 0.417091836735, 0.418367346939, 0.420599489796, 0.423469387755, 0.425701530612, 0.427295918367, 0.42825255102, 0.428571428571, 0.430803571429, 0.432397959184, 0.4375, 0.438456632653, 0.443558673469, 0.44387755102, 0.446109693878, 0.448660714286, 0.452806122449, 0.454081632653, 0.45631377551, 0.459183673469, 0.461415816327, 0.463010204082, 0.463966836735, 0.464285714286, 0.466517857143, 0.468112244898, 0.473214285714, 0.474170918367, 0.479272959184, 0.479591836735, 0.481823979592, 0.484375, 0.488520408163, 0.489795918367, 0.492028061224, 0.494897959184, 0.497130102041, 0.498724489796, 0.499681122449, 0.5, 0.502232142857, 0.503826530612, 0.508928571429, 0.509885204082, 0.514987244898, 0.515306122449, 0.517538265306, 0.520089285714, 0.524234693878, 0.525510204082, 0.527742346939, 0.530612244898, 0.532844387755, 0.53443877551, 0.535395408163, 0.535714285714, 0.537946428571, 0.539540816327, 0.544642857143, 0.545599489796, 0.550701530612, 0.551020408163, 0.55325255102, 0.555803571429, 0.559948979592, 0.561224489796, 0.563456632653, 0.566326530612, 0.568558673469, 0.570153061224, 0.571109693878, 0.571428571429, 0.573660714286, 0.575255102041, 0.580357142857, 0.58131377551, 0.586415816327, 0.586734693878, 0.588966836735, 0.591517857143, 0.595663265306, 0.59693877551, 0.599170918367, 0.602040816327, 0.604272959184, 0.605867346939, 0.606823979592, 0.607142857143, 0.609375, 0.610969387755, 0.616071428571, 0.617028061224, 0.622130102041, 0.622448979592, 0.624681122449, 0.627232142857, 0.63137755102, 0.632653061224, 0.634885204082, 0.637755102041, 0.639987244898, 0.641581632653, 0.642538265306, 0.642857142857, 0.645089285714, 0.646683673469, 0.651785714286, 0.652742346939, 0.657844387755, 0.658163265306, 0.660395408163, 0.662946428571, 0.667091836735, 0.668367346939, 0.670599489796, 0.673469387755, 0.675701530612, 0.677295918367, 0.67825255102, 0.678571428571, 0.680803571429, 0.682397959184, 0.6875, 0.688456632653, 0.693558673469, 0.69387755102, 0.696109693878, 0.698660714286, 0.702806122449, 0.704081632653, 0.70631377551, 0.709183673469, 0.711415816327, 0.713010204082, 0.713966836735, 0.714285714286, 0.716517857143, 0.718112244898, 0.723214285714, 0.724170918367, 0.729272959184, 0.729591836735, 0.731823979592, 0.734375, 0.738520408163, 0.739795918367, 0.742028061224, 0.744897959184, 0.747130102041, 0.748724489796, 0.749681122449, 0.75, 0.752232142857, 0.753826530612, 0.758928571429, 0.759885204082, 0.764987244898, 0.765306122449, 0.767538265306, 0.770089285714, 0.774234693878, 0.775510204082, 0.777742346939, 0.780612244898, 0.782844387755, 0.78443877551, 0.785395408163, 0.785714285714, 0.787946428571, 0.789540816327, 0.794642857143, 0.795599489796, 0.800701530612, 0.801020408163, 0.80325255102, 0.805803571429, 0.809948979592, 0.811224489796, 0.813456632653, 0.816326530612, 0.818558673469, 0.820153061224, 0.821109693878, 0.821428571429, 0.823660714286, 0.825255102041, 0.830357142857, 0.83131377551, 0.836415816327, 0.836734693878, 0.838966836735, 0.841517857143, 0.845663265306, 0.84693877551, 0.849170918367, 0.852040816327, 0.854272959184, 0.855867346939, 0.856823979592, 0.857142857143, 0.859375, 0.860969387755, 0.866071428571, 0.867028061224, 0.872130102041, 0.872448979592, 0.874681122449, 0.877232142857, 0.88137755102, 0.882653061224, 0.884885204082, 0.887755102041, 0.889987244898, 0.891581632653, 0.892538265306, 0.892857142857, 0.895089285714, 0.896683673469, 0.901785714286, 0.902742346939, 0.907844387755, 0.908163265306, 0.910395408163, 0.912946428571, 0.917091836735, 0.918367346939, 0.920599489796, 0.923469387755, 0.925701530612, 0.927295918367, 0.92825255102, 0.928571428571, 0.930803571429, 0.932397959184, 0.9375, 0.938456632653, 0.943558673469, 0.94387755102, 0.946109693878, 0.948660714286, 0.952806122449, 0.954081632653, 0.95631377551, 0.959183673469, 0.961415816327, 0.963010204082, 0.963966836735, 0.964285714286, 0.966517857143, 0.968112244898, 0.973214285714, 0.974170918367, 0.979272959184, 0.979591836735, 0.981823979592, 0.984375, 0.988520408163, 0.989795918367, 0.992028061224, 0.994897959184, 0.997130102041, 0.998724489796, 0.999681122449]
averages_even={0.0: [0.5, 0.0], 0.109375: [0.875, 0.125], 0.1875: [0.25, 0.75], 0.392857142857: [0.5, 0.0], 0.127232142857: [0.375, 0.625], 0.188456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.209183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.744897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.856823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.5: [0.5, 0.0], 0.946109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.657844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.03443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.244897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.354272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.535714285714: [0.5, 0.0], 0.473214285714: [0.75, 0.25], 0.78443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.753826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.59693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.537946428571: [0.875, 0.125], 0.813456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.780612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.015306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.488520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.999681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.559948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.382653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.651785714286: [0.75, 0.25], 0.009885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.823660714286: [0.875, 0.125], 0.6875: [0.75, 0.25], 0.412946428571: [0.375, 0.625], 0.882653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.502232142857: [0.875, 0.125], 0.270089285714: [0.375, 0.625], 0.08131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.75: [0.5, 0.0], 0.104272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.973214285714: [0.75, 0.25], 0.443558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.713010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.253826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.887755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.035714285714: [0.5, 0.0], 0.287946428571: [0.875, 0.125], 0.142538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.892857142857: [0.5, 0.0], 0.238520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.345663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.561224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.680803571429: [0.875, 0.125], 0.177295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.988520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.259885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.454081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.45631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.377232142857: [0.375, 0.625], 0.19387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.580357142857: [0.75, 0.25], 0.742028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.032844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.981823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.357142857143: [0.5, 0.0], 0.645089285714: [0.875, 0.125], 0.468112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.425701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.277742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.122448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.535395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.258928571429: [0.25, 0.75], 0.086415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.588966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.372448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.938456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.867028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.355867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.366071428571: [0.75, 0.25], 0.294642857143: [0.25, 0.75], 0.713966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.464285714286: [0.5, 0.0], 0.017538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.313456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.738520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.854272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.606823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.675701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.948660714286: [0.375, 0.625], 0.389987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.020089285714: [0.375, 0.625], 0.67825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.384885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.359375: [0.875, 0.125], 0.265306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.770089285714: [0.375, 0.625], 0.099170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.575255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.289540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.395089285714: [0.875, 0.125], 0.917091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.821428571429: [0.5, 0.0], 0.658163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.927295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.178571428571: [0.5, 0.0], 0.670599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.352040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.311224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.014987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.213010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.729272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.709183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.071109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.229272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.604272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.09693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.821109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.338966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.461415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.652742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.723214285714: [0.75, 0.25], 0.231823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.066326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.55325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.275510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.452806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.157844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.989795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.002232142857: [0.875, 0.125], 0.624681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.336734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.489795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.84693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.05325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.63137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.800701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.525510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.420599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.039540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.9375: [0.75, 0.25], 0.678571428571: [0.5, 0.0], 0.080357142857: [0.25, 0.75], 0.151785714286: [0.25, 0.75], 0.866071428571: [0.75, 0.25], 0.80325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.320153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.198660714286: [0.375, 0.625], 0.202806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.627232142857: [0.375, 0.625], 0.774234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.479591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.739795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.563456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.891581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.497130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.545599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.162946428571: [0.375, 0.625], 0.908163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.711415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.050701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.896683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.860969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.902742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.765306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.282844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.463966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.356823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.360969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.702806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.794642857143: [0.75, 0.25], 0.830357142857: [0.75, 0.25], 0.928571428571: [0.5, 0.0], 0.923469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.204081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.918367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.677295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.401785714286: [0.75, 0.25], 0.146683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.025510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.836734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.747130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.38137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.063456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.855867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.418367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.168367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.474170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.239795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.196109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.752232142857: [0.875, 0.125], 0.825255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.789540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.816326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.106823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.075255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.027742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.550701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.17825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.402742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.503826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.508928571429: [0.75, 0.25], 0.92825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.595663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.341517857143: [0.375, 0.625], 0.318558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.213966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.423469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.374681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.809948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.599170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.716517857143: [0.875, 0.125], 0.943558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.035395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.438456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.295599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.994897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.145089285714: [0.875, 0.125], 0.729591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.609375: [0.875, 0.125], 0.229591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.494897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.309948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.857142857143: [0.5, 0.0], 0.4375: [0.75, 0.25], 0.852040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.484375: [0.375, 0.625], 0.895089285714: [0.875, 0.125], 0.524234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.158163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.642857142857: [0.5, 0.0], 0.321109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.952806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.285714285714: [0.5, 0.0], 0.408163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.660395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.966517857143: [0.875, 0.125], 0.872448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.070153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.141581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.446109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.998724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.330357142857: [0.75, 0.25], 0.44387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.008928571429: [0.25, 0.75], 0.910395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.968112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.83131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.105867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.963010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.764987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.805803571429: [0.625, 0.375], 0.030612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.305803571429: [0.375, 0.625], 0.134885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.731823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.573660714286: [0.875, 0.125], 0.591517857143: [0.375, 0.625], 0.055803571429: [0.375, 0.625], 0.142857142857: [0.5, 0.0], 0.13137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.734375: [0.375, 0.625], 0.28443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.059948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.170599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.872130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.068558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.110969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.718112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.877232142857: [0.375, 0.625], 0.264987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.173469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.336415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.795599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.073660714286: [0.875, 0.125], 0.801020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.704081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.285395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.137755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.30325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.300701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.874681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.095663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.061224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.838966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.387755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.044642857143: [0.25, 0.75], 0.180803571429: [0.875, 0.125], 0.901785714286: [0.75, 0.25], 0.696109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.223214285714: [0.75, 0.25], 0.463010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.051020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.20631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.182397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.224170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.193558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.820153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.53443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.107142857143: [0.5, 0.0], 0.992028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.748724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.132653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.954081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.961415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.124681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.247130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.566326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.242028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.167091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.698660714286: [0.375, 0.625], 0.641581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.845663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.69387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.515306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.785714285714: [0.5, 0.0], 0.964285714286: [0.5, 0.0], 0.527742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.639987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.997130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.139987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.116071428571: [0.25, 0.75], 0.071428571429: [0.5, 0.0], 0.634885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.767538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.391581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.642538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.811224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.417091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.920599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.122130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.859375: [0.875, 0.125], 0.932397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.622448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.252232142857: [0.875, 0.125], 0.724170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.787946428571: [0.875, 0.125], 0.782844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.551020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.586734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.396683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.963966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.479272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.514987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.34693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.428571428571: [0.5, 0.0], 0.974170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.249681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.216517857143: [0.875, 0.125], 0.925701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.979591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.530612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.33131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.884885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.367028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.539540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.152742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.602040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.775510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.372130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.979272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.617028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.492028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.607142857143: [0.5, 0.0], 0.662946428571: [0.375, 0.625], 0.321428571429: [0.5, 0.0], 0.605867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.325255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.930803571429: [0.875, 0.125], 0.175701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.610969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.091517857143: [0.375, 0.625], 0.759885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.616071428571: [0.75, 0.25], 0.410395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.892538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.849170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.688456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.160395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.520089285714: [0.375, 0.625], 0.466517857143: [0.875, 0.125], 0.117028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.818558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.984375: [0.625, 0.375], 0.509885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.498724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.045599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.912946428571: [0.625, 0.375], 0.481823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.407844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.907844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.749681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.785395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.568558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.682397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.58131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.088966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.841517857143: [0.375, 0.625], 0.430803571429: [0.875, 0.125], 0.024234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.70631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.037946428571: [0.875, 0.125], 0.632653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.218112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.086734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.349170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.88137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.392538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.570153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.777742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.95631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.532844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.323660714286: [0.875, 0.125], 0.499681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.316326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.544642857143: [0.75, 0.25], 0.622130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.586415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.673469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.274234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.427295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.637755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.102040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.758928571429: [0.75, 0.25], 0.267538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.555803571429: [0.375, 0.625], 0.211415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.714285714286: [0.5, 0.0], 0.459183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.889987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.448660714286: [0.375, 0.625], 0.571109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.667091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.94387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.432397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.571428571429: [0.5, 0.0], 0.214285714286: [0.5, 0.0], 0.42825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.280612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.693558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.646683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.248724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.234375: [0.375, 0.625], 0.836415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.25: [0.5, 0.0], 0.959183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.003826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.668367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.517538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.301020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429]}
averages_odd={0.0: [0.5, 0.0], 0.109375: [0.875, 0.125], 0.1875: [0.25, 0.75], 0.392857142857: [0.5, 0.0], 0.127232142857: [0.375, 0.625], 0.188456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.209183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.744897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.856823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.5: [0.5, 0.0], 0.946109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.657844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.03443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.244897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.354272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.535714285714: [0.5, 0.0], 0.473214285714: [0.75, 0.25], 0.78443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.753826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.59693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.537946428571: [0.875, 0.125], 0.813456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.780612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.015306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.488520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.999681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.559948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.382653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.651785714286: [0.75, 0.25], 0.009885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.823660714286: [0.875, 0.125], 0.6875: [0.75, 0.25], 0.412946428571: [0.375, 0.625], 0.882653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.502232142857: [0.875, 0.125], 0.270089285714: [0.375, 0.625], 0.08131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.75: [0.5, 0.0], 0.104272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.973214285714: [0.75, 0.25], 0.443558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.713010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.253826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.887755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.035714285714: [0.5, 0.0], 0.287946428571: [0.875, 0.125], 0.142538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.892857142857: [0.5, 0.0], 0.238520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.345663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.561224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.680803571429: [0.875, 0.125], 0.177295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.988520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.259885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.454081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.45631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.377232142857: [0.375, 0.625], 0.19387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.580357142857: [0.75, 0.25], 0.742028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.032844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.981823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.357142857143: [0.5, 0.0], 0.645089285714: [0.875, 0.125], 0.468112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.425701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.277742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.122448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.535395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.258928571429: [0.25, 0.75], 0.086415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.588966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.372448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.938456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.867028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.355867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.366071428571: [0.75, 0.25], 0.294642857143: [0.25, 0.75], 0.713966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.464285714286: [0.5, 0.0], 0.017538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.313456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.738520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.854272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.606823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.675701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.948660714286: [0.375, 0.625], 0.389987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.020089285714: [0.375, 0.625], 0.67825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.384885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.359375: [0.875, 0.125], 0.265306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.770089285714: [0.375, 0.625], 0.099170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.575255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.289540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.395089285714: [0.875, 0.125], 0.917091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.821428571429: [0.5, 0.0], 0.658163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.927295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.178571428571: [0.5, 0.0], 0.670599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.352040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.311224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.014987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.213010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.729272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.709183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.071109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.229272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.604272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.09693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.821109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.338966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.461415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.652742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.723214285714: [0.75, 0.25], 0.231823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.066326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.55325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.275510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.452806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.157844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.989795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.002232142857: [0.875, 0.125], 0.624681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.336734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.489795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.84693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.05325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.63137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.800701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.525510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.420599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.039540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.9375: [0.75, 0.25], 0.678571428571: [0.5, 0.0], 0.080357142857: [0.25, 0.75], 0.151785714286: [0.25, 0.75], 0.866071428571: [0.75, 0.25], 0.80325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.320153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.198660714286: [0.375, 0.625], 0.202806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.627232142857: [0.375, 0.625], 0.774234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.479591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.739795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.563456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.891581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.497130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.545599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.162946428571: [0.375, 0.625], 0.908163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.711415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.050701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.896683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.860969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.902742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.765306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.282844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.463966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.356823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.360969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.702806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.794642857143: [0.75, 0.25], 0.830357142857: [0.75, 0.25], 0.928571428571: [0.5, 0.0], 0.923469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.204081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.918367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.677295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.401785714286: [0.75, 0.25], 0.146683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.025510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.836734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.747130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.38137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.063456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.855867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.418367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.168367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.474170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.239795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.196109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.752232142857: [0.875, 0.125], 0.825255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.789540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.816326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.106823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.075255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.027742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.550701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.17825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.402742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.503826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.508928571429: [0.75, 0.25], 0.92825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.595663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.341517857143: [0.375, 0.625], 0.318558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.213966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.423469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.374681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.809948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.599170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.716517857143: [0.875, 0.125], 0.943558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.035395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.438456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.295599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.994897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.145089285714: [0.875, 0.125], 0.729591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.609375: [0.875, 0.125], 0.229591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.494897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.309948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.857142857143: [0.5, 0.0], 0.4375: [0.75, 0.25], 0.852040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.484375: [0.375, 0.625], 0.895089285714: [0.875, 0.125], 0.524234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.158163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.642857142857: [0.5, 0.0], 0.321109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.952806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.285714285714: [0.5, 0.0], 0.408163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.660395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.966517857143: [0.875, 0.125], 0.872448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.070153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.141581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.446109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.998724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.330357142857: [0.75, 0.25], 0.44387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.008928571429: [0.25, 0.75], 0.910395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.968112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.83131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.105867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.963010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.764987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.805803571429: [0.625, 0.375], 0.030612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.305803571429: [0.375, 0.625], 0.134885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.731823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.573660714286: [0.875, 0.125], 0.591517857143: [0.375, 0.625], 0.055803571429: [0.375, 0.625], 0.142857142857: [0.5, 0.0], 0.13137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.734375: [0.375, 0.625], 0.28443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.059948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.170599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.872130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.068558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.110969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.718112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.877232142857: [0.375, 0.625], 0.264987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.173469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.336415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.795599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.073660714286: [0.875, 0.125], 0.801020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.704081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.285395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.137755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.30325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.300701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.874681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.095663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.061224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.838966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.387755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.044642857143: [0.25, 0.75], 0.180803571429: [0.875, 0.125], 0.901785714286: [0.75, 0.25], 0.696109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.223214285714: [0.75, 0.25], 0.463010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.051020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.20631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.182397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.224170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.193558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.820153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.53443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.107142857143: [0.5, 0.0], 0.992028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.748724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.132653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.954081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.961415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.124681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.247130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.566326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.242028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.167091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.698660714286: [0.375, 0.625], 0.641581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.845663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.69387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.515306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.785714285714: [0.5, 0.0], 0.964285714286: [0.5, 0.0], 0.527742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.639987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.997130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.139987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.116071428571: [0.25, 0.75], 0.071428571429: [0.5, 0.0], 0.634885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.767538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.391581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.642538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.811224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.417091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.920599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.122130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.859375: [0.875, 0.125], 0.932397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.622448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.252232142857: [0.875, 0.125], 0.724170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.787946428571: [0.875, 0.125], 0.782844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.551020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.586734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.396683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.963966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.479272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.514987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.34693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.428571428571: [0.5, 0.0], 0.974170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.249681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.216517857143: [0.875, 0.125], 0.925701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.979591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.530612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.33131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.884885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.367028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.539540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.152742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.602040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.775510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.372130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.979272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.617028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.492028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.607142857143: [0.5, 0.0], 0.662946428571: [0.375, 0.625], 0.321428571429: [0.5, 0.0], 0.605867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.325255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.930803571429: [0.875, 0.125], 0.175701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.610969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.091517857143: [0.375, 0.625], 0.759885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.616071428571: [0.75, 0.25], 0.410395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.892538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.849170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.688456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.160395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.520089285714: [0.375, 0.625], 0.466517857143: [0.875, 0.125], 0.117028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.818558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.984375: [0.625, 0.375], 0.509885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.498724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.045599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.912946428571: [0.625, 0.375], 0.481823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.407844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.907844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.749681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.785395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.568558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.682397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.58131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.088966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.841517857143: [0.375, 0.625], 0.430803571429: [0.875, 0.125], 0.024234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.70631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.037946428571: [0.875, 0.125], 0.632653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.218112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.086734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.349170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.88137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.392538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.570153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.777742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.95631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.532844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.323660714286: [0.875, 0.125], 0.499681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.316326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.544642857143: [0.75, 0.25], 0.622130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.586415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.673469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.274234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.427295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.637755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.102040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.758928571429: [0.75, 0.25], 0.267538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.555803571429: [0.375, 0.625], 0.211415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.714285714286: [0.5, 0.0], 0.459183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.889987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.448660714286: [0.375, 0.625], 0.571109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.667091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.94387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.432397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.571428571429: [0.5, 0.0], 0.214285714286: [0.5, 0.0], 0.42825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.280612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.693558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.646683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.248724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.234375: [0.375, 0.625], 0.836415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.25: [0.5, 0.0], 0.959183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.003826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.668367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.517538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.301020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429]}
|
pattern_zero = [0.0, 0.017538265306, 0.03443877551, 0.035714285714, 0.050701530612, 0.05325255102, 0.066326530612, 0.070153061224, 0.071428571429, 0.08131377551, 0.086415816327, 0.088966836735, 0.095663265306, 0.102040816327, 0.105867346939, 0.107142857143, 0.109375, 0.117028061224, 0.122130102041, 0.122448979592, 0.124681122449, 0.13137755102, 0.134885204082, 0.137755102041, 0.141581632653, 0.142857142857, 0.145089285714, 0.146683673469, 0.152742346939, 0.157844387755, 0.158163265306, 0.160395408163, 0.167091836735, 0.168367346939, 0.170599489796, 0.173469387755, 0.177295918367, 0.17825255102, 0.178571428571, 0.180803571429, 0.182397959184, 0.1875, 0.188456632653, 0.193558673469, 0.19387755102, 0.196109693878, 0.202806122449, 0.204081632653, 0.20631377551, 0.209183673469, 0.211415816327, 0.213010204082, 0.213966836735, 0.214285714286, 0.216517857143, 0.218112244898, 0.223214285714, 0.224170918367, 0.229272959184, 0.229591836735, 0.231823979592, 0.234375, 0.238520408163, 0.239795918367, 0.242028061224, 0.244897959184, 0.247130102041, 0.248724489796, 0.249681122449, 0.25, 0.252232142857, 0.253826530612, 0.258928571429, 0.259885204082, 0.264987244898, 0.265306122449, 0.267538265306, 0.270089285714, 0.274234693878, 0.275510204082, 0.277742346939, 0.280612244898, 0.282844387755, 0.28443877551, 0.285395408163, 0.285714285714, 0.287946428571, 0.289540816327, 0.294642857143, 0.295599489796, 0.300701530612, 0.301020408163, 0.30325255102, 0.305803571429, 0.309948979592, 0.311224489796, 0.313456632653, 0.316326530612, 0.318558673469, 0.320153061224, 0.321109693878, 0.321428571429, 0.323660714286, 0.325255102041, 0.330357142857, 0.33131377551, 0.336415816327, 0.336734693878, 0.338966836735, 0.341517857143, 0.345663265306, 0.34693877551, 0.349170918367, 0.352040816327, 0.354272959184, 0.355867346939, 0.356823979592, 0.357142857143, 0.359375, 0.360969387755, 0.366071428571, 0.367028061224, 0.372130102041, 0.372448979592, 0.374681122449, 0.377232142857, 0.38137755102, 0.382653061224, 0.384885204082, 0.387755102041, 0.389987244898, 0.391581632653, 0.392538265306, 0.392857142857, 0.395089285714, 0.396683673469, 0.401785714286, 0.402742346939, 0.407844387755, 0.408163265306, 0.410395408163, 0.412946428571, 0.417091836735, 0.418367346939, 0.420599489796, 0.423469387755, 0.425701530612, 0.427295918367, 0.42825255102, 0.428571428571, 0.430803571429, 0.432397959184, 0.4375, 0.438456632653, 0.443558673469, 0.44387755102, 0.446109693878, 0.448660714286, 0.452806122449, 0.454081632653, 0.45631377551, 0.459183673469, 0.461415816327, 0.463010204082, 0.463966836735, 0.464285714286, 0.466517857143, 0.468112244898, 0.473214285714, 0.474170918367, 0.479272959184, 0.479591836735, 0.481823979592, 0.484375, 0.488520408163, 0.489795918367, 0.492028061224, 0.494897959184, 0.497130102041, 0.498724489796, 0.499681122449, 0.5, 0.502232142857, 0.503826530612, 0.508928571429, 0.509885204082, 0.514987244898, 0.515306122449, 0.517538265306, 0.520089285714, 0.524234693878, 0.525510204082, 0.527742346939, 0.530612244898, 0.532844387755, 0.53443877551, 0.535395408163, 0.535714285714, 0.537946428571, 0.539540816327, 0.544642857143, 0.545599489796, 0.550701530612, 0.551020408163, 0.55325255102, 0.555803571429, 0.559948979592, 0.561224489796, 0.563456632653, 0.566326530612, 0.568558673469, 0.570153061224, 0.571109693878, 0.571428571429, 0.573660714286, 0.575255102041, 0.580357142857, 0.58131377551, 0.586415816327, 0.586734693878, 0.588966836735, 0.591517857143, 0.595663265306, 0.59693877551, 0.599170918367, 0.602040816327, 0.604272959184, 0.605867346939, 0.606823979592, 0.607142857143, 0.609375, 0.610969387755, 0.616071428571, 0.617028061224, 0.622130102041, 0.622448979592, 0.624681122449, 0.627232142857, 0.63137755102, 0.632653061224, 0.634885204082, 0.637755102041, 0.639987244898, 0.641581632653, 0.642538265306, 0.642857142857, 0.645089285714, 0.646683673469, 0.651785714286, 0.652742346939, 0.657844387755, 0.658163265306, 0.660395408163, 0.662946428571, 0.667091836735, 0.668367346939, 0.670599489796, 0.673469387755, 0.675701530612, 0.677295918367, 0.67825255102, 0.678571428571, 0.680803571429, 0.682397959184, 0.6875, 0.688456632653, 0.693558673469, 0.69387755102, 0.696109693878, 0.698660714286, 0.702806122449, 0.704081632653, 0.70631377551, 0.709183673469, 0.711415816327, 0.713010204082, 0.713966836735, 0.714285714286, 0.716517857143, 0.718112244898, 0.723214285714, 0.724170918367, 0.729272959184, 0.729591836735, 0.731823979592, 0.734375, 0.738520408163, 0.739795918367, 0.742028061224, 0.744897959184, 0.747130102041, 0.748724489796, 0.749681122449, 0.75, 0.752232142857, 0.753826530612, 0.758928571429, 0.759885204082, 0.764987244898, 0.765306122449, 0.767538265306, 0.770089285714, 0.774234693878, 0.775510204082, 0.777742346939, 0.780612244898, 0.782844387755, 0.78443877551, 0.785395408163, 0.785714285714, 0.787946428571, 0.789540816327, 0.794642857143, 0.795599489796, 0.800701530612, 0.801020408163, 0.80325255102, 0.805803571429, 0.809948979592, 0.811224489796, 0.813456632653, 0.816326530612, 0.818558673469, 0.820153061224, 0.821109693878, 0.821428571429, 0.823660714286, 0.825255102041, 0.830357142857, 0.83131377551, 0.836415816327, 0.836734693878, 0.838966836735, 0.841517857143, 0.845663265306, 0.84693877551, 0.849170918367, 0.852040816327, 0.854272959184, 0.855867346939, 0.856823979592, 0.857142857143, 0.859375, 0.860969387755, 0.866071428571, 0.867028061224, 0.872130102041, 0.872448979592, 0.874681122449, 0.877232142857, 0.88137755102, 0.882653061224, 0.884885204082, 0.887755102041, 0.889987244898, 0.891581632653, 0.892538265306, 0.892857142857, 0.895089285714, 0.896683673469, 0.901785714286, 0.902742346939, 0.907844387755, 0.908163265306, 0.910395408163, 0.912946428571, 0.917091836735, 0.918367346939, 0.920599489796, 0.923469387755, 0.925701530612, 0.927295918367, 0.92825255102, 0.928571428571, 0.930803571429, 0.932397959184, 0.9375, 0.938456632653, 0.943558673469, 0.94387755102, 0.946109693878, 0.948660714286, 0.952806122449, 0.954081632653, 0.95631377551, 0.959183673469, 0.961415816327, 0.963010204082, 0.963966836735, 0.964285714286, 0.966517857143, 0.968112244898, 0.973214285714, 0.974170918367, 0.979272959184, 0.979591836735, 0.981823979592, 0.984375, 0.988520408163, 0.989795918367, 0.992028061224, 0.994897959184, 0.997130102041, 0.998724489796, 0.999681122449]
pattern_odd = [0.0, 0.002232142857, 0.003826530612, 0.008928571429, 0.009885204082, 0.014987244898, 0.015306122449, 0.017538265306, 0.020089285714, 0.024234693878, 0.025510204082, 0.027742346939, 0.030612244898, 0.032844387755, 0.03443877551, 0.035395408163, 0.035714285714, 0.037946428571, 0.039540816327, 0.044642857143, 0.045599489796, 0.050701530612, 0.051020408163, 0.05325255102, 0.055803571429, 0.059948979592, 0.061224489796, 0.063456632653, 0.066326530612, 0.068558673469, 0.070153061224, 0.071109693878, 0.071428571429, 0.073660714286, 0.075255102041, 0.080357142857, 0.08131377551, 0.086415816327, 0.086734693878, 0.088966836735, 0.091517857143, 0.095663265306, 0.09693877551, 0.099170918367, 0.102040816327, 0.104272959184, 0.105867346939, 0.106823979592, 0.107142857143, 0.109375, 0.110969387755, 0.116071428571, 0.117028061224, 0.122130102041, 0.122448979592, 0.124681122449, 0.127232142857, 0.13137755102, 0.132653061224, 0.134885204082, 0.137755102041, 0.139987244898, 0.141581632653, 0.142538265306, 0.142857142857, 0.145089285714, 0.146683673469, 0.151785714286, 0.152742346939, 0.157844387755, 0.158163265306, 0.160395408163, 0.162946428571, 0.167091836735, 0.168367346939, 0.170599489796, 0.173469387755, 0.175701530612, 0.177295918367, 0.17825255102, 0.178571428571, 0.180803571429, 0.182397959184, 0.1875, 0.188456632653, 0.193558673469, 0.19387755102, 0.196109693878, 0.198660714286, 0.202806122449, 0.204081632653, 0.20631377551, 0.209183673469, 0.211415816327, 0.213010204082, 0.213966836735, 0.214285714286, 0.216517857143, 0.218112244898, 0.223214285714, 0.224170918367, 0.229272959184, 0.229591836735, 0.231823979592, 0.234375, 0.238520408163, 0.239795918367, 0.242028061224, 0.244897959184, 0.247130102041, 0.248724489796, 0.249681122449, 0.25, 0.252232142857, 0.253826530612, 0.258928571429, 0.259885204082, 0.264987244898, 0.265306122449, 0.267538265306, 0.270089285714, 0.274234693878, 0.275510204082, 0.277742346939, 0.280612244898, 0.282844387755, 0.28443877551, 0.285395408163, 0.285714285714, 0.287946428571, 0.289540816327, 0.294642857143, 0.295599489796, 0.300701530612, 0.301020408163, 0.30325255102, 0.305803571429, 0.309948979592, 0.311224489796, 0.313456632653, 0.316326530612, 0.318558673469, 0.320153061224, 0.321109693878, 0.321428571429, 0.323660714286, 0.325255102041, 0.330357142857, 0.33131377551, 0.336415816327, 0.336734693878, 0.338966836735, 0.341517857143, 0.345663265306, 0.34693877551, 0.349170918367, 0.352040816327, 0.354272959184, 0.355867346939, 0.356823979592, 0.357142857143, 0.359375, 0.360969387755, 0.366071428571, 0.367028061224, 0.372130102041, 0.372448979592, 0.374681122449, 0.377232142857, 0.38137755102, 0.382653061224, 0.384885204082, 0.387755102041, 0.389987244898, 0.391581632653, 0.392538265306, 0.392857142857, 0.395089285714, 0.396683673469, 0.401785714286, 0.402742346939, 0.407844387755, 0.408163265306, 0.410395408163, 0.412946428571, 0.417091836735, 0.418367346939, 0.420599489796, 0.423469387755, 0.425701530612, 0.427295918367, 0.42825255102, 0.428571428571, 0.430803571429, 0.432397959184, 0.4375, 0.438456632653, 0.443558673469, 0.44387755102, 0.446109693878, 0.448660714286, 0.452806122449, 0.454081632653, 0.45631377551, 0.459183673469, 0.461415816327, 0.463010204082, 0.463966836735, 0.464285714286, 0.466517857143, 0.468112244898, 0.473214285714, 0.474170918367, 0.479272959184, 0.479591836735, 0.481823979592, 0.484375, 0.488520408163, 0.489795918367, 0.492028061224, 0.494897959184, 0.497130102041, 0.498724489796, 0.499681122449, 0.5, 0.502232142857, 0.503826530612, 0.508928571429, 0.509885204082, 0.514987244898, 0.515306122449, 0.517538265306, 0.520089285714, 0.524234693878, 0.525510204082, 0.527742346939, 0.530612244898, 0.532844387755, 0.53443877551, 0.535395408163, 0.535714285714, 0.537946428571, 0.539540816327, 0.544642857143, 0.545599489796, 0.550701530612, 0.551020408163, 0.55325255102, 0.555803571429, 0.559948979592, 0.561224489796, 0.563456632653, 0.566326530612, 0.568558673469, 0.570153061224, 0.571109693878, 0.571428571429, 0.573660714286, 0.575255102041, 0.580357142857, 0.58131377551, 0.586415816327, 0.586734693878, 0.588966836735, 0.591517857143, 0.595663265306, 0.59693877551, 0.599170918367, 0.602040816327, 0.604272959184, 0.605867346939, 0.606823979592, 0.607142857143, 0.609375, 0.610969387755, 0.616071428571, 0.617028061224, 0.622130102041, 0.622448979592, 0.624681122449, 0.627232142857, 0.63137755102, 0.632653061224, 0.634885204082, 0.637755102041, 0.639987244898, 0.641581632653, 0.642538265306, 0.642857142857, 0.645089285714, 0.646683673469, 0.651785714286, 0.652742346939, 0.657844387755, 0.658163265306, 0.660395408163, 0.662946428571, 0.667091836735, 0.668367346939, 0.670599489796, 0.673469387755, 0.675701530612, 0.677295918367, 0.67825255102, 0.678571428571, 0.680803571429, 0.682397959184, 0.6875, 0.688456632653, 0.693558673469, 0.69387755102, 0.696109693878, 0.698660714286, 0.702806122449, 0.704081632653, 0.70631377551, 0.709183673469, 0.711415816327, 0.713010204082, 0.713966836735, 0.714285714286, 0.716517857143, 0.718112244898, 0.723214285714, 0.724170918367, 0.729272959184, 0.729591836735, 0.731823979592, 0.734375, 0.738520408163, 0.739795918367, 0.742028061224, 0.744897959184, 0.747130102041, 0.748724489796, 0.749681122449, 0.75, 0.752232142857, 0.753826530612, 0.758928571429, 0.759885204082, 0.764987244898, 0.765306122449, 0.767538265306, 0.770089285714, 0.774234693878, 0.775510204082, 0.777742346939, 0.780612244898, 0.782844387755, 0.78443877551, 0.785395408163, 0.785714285714, 0.787946428571, 0.789540816327, 0.794642857143, 0.795599489796, 0.800701530612, 0.801020408163, 0.80325255102, 0.805803571429, 0.809948979592, 0.811224489796, 0.813456632653, 0.816326530612, 0.818558673469, 0.820153061224, 0.821109693878, 0.821428571429, 0.823660714286, 0.825255102041, 0.830357142857, 0.83131377551, 0.836415816327, 0.836734693878, 0.838966836735, 0.841517857143, 0.845663265306, 0.84693877551, 0.849170918367, 0.852040816327, 0.854272959184, 0.855867346939, 0.856823979592, 0.857142857143, 0.859375, 0.860969387755, 0.866071428571, 0.867028061224, 0.872130102041, 0.872448979592, 0.874681122449, 0.877232142857, 0.88137755102, 0.882653061224, 0.884885204082, 0.887755102041, 0.889987244898, 0.891581632653, 0.892538265306, 0.892857142857, 0.895089285714, 0.896683673469, 0.901785714286, 0.902742346939, 0.907844387755, 0.908163265306, 0.910395408163, 0.912946428571, 0.917091836735, 0.918367346939, 0.920599489796, 0.923469387755, 0.925701530612, 0.927295918367, 0.92825255102, 0.928571428571, 0.930803571429, 0.932397959184, 0.9375, 0.938456632653, 0.943558673469, 0.94387755102, 0.946109693878, 0.948660714286, 0.952806122449, 0.954081632653, 0.95631377551, 0.959183673469, 0.961415816327, 0.963010204082, 0.963966836735, 0.964285714286, 0.966517857143, 0.968112244898, 0.973214285714, 0.974170918367, 0.979272959184, 0.979591836735, 0.981823979592, 0.984375, 0.988520408163, 0.989795918367, 0.992028061224, 0.994897959184, 0.997130102041, 0.998724489796, 0.999681122449]
pattern_even = [0.0, 0.002232142857, 0.003826530612, 0.008928571429, 0.009885204082, 0.014987244898, 0.015306122449, 0.017538265306, 0.020089285714, 0.024234693878, 0.025510204082, 0.027742346939, 0.030612244898, 0.032844387755, 0.03443877551, 0.035395408163, 0.035714285714, 0.037946428571, 0.039540816327, 0.044642857143, 0.045599489796, 0.050701530612, 0.051020408163, 0.05325255102, 0.055803571429, 0.059948979592, 0.061224489796, 0.063456632653, 0.066326530612, 0.068558673469, 0.070153061224, 0.071109693878, 0.071428571429, 0.073660714286, 0.075255102041, 0.080357142857, 0.08131377551, 0.086415816327, 0.086734693878, 0.088966836735, 0.091517857143, 0.095663265306, 0.09693877551, 0.099170918367, 0.102040816327, 0.104272959184, 0.105867346939, 0.106823979592, 0.107142857143, 0.109375, 0.110969387755, 0.116071428571, 0.117028061224, 0.122130102041, 0.122448979592, 0.124681122449, 0.127232142857, 0.13137755102, 0.132653061224, 0.134885204082, 0.137755102041, 0.139987244898, 0.141581632653, 0.142538265306, 0.142857142857, 0.145089285714, 0.146683673469, 0.151785714286, 0.152742346939, 0.157844387755, 0.158163265306, 0.160395408163, 0.162946428571, 0.167091836735, 0.168367346939, 0.170599489796, 0.173469387755, 0.175701530612, 0.177295918367, 0.17825255102, 0.178571428571, 0.180803571429, 0.182397959184, 0.1875, 0.188456632653, 0.193558673469, 0.19387755102, 0.196109693878, 0.198660714286, 0.202806122449, 0.204081632653, 0.20631377551, 0.209183673469, 0.211415816327, 0.213010204082, 0.213966836735, 0.214285714286, 0.216517857143, 0.218112244898, 0.223214285714, 0.224170918367, 0.229272959184, 0.229591836735, 0.231823979592, 0.234375, 0.238520408163, 0.239795918367, 0.242028061224, 0.244897959184, 0.247130102041, 0.248724489796, 0.249681122449, 0.25, 0.252232142857, 0.253826530612, 0.258928571429, 0.259885204082, 0.264987244898, 0.265306122449, 0.267538265306, 0.270089285714, 0.274234693878, 0.275510204082, 0.277742346939, 0.280612244898, 0.282844387755, 0.28443877551, 0.285395408163, 0.285714285714, 0.287946428571, 0.289540816327, 0.294642857143, 0.295599489796, 0.300701530612, 0.301020408163, 0.30325255102, 0.305803571429, 0.309948979592, 0.311224489796, 0.313456632653, 0.316326530612, 0.318558673469, 0.320153061224, 0.321109693878, 0.321428571429, 0.323660714286, 0.325255102041, 0.330357142857, 0.33131377551, 0.336415816327, 0.336734693878, 0.338966836735, 0.341517857143, 0.345663265306, 0.34693877551, 0.349170918367, 0.352040816327, 0.354272959184, 0.355867346939, 0.356823979592, 0.357142857143, 0.359375, 0.360969387755, 0.366071428571, 0.367028061224, 0.372130102041, 0.372448979592, 0.374681122449, 0.377232142857, 0.38137755102, 0.382653061224, 0.384885204082, 0.387755102041, 0.389987244898, 0.391581632653, 0.392538265306, 0.392857142857, 0.395089285714, 0.396683673469, 0.401785714286, 0.402742346939, 0.407844387755, 0.408163265306, 0.410395408163, 0.412946428571, 0.417091836735, 0.418367346939, 0.420599489796, 0.423469387755, 0.425701530612, 0.427295918367, 0.42825255102, 0.428571428571, 0.430803571429, 0.432397959184, 0.4375, 0.438456632653, 0.443558673469, 0.44387755102, 0.446109693878, 0.448660714286, 0.452806122449, 0.454081632653, 0.45631377551, 0.459183673469, 0.461415816327, 0.463010204082, 0.463966836735, 0.464285714286, 0.466517857143, 0.468112244898, 0.473214285714, 0.474170918367, 0.479272959184, 0.479591836735, 0.481823979592, 0.484375, 0.488520408163, 0.489795918367, 0.492028061224, 0.494897959184, 0.497130102041, 0.498724489796, 0.499681122449, 0.5, 0.502232142857, 0.503826530612, 0.508928571429, 0.509885204082, 0.514987244898, 0.515306122449, 0.517538265306, 0.520089285714, 0.524234693878, 0.525510204082, 0.527742346939, 0.530612244898, 0.532844387755, 0.53443877551, 0.535395408163, 0.535714285714, 0.537946428571, 0.539540816327, 0.544642857143, 0.545599489796, 0.550701530612, 0.551020408163, 0.55325255102, 0.555803571429, 0.559948979592, 0.561224489796, 0.563456632653, 0.566326530612, 0.568558673469, 0.570153061224, 0.571109693878, 0.571428571429, 0.573660714286, 0.575255102041, 0.580357142857, 0.58131377551, 0.586415816327, 0.586734693878, 0.588966836735, 0.591517857143, 0.595663265306, 0.59693877551, 0.599170918367, 0.602040816327, 0.604272959184, 0.605867346939, 0.606823979592, 0.607142857143, 0.609375, 0.610969387755, 0.616071428571, 0.617028061224, 0.622130102041, 0.622448979592, 0.624681122449, 0.627232142857, 0.63137755102, 0.632653061224, 0.634885204082, 0.637755102041, 0.639987244898, 0.641581632653, 0.642538265306, 0.642857142857, 0.645089285714, 0.646683673469, 0.651785714286, 0.652742346939, 0.657844387755, 0.658163265306, 0.660395408163, 0.662946428571, 0.667091836735, 0.668367346939, 0.670599489796, 0.673469387755, 0.675701530612, 0.677295918367, 0.67825255102, 0.678571428571, 0.680803571429, 0.682397959184, 0.6875, 0.688456632653, 0.693558673469, 0.69387755102, 0.696109693878, 0.698660714286, 0.702806122449, 0.704081632653, 0.70631377551, 0.709183673469, 0.711415816327, 0.713010204082, 0.713966836735, 0.714285714286, 0.716517857143, 0.718112244898, 0.723214285714, 0.724170918367, 0.729272959184, 0.729591836735, 0.731823979592, 0.734375, 0.738520408163, 0.739795918367, 0.742028061224, 0.744897959184, 0.747130102041, 0.748724489796, 0.749681122449, 0.75, 0.752232142857, 0.753826530612, 0.758928571429, 0.759885204082, 0.764987244898, 0.765306122449, 0.767538265306, 0.770089285714, 0.774234693878, 0.775510204082, 0.777742346939, 0.780612244898, 0.782844387755, 0.78443877551, 0.785395408163, 0.785714285714, 0.787946428571, 0.789540816327, 0.794642857143, 0.795599489796, 0.800701530612, 0.801020408163, 0.80325255102, 0.805803571429, 0.809948979592, 0.811224489796, 0.813456632653, 0.816326530612, 0.818558673469, 0.820153061224, 0.821109693878, 0.821428571429, 0.823660714286, 0.825255102041, 0.830357142857, 0.83131377551, 0.836415816327, 0.836734693878, 0.838966836735, 0.841517857143, 0.845663265306, 0.84693877551, 0.849170918367, 0.852040816327, 0.854272959184, 0.855867346939, 0.856823979592, 0.857142857143, 0.859375, 0.860969387755, 0.866071428571, 0.867028061224, 0.872130102041, 0.872448979592, 0.874681122449, 0.877232142857, 0.88137755102, 0.882653061224, 0.884885204082, 0.887755102041, 0.889987244898, 0.891581632653, 0.892538265306, 0.892857142857, 0.895089285714, 0.896683673469, 0.901785714286, 0.902742346939, 0.907844387755, 0.908163265306, 0.910395408163, 0.912946428571, 0.917091836735, 0.918367346939, 0.920599489796, 0.923469387755, 0.925701530612, 0.927295918367, 0.92825255102, 0.928571428571, 0.930803571429, 0.932397959184, 0.9375, 0.938456632653, 0.943558673469, 0.94387755102, 0.946109693878, 0.948660714286, 0.952806122449, 0.954081632653, 0.95631377551, 0.959183673469, 0.961415816327, 0.963010204082, 0.963966836735, 0.964285714286, 0.966517857143, 0.968112244898, 0.973214285714, 0.974170918367, 0.979272959184, 0.979591836735, 0.981823979592, 0.984375, 0.988520408163, 0.989795918367, 0.992028061224, 0.994897959184, 0.997130102041, 0.998724489796, 0.999681122449]
averages_even = {0.0: [0.5, 0.0], 0.109375: [0.875, 0.125], 0.1875: [0.25, 0.75], 0.392857142857: [0.5, 0.0], 0.127232142857: [0.375, 0.625], 0.188456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.209183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.744897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.856823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.5: [0.5, 0.0], 0.946109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.657844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.03443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.244897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.354272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.535714285714: [0.5, 0.0], 0.473214285714: [0.75, 0.25], 0.78443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.753826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.59693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.537946428571: [0.875, 0.125], 0.813456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.780612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.015306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.488520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.999681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.559948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.382653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.651785714286: [0.75, 0.25], 0.009885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.823660714286: [0.875, 0.125], 0.6875: [0.75, 0.25], 0.412946428571: [0.375, 0.625], 0.882653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.502232142857: [0.875, 0.125], 0.270089285714: [0.375, 0.625], 0.08131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.75: [0.5, 0.0], 0.104272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.973214285714: [0.75, 0.25], 0.443558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.713010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.253826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.887755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.035714285714: [0.5, 0.0], 0.287946428571: [0.875, 0.125], 0.142538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.892857142857: [0.5, 0.0], 0.238520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.345663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.561224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.680803571429: [0.875, 0.125], 0.177295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.988520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.259885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.454081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.45631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.377232142857: [0.375, 0.625], 0.19387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.580357142857: [0.75, 0.25], 0.742028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.032844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.981823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.357142857143: [0.5, 0.0], 0.645089285714: [0.875, 0.125], 0.468112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.425701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.277742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.122448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.535395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.258928571429: [0.25, 0.75], 0.086415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.588966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.372448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.938456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.867028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.355867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.366071428571: [0.75, 0.25], 0.294642857143: [0.25, 0.75], 0.713966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.464285714286: [0.5, 0.0], 0.017538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.313456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.738520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.854272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.606823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.675701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.948660714286: [0.375, 0.625], 0.389987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.020089285714: [0.375, 0.625], 0.67825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.384885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.359375: [0.875, 0.125], 0.265306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.770089285714: [0.375, 0.625], 0.099170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.575255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.289540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.395089285714: [0.875, 0.125], 0.917091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.821428571429: [0.5, 0.0], 0.658163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.927295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.178571428571: [0.5, 0.0], 0.670599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.352040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.311224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.014987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.213010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.729272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.709183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.071109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.229272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.604272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.09693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.821109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.338966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.461415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.652742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.723214285714: [0.75, 0.25], 0.231823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.066326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.55325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.275510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.452806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.157844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.989795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.002232142857: [0.875, 0.125], 0.624681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.336734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.489795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.84693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.05325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.63137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.800701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.525510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.420599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.039540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.9375: [0.75, 0.25], 0.678571428571: [0.5, 0.0], 0.080357142857: [0.25, 0.75], 0.151785714286: [0.25, 0.75], 0.866071428571: [0.75, 0.25], 0.80325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.320153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.198660714286: [0.375, 0.625], 0.202806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.627232142857: [0.375, 0.625], 0.774234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.479591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.739795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.563456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.891581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.497130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.545599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.162946428571: [0.375, 0.625], 0.908163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.711415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.050701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.896683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.860969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.902742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.765306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.282844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.463966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.356823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.360969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.702806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.794642857143: [0.75, 0.25], 0.830357142857: [0.75, 0.25], 0.928571428571: [0.5, 0.0], 0.923469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.204081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.918367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.677295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.401785714286: [0.75, 0.25], 0.146683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.025510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.836734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.747130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.38137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.063456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.855867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.418367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.168367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.474170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.239795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.196109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.752232142857: [0.875, 0.125], 0.825255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.789540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.816326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.106823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.075255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.027742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.550701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.17825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.402742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.503826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.508928571429: [0.75, 0.25], 0.92825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.595663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.341517857143: [0.375, 0.625], 0.318558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.213966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.423469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.374681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.809948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.599170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.716517857143: [0.875, 0.125], 0.943558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.035395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.438456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.295599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.994897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.145089285714: [0.875, 0.125], 0.729591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.609375: [0.875, 0.125], 0.229591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.494897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.309948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.857142857143: [0.5, 0.0], 0.4375: [0.75, 0.25], 0.852040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.484375: [0.375, 0.625], 0.895089285714: [0.875, 0.125], 0.524234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.158163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.642857142857: [0.5, 0.0], 0.321109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.952806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.285714285714: [0.5, 0.0], 0.408163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.660395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.966517857143: [0.875, 0.125], 0.872448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.070153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.141581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.446109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.998724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.330357142857: [0.75, 0.25], 0.44387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.008928571429: [0.25, 0.75], 0.910395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.968112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.83131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.105867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.963010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.764987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.805803571429: [0.625, 0.375], 0.030612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.305803571429: [0.375, 0.625], 0.134885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.731823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.573660714286: [0.875, 0.125], 0.591517857143: [0.375, 0.625], 0.055803571429: [0.375, 0.625], 0.142857142857: [0.5, 0.0], 0.13137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.734375: [0.375, 0.625], 0.28443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.059948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.170599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.872130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.068558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.110969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.718112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.877232142857: [0.375, 0.625], 0.264987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.173469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.336415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.795599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.073660714286: [0.875, 0.125], 0.801020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.704081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.285395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.137755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.30325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.300701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.874681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.095663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.061224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.838966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.387755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.044642857143: [0.25, 0.75], 0.180803571429: [0.875, 0.125], 0.901785714286: [0.75, 0.25], 0.696109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.223214285714: [0.75, 0.25], 0.463010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.051020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.20631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.182397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.224170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.193558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.820153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.53443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.107142857143: [0.5, 0.0], 0.992028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.748724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.132653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.954081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.961415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.124681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.247130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.566326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.242028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.167091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.698660714286: [0.375, 0.625], 0.641581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.845663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.69387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.515306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.785714285714: [0.5, 0.0], 0.964285714286: [0.5, 0.0], 0.527742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.639987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.997130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.139987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.116071428571: [0.25, 0.75], 0.071428571429: [0.5, 0.0], 0.634885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.767538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.391581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.642538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.811224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.417091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.920599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.122130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.859375: [0.875, 0.125], 0.932397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.622448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.252232142857: [0.875, 0.125], 0.724170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.787946428571: [0.875, 0.125], 0.782844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.551020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.586734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.396683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.963966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.479272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.514987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.34693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.428571428571: [0.5, 0.0], 0.974170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.249681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.216517857143: [0.875, 0.125], 0.925701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.979591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.530612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.33131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.884885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.367028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.539540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.152742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.602040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.775510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.372130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.979272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.617028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.492028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.607142857143: [0.5, 0.0], 0.662946428571: [0.375, 0.625], 0.321428571429: [0.5, 0.0], 0.605867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.325255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.930803571429: [0.875, 0.125], 0.175701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.610969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.091517857143: [0.375, 0.625], 0.759885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.616071428571: [0.75, 0.25], 0.410395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.892538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.849170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.688456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.160395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.520089285714: [0.375, 0.625], 0.466517857143: [0.875, 0.125], 0.117028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.818558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.984375: [0.625, 0.375], 0.509885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.498724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.045599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.912946428571: [0.625, 0.375], 0.481823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.407844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.907844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.749681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.785395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.568558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.682397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.58131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.088966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.841517857143: [0.375, 0.625], 0.430803571429: [0.875, 0.125], 0.024234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.70631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.037946428571: [0.875, 0.125], 0.632653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.218112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.086734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.349170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.88137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.392538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.570153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.777742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.95631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.532844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.323660714286: [0.875, 0.125], 0.499681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.316326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.544642857143: [0.75, 0.25], 0.622130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.586415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.673469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.274234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.427295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.637755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.102040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.758928571429: [0.75, 0.25], 0.267538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.555803571429: [0.375, 0.625], 0.211415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.714285714286: [0.5, 0.0], 0.459183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.889987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.448660714286: [0.375, 0.625], 0.571109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.667091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.94387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.432397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.571428571429: [0.5, 0.0], 0.214285714286: [0.5, 0.0], 0.42825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.280612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.693558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.646683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.248724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.234375: [0.375, 0.625], 0.836415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.25: [0.5, 0.0], 0.959183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.003826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.668367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.517538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.301020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429]}
averages_odd = {0.0: [0.5, 0.0], 0.109375: [0.875, 0.125], 0.1875: [0.25, 0.75], 0.392857142857: [0.5, 0.0], 0.127232142857: [0.375, 0.625], 0.188456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.209183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.744897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.856823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.5: [0.5, 0.0], 0.946109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.657844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.03443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.244897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.354272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.535714285714: [0.5, 0.0], 0.473214285714: [0.75, 0.25], 0.78443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.753826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.59693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.537946428571: [0.875, 0.125], 0.813456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.780612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.015306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.488520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.999681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.559948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.382653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.651785714286: [0.75, 0.25], 0.009885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.823660714286: [0.875, 0.125], 0.6875: [0.75, 0.25], 0.412946428571: [0.375, 0.625], 0.882653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.502232142857: [0.875, 0.125], 0.270089285714: [0.375, 0.625], 0.08131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.75: [0.5, 0.0], 0.104272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.973214285714: [0.75, 0.25], 0.443558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.713010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.253826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.887755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.035714285714: [0.5, 0.0], 0.287946428571: [0.875, 0.125], 0.142538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.892857142857: [0.5, 0.0], 0.238520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.345663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.561224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.680803571429: [0.875, 0.125], 0.177295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.988520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.259885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.454081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.45631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.377232142857: [0.375, 0.625], 0.19387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.580357142857: [0.75, 0.25], 0.742028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.032844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.981823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.357142857143: [0.5, 0.0], 0.645089285714: [0.875, 0.125], 0.468112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.425701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.277742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.122448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.535395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.258928571429: [0.25, 0.75], 0.086415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.588966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.372448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.938456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.867028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.355867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.366071428571: [0.75, 0.25], 0.294642857143: [0.25, 0.75], 0.713966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.464285714286: [0.5, 0.0], 0.017538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.313456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.738520408163: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.854272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.606823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.675701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.948660714286: [0.375, 0.625], 0.389987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.020089285714: [0.375, 0.625], 0.67825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.384885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.359375: [0.875, 0.125], 0.265306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.770089285714: [0.375, 0.625], 0.099170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.575255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.289540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.395089285714: [0.875, 0.125], 0.917091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.821428571429: [0.5, 0.0], 0.658163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.927295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.178571428571: [0.5, 0.0], 0.670599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.352040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.311224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.014987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.213010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.729272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.709183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.071109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.229272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.604272959184: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.09693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.821109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.338966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.461415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.652742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.723214285714: [0.75, 0.25], 0.231823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.066326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.55325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.275510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.452806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.157844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.989795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.002232142857: [0.875, 0.125], 0.624681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.336734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.489795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.84693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.05325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.63137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.800701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.525510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.420599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.039540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.9375: [0.75, 0.25], 0.678571428571: [0.5, 0.0], 0.080357142857: [0.25, 0.75], 0.151785714286: [0.25, 0.75], 0.866071428571: [0.75, 0.25], 0.80325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.320153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.198660714286: [0.375, 0.625], 0.202806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.627232142857: [0.375, 0.625], 0.774234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.479591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.739795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.563456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.891581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.497130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.545599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.162946428571: [0.375, 0.625], 0.908163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.711415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.050701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.896683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.860969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.902742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.765306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.282844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.463966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.356823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.360969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.702806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.794642857143: [0.75, 0.25], 0.830357142857: [0.75, 0.25], 0.928571428571: [0.5, 0.0], 0.923469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.204081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.918367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.677295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.401785714286: [0.75, 0.25], 0.146683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.025510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.836734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.747130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.38137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.063456632653: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.855867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.418367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.168367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.474170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.239795918367: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.196109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.752232142857: [0.875, 0.125], 0.825255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.789540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.816326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.106823979592: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.075255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.027742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.550701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.17825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.402742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.503826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.508928571429: [0.75, 0.25], 0.92825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.595663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.341517857143: [0.375, 0.625], 0.318558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.213966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.423469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.374681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.809948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.599170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.716517857143: [0.875, 0.125], 0.943558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.035395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.438456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.295599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.994897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.145089285714: [0.875, 0.125], 0.729591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.609375: [0.875, 0.125], 0.229591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.494897959184: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.309948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.857142857143: [0.5, 0.0], 0.4375: [0.75, 0.25], 0.852040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.484375: [0.375, 0.625], 0.895089285714: [0.875, 0.125], 0.524234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.158163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.642857142857: [0.5, 0.0], 0.321109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.952806122449: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.285714285714: [0.5, 0.0], 0.408163265306: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.660395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.966517857143: [0.875, 0.125], 0.872448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.070153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.141581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.446109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.998724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.330357142857: [0.75, 0.25], 0.44387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.008928571429: [0.25, 0.75], 0.910395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.968112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.83131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.105867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.963010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.764987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.805803571429: [0.625, 0.375], 0.030612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.305803571429: [0.375, 0.625], 0.134885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.731823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.573660714286: [0.875, 0.125], 0.591517857143: [0.375, 0.625], 0.055803571429: [0.375, 0.625], 0.142857142857: [0.5, 0.0], 0.13137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.734375: [0.375, 0.625], 0.28443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.059948979592: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.170599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.872130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.068558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.110969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.718112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.877232142857: [0.375, 0.625], 0.264987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.173469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.336415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.795599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.073660714286: [0.875, 0.125], 0.801020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.704081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.285395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.137755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.30325255102: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.300701530612: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.874681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.095663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.061224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.838966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.387755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.044642857143: [0.25, 0.75], 0.180803571429: [0.875, 0.125], 0.901785714286: [0.75, 0.25], 0.696109693878: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.223214285714: [0.75, 0.25], 0.463010204082: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.051020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.20631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.182397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.224170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.193558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.820153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.53443877551: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.107142857143: [0.5, 0.0], 0.992028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.748724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.132653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.954081632653: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.961415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.124681122449: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.247130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.566326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.242028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.167091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.698660714286: [0.375, 0.625], 0.641581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.845663265306: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.69387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.515306122449: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.785714285714: [0.5, 0.0], 0.964285714286: [0.5, 0.0], 0.527742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.639987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.997130102041: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.139987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.116071428571: [0.25, 0.75], 0.071428571429: [0.5, 0.0], 0.634885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.767538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.391581632653: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.642538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.811224489796: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.417091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.920599489796: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.122130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.859375: [0.875, 0.125], 0.932397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.622448979592: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.252232142857: [0.875, 0.125], 0.724170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.787946428571: [0.875, 0.125], 0.782844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.551020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.586734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.396683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.963966836735: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.479272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.514987244898: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.34693877551: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.428571428571: [0.5, 0.0], 0.974170918367: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.249681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.216517857143: [0.875, 0.125], 0.925701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.979591836735: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.530612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.33131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.884885204082: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.367028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.539540816327: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.152742346939: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.602040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.775510204082: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.372130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.979272959184: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.617028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.492028061224: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.607142857143: [0.5, 0.0], 0.662946428571: [0.375, 0.625], 0.321428571429: [0.5, 0.0], 0.605867346939: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.325255102041: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.930803571429: [0.875, 0.125], 0.175701530612: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.610969387755: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.091517857143: [0.375, 0.625], 0.759885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.616071428571: [0.75, 0.25], 0.410395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.892538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.849170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.688456632653: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.160395408163: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.520089285714: [0.375, 0.625], 0.466517857143: [0.875, 0.125], 0.117028061224: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.818558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.984375: [0.625, 0.375], 0.509885204082: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.498724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.045599489796: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.912946428571: [0.625, 0.375], 0.481823979592: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.407844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.907844387755: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.749681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.785395408163: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.568558673469: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.682397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.58131377551: [0.9107142857143, 0.0892857142857, 0.6607142857143, 0.3392857142857], 0.088966836735: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.841517857143: [0.375, 0.625], 0.430803571429: [0.875, 0.125], 0.024234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.70631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.037946428571: [0.875, 0.125], 0.632653061224: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.218112244898: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.086734693878: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.349170918367: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.88137755102: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.392538265306: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.570153061224: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.777742346939: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.95631377551: [0.4107142857143, 0.1607142857143, 0.5892857142857, 0.8392857142857], 0.532844387755: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.323660714286: [0.875, 0.125], 0.499681122449: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.316326530612: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.544642857143: [0.75, 0.25], 0.622130102041: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.586415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.673469387755: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.274234693878: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.427295918367: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.637755102041: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.102040816327: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.758928571429: [0.75, 0.25], 0.267538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.555803571429: [0.375, 0.625], 0.211415816327: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.714285714286: [0.5, 0.0], 0.459183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.889987244898: [0.6964285714286, 0.4464285714286, 0.3035714285714, 0.5535714285714], 0.448660714286: [0.375, 0.625], 0.571109693878: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.667091836735: [0.8928571428571, 0.3928571428571, 0.6071428571429, 0.1071428571429], 0.94387755102: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429], 0.432397959184: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.571428571429: [0.5, 0.0], 0.214285714286: [0.5, 0.0], 0.42825255102: [0.5178571428571, 0.4821428571429, 0.7678571428571, 0.2321428571429], 0.280612244898: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.693558673469: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.646683673469: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.248724489796: [0.0357142857143, 0.9642857142857, 0.5357142857143, 0.4642857142857], 0.234375: [0.375, 0.625], 0.836415816327: [0.9464285714286, 0.1964285714286, 0.0535714285714, 0.8035714285714], 0.25: [0.5, 0.0], 0.959183673469: [0.5714285714286, 0.4285714285714, 0.9285714285714, 0.0714285714286], 0.003826530612: [0.8214285714286, 0.3214285714286, 0.1785714285714, 0.6785714285714], 0.668367346939: [0.2857142857143, 0.7142857142857, 0.7857142857143, 0.2142857142857], 0.517538265306: [0.0178571428571, 0.2678571428571, 0.7321428571429, 0.9821428571429], 0.301020408163: [0.1428571428571, 0.6428571428571, 0.3571428571429, 0.8571428571429]}
|
def main() -> None:
x0, y0, x1, y1 = map(int, input().split())
for dx in range(-2, 3):
for dy in range(-2, 3):
if abs(dx) + abs(dy) != 3:
continue
if abs(dx) == 0 or abs(dy) == 0:
continue
x = x0 + dx
y = y0 + dy
dx = abs(x1 - x)
dy = abs(y1 - y)
if abs(dx) + abs(dy) != 3:
continue
if abs(dx) == 0 or abs(dy) == 0:
continue
print("Yes")
return
print("No")
if __name__ == "__main__":
main()
|
def main() -> None:
(x0, y0, x1, y1) = map(int, input().split())
for dx in range(-2, 3):
for dy in range(-2, 3):
if abs(dx) + abs(dy) != 3:
continue
if abs(dx) == 0 or abs(dy) == 0:
continue
x = x0 + dx
y = y0 + dy
dx = abs(x1 - x)
dy = abs(y1 - y)
if abs(dx) + abs(dy) != 3:
continue
if abs(dx) == 0 or abs(dy) == 0:
continue
print('Yes')
return
print('No')
if __name__ == '__main__':
main()
|
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file was split off from ppapi.gyp to prevent PPAPI users from
# needing to DEPS in ~10K files due to mesa.
{
'includes': [
'../../../third_party/mesa/mesa.gypi',
],
'variables': {
'chromium_code': 1, # Use higher warning level.
},
'targets': [
{
'target_name': 'ppapi_egl',
'type': 'static_library',
'dependencies': [
'<(DEPTH)/ppapi/ppapi.gyp:ppapi_c',
],
'include_dirs': [
'include',
],
'defines': [
# Do not export internal Mesa funcations. Exporting them is not
# required because we are compiling both - API dispatcher and driver
# into a single library.
'PUBLIC=',
# Define a new PPAPI platform.
'_EGL_PLATFORM_PPAPI=_EGL_NUM_PLATFORMS',
'_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_PPAPI',
],
'conditions': [
['OS=="win"', {
'defines': [
'_EGL_OS_WINDOWS',
],
}],
['OS=="mac"', {
# TODO(alokp): Make this compile on mac.
'suppress_wildcard': 1,
}],
],
'sources': [
# Mesa EGL API dispatcher sources.
'<@(mesa_egl_sources)',
# PPAPI EGL driver sources.
'egl/egldriver.c',
'egl/egldriver_ppapi.c',
],
},
],
}
|
{'includes': ['../../../third_party/mesa/mesa.gypi'], 'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'ppapi_egl', 'type': 'static_library', 'dependencies': ['<(DEPTH)/ppapi/ppapi.gyp:ppapi_c'], 'include_dirs': ['include'], 'defines': ['PUBLIC=', '_EGL_PLATFORM_PPAPI=_EGL_NUM_PLATFORMS', '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_PPAPI'], 'conditions': [['OS=="win"', {'defines': ['_EGL_OS_WINDOWS']}], ['OS=="mac"', {'suppress_wildcard': 1}]], 'sources': ['<@(mesa_egl_sources)', 'egl/egldriver.c', 'egl/egldriver_ppapi.c']}]}
|
# 5658. Maximum Absolute Sum of Any Subarray
# Biweekly contest 45
class Solution:
def maxAbsoluteSum(self, nums: List[int]) -> int:
currentmax = globalmax = currentmin = nums[0]
for i in range(1, len(nums)):
x, y = nums[i] + currentmax, nums[i] + currentmin
currentmax = max(nums[i], x, y)
currentmin = min(nums[i], x, y)
globalmax = max(globalmax, abs(currentmax), abs(currentmin))
return globalmax
|
class Solution:
def max_absolute_sum(self, nums: List[int]) -> int:
currentmax = globalmax = currentmin = nums[0]
for i in range(1, len(nums)):
(x, y) = (nums[i] + currentmax, nums[i] + currentmin)
currentmax = max(nums[i], x, y)
currentmin = min(nums[i], x, y)
globalmax = max(globalmax, abs(currentmax), abs(currentmin))
return globalmax
|
# 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.
def capital_checker(dicti):
correct_ans = {"New York": "Albany", "California": "Sacramento", "New Mexico": "Santa Fe", "Florida": "Tallahassee", "Michigan": "Lansing"}
return_dict = {}
for keys,values in dicti.items():
if values.lower() != correct_ans[keys].lower():
return_dict[keys] = "Incorrect"
else:
return_dict[keys] = "Correct"
return return_dict
|
def capital_checker(dicti):
correct_ans = {'New York': 'Albany', 'California': 'Sacramento', 'New Mexico': 'Santa Fe', 'Florida': 'Tallahassee', 'Michigan': 'Lansing'}
return_dict = {}
for (keys, values) in dicti.items():
if values.lower() != correct_ans[keys].lower():
return_dict[keys] = 'Incorrect'
else:
return_dict[keys] = 'Correct'
return return_dict
|
TEST_OCF_ACCOUNTS = (
'sanjay', # an old, sorried account with kerberos princ
'alec', # an old, sorried account with no kerberos princ
'guser', # an account specifically made for testing
'nonexist', # this account does not exist
)
TESTER_CALNET_UIDS = (
872544, # daradib
1034192, # ckuehl
869331, # tzhu
1031366, # mattmcal
1099131, # dkessler
1101587, # jvperrin
1511731, # ethanhs
1623751, # cooperc
1619256, # jaw
)
# comma separated tuples of CalLink OIDs and student group names
TEST_GROUP_ACCOUNTS = (
(91740, 'The Testing Group'), # needs to have a real OID, so boo
(46187, 'Open Computing Facility'), # good old ocf
(46692, 'Awesome Group of Awesome'), # boo another real OID
(92029, 'eXperimental Computing Facility'), # our sister org
)
|
test_ocf_accounts = ('sanjay', 'alec', 'guser', 'nonexist')
tester_calnet_uids = (872544, 1034192, 869331, 1031366, 1099131, 1101587, 1511731, 1623751, 1619256)
test_group_accounts = ((91740, 'The Testing Group'), (46187, 'Open Computing Facility'), (46692, 'Awesome Group of Awesome'), (92029, 'eXperimental Computing Facility'))
|
# -*- coding: utf-8 -*-
"""
awsecommerceservice
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
class Item13(object):
"""Implementation of the 'Item13' model.
TODO: type model description here.
Attributes:
asin (string): TODO: type description here.
offer_listing_id (string): TODO: type description here.
quantity (int): TODO: type description here.
associate_tag (string): TODO: type description here.
list_item_id (string): TODO: type description here.
"""
# Create a mapping from Model property names to API property names
_names = {
"asin":'ASIN',
"offer_listing_id":'OfferListingId',
"quantity":'Quantity',
"associate_tag":'AssociateTag',
"list_item_id":'ListItemId'
}
def __init__(self,
asin=None,
offer_listing_id=None,
quantity=None,
associate_tag=None,
list_item_id=None):
"""Constructor for the Item13 class"""
# Initialize members of the class
self.asin = asin
self.offer_listing_id = offer_listing_id
self.quantity = quantity
self.associate_tag = associate_tag
self.list_item_id = list_item_id
@classmethod
def from_dictionary(cls,
dictionary):
"""Creates an instance of this model from a dictionary
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. The keys
MUST match property names in the API description.
Returns:
object: An instance of this structure class.
"""
if dictionary is None:
return None
# Extract variables from the dictionary
asin = dictionary.get('ASIN')
offer_listing_id = dictionary.get('OfferListingId')
quantity = dictionary.get('Quantity')
associate_tag = dictionary.get('AssociateTag')
list_item_id = dictionary.get('ListItemId')
# Return an object of this model
return cls(asin,
offer_listing_id,
quantity,
associate_tag,
list_item_id)
|
"""
awsecommerceservice
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
class Item13(object):
"""Implementation of the 'Item13' model.
TODO: type model description here.
Attributes:
asin (string): TODO: type description here.
offer_listing_id (string): TODO: type description here.
quantity (int): TODO: type description here.
associate_tag (string): TODO: type description here.
list_item_id (string): TODO: type description here.
"""
_names = {'asin': 'ASIN', 'offer_listing_id': 'OfferListingId', 'quantity': 'Quantity', 'associate_tag': 'AssociateTag', 'list_item_id': 'ListItemId'}
def __init__(self, asin=None, offer_listing_id=None, quantity=None, associate_tag=None, list_item_id=None):
"""Constructor for the Item13 class"""
self.asin = asin
self.offer_listing_id = offer_listing_id
self.quantity = quantity
self.associate_tag = associate_tag
self.list_item_id = list_item_id
@classmethod
def from_dictionary(cls, dictionary):
"""Creates an instance of this model from a dictionary
Args:
dictionary (dictionary): A dictionary representation of the object as
obtained from the deserialization of the server's response. The keys
MUST match property names in the API description.
Returns:
object: An instance of this structure class.
"""
if dictionary is None:
return None
asin = dictionary.get('ASIN')
offer_listing_id = dictionary.get('OfferListingId')
quantity = dictionary.get('Quantity')
associate_tag = dictionary.get('AssociateTag')
list_item_id = dictionary.get('ListItemId')
return cls(asin, offer_listing_id, quantity, associate_tag, list_item_id)
|
class NotFoundError(Exception):
def __init__(self, url):
super().__init__(url)
self.type = "notfound"
class NoTitleError(Exception):
def __init__(self, url):
super().__init__(url)
self.type = "notitle"
class ErrorPageError(Exception):
def __init__(self, url):
super().__init__(url)
self.type = "errorpage"
class HomepageRedirectError(Exception):
def __init__(self, url):
super().__init__(url)
self.type = "homepageredir"
class FetchError(Exception):
def __init__(self, url, info={}):
super().__init__(url)
self.type = "fetcherror"
self.info = info
class UnknownError(Exception):
def __init__(self, url):
super().__init__(url)
self.type = "unknown"
|
class Notfounderror(Exception):
def __init__(self, url):
super().__init__(url)
self.type = 'notfound'
class Notitleerror(Exception):
def __init__(self, url):
super().__init__(url)
self.type = 'notitle'
class Errorpageerror(Exception):
def __init__(self, url):
super().__init__(url)
self.type = 'errorpage'
class Homepageredirecterror(Exception):
def __init__(self, url):
super().__init__(url)
self.type = 'homepageredir'
class Fetcherror(Exception):
def __init__(self, url, info={}):
super().__init__(url)
self.type = 'fetcherror'
self.info = info
class Unknownerror(Exception):
def __init__(self, url):
super().__init__(url)
self.type = 'unknown'
|
init_info = input().split(" ")
sapce_width = int(init_info[0])
space_length = int(init_info[1])
space_gun = int(init_info[2])
gun_x = []
gun_y = []
for each_input in range(space_gun):
init_gun = input().split()
gun_x.append(int(init_gun[0]))
gun_y.append(int(init_gun[1]))
new_width = sapce_width - len(set((gun_x)))
new_length = space_length - len(set((gun_y)))
print((new_width * new_length) % 25621)
# Passed
|
init_info = input().split(' ')
sapce_width = int(init_info[0])
space_length = int(init_info[1])
space_gun = int(init_info[2])
gun_x = []
gun_y = []
for each_input in range(space_gun):
init_gun = input().split()
gun_x.append(int(init_gun[0]))
gun_y.append(int(init_gun[1]))
new_width = sapce_width - len(set(gun_x))
new_length = space_length - len(set(gun_y))
print(new_width * new_length % 25621)
|
"""
File: anagram.py
Name: Howard
----------------------------------
This program recursively finds all the anagram(s)
for the word input by user and terminates when the
input string matches the EXIT constant defined
at line 19
If you correctly implement this program, you should see the
number of anagrams for each word listed below:
* arm -> 3 anagrams
* contains -> 5 anagrams
* stop -> 6 anagrams
* tesla -> 10 anagrams
* spear -> 12 anagrams
"""
# Constants
FILE = 'dictionary.txt' # This is the filename of an English dictionary
EXIT = '-1' # Controls when to stop the loop
# Global variables
dic = {} # a list to store all strings in a FILE
z
def main():
global ans
read_dictionary()
print('Welcome to stanCode "Anagram Generator" (or -1 to quit)')
while True:
ans = []
word = input('Find anagrams for: ')
if word == EXIT:
break
else:
find_anagrams(word)
print(f'{len(ans)} anagrams: {ans}')
def find_anagrams(s):
"""
A function to find all possible anagram and add them to the global variable ans.
:param s: str, a word user input to find the anagrams.
:return: list, a list containing of the anagrams found in the dictionary.
"""
print('Searching...')
return helper(s)
def helper(s, current=''):
"""
A helper function to implement recursions.
:param s: str, a word user input to find the anagrams.
:param current: the current word created in the recursion. Starts with empty string.
"""
# Base Case: when character option left is zero
if len(s) == 0:
if current in dic and current not in ans:
ans.append(current)
print('Found: ' + current)
print('Searching...')
for i in range(len(s)):
# Choose
new_current = current + s[i]
new_s = s[0:i] + s[i+1:] # a word without the character just being chosen.
# to skip the words that start with prefix that are not founded in the dictionary.
if has_prefix(new_current):
# Explore
helper(new_s, new_current)
def read_dictionary():
"""
This function reads the dictionary.txt file, parse the stings and append them into a global variable list.
"""
with open(FILE, 'r') as f:
for line in f:
line = line.replace('\n', '')
if line not in dic:
dic[line] = 1
def has_prefix(sub_s):
"""
This function will check every word in a file ot see whether any of them has the prefix substring.
:param sub_s: str, the prefix of a word
:return: bool
"""
for s in dic:
if s.startswith(sub_s):
return True
return False
if __name__ == '__main__':
main()
|
"""
File: anagram.py
Name: Howard
----------------------------------
This program recursively finds all the anagram(s)
for the word input by user and terminates when the
input string matches the EXIT constant defined
at line 19
If you correctly implement this program, you should see the
number of anagrams for each word listed below:
* arm -> 3 anagrams
* contains -> 5 anagrams
* stop -> 6 anagrams
* tesla -> 10 anagrams
* spear -> 12 anagrams
"""
file = 'dictionary.txt'
exit = '-1'
dic = {}
z
def main():
global ans
read_dictionary()
print('Welcome to stanCode "Anagram Generator" (or -1 to quit)')
while True:
ans = []
word = input('Find anagrams for: ')
if word == EXIT:
break
else:
find_anagrams(word)
print(f'{len(ans)} anagrams: {ans}')
def find_anagrams(s):
"""
A function to find all possible anagram and add them to the global variable ans.
:param s: str, a word user input to find the anagrams.
:return: list, a list containing of the anagrams found in the dictionary.
"""
print('Searching...')
return helper(s)
def helper(s, current=''):
"""
A helper function to implement recursions.
:param s: str, a word user input to find the anagrams.
:param current: the current word created in the recursion. Starts with empty string.
"""
if len(s) == 0:
if current in dic and current not in ans:
ans.append(current)
print('Found: ' + current)
print('Searching...')
for i in range(len(s)):
new_current = current + s[i]
new_s = s[0:i] + s[i + 1:]
if has_prefix(new_current):
helper(new_s, new_current)
def read_dictionary():
"""
This function reads the dictionary.txt file, parse the stings and append them into a global variable list.
"""
with open(FILE, 'r') as f:
for line in f:
line = line.replace('\n', '')
if line not in dic:
dic[line] = 1
def has_prefix(sub_s):
"""
This function will check every word in a file ot see whether any of them has the prefix substring.
:param sub_s: str, the prefix of a word
:return: bool
"""
for s in dic:
if s.startswith(sub_s):
return True
return False
if __name__ == '__main__':
main()
|
# Create a calculator function
# The function should accept three parameters:
# first_number: a numeric value for the math operation
# second_number: a numeric value for the math operation
# operation: the word 'add' or 'subtract'
# the function should return the result of the two numbers added or subtracted
# based on the value passed in for the operator
def calcutate(first, second, operation):
if operation.lower() == 'add':
result = first + second
elif operation.lower() == 'substract':
result = first - second
else:
result = 'Operation, not supported'
return result
first = float(input('Enter first number: '))
second = float(input('Enter second number: '))
operation = input('Enter operation type (add or substract): ')
print(calcutate(first, second, operation))
#
# Test your function with the values 6,4, add
# Should return 10
#
# Test your function with the values 6,4, subtract
# Should return 2
#
# BONUS: Test your function with the values 6, 4 and divide
# Have your function return an error message when invalid values are received
|
def calcutate(first, second, operation):
if operation.lower() == 'add':
result = first + second
elif operation.lower() == 'substract':
result = first - second
else:
result = 'Operation, not supported'
return result
first = float(input('Enter first number: '))
second = float(input('Enter second number: '))
operation = input('Enter operation type (add or substract): ')
print(calcutate(first, second, operation))
|
'''
We can pass multiple arguments to the .order_by() method to order by multiple columns. In fact, we can also sort in ascending or descending order for each individual column. Each column in the .order_by() method is fully sorted from left to right. This means that the first column is completely sorted, and then within each matching group of values in the first column, it's sorted by the next column in the .order_by() method. This process is repeated until all the columns in the .order_by() are sorted.
'''
# Build a query to select state and age: stmt
stmt = select([census.columns.state, census.columns.age])
# Append order by to ascend by state and descend by age
stmt = stmt.order_by(census.columns.state, desc(census.columns.age))
# Execute the statement and store all the records: results
results = connection.execute(stmt).fetchall()
# Print the first 20 results
print(results[:20])
|
"""
We can pass multiple arguments to the .order_by() method to order by multiple columns. In fact, we can also sort in ascending or descending order for each individual column. Each column in the .order_by() method is fully sorted from left to right. This means that the first column is completely sorted, and then within each matching group of values in the first column, it's sorted by the next column in the .order_by() method. This process is repeated until all the columns in the .order_by() are sorted.
"""
stmt = select([census.columns.state, census.columns.age])
stmt = stmt.order_by(census.columns.state, desc(census.columns.age))
results = connection.execute(stmt).fetchall()
print(results[:20])
|
#!/usr/bin/env python3
####################################################################################
# #
# Program purpose: Finds the difference between the largest and the smallest #
# integer which are created by numbers from 0 to 9. The #
# number that can be rearranged shall start with 0 as in #
# 00135668. #
# Program Author : Happi Yvan <[email protected]> #
# Creation Date : September 22, 2019 #
# #
####################################################################################
def read_data(mess: str):
valid = False
data = 0
while not valid:
try:
temp_data = list(input(mess).strip())
if len(temp_data) != 8:
raise ValueError("Number must be 8-digit long")
else:
for x in range(len(temp_data)):
if not f"{temp_data[x]}".isdigit():
raise ValueError(f"'{temp_data[x]}' is not an integer")
data = temp_data
valid = True
except ValueError as ve:
print(f"[ERROR]: {ve}")
return data
if __name__ == "__main__":
main_data = read_data("Enter an integer created by 8 numbers from 0 to 9: ")
largest = ''.join(sorted(main_data, reverse=True))
smallest = ''.join(sorted(main_data))
print(f"Difference between the largest {largest} and smallest {smallest}:"
f" {int(''.join(largest)) - int(''.join(smallest))}")
|
def read_data(mess: str):
valid = False
data = 0
while not valid:
try:
temp_data = list(input(mess).strip())
if len(temp_data) != 8:
raise value_error('Number must be 8-digit long')
else:
for x in range(len(temp_data)):
if not f'{temp_data[x]}'.isdigit():
raise value_error(f"'{temp_data[x]}' is not an integer")
data = temp_data
valid = True
except ValueError as ve:
print(f'[ERROR]: {ve}')
return data
if __name__ == '__main__':
main_data = read_data('Enter an integer created by 8 numbers from 0 to 9: ')
largest = ''.join(sorted(main_data, reverse=True))
smallest = ''.join(sorted(main_data))
print(f"Difference between the largest {largest} and smallest {smallest}: {int(''.join(largest)) - int(''.join(smallest))}")
|
#############################################################################
# _____ __________ ___ __ #
# / ___// ____/ __ \/ | / / #
# \__ \/ / / /_/ / /| | / / #
# ___/ / /___/ _, _/ ___ |/ /___ #
# /____/\____/_/ |_/_/ |_/_____/ Smart City Resource Adaptation Layer #
# #
# LINKS Foundation, (c) 2017-2020 #
# developed by Jacopo Foglietti & Luca Mannella #
# SCRAL is distributed under a BSD-style license -- See file LICENSE.md #
# #
#############################################################################
"""
SCRAL - constants
This file contains useful constants for this module.
"""
# URI
URL_CLOUD = "https://api.smartdatanet.it/api"
URL_TENANT = "https://api.smartdatanet.it/metadataapi/api/v02/search?tenant=cittato_rumore"
# Exposed URI
URI_DEFAULT = "/scral/v1.0/phono-gw"
URI_ACTIVE_DEVICES = URI_DEFAULT + "/active-devices"
ACTIVE_DEVICES = ["ds_S_01_1928", "ds_S_02_1926", "ds_S_03_1927", "ds_S_05_1932", "ds_S_06_1931", "ds_S_07_1933"]
FREQ_INTERVALS = ["16", "20", "25", "31_5", "40", "50", "63", "80", "100", "125", "160", "200",
"250", "315", "400", "500", "630", "800", "1000", "1250", "1600", "2000", "2500",
"3150", "4000", "5000", "6300", "8000", "10000", "12500", "16000", "20000"]
FILTER_SDN_1 = "Measures?%20&$format=json&$filter=time%20gt%20datetimeoffset%27"
FILTER_SDN_2 = "%27%20and%20time%20le%20datetimeoffset%27"
FILTER_SDN_3 = "%27&$orderby=time%20asc&$top=50"
# Timing
UPDATE_INTERVAL = 15
RETRY_INTERVAL = 120
# Keys
LAEQ_KEY = "LAeq"
SPECTRA_KEY = "CPBLZeq"
METADATA_KEY = "metadata"
STREAM_KEY = "stream"
SMART_OBJECT_KEY = "smartobject"
CODE_KEY = "code"
DATASET_KEY = "dataset"
DESCRIPTION_KEY = "description"
COUNT_KEY = "count"
TOTAL_COUNT_KEY = "totalCount"
OBS_DATA_KEY = "d"
OBS_DATA_RESULTS_KEY = "results"
VALUE_TYPE_KEY = "valueType"
RESPONSE_KEY = "response"
|
"""
SCRAL - constants
This file contains useful constants for this module.
"""
url_cloud = 'https://api.smartdatanet.it/api'
url_tenant = 'https://api.smartdatanet.it/metadataapi/api/v02/search?tenant=cittato_rumore'
uri_default = '/scral/v1.0/phono-gw'
uri_active_devices = URI_DEFAULT + '/active-devices'
active_devices = ['ds_S_01_1928', 'ds_S_02_1926', 'ds_S_03_1927', 'ds_S_05_1932', 'ds_S_06_1931', 'ds_S_07_1933']
freq_intervals = ['16', '20', '25', '31_5', '40', '50', '63', '80', '100', '125', '160', '200', '250', '315', '400', '500', '630', '800', '1000', '1250', '1600', '2000', '2500', '3150', '4000', '5000', '6300', '8000', '10000', '12500', '16000', '20000']
filter_sdn_1 = 'Measures?%20&$format=json&$filter=time%20gt%20datetimeoffset%27'
filter_sdn_2 = '%27%20and%20time%20le%20datetimeoffset%27'
filter_sdn_3 = '%27&$orderby=time%20asc&$top=50'
update_interval = 15
retry_interval = 120
laeq_key = 'LAeq'
spectra_key = 'CPBLZeq'
metadata_key = 'metadata'
stream_key = 'stream'
smart_object_key = 'smartobject'
code_key = 'code'
dataset_key = 'dataset'
description_key = 'description'
count_key = 'count'
total_count_key = 'totalCount'
obs_data_key = 'd'
obs_data_results_key = 'results'
value_type_key = 'valueType'
response_key = 'response'
|
class AuthenticationError(Exception):
pass
class MarketClosedError(Exception):
pass
class MarketEmptyError(Exception):
pass
|
class Authenticationerror(Exception):
pass
class Marketclosederror(Exception):
pass
class Marketemptyerror(Exception):
pass
|
# coding=utf-8
# @Time : 2021/3/26 10:34
# @Auto : zzf-jeff
class GlobalSetting():
label_path = './coco.names'
model_path = './weights/yolov5x-simpler.engine'
# model_path = './weights/yolov5s.pt'
output_path = './output'
img_path = './test_imgs'
conf_thresh = 0.3
iou_thresh = 0.45
anchors = [
[[10, 13], [16, 30], [33, 23]],
[[30, 61], [62, 45], [59, 119]],
[[116, 90], [156, 198], [373, 326]],
]
opt = GlobalSetting()
|
class Globalsetting:
label_path = './coco.names'
model_path = './weights/yolov5x-simpler.engine'
output_path = './output'
img_path = './test_imgs'
conf_thresh = 0.3
iou_thresh = 0.45
anchors = [[[10, 13], [16, 30], [33, 23]], [[30, 61], [62, 45], [59, 119]], [[116, 90], [156, 198], [373, 326]]]
opt = global_setting()
|
def test_trading_fee(position):
entry_price = 100000000000000000000 # 100
current_price = 150000000000000000000 # 150
notional = 10000000000000000000 # 10
debt = 2000000000000000000 # 2
liquidated = False
trading_fee_rate = 750000000000000
oi = int((notional / entry_price) * 1000000000000000000) # 0.1
fraction = 1000000000000000000 # 1
cap_payoff = 5000000000000000000 # 5
# check trading fee is notional * fee_rate
is_long = True
# NOTE: mid_ratio tests in test_entry_price.py
mid_ratio = position.calcEntryToMidRatio(entry_price, entry_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 11250000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price,
cap_payoff, trading_fee_rate)
assert expect == actual
# check trading fee is notional * fee_rate
is_long = False
# NOTE: mid_ratio tests in test_entry_price.py
mid_ratio = position.calcEntryToMidRatio(entry_price, entry_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 3750000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price,
cap_payoff, trading_fee_rate)
assert expect == actual
# check trading fee is notional * fee_rate when 0 price change
is_long = True
current_price = entry_price
# NOTE: mid_ratio tests in test_entry_price.py
mid_ratio = position.calcEntryToMidRatio(entry_price, entry_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 7500000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price,
cap_payoff, trading_fee_rate)
assert expect == actual
# check trading fee is notional * fee_rate when 0 price change
is_long = False
current_price = entry_price
# NOTE: mid_ratio tests in test_entry_price.py
mid_ratio = position.calcEntryToMidRatio(entry_price, entry_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 7500000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price,
cap_payoff, trading_fee_rate)
assert expect == actual
def test_trading_fee_when_entry_not_equal_to_mid(position):
mid_price = 100000000000000000000 # 100
current_price = 150000000000000000000 # 150
notional = 10000000000000000000 # 10
debt = 2000000000000000000 # 2
liquidated = False
trading_fee_rate = 750000000000000
oi = int((notional / mid_price) * 1000000000000000000) # 0.1
fraction = 1000000000000000000 # 1
cap_payoff = 5000000000000000000 # 5
# check trading fee is notional * fee_rate
is_long = True
entry_price = 101000000000000000000 # 101
# NOTE: mid_ratio tests in test_entry_price.py
mid_ratio = position.calcEntryToMidRatio(entry_price, mid_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 11175000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price,
cap_payoff, trading_fee_rate)
assert expect == actual
# check trading fee is notional * fee_rate
is_long = False
entry_price = 99000000000000000000 # 99
# NOTE: mid_ratio tests in test_entry_price.py
mid_ratio = position.calcEntryToMidRatio(entry_price, mid_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 3675000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price,
cap_payoff, trading_fee_rate)
assert expect == actual
# check trading fee is notional * fee_rate when 0 price change
is_long = True
entry_price = 101000000000000000000 # 101
current_price = entry_price
# NOTE: mid_ratio tests in test_entry_price.py
mid_ratio = position.calcEntryToMidRatio(entry_price, mid_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 7500000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price,
cap_payoff, trading_fee_rate)
assert expect == actual
# check trading fee is notional * fee_rate when 0 price change
is_long = False
entry_price = 99000000000000000000 # 99
current_price = entry_price
# NOTE: mid_ratio tests in test_entry_price.py
mid_ratio = position.calcEntryToMidRatio(entry_price, mid_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 7500000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price,
cap_payoff, trading_fee_rate)
assert expect == actual
def test_trading_fee_when_fraction_less_than_one(position):
entry_price = 100000000000000000000 # 100
current_price = 150000000000000000000 # 150
notional = 10000000000000000000 # 10
debt = 2000000000000000000 # 2
liquidated = False
trading_fee_rate = 750000000000000
oi = int((notional / entry_price) * 1000000000000000000) # 0.1
fraction = 250000000000000000 # 0.25
cap_payoff = 5000000000000000000 # 5
# check trading fee is notional * fee_rate
is_long = True
# NOTE: mid_ratio tests in test_entry_price.py
mid_ratio = position.calcEntryToMidRatio(entry_price, entry_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 2812500000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price,
cap_payoff, trading_fee_rate)
assert expect == actual
# check trading fee is notional * fee_rate
is_long = False
# NOTE: mid_ratio tests in test_entry_price.py
mid_ratio = position.calcEntryToMidRatio(entry_price, entry_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 937500000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price,
cap_payoff, trading_fee_rate)
assert expect == actual
def test_trading_fee_when_payoff_greater_than_cap(position):
entry_price = 100000000000000000000 # 100
current_price = 800000000000000000000 # 800
notional = 10000000000000000000 # 10
debt = 2000000000000000000 # 2
liquidated = False
trading_fee_rate = 750000000000000
oi = int((notional / entry_price) * 1000000000000000000) # 0.1
fraction = 1000000000000000000 # 1
cap_payoff = 5000000000000000000 # 5
# check trading fee is notional * fee_rate
is_long = True
# NOTE: mid_ratio tests in test_entry_price.py
mid_ratio = position.calcEntryToMidRatio(entry_price, entry_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 45000000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price,
cap_payoff, trading_fee_rate)
assert expect == actual
|
def test_trading_fee(position):
entry_price = 100000000000000000000
current_price = 150000000000000000000
notional = 10000000000000000000
debt = 2000000000000000000
liquidated = False
trading_fee_rate = 750000000000000
oi = int(notional / entry_price * 1000000000000000000)
fraction = 1000000000000000000
cap_payoff = 5000000000000000000
is_long = True
mid_ratio = position.calcEntryToMidRatio(entry_price, entry_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 11250000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price, cap_payoff, trading_fee_rate)
assert expect == actual
is_long = False
mid_ratio = position.calcEntryToMidRatio(entry_price, entry_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 3750000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price, cap_payoff, trading_fee_rate)
assert expect == actual
is_long = True
current_price = entry_price
mid_ratio = position.calcEntryToMidRatio(entry_price, entry_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 7500000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price, cap_payoff, trading_fee_rate)
assert expect == actual
is_long = False
current_price = entry_price
mid_ratio = position.calcEntryToMidRatio(entry_price, entry_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 7500000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price, cap_payoff, trading_fee_rate)
assert expect == actual
def test_trading_fee_when_entry_not_equal_to_mid(position):
mid_price = 100000000000000000000
current_price = 150000000000000000000
notional = 10000000000000000000
debt = 2000000000000000000
liquidated = False
trading_fee_rate = 750000000000000
oi = int(notional / mid_price * 1000000000000000000)
fraction = 1000000000000000000
cap_payoff = 5000000000000000000
is_long = True
entry_price = 101000000000000000000
mid_ratio = position.calcEntryToMidRatio(entry_price, mid_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 11175000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price, cap_payoff, trading_fee_rate)
assert expect == actual
is_long = False
entry_price = 99000000000000000000
mid_ratio = position.calcEntryToMidRatio(entry_price, mid_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 3675000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price, cap_payoff, trading_fee_rate)
assert expect == actual
is_long = True
entry_price = 101000000000000000000
current_price = entry_price
mid_ratio = position.calcEntryToMidRatio(entry_price, mid_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 7500000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price, cap_payoff, trading_fee_rate)
assert expect == actual
is_long = False
entry_price = 99000000000000000000
current_price = entry_price
mid_ratio = position.calcEntryToMidRatio(entry_price, mid_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 7500000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price, cap_payoff, trading_fee_rate)
assert expect == actual
def test_trading_fee_when_fraction_less_than_one(position):
entry_price = 100000000000000000000
current_price = 150000000000000000000
notional = 10000000000000000000
debt = 2000000000000000000
liquidated = False
trading_fee_rate = 750000000000000
oi = int(notional / entry_price * 1000000000000000000)
fraction = 250000000000000000
cap_payoff = 5000000000000000000
is_long = True
mid_ratio = position.calcEntryToMidRatio(entry_price, entry_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 2812500000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price, cap_payoff, trading_fee_rate)
assert expect == actual
is_long = False
mid_ratio = position.calcEntryToMidRatio(entry_price, entry_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 937500000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price, cap_payoff, trading_fee_rate)
assert expect == actual
def test_trading_fee_when_payoff_greater_than_cap(position):
entry_price = 100000000000000000000
current_price = 800000000000000000000
notional = 10000000000000000000
debt = 2000000000000000000
liquidated = False
trading_fee_rate = 750000000000000
oi = int(notional / entry_price * 1000000000000000000)
fraction = 1000000000000000000
cap_payoff = 5000000000000000000
is_long = True
mid_ratio = position.calcEntryToMidRatio(entry_price, entry_price)
pos = (notional, debt, mid_ratio, is_long, liquidated, oi)
expect = 45000000000000000
actual = position.tradingFee(pos, fraction, oi, oi, current_price, cap_payoff, trading_fee_rate)
assert expect == actual
|
# 9th Solutions
#--------------------------
n = int(input())
d = {}
for i in range(n):
x = input().split()
d[x[0]] = x[1]
while True:
try:
name = input()
if name in d:
print(name, '=', d[name], sep='')
else:
print('Not found')
except:
break
|
n = int(input())
d = {}
for i in range(n):
x = input().split()
d[x[0]] = x[1]
while True:
try:
name = input()
if name in d:
print(name, '=', d[name], sep='')
else:
print('Not found')
except:
break
|
def define_targets(rules):
rules.cc_test(
name = "test",
srcs = ["impl/CUDATest.cpp"],
deps = [
"@com_google_googletest//:gtest_main",
"//c10/cuda",
],
target_compatible_with = rules.requires_cuda_enabled(),
)
|
def define_targets(rules):
rules.cc_test(name='test', srcs=['impl/CUDATest.cpp'], deps=['@com_google_googletest//:gtest_main', '//c10/cuda'], target_compatible_with=rules.requires_cuda_enabled())
|
def vogal(c):
if c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u' or c == 'A' or c == 'E' or c == 'I' or c == 'O' or c == 'U':
return True
else:
return False
|
def vogal(c):
if c == 'a' or c == 'e' or c == 'i' or (c == 'o') or (c == 'u') or (c == 'A') or (c == 'E') or (c == 'I') or (c == 'O') or (c == 'U'):
return True
else:
return False
|
# Copyright 2020 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
#
# https://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.
"""Proof of concept. License restriction."""
load(
"@rules_license//rules:providers.bzl",
"LicenseInfo",
"LicenseKindInfo",
"LicensesInfo",
)
# An experiment to provide license defaults via a rule. This is far from
# working and should not be considered part of the current design.
#
def _default_licenses_impl(ctx):
licenses = []
for dep in ctx.attr.deps:
if LicenseInfo in dep:
licenses.append(dep[LicenseInfo])
return [LicensesInfo(licenses = licenses)]
_default_licenses = rule(
implementation = _default_licenses_impl,
attrs = {
"deps": attr.label_list(
mandatory = True,
doc = "Licenses",
providers = [LicenseInfo],
cfg = "host",
),
"conditions": attr.string_list(
doc = "",
),
},
)
def default_licenses(licenses, conditions = None):
_default_licenses(
name = "__default_licenses",
deps = ["%s_license" % l for l in licenses],
conditions = conditions,
)
|
"""Proof of concept. License restriction."""
load('@rules_license//rules:providers.bzl', 'LicenseInfo', 'LicenseKindInfo', 'LicensesInfo')
def _default_licenses_impl(ctx):
licenses = []
for dep in ctx.attr.deps:
if LicenseInfo in dep:
licenses.append(dep[LicenseInfo])
return [licenses_info(licenses=licenses)]
_default_licenses = rule(implementation=_default_licenses_impl, attrs={'deps': attr.label_list(mandatory=True, doc='Licenses', providers=[LicenseInfo], cfg='host'), 'conditions': attr.string_list(doc='')})
def default_licenses(licenses, conditions=None):
_default_licenses(name='__default_licenses', deps=['%s_license' % l for l in licenses], conditions=conditions)
|
# Copyright 2021 Variscite LTD
# SPDX-License-Identifier: BSD-3-Clause
__version__ = "1.0.0"
|
__version__ = '1.0.0'
|
#!/usr/bin/env python
# Copyright (c) 2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides the base class for user-defined actor
controllers. All user-defined controls must be derived from
this class.
A user must not modify the module.
"""
class BasicControl(object):
"""
This class is the base class for user-defined actor controllers
All user-defined agents must be derived from this class.
Args:
actor (carla.Actor): Actor that should be controlled by the controller.
Attributes:
_actor (carla.Actor): Controlled actor.
Defaults to None.
_target_speed (float): Logitudinal target speed of the controller.
Defaults to 0.
_init_speed (float): Initial longitudinal speed of the controller.
Defaults to 0.
_waypoints (list of carla.Transform): List of target waypoints the actor
should travel along. A waypoint here is of type carla.Transform!
Defaults to [].
_waypoints_updated (boolean):
Defaults to False.
_reached_goal (boolean):
Defaults to False.
"""
_actor = None
_waypoints = []
_waypoints_updated = False
_target_speed = 0
_reached_goal = False
_init_speed = False
def __init__(self, actor):
"""
Initialize the actor
"""
self._actor = actor
def update_target_speed(self, speed):
"""
Update the actor's target speed and set _init_speed to False.
Args:
speed (float): New target speed [m/s].
"""
self._target_speed = speed
self._init_speed = False
def update_waypoints(self, waypoints, start_time=None):
"""
Update the actor's waypoints
Args:
waypoints (List of carla.Transform): List of new waypoints.
"""
self._waypoints = waypoints
self._waypoints_updated = True
def set_init_speed(self):
"""
Set _init_speed to True
"""
self._init_speed = True
def check_reached_waypoint_goal(self):
"""
Check if the actor reached the end of the waypoint list
returns:
True if the end was reached, False otherwise.
"""
return self._reached_goal
def reset(self):
"""
Pure virtual function to reset the controller. This should be implemented
in the user-defined agent implementation.
"""
raise NotImplementedError(
"This function must be re-implemented by the user-defined actor control."
"If this error becomes visible the class hierarchy is somehow broken")
def run_step(self):
"""
Pure virtual function to run one step of the controllers's control loop.
This should be implemented in the user-defined agent implementation.
"""
raise NotImplementedError(
"This function must be re-implemented by the user-defined actor control."
"If this error becomes visible the class hierarchy is somehow broken")
|
"""
This module provides the base class for user-defined actor
controllers. All user-defined controls must be derived from
this class.
A user must not modify the module.
"""
class Basiccontrol(object):
"""
This class is the base class for user-defined actor controllers
All user-defined agents must be derived from this class.
Args:
actor (carla.Actor): Actor that should be controlled by the controller.
Attributes:
_actor (carla.Actor): Controlled actor.
Defaults to None.
_target_speed (float): Logitudinal target speed of the controller.
Defaults to 0.
_init_speed (float): Initial longitudinal speed of the controller.
Defaults to 0.
_waypoints (list of carla.Transform): List of target waypoints the actor
should travel along. A waypoint here is of type carla.Transform!
Defaults to [].
_waypoints_updated (boolean):
Defaults to False.
_reached_goal (boolean):
Defaults to False.
"""
_actor = None
_waypoints = []
_waypoints_updated = False
_target_speed = 0
_reached_goal = False
_init_speed = False
def __init__(self, actor):
"""
Initialize the actor
"""
self._actor = actor
def update_target_speed(self, speed):
"""
Update the actor's target speed and set _init_speed to False.
Args:
speed (float): New target speed [m/s].
"""
self._target_speed = speed
self._init_speed = False
def update_waypoints(self, waypoints, start_time=None):
"""
Update the actor's waypoints
Args:
waypoints (List of carla.Transform): List of new waypoints.
"""
self._waypoints = waypoints
self._waypoints_updated = True
def set_init_speed(self):
"""
Set _init_speed to True
"""
self._init_speed = True
def check_reached_waypoint_goal(self):
"""
Check if the actor reached the end of the waypoint list
returns:
True if the end was reached, False otherwise.
"""
return self._reached_goal
def reset(self):
"""
Pure virtual function to reset the controller. This should be implemented
in the user-defined agent implementation.
"""
raise not_implemented_error('This function must be re-implemented by the user-defined actor control.If this error becomes visible the class hierarchy is somehow broken')
def run_step(self):
"""
Pure virtual function to run one step of the controllers's control loop.
This should be implemented in the user-defined agent implementation.
"""
raise not_implemented_error('This function must be re-implemented by the user-defined actor control.If this error becomes visible the class hierarchy is somehow broken')
|
# dfs
def walk_parents(vertex):
return sum(
(walk_parents(parent) for parent in vertex.parents),
[]
) + [vertex]
def walk_children(vertex):
return sum(
(walk_children(child) for child in vertex.children),
[]
) + [vertex]
|
def walk_parents(vertex):
return sum((walk_parents(parent) for parent in vertex.parents), []) + [vertex]
def walk_children(vertex):
return sum((walk_children(child) for child in vertex.children), []) + [vertex]
|
"""
https://leetcode.com/problems/power-of-four/
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.
Example 1:
Input: 16
Output: true
Example 2:
Input: 5
Output: false
Follow up: Could you solve it without loops/recursion?
"""
# Inspired by @h285zhao in the discussion panel. If the number is a power of 4, then it in binary format should look like:
# 100 00000000000(number of 0 after 100 should be even).
# time complexity: O(logn) for the base conversion, space complexity: O(n)
class Solution:
def isPowerOfFour(self, num: int) -> bool:
s = bin(num)[3:]
return num > 0 and ('1' not in s) and len(s)%2 == 0
|
"""
https://leetcode.com/problems/power-of-four/
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.
Example 1:
Input: 16
Output: true
Example 2:
Input: 5
Output: false
Follow up: Could you solve it without loops/recursion?
"""
class Solution:
def is_power_of_four(self, num: int) -> bool:
s = bin(num)[3:]
return num > 0 and '1' not in s and (len(s) % 2 == 0)
|
# list1 = [i for i in range(5, 16)]
# print(list1)
# list1 = [i for i in range(0, 11)]
# for i in range(11):
# if i > 0:
# print(list1[i-1] * list1[i])
# list1 = [i * j for i in range(1, 10) for j in range(1, 10)]
# print(list1)
str1 = str(input())
strArray = list(str1)
newList = []
for i in strArray:
if i > "e":
del i
else:
newList.append(i)
print(*newList)
|
str1 = str(input())
str_array = list(str1)
new_list = []
for i in strArray:
if i > 'e':
del i
else:
newList.append(i)
print(*newList)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.