content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Programa: def __init__(self, nome, ano): self._nome = nome.title() self.ano = ano self._likes = 0 @property def likes(self): return self._likes def dar_like(self): self._likes += 1 @property def nome(self): return self._nome @nome.setter def nome(self, novo_nome): self._nome = novo_nome.title() def __str__(self): return f'nome: {self._nome} - ano: {self.ano} - likes: {self._likes}' class Filme(Programa): def __init__(self, nome, ano, duracao): super().__init__(nome, ano) self.duracao = duracao def __str__(self): return f'nome: {self._nome} - ano: {self.ano} - duracao: {self.duracao} - likes: {self._likes}' class Serie(Programa): def __init__(self, nome, ano, temporadas): super().__init__(nome, ano) self.temporada = temporadas def __str__(self): return f'nome: {self._nome} - ano: {self.ano} - temporada: {self.temporada} - likes: {self._likes}' vingadores = Filme('vigadores - a guerra', 2020, 160) vingadores.dar_like() vingadores.dar_like() vingadores.dar_like() senhorDosAneis = Filme('senhor dos aneis', 2010, 320) [senhorDosAneis.dar_like() for _ in range(10)] print(f'nome: {vingadores.nome} - ano: {vingadores.ano} - duracao: {vingadores.duracao}') print(f'likes: {vingadores.likes}') gameOf = Serie('game of thrones', 2010, 9) print(f'Nome: {gameOf.nome} - ano: {gameOf.ano} - temporadas: {gameOf.temporada}') gameOf.dar_like() print(vingadores.nome) atlanta = Serie('atlanta', 2018, 2) atlanta.dar_like() atlanta.dar_like() atlanta.dar_like() print(f'Nome: {atlanta.nome} - Ano: {atlanta.ano}') print('\n=======================================================================') filmesESeries = [senhorDosAneis, vingadores, gameOf, atlanta] for programa in filmesESeries: # colocando __str__ pode retornar colocando o nome dada da classe: programa print(programa)
class Programa: def __init__(self, nome, ano): self._nome = nome.title() self.ano = ano self._likes = 0 @property def likes(self): return self._likes def dar_like(self): self._likes += 1 @property def nome(self): return self._nome @nome.setter def nome(self, novo_nome): self._nome = novo_nome.title() def __str__(self): return f'nome: {self._nome} - ano: {self.ano} - likes: {self._likes}' class Filme(Programa): def __init__(self, nome, ano, duracao): super().__init__(nome, ano) self.duracao = duracao def __str__(self): return f'nome: {self._nome} - ano: {self.ano} - duracao: {self.duracao} - likes: {self._likes}' class Serie(Programa): def __init__(self, nome, ano, temporadas): super().__init__(nome, ano) self.temporada = temporadas def __str__(self): return f'nome: {self._nome} - ano: {self.ano} - temporada: {self.temporada} - likes: {self._likes}' vingadores = filme('vigadores - a guerra', 2020, 160) vingadores.dar_like() vingadores.dar_like() vingadores.dar_like() senhor_dos_aneis = filme('senhor dos aneis', 2010, 320) [senhorDosAneis.dar_like() for _ in range(10)] print(f'nome: {vingadores.nome} - ano: {vingadores.ano} - duracao: {vingadores.duracao}') print(f'likes: {vingadores.likes}') game_of = serie('game of thrones', 2010, 9) print(f'Nome: {gameOf.nome} - ano: {gameOf.ano} - temporadas: {gameOf.temporada}') gameOf.dar_like() print(vingadores.nome) atlanta = serie('atlanta', 2018, 2) atlanta.dar_like() atlanta.dar_like() atlanta.dar_like() print(f'Nome: {atlanta.nome} - Ano: {atlanta.ano}') print('\n=======================================================================') filmes_e_series = [senhorDosAneis, vingadores, gameOf, atlanta] for programa in filmesESeries: print(programa)
# -*- coding: utf-8 -*- { 'name': 'Customer Rating', 'version': '1.0', 'category': 'Productivity', 'description': """ This module allows a customer to give rating. """, 'depends': [ 'mail', ], 'data': [ 'views/rating_view.xml', 'views/rating_template.xml', 'security/ir.model.access.csv' ], 'installable': True, 'auto_install': False, }
{'name': 'Customer Rating', 'version': '1.0', 'category': 'Productivity', 'description': '\nThis module allows a customer to give rating.\n', 'depends': ['mail'], 'data': ['views/rating_view.xml', 'views/rating_template.xml', 'security/ir.model.access.csv'], 'installable': True, 'auto_install': False}
class Solution: def merge(self, intervals: List[List[int]]) -> List[List[int]]: # Check edge case if not intervals: return [] # Sort the list to make it ascending with respect to the sub-list's first element and then in second element intervals = sorted(intervals, key = lambda x: (x[0], x[1])) # Initialize the result list with the first sub-list res = [intervals[0]] # Traverse the entire sorted list from the 2nd sub-list for i in range(1, len(intervals)): # There is intersection, then update the last sub-list of result if intervals[i][0] <= res[-1][1]: res[-1][1] = max(res[-1][1], intervals[i][1]) # There is no intersection, then append the current sub-list to result else: res.append(intervals[i]) return res
class Solution: def merge(self, intervals: List[List[int]]) -> List[List[int]]: if not intervals: return [] intervals = sorted(intervals, key=lambda x: (x[0], x[1])) res = [intervals[0]] for i in range(1, len(intervals)): if intervals[i][0] <= res[-1][1]: res[-1][1] = max(res[-1][1], intervals[i][1]) else: res.append(intervals[i]) return res
__source__ = 'https://leetcode.com/problems/next-greater-element-iii/description/' # Time: O(n) # Space: O(n) # # Description: same as 556. Next Greater Element III # //[email protected] # // Next closest bigger number with the same digits # // You have to create a function that takes a positive integer number and returns # the next bigger number formed by the same digits: # # // next_bigger(12)==21 //string for permutation # // next_bigger(513)==531 # // next_bigger(2017)==2071 # # // If no bigger number can be composed using those digits, return -1: # # // next_bigger(9)==-1 # // next_bigger(111)==-1 # // next_bigger(531)==-1 # Result = ''' IFang Lee ran 238 lines of Java (finished in 11.59s): getRealNextBiggerInteger(): 12-> 21 true 513 -> 531 true 1342-> 1423 true 534976-> 536479 true 9999-> -1 true 11-> -1 true 0-> -1 true 2147483647-> -1 true getRealNextBiggerIntegerByPermutation(): 12-> 21 true 513 -> 531 true 1342-> 1423 true 534976-> 536479 true 9999-> -1 true 11-> -1 true 0-> -1 true 2147483647-> -1 true ''' my_ans = ''' import java.io.*; import java.util.*; // 1. permutation -> worse big O (n!) // 2. scan from the last digit, swap with the first smaller digit O(n) public class Solution { public static void main(String[] args) { testNextBiggerInteger(); } public static void testNextBiggerInteger() { int res1, res2; System.out.println("getRealNextBiggerInteger(): "); System.out.println("12-> " + (res2 = getRealNextBiggerInteger(12)) + " " + (res2 == 21) + ""); System.out.println("513 -> " + (res2 = getRealNextBiggerInteger(513)) + " " + (res2 == 531) + ""); System.out.println("1342-> " + (res2 = getRealNextBiggerInteger(1342)) + " " + (res2 == 1423) + ""); System.out.println("534976-> " + (res2 = getRealNextBiggerInteger(534976)) + " " + (res2 == 536479) + ""); //negative tests System.out.println("9999-> " + (res2 = getRealNextBiggerInteger(9999)) + " " + (res2 == -1) + ""); System.out.println("11-> " + (res2 = getRealNextBiggerInteger(11)) + " " + (res2 == -1) + ""); System.out.println("0-> " + (res2 = getRealNextBiggerInteger(0)) + " " + (res2 == -1) + ""); System.out.println("2147483647-> " + (res2 = getRealNextBiggerInteger(Integer.MAX_VALUE))+ " " + (res2 == -1) + ""); System.out.println("987654321-> " + (res1 = getRealNextBiggerInteger(987654321)) + " " + (res1 == -1) + ""); System.out.println(); System.out.println("getRealNextBiggerIntegerByPermutation(): "); System.out.println("12-> " + (res1 = getRealNextBiggerIntegerByPermutation(12)) + " " + (res1 == 21) + ""); System.out.println("513 -> " + (res1 = getRealNextBiggerIntegerByPermutation(513))+ " " + (res1 == 531) + ""); System.out.println("1342-> " + (res1 = getRealNextBiggerIntegerByPermutation(1342)) + " " + (res1 == 1423) + ""); System.out.println("534976-> " + (res1 = getRealNextBiggerIntegerByPermutation(534976)) + " " + (res1 == 536479) + ""); //negative tests System.out.println("9999-> " + (res1 = getRealNextBiggerIntegerByPermutation(9999)) + " " + (res1 == -1) + ""); System.out.println("11-> " + (res1 = getRealNextBiggerIntegerByPermutation(11)) + " " + (res1 == -1) + ""); System.out.println("0-> " + (res1 = getRealNextBiggerIntegerByPermutation(0)) + " " + (res1 == -1) + ""); // significant long runtime (10982 milliseconds) for below test cases: System.out.println("2147483647-> " + (res1 = getRealNextBiggerIntegerByPermutation(Integer.MAX_VALUE)) + " " + (res1 == -1) + ""); // cannot run below: Stopped: CPU usage beyond threshold! // System.out.println("9876543210-> " + (res1 = getRealNextBiggerIntegerByPermutation(987654321)) + " " // + (res1 == -1) + ""); } ///////////////////////////////////////////////////////////////////////////////////////////// /* Time O(n) * 1. scan from the right, find the first digit larger than its right neighbor * 2. Within the range of (1) to right of the number, find a digit larger than(1) * 3. swap digit at (1) and (2) * 4. reverse the digit from index at (i) to the end of the digits * 5. return the result */ public static int getRealNextBiggerInteger(int number){ if (number < 0) throw new IllegalArgumentException("input must be positive integer"); char[] num = String.valueOf(number).toCharArray(); int i = num.length - 1, j = num.length - 1; // find the first digit from right that is smaller the its right digit while (i > 0 && num[i] <= num[i-1]) i--; //pivot = num[i-1] // descending order //ex: 54321 if (i == 0) return -1; // find the smallest digit >= pivot within the range (i, num.length) while (j > i - 1 && num[j] <= num[i - 1]) j--; swap(num, i - 1, j); reverse(num, i, num.length - 1); try { //check for overflow return Integer.parseInt(new String(num)); } catch(NumberFormatException noe) { System.out.println(noe.toString()); return -1; } } private static void swap(char[] num, int i, int j) { char tmp = num[i]; num[i] = num[j]; num[j] = tmp; } private static void reverse(char[] num, int start, int end) { while(start < end) { swap(num, start, end); start++; end--; } } ///////////////////////////////////////////////////////////////////////////////////////////// /* Time O(n!) * 1. Below algo use permutation way to get the next_bigger * getAllPermutation(): for any given number, it computes all permutation using given number * getRealNextBiggerIntegerByPermutation(): sort the result return by getAllPermutation() and * find the next big integer */ // return the next big integer of number // the algo first get all the permutations of that number to a list of integers // then sort the list and traverse the list to find the next big integer of given number // return -1 if not found public static int getRealNextBiggerIntegerByPermutation(int number){ if (number < 0) throw new IllegalArgumentException("input must be positive integer"); List<Integer> permutations; try{ permutations = getAllPermutation(number); } catch(NumberFormatException noe) { //overflow case //System.out.println(noe.toString()); return -1; } Collections.sort(permutations); for (int i = 0; i < permutations.size(); i++) { if ( i + 1 < permutations.size() && permutations.get(i + 1) > number) { //System.out.println("ans" + permutations.get(i + 1)); return permutations.get(i+1); } } return -1; } // given any number, get a list of all permutations in String type of the given number // return a list of interger type of the all permutations of that given number private static List<Integer> getAllPermutation(int number) { List<String> res = new LinkedList<>(); String num = String.valueOf(number); getPerm(num.toCharArray(), new boolean[num.length()], new StringBuilder(), res); List<Integer> numbers = new LinkedList<>(); for (String n : res) { try{ numbers.add(Integer.parseInt(n)); } catch(NumberFormatException noe) { throw noe; } } return numbers; } // backtrack to get all the permutation of "number" char array // save the result to a list of string private static void getPerm(char[] number, boolean[] used, StringBuilder sb, List<String> res) { if (sb.length() == number.length) { res.add(sb.toString()); return; } for (int i = 0; i < number.length; i++) { if(!used[i]) { sb.append(number[i]); used[i] = true; getPerm(number, used, sb, res); sb.setLength(sb.length() - 1); used[i] = false; } } } ///////////////////////////////////////////////////////////////////////////////////////////// // below not working version //starts with #2 scan from the last digit, swap with the first smaller digit O(n) // lets use int think of overflow later (with long) // the func does not work with 1342 -> returns 2341, but the correct ans = 1423 public static int nextBiggerInteger(int number){ //12 int num = number; int lastDigit = num % 10; //2 num /= 10; //1 StringBuilder sb = new StringBuilder(); while (num > 0) { //loop throw numbers from last digits int next = num % 10; //1 if ( next < lastDigit) { //swap next and lastDigit num = (num / 10) * 10 + lastDigit; sb.reverse().append(next); break; } sb.append(next); num /= 10; } // add num with sb String rest = sb.toString(); //System.out.println(rest); int restInt = 0; if (rest != null && rest.length() > 0) { try{ restInt = Integer.parseInt(rest); // none }catch(NumberFormatException noe) { System.out.println(noe.toString()); restInt = 0; } for (int i = 0; i < rest.length(); i++) { num *= 10; } } num += restInt; return num > number ? num : -1; } ///////////////////////////////////////////////////////////////////////////////////////////// } '''
__source__ = 'https://leetcode.com/problems/next-greater-element-iii/description/' result = '\nIFang Lee ran 238 lines of Java (finished in 11.59s):\n\ngetRealNextBiggerInteger():\n12-> 21 true\n513 -> 531 true\n1342-> 1423 true\n534976-> 536479 true\n9999-> -1 true\n11-> -1 true\n0-> -1 true\n2147483647-> -1 true\n\ngetRealNextBiggerIntegerByPermutation():\n12-> 21 true\n513 -> 531 true\n1342-> 1423 true\n534976-> 536479 true\n9999-> -1 true\n11-> -1 true\n0-> -1 true\n2147483647-> -1 true\n' my_ans = '\nimport java.io.*;\nimport java.util.*;\n\n// 1. permutation -> worse big O (n!)\n// 2. scan from the last digit, swap with the first smaller digit O(n)\n\npublic class Solution {\n public static void main(String[] args) {\n testNextBiggerInteger();\n }\n\n public static void testNextBiggerInteger() {\n int res1, res2;\n System.out.println("getRealNextBiggerInteger(): ");\n System.out.println("12-> " + (res2 = getRealNextBiggerInteger(12)) + " "\n + (res2 == 21) + "");\n System.out.println("513 -> " + (res2 = getRealNextBiggerInteger(513)) + " "\n + (res2 == 531) + "");\n System.out.println("1342-> " + (res2 = getRealNextBiggerInteger(1342)) + " "\n + (res2 == 1423) + "");\n System.out.println("534976-> " + (res2 = getRealNextBiggerInteger(534976)) + " "\n + (res2 == 536479) + "");\n\n //negative tests\n System.out.println("9999-> " + (res2 = getRealNextBiggerInteger(9999)) + " "\n + (res2 == -1) + "");\n System.out.println("11-> " + (res2 = getRealNextBiggerInteger(11)) + " "\n + (res2 == -1) + "");\n System.out.println("0-> " + (res2 = getRealNextBiggerInteger(0)) + " "\n + (res2 == -1) + "");\n System.out.println("2147483647-> " + (res2 = getRealNextBiggerInteger(Integer.MAX_VALUE))+ " "\n + (res2 == -1) + "");\n System.out.println("987654321-> " + (res1 = getRealNextBiggerInteger(987654321)) + " "\n + (res1 == -1) + "");\n\n System.out.println();\n System.out.println("getRealNextBiggerIntegerByPermutation(): ");\n System.out.println("12-> " + (res1 = getRealNextBiggerIntegerByPermutation(12)) + " "\n + (res1 == 21) + "");\n System.out.println("513 -> " + (res1 = getRealNextBiggerIntegerByPermutation(513))+ " "\n + (res1 == 531) + "");\n System.out.println("1342-> " + (res1 = getRealNextBiggerIntegerByPermutation(1342)) + " "\n + (res1 == 1423) + "");\n System.out.println("534976-> " + (res1 = getRealNextBiggerIntegerByPermutation(534976)) + " "\n + (res1 == 536479) + "");\n\n //negative tests\n System.out.println("9999-> " + (res1 = getRealNextBiggerIntegerByPermutation(9999)) + " "\n + (res1 == -1) + "");\n System.out.println("11-> " + (res1 = getRealNextBiggerIntegerByPermutation(11)) + " "\n + (res1 == -1) + "");\n System.out.println("0-> " + (res1 = getRealNextBiggerIntegerByPermutation(0)) + " "\n + (res1 == -1) + "");\n // significant long runtime (10982 milliseconds) for below test cases:\n System.out.println("2147483647-> " + (res1 = getRealNextBiggerIntegerByPermutation(Integer.MAX_VALUE))\n + " " + (res1 == -1) + "");\n // cannot run below: Stopped: CPU usage beyond threshold!\n // System.out.println("9876543210-> " + (res1 = getRealNextBiggerIntegerByPermutation(987654321)) + " "\n // + (res1 == -1) + "");\n\n }\n\n /////////////////////////////////////////////////////////////////////////////////////////////\n /* Time O(n)\n * 1. scan from the right, find the first digit larger than its right neighbor\n * 2. Within the range of (1) to right of the number, find a digit larger than(1)\n * 3. swap digit at (1) and (2)\n * 4. reverse the digit from index at (i) to the end of the digits\n * 5. return the result\n */\n\n public static int getRealNextBiggerInteger(int number){\n if (number < 0) throw new IllegalArgumentException("input must be positive integer");\n char[] num = String.valueOf(number).toCharArray();\n int i = num.length - 1, j = num.length - 1;\n\n // find the first digit from right that is smaller the its right digit\n while (i > 0 && num[i] <= num[i-1]) i--; //pivot = num[i-1]\n\n // descending order //ex: 54321\n if (i == 0) return -1;\n\n // find the smallest digit >= pivot within the range (i, num.length)\n while (j > i - 1 && num[j] <= num[i - 1]) j--;\n swap(num, i - 1, j);\n reverse(num, i, num.length - 1);\n\n try { //check for overflow\n return Integer.parseInt(new String(num));\n } catch(NumberFormatException noe) {\n System.out.println(noe.toString());\n return -1;\n }\n\n }\n\n private static void swap(char[] num, int i, int j) {\n char tmp = num[i];\n num[i] = num[j];\n num[j] = tmp;\n }\n\n private static void reverse(char[] num, int start, int end) {\n while(start < end) {\n swap(num, start, end);\n start++;\n end--;\n }\n }\n\n /////////////////////////////////////////////////////////////////////////////////////////////\n /* Time O(n!)\n * 1. Below algo use permutation way to get the next_bigger\n * getAllPermutation(): for any given number, it computes all permutation using given number\n * getRealNextBiggerIntegerByPermutation(): sort the result return by getAllPermutation() and\n * find the next big integer\n */\n\n // return the next big integer of number\n // the algo first get all the permutations of that number to a list of integers\n // then sort the list and traverse the list to find the next big integer of given number\n // return -1 if not found\n public static int getRealNextBiggerIntegerByPermutation(int number){\n if (number < 0) throw new IllegalArgumentException("input must be positive integer");\n List<Integer> permutations;\n try{\n permutations = getAllPermutation(number);\n } catch(NumberFormatException noe) { //overflow case\n //System.out.println(noe.toString());\n return -1;\n }\n Collections.sort(permutations);\n for (int i = 0; i < permutations.size(); i++) {\n if ( i + 1 < permutations.size() && permutations.get(i + 1) > number) {\n //System.out.println("ans" + permutations.get(i + 1));\n return permutations.get(i+1);\n }\n }\n return -1;\n }\n\n // given any number, get a list of all permutations in String type of the given number\n // return a list of interger type of the all permutations of that given number\n private static List<Integer> getAllPermutation(int number) {\n List<String> res = new LinkedList<>();\n String num = String.valueOf(number);\n getPerm(num.toCharArray(), new boolean[num.length()], new StringBuilder(), res);\n List<Integer> numbers = new LinkedList<>();\n for (String n : res) {\n try{\n numbers.add(Integer.parseInt(n));\n } catch(NumberFormatException noe) {\n throw noe;\n }\n }\n return numbers;\n }\n\n // backtrack to get all the permutation of "number" char array\n // save the result to a list of string\n private static void getPerm(char[] number, boolean[] used, StringBuilder sb, List<String> res) {\n if (sb.length() == number.length) {\n res.add(sb.toString());\n return;\n }\n\n for (int i = 0; i < number.length; i++) {\n if(!used[i]) {\n sb.append(number[i]);\n used[i] = true;\n getPerm(number, used, sb, res);\n sb.setLength(sb.length() - 1);\n used[i] = false;\n }\n }\n }\n\n\n /////////////////////////////////////////////////////////////////////////////////////////////\n // below not working version\n //starts with #2 scan from the last digit, swap with the first smaller digit O(n)\n // lets use int think of overflow later (with long)\n // the func does not work with 1342 -> returns 2341, but the correct ans = 1423\n public static int nextBiggerInteger(int number){ //12\n int num = number;\n int lastDigit = num % 10; //2\n num /= 10; //1\n StringBuilder sb = new StringBuilder();\n while (num > 0) { //loop throw numbers from last digits\n int next = num % 10; //1\n\n if ( next < lastDigit) { //swap next and lastDigit\n num = (num / 10) * 10 + lastDigit;\n sb.reverse().append(next);\n break;\n }\n sb.append(next);\n num /= 10;\n }\n // add num with sb\n String rest = sb.toString();\n //System.out.println(rest);\n int restInt = 0;\n if (rest != null && rest.length() > 0) {\n try{\n restInt = Integer.parseInt(rest); // none\n }catch(NumberFormatException noe) {\n System.out.println(noe.toString());\n restInt = 0;\n }\n\n for (int i = 0; i < rest.length(); i++) {\n num *= 10;\n }\n }\n\n\n num += restInt;\n return num > number ? num : -1;\n }\n /////////////////////////////////////////////////////////////////////////////////////////////\n}\n'
def es_vocal(letra): """ Decide si una letra es vocal >>> es_vocal('A') True >>> es_vocal('ae') False >>> es_vocal('Z') False >>> es_vocal('o') True :param letra: :return: """ return len(letra) == 1 and letra in 'aeiouAEIOU' def contar_vocales(texto): """ Cuenta cuantas vocales hay en un texto >>> contar_vocales('') 0 >>> contar_vocales('hola') 2 >>> contar_vocales('qwrtp') 0 >>> contar_vocales('aeiou') 5 :param texto: :return: """ contador = 0 for letra in texto: if es_vocal(letra): contador += 1 return contador
def es_vocal(letra): """ Decide si una letra es vocal >>> es_vocal('A') True >>> es_vocal('ae') False >>> es_vocal('Z') False >>> es_vocal('o') True :param letra: :return: """ return len(letra) == 1 and letra in 'aeiouAEIOU' def contar_vocales(texto): """ Cuenta cuantas vocales hay en un texto >>> contar_vocales('') 0 >>> contar_vocales('hola') 2 >>> contar_vocales('qwrtp') 0 >>> contar_vocales('aeiou') 5 :param texto: :return: """ contador = 0 for letra in texto: if es_vocal(letra): contador += 1 return contador
# Portal & Effect for Evan Intro | Dream World: Dream Forest Entrance (900010000) # Author: Tiger # "You who are seeking a Pact..." sm.showEffect("Map/Effect.img/evan/dragonTalk01", 3000)
sm.showEffect('Map/Effect.img/evan/dragonTalk01', 3000)
#implement STACK/LIFO using LIST stack=[] while True: choice=int(input("1 push, 2 pop, 3 peek, 4 display, 5 exit ")) if choice == 1: ele=int(input("enter element to push ")) stack.append(ele) elif choice == 2: if len(stack)>0: pele=stack.pop() print("poped elemnt ",pele) else: print("stack is empty") elif choice == 3: if len(stack)>0: tele=stack[len(stack)-1] print("topmost elemnt ",tele) else: print("stack is empty") elif choice == 4: for i in stack: print(i,end='') print() elif choice == 5: break else: print("invalid choice")
stack = [] while True: choice = int(input('1 push, 2 pop, 3 peek, 4 display, 5 exit ')) if choice == 1: ele = int(input('enter element to push ')) stack.append(ele) elif choice == 2: if len(stack) > 0: pele = stack.pop() print('poped elemnt ', pele) else: print('stack is empty') elif choice == 3: if len(stack) > 0: tele = stack[len(stack) - 1] print('topmost elemnt ', tele) else: print('stack is empty') elif choice == 4: for i in stack: print(i, end='') print() elif choice == 5: break else: print('invalid choice')
#!/bin/python3 nombre = 3 nombres_premiers = [1, 2] print(2) try: while True: diviseurs = [] for diviseur in nombres_premiers: division = nombre / diviseur if division == int(division): diviseurs.append(diviseur) if len(diviseurs) == 1: print(nombre) nombres_premiers.append(nombre) del diviseurs nombre += 2 except KeyboardInterrupt: pass # print(nombre)
nombre = 3 nombres_premiers = [1, 2] print(2) try: while True: diviseurs = [] for diviseur in nombres_premiers: division = nombre / diviseur if division == int(division): diviseurs.append(diviseur) if len(diviseurs) == 1: print(nombre) nombres_premiers.append(nombre) del diviseurs nombre += 2 except KeyboardInterrupt: pass
DIGS = {1: 'F1D', 2: 'F2D', 3: 'F3D', 22: 'SD', -2: 'L2D'} SEC_ORDER_DIGS = {key: f'{val}_sec' for key, val in DIGS.items()} REV_DIGS = {'F1D': 1, 'F2D': 2, 'F3D': 3, 'SD': 22, 'L2D': -2} LEN_TEST = {1: 9, 2: 90, 3: 900, 22: 10, -2: 100} TEST_NAMES = {'F1D': 'First Digit Test', 'F2D': 'First Two Digits Test', 'F3D': 'First Three Digits Test', 'SD': 'Second Digit Test', 'L2D': 'Last Two Digits Test', 'F1D_sec': 'First Digit Second Order Test', 'F2D_sec': 'First Two Digits Second Order Test', 'F3D_sec': 'First Three Digits Second Order Test', 'SD_sec': 'Second Digit Second Order Test', 'L2D_sec': 'Last Two Digits Second Order Test', 'F1D_Summ': 'First Digit Summation Test', 'F2D_Summ': 'First Two Digits Summation Test', 'F3D_Summ': 'First Three Digits Summation Test', 'Mantissas': 'Mantissas Test' } # Critical values for Mean Absolute Deviation MAD_CONFORM = {1: [0.006, 0.012, 0.015], 2: [0.0012, 0.0018, 0.0022], 3: [0.00036, 0.00044, 0.00050], 22: [0.008, 0.01, 0.012], -2: None, 'F1D': 'First Digit', 'F2D': 'First Two Digits', 'F3D': 'First Three Digits', 'SD': 'Second Digits'} # Color for the plotting COLORS = {'m': '#00798c', 'b': '#E2DCD8', 's': '#9c3848', 'af': '#edae49', 'ab': '#33658a', 'h': '#d1495b', 'h2': '#f64740', 't': '#16DB93'} # Critical Z-scores according to the confindence levels CONFS = {None: None, 80: 1.285, 85: 1.435, 90: 1.645, 95: 1.96, 99: 2.576, 99.9: 3.29, 99.99: 3.89, 99.999: 4.417, 99.9999: 4.892, 99.99999: 5.327} P_VALUES = {None: 'None', 80: '0.2', 85: '0.15', 90: '0.1', 95: '0.05', 99: '0.01', 99.9: '0.001', 99.99: '0.0001', 99.999: '0.00001', 99.9999: '0.000001', 99.99999: '0.0000001'} # Critical Chi-Square values according to the tests degrees of freedom # and confidence levels CRIT_CHI2 = {8: {80: 11.03, 85: 12.027, 90: 13.362, 95: 15.507, 99: 20.090, 99.9: 26.124, 99.99: 31.827, None: None, 99.999: 37.332, 99.9999: 42.701, 99.99999: 47.972}, 9: {80: 12.242, 85: 13.288, 90: 14.684, 95: 16.919, 99: 21.666, 99.9: 27.877, 99.99: 33.72, None: None, 99.999: 39.341, 99.9999: 44.811, 99.99999: 50.172}, 89: {80: 99.991, 85: 102.826, 90: 106.469, 95: 112.022, 99: 122.942, 99.9: 135.978, 99.99: 147.350, 99.999: 157.702, 99.9999: 167.348, 99.99999: 176.471, None: None}, 99: {80: 110.607, 85: 113.585, 90: 117.407, 95: 123.225, 99: 134.642, 99.9: 148.230, 99.99: 160.056, 99.999: 170.798, 99.9999: 180.792, 99.99999: 190.23, None: None}, 899: {80: 934.479, 85: 942.981, 90: 953.752, 95: 969.865, 99: 1000.575, 99.9: 1035.753, 99.99: 1065.314, 99.999: 1091.422, 99.9999: 1115.141, 99.99999: 1137.082, None: None} } # Critical Kolmogorov-Smirnov values according to the confidence levels # These values are yet to be divided by the square root of the sample size CRIT_KS = {80: 1.075, 85: 1.139, 90: 1.225, 95: 1.36, 99: 1.63, 99.9: 1.95, 99.99: 2.23, 99.999: 2.47, 99.9999: 2.7, 99.99999: 2.9, None: None}
digs = {1: 'F1D', 2: 'F2D', 3: 'F3D', 22: 'SD', -2: 'L2D'} sec_order_digs = {key: f'{val}_sec' for (key, val) in DIGS.items()} rev_digs = {'F1D': 1, 'F2D': 2, 'F3D': 3, 'SD': 22, 'L2D': -2} len_test = {1: 9, 2: 90, 3: 900, 22: 10, -2: 100} test_names = {'F1D': 'First Digit Test', 'F2D': 'First Two Digits Test', 'F3D': 'First Three Digits Test', 'SD': 'Second Digit Test', 'L2D': 'Last Two Digits Test', 'F1D_sec': 'First Digit Second Order Test', 'F2D_sec': 'First Two Digits Second Order Test', 'F3D_sec': 'First Three Digits Second Order Test', 'SD_sec': 'Second Digit Second Order Test', 'L2D_sec': 'Last Two Digits Second Order Test', 'F1D_Summ': 'First Digit Summation Test', 'F2D_Summ': 'First Two Digits Summation Test', 'F3D_Summ': 'First Three Digits Summation Test', 'Mantissas': 'Mantissas Test'} mad_conform = {1: [0.006, 0.012, 0.015], 2: [0.0012, 0.0018, 0.0022], 3: [0.00036, 0.00044, 0.0005], 22: [0.008, 0.01, 0.012], -2: None, 'F1D': 'First Digit', 'F2D': 'First Two Digits', 'F3D': 'First Three Digits', 'SD': 'Second Digits'} colors = {'m': '#00798c', 'b': '#E2DCD8', 's': '#9c3848', 'af': '#edae49', 'ab': '#33658a', 'h': '#d1495b', 'h2': '#f64740', 't': '#16DB93'} confs = {None: None, 80: 1.285, 85: 1.435, 90: 1.645, 95: 1.96, 99: 2.576, 99.9: 3.29, 99.99: 3.89, 99.999: 4.417, 99.9999: 4.892, 99.99999: 5.327} p_values = {None: 'None', 80: '0.2', 85: '0.15', 90: '0.1', 95: '0.05', 99: '0.01', 99.9: '0.001', 99.99: '0.0001', 99.999: '0.00001', 99.9999: '0.000001', 99.99999: '0.0000001'} crit_chi2 = {8: {80: 11.03, 85: 12.027, 90: 13.362, 95: 15.507, 99: 20.09, 99.9: 26.124, 99.99: 31.827, None: None, 99.999: 37.332, 99.9999: 42.701, 99.99999: 47.972}, 9: {80: 12.242, 85: 13.288, 90: 14.684, 95: 16.919, 99: 21.666, 99.9: 27.877, 99.99: 33.72, None: None, 99.999: 39.341, 99.9999: 44.811, 99.99999: 50.172}, 89: {80: 99.991, 85: 102.826, 90: 106.469, 95: 112.022, 99: 122.942, 99.9: 135.978, 99.99: 147.35, 99.999: 157.702, 99.9999: 167.348, 99.99999: 176.471, None: None}, 99: {80: 110.607, 85: 113.585, 90: 117.407, 95: 123.225, 99: 134.642, 99.9: 148.23, 99.99: 160.056, 99.999: 170.798, 99.9999: 180.792, 99.99999: 190.23, None: None}, 899: {80: 934.479, 85: 942.981, 90: 953.752, 95: 969.865, 99: 1000.575, 99.9: 1035.753, 99.99: 1065.314, 99.999: 1091.422, 99.9999: 1115.141, 99.99999: 1137.082, None: None}} crit_ks = {80: 1.075, 85: 1.139, 90: 1.225, 95: 1.36, 99: 1.63, 99.9: 1.95, 99.99: 2.23, 99.999: 2.47, 99.9999: 2.7, 99.99999: 2.9, None: None}
# model settings model = dict( type='NPID', neg_num=65536, backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(3,), # no conv-1, x-1: stage-x norm_cfg=dict(type='SyncBN'), style='pytorch'), neck=dict( type='LinearNeck', in_channels=2048, out_channels=128, with_avg_pool=True), head=dict(type='ContrastiveHead', temperature=0.07), memory_bank=dict( type='SimpleMemory', length=1281167, feat_dim=128, momentum=0.5) )
model = dict(type='NPID', neg_num=65536, backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(3,), norm_cfg=dict(type='SyncBN'), style='pytorch'), neck=dict(type='LinearNeck', in_channels=2048, out_channels=128, with_avg_pool=True), head=dict(type='ContrastiveHead', temperature=0.07), memory_bank=dict(type='SimpleMemory', length=1281167, feat_dim=128, momentum=0.5))
#!/usr/bin/env python3 # coding:utf-8 def estimate_area_from_stock(stock) : return 10000000000;
def estimate_area_from_stock(stock): return 10000000000
# CFG-RATE (0x06,0x08) packet (without header 0xB5,0x62) # payload length - 6 (little endian format), update rate 200ms, cycles - 1, reference - UTC (0) packet = [] packet = input('What is the payload? ') CK_A,CK_B = 0, 0 for i in range(len(packet)): CK_A = CK_A + packet[i] CK_B = CK_B + CK_A # ensure unsigned byte range CK_A = CK_A & 0xFF CK_B = CK_B & 0xFF print ("UBX packet checksum:", ("0x%02X,0x%02X" % (CK_A,CK_B)))
packet = [] packet = input('What is the payload? ') (ck_a, ck_b) = (0, 0) for i in range(len(packet)): ck_a = CK_A + packet[i] ck_b = CK_B + CK_A ck_a = CK_A & 255 ck_b = CK_B & 255 print('UBX packet checksum:', '0x%02X,0x%02X' % (CK_A, CK_B))
class Course: def __init__(self, **kw): self.name = kw.pop('name') #def full_name(self): # return self.first_name + " " + self.last_name
class Course: def __init__(self, **kw): self.name = kw.pop('name')
'''Extracts the data from the json content. Outputs results in a dataframe''' def get_play_df(content): events = {} event_num = 0 home = content['gameData']['teams']['home']['id'] away = content['gameData']['teams']['away']['id'] for i in range(len(content['liveData']['plays']['allPlays'])): temp = {} if content['liveData']['plays']['allPlays'][i]['result']['event'] == 'Penalty': temp['event_type'] = 'Penalty' temp['penalty_minutes'] = content['liveData']['plays']['allPlays'][i]['result']['penaltyMinutes'] temp['time_of_event'] = content['liveData']['plays']['allPlays'][i]['about']['periodTime'] temp['period'] = content['liveData']['plays']['allPlays'][i]['about']['ordinalNum'] temp['current_score'] = content['liveData']['plays']['allPlays'][i]['about']['goals'] if content['liveData']['plays']['allPlays'][i]['team']['id'] == home: temp['team'] = 'home' elif content['liveData']['plays']['allPlays'][i]['team']['id'] == away: temp['team'] = 'away' else: temp['team'] = 'error' events[event_num] = temp event_num += 1 if content['liveData']['plays']['allPlays'][i]['result']['event'] in ['Blocked Shot', 'Goal', 'Missed Shot', 'Shot']: temp['event_type'] = content['liveData']['plays']['allPlays'][i]['result']['event'] temp['penalty_minutes'] = 0 temp['time_of_event'] = content['liveData']['plays']['allPlays'][i]['about']['periodTime'] temp['period'] = content['liveData']['plays']['allPlays'][i]['about']['ordinalNum'] temp['current_score'] = content['liveData']['plays']['allPlays'][i]['about']['goals'] if content['liveData']['plays']['allPlays'][i]['team']['id'] == home: temp['team'] = 'home' elif content['liveData']['plays']['allPlays'][i]['team']['id'] == away: temp['team'] = 'away' else: temp['team'] = 'error' events[event_num] = temp event_num += 1 events_df = pd.DataFrame(events) events_df_t = events_df.transpose() return events_df_t ''' Helper function to get time of game events in seconds''' def get_seconds(time, period): if period == 'OT': period = '4th' elif period == 'SO': return 3605 seconds = int(time[3:]) minutes = int(time[0:2]) game_period = int(period[0]) -1 timestamp = (20 * 60 * game_period) + (60 * minutes) + seconds return timestamp ''' Main function that determines shots, and if there are any active penalties (which would negate the shot being counted towards the advanced stats). The function returns the shot counts for each team''' def count_all_shots(events_df_t): home_shots = 0 away_shots = 0 home_blocked_shots = 0 away_blocked_shots = 0 active_penalty = False home_penalty = False away_penalty = False two_man_advtg = False four_v_four = False major_penalty = False shot_types = ['Blocked Shot', 'Goal', 'Missed Shot', 'Shot'] for i in range(len(events_df_t)): event = events_df_t['event_type'][i] event_time = events_df_t['timestamp'][i] if events_df_t['period'][i] == 'SO': return home_shots, away_shots, home_blocked_shots, away_blocked_shots if major_penalty == True: if end_penalty_time <= event_time: major_penalty = False if active_penalty == True: if (event in shot_types) & (end_penalty_time <= event_time): active_penalty = False four_v_four = False elif event == 'Penalty': if ((events_df_t['team'][i] == 'home') & (home_penalty == True) or ((events_df_t['team'][i] == 'away') & (away_penalty == True))): added_time = 60 * events_df_t['penalty_minutes'][i] end_penalty_time = event_time + added_time two_man_advtg = True else: # Currently does not take into account 4v4 as even strength, will fix later added_time = 60 * events_df_t['penalty_minutes'][i] end_penalty_time = event_time + added_time four_v_four = True if (event in shot_types) & (active_penalty == False): if events_df_t['team'][i] == 'home': if event == 'Blocked Shot': home_blocked_shots += 1 else: home_shots += 1 else: if event == 'Blocked Shot': away_blocked_shots += 1 else: away_shots += 1 elif (event == 'Penalty') & (active_penalty == False): active_penalty = True if events_df_t['penalty_minutes'][i] >= 5: major_penalty = True if events_df_t['team'][i] == 'home': home_penalty = True else: away_penalty = True added_time = 60 * events_df_t['penalty_minutes'][i] end_penalty_time = event_time + added_time elif (event == 'Goal') & (active_penalty == True) & (major_penalty == False): if two_man_advtg == True: two_man_advtg = False elif four_v_four == True: if events_df_t['team'][i] == 'home': away_penalty = False elif events_df_t['team'][i] == 'away': home_penalty = False four_v_four = False else: active_penalty = False home_penalty = False away_penalty = False return home_shots, away_shots, home_blocked_shots, away_blocked_shots '''Based on the output of the above function, this calculates that actual advanced Corsi and Fenwick stats''' def calc_advanced_stats(home_shots, away_shots, home_blocked_shots, away_blocked_shots): corsi_for = home_shots + home_blocked_shots corsi_against = away_shots + away_blocked_shots cf_pct = corsi_for/(corsi_for + corsi_against) ca_pct = corsi_against/(corsi_for + corsi_against) fenwick_for = home_shots fenwick_against = away_shots ff_pct = home_shots/(home_shots + away_shots) fa_pct = away_shots/(home_shots + away_shots) return corsi_for, corsi_against, cf_pct, ca_pct, fenwick_for, fenwick_against, ff_pct, fa_pct '''Performs the API call to the NHL API''' def get_api_data(game_id): # Call API URL = f"https://statsapi.web.nhl.com/api/v1/game/{game_id}/feed/live" # sending get request and saving the response as response object r = re.get(url=URL) content = r.json() return content '''Main function to call API. Uses game IDs in the Kaggle dataset to perform the call''' def get_game_data(game_list): game_data_dict = {} i = 0 for game_id in tqdm(game_list): try: game_data_dict[game_id] = get_api_data(game_id) except Exception as e: print('\n======EXCEPTION=====') print(e) game_data_dict[game_id] = 0 continue # Saving checkpoint if i % 100 == 0: print(f"Completed {i} iterations") #filename = f'game_data_checkpoint_{i}.sav' #pickle.dump(game_data_dict, open(filename, 'wb')) i+=1 return game_data_dict
"""Extracts the data from the json content. Outputs results in a dataframe""" def get_play_df(content): events = {} event_num = 0 home = content['gameData']['teams']['home']['id'] away = content['gameData']['teams']['away']['id'] for i in range(len(content['liveData']['plays']['allPlays'])): temp = {} if content['liveData']['plays']['allPlays'][i]['result']['event'] == 'Penalty': temp['event_type'] = 'Penalty' temp['penalty_minutes'] = content['liveData']['plays']['allPlays'][i]['result']['penaltyMinutes'] temp['time_of_event'] = content['liveData']['plays']['allPlays'][i]['about']['periodTime'] temp['period'] = content['liveData']['plays']['allPlays'][i]['about']['ordinalNum'] temp['current_score'] = content['liveData']['plays']['allPlays'][i]['about']['goals'] if content['liveData']['plays']['allPlays'][i]['team']['id'] == home: temp['team'] = 'home' elif content['liveData']['plays']['allPlays'][i]['team']['id'] == away: temp['team'] = 'away' else: temp['team'] = 'error' events[event_num] = temp event_num += 1 if content['liveData']['plays']['allPlays'][i]['result']['event'] in ['Blocked Shot', 'Goal', 'Missed Shot', 'Shot']: temp['event_type'] = content['liveData']['plays']['allPlays'][i]['result']['event'] temp['penalty_minutes'] = 0 temp['time_of_event'] = content['liveData']['plays']['allPlays'][i]['about']['periodTime'] temp['period'] = content['liveData']['plays']['allPlays'][i]['about']['ordinalNum'] temp['current_score'] = content['liveData']['plays']['allPlays'][i]['about']['goals'] if content['liveData']['plays']['allPlays'][i]['team']['id'] == home: temp['team'] = 'home' elif content['liveData']['plays']['allPlays'][i]['team']['id'] == away: temp['team'] = 'away' else: temp['team'] = 'error' events[event_num] = temp event_num += 1 events_df = pd.DataFrame(events) events_df_t = events_df.transpose() return events_df_t ' Helper function to get time of game events in seconds' def get_seconds(time, period): if period == 'OT': period = '4th' elif period == 'SO': return 3605 seconds = int(time[3:]) minutes = int(time[0:2]) game_period = int(period[0]) - 1 timestamp = 20 * 60 * game_period + 60 * minutes + seconds return timestamp ' Main function that determines shots, and if there are any active penalties (which would negate\nthe shot being counted towards the advanced stats). The function returns the shot counts for each team' def count_all_shots(events_df_t): home_shots = 0 away_shots = 0 home_blocked_shots = 0 away_blocked_shots = 0 active_penalty = False home_penalty = False away_penalty = False two_man_advtg = False four_v_four = False major_penalty = False shot_types = ['Blocked Shot', 'Goal', 'Missed Shot', 'Shot'] for i in range(len(events_df_t)): event = events_df_t['event_type'][i] event_time = events_df_t['timestamp'][i] if events_df_t['period'][i] == 'SO': return (home_shots, away_shots, home_blocked_shots, away_blocked_shots) if major_penalty == True: if end_penalty_time <= event_time: major_penalty = False if active_penalty == True: if (event in shot_types) & (end_penalty_time <= event_time): active_penalty = False four_v_four = False elif event == 'Penalty': if (events_df_t['team'][i] == 'home') & (home_penalty == True) or (events_df_t['team'][i] == 'away') & (away_penalty == True): added_time = 60 * events_df_t['penalty_minutes'][i] end_penalty_time = event_time + added_time two_man_advtg = True else: added_time = 60 * events_df_t['penalty_minutes'][i] end_penalty_time = event_time + added_time four_v_four = True if (event in shot_types) & (active_penalty == False): if events_df_t['team'][i] == 'home': if event == 'Blocked Shot': home_blocked_shots += 1 else: home_shots += 1 elif event == 'Blocked Shot': away_blocked_shots += 1 else: away_shots += 1 elif (event == 'Penalty') & (active_penalty == False): active_penalty = True if events_df_t['penalty_minutes'][i] >= 5: major_penalty = True if events_df_t['team'][i] == 'home': home_penalty = True else: away_penalty = True added_time = 60 * events_df_t['penalty_minutes'][i] end_penalty_time = event_time + added_time elif (event == 'Goal') & (active_penalty == True) & (major_penalty == False): if two_man_advtg == True: two_man_advtg = False elif four_v_four == True: if events_df_t['team'][i] == 'home': away_penalty = False elif events_df_t['team'][i] == 'away': home_penalty = False four_v_four = False else: active_penalty = False home_penalty = False away_penalty = False return (home_shots, away_shots, home_blocked_shots, away_blocked_shots) 'Based on the output of the above function, this calculates that actual advanced Corsi and Fenwick stats' def calc_advanced_stats(home_shots, away_shots, home_blocked_shots, away_blocked_shots): corsi_for = home_shots + home_blocked_shots corsi_against = away_shots + away_blocked_shots cf_pct = corsi_for / (corsi_for + corsi_against) ca_pct = corsi_against / (corsi_for + corsi_against) fenwick_for = home_shots fenwick_against = away_shots ff_pct = home_shots / (home_shots + away_shots) fa_pct = away_shots / (home_shots + away_shots) return (corsi_for, corsi_against, cf_pct, ca_pct, fenwick_for, fenwick_against, ff_pct, fa_pct) 'Performs the API call to the NHL API' def get_api_data(game_id): url = f'https://statsapi.web.nhl.com/api/v1/game/{game_id}/feed/live' r = re.get(url=URL) content = r.json() return content 'Main function to call API. Uses game IDs in the Kaggle dataset to perform the call' def get_game_data(game_list): game_data_dict = {} i = 0 for game_id in tqdm(game_list): try: game_data_dict[game_id] = get_api_data(game_id) except Exception as e: print('\n======EXCEPTION=====') print(e) game_data_dict[game_id] = 0 continue if i % 100 == 0: print(f'Completed {i} iterations') i += 1 return game_data_dict
""" * * Author: Juarez Paulino(coderemite) * Email: [email protected] * """ n=int(input()) a,b=map(int,input().split()) c,d=map(int,input().split()) e,f=map(int,input().split()) m=n-a-c-e x=max(0,min(m,b-a));m-=x y=max(0,min(m,d-c));m-=y z=max(0,min(m,f-e));m-=z print(a+x,c+y,e+z)
""" * * Author: Juarez Paulino(coderemite) * Email: [email protected] * """ n = int(input()) (a, b) = map(int, input().split()) (c, d) = map(int, input().split()) (e, f) = map(int, input().split()) m = n - a - c - e x = max(0, min(m, b - a)) m -= x y = max(0, min(m, d - c)) m -= y z = max(0, min(m, f - e)) m -= z print(a + x, c + y, e + z)
""" models/__init__.py ------------------------------------------------------------------- """ def init_app(app): """ :param app: :return: """ pass
""" models/__init__.py ------------------------------------------------------------------- """ def init_app(app): """ :param app: :return: """ pass
""" Discussion: As we increase the input firing rate, more synapses move to the extreme values, either go to zero or to maximal conductance. Using 15Hz, the distribution of the weights at the end of the simulation is more like a bell-shaped, skewed, with more synapses to be potentiated. However, increasing the firing rate, in early times, almost all synapses undergo depression, and then only a few escape and they become potentiated. """;
""" Discussion: As we increase the input firing rate, more synapses move to the extreme values, either go to zero or to maximal conductance. Using 15Hz, the distribution of the weights at the end of the simulation is more like a bell-shaped, skewed, with more synapses to be potentiated. However, increasing the firing rate, in early times, almost all synapses undergo depression, and then only a few escape and they become potentiated. """
#!/usr/bin/env python #-*- coding:utf8 -*- # @Author: lisnb # @Date: 2016-04-27T11:05:16+08:00 # @Email: [email protected] # @Last modified by: lisnb # @Last modified time: 2016-06-18T22:20:18+08:00 class UnknownError(Exception): pass class ImproperlyConfigured(Exception): """Wiesler is somehow improperly configured""" pass class ImportFailed(ImportError): """Import module failed""" pass class ImportAppConfigFailed(ImportFailed): """Can't import config of app when initialize an App instance""" pass class AttributeNotFound(Exception): """Necessary attribute is not found""" pass class NecessaryVariableIsEmpty(Exception): """A variable that is necessary is empty, None or empty list etc.""" pass class ArguementInvalid(Exception): """Attribute is somehow invalid""" pass class DBError(Exception): pass class MySQLError(DBError): """Something happens when using mysql""" pass class MySQLConnectionError(MySQLError): """Can't establish connection with mysql server""" pass class MySQLExecuteError(MySQLError): """Error when try to execute SQL statement""" pass class MongoDBError(DBError): pass class MongoDBConnectionError(MongoDBError): pass class MongoDBExecuteError(MongoDBError): pass class AppNotFound(ImportFailed): pass
class Unknownerror(Exception): pass class Improperlyconfigured(Exception): """Wiesler is somehow improperly configured""" pass class Importfailed(ImportError): """Import module failed""" pass class Importappconfigfailed(ImportFailed): """Can't import config of app when initialize an App instance""" pass class Attributenotfound(Exception): """Necessary attribute is not found""" pass class Necessaryvariableisempty(Exception): """A variable that is necessary is empty, None or empty list etc.""" pass class Arguementinvalid(Exception): """Attribute is somehow invalid""" pass class Dberror(Exception): pass class Mysqlerror(DBError): """Something happens when using mysql""" pass class Mysqlconnectionerror(MySQLError): """Can't establish connection with mysql server""" pass class Mysqlexecuteerror(MySQLError): """Error when try to execute SQL statement""" pass class Mongodberror(DBError): pass class Mongodbconnectionerror(MongoDBError): pass class Mongodbexecuteerror(MongoDBError): pass class Appnotfound(ImportFailed): pass
def raio_simplificado(lista_composta): for elemento in lista_composta: yield from elemento lista_composta = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]
def raio_simplificado(lista_composta): for elemento in lista_composta: yield from elemento lista_composta = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
#trying something new uridine_mods_paths = {'U_to_DDusA' : {'upstream_rxns' : ['U'], 'enzymes' : {20:['DusA_mono'], '20A':['DusA_mono'], 17:['DusA_mono'], 16:['DusA_mono']}}, 'U_to_DDusgen' : {'upstream_rxns' : ['U'], 'enzymes' : {20:['generic_Dus'], '20A':['generic_Dus'], 17:['generic_Dus'], 16:['generic_Dus']}}, 'U_to_Um' : {'upstream_rxns' : ['U'], 'enzymes' : {2552:['RrmJ_mono'], 32 : ['TrmJ_dim'], 34 :['trmL_dim' ]}}, 'U_to_Y' : {'upstream_rxns' : ['U'], 'enzymes' : {32:['RluA_mono'], 746 : ['RluA_mono'], 2605:['RluB_mono'], 2504 :['RluC_mono'], 2580:['RluC_mono'], 995 :[ 'RluC_mono'], 1915:['RluD_mono_mod_1:mg2'], 1911:['RluD_mono_mod_1:mg2'], 1917:['RluD_mono_mod_1:mg2'], 2457 :['YmfC_mono'], 2604 :[ 'YjbC_mono'], 13 :[ 'TruD_mono'], 65 :[ 'YqcB_mono'], 55 : ['TruB_mono'], 38 : ['TruA_dim'], 39 :[ 'TruA_dim'], 40 : ['TruA_dim'], 516 :['RsuA_mono']} }, 'U_to_acp3U' : {'upstream_rxns' : ['U'], 'enzymes' : {47:['enzyme_unknown']}}, 'U_to_cmnm5U' : {'upstream_rxns' : ['U'], 'enzymes' : {34:['MnmEG_cplx_mod_fad_mod_2:k']}}, 'U_to_ho5U' : {'upstream_rxns' : ['U'], 'enzymes' : {34:['enzyme_unknown2']}}, 'U_to_m3U' : {'upstream_rxns' : ['U'], 'enzymes' : {1498:['YggJ_dim']}}, 'U_to_m5U' : {'upstream_rxns' : ['U'], 'enzymes' : {747:['RumB_mono_mod_1:4fe4s'], 1939:['RumA_mono_mod_1:4fe4s'], 54 :['TrmA_mono'] }}, 'U_to_nm5U' : {'upstream_rxns' : ['U'], 'enzymes' : {34:['MnmEG_cplx_mod_fad_mod_2:k']}}, 'U_to_s2U' : {'upstream_rxns' : ['U'], 'enzymes' : {34:['TrmU_mono']}}, 'U_to_s4U' : {'upstream_rxns' : ['U'], 'enzymes' : {8:['ThiI_mono']}}, 'ho5U_to_mo5U' : {'upstream_rxns' : ['U_to_ho5U'], 'enzymes' : {34:['YecP_mono']}}, 's2U_to_nm5s2U' : {'upstream_rxns' : ['U_to_s2U'], 'enzymes' : {34:['MnmEG_cplx_mod_fad_mod_2:k']}}, 'cmnm5U_to_cmnm5s2U' : {'upstream_rxns' : ['U_to_cmnm5U'], 'enzymes' : {34:['TrmU_mono']}}, 's2U_to_ges2U' : {'upstream_rxns' : ['U_to_s2U'], 'enzymes' : {34:['YbbB_dim']}}, 's2U_to_se2U' : {'upstream_rxns' : ['U_to_s2U'], 'enzymes' : {34:['YbbB_dim']}}, # this is a guess! 's2U_to_cmnm5s2U' : {'upstream_rxns' : ['U_to_s2U'], 'enzymes' : {34:['MnmEG_cplx_mod_fad_mod_2:k']}}, 'cmnm5s2U_to_cmnm5se2U' : {'upstream_rxns' : ['s2U_to_cmnm5s2U','cmnm5U_to_cmnm5s2U'], 'enzymes' : {34:['YbbB_dim']}}, 'mnm5s2U_to_mnm5ges2U' : {'upstream_rxns' : ['nm5s2U_to_mnm5s2U','mnm5U_to_mnm5s2U'], 'enzymes' : {34:['YbbB_dim']}}, 'cmnm5se2U_to_nm5se2U' : {'upstream_rxns' : ['se2U_to_cmnm5se2U','cmnm5s2U_to_cmnm5se2U'], 'enzymes' : {34:['MnmC_mono_mod_fad']}}, 'Y_to_m3Y' : {'upstream_rxns' : ['U_to_Y'], 'enzymes' : {1915:['RlmH_dim']}}, 'se2U_to_cmnm5se2U' : {'upstream_rxns' : ['s2U_to_se2U'], 'enzymes' : {34:['MnmEG_cplx_mod_fad_mod_2:k']}}, 'cmnm5s2U_to_nm5s2U' : {'upstream_rxns' : ['s2U_to_cmnm5s2U','cmnm5U_to_cmnm5s2U'], 'enzymes' : {34:['MnmC_mono_mod_fad']}}, 'nm5se2U_to_mnm5se2U' : {'upstream_rxns' : ['cmnm5se2U_to_nm5se2U', 'se2U_to_nm5se2U' ,'nm5s2U_to_nm5se2U'], 'enzymes' : {34:['MnmC_mono_mod_fad']}}, 'mnm5s2U_to_mnm5se2U' : {'upstream_rxns' : ['nm5s2U_to_mnm5s2U','mnm5U_to_mnm5s2U'], 'enzymes' : {34:['YbbB_dim']}}, 'mnm5U_to_mnm5s2U' : {'upstream_rxns' : ['nm5U_to_mnm5U'], 'enzymes' : {34:['TrmU_mono']}}, 'nm5s2U_to_nm5se2U' : {'upstream_rxns' : ['s2U_to_nm5s2U','cmnm5s2U_to_nm5s2U'], 'enzymes' : {34:['YbbB_dim']}}, 'nm5s2U_to_mnm5s2U' : {'upstream_rxns' : ['s2U_to_nm5s2U','cmnm5s2U_to_nm5s2U'], 'enzymes' : {34:['MnmC_mono_mod_fad']}}, 'se2U_to_nm5se2U' : {'upstream_rxns' : ['s2U_to_se2U'], 'enzymes' : {34:['MnmEG_cplx_mod_fad_mod_2:k']}}, 'cmnm5U_to_nm5U' : {'upstream_rxns' : ['U_to_cmnm5U'], 'enzymes' : {34:['MnmC_mono_mod_fad']}}, 'cmnm5U_to_cmnm5Um' : {'upstream_rxns' : ['U_to_cmnm5U'], 'enzymes' : {34:['trmL_dim']}}, 'Um_to_cmnm5Um' : {'upstream_rxns' : ['U_to_Um'], 'enzymes' : {34:['MnmEG_cplx_mod_fad_mod_2:k']}}, 'nm5U_to_mnm5U' : {'upstream_rxns' : ['U_to_nm5U', 'cmnm5U_to_nm5U'], 'enzymes' : {34:['MnmC_mono_mod_fad']}}, 'ho5U_to_cmo5U' : {'upstream_rxns' : ['U_to_ho5U'], 'enzymes' : {34:['YecP_mono']} }} cytidine_mods_paths = {'C_to_s2C' : {'upstream_rxns' : ['C'], 'enzymes' : {32:['YdaO_mono']}}, 'C_to_m5C' : {'upstream_rxns' : ['C'], 'enzymes' : {1962:['RlmI_dim'], 967 : ['RsmB_mono'], 1407 : ['RsmF_mono']}}, 'C_to_Cm' : {'upstream_rxns' : ['C'], 'enzymes' : {2498:['RlmM_mono'], 1402:['RsmI_mono'], 32:['TrmJ_dim'], 34 : ['trmL_dim']}}, 'C_to_ac4C' : {'upstream_rxns' : ['C'], 'enzymes' : {34:['TmcA_mono']}}, 'Cm_to_m4Cm' : {'upstream_rxns' : ['C_to_Cm'], 'enzymes' : {1402:['RsmH_mono']}}, 'm4Cm_to_m44Cm' : {'upstream_rxns' : ['Cm_to_m4Cm','m4C_to_m4Cm'], 'enzymes' : {1402:['RsmH_mono']}}, 'C_to_m4C' : {'upstream_rxns' : ['C'], 'enzymes' : {1402:['RsmH_mono']}}, 'm4C_to_m44C' : {'upstream_rxns' : ['C_to_m4C'], 'enzymes' : {1402:['RsmI_mono']}}, 'm4C_to_m4Cm' : {'upstream_rxns' : ['C_to_m4C'], 'enzymes' : {1402:['RsmH_mono']}}, 'C_to_k2C' : {'upstream_rxns' : ['C'], 'enzymes' : {34:['TilS_mono']}} } adenine_mods_paths ={'A_to_m2A' : {'upstream_rxns' : ['A'], 'enzymes' : {37:['RlmN_mono_mod_1:4fe4s'], 2503:['RlmN_mono_mod_1:4fe4s']}}, 'A_to_m6A' : {'upstream_rxns' : ['A'], 'enzymes' : {2058:['enzyme_new_ErmBC'], 1618:['RlmF_mono'], 2030:['enzyme_new_RlmJ'], 1518:['KsgA_mono'], 1519:['KsgA_mono'], 37:['YfiC_mono']}}, 'm6A_to_m66A' : {'upstream_rxns' : ['A_to_m6A'], 'enzymes' : { 1518:['KsgA_mono'], 1519:['KsgA_mono']}}, 'A_to_I' : {'upstream_rxns' : ['A'], 'enzymes' : {34:['TadA_dim_mod_2:zn2']}}, 'A_to_m1A' : {'upstream_rxns' : ['A'], 'enzymes' : {1408:['enzyme_new_NpmA']}}, 'A_to_i6A' : {'upstream_rxns' : ['A'], 'enzymes' : {37:['MiaA_dim_mod_2:mg2']}}, 'i6A_to_ms2i6A' : {'upstream_rxns' : ['A_to_i6A'], 'enzymes' : {37:['MiaB_mono_mod_1:4fe4s']}}, 'A_to_t6A' : {'upstream_rxns' : ['A'], 'enzymes' : {37:['TsaBCDE']}}, 't6A_to_m6t6A' : {'upstream_rxns' : ['A_to_t6A'], 'enzymes' : {37:['EG11503_MONOMER']}}, 't6A_to_ct6A' : {'upstream_rxns' : ['A_to_t6A'], 'enzymes' : {37:['TcdA_dim']}} } guanine_mods_paths={'G_to_m7G' : {'upstream_rxns' : ['G'], 'enzymes' : {2069:['RlmL_dim'], 1405:['enzyme_new_RmtB'], 527:['RsmG_mono'], 46:['YggH_mono']}}, 'G_to_m2G' : {'upstream_rxns' : ['G'], 'enzymes' : {1835:['RlmG_mono'], 2445:['RlmL_dim'], 1207:['RsmC_mono'], 966:['RsmD_mono'], 1516:['enzyme_new_RsmJ'] }}, 'G_to_Gm' : {'upstream_rxns' : ['G'], 'enzymes' : {2251:['RlmB_dim'], 18:['TrmH_dim']}}, 'G_to_m1G' : {'upstream_rxns' : ['G'], 'enzymes' : {745:['RrmA_dim_mod_2:zn2'], 37:['TrmD_dim']}}, 'G_to_preq1tRNA' : {'upstream_rxns' : ['G'], 'enzymes' : {34:['Tgt_hexa_mod_6:zn2']}}, 'preq1tRNA_to_oQtRNA' : {'upstream_rxns' : ['G_to_preq1tRNA'], 'enzymes' : {34:['QueA_mono']}}, 'oQtRNA_to_QtRNA' : {'upstream_rxns' : ['preq1tRNA_to_oQtRNA'], 'enzymes' : {34:['QueG_mono_mod_adocbl']}}, 'QtRNA_to_gluQtRNA' : {'upstream_rxns' : ['oQtRNA_to_QtRNA'], 'enzymes' : {34:['YadB_mono']}} }
uridine_mods_paths = {'U_to_DDusA': {'upstream_rxns': ['U'], 'enzymes': {20: ['DusA_mono'], '20A': ['DusA_mono'], 17: ['DusA_mono'], 16: ['DusA_mono']}}, 'U_to_DDusgen': {'upstream_rxns': ['U'], 'enzymes': {20: ['generic_Dus'], '20A': ['generic_Dus'], 17: ['generic_Dus'], 16: ['generic_Dus']}}, 'U_to_Um': {'upstream_rxns': ['U'], 'enzymes': {2552: ['RrmJ_mono'], 32: ['TrmJ_dim'], 34: ['trmL_dim']}}, 'U_to_Y': {'upstream_rxns': ['U'], 'enzymes': {32: ['RluA_mono'], 746: ['RluA_mono'], 2605: ['RluB_mono'], 2504: ['RluC_mono'], 2580: ['RluC_mono'], 995: ['RluC_mono'], 1915: ['RluD_mono_mod_1:mg2'], 1911: ['RluD_mono_mod_1:mg2'], 1917: ['RluD_mono_mod_1:mg2'], 2457: ['YmfC_mono'], 2604: ['YjbC_mono'], 13: ['TruD_mono'], 65: ['YqcB_mono'], 55: ['TruB_mono'], 38: ['TruA_dim'], 39: ['TruA_dim'], 40: ['TruA_dim'], 516: ['RsuA_mono']}}, 'U_to_acp3U': {'upstream_rxns': ['U'], 'enzymes': {47: ['enzyme_unknown']}}, 'U_to_cmnm5U': {'upstream_rxns': ['U'], 'enzymes': {34: ['MnmEG_cplx_mod_fad_mod_2:k']}}, 'U_to_ho5U': {'upstream_rxns': ['U'], 'enzymes': {34: ['enzyme_unknown2']}}, 'U_to_m3U': {'upstream_rxns': ['U'], 'enzymes': {1498: ['YggJ_dim']}}, 'U_to_m5U': {'upstream_rxns': ['U'], 'enzymes': {747: ['RumB_mono_mod_1:4fe4s'], 1939: ['RumA_mono_mod_1:4fe4s'], 54: ['TrmA_mono']}}, 'U_to_nm5U': {'upstream_rxns': ['U'], 'enzymes': {34: ['MnmEG_cplx_mod_fad_mod_2:k']}}, 'U_to_s2U': {'upstream_rxns': ['U'], 'enzymes': {34: ['TrmU_mono']}}, 'U_to_s4U': {'upstream_rxns': ['U'], 'enzymes': {8: ['ThiI_mono']}}, 'ho5U_to_mo5U': {'upstream_rxns': ['U_to_ho5U'], 'enzymes': {34: ['YecP_mono']}}, 's2U_to_nm5s2U': {'upstream_rxns': ['U_to_s2U'], 'enzymes': {34: ['MnmEG_cplx_mod_fad_mod_2:k']}}, 'cmnm5U_to_cmnm5s2U': {'upstream_rxns': ['U_to_cmnm5U'], 'enzymes': {34: ['TrmU_mono']}}, 's2U_to_ges2U': {'upstream_rxns': ['U_to_s2U'], 'enzymes': {34: ['YbbB_dim']}}, 's2U_to_se2U': {'upstream_rxns': ['U_to_s2U'], 'enzymes': {34: ['YbbB_dim']}}, 's2U_to_cmnm5s2U': {'upstream_rxns': ['U_to_s2U'], 'enzymes': {34: ['MnmEG_cplx_mod_fad_mod_2:k']}}, 'cmnm5s2U_to_cmnm5se2U': {'upstream_rxns': ['s2U_to_cmnm5s2U', 'cmnm5U_to_cmnm5s2U'], 'enzymes': {34: ['YbbB_dim']}}, 'mnm5s2U_to_mnm5ges2U': {'upstream_rxns': ['nm5s2U_to_mnm5s2U', 'mnm5U_to_mnm5s2U'], 'enzymes': {34: ['YbbB_dim']}}, 'cmnm5se2U_to_nm5se2U': {'upstream_rxns': ['se2U_to_cmnm5se2U', 'cmnm5s2U_to_cmnm5se2U'], 'enzymes': {34: ['MnmC_mono_mod_fad']}}, 'Y_to_m3Y': {'upstream_rxns': ['U_to_Y'], 'enzymes': {1915: ['RlmH_dim']}}, 'se2U_to_cmnm5se2U': {'upstream_rxns': ['s2U_to_se2U'], 'enzymes': {34: ['MnmEG_cplx_mod_fad_mod_2:k']}}, 'cmnm5s2U_to_nm5s2U': {'upstream_rxns': ['s2U_to_cmnm5s2U', 'cmnm5U_to_cmnm5s2U'], 'enzymes': {34: ['MnmC_mono_mod_fad']}}, 'nm5se2U_to_mnm5se2U': {'upstream_rxns': ['cmnm5se2U_to_nm5se2U', 'se2U_to_nm5se2U', 'nm5s2U_to_nm5se2U'], 'enzymes': {34: ['MnmC_mono_mod_fad']}}, 'mnm5s2U_to_mnm5se2U': {'upstream_rxns': ['nm5s2U_to_mnm5s2U', 'mnm5U_to_mnm5s2U'], 'enzymes': {34: ['YbbB_dim']}}, 'mnm5U_to_mnm5s2U': {'upstream_rxns': ['nm5U_to_mnm5U'], 'enzymes': {34: ['TrmU_mono']}}, 'nm5s2U_to_nm5se2U': {'upstream_rxns': ['s2U_to_nm5s2U', 'cmnm5s2U_to_nm5s2U'], 'enzymes': {34: ['YbbB_dim']}}, 'nm5s2U_to_mnm5s2U': {'upstream_rxns': ['s2U_to_nm5s2U', 'cmnm5s2U_to_nm5s2U'], 'enzymes': {34: ['MnmC_mono_mod_fad']}}, 'se2U_to_nm5se2U': {'upstream_rxns': ['s2U_to_se2U'], 'enzymes': {34: ['MnmEG_cplx_mod_fad_mod_2:k']}}, 'cmnm5U_to_nm5U': {'upstream_rxns': ['U_to_cmnm5U'], 'enzymes': {34: ['MnmC_mono_mod_fad']}}, 'cmnm5U_to_cmnm5Um': {'upstream_rxns': ['U_to_cmnm5U'], 'enzymes': {34: ['trmL_dim']}}, 'Um_to_cmnm5Um': {'upstream_rxns': ['U_to_Um'], 'enzymes': {34: ['MnmEG_cplx_mod_fad_mod_2:k']}}, 'nm5U_to_mnm5U': {'upstream_rxns': ['U_to_nm5U', 'cmnm5U_to_nm5U'], 'enzymes': {34: ['MnmC_mono_mod_fad']}}, 'ho5U_to_cmo5U': {'upstream_rxns': ['U_to_ho5U'], 'enzymes': {34: ['YecP_mono']}}} cytidine_mods_paths = {'C_to_s2C': {'upstream_rxns': ['C'], 'enzymes': {32: ['YdaO_mono']}}, 'C_to_m5C': {'upstream_rxns': ['C'], 'enzymes': {1962: ['RlmI_dim'], 967: ['RsmB_mono'], 1407: ['RsmF_mono']}}, 'C_to_Cm': {'upstream_rxns': ['C'], 'enzymes': {2498: ['RlmM_mono'], 1402: ['RsmI_mono'], 32: ['TrmJ_dim'], 34: ['trmL_dim']}}, 'C_to_ac4C': {'upstream_rxns': ['C'], 'enzymes': {34: ['TmcA_mono']}}, 'Cm_to_m4Cm': {'upstream_rxns': ['C_to_Cm'], 'enzymes': {1402: ['RsmH_mono']}}, 'm4Cm_to_m44Cm': {'upstream_rxns': ['Cm_to_m4Cm', 'm4C_to_m4Cm'], 'enzymes': {1402: ['RsmH_mono']}}, 'C_to_m4C': {'upstream_rxns': ['C'], 'enzymes': {1402: ['RsmH_mono']}}, 'm4C_to_m44C': {'upstream_rxns': ['C_to_m4C'], 'enzymes': {1402: ['RsmI_mono']}}, 'm4C_to_m4Cm': {'upstream_rxns': ['C_to_m4C'], 'enzymes': {1402: ['RsmH_mono']}}, 'C_to_k2C': {'upstream_rxns': ['C'], 'enzymes': {34: ['TilS_mono']}}} adenine_mods_paths = {'A_to_m2A': {'upstream_rxns': ['A'], 'enzymes': {37: ['RlmN_mono_mod_1:4fe4s'], 2503: ['RlmN_mono_mod_1:4fe4s']}}, 'A_to_m6A': {'upstream_rxns': ['A'], 'enzymes': {2058: ['enzyme_new_ErmBC'], 1618: ['RlmF_mono'], 2030: ['enzyme_new_RlmJ'], 1518: ['KsgA_mono'], 1519: ['KsgA_mono'], 37: ['YfiC_mono']}}, 'm6A_to_m66A': {'upstream_rxns': ['A_to_m6A'], 'enzymes': {1518: ['KsgA_mono'], 1519: ['KsgA_mono']}}, 'A_to_I': {'upstream_rxns': ['A'], 'enzymes': {34: ['TadA_dim_mod_2:zn2']}}, 'A_to_m1A': {'upstream_rxns': ['A'], 'enzymes': {1408: ['enzyme_new_NpmA']}}, 'A_to_i6A': {'upstream_rxns': ['A'], 'enzymes': {37: ['MiaA_dim_mod_2:mg2']}}, 'i6A_to_ms2i6A': {'upstream_rxns': ['A_to_i6A'], 'enzymes': {37: ['MiaB_mono_mod_1:4fe4s']}}, 'A_to_t6A': {'upstream_rxns': ['A'], 'enzymes': {37: ['TsaBCDE']}}, 't6A_to_m6t6A': {'upstream_rxns': ['A_to_t6A'], 'enzymes': {37: ['EG11503_MONOMER']}}, 't6A_to_ct6A': {'upstream_rxns': ['A_to_t6A'], 'enzymes': {37: ['TcdA_dim']}}} guanine_mods_paths = {'G_to_m7G': {'upstream_rxns': ['G'], 'enzymes': {2069: ['RlmL_dim'], 1405: ['enzyme_new_RmtB'], 527: ['RsmG_mono'], 46: ['YggH_mono']}}, 'G_to_m2G': {'upstream_rxns': ['G'], 'enzymes': {1835: ['RlmG_mono'], 2445: ['RlmL_dim'], 1207: ['RsmC_mono'], 966: ['RsmD_mono'], 1516: ['enzyme_new_RsmJ']}}, 'G_to_Gm': {'upstream_rxns': ['G'], 'enzymes': {2251: ['RlmB_dim'], 18: ['TrmH_dim']}}, 'G_to_m1G': {'upstream_rxns': ['G'], 'enzymes': {745: ['RrmA_dim_mod_2:zn2'], 37: ['TrmD_dim']}}, 'G_to_preq1tRNA': {'upstream_rxns': ['G'], 'enzymes': {34: ['Tgt_hexa_mod_6:zn2']}}, 'preq1tRNA_to_oQtRNA': {'upstream_rxns': ['G_to_preq1tRNA'], 'enzymes': {34: ['QueA_mono']}}, 'oQtRNA_to_QtRNA': {'upstream_rxns': ['preq1tRNA_to_oQtRNA'], 'enzymes': {34: ['QueG_mono_mod_adocbl']}}, 'QtRNA_to_gluQtRNA': {'upstream_rxns': ['oQtRNA_to_QtRNA'], 'enzymes': {34: ['YadB_mono']}}}
def run(): # Range can receive a first value that defines start value of range: range(1, 1000) for i in range(1000): print('Value ' + str(i)) if __name__ == '__main__': run()
def run(): for i in range(1000): print('Value ' + str(i)) if __name__ == '__main__': run()
def biggerIsGreater(w): w = list(w) x = len(w)-1 while x > 0 and w[x-1] >= w[x]: x -= 1 if x <= 0: return 'no answer' j = len(w) - 1 while w[j] <= w[x - 1]: j -= 1 w[x-1], w[j] = w[j], w[x-1] w[x:] = w[len(w)-1:x-1:-1] return ''.join(w)
def bigger_is_greater(w): w = list(w) x = len(w) - 1 while x > 0 and w[x - 1] >= w[x]: x -= 1 if x <= 0: return 'no answer' j = len(w) - 1 while w[j] <= w[x - 1]: j -= 1 (w[x - 1], w[j]) = (w[j], w[x - 1]) w[x:] = w[len(w) - 1:x - 1:-1] return ''.join(w)
# Add support for multiple event queues def upgrader(cpt): cpt.set('Globals', 'numMainEventQueues', '1') legacy_version = 12
def upgrader(cpt): cpt.set('Globals', 'numMainEventQueues', '1') legacy_version = 12
class Solution(object): def moveZeroes(self, nums): totalZeros = 0 for i in range(len(nums)): if nums[i] == 0 : totalZeros += 1 continue nums[i - totalZeros] = nums[i] if(totalZeros) : nums[i] = 0
class Solution(object): def move_zeroes(self, nums): total_zeros = 0 for i in range(len(nums)): if nums[i] == 0: total_zeros += 1 continue nums[i - totalZeros] = nums[i] if totalZeros: nums[i] = 0
# This file is created by generate_build_files.py. Do not edit manually. ssl_headers = [ "src/include/openssl/dtls1.h", "src/include/openssl/srtp.h", "src/include/openssl/ssl.h", "src/include/openssl/ssl3.h", "src/include/openssl/tls1.h", ] fips_fragments = [ "src/crypto/fipsmodule/aes/aes.c", "src/crypto/fipsmodule/aes/aes_nohw.c", "src/crypto/fipsmodule/aes/key_wrap.c", "src/crypto/fipsmodule/aes/mode_wrappers.c", "src/crypto/fipsmodule/bn/add.c", "src/crypto/fipsmodule/bn/asm/x86_64-gcc.c", "src/crypto/fipsmodule/bn/bn.c", "src/crypto/fipsmodule/bn/bytes.c", "src/crypto/fipsmodule/bn/cmp.c", "src/crypto/fipsmodule/bn/ctx.c", "src/crypto/fipsmodule/bn/div.c", "src/crypto/fipsmodule/bn/div_extra.c", "src/crypto/fipsmodule/bn/exponentiation.c", "src/crypto/fipsmodule/bn/gcd.c", "src/crypto/fipsmodule/bn/gcd_extra.c", "src/crypto/fipsmodule/bn/generic.c", "src/crypto/fipsmodule/bn/jacobi.c", "src/crypto/fipsmodule/bn/montgomery.c", "src/crypto/fipsmodule/bn/montgomery_inv.c", "src/crypto/fipsmodule/bn/mul.c", "src/crypto/fipsmodule/bn/prime.c", "src/crypto/fipsmodule/bn/random.c", "src/crypto/fipsmodule/bn/rsaz_exp.c", "src/crypto/fipsmodule/bn/shift.c", "src/crypto/fipsmodule/bn/sqrt.c", "src/crypto/fipsmodule/cipher/aead.c", "src/crypto/fipsmodule/cipher/cipher.c", "src/crypto/fipsmodule/cipher/e_aes.c", "src/crypto/fipsmodule/cipher/e_des.c", "src/crypto/fipsmodule/des/des.c", "src/crypto/fipsmodule/digest/digest.c", "src/crypto/fipsmodule/digest/digests.c", "src/crypto/fipsmodule/ec/ec.c", "src/crypto/fipsmodule/ec/ec_key.c", "src/crypto/fipsmodule/ec/ec_montgomery.c", "src/crypto/fipsmodule/ec/felem.c", "src/crypto/fipsmodule/ec/oct.c", "src/crypto/fipsmodule/ec/p224-64.c", "src/crypto/fipsmodule/ec/p256-x86_64.c", "src/crypto/fipsmodule/ec/scalar.c", "src/crypto/fipsmodule/ec/simple.c", "src/crypto/fipsmodule/ec/simple_mul.c", "src/crypto/fipsmodule/ec/util.c", "src/crypto/fipsmodule/ec/wnaf.c", "src/crypto/fipsmodule/ecdh/ecdh.c", "src/crypto/fipsmodule/ecdsa/ecdsa.c", "src/crypto/fipsmodule/hmac/hmac.c", "src/crypto/fipsmodule/md4/md4.c", "src/crypto/fipsmodule/md5/md5.c", "src/crypto/fipsmodule/modes/cbc.c", "src/crypto/fipsmodule/modes/cfb.c", "src/crypto/fipsmodule/modes/ctr.c", "src/crypto/fipsmodule/modes/gcm.c", "src/crypto/fipsmodule/modes/gcm_nohw.c", "src/crypto/fipsmodule/modes/ofb.c", "src/crypto/fipsmodule/modes/polyval.c", "src/crypto/fipsmodule/rand/ctrdrbg.c", "src/crypto/fipsmodule/rand/rand.c", "src/crypto/fipsmodule/rand/urandom.c", "src/crypto/fipsmodule/rsa/blinding.c", "src/crypto/fipsmodule/rsa/padding.c", "src/crypto/fipsmodule/rsa/rsa.c", "src/crypto/fipsmodule/rsa/rsa_impl.c", "src/crypto/fipsmodule/self_check/self_check.c", "src/crypto/fipsmodule/sha/sha1-altivec.c", "src/crypto/fipsmodule/sha/sha1.c", "src/crypto/fipsmodule/sha/sha256.c", "src/crypto/fipsmodule/sha/sha512.c", "src/crypto/fipsmodule/tls/kdf.c", "src/third_party/fiat/p256.c", ] ssl_internal_headers = [ "src/ssl/internal.h", ] ssl_sources = [ "src/ssl/bio_ssl.cc", "src/ssl/d1_both.cc", "src/ssl/d1_lib.cc", "src/ssl/d1_pkt.cc", "src/ssl/d1_srtp.cc", "src/ssl/dtls_method.cc", "src/ssl/dtls_record.cc", "src/ssl/handoff.cc", "src/ssl/handshake.cc", "src/ssl/handshake_client.cc", "src/ssl/handshake_server.cc", "src/ssl/s3_both.cc", "src/ssl/s3_lib.cc", "src/ssl/s3_pkt.cc", "src/ssl/ssl_aead_ctx.cc", "src/ssl/ssl_asn1.cc", "src/ssl/ssl_buffer.cc", "src/ssl/ssl_cert.cc", "src/ssl/ssl_cipher.cc", "src/ssl/ssl_file.cc", "src/ssl/ssl_key_share.cc", "src/ssl/ssl_lib.cc", "src/ssl/ssl_privkey.cc", "src/ssl/ssl_session.cc", "src/ssl/ssl_stat.cc", "src/ssl/ssl_transcript.cc", "src/ssl/ssl_versions.cc", "src/ssl/ssl_x509.cc", "src/ssl/t1_enc.cc", "src/ssl/t1_lib.cc", "src/ssl/tls13_both.cc", "src/ssl/tls13_client.cc", "src/ssl/tls13_enc.cc", "src/ssl/tls13_server.cc", "src/ssl/tls_method.cc", "src/ssl/tls_record.cc", ] crypto_headers = [ "src/include/openssl/aead.h", "src/include/openssl/aes.h", "src/include/openssl/arm_arch.h", "src/include/openssl/asn1.h", "src/include/openssl/asn1_mac.h", "src/include/openssl/asn1t.h", "src/include/openssl/base.h", "src/include/openssl/base64.h", "src/include/openssl/bio.h", "src/include/openssl/blowfish.h", "src/include/openssl/bn.h", "src/include/openssl/buf.h", "src/include/openssl/buffer.h", "src/include/openssl/bytestring.h", "src/include/openssl/cast.h", "src/include/openssl/chacha.h", "src/include/openssl/cipher.h", "src/include/openssl/cmac.h", "src/include/openssl/conf.h", "src/include/openssl/cpu.h", "src/include/openssl/crypto.h", "src/include/openssl/curve25519.h", "src/include/openssl/des.h", "src/include/openssl/dh.h", "src/include/openssl/digest.h", "src/include/openssl/dsa.h", "src/include/openssl/e_os2.h", "src/include/openssl/ec.h", "src/include/openssl/ec_key.h", "src/include/openssl/ecdh.h", "src/include/openssl/ecdsa.h", "src/include/openssl/engine.h", "src/include/openssl/err.h", "src/include/openssl/evp.h", "src/include/openssl/ex_data.h", "src/include/openssl/hkdf.h", "src/include/openssl/hmac.h", "src/include/openssl/hrss.h", "src/include/openssl/is_boringssl.h", "src/include/openssl/lhash.h", "src/include/openssl/md4.h", "src/include/openssl/md5.h", "src/include/openssl/mem.h", "src/include/openssl/nid.h", "src/include/openssl/obj.h", "src/include/openssl/obj_mac.h", "src/include/openssl/objects.h", "src/include/openssl/opensslconf.h", "src/include/openssl/opensslv.h", "src/include/openssl/ossl_typ.h", "src/include/openssl/pem.h", "src/include/openssl/pkcs12.h", "src/include/openssl/pkcs7.h", "src/include/openssl/pkcs8.h", "src/include/openssl/poly1305.h", "src/include/openssl/pool.h", "src/include/openssl/rand.h", "src/include/openssl/rc4.h", "src/include/openssl/ripemd.h", "src/include/openssl/rsa.h", "src/include/openssl/safestack.h", "src/include/openssl/sha.h", "src/include/openssl/siphash.h", "src/include/openssl/span.h", "src/include/openssl/stack.h", "src/include/openssl/thread.h", "src/include/openssl/type_check.h", "src/include/openssl/x509.h", "src/include/openssl/x509_vfy.h", "src/include/openssl/x509v3.h", ] crypto_internal_headers = [ "src/crypto/asn1/asn1_locl.h", "src/crypto/bio/internal.h", "src/crypto/bytestring/internal.h", "src/crypto/chacha/internal.h", "src/crypto/cipher_extra/internal.h", "src/crypto/conf/conf_def.h", "src/crypto/conf/internal.h", "src/crypto/cpu-arm-linux.h", "src/crypto/err/internal.h", "src/crypto/evp/internal.h", "src/crypto/fipsmodule/aes/internal.h", "src/crypto/fipsmodule/bn/internal.h", "src/crypto/fipsmodule/bn/rsaz_exp.h", "src/crypto/fipsmodule/cipher/internal.h", "src/crypto/fipsmodule/delocate.h", "src/crypto/fipsmodule/des/internal.h", "src/crypto/fipsmodule/digest/internal.h", "src/crypto/fipsmodule/digest/md32_common.h", "src/crypto/fipsmodule/ec/internal.h", "src/crypto/fipsmodule/ec/p256-x86_64-table.h", "src/crypto/fipsmodule/ec/p256-x86_64.h", "src/crypto/fipsmodule/md5/internal.h", "src/crypto/fipsmodule/modes/internal.h", "src/crypto/fipsmodule/rand/internal.h", "src/crypto/fipsmodule/rsa/internal.h", "src/crypto/fipsmodule/sha/internal.h", "src/crypto/fipsmodule/tls/internal.h", "src/crypto/hrss/internal.h", "src/crypto/internal.h", "src/crypto/obj/obj_dat.h", "src/crypto/pkcs7/internal.h", "src/crypto/pkcs8/internal.h", "src/crypto/poly1305/internal.h", "src/crypto/pool/internal.h", "src/crypto/x509/charmap.h", "src/crypto/x509/internal.h", "src/crypto/x509/vpm_int.h", "src/crypto/x509v3/ext_dat.h", "src/crypto/x509v3/internal.h", "src/crypto/x509v3/pcy_int.h", "src/third_party/fiat/curve25519_32.h", "src/third_party/fiat/curve25519_64.h", "src/third_party/fiat/curve25519_tables.h", "src/third_party/fiat/internal.h", "src/third_party/fiat/p256_32.h", "src/third_party/fiat/p256_64.h", ] crypto_sources = [ "err_data.c", "src/crypto/asn1/a_bitstr.c", "src/crypto/asn1/a_bool.c", "src/crypto/asn1/a_d2i_fp.c", "src/crypto/asn1/a_dup.c", "src/crypto/asn1/a_enum.c", "src/crypto/asn1/a_gentm.c", "src/crypto/asn1/a_i2d_fp.c", "src/crypto/asn1/a_int.c", "src/crypto/asn1/a_mbstr.c", "src/crypto/asn1/a_object.c", "src/crypto/asn1/a_octet.c", "src/crypto/asn1/a_print.c", "src/crypto/asn1/a_strnid.c", "src/crypto/asn1/a_time.c", "src/crypto/asn1/a_type.c", "src/crypto/asn1/a_utctm.c", "src/crypto/asn1/a_utf8.c", "src/crypto/asn1/asn1_lib.c", "src/crypto/asn1/asn1_par.c", "src/crypto/asn1/asn_pack.c", "src/crypto/asn1/f_enum.c", "src/crypto/asn1/f_int.c", "src/crypto/asn1/f_string.c", "src/crypto/asn1/tasn_dec.c", "src/crypto/asn1/tasn_enc.c", "src/crypto/asn1/tasn_fre.c", "src/crypto/asn1/tasn_new.c", "src/crypto/asn1/tasn_typ.c", "src/crypto/asn1/tasn_utl.c", "src/crypto/asn1/time_support.c", "src/crypto/base64/base64.c", "src/crypto/bio/bio.c", "src/crypto/bio/bio_mem.c", "src/crypto/bio/connect.c", "src/crypto/bio/fd.c", "src/crypto/bio/file.c", "src/crypto/bio/hexdump.c", "src/crypto/bio/pair.c", "src/crypto/bio/printf.c", "src/crypto/bio/socket.c", "src/crypto/bio/socket_helper.c", "src/crypto/bn_extra/bn_asn1.c", "src/crypto/bn_extra/convert.c", "src/crypto/buf/buf.c", "src/crypto/bytestring/asn1_compat.c", "src/crypto/bytestring/ber.c", "src/crypto/bytestring/cbb.c", "src/crypto/bytestring/cbs.c", "src/crypto/bytestring/unicode.c", "src/crypto/chacha/chacha.c", "src/crypto/cipher_extra/cipher_extra.c", "src/crypto/cipher_extra/derive_key.c", "src/crypto/cipher_extra/e_aesccm.c", "src/crypto/cipher_extra/e_aesctrhmac.c", "src/crypto/cipher_extra/e_aesgcmsiv.c", "src/crypto/cipher_extra/e_chacha20poly1305.c", "src/crypto/cipher_extra/e_null.c", "src/crypto/cipher_extra/e_rc2.c", "src/crypto/cipher_extra/e_rc4.c", "src/crypto/cipher_extra/e_tls.c", "src/crypto/cipher_extra/tls_cbc.c", "src/crypto/cmac/cmac.c", "src/crypto/conf/conf.c", "src/crypto/cpu-aarch64-fuchsia.c", "src/crypto/cpu-aarch64-linux.c", "src/crypto/cpu-arm-linux.c", "src/crypto/cpu-arm.c", "src/crypto/cpu-intel.c", "src/crypto/cpu-ppc64le.c", "src/crypto/crypto.c", "src/crypto/curve25519/spake25519.c", "src/crypto/dh/check.c", "src/crypto/dh/dh.c", "src/crypto/dh/dh_asn1.c", "src/crypto/dh/params.c", "src/crypto/digest_extra/digest_extra.c", "src/crypto/dsa/dsa.c", "src/crypto/dsa/dsa_asn1.c", "src/crypto/ec_extra/ec_asn1.c", "src/crypto/ec_extra/ec_derive.c", "src/crypto/ecdh_extra/ecdh_extra.c", "src/crypto/ecdsa_extra/ecdsa_asn1.c", "src/crypto/engine/engine.c", "src/crypto/err/err.c", "src/crypto/evp/digestsign.c", "src/crypto/evp/evp.c", "src/crypto/evp/evp_asn1.c", "src/crypto/evp/evp_ctx.c", "src/crypto/evp/p_dsa_asn1.c", "src/crypto/evp/p_ec.c", "src/crypto/evp/p_ec_asn1.c", "src/crypto/evp/p_ed25519.c", "src/crypto/evp/p_ed25519_asn1.c", "src/crypto/evp/p_rsa.c", "src/crypto/evp/p_rsa_asn1.c", "src/crypto/evp/p_x25519.c", "src/crypto/evp/p_x25519_asn1.c", "src/crypto/evp/pbkdf.c", "src/crypto/evp/print.c", "src/crypto/evp/scrypt.c", "src/crypto/evp/sign.c", "src/crypto/ex_data.c", "src/crypto/fipsmodule/bcm.c", "src/crypto/fipsmodule/fips_shared_support.c", "src/crypto/fipsmodule/is_fips.c", "src/crypto/hkdf/hkdf.c", "src/crypto/hrss/hrss.c", "src/crypto/lhash/lhash.c", "src/crypto/mem.c", "src/crypto/obj/obj.c", "src/crypto/obj/obj_xref.c", "src/crypto/pem/pem_all.c", "src/crypto/pem/pem_info.c", "src/crypto/pem/pem_lib.c", "src/crypto/pem/pem_oth.c", "src/crypto/pem/pem_pk8.c", "src/crypto/pem/pem_pkey.c", "src/crypto/pem/pem_x509.c", "src/crypto/pem/pem_xaux.c", "src/crypto/pkcs7/pkcs7.c", "src/crypto/pkcs7/pkcs7_x509.c", "src/crypto/pkcs8/p5_pbev2.c", "src/crypto/pkcs8/pkcs8.c", "src/crypto/pkcs8/pkcs8_x509.c", "src/crypto/poly1305/poly1305.c", "src/crypto/poly1305/poly1305_arm.c", "src/crypto/poly1305/poly1305_vec.c", "src/crypto/pool/pool.c", "src/crypto/rand_extra/deterministic.c", "src/crypto/rand_extra/forkunsafe.c", "src/crypto/rand_extra/fuchsia.c", "src/crypto/rand_extra/rand_extra.c", "src/crypto/rand_extra/windows.c", "src/crypto/rc4/rc4.c", "src/crypto/refcount_c11.c", "src/crypto/refcount_lock.c", "src/crypto/rsa_extra/rsa_asn1.c", "src/crypto/rsa_extra/rsa_print.c", "src/crypto/siphash/siphash.c", "src/crypto/stack/stack.c", "src/crypto/thread.c", "src/crypto/thread_none.c", "src/crypto/thread_pthread.c", "src/crypto/thread_win.c", "src/crypto/x509/a_digest.c", "src/crypto/x509/a_sign.c", "src/crypto/x509/a_strex.c", "src/crypto/x509/a_verify.c", "src/crypto/x509/algorithm.c", "src/crypto/x509/asn1_gen.c", "src/crypto/x509/by_dir.c", "src/crypto/x509/by_file.c", "src/crypto/x509/i2d_pr.c", "src/crypto/x509/rsa_pss.c", "src/crypto/x509/t_crl.c", "src/crypto/x509/t_req.c", "src/crypto/x509/t_x509.c", "src/crypto/x509/t_x509a.c", "src/crypto/x509/x509.c", "src/crypto/x509/x509_att.c", "src/crypto/x509/x509_cmp.c", "src/crypto/x509/x509_d2.c", "src/crypto/x509/x509_def.c", "src/crypto/x509/x509_ext.c", "src/crypto/x509/x509_lu.c", "src/crypto/x509/x509_obj.c", "src/crypto/x509/x509_r2x.c", "src/crypto/x509/x509_req.c", "src/crypto/x509/x509_set.c", "src/crypto/x509/x509_trs.c", "src/crypto/x509/x509_txt.c", "src/crypto/x509/x509_v3.c", "src/crypto/x509/x509_vfy.c", "src/crypto/x509/x509_vpm.c", "src/crypto/x509/x509cset.c", "src/crypto/x509/x509name.c", "src/crypto/x509/x509rset.c", "src/crypto/x509/x509spki.c", "src/crypto/x509/x_algor.c", "src/crypto/x509/x_all.c", "src/crypto/x509/x_attrib.c", "src/crypto/x509/x_crl.c", "src/crypto/x509/x_exten.c", "src/crypto/x509/x_info.c", "src/crypto/x509/x_name.c", "src/crypto/x509/x_pkey.c", "src/crypto/x509/x_pubkey.c", "src/crypto/x509/x_req.c", "src/crypto/x509/x_sig.c", "src/crypto/x509/x_spki.c", "src/crypto/x509/x_val.c", "src/crypto/x509/x_x509.c", "src/crypto/x509/x_x509a.c", "src/crypto/x509v3/pcy_cache.c", "src/crypto/x509v3/pcy_data.c", "src/crypto/x509v3/pcy_lib.c", "src/crypto/x509v3/pcy_map.c", "src/crypto/x509v3/pcy_node.c", "src/crypto/x509v3/pcy_tree.c", "src/crypto/x509v3/v3_akey.c", "src/crypto/x509v3/v3_akeya.c", "src/crypto/x509v3/v3_alt.c", "src/crypto/x509v3/v3_bcons.c", "src/crypto/x509v3/v3_bitst.c", "src/crypto/x509v3/v3_conf.c", "src/crypto/x509v3/v3_cpols.c", "src/crypto/x509v3/v3_crld.c", "src/crypto/x509v3/v3_enum.c", "src/crypto/x509v3/v3_extku.c", "src/crypto/x509v3/v3_genn.c", "src/crypto/x509v3/v3_ia5.c", "src/crypto/x509v3/v3_info.c", "src/crypto/x509v3/v3_int.c", "src/crypto/x509v3/v3_lib.c", "src/crypto/x509v3/v3_ncons.c", "src/crypto/x509v3/v3_ocsp.c", "src/crypto/x509v3/v3_pci.c", "src/crypto/x509v3/v3_pcia.c", "src/crypto/x509v3/v3_pcons.c", "src/crypto/x509v3/v3_pku.c", "src/crypto/x509v3/v3_pmaps.c", "src/crypto/x509v3/v3_prn.c", "src/crypto/x509v3/v3_purp.c", "src/crypto/x509v3/v3_skey.c", "src/crypto/x509v3/v3_sxnet.c", "src/crypto/x509v3/v3_utl.c", "src/third_party/fiat/curve25519.c", ] tool_sources = [ "src/tool/args.cc", "src/tool/ciphers.cc", "src/tool/client.cc", "src/tool/const.cc", "src/tool/digest.cc", "src/tool/file.cc", "src/tool/generate_ed25519.cc", "src/tool/genrsa.cc", "src/tool/pkcs12.cc", "src/tool/rand.cc", "src/tool/server.cc", "src/tool/sign.cc", "src/tool/speed.cc", "src/tool/tool.cc", "src/tool/transport_common.cc", ] tool_headers = [ "src/tool/internal.h", "src/tool/transport_common.h", ] crypto_sources_ios_aarch64 = [ "ios-aarch64/crypto/chacha/chacha-armv8.S", "ios-aarch64/crypto/fipsmodule/aesv8-armx64.S", "ios-aarch64/crypto/fipsmodule/armv8-mont.S", "ios-aarch64/crypto/fipsmodule/ghash-neon-armv8.S", "ios-aarch64/crypto/fipsmodule/ghashv8-armx64.S", "ios-aarch64/crypto/fipsmodule/sha1-armv8.S", "ios-aarch64/crypto/fipsmodule/sha256-armv8.S", "ios-aarch64/crypto/fipsmodule/sha512-armv8.S", "ios-aarch64/crypto/fipsmodule/vpaes-armv8.S", "ios-aarch64/crypto/test/trampoline-armv8.S", ] crypto_sources_ios_arm = [ "ios-arm/crypto/chacha/chacha-armv4.S", "ios-arm/crypto/fipsmodule/aesv8-armx32.S", "ios-arm/crypto/fipsmodule/armv4-mont.S", "ios-arm/crypto/fipsmodule/bsaes-armv7.S", "ios-arm/crypto/fipsmodule/ghash-armv4.S", "ios-arm/crypto/fipsmodule/ghashv8-armx32.S", "ios-arm/crypto/fipsmodule/sha1-armv4-large.S", "ios-arm/crypto/fipsmodule/sha256-armv4.S", "ios-arm/crypto/fipsmodule/sha512-armv4.S", "ios-arm/crypto/fipsmodule/vpaes-armv7.S", "ios-arm/crypto/test/trampoline-armv4.S", ] crypto_sources_linux_aarch64 = [ "linux-aarch64/crypto/chacha/chacha-armv8.S", "linux-aarch64/crypto/fipsmodule/aesv8-armx64.S", "linux-aarch64/crypto/fipsmodule/armv8-mont.S", "linux-aarch64/crypto/fipsmodule/ghash-neon-armv8.S", "linux-aarch64/crypto/fipsmodule/ghashv8-armx64.S", "linux-aarch64/crypto/fipsmodule/sha1-armv8.S", "linux-aarch64/crypto/fipsmodule/sha256-armv8.S", "linux-aarch64/crypto/fipsmodule/sha512-armv8.S", "linux-aarch64/crypto/fipsmodule/vpaes-armv8.S", "linux-aarch64/crypto/test/trampoline-armv8.S", ] crypto_sources_linux_arm = [ "linux-arm/crypto/chacha/chacha-armv4.S", "linux-arm/crypto/fipsmodule/aesv8-armx32.S", "linux-arm/crypto/fipsmodule/armv4-mont.S", "linux-arm/crypto/fipsmodule/bsaes-armv7.S", "linux-arm/crypto/fipsmodule/ghash-armv4.S", "linux-arm/crypto/fipsmodule/ghashv8-armx32.S", "linux-arm/crypto/fipsmodule/sha1-armv4-large.S", "linux-arm/crypto/fipsmodule/sha256-armv4.S", "linux-arm/crypto/fipsmodule/sha512-armv4.S", "linux-arm/crypto/fipsmodule/vpaes-armv7.S", "linux-arm/crypto/test/trampoline-armv4.S", "src/crypto/curve25519/asm/x25519-asm-arm.S", "src/crypto/poly1305/poly1305_arm_asm.S", ] crypto_sources_linux_ppc64le = [ "linux-ppc64le/crypto/fipsmodule/aesp8-ppc.S", "linux-ppc64le/crypto/fipsmodule/ghashp8-ppc.S", "linux-ppc64le/crypto/test/trampoline-ppc.S", ] crypto_sources_linux_x86 = [ "linux-x86/crypto/chacha/chacha-x86.S", "linux-x86/crypto/fipsmodule/aesni-x86.S", "linux-x86/crypto/fipsmodule/bn-586.S", "linux-x86/crypto/fipsmodule/co-586.S", "linux-x86/crypto/fipsmodule/ghash-ssse3-x86.S", "linux-x86/crypto/fipsmodule/ghash-x86.S", "linux-x86/crypto/fipsmodule/md5-586.S", "linux-x86/crypto/fipsmodule/sha1-586.S", "linux-x86/crypto/fipsmodule/sha256-586.S", "linux-x86/crypto/fipsmodule/sha512-586.S", "linux-x86/crypto/fipsmodule/vpaes-x86.S", "linux-x86/crypto/fipsmodule/x86-mont.S", "linux-x86/crypto/test/trampoline-x86.S", ] crypto_sources_linux_x86_64 = [ "linux-x86_64/crypto/chacha/chacha-x86_64.S", "linux-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.S", "linux-x86_64/crypto/cipher_extra/chacha20_poly1305_x86_64.S", "linux-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.S", "linux-x86_64/crypto/fipsmodule/aesni-x86_64.S", "linux-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.S", "linux-x86_64/crypto/fipsmodule/ghash-x86_64.S", "linux-x86_64/crypto/fipsmodule/md5-x86_64.S", "linux-x86_64/crypto/fipsmodule/p256-x86_64-asm.S", "linux-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.S", "linux-x86_64/crypto/fipsmodule/rdrand-x86_64.S", "linux-x86_64/crypto/fipsmodule/rsaz-avx2.S", "linux-x86_64/crypto/fipsmodule/sha1-x86_64.S", "linux-x86_64/crypto/fipsmodule/sha256-x86_64.S", "linux-x86_64/crypto/fipsmodule/sha512-x86_64.S", "linux-x86_64/crypto/fipsmodule/vpaes-x86_64.S", "linux-x86_64/crypto/fipsmodule/x86_64-mont.S", "linux-x86_64/crypto/fipsmodule/x86_64-mont5.S", "linux-x86_64/crypto/test/trampoline-x86_64.S", "src/crypto/hrss/asm/poly_rq_mul.S", ] crypto_sources_mac_x86 = [ "mac-x86/crypto/chacha/chacha-x86.S", "mac-x86/crypto/fipsmodule/aesni-x86.S", "mac-x86/crypto/fipsmodule/bn-586.S", "mac-x86/crypto/fipsmodule/co-586.S", "mac-x86/crypto/fipsmodule/ghash-ssse3-x86.S", "mac-x86/crypto/fipsmodule/ghash-x86.S", "mac-x86/crypto/fipsmodule/md5-586.S", "mac-x86/crypto/fipsmodule/sha1-586.S", "mac-x86/crypto/fipsmodule/sha256-586.S", "mac-x86/crypto/fipsmodule/sha512-586.S", "mac-x86/crypto/fipsmodule/vpaes-x86.S", "mac-x86/crypto/fipsmodule/x86-mont.S", "mac-x86/crypto/test/trampoline-x86.S", ] crypto_sources_mac_x86_64 = [ "mac-x86_64/crypto/chacha/chacha-x86_64.S", "mac-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.S", "mac-x86_64/crypto/cipher_extra/chacha20_poly1305_x86_64.S", "mac-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.S", "mac-x86_64/crypto/fipsmodule/aesni-x86_64.S", "mac-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.S", "mac-x86_64/crypto/fipsmodule/ghash-x86_64.S", "mac-x86_64/crypto/fipsmodule/md5-x86_64.S", "mac-x86_64/crypto/fipsmodule/p256-x86_64-asm.S", "mac-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.S", "mac-x86_64/crypto/fipsmodule/rdrand-x86_64.S", "mac-x86_64/crypto/fipsmodule/rsaz-avx2.S", "mac-x86_64/crypto/fipsmodule/sha1-x86_64.S", "mac-x86_64/crypto/fipsmodule/sha256-x86_64.S", "mac-x86_64/crypto/fipsmodule/sha512-x86_64.S", "mac-x86_64/crypto/fipsmodule/vpaes-x86_64.S", "mac-x86_64/crypto/fipsmodule/x86_64-mont.S", "mac-x86_64/crypto/fipsmodule/x86_64-mont5.S", "mac-x86_64/crypto/test/trampoline-x86_64.S", ] crypto_sources_win_x86 = [ "win-x86/crypto/chacha/chacha-x86.asm", "win-x86/crypto/fipsmodule/aesni-x86.asm", "win-x86/crypto/fipsmodule/bn-586.asm", "win-x86/crypto/fipsmodule/co-586.asm", "win-x86/crypto/fipsmodule/ghash-ssse3-x86.asm", "win-x86/crypto/fipsmodule/ghash-x86.asm", "win-x86/crypto/fipsmodule/md5-586.asm", "win-x86/crypto/fipsmodule/sha1-586.asm", "win-x86/crypto/fipsmodule/sha256-586.asm", "win-x86/crypto/fipsmodule/sha512-586.asm", "win-x86/crypto/fipsmodule/vpaes-x86.asm", "win-x86/crypto/fipsmodule/x86-mont.asm", "win-x86/crypto/test/trampoline-x86.asm", ] crypto_sources_win_x86_64 = [ "win-x86_64/crypto/chacha/chacha-x86_64.asm", "win-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.asm", "win-x86_64/crypto/cipher_extra/chacha20_poly1305_x86_64.asm", "win-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.asm", "win-x86_64/crypto/fipsmodule/aesni-x86_64.asm", "win-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.asm", "win-x86_64/crypto/fipsmodule/ghash-x86_64.asm", "win-x86_64/crypto/fipsmodule/md5-x86_64.asm", "win-x86_64/crypto/fipsmodule/p256-x86_64-asm.asm", "win-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.asm", "win-x86_64/crypto/fipsmodule/rdrand-x86_64.asm", "win-x86_64/crypto/fipsmodule/rsaz-avx2.asm", "win-x86_64/crypto/fipsmodule/sha1-x86_64.asm", "win-x86_64/crypto/fipsmodule/sha256-x86_64.asm", "win-x86_64/crypto/fipsmodule/sha512-x86_64.asm", "win-x86_64/crypto/fipsmodule/vpaes-x86_64.asm", "win-x86_64/crypto/fipsmodule/x86_64-mont.asm", "win-x86_64/crypto/fipsmodule/x86_64-mont5.asm", "win-x86_64/crypto/test/trampoline-x86_64.asm", ]
ssl_headers = ['src/include/openssl/dtls1.h', 'src/include/openssl/srtp.h', 'src/include/openssl/ssl.h', 'src/include/openssl/ssl3.h', 'src/include/openssl/tls1.h'] fips_fragments = ['src/crypto/fipsmodule/aes/aes.c', 'src/crypto/fipsmodule/aes/aes_nohw.c', 'src/crypto/fipsmodule/aes/key_wrap.c', 'src/crypto/fipsmodule/aes/mode_wrappers.c', 'src/crypto/fipsmodule/bn/add.c', 'src/crypto/fipsmodule/bn/asm/x86_64-gcc.c', 'src/crypto/fipsmodule/bn/bn.c', 'src/crypto/fipsmodule/bn/bytes.c', 'src/crypto/fipsmodule/bn/cmp.c', 'src/crypto/fipsmodule/bn/ctx.c', 'src/crypto/fipsmodule/bn/div.c', 'src/crypto/fipsmodule/bn/div_extra.c', 'src/crypto/fipsmodule/bn/exponentiation.c', 'src/crypto/fipsmodule/bn/gcd.c', 'src/crypto/fipsmodule/bn/gcd_extra.c', 'src/crypto/fipsmodule/bn/generic.c', 'src/crypto/fipsmodule/bn/jacobi.c', 'src/crypto/fipsmodule/bn/montgomery.c', 'src/crypto/fipsmodule/bn/montgomery_inv.c', 'src/crypto/fipsmodule/bn/mul.c', 'src/crypto/fipsmodule/bn/prime.c', 'src/crypto/fipsmodule/bn/random.c', 'src/crypto/fipsmodule/bn/rsaz_exp.c', 'src/crypto/fipsmodule/bn/shift.c', 'src/crypto/fipsmodule/bn/sqrt.c', 'src/crypto/fipsmodule/cipher/aead.c', 'src/crypto/fipsmodule/cipher/cipher.c', 'src/crypto/fipsmodule/cipher/e_aes.c', 'src/crypto/fipsmodule/cipher/e_des.c', 'src/crypto/fipsmodule/des/des.c', 'src/crypto/fipsmodule/digest/digest.c', 'src/crypto/fipsmodule/digest/digests.c', 'src/crypto/fipsmodule/ec/ec.c', 'src/crypto/fipsmodule/ec/ec_key.c', 'src/crypto/fipsmodule/ec/ec_montgomery.c', 'src/crypto/fipsmodule/ec/felem.c', 'src/crypto/fipsmodule/ec/oct.c', 'src/crypto/fipsmodule/ec/p224-64.c', 'src/crypto/fipsmodule/ec/p256-x86_64.c', 'src/crypto/fipsmodule/ec/scalar.c', 'src/crypto/fipsmodule/ec/simple.c', 'src/crypto/fipsmodule/ec/simple_mul.c', 'src/crypto/fipsmodule/ec/util.c', 'src/crypto/fipsmodule/ec/wnaf.c', 'src/crypto/fipsmodule/ecdh/ecdh.c', 'src/crypto/fipsmodule/ecdsa/ecdsa.c', 'src/crypto/fipsmodule/hmac/hmac.c', 'src/crypto/fipsmodule/md4/md4.c', 'src/crypto/fipsmodule/md5/md5.c', 'src/crypto/fipsmodule/modes/cbc.c', 'src/crypto/fipsmodule/modes/cfb.c', 'src/crypto/fipsmodule/modes/ctr.c', 'src/crypto/fipsmodule/modes/gcm.c', 'src/crypto/fipsmodule/modes/gcm_nohw.c', 'src/crypto/fipsmodule/modes/ofb.c', 'src/crypto/fipsmodule/modes/polyval.c', 'src/crypto/fipsmodule/rand/ctrdrbg.c', 'src/crypto/fipsmodule/rand/rand.c', 'src/crypto/fipsmodule/rand/urandom.c', 'src/crypto/fipsmodule/rsa/blinding.c', 'src/crypto/fipsmodule/rsa/padding.c', 'src/crypto/fipsmodule/rsa/rsa.c', 'src/crypto/fipsmodule/rsa/rsa_impl.c', 'src/crypto/fipsmodule/self_check/self_check.c', 'src/crypto/fipsmodule/sha/sha1-altivec.c', 'src/crypto/fipsmodule/sha/sha1.c', 'src/crypto/fipsmodule/sha/sha256.c', 'src/crypto/fipsmodule/sha/sha512.c', 'src/crypto/fipsmodule/tls/kdf.c', 'src/third_party/fiat/p256.c'] ssl_internal_headers = ['src/ssl/internal.h'] ssl_sources = ['src/ssl/bio_ssl.cc', 'src/ssl/d1_both.cc', 'src/ssl/d1_lib.cc', 'src/ssl/d1_pkt.cc', 'src/ssl/d1_srtp.cc', 'src/ssl/dtls_method.cc', 'src/ssl/dtls_record.cc', 'src/ssl/handoff.cc', 'src/ssl/handshake.cc', 'src/ssl/handshake_client.cc', 'src/ssl/handshake_server.cc', 'src/ssl/s3_both.cc', 'src/ssl/s3_lib.cc', 'src/ssl/s3_pkt.cc', 'src/ssl/ssl_aead_ctx.cc', 'src/ssl/ssl_asn1.cc', 'src/ssl/ssl_buffer.cc', 'src/ssl/ssl_cert.cc', 'src/ssl/ssl_cipher.cc', 'src/ssl/ssl_file.cc', 'src/ssl/ssl_key_share.cc', 'src/ssl/ssl_lib.cc', 'src/ssl/ssl_privkey.cc', 'src/ssl/ssl_session.cc', 'src/ssl/ssl_stat.cc', 'src/ssl/ssl_transcript.cc', 'src/ssl/ssl_versions.cc', 'src/ssl/ssl_x509.cc', 'src/ssl/t1_enc.cc', 'src/ssl/t1_lib.cc', 'src/ssl/tls13_both.cc', 'src/ssl/tls13_client.cc', 'src/ssl/tls13_enc.cc', 'src/ssl/tls13_server.cc', 'src/ssl/tls_method.cc', 'src/ssl/tls_record.cc'] crypto_headers = ['src/include/openssl/aead.h', 'src/include/openssl/aes.h', 'src/include/openssl/arm_arch.h', 'src/include/openssl/asn1.h', 'src/include/openssl/asn1_mac.h', 'src/include/openssl/asn1t.h', 'src/include/openssl/base.h', 'src/include/openssl/base64.h', 'src/include/openssl/bio.h', 'src/include/openssl/blowfish.h', 'src/include/openssl/bn.h', 'src/include/openssl/buf.h', 'src/include/openssl/buffer.h', 'src/include/openssl/bytestring.h', 'src/include/openssl/cast.h', 'src/include/openssl/chacha.h', 'src/include/openssl/cipher.h', 'src/include/openssl/cmac.h', 'src/include/openssl/conf.h', 'src/include/openssl/cpu.h', 'src/include/openssl/crypto.h', 'src/include/openssl/curve25519.h', 'src/include/openssl/des.h', 'src/include/openssl/dh.h', 'src/include/openssl/digest.h', 'src/include/openssl/dsa.h', 'src/include/openssl/e_os2.h', 'src/include/openssl/ec.h', 'src/include/openssl/ec_key.h', 'src/include/openssl/ecdh.h', 'src/include/openssl/ecdsa.h', 'src/include/openssl/engine.h', 'src/include/openssl/err.h', 'src/include/openssl/evp.h', 'src/include/openssl/ex_data.h', 'src/include/openssl/hkdf.h', 'src/include/openssl/hmac.h', 'src/include/openssl/hrss.h', 'src/include/openssl/is_boringssl.h', 'src/include/openssl/lhash.h', 'src/include/openssl/md4.h', 'src/include/openssl/md5.h', 'src/include/openssl/mem.h', 'src/include/openssl/nid.h', 'src/include/openssl/obj.h', 'src/include/openssl/obj_mac.h', 'src/include/openssl/objects.h', 'src/include/openssl/opensslconf.h', 'src/include/openssl/opensslv.h', 'src/include/openssl/ossl_typ.h', 'src/include/openssl/pem.h', 'src/include/openssl/pkcs12.h', 'src/include/openssl/pkcs7.h', 'src/include/openssl/pkcs8.h', 'src/include/openssl/poly1305.h', 'src/include/openssl/pool.h', 'src/include/openssl/rand.h', 'src/include/openssl/rc4.h', 'src/include/openssl/ripemd.h', 'src/include/openssl/rsa.h', 'src/include/openssl/safestack.h', 'src/include/openssl/sha.h', 'src/include/openssl/siphash.h', 'src/include/openssl/span.h', 'src/include/openssl/stack.h', 'src/include/openssl/thread.h', 'src/include/openssl/type_check.h', 'src/include/openssl/x509.h', 'src/include/openssl/x509_vfy.h', 'src/include/openssl/x509v3.h'] crypto_internal_headers = ['src/crypto/asn1/asn1_locl.h', 'src/crypto/bio/internal.h', 'src/crypto/bytestring/internal.h', 'src/crypto/chacha/internal.h', 'src/crypto/cipher_extra/internal.h', 'src/crypto/conf/conf_def.h', 'src/crypto/conf/internal.h', 'src/crypto/cpu-arm-linux.h', 'src/crypto/err/internal.h', 'src/crypto/evp/internal.h', 'src/crypto/fipsmodule/aes/internal.h', 'src/crypto/fipsmodule/bn/internal.h', 'src/crypto/fipsmodule/bn/rsaz_exp.h', 'src/crypto/fipsmodule/cipher/internal.h', 'src/crypto/fipsmodule/delocate.h', 'src/crypto/fipsmodule/des/internal.h', 'src/crypto/fipsmodule/digest/internal.h', 'src/crypto/fipsmodule/digest/md32_common.h', 'src/crypto/fipsmodule/ec/internal.h', 'src/crypto/fipsmodule/ec/p256-x86_64-table.h', 'src/crypto/fipsmodule/ec/p256-x86_64.h', 'src/crypto/fipsmodule/md5/internal.h', 'src/crypto/fipsmodule/modes/internal.h', 'src/crypto/fipsmodule/rand/internal.h', 'src/crypto/fipsmodule/rsa/internal.h', 'src/crypto/fipsmodule/sha/internal.h', 'src/crypto/fipsmodule/tls/internal.h', 'src/crypto/hrss/internal.h', 'src/crypto/internal.h', 'src/crypto/obj/obj_dat.h', 'src/crypto/pkcs7/internal.h', 'src/crypto/pkcs8/internal.h', 'src/crypto/poly1305/internal.h', 'src/crypto/pool/internal.h', 'src/crypto/x509/charmap.h', 'src/crypto/x509/internal.h', 'src/crypto/x509/vpm_int.h', 'src/crypto/x509v3/ext_dat.h', 'src/crypto/x509v3/internal.h', 'src/crypto/x509v3/pcy_int.h', 'src/third_party/fiat/curve25519_32.h', 'src/third_party/fiat/curve25519_64.h', 'src/third_party/fiat/curve25519_tables.h', 'src/third_party/fiat/internal.h', 'src/third_party/fiat/p256_32.h', 'src/third_party/fiat/p256_64.h'] crypto_sources = ['err_data.c', 'src/crypto/asn1/a_bitstr.c', 'src/crypto/asn1/a_bool.c', 'src/crypto/asn1/a_d2i_fp.c', 'src/crypto/asn1/a_dup.c', 'src/crypto/asn1/a_enum.c', 'src/crypto/asn1/a_gentm.c', 'src/crypto/asn1/a_i2d_fp.c', 'src/crypto/asn1/a_int.c', 'src/crypto/asn1/a_mbstr.c', 'src/crypto/asn1/a_object.c', 'src/crypto/asn1/a_octet.c', 'src/crypto/asn1/a_print.c', 'src/crypto/asn1/a_strnid.c', 'src/crypto/asn1/a_time.c', 'src/crypto/asn1/a_type.c', 'src/crypto/asn1/a_utctm.c', 'src/crypto/asn1/a_utf8.c', 'src/crypto/asn1/asn1_lib.c', 'src/crypto/asn1/asn1_par.c', 'src/crypto/asn1/asn_pack.c', 'src/crypto/asn1/f_enum.c', 'src/crypto/asn1/f_int.c', 'src/crypto/asn1/f_string.c', 'src/crypto/asn1/tasn_dec.c', 'src/crypto/asn1/tasn_enc.c', 'src/crypto/asn1/tasn_fre.c', 'src/crypto/asn1/tasn_new.c', 'src/crypto/asn1/tasn_typ.c', 'src/crypto/asn1/tasn_utl.c', 'src/crypto/asn1/time_support.c', 'src/crypto/base64/base64.c', 'src/crypto/bio/bio.c', 'src/crypto/bio/bio_mem.c', 'src/crypto/bio/connect.c', 'src/crypto/bio/fd.c', 'src/crypto/bio/file.c', 'src/crypto/bio/hexdump.c', 'src/crypto/bio/pair.c', 'src/crypto/bio/printf.c', 'src/crypto/bio/socket.c', 'src/crypto/bio/socket_helper.c', 'src/crypto/bn_extra/bn_asn1.c', 'src/crypto/bn_extra/convert.c', 'src/crypto/buf/buf.c', 'src/crypto/bytestring/asn1_compat.c', 'src/crypto/bytestring/ber.c', 'src/crypto/bytestring/cbb.c', 'src/crypto/bytestring/cbs.c', 'src/crypto/bytestring/unicode.c', 'src/crypto/chacha/chacha.c', 'src/crypto/cipher_extra/cipher_extra.c', 'src/crypto/cipher_extra/derive_key.c', 'src/crypto/cipher_extra/e_aesccm.c', 'src/crypto/cipher_extra/e_aesctrhmac.c', 'src/crypto/cipher_extra/e_aesgcmsiv.c', 'src/crypto/cipher_extra/e_chacha20poly1305.c', 'src/crypto/cipher_extra/e_null.c', 'src/crypto/cipher_extra/e_rc2.c', 'src/crypto/cipher_extra/e_rc4.c', 'src/crypto/cipher_extra/e_tls.c', 'src/crypto/cipher_extra/tls_cbc.c', 'src/crypto/cmac/cmac.c', 'src/crypto/conf/conf.c', 'src/crypto/cpu-aarch64-fuchsia.c', 'src/crypto/cpu-aarch64-linux.c', 'src/crypto/cpu-arm-linux.c', 'src/crypto/cpu-arm.c', 'src/crypto/cpu-intel.c', 'src/crypto/cpu-ppc64le.c', 'src/crypto/crypto.c', 'src/crypto/curve25519/spake25519.c', 'src/crypto/dh/check.c', 'src/crypto/dh/dh.c', 'src/crypto/dh/dh_asn1.c', 'src/crypto/dh/params.c', 'src/crypto/digest_extra/digest_extra.c', 'src/crypto/dsa/dsa.c', 'src/crypto/dsa/dsa_asn1.c', 'src/crypto/ec_extra/ec_asn1.c', 'src/crypto/ec_extra/ec_derive.c', 'src/crypto/ecdh_extra/ecdh_extra.c', 'src/crypto/ecdsa_extra/ecdsa_asn1.c', 'src/crypto/engine/engine.c', 'src/crypto/err/err.c', 'src/crypto/evp/digestsign.c', 'src/crypto/evp/evp.c', 'src/crypto/evp/evp_asn1.c', 'src/crypto/evp/evp_ctx.c', 'src/crypto/evp/p_dsa_asn1.c', 'src/crypto/evp/p_ec.c', 'src/crypto/evp/p_ec_asn1.c', 'src/crypto/evp/p_ed25519.c', 'src/crypto/evp/p_ed25519_asn1.c', 'src/crypto/evp/p_rsa.c', 'src/crypto/evp/p_rsa_asn1.c', 'src/crypto/evp/p_x25519.c', 'src/crypto/evp/p_x25519_asn1.c', 'src/crypto/evp/pbkdf.c', 'src/crypto/evp/print.c', 'src/crypto/evp/scrypt.c', 'src/crypto/evp/sign.c', 'src/crypto/ex_data.c', 'src/crypto/fipsmodule/bcm.c', 'src/crypto/fipsmodule/fips_shared_support.c', 'src/crypto/fipsmodule/is_fips.c', 'src/crypto/hkdf/hkdf.c', 'src/crypto/hrss/hrss.c', 'src/crypto/lhash/lhash.c', 'src/crypto/mem.c', 'src/crypto/obj/obj.c', 'src/crypto/obj/obj_xref.c', 'src/crypto/pem/pem_all.c', 'src/crypto/pem/pem_info.c', 'src/crypto/pem/pem_lib.c', 'src/crypto/pem/pem_oth.c', 'src/crypto/pem/pem_pk8.c', 'src/crypto/pem/pem_pkey.c', 'src/crypto/pem/pem_x509.c', 'src/crypto/pem/pem_xaux.c', 'src/crypto/pkcs7/pkcs7.c', 'src/crypto/pkcs7/pkcs7_x509.c', 'src/crypto/pkcs8/p5_pbev2.c', 'src/crypto/pkcs8/pkcs8.c', 'src/crypto/pkcs8/pkcs8_x509.c', 'src/crypto/poly1305/poly1305.c', 'src/crypto/poly1305/poly1305_arm.c', 'src/crypto/poly1305/poly1305_vec.c', 'src/crypto/pool/pool.c', 'src/crypto/rand_extra/deterministic.c', 'src/crypto/rand_extra/forkunsafe.c', 'src/crypto/rand_extra/fuchsia.c', 'src/crypto/rand_extra/rand_extra.c', 'src/crypto/rand_extra/windows.c', 'src/crypto/rc4/rc4.c', 'src/crypto/refcount_c11.c', 'src/crypto/refcount_lock.c', 'src/crypto/rsa_extra/rsa_asn1.c', 'src/crypto/rsa_extra/rsa_print.c', 'src/crypto/siphash/siphash.c', 'src/crypto/stack/stack.c', 'src/crypto/thread.c', 'src/crypto/thread_none.c', 'src/crypto/thread_pthread.c', 'src/crypto/thread_win.c', 'src/crypto/x509/a_digest.c', 'src/crypto/x509/a_sign.c', 'src/crypto/x509/a_strex.c', 'src/crypto/x509/a_verify.c', 'src/crypto/x509/algorithm.c', 'src/crypto/x509/asn1_gen.c', 'src/crypto/x509/by_dir.c', 'src/crypto/x509/by_file.c', 'src/crypto/x509/i2d_pr.c', 'src/crypto/x509/rsa_pss.c', 'src/crypto/x509/t_crl.c', 'src/crypto/x509/t_req.c', 'src/crypto/x509/t_x509.c', 'src/crypto/x509/t_x509a.c', 'src/crypto/x509/x509.c', 'src/crypto/x509/x509_att.c', 'src/crypto/x509/x509_cmp.c', 'src/crypto/x509/x509_d2.c', 'src/crypto/x509/x509_def.c', 'src/crypto/x509/x509_ext.c', 'src/crypto/x509/x509_lu.c', 'src/crypto/x509/x509_obj.c', 'src/crypto/x509/x509_r2x.c', 'src/crypto/x509/x509_req.c', 'src/crypto/x509/x509_set.c', 'src/crypto/x509/x509_trs.c', 'src/crypto/x509/x509_txt.c', 'src/crypto/x509/x509_v3.c', 'src/crypto/x509/x509_vfy.c', 'src/crypto/x509/x509_vpm.c', 'src/crypto/x509/x509cset.c', 'src/crypto/x509/x509name.c', 'src/crypto/x509/x509rset.c', 'src/crypto/x509/x509spki.c', 'src/crypto/x509/x_algor.c', 'src/crypto/x509/x_all.c', 'src/crypto/x509/x_attrib.c', 'src/crypto/x509/x_crl.c', 'src/crypto/x509/x_exten.c', 'src/crypto/x509/x_info.c', 'src/crypto/x509/x_name.c', 'src/crypto/x509/x_pkey.c', 'src/crypto/x509/x_pubkey.c', 'src/crypto/x509/x_req.c', 'src/crypto/x509/x_sig.c', 'src/crypto/x509/x_spki.c', 'src/crypto/x509/x_val.c', 'src/crypto/x509/x_x509.c', 'src/crypto/x509/x_x509a.c', 'src/crypto/x509v3/pcy_cache.c', 'src/crypto/x509v3/pcy_data.c', 'src/crypto/x509v3/pcy_lib.c', 'src/crypto/x509v3/pcy_map.c', 'src/crypto/x509v3/pcy_node.c', 'src/crypto/x509v3/pcy_tree.c', 'src/crypto/x509v3/v3_akey.c', 'src/crypto/x509v3/v3_akeya.c', 'src/crypto/x509v3/v3_alt.c', 'src/crypto/x509v3/v3_bcons.c', 'src/crypto/x509v3/v3_bitst.c', 'src/crypto/x509v3/v3_conf.c', 'src/crypto/x509v3/v3_cpols.c', 'src/crypto/x509v3/v3_crld.c', 'src/crypto/x509v3/v3_enum.c', 'src/crypto/x509v3/v3_extku.c', 'src/crypto/x509v3/v3_genn.c', 'src/crypto/x509v3/v3_ia5.c', 'src/crypto/x509v3/v3_info.c', 'src/crypto/x509v3/v3_int.c', 'src/crypto/x509v3/v3_lib.c', 'src/crypto/x509v3/v3_ncons.c', 'src/crypto/x509v3/v3_ocsp.c', 'src/crypto/x509v3/v3_pci.c', 'src/crypto/x509v3/v3_pcia.c', 'src/crypto/x509v3/v3_pcons.c', 'src/crypto/x509v3/v3_pku.c', 'src/crypto/x509v3/v3_pmaps.c', 'src/crypto/x509v3/v3_prn.c', 'src/crypto/x509v3/v3_purp.c', 'src/crypto/x509v3/v3_skey.c', 'src/crypto/x509v3/v3_sxnet.c', 'src/crypto/x509v3/v3_utl.c', 'src/third_party/fiat/curve25519.c'] tool_sources = ['src/tool/args.cc', 'src/tool/ciphers.cc', 'src/tool/client.cc', 'src/tool/const.cc', 'src/tool/digest.cc', 'src/tool/file.cc', 'src/tool/generate_ed25519.cc', 'src/tool/genrsa.cc', 'src/tool/pkcs12.cc', 'src/tool/rand.cc', 'src/tool/server.cc', 'src/tool/sign.cc', 'src/tool/speed.cc', 'src/tool/tool.cc', 'src/tool/transport_common.cc'] tool_headers = ['src/tool/internal.h', 'src/tool/transport_common.h'] crypto_sources_ios_aarch64 = ['ios-aarch64/crypto/chacha/chacha-armv8.S', 'ios-aarch64/crypto/fipsmodule/aesv8-armx64.S', 'ios-aarch64/crypto/fipsmodule/armv8-mont.S', 'ios-aarch64/crypto/fipsmodule/ghash-neon-armv8.S', 'ios-aarch64/crypto/fipsmodule/ghashv8-armx64.S', 'ios-aarch64/crypto/fipsmodule/sha1-armv8.S', 'ios-aarch64/crypto/fipsmodule/sha256-armv8.S', 'ios-aarch64/crypto/fipsmodule/sha512-armv8.S', 'ios-aarch64/crypto/fipsmodule/vpaes-armv8.S', 'ios-aarch64/crypto/test/trampoline-armv8.S'] crypto_sources_ios_arm = ['ios-arm/crypto/chacha/chacha-armv4.S', 'ios-arm/crypto/fipsmodule/aesv8-armx32.S', 'ios-arm/crypto/fipsmodule/armv4-mont.S', 'ios-arm/crypto/fipsmodule/bsaes-armv7.S', 'ios-arm/crypto/fipsmodule/ghash-armv4.S', 'ios-arm/crypto/fipsmodule/ghashv8-armx32.S', 'ios-arm/crypto/fipsmodule/sha1-armv4-large.S', 'ios-arm/crypto/fipsmodule/sha256-armv4.S', 'ios-arm/crypto/fipsmodule/sha512-armv4.S', 'ios-arm/crypto/fipsmodule/vpaes-armv7.S', 'ios-arm/crypto/test/trampoline-armv4.S'] crypto_sources_linux_aarch64 = ['linux-aarch64/crypto/chacha/chacha-armv8.S', 'linux-aarch64/crypto/fipsmodule/aesv8-armx64.S', 'linux-aarch64/crypto/fipsmodule/armv8-mont.S', 'linux-aarch64/crypto/fipsmodule/ghash-neon-armv8.S', 'linux-aarch64/crypto/fipsmodule/ghashv8-armx64.S', 'linux-aarch64/crypto/fipsmodule/sha1-armv8.S', 'linux-aarch64/crypto/fipsmodule/sha256-armv8.S', 'linux-aarch64/crypto/fipsmodule/sha512-armv8.S', 'linux-aarch64/crypto/fipsmodule/vpaes-armv8.S', 'linux-aarch64/crypto/test/trampoline-armv8.S'] crypto_sources_linux_arm = ['linux-arm/crypto/chacha/chacha-armv4.S', 'linux-arm/crypto/fipsmodule/aesv8-armx32.S', 'linux-arm/crypto/fipsmodule/armv4-mont.S', 'linux-arm/crypto/fipsmodule/bsaes-armv7.S', 'linux-arm/crypto/fipsmodule/ghash-armv4.S', 'linux-arm/crypto/fipsmodule/ghashv8-armx32.S', 'linux-arm/crypto/fipsmodule/sha1-armv4-large.S', 'linux-arm/crypto/fipsmodule/sha256-armv4.S', 'linux-arm/crypto/fipsmodule/sha512-armv4.S', 'linux-arm/crypto/fipsmodule/vpaes-armv7.S', 'linux-arm/crypto/test/trampoline-armv4.S', 'src/crypto/curve25519/asm/x25519-asm-arm.S', 'src/crypto/poly1305/poly1305_arm_asm.S'] crypto_sources_linux_ppc64le = ['linux-ppc64le/crypto/fipsmodule/aesp8-ppc.S', 'linux-ppc64le/crypto/fipsmodule/ghashp8-ppc.S', 'linux-ppc64le/crypto/test/trampoline-ppc.S'] crypto_sources_linux_x86 = ['linux-x86/crypto/chacha/chacha-x86.S', 'linux-x86/crypto/fipsmodule/aesni-x86.S', 'linux-x86/crypto/fipsmodule/bn-586.S', 'linux-x86/crypto/fipsmodule/co-586.S', 'linux-x86/crypto/fipsmodule/ghash-ssse3-x86.S', 'linux-x86/crypto/fipsmodule/ghash-x86.S', 'linux-x86/crypto/fipsmodule/md5-586.S', 'linux-x86/crypto/fipsmodule/sha1-586.S', 'linux-x86/crypto/fipsmodule/sha256-586.S', 'linux-x86/crypto/fipsmodule/sha512-586.S', 'linux-x86/crypto/fipsmodule/vpaes-x86.S', 'linux-x86/crypto/fipsmodule/x86-mont.S', 'linux-x86/crypto/test/trampoline-x86.S'] crypto_sources_linux_x86_64 = ['linux-x86_64/crypto/chacha/chacha-x86_64.S', 'linux-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.S', 'linux-x86_64/crypto/cipher_extra/chacha20_poly1305_x86_64.S', 'linux-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.S', 'linux-x86_64/crypto/fipsmodule/aesni-x86_64.S', 'linux-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.S', 'linux-x86_64/crypto/fipsmodule/ghash-x86_64.S', 'linux-x86_64/crypto/fipsmodule/md5-x86_64.S', 'linux-x86_64/crypto/fipsmodule/p256-x86_64-asm.S', 'linux-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.S', 'linux-x86_64/crypto/fipsmodule/rdrand-x86_64.S', 'linux-x86_64/crypto/fipsmodule/rsaz-avx2.S', 'linux-x86_64/crypto/fipsmodule/sha1-x86_64.S', 'linux-x86_64/crypto/fipsmodule/sha256-x86_64.S', 'linux-x86_64/crypto/fipsmodule/sha512-x86_64.S', 'linux-x86_64/crypto/fipsmodule/vpaes-x86_64.S', 'linux-x86_64/crypto/fipsmodule/x86_64-mont.S', 'linux-x86_64/crypto/fipsmodule/x86_64-mont5.S', 'linux-x86_64/crypto/test/trampoline-x86_64.S', 'src/crypto/hrss/asm/poly_rq_mul.S'] crypto_sources_mac_x86 = ['mac-x86/crypto/chacha/chacha-x86.S', 'mac-x86/crypto/fipsmodule/aesni-x86.S', 'mac-x86/crypto/fipsmodule/bn-586.S', 'mac-x86/crypto/fipsmodule/co-586.S', 'mac-x86/crypto/fipsmodule/ghash-ssse3-x86.S', 'mac-x86/crypto/fipsmodule/ghash-x86.S', 'mac-x86/crypto/fipsmodule/md5-586.S', 'mac-x86/crypto/fipsmodule/sha1-586.S', 'mac-x86/crypto/fipsmodule/sha256-586.S', 'mac-x86/crypto/fipsmodule/sha512-586.S', 'mac-x86/crypto/fipsmodule/vpaes-x86.S', 'mac-x86/crypto/fipsmodule/x86-mont.S', 'mac-x86/crypto/test/trampoline-x86.S'] crypto_sources_mac_x86_64 = ['mac-x86_64/crypto/chacha/chacha-x86_64.S', 'mac-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.S', 'mac-x86_64/crypto/cipher_extra/chacha20_poly1305_x86_64.S', 'mac-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.S', 'mac-x86_64/crypto/fipsmodule/aesni-x86_64.S', 'mac-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.S', 'mac-x86_64/crypto/fipsmodule/ghash-x86_64.S', 'mac-x86_64/crypto/fipsmodule/md5-x86_64.S', 'mac-x86_64/crypto/fipsmodule/p256-x86_64-asm.S', 'mac-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.S', 'mac-x86_64/crypto/fipsmodule/rdrand-x86_64.S', 'mac-x86_64/crypto/fipsmodule/rsaz-avx2.S', 'mac-x86_64/crypto/fipsmodule/sha1-x86_64.S', 'mac-x86_64/crypto/fipsmodule/sha256-x86_64.S', 'mac-x86_64/crypto/fipsmodule/sha512-x86_64.S', 'mac-x86_64/crypto/fipsmodule/vpaes-x86_64.S', 'mac-x86_64/crypto/fipsmodule/x86_64-mont.S', 'mac-x86_64/crypto/fipsmodule/x86_64-mont5.S', 'mac-x86_64/crypto/test/trampoline-x86_64.S'] crypto_sources_win_x86 = ['win-x86/crypto/chacha/chacha-x86.asm', 'win-x86/crypto/fipsmodule/aesni-x86.asm', 'win-x86/crypto/fipsmodule/bn-586.asm', 'win-x86/crypto/fipsmodule/co-586.asm', 'win-x86/crypto/fipsmodule/ghash-ssse3-x86.asm', 'win-x86/crypto/fipsmodule/ghash-x86.asm', 'win-x86/crypto/fipsmodule/md5-586.asm', 'win-x86/crypto/fipsmodule/sha1-586.asm', 'win-x86/crypto/fipsmodule/sha256-586.asm', 'win-x86/crypto/fipsmodule/sha512-586.asm', 'win-x86/crypto/fipsmodule/vpaes-x86.asm', 'win-x86/crypto/fipsmodule/x86-mont.asm', 'win-x86/crypto/test/trampoline-x86.asm'] crypto_sources_win_x86_64 = ['win-x86_64/crypto/chacha/chacha-x86_64.asm', 'win-x86_64/crypto/cipher_extra/aes128gcmsiv-x86_64.asm', 'win-x86_64/crypto/cipher_extra/chacha20_poly1305_x86_64.asm', 'win-x86_64/crypto/fipsmodule/aesni-gcm-x86_64.asm', 'win-x86_64/crypto/fipsmodule/aesni-x86_64.asm', 'win-x86_64/crypto/fipsmodule/ghash-ssse3-x86_64.asm', 'win-x86_64/crypto/fipsmodule/ghash-x86_64.asm', 'win-x86_64/crypto/fipsmodule/md5-x86_64.asm', 'win-x86_64/crypto/fipsmodule/p256-x86_64-asm.asm', 'win-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.asm', 'win-x86_64/crypto/fipsmodule/rdrand-x86_64.asm', 'win-x86_64/crypto/fipsmodule/rsaz-avx2.asm', 'win-x86_64/crypto/fipsmodule/sha1-x86_64.asm', 'win-x86_64/crypto/fipsmodule/sha256-x86_64.asm', 'win-x86_64/crypto/fipsmodule/sha512-x86_64.asm', 'win-x86_64/crypto/fipsmodule/vpaes-x86_64.asm', 'win-x86_64/crypto/fipsmodule/x86_64-mont.asm', 'win-x86_64/crypto/fipsmodule/x86_64-mont5.asm', 'win-x86_64/crypto/test/trampoline-x86_64.asm']
def possible_combination(string): n = len(string) count = [0] * (n + 1); count[0] = 1; count[1] = 1; for i in range(2, n + 1): count[i] = 0; if (string[i - 1] > '0'): count[i] = count[i - 1]; if (string[i - 2] == '1' or (string[i - 2] == '2' and string[i - 1] < '7')): count[i] += count[i - 2]; return count[n]; print(possible_combination(input()))
def possible_combination(string): n = len(string) count = [0] * (n + 1) count[0] = 1 count[1] = 1 for i in range(2, n + 1): count[i] = 0 if string[i - 1] > '0': count[i] = count[i - 1] if string[i - 2] == '1' or (string[i - 2] == '2' and string[i - 1] < '7'): count[i] += count[i - 2] return count[n] print(possible_combination(input()))
''' Description: Given a binary tree, flatten it to a linked list in-place. For example, given the following tree: 1 / \ 2 5 / \ \ 3 4 6 The flattened tree should look like: 1 \ 2 \ 3 \ 4 \ 5 \ 6 ''' # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def flatten(self, root: TreeNode) -> None: """ Input: root node of binary tree Output: convert binary tree to right-skewed linked list """ cur_node = root while cur_node: if cur_node.left: # locate the rightmost anchor node of left sub-tree rihgtmost_of_left_subtree = cur_node.left while rihgtmost_of_left_subtree.right: rihgtmost_of_left_subtree = rihgtmost_of_left_subtree.right # flatten the right sub-tree to linked lsit and append to anchor node rihgtmost_of_left_subtree.right = cur_node.right # flatten the left sub-tree to right-skewed linked list cur_node.right = cur_node.left cur_node.left = None cur_node = cur_node.right # n : the number of node in binary tree ## Time Compleity: O( n ) # # The overhead in time is the cost of DFS traverdal, which is of O( n ). ## Space Complexity: O( n ) # # The overhead in space is the dpeth of recursion call stack, which is of O( n ). def print_right_skewed_linked_list( node:TreeNode ): if node: print( f'{node.val} ', end = '') print_right_skewed_linked_list( node.right ) def test_bench(): root = TreeNode(1) root.left = TreeNode(2) root.right = TreeNode(5) root.left.left = TreeNode(3) root.left.right = TreeNode(4) root.right.right = TreeNode(6) Solution().flatten(root) # expected output: ''' 1 2 3 4 5 6 ''' print_right_skewed_linked_list( root ) return if __name__ == '__main__': test_bench()
""" Description: Given a binary tree, flatten it to a linked list in-place. For example, given the following tree: 1 / 2 5 / \\ 3 4 6 The flattened tree should look like: 1 2 3 4 5 6 """ class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def flatten(self, root: TreeNode) -> None: """ Input: root node of binary tree Output: convert binary tree to right-skewed linked list """ cur_node = root while cur_node: if cur_node.left: rihgtmost_of_left_subtree = cur_node.left while rihgtmost_of_left_subtree.right: rihgtmost_of_left_subtree = rihgtmost_of_left_subtree.right rihgtmost_of_left_subtree.right = cur_node.right cur_node.right = cur_node.left cur_node.left = None cur_node = cur_node.right def print_right_skewed_linked_list(node: TreeNode): if node: print(f'{node.val} ', end='') print_right_skewed_linked_list(node.right) def test_bench(): root = tree_node(1) root.left = tree_node(2) root.right = tree_node(5) root.left.left = tree_node(3) root.left.right = tree_node(4) root.right.right = tree_node(6) solution().flatten(root) '\n 1 2 3 4 5 6 \n ' print_right_skewed_linked_list(root) return if __name__ == '__main__': test_bench()
"""Constants for the Template Platform Components.""" CONF_AVAILABILITY_TEMPLATE = "availability_template" DOMAIN = "template" PLATFORM_STORAGE_KEY = "template_platforms" PLATFORMS = [ "alarm_control_panel", "binary_sensor", "cover", "fan", "light", "lock", "sensor", "switch", "vacuum", "weather", ]
"""Constants for the Template Platform Components.""" conf_availability_template = 'availability_template' domain = 'template' platform_storage_key = 'template_platforms' platforms = ['alarm_control_panel', 'binary_sensor', 'cover', 'fan', 'light', 'lock', 'sensor', 'switch', 'vacuum', 'weather']
############################################################################### # Copyright (c) 2019, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory # Written by the Merlin dev team, listed in the CONTRIBUTORS file. # <[email protected]> # # LLNL-CODE-797170 # All rights reserved. # This file is part of Merlin, Version: 1.5.1. # # For details, see https://github.com/LLNL/merlin. # # 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. ############################################################################### DESCRIPTION = {"description": {}} BATCH = {"batch": {"type": "local", "dry_run": False, "shell": "/bin/bash"}} ENV = {"env": {"variables": {}}} STUDY_STEP_RUN = {"task_queue": "merlin", "shell": "/bin/bash", "max_retries": 30} PARAMETER = {"global.parameters": {}} MERLIN = { "merlin": { "resources": {"task_server": "celery", "overlap": False, "workers": None}, "samples": None, } } WORKER = {"steps": ["all"], "nodes": None, "batch": None} SAMPLES = { "generate": {"cmd": "echo 'Insert sample-generating command here'"}, "level_max_dirs": 25, }
description = {'description': {}} batch = {'batch': {'type': 'local', 'dry_run': False, 'shell': '/bin/bash'}} env = {'env': {'variables': {}}} study_step_run = {'task_queue': 'merlin', 'shell': '/bin/bash', 'max_retries': 30} parameter = {'global.parameters': {}} merlin = {'merlin': {'resources': {'task_server': 'celery', 'overlap': False, 'workers': None}, 'samples': None}} worker = {'steps': ['all'], 'nodes': None, 'batch': None} samples = {'generate': {'cmd': "echo 'Insert sample-generating command here'"}, 'level_max_dirs': 25}
# -*- coding: utf-8 -*- """ Created on Tue Oct 20 20:20:20 2020 @authors: Amal Htait and Leif Azzopardi For license information, see LICENSE.TXT """ class SentimentIntensityAggregator: """ Apply an aggregation to a list of similarity scores. """ def __init__(self): pass def agg_score(self, pos_dists, neg_dists): """ Return a float as a score of aggregated similarity scores with positive and negative seeds lists. :param pos_dists: a list of similarity scores with pos seeds :param neg_dists: a list of similarity scores with neg seeds :return: a score (float) """ pass class SumSentimentIntensityAggregator(SentimentIntensityAggregator): """ Apply an sum aggregation to a list of similarity scores. """ def agg_score(self, pos_dists, neg_dists): pos_score=0.0 neg_score=0.0 dists_size = len(pos_dists) for i in range(dists_size): pos_score=pos_score + (1.0-pos_dists[i]) neg_score=neg_score + (1.0-neg_dists[i]) score=pos_score - neg_score return score class AvgSentimentIntensityAggregator(SentimentIntensityAggregator): """ Apply an average aggregation to a list of similarity scores. """ def agg_score(self, pos_dists, neg_dists): pos_sum = 0.0 neg_sum = 0.0 dists_size = len(pos_dists) for i in range(dists_size): pos_sum = pos_sum + (1.0-pos_dists[i]) neg_sum = neg_sum + (1.0-neg_dists[i]) pos_score = pos_sum/dists_size neg_score = neg_sum/dists_size score = pos_score - neg_score return score class MaxSentimentIntensityAggregator(SentimentIntensityAggregator): """ Selecting the maximum value in a list of similarity scores. """ def agg_score(self, pos_dists, neg_dists): pos_score = (1.0-(min(pos_dists))) neg_score = (1.0-(min(neg_dists))) score = pos_score - neg_score return score
""" Created on Tue Oct 20 20:20:20 2020 @authors: Amal Htait and Leif Azzopardi For license information, see LICENSE.TXT """ class Sentimentintensityaggregator: """ Apply an aggregation to a list of similarity scores. """ def __init__(self): pass def agg_score(self, pos_dists, neg_dists): """ Return a float as a score of aggregated similarity scores with positive and negative seeds lists. :param pos_dists: a list of similarity scores with pos seeds :param neg_dists: a list of similarity scores with neg seeds :return: a score (float) """ pass class Sumsentimentintensityaggregator(SentimentIntensityAggregator): """ Apply an sum aggregation to a list of similarity scores. """ def agg_score(self, pos_dists, neg_dists): pos_score = 0.0 neg_score = 0.0 dists_size = len(pos_dists) for i in range(dists_size): pos_score = pos_score + (1.0 - pos_dists[i]) neg_score = neg_score + (1.0 - neg_dists[i]) score = pos_score - neg_score return score class Avgsentimentintensityaggregator(SentimentIntensityAggregator): """ Apply an average aggregation to a list of similarity scores. """ def agg_score(self, pos_dists, neg_dists): pos_sum = 0.0 neg_sum = 0.0 dists_size = len(pos_dists) for i in range(dists_size): pos_sum = pos_sum + (1.0 - pos_dists[i]) neg_sum = neg_sum + (1.0 - neg_dists[i]) pos_score = pos_sum / dists_size neg_score = neg_sum / dists_size score = pos_score - neg_score return score class Maxsentimentintensityaggregator(SentimentIntensityAggregator): """ Selecting the maximum value in a list of similarity scores. """ def agg_score(self, pos_dists, neg_dists): pos_score = 1.0 - min(pos_dists) neg_score = 1.0 - min(neg_dists) score = pos_score - neg_score return score
# Metadata Create Tests def test0_metadata_create(): return # Metadata Getters Tests def test0_metadata_name(): return def test0_metadata_ename(): return def test0_metadata_season(): return def test0_metadata_episode(): return def test0_metadata_quality(): return def test0_metadata_extension(): return def test0_metadata_year(): return def tets0_metadata_fflag(): return # ExtendendMetadata Create Tests def test0_extendedmetadata_create(): return # ExtendendMetadata Getters Tests def test0_extendedmetadata_genre(): return
def test0_metadata_create(): return def test0_metadata_name(): return def test0_metadata_ename(): return def test0_metadata_season(): return def test0_metadata_episode(): return def test0_metadata_quality(): return def test0_metadata_extension(): return def test0_metadata_year(): return def tets0_metadata_fflag(): return def test0_extendedmetadata_create(): return def test0_extendedmetadata_genre(): return
# coding: utf-8 # Author: zhao-zh10 # The function localize takes the following arguments: # # colors: # 2D list, each entry either 'R' (for red cell) or 'G' (for green cell). The environment is cyclic. # # measurements: # list of measurements taken by the robot, each entry either 'R' or 'G' # # motions: # list of actions taken by the robot, each entry of the form [dy,dx], # where dx refers to the change in the x-direction (positive meaning # movement to the right) and dy refers to the change in the y-direction # (positive meaning movement downward) # NOTE: the *first* coordinate is change in y; the *second* coordinate is # change in x # # sensor_right: # float between 0 and 1, giving the probability that any given # measurement is correct; the probability that the measurement is # incorrect is 1-sensor_right # # p_move: # float between 0 and 1, giving the probability that any given movement # command takes place; the probability that the movement command fails # (and the robot remains still) is 1-p_move; the robot will NOT overshoot # its destination in this exercise # # The function should RETURN (not just show or print) a 2D list (of the same # dimensions as colors) that gives the probabilities that the robot occupies # each cell in the world. # # Compute the probabilities by assuming the robot initially has a uniform # probability of being in any cell. # # Also assume that at each step, the robot: # 1) first makes a movement, # 2) then takes a measurement. # # Motion: # [0,0] - stay # [0,1] - right # [0,-1] - left # [1,0] - down # [-1,0] - up # For the purpose of this homework assume that the robot can move only left, right, up, or down. It cannot move diagonally. # Also, for this assignment, the robot will never overshoot its destination square; it will either make the movement or it will remain stationary. def localize(colors,measurements,motions,sensor_right,p_move): # initializes p to a uniform distribution over a grid of the same dimensions as colors pinit = 1.0 / float(len(colors)) / float(len(colors[0])) p = [[pinit for col in range(len(colors[0]))] for row in range(len(colors))] assert(len(motions) == len(measurements)) for i in range(len(motions)): p = move(p, motions[i], p_move) p = sense(p, colors, measurements[i], sensor_right) return p def show(p): rows = ['[' + ','.join(map(lambda x: '{0:.5f}'.format(x),r)) + ']' for r in p] print('[' + ',\n '.join(rows) + ']') def sense(probability, colors, measurement, sensor_right): prob = [[0.0 for col in range(len(colors[0]))] for row in range(len(colors))] sum_prob = 0.0 sensor_wrong = 1.0 - sensor_right for i in range(len(colors)): for j in range(len(colors[0])): hit = (measurement == colors[i][j]) prob[i][j] = probability[i][j] * (hit * sensor_right + (1 - hit) * sensor_wrong) sum_prob += prob[i][j] for i in range(len(colors)): for j in range(len(colors[0])): prob[i][j] /= sum_prob return prob def move(probability, motion, p_move): dy, dx = motion[0], motion[1] prob = [[0.0 for col in range(len(colors[0]))] for row in range(len(colors))] p_stay = 1.0 - p_move for i in range(len(colors)): for j in range(len(colors[0])): prob[i][j] = probability[i][j] * p_stay + probability[(i-dy)%len(colors)][(j-dx)%len(colors[0])] * p_move return prob if __name__ == '__main__': ################################################################################# #Test Case # # test 1 # colors = [['G', 'G', 'G'], # ['G', 'R', 'G'], # ['G', 'G', 'G']] # measurements = ['R'] # motions = [[0,0]] # sensor_right = 1.0 # p_move = 1.0 # p = localize(colors,measurements,motions,sensor_right,p_move) # correct_answer = ( # [[0.0, 0.0, 0.0], # [0.0, 1.0, 0.0], # [0.0, 0.0, 0.0]]) # show(p) # # test 2 # colors = [['G', 'G', 'G'], # ['G', 'R', 'R'], # ['G', 'G', 'G']] # measurements = ['R'] # motions = [[0,0]] # sensor_right = 1.0 # p_move = 1.0 # p = localize(colors,measurements,motions,sensor_right,p_move) # correct_answer = ( # [[0.0, 0.0, 0.0], # [0.0, 0.5, 0.5], # [0.0, 0.0, 0.0]]) # show(p) # # test 3 # colors = [['G', 'G', 'G'], # ['G', 'R', 'R'], # ['G', 'G', 'G']] # measurements = ['R'] # motions = [[0,0]] # sensor_right = 0.8 # p_move = 1.0 # p = localize(colors,measurements,motions,sensor_right,p_move) # correct_answer = ( # [[0.06666666666, 0.06666666666, 0.06666666666], # [0.06666666666, 0.26666666666, 0.26666666666], # [0.06666666666, 0.06666666666, 0.06666666666]]) # show(p) # # test 4 # colors = [['G', 'G', 'G'], # ['G', 'R', 'R'], # ['G', 'G', 'G']] # measurements = ['R', 'R'] # motions = [[0,0], [0,1]] # sensor_right = 0.8 # p_move = 1.0 # p = localize(colors,measurements,motions,sensor_right,p_move) # correct_answer = ( # [[0.03333333333, 0.03333333333, 0.03333333333], # [0.13333333333, 0.13333333333, 0.53333333333], # [0.03333333333, 0.03333333333, 0.03333333333]]) # show(p) # # test 5 # colors = [['G', 'G', 'G'], # ['G', 'R', 'R'], # ['G', 'G', 'G']] # measurements = ['R', 'R'] # motions = [[0,0], [0,1]] # sensor_right = 1.0 # p_move = 1.0 # p = localize(colors,measurements,motions,sensor_right,p_move) # correct_answer = ( # [[0.0, 0.0, 0.0], # [0.0, 0.0, 1.0], # [0.0, 0.0, 0.0]]) # show(p) # # test 6 # colors = [['G', 'G', 'G'], # ['G', 'R', 'R'], # ['G', 'G', 'G']] # measurements = ['R', 'R'] # motions = [[0,0], [0,1]] # sensor_right = 0.8 # p_move = 0.5 # p = localize(colors,measurements,motions,sensor_right,p_move) # correct_answer = ( # [[0.0289855072, 0.0289855072, 0.0289855072], # [0.0724637681, 0.2898550724, 0.4637681159], # [0.0289855072, 0.0289855072, 0.0289855072]]) # show(p) # # test 7 # colors = [['G', 'G', 'G'], # ['G', 'R', 'R'], # ['G', 'G', 'G']] # measurements = ['R', 'R'] # motions = [[0,0], [0,1]] # sensor_right = 1.0 # p_move = 0.5 # p = localize(colors,measurements,motions,sensor_right,p_move) # correct_answer = ( # [[0.0, 0.0, 0.0], # [0.0, 0.33333333, 0.66666666], # [0.0, 0.0, 0.0]]) # show(p) ############################################################# # For the following test case, your output should be # [[0.01105, 0.02464, 0.06799, 0.04472, 0.02465], # [0.00715, 0.01017, 0.08696, 0.07988, 0.00935], # [0.00739, 0.00894, 0.11272, 0.35350, 0.04065], # [0.00910, 0.00715, 0.01434, 0.04313, 0.03642]] # (within a tolerance of +/- 0.001 for each entry) colors = [['R','G','G','R','R'],['R','R','G','R','R'],['R','R','G','G','R'],['R','R','R','R','R']] measurements = ['G','G','G','G','G'] motions = [[0,0],[0,1],[1,0],[1,0],[0,1]] p = localize(colors,measurements,motions,sensor_right = 0.7, p_move = 0.8) show(p) # displays your answer
def localize(colors, measurements, motions, sensor_right, p_move): pinit = 1.0 / float(len(colors)) / float(len(colors[0])) p = [[pinit for col in range(len(colors[0]))] for row in range(len(colors))] assert len(motions) == len(measurements) for i in range(len(motions)): p = move(p, motions[i], p_move) p = sense(p, colors, measurements[i], sensor_right) return p def show(p): rows = ['[' + ','.join(map(lambda x: '{0:.5f}'.format(x), r)) + ']' for r in p] print('[' + ',\n '.join(rows) + ']') def sense(probability, colors, measurement, sensor_right): prob = [[0.0 for col in range(len(colors[0]))] for row in range(len(colors))] sum_prob = 0.0 sensor_wrong = 1.0 - sensor_right for i in range(len(colors)): for j in range(len(colors[0])): hit = measurement == colors[i][j] prob[i][j] = probability[i][j] * (hit * sensor_right + (1 - hit) * sensor_wrong) sum_prob += prob[i][j] for i in range(len(colors)): for j in range(len(colors[0])): prob[i][j] /= sum_prob return prob def move(probability, motion, p_move): (dy, dx) = (motion[0], motion[1]) prob = [[0.0 for col in range(len(colors[0]))] for row in range(len(colors))] p_stay = 1.0 - p_move for i in range(len(colors)): for j in range(len(colors[0])): prob[i][j] = probability[i][j] * p_stay + probability[(i - dy) % len(colors)][(j - dx) % len(colors[0])] * p_move return prob if __name__ == '__main__': colors = [['R', 'G', 'G', 'R', 'R'], ['R', 'R', 'G', 'R', 'R'], ['R', 'R', 'G', 'G', 'R'], ['R', 'R', 'R', 'R', 'R']] measurements = ['G', 'G', 'G', 'G', 'G'] motions = [[0, 0], [0, 1], [1, 0], [1, 0], [0, 1]] p = localize(colors, measurements, motions, sensor_right=0.7, p_move=0.8) show(p)
def foo(): print("In utility.py ==> foo()") if __name__=='__main__': foo()
def foo(): print('In utility.py ==> foo()') if __name__ == '__main__': foo()
count=0 def permute(s,l,pos,n): if pos>=n: global count count+=1 print(l) for k in l: print(s[k],end="") print() return for i in range(n): if i not in l[:pos]: l[pos] = i permute(s,l,pos+1,n) s="shivank" n=len(s) l=[] for i in range(n): l.append(0) permute(s,l,0,n) print(count)
count = 0 def permute(s, l, pos, n): if pos >= n: global count count += 1 print(l) for k in l: print(s[k], end='') print() return for i in range(n): if i not in l[:pos]: l[pos] = i permute(s, l, pos + 1, n) s = 'shivank' n = len(s) l = [] for i in range(n): l.append(0) permute(s, l, 0, n) print(count)
# https://leetcode.com/problems/divide-two-integers/ # class Solution: def divide(self, dividend: int, divisor: int) -> int: if dividend == divisor: return 1 isPositive = (dividend > 0 and divisor > 0) or (dividend < 0 and divisor < 0) dividend = dividend if dividend > 0 else -dividend divisor = divisor if divisor > 0 else -divisor ans = 0 divisors = {0: 0, 1: divisor} divIdx = 1 while divisors[divIdx] < dividend: i = divIdx divIdx += divIdx divisors[divIdx] = divisors[i] + divisors[i] divisorsKeys = sorted(list(divisors.keys())) divisorsIdx = len(divisorsKeys)-1 while divisorsIdx > 0 and dividend > 0: while divisors[divisorsKeys[divisorsIdx]] > dividend: divisorsIdx -= 1 dividend -= divisors[divisorsKeys[divisorsIdx]] ans += divisorsKeys[divisorsIdx] return ans if isPositive else -ans s = Solution() # print(s.divide(10,3)) print(s.divide(10,-2)) print(s.divide(100000000000,-2))
class Solution: def divide(self, dividend: int, divisor: int) -> int: if dividend == divisor: return 1 is_positive = dividend > 0 and divisor > 0 or (dividend < 0 and divisor < 0) dividend = dividend if dividend > 0 else -dividend divisor = divisor if divisor > 0 else -divisor ans = 0 divisors = {0: 0, 1: divisor} div_idx = 1 while divisors[divIdx] < dividend: i = divIdx div_idx += divIdx divisors[divIdx] = divisors[i] + divisors[i] divisors_keys = sorted(list(divisors.keys())) divisors_idx = len(divisorsKeys) - 1 while divisorsIdx > 0 and dividend > 0: while divisors[divisorsKeys[divisorsIdx]] > dividend: divisors_idx -= 1 dividend -= divisors[divisorsKeys[divisorsIdx]] ans += divisorsKeys[divisorsIdx] return ans if isPositive else -ans s = solution() print(s.divide(10, -2)) print(s.divide(100000000000, -2))
class DataClassFile(): def functionName1(self, parameter1): """ One Function (takes a parameter) with one test function (with single line comments) where outdated documentation exists. ************************************************************ ####UnitTest Specifications - Given: Old specifications Given: line When : Old specifications When: line Then : Old specifications Then: line `test_functionName1_test_case_3()` ************************************************************ @param string $parameter1 a String @return string a String """ say = "say" fu = "fu" return say + " " + fu
class Dataclassfile: def function_name1(self, parameter1): """ One Function (takes a parameter) with one test function (with single line comments) where outdated documentation exists. ************************************************************ ####UnitTest Specifications - Given: Old specifications Given: line When : Old specifications When: line Then : Old specifications Then: line `test_functionName1_test_case_3()` ************************************************************ @param string $parameter1 a String @return string a String """ say = 'say' fu = 'fu' return say + ' ' + fu
#!/usr/bin/env python3 def linearSearch(lst,item): isFound = False for x in range(0,len(lst)): if item == lst[x]: isFound = True return "Item found at index " + str(x) elif (x == len(lst)-1) and (isFound == False): return "Item not found" if __name__ == '__main__': numLst = [11,45,6,8,1,2,9,45,32] print(linearSearch(numLst,22))
def linear_search(lst, item): is_found = False for x in range(0, len(lst)): if item == lst[x]: is_found = True return 'Item found at index ' + str(x) elif x == len(lst) - 1 and isFound == False: return 'Item not found' if __name__ == '__main__': num_lst = [11, 45, 6, 8, 1, 2, 9, 45, 32] print(linear_search(numLst, 22))
line = input() if line == 's3cr3t!P@ssw0rd': print("Welcome") else: print("Wrong password!")
line = input() if line == 's3cr3t!P@ssw0rd': print('Welcome') else: print('Wrong password!')
#%% def generate_range(min: int, max: int, step: int) -> None: for i in range(min, max + 1, step): print(i) generate_range(2, 10, 2) # %% # %% def generate_range(min: int, max: int, step: int) -> None: i = min while i <= max: print(i) i = i + step generate_range(2, 10, 2)
def generate_range(min: int, max: int, step: int) -> None: for i in range(min, max + 1, step): print(i) generate_range(2, 10, 2) def generate_range(min: int, max: int, step: int) -> None: i = min while i <= max: print(i) i = i + step generate_range(2, 10, 2)
begin_unit comment|'# Copyright 2015 Red Hat Inc' nl|'\n' comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may' nl|'\n' comment|'# not use this file except in compliance with the License. You may obtain' nl|'\n' comment|'# a copy of the License at' nl|'\n' comment|'#' nl|'\n' comment|'# http://www.apache.org/licenses/LICENSE-2.0' nl|'\n' comment|'#' nl|'\n' comment|'# Unless required by applicable law or agreed to in writing, software' nl|'\n' comment|'# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT' nl|'\n' comment|'# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the' nl|'\n' comment|'# License for the specific language governing permissions and limitations' nl|'\n' comment|'# under the License.' nl|'\n' nl|'\n' comment|'#' nl|'\n' comment|'# See blueprint backportable-db-migrations-icehouse' nl|'\n' comment|'# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html' nl|'\n' nl|'\n' name|'from' name|'sqlalchemy' name|'import' name|'MetaData' op|',' name|'Table' op|',' name|'Column' op|',' name|'String' op|',' name|'Index' newline|'\n' nl|'\n' nl|'\n' DECL|function|upgrade name|'def' name|'upgrade' op|'(' name|'migrate_engine' op|')' op|':' newline|'\n' indent|' ' name|'meta' op|'=' name|'MetaData' op|'(' name|'bind' op|'=' name|'migrate_engine' op|')' newline|'\n' nl|'\n' comment|'# Add a new column to store PCI device parent address' nl|'\n' name|'pci_devices' op|'=' name|'Table' op|'(' string|"'pci_devices'" op|',' name|'meta' op|',' name|'autoload' op|'=' name|'True' op|')' newline|'\n' name|'shadow_pci_devices' op|'=' name|'Table' op|'(' string|"'shadow_pci_devices'" op|',' name|'meta' op|',' name|'autoload' op|'=' name|'True' op|')' newline|'\n' nl|'\n' name|'parent_addr' op|'=' name|'Column' op|'(' string|"'parent_addr'" op|',' name|'String' op|'(' number|'12' op|')' op|',' name|'nullable' op|'=' name|'True' op|')' newline|'\n' nl|'\n' name|'if' name|'not' name|'hasattr' op|'(' name|'pci_devices' op|'.' name|'c' op|',' string|"'parent_addr'" op|')' op|':' newline|'\n' indent|' ' name|'pci_devices' op|'.' name|'create_column' op|'(' name|'parent_addr' op|')' newline|'\n' dedent|'' name|'if' name|'not' name|'hasattr' op|'(' name|'shadow_pci_devices' op|'.' name|'c' op|',' string|"'parent_addr'" op|')' op|':' newline|'\n' indent|' ' name|'shadow_pci_devices' op|'.' name|'create_column' op|'(' name|'parent_addr' op|'.' name|'copy' op|'(' op|')' op|')' newline|'\n' nl|'\n' comment|'# Create index' nl|'\n' dedent|'' name|'parent_index' op|'=' name|'Index' op|'(' string|"'ix_pci_devices_compute_node_id_parent_addr_deleted'" op|',' nl|'\n' name|'pci_devices' op|'.' name|'c' op|'.' name|'compute_node_id' op|',' nl|'\n' name|'pci_devices' op|'.' name|'c' op|'.' name|'parent_addr' op|',' nl|'\n' name|'pci_devices' op|'.' name|'c' op|'.' name|'deleted' op|')' newline|'\n' name|'parent_index' op|'.' name|'create' op|'(' name|'migrate_engine' op|')' newline|'\n' dedent|'' endmarker|'' end_unit
begin_unit comment | '# Copyright 2015 Red Hat Inc' nl | '\n' comment | '# Licensed under the Apache License, Version 2.0 (the "License"); you may' nl | '\n' comment | '# not use this file except in compliance with the License. You may obtain' nl | '\n' comment | '# a copy of the License at' nl | '\n' comment | '#' nl | '\n' comment | '# http://www.apache.org/licenses/LICENSE-2.0' nl | '\n' comment | '#' nl | '\n' comment | '# Unless required by applicable law or agreed to in writing, software' nl | '\n' comment | '# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT' nl | '\n' comment | '# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the' nl | '\n' comment | '# License for the specific language governing permissions and limitations' nl | '\n' comment | '# under the License.' nl | '\n' nl | '\n' comment | '#' nl | '\n' comment | '# See blueprint backportable-db-migrations-icehouse' nl | '\n' comment | '# http://lists.openstack.org/pipermail/openstack-dev/2013-March/006827.html' nl | '\n' nl | '\n' name | 'from' name | 'sqlalchemy' name | 'import' name | 'MetaData' op | ',' name | 'Table' op | ',' name | 'Column' op | ',' name | 'String' op | ',' name | 'Index' newline | '\n' nl | '\n' nl | '\n' DECL | function | upgrade name | 'def' name | 'upgrade' op | '(' name | 'migrate_engine' op | ')' op | ':' newline | '\n' indent | ' ' name | 'meta' op | '=' name | 'MetaData' op | '(' name | 'bind' op | '=' name | 'migrate_engine' op | ')' newline | '\n' nl | '\n' comment | '# Add a new column to store PCI device parent address' nl | '\n' name | 'pci_devices' op | '=' name | 'Table' op | '(' string | "'pci_devices'" op | ',' name | 'meta' op | ',' name | 'autoload' op | '=' name | 'True' op | ')' newline | '\n' name | 'shadow_pci_devices' op | '=' name | 'Table' op | '(' string | "'shadow_pci_devices'" op | ',' name | 'meta' op | ',' name | 'autoload' op | '=' name | 'True' op | ')' newline | '\n' nl | '\n' name | 'parent_addr' op | '=' name | 'Column' op | '(' string | "'parent_addr'" op | ',' name | 'String' op | '(' number | '12' op | ')' op | ',' name | 'nullable' op | '=' name | 'True' op | ')' newline | '\n' nl | '\n' name | 'if' name | 'not' name | 'hasattr' op | '(' name | 'pci_devices' op | '.' name | 'c' op | ',' string | "'parent_addr'" op | ')' op | ':' newline | '\n' indent | ' ' name | 'pci_devices' op | '.' name | 'create_column' op | '(' name | 'parent_addr' op | ')' newline | '\n' dedent | '' name | 'if' name | 'not' name | 'hasattr' op | '(' name | 'shadow_pci_devices' op | '.' name | 'c' op | ',' string | "'parent_addr'" op | ')' op | ':' newline | '\n' indent | ' ' name | 'shadow_pci_devices' op | '.' name | 'create_column' op | '(' name | 'parent_addr' op | '.' name | 'copy' op | '(' op | ')' op | ')' newline | '\n' nl | '\n' comment | '# Create index' nl | '\n' dedent | '' name | 'parent_index' op | '=' name | 'Index' op | '(' string | "'ix_pci_devices_compute_node_id_parent_addr_deleted'" op | ',' nl | '\n' name | 'pci_devices' op | '.' name | 'c' op | '.' name | 'compute_node_id' op | ',' nl | '\n' name | 'pci_devices' op | '.' name | 'c' op | '.' name | 'parent_addr' op | ',' nl | '\n' name | 'pci_devices' op | '.' name | 'c' op | '.' name | 'deleted' op | ')' newline | '\n' name | 'parent_index' op | '.' name | 'create' op | '(' name | 'migrate_engine' op | ')' newline | '\n' dedent | '' endmarker | '' end_unit
while True: entrada = input() if entrada == '0': break entrada = input() joao = entrada.count('1') maria = entrada.count('0') print(f'Mary won {maria} times and John won {joao} times')
while True: entrada = input() if entrada == '0': break entrada = input() joao = entrada.count('1') maria = entrada.count('0') print(f'Mary won {maria} times and John won {joao} times')
# Age avergage with floating points # Var declarations # Code age1 = 10.0 age2 = 11.0 age3 = 13.0 age4 = 9.0 age5 = 12.0 result = (age1+age2+age3+age4+age5)/5.0 # Result print(result)
age1 = 10.0 age2 = 11.0 age3 = 13.0 age4 = 9.0 age5 = 12.0 result = (age1 + age2 + age3 + age4 + age5) / 5.0 print(result)
class Word: def __init__(self, cells): if not cells: raise ValueError("word cannot contain 0 cells") self.cell = cells[0] self.rest = Word(cells[1:]) if cells[1:] else None def _clear(self): self.cell |= 0 if self.rest: self.rest.clear() def _succ(self): self.cell += 1 if self.rest: for if_ in (~self.cell).not_(): self.rest._succ() def _pred(self): if self.rest: for if_ in (~self.cell).not_(): self.rest._pred() self.cell -= 1 def _if(self): if self.rest: for if_ in self.cell | self.rest: self.rest.clear() yield else: for if_ in self.cell: yield def _while(self): ...
class Word: def __init__(self, cells): if not cells: raise value_error('word cannot contain 0 cells') self.cell = cells[0] self.rest = word(cells[1:]) if cells[1:] else None def _clear(self): self.cell |= 0 if self.rest: self.rest.clear() def _succ(self): self.cell += 1 if self.rest: for if_ in (~self.cell).not_(): self.rest._succ() def _pred(self): if self.rest: for if_ in (~self.cell).not_(): self.rest._pred() self.cell -= 1 def _if(self): if self.rest: for if_ in self.cell | self.rest: self.rest.clear() yield else: for if_ in self.cell: yield def _while(self): ...
'''6. Write a Python program to add 'ing' at the end of a given string (length should be at least 3). If the given string already ends with 'ing' then add 'ly' instead. If the string length of the given string is less than 3, leave it unchanged. Sample String : 'abc' Expected Result : 'abcing' Sample String : 'string' Expected Result : 'stringly' ''' def add_string(str1): length = len(str1) if length > 2: if str1[-3:] == 'ing': str1 += 'ly' else: str1 += 'ing' return str1 print(add_string('ab')) print(add_string('abc')) print(add_string('string')) #Reference: w3resource
"""6. Write a Python program to add 'ing' at the end of a given string (length should be at least 3). If the given string already ends with 'ing' then add 'ly' instead. If the string length of the given string is less than 3, leave it unchanged. Sample String : 'abc' Expected Result : 'abcing' Sample String : 'string' Expected Result : 'stringly' """ def add_string(str1): length = len(str1) if length > 2: if str1[-3:] == 'ing': str1 += 'ly' else: str1 += 'ing' return str1 print(add_string('ab')) print(add_string('abc')) print(add_string('string'))
# basic tuple functionality x = (1, 2, 3 * 4) print(x) try: x[0] = 4 except TypeError: print("TypeError") print(x) try: x.append(5) except AttributeError: print("AttributeError") print(x[1:]) print(x[:-1]) print(x[2:3]) print(x + (10, 100, 10000))
x = (1, 2, 3 * 4) print(x) try: x[0] = 4 except TypeError: print('TypeError') print(x) try: x.append(5) except AttributeError: print('AttributeError') print(x[1:]) print(x[:-1]) print(x[2:3]) print(x + (10, 100, 10000))
# from util.stack import Stack """ Given a array of number find the next greater no in the right of each element Example- Input 12 15 22 09 07 02 18 23 27 Output 15 22 23 18 18 18 23 27 -1 """ '''prints element and NGE pair for all elements of arr[] ''' def find_next_greater_ele_in_array(array): """ complexity O(n2) :param array: :return: """ temp_arr = [] for i in range(0, len(array)): # if i == len(array) - 1: # temp_arr.append(-1) nxt = -1 for j in range(i + 1, len(array)): if array[i] < array[j]: nxt = array[j] break temp_arr.append(nxt) print(array) print(temp_arr) class Stack(object): @staticmethod def create_stack(): stack = [] return stack @staticmethod def is_empty(stack): return len(stack) == 0 @staticmethod def push(stack, x): stack.append(x) @staticmethod def pop(stack): if Stack.is_empty(stack): print("Error : stack underflow") else: return stack.pop() def find_next_greater_ele_in_array_using_stack(array): """ complexity O(n) :param array: :return: """ stack = Stack.create_stack() ele = 0 nxt = 0 temp = [] # push the first element to stack Stack.push(stack, array[0]) # iterate for rest of the elements for i in range(1, len(array), 1): nxt = array[i] if not Stack.is_empty(stack): # if stack is not empty, then pop an element from stack ele = Stack.pop(stack) ''' If the popped element is smaller than next, then keep popping while elements are smaller and stack is not empty ''' while ele < nxt: temp.append(nxt) if Stack.is_empty(stack): break ele = Stack.pop(stack) '''If element is greater than next, then push the element back ''' if ele > nxt: Stack.push(stack, ele) '''push next to stack so that we can find next greater for it ''' Stack.push(stack, nxt) ''' After iterating over the loop, the remaining elements in stack do not have the next greater element, so print -1 for them ''' while not Stack.is_empty(stack): ele = Stack.pop(stack) nxt = -1 temp.append(nxt) print(array) print(temp) if __name__ == '__main__': arr = [12, 15, 22, 9, 7, 2, 18, 23, 27] find_next_greater_ele_in_array(arr) find_next_greater_ele_in_array_using_stack(arr)
""" Given a array of number find the next greater no in the right of each element Example- Input 12 15 22 09 07 02 18 23 27 Output 15 22 23 18 18 18 23 27 -1 """ 'prints element and NGE pair for all elements of arr[] ' def find_next_greater_ele_in_array(array): """ complexity O(n2) :param array: :return: """ temp_arr = [] for i in range(0, len(array)): nxt = -1 for j in range(i + 1, len(array)): if array[i] < array[j]: nxt = array[j] break temp_arr.append(nxt) print(array) print(temp_arr) class Stack(object): @staticmethod def create_stack(): stack = [] return stack @staticmethod def is_empty(stack): return len(stack) == 0 @staticmethod def push(stack, x): stack.append(x) @staticmethod def pop(stack): if Stack.is_empty(stack): print('Error : stack underflow') else: return stack.pop() def find_next_greater_ele_in_array_using_stack(array): """ complexity O(n) :param array: :return: """ stack = Stack.create_stack() ele = 0 nxt = 0 temp = [] Stack.push(stack, array[0]) for i in range(1, len(array), 1): nxt = array[i] if not Stack.is_empty(stack): ele = Stack.pop(stack) '\n If the popped element is smaller than next, then \n keep popping while elements are smaller and stack is not empty \n ' while ele < nxt: temp.append(nxt) if Stack.is_empty(stack): break ele = Stack.pop(stack) 'If element is greater than next, then push the element back ' if ele > nxt: Stack.push(stack, ele) 'push next to stack so that we can find next greater for it ' Stack.push(stack, nxt) '\n After iterating over the loop, the remaining\n elements in stack do not have the next greater\n element, so print -1 for them \n ' while not Stack.is_empty(stack): ele = Stack.pop(stack) nxt = -1 temp.append(nxt) print(array) print(temp) if __name__ == '__main__': arr = [12, 15, 22, 9, 7, 2, 18, 23, 27] find_next_greater_ele_in_array(arr) find_next_greater_ele_in_array_using_stack(arr)
N = int(input()) list = [] for _ in range(N): command = input().rstrip().split() if "insert" in command: i = int(command[1]) e = int(command[2]) list.insert(i, e) elif "print" in command: print(list) elif "remove" in command: i = int(command[1]) list.remove(i) elif "append" in command: i = int(command[1]) list.append(i) elif "sort" in command: list = sorted(list) elif "pop" in command: list.pop() elif "reverse" in command: reversed = [] for _ in range(len(list)): reversed.append(list.pop()) list = reversed else: None
n = int(input()) list = [] for _ in range(N): command = input().rstrip().split() if 'insert' in command: i = int(command[1]) e = int(command[2]) list.insert(i, e) elif 'print' in command: print(list) elif 'remove' in command: i = int(command[1]) list.remove(i) elif 'append' in command: i = int(command[1]) list.append(i) elif 'sort' in command: list = sorted(list) elif 'pop' in command: list.pop() elif 'reverse' in command: reversed = [] for _ in range(len(list)): reversed.append(list.pop()) list = reversed else: None
# Store all kinds of lookup table. # # generate rsPoly lookup table. # from qrcode import base # def create_bytes(rs_blocks): # for r in range(len(rs_blocks)): # dcCount = rs_blocks[r].data_count # ecCount = rs_blocks[r].total_count - dcCount # rsPoly = base.Polynomial([1], 0) # for i in range(ecCount): # rsPoly = rsPoly * base.Polynomial([1, base.gexp(i)], 0) # return ecCount, rsPoly # rsPoly_LUT = {} # for version in range(1,41): # for error_correction in range(4): # rs_blocks_list = base.rs_blocks(version, error_correction) # ecCount, rsPoly = create_bytes(rs_blocks_list) # rsPoly_LUT[ecCount]=rsPoly.num # print(rsPoly_LUT) # Result. Usage: input: ecCount, output: Polynomial.num # e.g. rsPoly = base.Polynomial(LUT.rsPoly_LUT[ecCount], 0) rsPoly_LUT = { 7: [1, 127, 122, 154, 164, 11, 68, 117], 10: [1, 216, 194, 159, 111, 199, 94, 95, 113, 157, 193], 13: [1, 137, 73, 227, 17, 177, 17, 52, 13, 46, 43, 83, 132, 120], 15: [1, 29, 196, 111, 163, 112, 74, 10, 105, 105, 139, 132, 151, 32, 134, 26], 16: [1, 59, 13, 104, 189, 68, 209, 30, 8, 163, 65, 41, 229, 98, 50, 36, 59], 17: [1, 119, 66, 83, 120, 119, 22, 197, 83, 249, 41, 143, 134, 85, 53, 125, 99, 79], 18: [1, 239, 251, 183, 113, 149, 175, 199, 215, 240, 220, 73, 82, 173, 75, 32, 67, 217, 146], 20: [1, 152, 185, 240, 5, 111, 99, 6, 220, 112, 150, 69, 36, 187, 22, 228, 198, 121, 121, 165, 174], 22: [1, 89, 179, 131, 176, 182, 244, 19, 189, 69, 40, 28, 137, 29, 123, 67, 253, 86, 218, 230, 26, 145, 245], 24: [1, 122, 118, 169, 70, 178, 237, 216, 102, 115, 150, 229, 73, 130, 72, 61, 43, 206, 1, 237, 247, 127, 217, 144, 117], 26: [1, 246, 51, 183, 4, 136, 98, 199, 152, 77, 56, 206, 24, 145, 40, 209, 117, 233, 42, 135, 68, 70, 144, 146, 77, 43, 94], 28: [1, 252, 9, 28, 13, 18, 251, 208, 150, 103, 174, 100, 41, 167, 12, 247, 56, 117, 119, 233, 127, 181, 100, 121, 147, 176, 74, 58, 197], 30: [1, 212, 246, 77, 73, 195, 192, 75, 98, 5, 70, 103, 177, 22, 217, 138, 51, 181, 246, 72, 25, 18, 46, 228, 74, 216, 195, 11, 106, 130, 150] }
rs_poly_lut = {7: [1, 127, 122, 154, 164, 11, 68, 117], 10: [1, 216, 194, 159, 111, 199, 94, 95, 113, 157, 193], 13: [1, 137, 73, 227, 17, 177, 17, 52, 13, 46, 43, 83, 132, 120], 15: [1, 29, 196, 111, 163, 112, 74, 10, 105, 105, 139, 132, 151, 32, 134, 26], 16: [1, 59, 13, 104, 189, 68, 209, 30, 8, 163, 65, 41, 229, 98, 50, 36, 59], 17: [1, 119, 66, 83, 120, 119, 22, 197, 83, 249, 41, 143, 134, 85, 53, 125, 99, 79], 18: [1, 239, 251, 183, 113, 149, 175, 199, 215, 240, 220, 73, 82, 173, 75, 32, 67, 217, 146], 20: [1, 152, 185, 240, 5, 111, 99, 6, 220, 112, 150, 69, 36, 187, 22, 228, 198, 121, 121, 165, 174], 22: [1, 89, 179, 131, 176, 182, 244, 19, 189, 69, 40, 28, 137, 29, 123, 67, 253, 86, 218, 230, 26, 145, 245], 24: [1, 122, 118, 169, 70, 178, 237, 216, 102, 115, 150, 229, 73, 130, 72, 61, 43, 206, 1, 237, 247, 127, 217, 144, 117], 26: [1, 246, 51, 183, 4, 136, 98, 199, 152, 77, 56, 206, 24, 145, 40, 209, 117, 233, 42, 135, 68, 70, 144, 146, 77, 43, 94], 28: [1, 252, 9, 28, 13, 18, 251, 208, 150, 103, 174, 100, 41, 167, 12, 247, 56, 117, 119, 233, 127, 181, 100, 121, 147, 176, 74, 58, 197], 30: [1, 212, 246, 77, 73, 195, 192, 75, 98, 5, 70, 103, 177, 22, 217, 138, 51, 181, 246, 72, 25, 18, 46, 228, 74, 216, 195, 11, 106, 130, 150]}
#!/bin/python3 # coding: utf-8 print ('input name: ') name = input() print ('input passwd: ') passwd = input() if name == 'A': print('A') if passwd == 'BB': print('BB') else: print('Other!')
print('input name: ') name = input() print('input passwd: ') passwd = input() if name == 'A': print('A') if passwd == 'BB': print('BB') else: print('Other!')
# Created by MechAviv # Map ID :: 940001050 # Hidden Street : East Pantheon sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) OBJECT_1 = sm.sendNpcController(3000107, -2000, 20) sm.showNpcSpecialActionByObjectId(OBJECT_1, "summon", 0) sm.setSpeakerID(3000107) sm.removeEscapeButton() sm.flipDialoguePlayerAsSpeaker() sm.setSpeakerType(3) sm.sendNext("There are Specters here as well?") sm.setSpeakerID(3000107) sm.removeEscapeButton() sm.setSpeakerType(3) sm.sendSay("The situation might be more serious than I expected.") sm.forcedInput(1) sm.sendDelay(30) sm.forcedInput(0) sm.setSpeakerID(3000107) sm.removeEscapeButton() sm.setPlayerAsSpeaker() sm.setSpeakerType(3) sm.sendNext("This isn't good. Go back and activate the shield as soon as possible.") sm.setSpeakerID(3000107) sm.removeEscapeButton() sm.setSpeakerType(3) sm.sendSay("This is precisely when you need the most help. Even if you are Kaiser, you can't make it by yourself...") sm.setSpeakerID(3000107) sm.removeEscapeButton() sm.setPlayerAsSpeaker() sm.setSpeakerType(3) sm.sendSay("Cartalion, you are a knight of Nova. Your first duty is always to the people of Nova. You must protect them, not me. As Kaiser, I fight for others, not the other way around.") sm.setSpeakerID(3000107) sm.removeEscapeButton() sm.setSpeakerType(3) sm.sendSay("As you wish. Good luck out there.") sm.sendDelay(1000) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(False, True, False, False) sm.warp(940001100, 0)
sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) object_1 = sm.sendNpcController(3000107, -2000, 20) sm.showNpcSpecialActionByObjectId(OBJECT_1, 'summon', 0) sm.setSpeakerID(3000107) sm.removeEscapeButton() sm.flipDialoguePlayerAsSpeaker() sm.setSpeakerType(3) sm.sendNext('There are Specters here as well?') sm.setSpeakerID(3000107) sm.removeEscapeButton() sm.setSpeakerType(3) sm.sendSay('The situation might be more serious than I expected.') sm.forcedInput(1) sm.sendDelay(30) sm.forcedInput(0) sm.setSpeakerID(3000107) sm.removeEscapeButton() sm.setPlayerAsSpeaker() sm.setSpeakerType(3) sm.sendNext("This isn't good. Go back and activate the shield as soon as possible.") sm.setSpeakerID(3000107) sm.removeEscapeButton() sm.setSpeakerType(3) sm.sendSay("This is precisely when you need the most help. Even if you are Kaiser, you can't make it by yourself...") sm.setSpeakerID(3000107) sm.removeEscapeButton() sm.setPlayerAsSpeaker() sm.setSpeakerType(3) sm.sendSay('Cartalion, you are a knight of Nova. Your first duty is always to the people of Nova. You must protect them, not me. As Kaiser, I fight for others, not the other way around.') sm.setSpeakerID(3000107) sm.removeEscapeButton() sm.setSpeakerType(3) sm.sendSay('As you wish. Good luck out there.') sm.sendDelay(1000) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(False, True, False, False) sm.warp(940001100, 0)
subreddit = "quackers987" #CHANGE THIS #Multiple subreddits can be specified by joining them with pluses, for example AskReddit+NoStupidQuestions. fileLog = "imageRemoveLog.txt" neededModPermissions = ['posts', 'flair'] removeSubmission = False logFullInfo = False checkResolution = True minHeight = 800 minWidth = 800 lowResReply = f"Your submission has been removed as it was deemed to be low resolution (less than {minWidth} x {minHeight})." lowResPostFlairID = "90320684-d8c4-11eb-8b59-0e83c0f77ef7" #CHANGE THIS checkImgDomain = False acceptedDomain = ["i.redd.it", "i.imgur.com"] wrongDomainReply = f"Your submission has been removed as it was deemed to be posted to a disallowed domain. Allowed domains are {acceptedDomain}" wrongDomainPostFlairID = "4f78c98a-d8d2-11eb-bf32-0e0b42d5cc2b" #CHANGE THIS
subreddit = 'quackers987' file_log = 'imageRemoveLog.txt' needed_mod_permissions = ['posts', 'flair'] remove_submission = False log_full_info = False check_resolution = True min_height = 800 min_width = 800 low_res_reply = f'Your submission has been removed as it was deemed to be low resolution (less than {minWidth} x {minHeight}).' low_res_post_flair_id = '90320684-d8c4-11eb-8b59-0e83c0f77ef7' check_img_domain = False accepted_domain = ['i.redd.it', 'i.imgur.com'] wrong_domain_reply = f'Your submission has been removed as it was deemed to be posted to a disallowed domain. Allowed domains are {acceptedDomain}' wrong_domain_post_flair_id = '4f78c98a-d8d2-11eb-bf32-0e0b42d5cc2b'
# In Islandora 8 maps to Repository Item Content Type -> field_resource_type field # The field_resource_type field is a pointer to the Resource Types taxonomy # class Genre: def __init__(self): self.drupal_fieldname = 'field_genre' self.islandora_taxonomy = ['tags','genre'] self.mods_xpath = 'mods/genre' self.dc_designator = 'type' self.genre = '' def set_genre(self, genre): if isinstance(genre, str) and genre != '': self.genre = genre def get_genre(self): return self.genre def get_genre_fieldname(self): return self.drupal_fieldname
class Genre: def __init__(self): self.drupal_fieldname = 'field_genre' self.islandora_taxonomy = ['tags', 'genre'] self.mods_xpath = 'mods/genre' self.dc_designator = 'type' self.genre = '' def set_genre(self, genre): if isinstance(genre, str) and genre != '': self.genre = genre def get_genre(self): return self.genre def get_genre_fieldname(self): return self.drupal_fieldname
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup ------------------------------------------------------------------------------------------------------ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # # import os # import sys # sys.path.insert(0, os.path.abspath('.')) # -- Project information --------------------------------------------------------------------------------------------- project = 'nRF Asset Tracker' copyright = '2019-2021, Nordic Semiconductor ASA | nordicsemi.no' author = 'Nordic Semiconductor ASA | nordicsemi.no' # -- General configuration ------------------------------------------------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx_rtd_theme', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # These folders are copied to the documentation's HTML output html_static_path = ['_static'] # These paths are either relative to html_static_path # or fully qualified paths (eg. https://...) html_css_files = [ 'common.css', ] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # -- Options for HTML output ----------------------------------------------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = 'sphinx_rtd_theme' html_theme_options = { 'logo_only': True } # Enable the "Edit in GitHub link within the header of each page. html_context = { 'display_github': True, 'github_user': 'NordicSemiconductor', 'github_repo': 'asset-tracker-cloud-docs', 'github_version': 'saga' } master_doc = 'index' suppress_warnings = ['ref.ref']
project = 'nRF Asset Tracker' copyright = '2019-2021, Nordic Semiconductor ASA | nordicsemi.no' author = 'Nordic Semiconductor ASA | nordicsemi.no' extensions = ['sphinx_rtd_theme'] templates_path = ['_templates'] html_static_path = ['_static'] html_css_files = ['common.css'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] html_theme = 'sphinx_rtd_theme' html_theme_options = {'logo_only': True} html_context = {'display_github': True, 'github_user': 'NordicSemiconductor', 'github_repo': 'asset-tracker-cloud-docs', 'github_version': 'saga'} master_doc = 'index' suppress_warnings = ['ref.ref']
# Problem: Missing Number # Difficulty: Easy # Category: Array # Leetcode 268:https://leetcode.com/problems/missing-number/#/description # Description: """ Given an sorted array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [0, 1, 3] return 2. Note: Your algorithm should run in linear runtime complexity. Could you implement it using only constant extra space complexity? """ class Solution(object): def bit_manipulation(self, nums): missing = 0 i = 0 while i < len(nums): missing = missing ^ i ^ nums[i] i += 1 return missing ^ i obj = Solution() nums1 = [7, 5, 3, 4, 1, 0, 2] nums2 = [3, 0, 1, 2] print(obj.bit_manipulation(nums1)) print(obj.bit_manipulation(nums2))
""" Given an sorted array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [0, 1, 3] return 2. Note: Your algorithm should run in linear runtime complexity. Could you implement it using only constant extra space complexity? """ class Solution(object): def bit_manipulation(self, nums): missing = 0 i = 0 while i < len(nums): missing = missing ^ i ^ nums[i] i += 1 return missing ^ i obj = solution() nums1 = [7, 5, 3, 4, 1, 0, 2] nums2 = [3, 0, 1, 2] print(obj.bit_manipulation(nums1)) print(obj.bit_manipulation(nums2))
while True: num = int(input("Enter an even number: ")) if num % 2 == 0: break print("Thanks for following directions.")
while True: num = int(input('Enter an even number: ')) if num % 2 == 0: break print('Thanks for following directions.')
#Tuple is a collection of ordered items. A tuple is immutable in nature. #Refer https://docs.python.org/3/library/stdtypes.html?#tuples for more information person= ("Susan","Christopher","Bill","Susan") print(person) print(person[1]) x= person.count("Susan") print("Occurrence of 'Susan' in tuple is:" + str(x)) l=['apple','oranges'] print(tuple(l))
person = ('Susan', 'Christopher', 'Bill', 'Susan') print(person) print(person[1]) x = person.count('Susan') print("Occurrence of 'Susan' in tuple is:" + str(x)) l = ['apple', 'oranges'] print(tuple(l))
def get_sdm_query(query,lambda_t=0.8,lambda_o=0.1,lambda_u=0.1): words = query.split() if len(words)==1: return f"#combine( {query} )" terms = " ".join(words) ordered = "".join([" #1({}) ".format(" ".join(bigram)) for bigram in zip(words,words[1:])]) unordered = "".join([" #uw8({}) ".format(" ".join(bigram)) for bigram in zip(words,words[1:])]) indri_query = f"#weight({lambda_t} #combine( {terms} ) {lambda_o} #combine({ordered}) {lambda_u} #combine({unordered}))" return indri_query if __name__ == "__main__": query = "greta thunberg cross atlantic" print(get_sdm_query(query))
def get_sdm_query(query, lambda_t=0.8, lambda_o=0.1, lambda_u=0.1): words = query.split() if len(words) == 1: return f'#combine( {query} )' terms = ' '.join(words) ordered = ''.join([' #1({}) '.format(' '.join(bigram)) for bigram in zip(words, words[1:])]) unordered = ''.join([' #uw8({}) '.format(' '.join(bigram)) for bigram in zip(words, words[1:])]) indri_query = f'#weight({lambda_t} #combine( {terms} ) {lambda_o} #combine({ordered}) {lambda_u} #combine({unordered}))' return indri_query if __name__ == '__main__': query = 'greta thunberg cross atlantic' print(get_sdm_query(query))
"""Define common constants""" JOB_COMMAND_START = "start" JOB_COMMAND_CANCEL = "cancel" JOB_COMMAND_RESTART = "restart" JOB_COMMAND_PAUSE = "pause" JOB_COMMAND_PAUSE_PAUSE = "pause" JOB_COMMAND_PAUSE_RESUME = "resume" JOB_COMMAND_PAUSE_TOGGLE = "toggle" JOB_STATE_OPERATIONAL="Operational" JOB_STATE_PRINTING="Printing" JOB_STATE_PAUSING="Pausing" JOB_STATE_PAUSED="Paused" JOB_STATE_CANCELLING="Cancelling" JOB_STATE_ERROR="Error" JOB_STATE_OFFLINE="Offline"
"""Define common constants""" job_command_start = 'start' job_command_cancel = 'cancel' job_command_restart = 'restart' job_command_pause = 'pause' job_command_pause_pause = 'pause' job_command_pause_resume = 'resume' job_command_pause_toggle = 'toggle' job_state_operational = 'Operational' job_state_printing = 'Printing' job_state_pausing = 'Pausing' job_state_paused = 'Paused' job_state_cancelling = 'Cancelling' job_state_error = 'Error' job_state_offline = 'Offline'
def encode_structure_fold(fold, tree): def encode_node(node): if node.is_leaf(): return fold.add('boxEncoder', node.box) elif node.is_adj(): left = encode_node(node.left) right = encode_node(node.right) return fold.add('adjEncoder', left, right) elif node.is_sym(): feature = encode_node(node.left) sym = node.sym return fold.add('symEncoder', feature, sym) encoding = encode_node(tree.root) return fold.add('sampleEncoder', encoding) def decode_structure_fold(fold, feature, tree): def decode_node_box(node, feature): if node.is_leaf(): box = fold.add('boxDecoder', feature) recon_loss = fold.add('boxLossEstimator', box, node.box) label = fold.add('nodeClassifier', feature) label_loss = fold.add('classifyLossEstimator', label, node.label) return fold.add('vectorAdder', recon_loss, label_loss) elif node.is_adj(): left, right = fold.add('adjDecoder', feature).split(2) left_loss = decode_node_box(node.left, left) right_loss = decode_node_box(node.right, right) label = fold.add('nodeClassifier', feature) label_loss = fold.add('classifyLossEstimator', label, node.label) loss = fold.add('vectorAdder', left_loss, right_loss) return fold.add('vectorAdder', loss, label_loss) elif node.is_sym(): sym_gen, sym_param = fold.add('symDecoder', feature).split(2) sym_param_loss = fold.add('symLossEstimator', sym_param, node.sym) sym_gen_loss = decode_node_box(node.left, sym_gen) label = fold.add('nodeClassifier', feature) label_loss = fold.add('classifyLossEstimator', label, node.label) loss = fold.add('vectorAdder', sym_gen_loss, sym_param_loss) return fold.add('vectorAdder', loss, label_loss) feature = fold.add('sampleDecoder', feature) loss = decode_node_box(tree.root, feature) return loss
def encode_structure_fold(fold, tree): def encode_node(node): if node.is_leaf(): return fold.add('boxEncoder', node.box) elif node.is_adj(): left = encode_node(node.left) right = encode_node(node.right) return fold.add('adjEncoder', left, right) elif node.is_sym(): feature = encode_node(node.left) sym = node.sym return fold.add('symEncoder', feature, sym) encoding = encode_node(tree.root) return fold.add('sampleEncoder', encoding) def decode_structure_fold(fold, feature, tree): def decode_node_box(node, feature): if node.is_leaf(): box = fold.add('boxDecoder', feature) recon_loss = fold.add('boxLossEstimator', box, node.box) label = fold.add('nodeClassifier', feature) label_loss = fold.add('classifyLossEstimator', label, node.label) return fold.add('vectorAdder', recon_loss, label_loss) elif node.is_adj(): (left, right) = fold.add('adjDecoder', feature).split(2) left_loss = decode_node_box(node.left, left) right_loss = decode_node_box(node.right, right) label = fold.add('nodeClassifier', feature) label_loss = fold.add('classifyLossEstimator', label, node.label) loss = fold.add('vectorAdder', left_loss, right_loss) return fold.add('vectorAdder', loss, label_loss) elif node.is_sym(): (sym_gen, sym_param) = fold.add('symDecoder', feature).split(2) sym_param_loss = fold.add('symLossEstimator', sym_param, node.sym) sym_gen_loss = decode_node_box(node.left, sym_gen) label = fold.add('nodeClassifier', feature) label_loss = fold.add('classifyLossEstimator', label, node.label) loss = fold.add('vectorAdder', sym_gen_loss, sym_param_loss) return fold.add('vectorAdder', loss, label_loss) feature = fold.add('sampleDecoder', feature) loss = decode_node_box(tree.root, feature) return loss
# -*- coding: utf-8 -*- class TrieNode: def __init__(self): self.children = {} self.leaf = False class Trie: def __init__(self): self.root = TrieNode() def insert(self, word): current = self.root for char in word: if char not in current.children: current.children[char] = TrieNode() current = current.children[char] current.leaf = True def minimumLengthEncoding(self): result = 0 for child in self.root.children: result += self.depthOfLeaves(self.root.children[child], 1) return result def depthOfLeaves(self, current, length): if not current.children: return length + 1 result = 0 for child in current.children: result += self.depthOfLeaves(current.children[child], length + 1) return result class Solution: def minimumLengthEncoding(self, words): trie = Trie() for word in words: trie.insert(word[::-1]) return trie.minimumLengthEncoding() if __name__ == '__main__': solution = Solution() assert 10 == solution.minimumLengthEncoding(['time', 'me', 'bell']) assert 12 == solution.minimumLengthEncoding(['time', 'atime', 'btime'])
class Trienode: def __init__(self): self.children = {} self.leaf = False class Trie: def __init__(self): self.root = trie_node() def insert(self, word): current = self.root for char in word: if char not in current.children: current.children[char] = trie_node() current = current.children[char] current.leaf = True def minimum_length_encoding(self): result = 0 for child in self.root.children: result += self.depthOfLeaves(self.root.children[child], 1) return result def depth_of_leaves(self, current, length): if not current.children: return length + 1 result = 0 for child in current.children: result += self.depthOfLeaves(current.children[child], length + 1) return result class Solution: def minimum_length_encoding(self, words): trie = trie() for word in words: trie.insert(word[::-1]) return trie.minimumLengthEncoding() if __name__ == '__main__': solution = solution() assert 10 == solution.minimumLengthEncoding(['time', 'me', 'bell']) assert 12 == solution.minimumLengthEncoding(['time', 'atime', 'btime'])
class PID: """PID controller.""" def __init__(self, Kp, Ti, Td, Imax): self.Kp = Kp self.Ti = Ti self.Td = Td self.Imax = Imax self.clear() def clear(self): self.Cp = 0.0 self.Ci = 0.0 self.Cd = 0.0 self.previous_error = 0.0 def update(self, error, dt): de = error - self.previous_error self.previous_error = error self.Cp = self.Kp * error self.Ci += self.Kp * error * dt / self.Ti self.Ci = min(self.Ci, self.Imax) self.Ci = max(self.Ci, -self.Imax) self.Cd = self.Kp * self.Td * de / dt return self.Cp + self.Ci + self.Cd
class Pid: """PID controller.""" def __init__(self, Kp, Ti, Td, Imax): self.Kp = Kp self.Ti = Ti self.Td = Td self.Imax = Imax self.clear() def clear(self): self.Cp = 0.0 self.Ci = 0.0 self.Cd = 0.0 self.previous_error = 0.0 def update(self, error, dt): de = error - self.previous_error self.previous_error = error self.Cp = self.Kp * error self.Ci += self.Kp * error * dt / self.Ti self.Ci = min(self.Ci, self.Imax) self.Ci = max(self.Ci, -self.Imax) self.Cd = self.Kp * self.Td * de / dt return self.Cp + self.Ci + self.Cd
class DecimalPointFloatConverter: """ Custom Django converter for URLs. Parses floats with a decimal point (not with a comma!) Allows for integers too, parses values in this or similar form: - 100.0 - 100 Will NOT work for these forms: - 100.000.000 - 100,0 """ regex = "[0-9]*[.]?[0-9]*" def to_python(self, value): return float(value) def to_url(self, value): return str(value)
class Decimalpointfloatconverter: """ Custom Django converter for URLs. Parses floats with a decimal point (not with a comma!) Allows for integers too, parses values in this or similar form: - 100.0 - 100 Will NOT work for these forms: - 100.000.000 - 100,0 """ regex = '[0-9]*[.]?[0-9]*' def to_python(self, value): return float(value) def to_url(self, value): return str(value)
# dataset settings dataset_type = 'CUB' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='Resize', size=510), dict(type='RandomCrop', size=384), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict(type='Normalize', **img_norm_cfg), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label']) ] test_pipeline = [ dict(type='LoadImageFromFile'), dict(type='Resize', size=510), dict(type='CenterCrop', crop_size=384), dict(type='Normalize', **img_norm_cfg), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']) ] data_root = 'data/CUB_200_2011/' data = dict( samples_per_gpu=8, workers_per_gpu=2, train=dict( type=dataset_type, ann_file=data_root + 'images.txt', image_class_labels_file=data_root + 'image_class_labels.txt', train_test_split_file=data_root + 'train_test_split.txt', data_prefix=data_root + 'images', pipeline=train_pipeline), val=dict( type=dataset_type, ann_file=data_root + 'images.txt', image_class_labels_file=data_root + 'image_class_labels.txt', train_test_split_file=data_root + 'train_test_split.txt', data_prefix=data_root + 'images', test_mode=True, pipeline=test_pipeline), test=dict( type=dataset_type, ann_file=data_root + 'images.txt', image_class_labels_file=data_root + 'image_class_labels.txt', train_test_split_file=data_root + 'train_test_split.txt', data_prefix=data_root + 'images', test_mode=True, pipeline=test_pipeline)) evaluation = dict( interval=1, metric='accuracy', save_best='auto') # save the checkpoint with highest accuracy
dataset_type = 'CUB' img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [dict(type='LoadImageFromFile'), dict(type='Resize', size=510), dict(type='RandomCrop', size=384), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict(type='Normalize', **img_norm_cfg), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label'])] test_pipeline = [dict(type='LoadImageFromFile'), dict(type='Resize', size=510), dict(type='CenterCrop', crop_size=384), dict(type='Normalize', **img_norm_cfg), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img'])] data_root = 'data/CUB_200_2011/' data = dict(samples_per_gpu=8, workers_per_gpu=2, train=dict(type=dataset_type, ann_file=data_root + 'images.txt', image_class_labels_file=data_root + 'image_class_labels.txt', train_test_split_file=data_root + 'train_test_split.txt', data_prefix=data_root + 'images', pipeline=train_pipeline), val=dict(type=dataset_type, ann_file=data_root + 'images.txt', image_class_labels_file=data_root + 'image_class_labels.txt', train_test_split_file=data_root + 'train_test_split.txt', data_prefix=data_root + 'images', test_mode=True, pipeline=test_pipeline), test=dict(type=dataset_type, ann_file=data_root + 'images.txt', image_class_labels_file=data_root + 'image_class_labels.txt', train_test_split_file=data_root + 'train_test_split.txt', data_prefix=data_root + 'images', test_mode=True, pipeline=test_pipeline)) evaluation = dict(interval=1, metric='accuracy', save_best='auto')
# -*- coding: utf-8 -*- class Config: class MongoDB: database = "crawlib2_test"
class Config: class Mongodb: database = 'crawlib2_test'
months = "JanFebMarAprMayJunJulAugSepOctNovDec" n = int(input("Enter month Number: ")) if (n > 0 and n < 13): mE = (3 * n) mA = mE - 3 print(months[mA:mE]) else: print("falsche Zahl")
months = 'JanFebMarAprMayJunJulAugSepOctNovDec' n = int(input('Enter month Number: ')) if n > 0 and n < 13: m_e = 3 * n m_a = mE - 3 print(months[mA:mE]) else: print('falsche Zahl')
""" >>> getg() 5 >>> setg(42) >>> getg() 42 """ g = 5 def setg(a): global g g = a def getg(): return g class Test(object): """ >>> global_in_class 9 >>> Test.global_in_class Traceback (most recent call last): AttributeError: type object 'Test' has no attribute 'global_in_class' >>> Test().global_in_class Traceback (most recent call last): AttributeError: 'Test' object has no attribute 'global_in_class' """ global global_in_class global_in_class = 9
""" >>> getg() 5 >>> setg(42) >>> getg() 42 """ g = 5 def setg(a): global g g = a def getg(): return g class Test(object): """ >>> global_in_class 9 >>> Test.global_in_class Traceback (most recent call last): AttributeError: type object 'Test' has no attribute 'global_in_class' >>> Test().global_in_class Traceback (most recent call last): AttributeError: 'Test' object has no attribute 'global_in_class' """ global global_in_class global_in_class = 9
#!python with open('pessoas.csv') as arquivo: with open('pessoas.txt', 'w') as saida: for registro in arquivo: pessoa = registro.strip().split(',') print('Nome:{}, Idade:{}'.format(*pessoa), file=saida) if saida.closed: print('Saida OK') if arquivo.closed: print('saida ok')
with open('pessoas.csv') as arquivo: with open('pessoas.txt', 'w') as saida: for registro in arquivo: pessoa = registro.strip().split(',') print('Nome:{}, Idade:{}'.format(*pessoa), file=saida) if saida.closed: print('Saida OK') if arquivo.closed: print('saida ok')
class ConfigError(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class MercuryUnsupportedService(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class MercuryConnectException(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class MercuriusRequestException(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class MercuriusHTTPException(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class MercuriusHeaderException(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs)
class Configerror(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class Mercuryunsupportedservice(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class Mercuryconnectexception(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class Mercuriusrequestexception(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class Mercuriushttpexception(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class Mercuriusheaderexception(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs)
####################################### graph={} graph["start"]["a"]=6 graph["start"]["b"]=2 graph["a"]={} graph["a"]["fin"]=1 graph["b"]={} graph["b"]["a"]=3 graph["b"]["fin"]=5 graph["fin"]={} ####################################### infinity = float("inf") costs={} costs["a"]=6 costs["b"]=2 costs["fin"]=infinity ####################################### ###### parents={} parents["a"]="start" parents["b"]="start" parents["fin"]=None ####################################### processed = [] node = find_lowest_cost_node(costs) while node is not None: cost = costs[node] neightbors = graph[node] for n in neightbors.key(): new_cost = cost+neightbors[n] if costs[n]> new_cost: costs[n]=new_cost parents[n]=node processed.append(node) node = find_lowest_cost_node(costs) def find_lowest_cost_node(costs): lowest_cost = float("inf") lowest_cost_node=None for node in costs: cost = costs[node] if cost < lowest_cost and node not in processed: lowest_cost = cost lowest_cost_node = node return lowest_cost_node
graph = {} graph['start']['a'] = 6 graph['start']['b'] = 2 graph['a'] = {} graph['a']['fin'] = 1 graph['b'] = {} graph['b']['a'] = 3 graph['b']['fin'] = 5 graph['fin'] = {} infinity = float('inf') costs = {} costs['a'] = 6 costs['b'] = 2 costs['fin'] = infinity parents = {} parents['a'] = 'start' parents['b'] = 'start' parents['fin'] = None processed = [] node = find_lowest_cost_node(costs) while node is not None: cost = costs[node] neightbors = graph[node] for n in neightbors.key(): new_cost = cost + neightbors[n] if costs[n] > new_cost: costs[n] = new_cost parents[n] = node processed.append(node) node = find_lowest_cost_node(costs) def find_lowest_cost_node(costs): lowest_cost = float('inf') lowest_cost_node = None for node in costs: cost = costs[node] if cost < lowest_cost and node not in processed: lowest_cost = cost lowest_cost_node = node return lowest_cost_node
## using the return statement in python ## execute fct and give the respond back def cube(num): ## expectin one num return num*num*num ## allows to return value to the caller print(cube(3)) ## return none result = cube(4) print(result)
def cube(num): return num * num * num print(cube(3)) result = cube(4) print(result)
def flatten(x): """Flatten a two-dimensional list into one-dimension. Todo: * Support flattening n-dimension list into one-dimension. Args: x (list of list of any): A two-dimension list. Returns: list of any: An one-dimension list. """ return [a for i in x for a in i] def replace_with_phrases(tokens, phrases): """Replace applicable tokens in semantically-ordered tokens with their corresponding phrase. Args: tokens (list of str): A list of semantically-ordered tokens. phrases (list of str): A list of phrases. Returns: list of str: A list of tokens which applicable tokens are replaced with a corresponding phrase. Examples: >>> print(tokens) ['it', 'is', 'straight', 'forward'] >>> print(phrases) ['straight forward'] >>> print(replace_with_phrases(tokens, phrases)) ['it', 'is', 'straight forward'] """ tempTokens = tokens.copy() for phrase in phrases: phraseTokens = phrase.split(' ') isPhrase = False for i in range(len(tempTokens) + 1 - len(phraseTokens)): matches = 0 for key, token in enumerate(phraseTokens): if tempTokens[i + key] == token: matches += 1 if matches == len(phraseTokens): isPhrase = True break if isPhrase: start = tempTokens.index(phraseTokens[0]) end = start + len(phraseTokens) tempTokens[start:end] = [' '.join(phraseTokens)] return tempTokens def append_with_phrases(tokens, phrases): """Append phrases to the tokens. Args: tokens (list of str): A list of tokens. phrases (list of str): A list of phrases. Returns: list of str: A concatinated list of tokens and phrases. """ return tokens + phrases
def flatten(x): """Flatten a two-dimensional list into one-dimension. Todo: * Support flattening n-dimension list into one-dimension. Args: x (list of list of any): A two-dimension list. Returns: list of any: An one-dimension list. """ return [a for i in x for a in i] def replace_with_phrases(tokens, phrases): """Replace applicable tokens in semantically-ordered tokens with their corresponding phrase. Args: tokens (list of str): A list of semantically-ordered tokens. phrases (list of str): A list of phrases. Returns: list of str: A list of tokens which applicable tokens are replaced with a corresponding phrase. Examples: >>> print(tokens) ['it', 'is', 'straight', 'forward'] >>> print(phrases) ['straight forward'] >>> print(replace_with_phrases(tokens, phrases)) ['it', 'is', 'straight forward'] """ temp_tokens = tokens.copy() for phrase in phrases: phrase_tokens = phrase.split(' ') is_phrase = False for i in range(len(tempTokens) + 1 - len(phraseTokens)): matches = 0 for (key, token) in enumerate(phraseTokens): if tempTokens[i + key] == token: matches += 1 if matches == len(phraseTokens): is_phrase = True break if isPhrase: start = tempTokens.index(phraseTokens[0]) end = start + len(phraseTokens) tempTokens[start:end] = [' '.join(phraseTokens)] return tempTokens def append_with_phrases(tokens, phrases): """Append phrases to the tokens. Args: tokens (list of str): A list of tokens. phrases (list of str): A list of phrases. Returns: list of str: A concatinated list of tokens and phrases. """ return tokens + phrases
# Used when we want to process an array of requests through a chain of handlers. Respective handler processes the request depending on the value, and send the request to the successor handler if not handled at that handler. class Handler: def __init__(self, successor): self.successor = successor def handle(self, request): handled = self._handle(request) if not handled: print("-- Refering to successor,", request) self.successor.handle(request) def _handle(self, request): raise NotImplementedError("NotImplementedError") class HandlerOne(Handler): def _handle(self, request): if 0 < request < 10: print("Handled by H-One", request) return True class HandlerTwo(Handler): def _handle(self, request): if request < 25: print("Handled by H-Two", request) return True class DefaultHandler(Handler): def _handle(self, request): print("End of chain", request) return True class Client: def __init__(self): self.handler = HandlerOne(HandlerTwo(DefaultHandler(None))) def delegate(self, requests): for r in requests: self.handler.handle(r) c = Client() requests = [1, 2, 3, 24, 30] c.delegate(requests)
class Handler: def __init__(self, successor): self.successor = successor def handle(self, request): handled = self._handle(request) if not handled: print('-- Refering to successor,', request) self.successor.handle(request) def _handle(self, request): raise not_implemented_error('NotImplementedError') class Handlerone(Handler): def _handle(self, request): if 0 < request < 10: print('Handled by H-One', request) return True class Handlertwo(Handler): def _handle(self, request): if request < 25: print('Handled by H-Two', request) return True class Defaulthandler(Handler): def _handle(self, request): print('End of chain', request) return True class Client: def __init__(self): self.handler = handler_one(handler_two(default_handler(None))) def delegate(self, requests): for r in requests: self.handler.handle(r) c = client() requests = [1, 2, 3, 24, 30] c.delegate(requests)
def brac_balance(expr): stack = [] for char in expr: if char in ["(", "{", "["]: stack.append(char) else: if not stack: return False current_char = stack.pop() if current_char == '(': if char != ")": return False if current_char == '{': if char != "}": return False if current_char == '[': if char != "]": return False if stack: return False return True if __name__ == "__main__": expr = input('enter bracs as per your need ') if brac_balance(expr): print("true") else: print('false')
def brac_balance(expr): stack = [] for char in expr: if char in ['(', '{', '[']: stack.append(char) else: if not stack: return False current_char = stack.pop() if current_char == '(': if char != ')': return False if current_char == '{': if char != '}': return False if current_char == '[': if char != ']': return False if stack: return False return True if __name__ == '__main__': expr = input('enter bracs as per your need ') if brac_balance(expr): print('true') else: print('false')
# Stack implementation ''' Stack using python list. Use append to push an item onto the stack and pop to remove an item ''' my_stack = list() my_stack.append(4) my_stack.append(7) my_stack.append(12) my_stack.append(19) print(my_stack) print(my_stack.pop()) # 19 print(my_stack.pop()) # 12 print(my_stack) # [4,7]
""" Stack using python list. Use append to push an item onto the stack and pop to remove an item """ my_stack = list() my_stack.append(4) my_stack.append(7) my_stack.append(12) my_stack.append(19) print(my_stack) print(my_stack.pop()) print(my_stack.pop()) print(my_stack)
class LED_80_64: keySize = 64 T0 = [0x00BB00DD00AA0055, 0x00BA00D100AE0057, 0x00BC00DF00A5005B, 0x00B500D900A7005A, 0x00B100DC00A40052, 0x00B000D000A00050, 0x00B700D200AF005E, 0x00B900D600A20051, 0x00B600DE00AB005C, 0x00BF00D800A9005D, 0x00BD00D300A10059, 0x00B300D700AC0056, 0x00B800DA00A60053, 0x00BE00D400AD005F, 0x00B200DB00A80054, 0x00B400D500A30058, 0x00AB001D00EA0075, 0x00AA001100EE0077, 0x00AC001F00E5007B, 0x00A5001900E7007A, 0x00A1001C00E40072, 0x00A0001000E00070, 0x00A7001200EF007E, 0x00A9001600E20071, 0x00A6001E00EB007C, 0x00AF001800E9007D, 0x00AD001300E10079, 0x00A3001700EC0076, 0x00A8001A00E60073, 0x00AE001400ED007F, 0x00A2001B00E80074, 0x00A4001500E30078, 0x00CB00FD005A00B5, 0x00CA00F1005E00B7, 0x00CC00FF005500BB, 0x00C500F9005700BA, 0x00C100FC005400B2, 0x00C000F0005000B0, 0x00C700F2005F00BE, 0x00C900F6005200B1, 0x00C600FE005B00BC, 0x00CF00F8005900BD, 0x00CD00F3005100B9, 0x00C300F7005C00B6, 0x00C800FA005600B3, 0x00CE00F4005D00BF, 0x00C200FB005800B4, 0x00C400F5005300B8, 0x005B009D007A00A5, 0x005A0091007E00A7, 0x005C009F007500AB, 0x00550099007700AA, 0x0051009C007400A2, 0x00500090007000A0, 0x00570092007F00AE, 0x00590096007200A1, 0x0056009E007B00AC, 0x005F0098007900AD, 0x005D0093007100A9, 0x00530097007C00A6, 0x0058009A007600A3, 0x005E0094007D00AF, 0x0052009B007800A4, 0x00540095007300A8, 0x001B00CD004A0025, 0x001A00C1004E0027, 0x001C00CF0045002B, 0x001500C90047002A, 0x001100CC00440022, 0x001000C000400020, 0x001700C2004F002E, 0x001900C600420021, 0x001600CE004B002C, 0x001F00C80049002D, 0x001D00C300410029, 0x001300C7004C0026, 0x001800CA00460023, 0x001E00C4004D002F, 0x001200CB00480024, 0x001400C500430028, 0x000B000D000A0005, 0x000A0001000E0007, 0x000C000F0005000B, 0x000500090007000A, 0x0001000C00040002, 0x0000000000000000, 0x00070002000F000E, 0x0009000600020001, 0x0006000E000B000C, 0x000F00080009000D, 0x000D000300010009, 0x00030007000C0006, 0x0008000A00060003, 0x000E0004000D000F, 0x0002000B00080004, 0x0004000500030008, 0x007B002D00FA00E5, 0x007A002100FE00E7, 0x007C002F00F500EB, 0x0075002900F700EA, 0x0071002C00F400E2, 0x0070002000F000E0, 0x0077002200FF00EE, 0x0079002600F200E1, 0x0076002E00FB00EC, 0x007F002800F900ED, 0x007D002300F100E9, 0x0073002700FC00E6, 0x0078002A00F600E3, 0x007E002400FD00EF, 0x0072002B00F800E4, 0x0074002500F300E8, 0x009B006D002A0015, 0x009A0061002E0017, 0x009C006F0025001B, 0x009500690027001A, 0x0091006C00240012, 0x0090006000200010, 0x00970062002F001E, 0x0099006600220011, 0x0096006E002B001C, 0x009F00680029001D, 0x009D006300210019, 0x00930067002C0016, 0x0098006A00260013, 0x009E0064002D001F, 0x0092006B00280014, 0x0094006500230018, 0x006B00ED00BA00C5, 0x006A00E100BE00C7, 0x006C00EF00B500CB, 0x006500E900B700CA, 0x006100EC00B400C2, 0x006000E000B000C0, 0x006700E200BF00CE, 0x006900E600B200C1, 0x006600EE00BB00CC, 0x006F00E800B900CD, 0x006D00E300B100C9, 0x006300E700BC00C6, 0x006800EA00B600C3, 0x006E00E400BD00CF, 0x006200EB00B800C4, 0x006400E500B300C8, 0x00FB008D009A00D5, 0x00FA0081009E00D7, 0x00FC008F009500DB, 0x00F50089009700DA, 0x00F1008C009400D2, 0x00F00080009000D0, 0x00F70082009F00DE, 0x00F90086009200D1, 0x00F6008E009B00DC, 0x00FF0088009900DD, 0x00FD0083009100D9, 0x00F30087009C00D6, 0x00F8008A009600D3, 0x00FE0084009D00DF, 0x00F2008B009800D4, 0x00F40085009300D8, 0x00DB003D001A0095, 0x00DA0031001E0097, 0x00DC003F0015009B, 0x00D500390017009A, 0x00D1003C00140092, 0x00D0003000100090, 0x00D70032001F009E, 0x00D9003600120091, 0x00D6003E001B009C, 0x00DF00380019009D, 0x00DD003300110099, 0x00D30037001C0096, 0x00D8003A00160093, 0x00DE0034001D009F, 0x00D2003B00180094, 0x00D4003500130098, 0x003B007D00CA0065, 0x003A007100CE0067, 0x003C007F00C5006B, 0x0035007900C7006A, 0x0031007C00C40062, 0x0030007000C00060, 0x0037007200CF006E, 0x0039007600C20061, 0x0036007E00CB006C, 0x003F007800C9006D, 0x003D007300C10069, 0x0033007700CC0066, 0x0038007A00C60063, 0x003E007400CD006F, 0x0032007B00C80064, 0x0034007500C30068, 0x008B00AD006A0035, 0x008A00A1006E0037, 0x008C00AF0065003B, 0x008500A90067003A, 0x008100AC00640032, 0x008000A000600030, 0x008700A2006F003E, 0x008900A600620031, 0x008600AE006B003C, 0x008F00A80069003D, 0x008D00A300610039, 0x008300A7006C0036, 0x008800AA00660033, 0x008E00A4006D003F, 0x008200AB00680034, 0x008400A500630038, 0x00EB004D00DA00F5, 0x00EA004100DE00F7, 0x00EC004F00D500FB, 0x00E5004900D700FA, 0x00E1004C00D400F2, 0x00E0004000D000F0, 0x00E7004200DF00FE, 0x00E9004600D200F1, 0x00E6004E00DB00FC, 0x00EF004800D900FD, 0x00ED004300D100F9, 0x00E3004700DC00F6, 0x00E8004A00D600F3, 0x00EE004400DD00FF, 0x00E2004B00D800F4, 0x00E4004500D300F8, 0x002B00BD008A0045, 0x002A00B1008E0047, 0x002C00BF0085004B, 0x002500B90087004A, 0x002100BC00840042, 0x002000B000800040, 0x002700B2008F004E, 0x002900B600820041, 0x002600BE008B004C, 0x002F00B80089004D, 0x002D00B300810049, 0x002300B7008C0046, 0x002800BA00860043, 0x002E00B4008D004F, 0x002200BB00880044, 0x002400B500830048, 0x004B005D003A0085, 0x004A0051003E0087, 0x004C005F0035008B, 0x004500590037008A, 0x0041005C00340082, 0x0040005000300080, 0x00470052003F008E, 0x0049005600320081, 0x0046005E003B008C, 0x004F00580039008D, 0x004D005300310089, 0x00430057003C0086, 0x0048005A00360083, 0x004E0054003D008F, 0x0042005B00380084, 0x0044005500330088] T1 = [0xBB00DD00AA005500, 0xBA00D100AE005700, 0xBC00DF00A5005B00, 0xB500D900A7005A00, 0xB100DC00A4005200, 0xB000D000A0005000, 0xB700D200AF005E00, 0xB900D600A2005100, 0xB600DE00AB005C00, 0xBF00D800A9005D00, 0xBD00D300A1005900, 0xB300D700AC005600, 0xB800DA00A6005300, 0xBE00D400AD005F00, 0xB200DB00A8005400, 0xB400D500A3005800, 0xAB001D00EA007500, 0xAA001100EE007700, 0xAC001F00E5007B00, 0xA5001900E7007A00, 0xA1001C00E4007200, 0xA0001000E0007000, 0xA7001200EF007E00, 0xA9001600E2007100, 0xA6001E00EB007C00, 0xAF001800E9007D00, 0xAD001300E1007900, 0xA3001700EC007600, 0xA8001A00E6007300, 0xAE001400ED007F00, 0xA2001B00E8007400, 0xA4001500E3007800, 0xCB00FD005A00B500, 0xCA00F1005E00B700, 0xCC00FF005500BB00, 0xC500F9005700BA00, 0xC100FC005400B200, 0xC000F0005000B000, 0xC700F2005F00BE00, 0xC900F6005200B100, 0xC600FE005B00BC00, 0xCF00F8005900BD00, 0xCD00F3005100B900, 0xC300F7005C00B600, 0xC800FA005600B300, 0xCE00F4005D00BF00, 0xC200FB005800B400, 0xC400F5005300B800, 0x5B009D007A00A500, 0x5A0091007E00A700, 0x5C009F007500AB00, 0x550099007700AA00, 0x51009C007400A200, 0x500090007000A000, 0x570092007F00AE00, 0x590096007200A100, 0x56009E007B00AC00, 0x5F0098007900AD00, 0x5D0093007100A900, 0x530097007C00A600, 0x58009A007600A300, 0x5E0094007D00AF00, 0x52009B007800A400, 0x540095007300A800, 0x1B00CD004A002500, 0x1A00C1004E002700, 0x1C00CF0045002B00, 0x1500C90047002A00, 0x1100CC0044002200, 0x1000C00040002000, 0x1700C2004F002E00, 0x1900C60042002100, 0x1600CE004B002C00, 0x1F00C80049002D00, 0x1D00C30041002900, 0x1300C7004C002600, 0x1800CA0046002300, 0x1E00C4004D002F00, 0x1200CB0048002400, 0x1400C50043002800, 0x0B000D000A000500, 0x0A0001000E000700, 0x0C000F0005000B00, 0x0500090007000A00, 0x01000C0004000200, 0x0000000000000000, 0x070002000F000E00, 0x0900060002000100, 0x06000E000B000C00, 0x0F00080009000D00, 0x0D00030001000900, 0x030007000C000600, 0x08000A0006000300, 0x0E0004000D000F00, 0x02000B0008000400, 0x0400050003000800, 0x7B002D00FA00E500, 0x7A002100FE00E700, 0x7C002F00F500EB00, 0x75002900F700EA00, 0x71002C00F400E200, 0x70002000F000E000, 0x77002200FF00EE00, 0x79002600F200E100, 0x76002E00FB00EC00, 0x7F002800F900ED00, 0x7D002300F100E900, 0x73002700FC00E600, 0x78002A00F600E300, 0x7E002400FD00EF00, 0x72002B00F800E400, 0x74002500F300E800, 0x9B006D002A001500, 0x9A0061002E001700, 0x9C006F0025001B00, 0x9500690027001A00, 0x91006C0024001200, 0x9000600020001000, 0x970062002F001E00, 0x9900660022001100, 0x96006E002B001C00, 0x9F00680029001D00, 0x9D00630021001900, 0x930067002C001600, 0x98006A0026001300, 0x9E0064002D001F00, 0x92006B0028001400, 0x9400650023001800, 0x6B00ED00BA00C500, 0x6A00E100BE00C700, 0x6C00EF00B500CB00, 0x6500E900B700CA00, 0x6100EC00B400C200, 0x6000E000B000C000, 0x6700E200BF00CE00, 0x6900E600B200C100, 0x6600EE00BB00CC00, 0x6F00E800B900CD00, 0x6D00E300B100C900, 0x6300E700BC00C600, 0x6800EA00B600C300, 0x6E00E400BD00CF00, 0x6200EB00B800C400, 0x6400E500B300C800, 0xFB008D009A00D500, 0xFA0081009E00D700, 0xFC008F009500DB00, 0xF50089009700DA00, 0xF1008C009400D200, 0xF00080009000D000, 0xF70082009F00DE00, 0xF90086009200D100, 0xF6008E009B00DC00, 0xFF0088009900DD00, 0xFD0083009100D900, 0xF30087009C00D600, 0xF8008A009600D300, 0xFE0084009D00DF00, 0xF2008B009800D400, 0xF40085009300D800, 0xDB003D001A009500, 0xDA0031001E009700, 0xDC003F0015009B00, 0xD500390017009A00, 0xD1003C0014009200, 0xD000300010009000, 0xD70032001F009E00, 0xD900360012009100, 0xD6003E001B009C00, 0xDF00380019009D00, 0xDD00330011009900, 0xD30037001C009600, 0xD8003A0016009300, 0xDE0034001D009F00, 0xD2003B0018009400, 0xD400350013009800, 0x3B007D00CA006500, 0x3A007100CE006700, 0x3C007F00C5006B00, 0x35007900C7006A00, 0x31007C00C4006200, 0x30007000C0006000, 0x37007200CF006E00, 0x39007600C2006100, 0x36007E00CB006C00, 0x3F007800C9006D00, 0x3D007300C1006900, 0x33007700CC006600, 0x38007A00C6006300, 0x3E007400CD006F00, 0x32007B00C8006400, 0x34007500C3006800, 0x8B00AD006A003500, 0x8A00A1006E003700, 0x8C00AF0065003B00, 0x8500A90067003A00, 0x8100AC0064003200, 0x8000A00060003000, 0x8700A2006F003E00, 0x8900A60062003100, 0x8600AE006B003C00, 0x8F00A80069003D00, 0x8D00A30061003900, 0x8300A7006C003600, 0x8800AA0066003300, 0x8E00A4006D003F00, 0x8200AB0068003400, 0x8400A50063003800, 0xEB004D00DA00F500, 0xEA004100DE00F700, 0xEC004F00D500FB00, 0xE5004900D700FA00, 0xE1004C00D400F200, 0xE0004000D000F000, 0xE7004200DF00FE00, 0xE9004600D200F100, 0xE6004E00DB00FC00, 0xEF004800D900FD00, 0xED004300D100F900, 0xE3004700DC00F600, 0xE8004A00D600F300, 0xEE004400DD00FF00, 0xE2004B00D800F400, 0xE4004500D300F800, 0x2B00BD008A004500, 0x2A00B1008E004700, 0x2C00BF0085004B00, 0x2500B90087004A00, 0x2100BC0084004200, 0x2000B00080004000, 0x2700B2008F004E00, 0x2900B60082004100, 0x2600BE008B004C00, 0x2F00B80089004D00, 0x2D00B30081004900, 0x2300B7008C004600, 0x2800BA0086004300, 0x2E00B4008D004F00, 0x2200BB0088004400, 0x2400B50083004800, 0x4B005D003A008500, 0x4A0051003E008700, 0x4C005F0035008B00, 0x4500590037008A00, 0x41005C0034008200, 0x4000500030008000, 0x470052003F008E00, 0x4900560032008100, 0x46005E003B008C00, 0x4F00580039008D00, 0x4D00530031008900, 0x430057003C008600, 0x48005A0036008300, 0x4E0054003D008F00, 0x42005B0038008400, 0x4400550033008800] T2 = [0xB00B4004E00EC00C, 0xA00B3004D00E500C, 0xC00B2004700E600C, 0x500B8004F00EB00C, 0x100B7004300E900C, 0x000B0004000E000C, 0x700B6004900EA00C, 0x900BA004800ED00C, 0x600B1004A00E300C, 0xF00BB004200EE00C, 0xD00B5004400EF00C, 0x300B9004500E800C, 0x800BD004B00E400C, 0xE00BC004100E700C, 0x200BE004600E100C, 0x400BF004C00E200C, 0xB00A4003E00DC005, 0xA00A3003D00D5005, 0xC00A2003700D6005, 0x500A8003F00DB005, 0x100A7003300D9005, 0x000A0003000D0005, 0x700A6003900DA005, 0x900AA003800DD005, 0x600A1003A00D3005, 0xF00AB003200DE005, 0xD00A5003400DF005, 0x300A9003500D8005, 0x800AD003B00D4005, 0xE00AC003100D7005, 0x200AE003600D1005, 0x400AF003C00D2005, 0xB00C4002E007C006, 0xA00C3002D0075006, 0xC00C200270076006, 0x500C8002F007B006, 0x100C700230079006, 0x000C000200070006, 0x700C60029007A006, 0x900CA0028007D006, 0x600C1002A0073006, 0xF00CB0022007E006, 0xD00C50024007F006, 0x300C900250078006, 0x800CD002B0074006, 0xE00CC00210077006, 0x200CE00260071006, 0x400CF002C0072006, 0xB0054008E00FC00B, 0xA0053008D00F500B, 0xC0052008700F600B, 0x50058008F00FB00B, 0x10057008300F900B, 0x00050008000F000B, 0x70056008900FA00B, 0x9005A008800FD00B, 0x60051008A00F300B, 0xF005B008200FE00B, 0xD0055008400FF00B, 0x30059008500F800B, 0x8005D008B00F400B, 0xE005C008100F700B, 0x2005E008600F100B, 0x4005F008C00F200B, 0xB0014007E003C009, 0xA0013007D0035009, 0xC001200770036009, 0x50018007F003B009, 0x1001700730039009, 0x0001000700030009, 0x700160079003A009, 0x9001A0078003D009, 0x60011007A0033009, 0xF001B0072003E009, 0xD00150074003F009, 0x3001900750038009, 0x8001D007B0034009, 0xE001C00710037009, 0x2001E00760031009, 0x4001F007C0032009, 0xB0004000E000C000, 0xA0003000D0005000, 0xC000200070006000, 0x50008000F000B000, 0x1000700030009000, 0x0000000000000000, 0x700060009000A000, 0x9000A0008000D000, 0x60001000A0003000, 0xF000B0002000E000, 0xD00050004000F000, 0x3000900050008000, 0x8000D000B0004000, 0xE000C00010007000, 0x2000E00060001000, 0x4000F000C0002000, 0xB0074006E009C00A, 0xA0073006D009500A, 0xC00720067009600A, 0x50078006F009B00A, 0x100770063009900A, 0x000700060009000A, 0x700760069009A00A, 0x9007A0068009D00A, 0x60071006A009300A, 0xF007B0062009E00A, 0xD00750064009F00A, 0x300790065009800A, 0x8007D006B009400A, 0xE007C0061009700A, 0x2007E0066009100A, 0x4007F006C009200A, 0xB009400AE008C00D, 0xA009300AD008500D, 0xC009200A7008600D, 0x5009800AF008B00D, 0x1009700A3008900D, 0x0009000A0008000D, 0x7009600A9008A00D, 0x9009A00A8008D00D, 0x6009100AA008300D, 0xF009B00A2008E00D, 0xD009500A4008F00D, 0x3009900A5008800D, 0x8009D00AB008400D, 0xE009C00A1008700D, 0x2009E00A6008100D, 0x4009F00AC008200D, 0xB0064001E00AC003, 0xA0063001D00A5003, 0xC0062001700A6003, 0x50068001F00AB003, 0x10067001300A9003, 0x00060001000A0003, 0x70066001900AA003, 0x9006A001800AD003, 0x60061001A00A3003, 0xF006B001200AE003, 0xD0065001400AF003, 0x30069001500A8003, 0x8006D001B00A4003, 0xE006C001100A7003, 0x2006E001600A1003, 0x4006F001C00A2003, 0xB00F400BE002C00E, 0xA00F300BD002500E, 0xC00F200B7002600E, 0x500F800BF002B00E, 0x100F700B3002900E, 0x000F000B0002000E, 0x700F600B9002A00E, 0x900FA00B8002D00E, 0x600F100BA002300E, 0xF00FB00B2002E00E, 0xD00F500B4002F00E, 0x300F900B5002800E, 0x800FD00BB002400E, 0xE00FC00B1002700E, 0x200FE00B6002100E, 0x400FF00BC002200E, 0xB00D4005E004C00F, 0xA00D3005D004500F, 0xC00D20057004600F, 0x500D8005F004B00F, 0x100D70053004900F, 0x000D00050004000F, 0x700D60059004A00F, 0x900DA0058004D00F, 0x600D1005A004300F, 0xF00DB0052004E00F, 0xD00D50054004F00F, 0x300D90055004800F, 0x800DD005B004400F, 0xE00DC0051004700F, 0x200DE0056004100F, 0x400DF005C004200F, 0xB0034009E005C008, 0xA0033009D0055008, 0xC003200970056008, 0x50038009F005B008, 0x1003700930059008, 0x0003000900050008, 0x700360099005A008, 0x9003A0098005D008, 0x60031009A0053008, 0xF003B0092005E008, 0xD00350094005F008, 0x3003900950058008, 0x8003D009B0054008, 0xE003C00910057008, 0x2003E00960051008, 0x4003F009C0052008, 0xB008400DE00BC004, 0xA008300DD00B5004, 0xC008200D700B6004, 0x5008800DF00BB004, 0x1008700D300B9004, 0x0008000D000B0004, 0x7008600D900BA004, 0x9008A00D800BD004, 0x6008100DA00B3004, 0xF008B00D200BE004, 0xD008500D400BF004, 0x3008900D500B8004, 0x8008D00DB00B4004, 0xE008C00D100B7004, 0x2008E00D600B1004, 0x4008F00DC00B2004, 0xB00E400CE001C007, 0xA00E300CD0015007, 0xC00E200C70016007, 0x500E800CF001B007, 0x100E700C30019007, 0x000E000C00010007, 0x700E600C9001A007, 0x900EA00C8001D007, 0x600E100CA0013007, 0xF00EB00C2001E007, 0xD00E500C4001F007, 0x300E900C50018007, 0x800ED00CB0014007, 0xE00EC00C10017007, 0x200EE00C60011007, 0x400EF00CC0012007, 0xB002400EE006C001, 0xA002300ED0065001, 0xC002200E70066001, 0x5002800EF006B001, 0x1002700E30069001, 0x0002000E00060001, 0x7002600E9006A001, 0x9002A00E8006D001, 0x6002100EA0063001, 0xF002B00E2006E001, 0xD002500E4006F001, 0x3002900E50068001, 0x8002D00EB0064001, 0xE002C00E10067001, 0x2002E00E60061001, 0x4002F00EC0062001, 0xB004400FE00CC002, 0xA004300FD00C5002, 0xC004200F700C6002, 0x5004800FF00CB002, 0x1004700F300C9002, 0x0004000F000C0002, 0x7004600F900CA002, 0x9004A00F800CD002, 0x6004100FA00C3002, 0xF004B00F200CE002, 0xD004500F400CF002, 0x3004900F500C8002, 0x8004D00FB00C4002, 0xE004C00F100C7002, 0x2004E00F600C1002, 0x4004F00FC00C2002] T3 = [0x0BB004400EE00CC0, 0x0BA004300ED00C50, 0x0BC004200E700C60, 0x0B5004800EF00CB0, 0x0B1004700E300C90, 0x0B0004000E000C00, 0x0B7004600E900CA0, 0x0B9004A00E800CD0, 0x0B6004100EA00C30, 0x0BF004B00E200CE0, 0x0BD004500E400CF0, 0x0B3004900E500C80, 0x0B8004D00EB00C40, 0x0BE004C00E100C70, 0x0B2004E00E600C10, 0x0B4004F00EC00C20, 0x0AB003400DE005C0, 0x0AA003300DD00550, 0x0AC003200D700560, 0x0A5003800DF005B0, 0x0A1003700D300590, 0x0A0003000D000500, 0x0A7003600D9005A0, 0x0A9003A00D8005D0, 0x0A6003100DA00530, 0x0AF003B00D2005E0, 0x0AD003500D4005F0, 0x0A3003900D500580, 0x0A8003D00DB00540, 0x0AE003C00D100570, 0x0A2003E00D600510, 0x0A4003F00DC00520, 0x0CB0024007E006C0, 0x0CA0023007D00650, 0x0CC0022007700660, 0x0C50028007F006B0, 0x0C10027007300690, 0x0C00020007000600, 0x0C700260079006A0, 0x0C9002A0078006D0, 0x0C60021007A00630, 0x0CF002B0072006E0, 0x0CD00250074006F0, 0x0C30029007500680, 0x0C8002D007B00640, 0x0CE002C007100670, 0x0C2002E007600610, 0x0C4002F007C00620, 0x05B008400FE00BC0, 0x05A008300FD00B50, 0x05C008200F700B60, 0x055008800FF00BB0, 0x051008700F300B90, 0x050008000F000B00, 0x057008600F900BA0, 0x059008A00F800BD0, 0x056008100FA00B30, 0x05F008B00F200BE0, 0x05D008500F400BF0, 0x053008900F500B80, 0x058008D00FB00B40, 0x05E008C00F100B70, 0x052008E00F600B10, 0x054008F00FC00B20, 0x01B0074003E009C0, 0x01A0073003D00950, 0x01C0072003700960, 0x0150078003F009B0, 0x0110077003300990, 0x0100070003000900, 0x01700760039009A0, 0x019007A0038009D0, 0x0160071003A00930, 0x01F007B0032009E0, 0x01D00750034009F0, 0x0130079003500980, 0x018007D003B00940, 0x01E007C003100970, 0x012007E003600910, 0x014007F003C00920, 0x00B0004000E000C0, 0x00A0003000D00050, 0x00C0002000700060, 0x0050008000F000B0, 0x0010007000300090, 0x0000000000000000, 0x00700060009000A0, 0x009000A0008000D0, 0x0060001000A00030, 0x00F000B0002000E0, 0x00D00050004000F0, 0x0030009000500080, 0x008000D000B00040, 0x00E000C000100070, 0x002000E000600010, 0x004000F000C00020, 0x07B0064009E00AC0, 0x07A0063009D00A50, 0x07C0062009700A60, 0x0750068009F00AB0, 0x0710067009300A90, 0x0700060009000A00, 0x0770066009900AA0, 0x079006A009800AD0, 0x0760061009A00A30, 0x07F006B009200AE0, 0x07D0065009400AF0, 0x0730069009500A80, 0x078006D009B00A40, 0x07E006C009100A70, 0x072006E009600A10, 0x074006F009C00A20, 0x09B00A4008E00DC0, 0x09A00A3008D00D50, 0x09C00A2008700D60, 0x09500A8008F00DB0, 0x09100A7008300D90, 0x09000A0008000D00, 0x09700A6008900DA0, 0x09900AA008800DD0, 0x09600A1008A00D30, 0x09F00AB008200DE0, 0x09D00A5008400DF0, 0x09300A9008500D80, 0x09800AD008B00D40, 0x09E00AC008100D70, 0x09200AE008600D10, 0x09400AF008C00D20, 0x06B001400AE003C0, 0x06A001300AD00350, 0x06C001200A700360, 0x065001800AF003B0, 0x061001700A300390, 0x060001000A000300, 0x067001600A9003A0, 0x069001A00A8003D0, 0x066001100AA00330, 0x06F001B00A2003E0, 0x06D001500A4003F0, 0x063001900A500380, 0x068001D00AB00340, 0x06E001C00A100370, 0x062001E00A600310, 0x064001F00AC00320, 0x0FB00B4002E00EC0, 0x0FA00B3002D00E50, 0x0FC00B2002700E60, 0x0F500B8002F00EB0, 0x0F100B7002300E90, 0x0F000B0002000E00, 0x0F700B6002900EA0, 0x0F900BA002800ED0, 0x0F600B1002A00E30, 0x0FF00BB002200EE0, 0x0FD00B5002400EF0, 0x0F300B9002500E80, 0x0F800BD002B00E40, 0x0FE00BC002100E70, 0x0F200BE002600E10, 0x0F400BF002C00E20, 0x0DB0054004E00FC0, 0x0DA0053004D00F50, 0x0DC0052004700F60, 0x0D50058004F00FB0, 0x0D10057004300F90, 0x0D00050004000F00, 0x0D70056004900FA0, 0x0D9005A004800FD0, 0x0D60051004A00F30, 0x0DF005B004200FE0, 0x0DD0055004400FF0, 0x0D30059004500F80, 0x0D8005D004B00F40, 0x0DE005C004100F70, 0x0D2005E004600F10, 0x0D4005F004C00F20, 0x03B0094005E008C0, 0x03A0093005D00850, 0x03C0092005700860, 0x0350098005F008B0, 0x0310097005300890, 0x0300090005000800, 0x03700960059008A0, 0x039009A0058008D0, 0x0360091005A00830, 0x03F009B0052008E0, 0x03D00950054008F0, 0x0330099005500880, 0x038009D005B00840, 0x03E009C005100870, 0x032009E005600810, 0x034009F005C00820, 0x08B00D400BE004C0, 0x08A00D300BD00450, 0x08C00D200B700460, 0x08500D800BF004B0, 0x08100D700B300490, 0x08000D000B000400, 0x08700D600B9004A0, 0x08900DA00B8004D0, 0x08600D100BA00430, 0x08F00DB00B2004E0, 0x08D00D500B4004F0, 0x08300D900B500480, 0x08800DD00BB00440, 0x08E00DC00B100470, 0x08200DE00B600410, 0x08400DF00BC00420, 0x0EB00C4001E007C0, 0x0EA00C3001D00750, 0x0EC00C2001700760, 0x0E500C8001F007B0, 0x0E100C7001300790, 0x0E000C0001000700, 0x0E700C60019007A0, 0x0E900CA0018007D0, 0x0E600C1001A00730, 0x0EF00CB0012007E0, 0x0ED00C50014007F0, 0x0E300C9001500780, 0x0E800CD001B00740, 0x0EE00CC001100770, 0x0E200CE001600710, 0x0E400CF001C00720, 0x02B00E4006E001C0, 0x02A00E3006D00150, 0x02C00E2006700160, 0x02500E8006F001B0, 0x02100E7006300190, 0x02000E0006000100, 0x02700E60069001A0, 0x02900EA0068001D0, 0x02600E1006A00130, 0x02F00EB0062001E0, 0x02D00E50064001F0, 0x02300E9006500180, 0x02800ED006B00140, 0x02E00EC006100170, 0x02200EE006600110, 0x02400EF006C00120, 0x04B00F400CE002C0, 0x04A00F300CD00250, 0x04C00F200C700260, 0x04500F800CF002B0, 0x04100F700C300290, 0x04000F000C000200, 0x04700F600C9002A0, 0x04900FA00C8002D0, 0x04600F100CA00230, 0x04F00FB00C2002E0, 0x04D00F500C4002F0, 0x04300F900C500280, 0x04800FD00CB00240, 0x04E00FC00C100270, 0x04200FE00C600210, 0x04400FF00CC00220] T4 = [0x880011009900BB00, 0x860014009200BA00, 0x840019009D00BC00, 0x830012009100B500, 0x8E0015009B00B100, 0x800010009000B000, 0x8C0018009400B700, 0x87001B009C00B900, 0x82001D009F00B600, 0x850016009300BF00, 0x8A001C009600BD00, 0x81001F009E00B300, 0x89001E009700B800, 0x8B0013009800BE00, 0x8F001A009500B200, 0x8D0017009A00B400, 0x680041002900AB00, 0x660044002200AA00, 0x640049002D00AC00, 0x630042002100A500, 0x6E0045002B00A100, 0x600040002000A000, 0x6C0048002400A700, 0x67004B002C00A900, 0x62004D002F00A600, 0x650046002300AF00, 0x6A004C002600AD00, 0x61004F002E00A300, 0x69004E002700A800, 0x6B0043002800AE00, 0x6F004A002500A200, 0x6D0047002A00A400, 0x48009100D900CB00, 0x46009400D200CA00, 0x44009900DD00CC00, 0x43009200D100C500, 0x4E009500DB00C100, 0x40009000D000C000, 0x4C009800D400C700, 0x47009B00DC00C900, 0x42009D00DF00C600, 0x45009600D300CF00, 0x4A009C00D600CD00, 0x41009F00DE00C300, 0x49009E00D700C800, 0x4B009300D800CE00, 0x4F009A00D500C200, 0x4D009700DA00C400, 0x3800210019005B00, 0x3600240012005A00, 0x340029001D005C00, 0x3300220011005500, 0x3E0025001B005100, 0x3000200010005000, 0x3C00280014005700, 0x37002B001C005900, 0x32002D001F005600, 0x3500260013005F00, 0x3A002C0016005D00, 0x31002F001E005300, 0x39002E0017005800, 0x3B00230018005E00, 0x3F002A0015005200, 0x3D0027001A005400, 0xE8005100B9001B00, 0xE6005400B2001A00, 0xE4005900BD001C00, 0xE3005200B1001500, 0xEE005500BB001100, 0xE0005000B0001000, 0xEC005800B4001700, 0xE7005B00BC001900, 0xE2005D00BF001600, 0xE5005600B3001F00, 0xEA005C00B6001D00, 0xE1005F00BE001300, 0xE9005E00B7001800, 0xEB005300B8001E00, 0xEF005A00B5001200, 0xED005700BA001400, 0x0800010009000B00, 0x0600040002000A00, 0x040009000D000C00, 0x0300020001000500, 0x0E0005000B000100, 0x0000000000000000, 0x0C00080004000700, 0x07000B000C000900, 0x02000D000F000600, 0x0500060003000F00, 0x0A000C0006000D00, 0x01000F000E000300, 0x09000E0007000800, 0x0B00030008000E00, 0x0F000A0005000200, 0x0D0007000A000400, 0xC800810049007B00, 0xC600840042007A00, 0xC40089004D007C00, 0xC300820041007500, 0xCE0085004B007100, 0xC000800040007000, 0xCC00880044007700, 0xC7008B004C007900, 0xC2008D004F007600, 0xC500860043007F00, 0xCA008C0046007D00, 0xC1008F004E007300, 0xC9008E0047007800, 0xCB00830048007E00, 0xCF008A0045007200, 0xCD0087004A007400, 0x7800B100C9009B00, 0x7600B400C2009A00, 0x7400B900CD009C00, 0x7300B200C1009500, 0x7E00B500CB009100, 0x7000B000C0009000, 0x7C00B800C4009700, 0x7700BB00CC009900, 0x7200BD00CF009600, 0x7500B600C3009F00, 0x7A00BC00C6009D00, 0x7100BF00CE009300, 0x7900BE00C7009800, 0x7B00B300C8009E00, 0x7F00BA00C5009200, 0x7D00B700CA009400, 0x2800D100F9006B00, 0x2600D400F2006A00, 0x2400D900FD006C00, 0x2300D200F1006500, 0x2E00D500FB006100, 0x2000D000F0006000, 0x2C00D800F4006700, 0x2700DB00FC006900, 0x2200DD00FF006600, 0x2500D600F3006F00, 0x2A00DC00F6006D00, 0x2100DF00FE006300, 0x2900DE00F7006800, 0x2B00D300F8006E00, 0x2F00DA00F5006200, 0x2D00D700FA006400, 0x580061003900FB00, 0x560064003200FA00, 0x540069003D00FC00, 0x530062003100F500, 0x5E0065003B00F100, 0x500060003000F000, 0x5C0068003400F700, 0x57006B003C00F900, 0x52006D003F00F600, 0x550066003300FF00, 0x5A006C003600FD00, 0x51006F003E00F300, 0x59006E003700F800, 0x5B0063003800FE00, 0x5F006A003500F200, 0x5D0067003A00F400, 0xA800C1006900DB00, 0xA600C4006200DA00, 0xA400C9006D00DC00, 0xA300C2006100D500, 0xAE00C5006B00D100, 0xA000C0006000D000, 0xAC00C8006400D700, 0xA700CB006C00D900, 0xA200CD006F00D600, 0xA500C6006300DF00, 0xAA00CC006600DD00, 0xA100CF006E00D300, 0xA900CE006700D800, 0xAB00C3006800DE00, 0xAF00CA006500D200, 0xAD00C7006A00D400, 0x1800F100E9003B00, 0x1600F400E2003A00, 0x1400F900ED003C00, 0x1300F200E1003500, 0x1E00F500EB003100, 0x1000F000E0003000, 0x1C00F800E4003700, 0x1700FB00EC003900, 0x1200FD00EF003600, 0x1500F600E3003F00, 0x1A00FC00E6003D00, 0x1100FF00EE003300, 0x1900FE00E7003800, 0x1B00F300E8003E00, 0x1F00FA00E5003200, 0x1D00F700EA003400, 0x9800E10079008B00, 0x9600E40072008A00, 0x9400E9007D008C00, 0x9300E20071008500, 0x9E00E5007B008100, 0x9000E00070008000, 0x9C00E80074008700, 0x9700EB007C008900, 0x9200ED007F008600, 0x9500E60073008F00, 0x9A00EC0076008D00, 0x9100EF007E008300, 0x9900EE0077008800, 0x9B00E30078008E00, 0x9F00EA0075008200, 0x9D00E7007A008400, 0xB80031008900EB00, 0xB60034008200EA00, 0xB40039008D00EC00, 0xB30032008100E500, 0xBE0035008B00E100, 0xB00030008000E000, 0xBC0038008400E700, 0xB7003B008C00E900, 0xB2003D008F00E600, 0xB50036008300EF00, 0xBA003C008600ED00, 0xB1003F008E00E300, 0xB9003E008700E800, 0xBB0033008800EE00, 0xBF003A008500E200, 0xBD0037008A00E400, 0xF800A10059002B00, 0xF600A40052002A00, 0xF400A9005D002C00, 0xF300A20051002500, 0xFE00A5005B002100, 0xF000A00050002000, 0xFC00A80054002700, 0xF700AB005C002900, 0xF200AD005F002600, 0xF500A60053002F00, 0xFA00AC0056002D00, 0xF100AF005E002300, 0xF900AE0057002800, 0xFB00A30058002E00, 0xFF00AA0055002200, 0xFD00A7005A002400, 0xD8007100A9004B00, 0xD6007400A2004A00, 0xD4007900AD004C00, 0xD3007200A1004500, 0xDE007500AB004100, 0xD0007000A0004000, 0xDC007800A4004700, 0xD7007B00AC004900, 0xD2007D00AF004600, 0xD5007600A3004F00, 0xDA007C00A6004D00, 0xD1007F00AE004300, 0xD9007E00A7004800, 0xDB007300A8004E00, 0xDF007A00A5004200, 0xDD007700AA004400] T5 = [0x00880011009900BB, 0x00860014009200BA, 0x00840019009D00BC, 0x00830012009100B5, 0x008E0015009B00B1, 0x00800010009000B0, 0x008C0018009400B7, 0x0087001B009C00B9, 0x0082001D009F00B6, 0x00850016009300BF, 0x008A001C009600BD, 0x0081001F009E00B3, 0x0089001E009700B8, 0x008B0013009800BE, 0x008F001A009500B2, 0x008D0017009A00B4, 0x00680041002900AB, 0x00660044002200AA, 0x00640049002D00AC, 0x00630042002100A5, 0x006E0045002B00A1, 0x00600040002000A0, 0x006C0048002400A7, 0x0067004B002C00A9, 0x0062004D002F00A6, 0x00650046002300AF, 0x006A004C002600AD, 0x0061004F002E00A3, 0x0069004E002700A8, 0x006B0043002800AE, 0x006F004A002500A2, 0x006D0047002A00A4, 0x0048009100D900CB, 0x0046009400D200CA, 0x0044009900DD00CC, 0x0043009200D100C5, 0x004E009500DB00C1, 0x0040009000D000C0, 0x004C009800D400C7, 0x0047009B00DC00C9, 0x0042009D00DF00C6, 0x0045009600D300CF, 0x004A009C00D600CD, 0x0041009F00DE00C3, 0x0049009E00D700C8, 0x004B009300D800CE, 0x004F009A00D500C2, 0x004D009700DA00C4, 0x003800210019005B, 0x003600240012005A, 0x00340029001D005C, 0x0033002200110055, 0x003E0025001B0051, 0x0030002000100050, 0x003C002800140057, 0x0037002B001C0059, 0x0032002D001F0056, 0x003500260013005F, 0x003A002C0016005D, 0x0031002F001E0053, 0x0039002E00170058, 0x003B00230018005E, 0x003F002A00150052, 0x003D0027001A0054, 0x00E8005100B9001B, 0x00E6005400B2001A, 0x00E4005900BD001C, 0x00E3005200B10015, 0x00EE005500BB0011, 0x00E0005000B00010, 0x00EC005800B40017, 0x00E7005B00BC0019, 0x00E2005D00BF0016, 0x00E5005600B3001F, 0x00EA005C00B6001D, 0x00E1005F00BE0013, 0x00E9005E00B70018, 0x00EB005300B8001E, 0x00EF005A00B50012, 0x00ED005700BA0014, 0x000800010009000B, 0x000600040002000A, 0x00040009000D000C, 0x0003000200010005, 0x000E0005000B0001, 0x0000000000000000, 0x000C000800040007, 0x0007000B000C0009, 0x0002000D000F0006, 0x000500060003000F, 0x000A000C0006000D, 0x0001000F000E0003, 0x0009000E00070008, 0x000B00030008000E, 0x000F000A00050002, 0x000D0007000A0004, 0x00C800810049007B, 0x00C600840042007A, 0x00C40089004D007C, 0x00C3008200410075, 0x00CE0085004B0071, 0x00C0008000400070, 0x00CC008800440077, 0x00C7008B004C0079, 0x00C2008D004F0076, 0x00C500860043007F, 0x00CA008C0046007D, 0x00C1008F004E0073, 0x00C9008E00470078, 0x00CB00830048007E, 0x00CF008A00450072, 0x00CD0087004A0074, 0x007800B100C9009B, 0x007600B400C2009A, 0x007400B900CD009C, 0x007300B200C10095, 0x007E00B500CB0091, 0x007000B000C00090, 0x007C00B800C40097, 0x007700BB00CC0099, 0x007200BD00CF0096, 0x007500B600C3009F, 0x007A00BC00C6009D, 0x007100BF00CE0093, 0x007900BE00C70098, 0x007B00B300C8009E, 0x007F00BA00C50092, 0x007D00B700CA0094, 0x002800D100F9006B, 0x002600D400F2006A, 0x002400D900FD006C, 0x002300D200F10065, 0x002E00D500FB0061, 0x002000D000F00060, 0x002C00D800F40067, 0x002700DB00FC0069, 0x002200DD00FF0066, 0x002500D600F3006F, 0x002A00DC00F6006D, 0x002100DF00FE0063, 0x002900DE00F70068, 0x002B00D300F8006E, 0x002F00DA00F50062, 0x002D00D700FA0064, 0x00580061003900FB, 0x00560064003200FA, 0x00540069003D00FC, 0x00530062003100F5, 0x005E0065003B00F1, 0x00500060003000F0, 0x005C0068003400F7, 0x0057006B003C00F9, 0x0052006D003F00F6, 0x00550066003300FF, 0x005A006C003600FD, 0x0051006F003E00F3, 0x0059006E003700F8, 0x005B0063003800FE, 0x005F006A003500F2, 0x005D0067003A00F4, 0x00A800C1006900DB, 0x00A600C4006200DA, 0x00A400C9006D00DC, 0x00A300C2006100D5, 0x00AE00C5006B00D1, 0x00A000C0006000D0, 0x00AC00C8006400D7, 0x00A700CB006C00D9, 0x00A200CD006F00D6, 0x00A500C6006300DF, 0x00AA00CC006600DD, 0x00A100CF006E00D3, 0x00A900CE006700D8, 0x00AB00C3006800DE, 0x00AF00CA006500D2, 0x00AD00C7006A00D4, 0x001800F100E9003B, 0x001600F400E2003A, 0x001400F900ED003C, 0x001300F200E10035, 0x001E00F500EB0031, 0x001000F000E00030, 0x001C00F800E40037, 0x001700FB00EC0039, 0x001200FD00EF0036, 0x001500F600E3003F, 0x001A00FC00E6003D, 0x001100FF00EE0033, 0x001900FE00E70038, 0x001B00F300E8003E, 0x001F00FA00E50032, 0x001D00F700EA0034, 0x009800E10079008B, 0x009600E40072008A, 0x009400E9007D008C, 0x009300E200710085, 0x009E00E5007B0081, 0x009000E000700080, 0x009C00E800740087, 0x009700EB007C0089, 0x009200ED007F0086, 0x009500E60073008F, 0x009A00EC0076008D, 0x009100EF007E0083, 0x009900EE00770088, 0x009B00E30078008E, 0x009F00EA00750082, 0x009D00E7007A0084, 0x00B80031008900EB, 0x00B60034008200EA, 0x00B40039008D00EC, 0x00B30032008100E5, 0x00BE0035008B00E1, 0x00B00030008000E0, 0x00BC0038008400E7, 0x00B7003B008C00E9, 0x00B2003D008F00E6, 0x00B50036008300EF, 0x00BA003C008600ED, 0x00B1003F008E00E3, 0x00B9003E008700E8, 0x00BB0033008800EE, 0x00BF003A008500E2, 0x00BD0037008A00E4, 0x00F800A10059002B, 0x00F600A40052002A, 0x00F400A9005D002C, 0x00F300A200510025, 0x00FE00A5005B0021, 0x00F000A000500020, 0x00FC00A800540027, 0x00F700AB005C0029, 0x00F200AD005F0026, 0x00F500A60053002F, 0x00FA00AC0056002D, 0x00F100AF005E0023, 0x00F900AE00570028, 0x00FB00A30058002E, 0x00FF00AA00550022, 0x00FD00A7005A0024, 0x00D8007100A9004B, 0x00D6007400A2004A, 0x00D4007900AD004C, 0x00D3007200A10045, 0x00DE007500AB0041, 0x00D0007000A00040, 0x00DC007800A40047, 0x00D7007B00AC0049, 0x00D2007D00AF0046, 0x00D5007600A3004F, 0x00DA007C00A6004D, 0x00D1007F00AE0043, 0x00D9007E00A70048, 0x00DB007300A8004E, 0x00DF007A00A50042, 0x00DD007700AA0044] T6 = [0x0DD006600EE00BB0, 0x0D1006B00ED00BA0, 0x0DF006300E700BC0, 0x0D9006C00EF00B50, 0x0DC006D00E300B10, 0x0D0006000E000B00, 0x0D2006500E900B70, 0x0D6006F00E800B90, 0x0DE006800EA00B60, 0x0D8006700E200BF0, 0x0D3006E00E400BD0, 0x0D7006400E500B30, 0x0DA006200EB00B80, 0x0D4006A00E100BE0, 0x0DB006900E600B20, 0x0D5006100EC00B40, 0x01D00B600DE00AB0, 0x01100BB00DD00AA0, 0x01F00B300D700AC0, 0x01900BC00DF00A50, 0x01C00BD00D300A10, 0x01000B000D000A00, 0x01200B500D900A70, 0x01600BF00D800A90, 0x01E00B800DA00A60, 0x01800B700D200AF0, 0x01300BE00D400AD0, 0x01700B400D500A30, 0x01A00B200DB00A80, 0x01400BA00D100AE0, 0x01B00B900D600A20, 0x01500B100DC00A40, 0x0FD0036007E00CB0, 0x0F1003B007D00CA0, 0x0FF0033007700CC0, 0x0F9003C007F00C50, 0x0FC003D007300C10, 0x0F00030007000C00, 0x0F20035007900C70, 0x0F6003F007800C90, 0x0FE0038007A00C60, 0x0F80037007200CF0, 0x0F3003E007400CD0, 0x0F70034007500C30, 0x0FA0032007B00C80, 0x0F4003A007100CE0, 0x0FB0039007600C20, 0x0F50031007C00C40, 0x09D00C600FE005B0, 0x09100CB00FD005A0, 0x09F00C300F7005C0, 0x09900CC00FF00550, 0x09C00CD00F300510, 0x09000C000F000500, 0x09200C500F900570, 0x09600CF00F800590, 0x09E00C800FA00560, 0x09800C700F2005F0, 0x09300CE00F4005D0, 0x09700C400F500530, 0x09A00C200FB00580, 0x09400CA00F1005E0, 0x09B00C900F600520, 0x09500C100FC00540, 0x0CD00D6003E001B0, 0x0C100DB003D001A0, 0x0CF00D30037001C0, 0x0C900DC003F00150, 0x0CC00DD003300110, 0x0C000D0003000100, 0x0C200D5003900170, 0x0C600DF003800190, 0x0CE00D8003A00160, 0x0C800D70032001F0, 0x0C300DE0034001D0, 0x0C700D4003500130, 0x0CA00D2003B00180, 0x0C400DA0031001E0, 0x0CB00D9003600120, 0x0C500D1003C00140, 0x00D0006000E000B0, 0x001000B000D000A0, 0x00F00030007000C0, 0x009000C000F00050, 0x00C000D000300010, 0x0000000000000000, 0x0020005000900070, 0x006000F000800090, 0x00E0008000A00060, 0x00800070002000F0, 0x003000E0004000D0, 0x0070004000500030, 0x00A0002000B00080, 0x004000A0001000E0, 0x00B0009000600020, 0x0050001000C00040, 0x02D0056009E007B0, 0x021005B009D007A0, 0x02F00530097007C0, 0x029005C009F00750, 0x02C005D009300710, 0x0200050009000700, 0x0220055009900770, 0x026005F009800790, 0x02E0058009A00760, 0x02800570092007F0, 0x023005E0094007D0, 0x0270054009500730, 0x02A0052009B00780, 0x024005A0091007E0, 0x02B0059009600720, 0x0250051009C00740, 0x06D00F6008E009B0, 0x06100FB008D009A0, 0x06F00F30087009C0, 0x06900FC008F00950, 0x06C00FD008300910, 0x06000F0008000900, 0x06200F5008900970, 0x06600FF008800990, 0x06E00F8008A00960, 0x06800F70082009F0, 0x06300FE0084009D0, 0x06700F4008500930, 0x06A00F2008B00980, 0x06400FA0081009E0, 0x06B00F9008600920, 0x06500F1008C00940, 0x0ED008600AE006B0, 0x0E1008B00AD006A0, 0x0EF008300A7006C0, 0x0E9008C00AF00650, 0x0EC008D00A300610, 0x0E0008000A000600, 0x0E2008500A900670, 0x0E6008F00A800690, 0x0EE008800AA00660, 0x0E8008700A2006F0, 0x0E3008E00A4006D0, 0x0E7008400A500630, 0x0EA008200AB00680, 0x0E4008A00A1006E0, 0x0EB008900A600620, 0x0E5008100AC00640, 0x08D0076002E00FB0, 0x081007B002D00FA0, 0x08F0073002700FC0, 0x089007C002F00F50, 0x08C007D002300F10, 0x0800070002000F00, 0x0820075002900F70, 0x086007F002800F90, 0x08E0078002A00F60, 0x0880077002200FF0, 0x083007E002400FD0, 0x0870074002500F30, 0x08A0072002B00F80, 0x084007A002100FE0, 0x08B0079002600F20, 0x0850071002C00F40, 0x03D00E6004E00DB0, 0x03100EB004D00DA0, 0x03F00E3004700DC0, 0x03900EC004F00D50, 0x03C00ED004300D10, 0x03000E0004000D00, 0x03200E5004900D70, 0x03600EF004800D90, 0x03E00E8004A00D60, 0x03800E7004200DF0, 0x03300EE004400DD0, 0x03700E4004500D30, 0x03A00E2004B00D80, 0x03400EA004100DE0, 0x03B00E9004600D20, 0x03500E1004C00D40, 0x07D0046005E003B0, 0x071004B005D003A0, 0x07F00430057003C0, 0x079004C005F00350, 0x07C004D005300310, 0x0700040005000300, 0x0720045005900370, 0x076004F005800390, 0x07E0048005A00360, 0x07800470052003F0, 0x073004E0054003D0, 0x0770044005500330, 0x07A0042005B00380, 0x074004A0051003E0, 0x07B0049005600320, 0x0750041005C00340, 0x0AD002600BE008B0, 0x0A1002B00BD008A0, 0x0AF002300B7008C0, 0x0A9002C00BF00850, 0x0AC002D00B300810, 0x0A0002000B000800, 0x0A2002500B900870, 0x0A6002F00B800890, 0x0AE002800BA00860, 0x0A8002700B2008F0, 0x0A3002E00B4008D0, 0x0A7002400B500830, 0x0AA002200BB00880, 0x0A4002A00B1008E0, 0x0AB002900B600820, 0x0A5002100BC00840, 0x04D00A6001E00EB0, 0x04100AB001D00EA0, 0x04F00A3001700EC0, 0x04900AC001F00E50, 0x04C00AD001300E10, 0x04000A0001000E00, 0x04200A5001900E70, 0x04600AF001800E90, 0x04E00A8001A00E60, 0x04800A7001200EF0, 0x04300AE001400ED0, 0x04700A4001500E30, 0x04A00A2001B00E80, 0x04400AA001100EE0, 0x04B00A9001600E20, 0x04500A1001C00E40, 0x0BD0096006E002B0, 0x0B1009B006D002A0, 0x0BF00930067002C0, 0x0B9009C006F00250, 0x0BC009D006300210, 0x0B00090006000200, 0x0B20095006900270, 0x0B6009F006800290, 0x0BE0098006A00260, 0x0B800970062002F0, 0x0B3009E0064002D0, 0x0B70094006500230, 0x0BA0092006B00280, 0x0B4009A0061002E0, 0x0BB0099006600220, 0x0B50091006C00240, 0x05D001600CE004B0, 0x051001B00CD004A0, 0x05F001300C7004C0, 0x059001C00CF00450, 0x05C001D00C300410, 0x050001000C000400, 0x052001500C900470, 0x056001F00C800490, 0x05E001800CA00460, 0x058001700C2004F0, 0x053001E00C4004D0, 0x057001400C500430, 0x05A001200CB00480, 0x054001A00C1004E0, 0x05B001900C600420, 0x055001100CC00440] T7 = [0xD00D6006E00EB00B, 0x100DB006D00EA00B, 0xF00D3006700EC00B, 0x900DC006F00E500B, 0xC00DD006300E100B, 0x000D0006000E000B, 0x200D5006900E700B, 0x600DF006800E900B, 0xE00D8006A00E600B, 0x800D7006200EF00B, 0x300DE006400ED00B, 0x700D4006500E300B, 0xA00D2006B00E800B, 0x400DA006100EE00B, 0xB00D9006600E200B, 0x500D1006C00E400B, 0xD001600BE00DB00A, 0x1001B00BD00DA00A, 0xF001300B700DC00A, 0x9001C00BF00D500A, 0xC001D00B300D100A, 0x0001000B000D000A, 0x2001500B900D700A, 0x6001F00B800D900A, 0xE001800BA00D600A, 0x8001700B200DF00A, 0x3001E00B400DD00A, 0x7001400B500D300A, 0xA001200BB00D800A, 0x4001A00B100DE00A, 0xB001900B600D200A, 0x5001100BC00D400A, 0xD00F6003E007B00C, 0x100FB003D007A00C, 0xF00F30037007C00C, 0x900FC003F007500C, 0xC00FD0033007100C, 0x000F00030007000C, 0x200F50039007700C, 0x600FF0038007900C, 0xE00F8003A007600C, 0x800F70032007F00C, 0x300FE0034007D00C, 0x700F40035007300C, 0xA00F2003B007800C, 0x400FA0031007E00C, 0xB00F90036007200C, 0x500F1003C007400C, 0xD009600CE00FB005, 0x1009B00CD00FA005, 0xF009300C700FC005, 0x9009C00CF00F5005, 0xC009D00C300F1005, 0x0009000C000F0005, 0x2009500C900F7005, 0x6009F00C800F9005, 0xE009800CA00F6005, 0x8009700C200FF005, 0x3009E00C400FD005, 0x7009400C500F3005, 0xA009200CB00F8005, 0x4009A00C100FE005, 0xB009900C600F2005, 0x5009100CC00F4005, 0xD00C600DE003B001, 0x100CB00DD003A001, 0xF00C300D7003C001, 0x900CC00DF0035001, 0xC00CD00D30031001, 0x000C000D00030001, 0x200C500D90037001, 0x600CF00D80039001, 0xE00C800DA0036001, 0x800C700D2003F001, 0x300CE00D4003D001, 0x700C400D50033001, 0xA00C200DB0038001, 0x400CA00D1003E001, 0xB00C900D60032001, 0x500C100DC0034001, 0xD0006000E000B000, 0x1000B000D000A000, 0xF00030007000C000, 0x9000C000F0005000, 0xC000D00030001000, 0x0000000000000000, 0x2000500090007000, 0x6000F00080009000, 0xE0008000A0006000, 0x800070002000F000, 0x3000E0004000D000, 0x7000400050003000, 0xA0002000B0008000, 0x4000A0001000E000, 0xB000900060002000, 0x50001000C0004000, 0xD0026005E009B007, 0x1002B005D009A007, 0xF00230057009C007, 0x9002C005F0095007, 0xC002D00530091007, 0x0002000500090007, 0x2002500590097007, 0x6002F00580099007, 0xE0028005A0096007, 0x800270052009F007, 0x3002E0054009D007, 0x7002400550093007, 0xA0022005B0098007, 0x4002A0051009E007, 0xB002900560092007, 0x50021005C0094007, 0xD006600FE008B009, 0x1006B00FD008A009, 0xF006300F7008C009, 0x9006C00FF0085009, 0xC006D00F30081009, 0x0006000F00080009, 0x2006500F90087009, 0x6006F00F80089009, 0xE006800FA0086009, 0x8006700F2008F009, 0x3006E00F4008D009, 0x7006400F50083009, 0xA006200FB0088009, 0x4006A00F1008E009, 0xB006900F60082009, 0x5006100FC0084009, 0xD00E6008E00AB006, 0x100EB008D00AA006, 0xF00E3008700AC006, 0x900EC008F00A5006, 0xC00ED008300A1006, 0x000E0008000A0006, 0x200E5008900A7006, 0x600EF008800A9006, 0xE00E8008A00A6006, 0x800E7008200AF006, 0x300EE008400AD006, 0x700E4008500A3006, 0xA00E2008B00A8006, 0x400EA008100AE006, 0xB00E9008600A2006, 0x500E1008C00A4006, 0xD0086007E002B00F, 0x1008B007D002A00F, 0xF00830077002C00F, 0x9008C007F002500F, 0xC008D0073002100F, 0x000800070002000F, 0x200850079002700F, 0x6008F0078002900F, 0xE0088007A002600F, 0x800870072002F00F, 0x3008E0074002D00F, 0x700840075002300F, 0xA0082007B002800F, 0x4008A0071002E00F, 0xB00890076002200F, 0x50081007C002400F, 0xD003600EE004B00D, 0x1003B00ED004A00D, 0xF003300E7004C00D, 0x9003C00EF004500D, 0xC003D00E3004100D, 0x0003000E0004000D, 0x2003500E9004700D, 0x6003F00E8004900D, 0xE003800EA004600D, 0x8003700E2004F00D, 0x3003E00E4004D00D, 0x7003400E5004300D, 0xA003200EB004800D, 0x4003A00E1004E00D, 0xB003900E6004200D, 0x5003100EC004400D, 0xD0076004E005B003, 0x1007B004D005A003, 0xF00730047005C003, 0x9007C004F0055003, 0xC007D00430051003, 0x0007000400050003, 0x2007500490057003, 0x6007F00480059003, 0xE0078004A0056003, 0x800770042005F003, 0x3007E0044005D003, 0x7007400450053003, 0xA0072004B0058003, 0x4007A0041005E003, 0xB007900460052003, 0x50071004C0054003, 0xD00A6002E00BB008, 0x100AB002D00BA008, 0xF00A3002700BC008, 0x900AC002F00B5008, 0xC00AD002300B1008, 0x000A0002000B0008, 0x200A5002900B7008, 0x600AF002800B9008, 0xE00A8002A00B6008, 0x800A7002200BF008, 0x300AE002400BD008, 0x700A4002500B3008, 0xA00A2002B00B8008, 0x400AA002100BE008, 0xB00A9002600B2008, 0x500A1002C00B4008, 0xD004600AE001B00E, 0x1004B00AD001A00E, 0xF004300A7001C00E, 0x9004C00AF001500E, 0xC004D00A3001100E, 0x0004000A0001000E, 0x2004500A9001700E, 0x6004F00A8001900E, 0xE004800AA001600E, 0x8004700A2001F00E, 0x3004E00A4001D00E, 0x7004400A5001300E, 0xA004200AB001800E, 0x4004A00A1001E00E, 0xB004900A6001200E, 0x5004100AC001400E, 0xD00B6009E006B002, 0x100BB009D006A002, 0xF00B30097006C002, 0x900BC009F0065002, 0xC00BD00930061002, 0x000B000900060002, 0x200B500990067002, 0x600BF00980069002, 0xE00B8009A0066002, 0x800B70092006F002, 0x300BE0094006D002, 0x700B400950063002, 0xA00B2009B0068002, 0x400BA0091006E002, 0xB00B900960062002, 0x500B1009C0064002, 0xD0056001E00CB004, 0x1005B001D00CA004, 0xF0053001700CC004, 0x9005C001F00C5004, 0xC005D001300C1004, 0x00050001000C0004, 0x20055001900C7004, 0x6005F001800C9004, 0xE0058001A00C6004, 0x80057001200CF004, 0x3005E001400CD004, 0x70054001500C3004, 0xA0052001B00C8004, 0x4005A001100CE004, 0xB0059001600C2004, 0x50051001C00C4004] RCandKeySizeConstLong = [0x0013000200140005, 0x0033000200340005, 0x0073000200740005, 0x0073001200740015, 0x0073003200740035, 0x0063007200640075, 0x0053007200540075, 0x0033007200340075, 0x0073006200740065, 0x0073005200740055, 0x0063003200640035, 0x0043007200440075, 0x0013007200140075, 0x0033006200340065, 0x0073004200740045, 0x0063001200640015, 0x0053003200540035, 0x0023007200240075, 0x0053006200540065, 0x0033005200340055, 0x0063002200640025, 0x0043005200440055, 0x0003003200040035, 0x0003006200040065, 0x0013004200140045, 0x0023000200240005, 0x0053000200540005, 0x0033001200340015, 0x0073002200740025, 0x0063005200640055, 0x0043003200440035, 0x0003007200040075, 0x0013006200140065, 0x0033004200340045, 0x0063000200640005, 0x0053001200540015, 0x0033003200340035, 0x0063006200640065, 0x0053005200540055, 0x0023003200240035, 0x0043006200440065, 0x0013005200140055, 0x0023002200240025, 0x0043004200440045, 0x0003001200040015, 0x0013002200140025, 0x0023004200240045, 0x0043000200440005] @classmethod def byte2ulong(cls, b, offSet): x = 0 for i in range(7, -1, -1): x = (x << 8) ^ b[i + offSet] return x @classmethod def ulong2byte(cls, x): b = [None] * 8 for i in range(0, 8, 1): b[i] = ((x >> i * 8) & 0xFF) return b @classmethod def ulong2byteCopy(cls, x, b, offSet): for i in range(0, 8, 1): b[offSet + i] = ((x >> i * 8) & 0xFF) return @classmethod def AddKey(cls, state, roundKey): return state ^ roundKey @classmethod def AddConstants(cls, state, round): return state ^ cls.RCandKeySizeConstLong[round] @classmethod def SubCellShiftRowAndMixColumns(cls, state): temp = cls.T0[state >> 0 & 0xFF] temp ^= cls.T1[state >> 8 & 0xFF] temp ^= cls.T2[state >> 16 & 0xFF] temp ^= cls.T3[state >> 24 & 0xFF] temp ^= cls.T4[state >> 32 & 0xFF] temp ^= cls.T5[state >> 40 & 0xFF] temp ^= cls.T6[state >> 48 & 0xFF] temp ^= cls.T7[state >> 56 & 0xFF] return temp @classmethod def Step(cls, state, step): for i in range(0, 4, 1): state = cls.AddConstants(state, (step * 4 + i)) state = cls.SubCellShiftRowAndMixColumns(state) return state @classmethod def EncryptOneBlock(cls, state, sk0, sk1): for i in range(0, 12, 2): state = cls.AddKey(state, sk0) state = cls.Step(state, i) state = cls.AddKey(state, sk1) state = cls.Step(state, i+1) state = cls.AddKey(state, sk0) return state @classmethod def Encrypt(cls, plainText, key): cipherText = [None] * len(plainText) sk0 = cls.byte2ulong(key, 0) sk2 = [None] * 8 for i in range(0, 8, 1): sk2[i] = key[(8 + i) % 10] sk1 = cls.byte2ulong(sk2, 0) for i in range(0, len(plainText), 8): state = cls.byte2ulong(plainText, i) state = cls.EncryptOneBlock(state, sk0, sk1) cls.ulong2byteCopy(state, cipherText, i) return cipherText
class Led_80_64: key_size = 64 t0 = [52636769843806293, 52355243327750231, 52918253410123867, 50947902803476570, 49822015781339218, 49540489264758864, 51510822692651102, 52073789825089617, 51229399255285852, 53762648275746909, 53199676846964825, 50384944260448342, 51792332028510291, 53481156119429215, 50103486463344724, 50666410646634584, 48132345586909301, 47850819070853239, 48413829153226875, 46443478546579578, 45317591524442226, 45036065007861872, 47006398435754110, 47569365568192625, 46724974998388860, 49258224018849917, 48695252590067833, 45880520003551350, 47287907771613299, 48976731862532223, 45599062206447732, 46161986389737592, 57140506904887477, 56858980388831415, 57421990471205051, 55451639864557754, 54325752842420402, 54044226325840048, 56014559753732286, 56577526886170801, 55733136316367036, 58266385336828093, 57703413908046009, 54888681321529526, 56296069089591475, 57984893180510399, 54607223524425908, 55170147707715768, 25614897198530725, 25333370682474663, 25896380764848299, 23926030158201002, 22800143136063650, 22518616619483296, 24488950047375534, 25051917179814049, 24207526610010284, 26740775630471341, 26177804201689257, 23363071615172774, 24770459383234723, 26459283474153647, 23081613818069156, 23644538001359016, 7600704844333093, 7319178328277031, 7882188410650667, 5911837804003370, 4785950781866018, 4504424265285664, 6474757693177902, 7037724825616417, 6193334255812652, 8726583276273709, 8163611847491625, 5348879260975142, 6756267029037091, 8445091119956015, 5067421463871524, 5630345647161384, 3096280579047429, 2814754062991367, 3377764145365003, 1407413538717706, 281526516580354, 0, 1970333427892238, 2533300560330753, 1688909990526988, 4222159010988045, 3659187582205961, 844454995689478, 2251842763751427, 3940666854670351, 562997198585860, 1125921381875720, 34621615425323237, 34340088909267175, 34903098991640811, 32932748384993514, 31806861362856162, 31525334846275808, 33495668274168046, 34058635406606561, 33214244836802796, 35747493857263853, 35184522428481769, 32369789841965286, 33777177610027235, 35466001700946159, 32088332044861668, 32651256228151528, 43629089544339477, 43347563028283415, 43910573110657051, 41940222504009754, 40814335481872402, 40532808965292048, 42503142393184286, 43066109525622801, 42221718955819036, 44754967976280093, 44191996547498009, 41377263960981526, 42784651729043475, 44473475819962399, 41095806163877908, 41658730347167768, 30118840427479237, 29837313911423175, 30400323993796811, 28429973387149514, 27304086365012162, 27022559848431808, 28992893276324046, 29555860408762561, 28711469838958796, 31244718859419853, 30681747430637769, 27867014844121286, 29274402612183235, 30963226703102159, 27585557047017668, 28148481230307528, 70650824754856149, 70369298238800087, 70932308321173723, 68961957714526426, 67836070692389074, 67554544175808720, 69524877603700958, 70087844736139473, 69243454166335708, 71776703186796765, 71213731758014681, 68398999171498198, 69806386939560147, 71495211030479071, 68117541374394580, 68680465557684440, 61643281894342805, 61361755378286743, 61924765460660379, 59954414854013082, 58828527831875730, 58547001315295376, 60517334743187614, 61080301875626129, 60235911305822364, 62769160326283421, 62206188897501337, 59391456310984854, 60798844079046803, 62487668169965727, 59109998513881236, 59672922697171096, 16607560510079077, 16326033994023015, 16889044076396651, 14918693469749354, 13792806447612002, 13511279931031648, 15481613358923886, 16044580491362401, 15200189921558636, 17733438942019693, 17170467513237609, 14355734926721126, 15763122694783075, 17451946785701999, 14074277129617508, 14637201312907368, 39125764799070261, 38844238283014199, 39407248365387835, 37436897758740538, 36311010736603186, 36029484220022832, 37999817647915070, 38562784780353585, 37718394210549820, 40251643231010877, 39688671802228793, 36873939215712310, 38281326983774259, 39970151074693183, 36592481418608692, 37155405601898552, 66146950253773045, 65865423737716983, 66428433820090619, 64458083213443322, 63332196191305970, 63050669674725616, 65021003102617854, 65583970235056369, 64739579665252604, 67272828685713661, 66709857256931577, 63895124670415094, 65302512438477043, 66991336529395967, 63613666873311476, 64176591056601336, 12104235756421189, 11822709240365127, 12385719322738763, 10415368716091466, 9289481693954114, 9007955177373760, 10978288605265998, 11541255737704513, 10696865167900748, 13230114188361805, 12667142759579721, 9852410173063238, 11259797941125187, 12948622032044111, 9570952375959620, 10133876559249480, 21111022689058949, 20829496173002887, 21392506255376523, 19422155648729226, 18296268626591874, 18014742110011520, 19985075537903758, 20548042670342273, 19703652100538508, 22236901120999565, 21673929692217481, 18859197105700998, 20266584873762947, 21955408964681871, 18577739308597380, 19140663491887240] t1 = [13475013080014411008, 13402942291904059136, 13547072872991709952, 13042663117690001920, 12754436040022839808, 12682365251778269184, 13186770609318682112, 13330890195222941952, 13114726209353178112, 13763237958591208704, 13619117272822995200, 12898545730674775552, 13258836999298634496, 13691175966573879040, 12826492534616249344, 12970601125538453504, 12321880470248781056, 12249809682138429184, 12393940263226080000, 11889530507924371968, 11601303430257209856, 11529232642012639232, 12033637999553052160, 12177757585457312000, 11961593599587548160, 12610105348825578752, 12465984663057365248, 11745413120909145600, 12105704389533004544, 12538043356808249088, 11673359924850619392, 11817468515772823552, 14627969767651194112, 14555898979540842240, 14700029560628493056, 14195619805326785024, 13907392727659622912, 13835321939415052288, 14339727296955465216, 14483846882859725056, 14267682896989961216, 14916194646227991808, 14772073960459778304, 14051502418311558656, 14411793686935417600, 14844132654210662144, 13979449222253032448, 14123557813175236608, 6557413682823865600, 6485342894713513728, 6629473475801164544, 6125063720499456512, 5836836642832294400, 5764765854587723776, 6269171212128136704, 6413290798032396544, 6197126812162632704, 6845638561400663296, 6701517875632449792, 5980946333484230144, 6341237602108089088, 6773576569383333632, 5908893137425703936, 6053001728347908096, 1945780440149271808, 1873709652038919936, 2017840233126570752, 1513430477824862720, 1225203400157700608, 1153132611913129984, 1657537969453542912, 1801657555357802752, 1585493569488038912, 2234005318726069504, 2089884632957856000, 1369313090809636352, 1729604359433495296, 2161943326708739840, 1297259894751110144, 1441368485673314304, 792647828236141824, 720577040125789952, 864707621213440768, 360297865911732736, 72070788244570624, 0, 504405357540412928, 648524943444672768, 432360957574908928, 1080872706812939520, 936752021044726016, 216180478896506368, 576471747520365312, 1008810714795609856, 144127282837980160, 288235873760184320, 8863133548882748672, 8791062760772396800, 8935193341860047616, 8430783586558339584, 8142556508891177472, 8070485720646606848, 8574891078187019776, 8719010664091279616, 8502846678221515776, 9151358427459546368, 9007237741691332864, 8286666199543113216, 8646957468166972160, 9079296435442216704, 8214613003484587008, 8358721594406791168, 11169046923350906112, 11096976135240554240, 11241106716328205056, 10736696961026497024, 10448469883359334912, 10376399095114764288, 10880804452655177216, 11024924038559437056, 10808760052689673216, 11457271801927703808, 11313151116159490304, 10592579574011270656, 10952870842635129600, 11385209809910374144, 10520526377952744448, 10664634968874948608, 7710423149434684672, 7638352361324332800, 7782482942411983616, 7278073187110275584, 6989846109443113472, 6917775321198542848, 7422180678738955776, 7566300264643215616, 7350136278773451776, 7998648028011482368, 7854527342243268864, 7133955800095049216, 7494247068718908160, 7926586035994152704, 7061902604036523008, 7206011194958727168, 18086611137243174144, 18014540349132822272, 18158670930220473088, 17654261174918765056, 17366034097251602944, 17293963309007032320, 17798368666547445248, 17942488252451705088, 17726324266581941248, 18374836015819971840, 18230715330051758336, 17510143787903538688, 17870435056527397632, 18302774023802642176, 17438090591845012480, 17582199182767216640, 15780680164951758080, 15708609376841406208, 15852739957929057024, 15348330202627348992, 15060103124960186880, 14988032336715616256, 15492437694256029184, 15636557280160289024, 15420393294290525184, 16068905043528555776, 15924784357760342272, 15204212815612122624, 15564504084235981568, 15996843051511226112, 15132159619553596416, 15276268210475800576, 4251535490580243712, 4179464702469891840, 4323595283557542656, 3819185528255834624, 3530958450588672512, 3458887662344101888, 3963293019884514816, 4107412605788774656, 3891248619919010816, 4539760369157041408, 4395639683388827904, 3675068141240608256, 4035359409864467200, 4467698377139711744, 3603014945182082048, 3747123536104286208, 10016195788561986816, 9944125000451634944, 10088255581539285760, 9583845826237577728, 9295618748570415616, 9223547960325844992, 9727953317866257920, 9872072903770517760, 9655908917900753920, 10304420667138784512, 10160299981370571008, 9439728439222351360, 9800019707846210304, 10232358675121454848, 9367675243163825152, 9511783834086029312, 16933619264965899520, 16861548476855547648, 17005679057943198464, 16501269302641490432, 16213042224974328320, 16140971436729757696, 16645376794270170624, 16789496380174430464, 16573332394304666624, 17221844143542697216, 17077723457774483712, 16357151915626264064, 16717443184250123008, 17149782151525367552, 16285098719567737856, 16429207310489942016, 3098684353643824384, 3026613565533472512, 3170744146621123328, 2666334391319415296, 2378107313652253184, 2306036525407682560, 2810441882948095488, 2954561468852355328, 2738397482982591488, 3386909232220622080, 3242788546452408576, 2522217004304188928, 2882508272928047872, 3314847240203292416, 2450163808245662720, 2594272399167866880, 5404421808399090944, 5332351020288739072, 5476481601376389888, 4972071846074681856, 4683844768407519744, 4611773980162949120, 5116179337703362048, 5260298923607621888, 5044134937737858048, 5692646686975888640, 5548526001207675136, 4827954459059455488, 5188245727683314432, 5620584694958558976, 4755901263000929280, 4900009853923133440] t2 = [12685303165102243852, 11532364068040888332, 13838189483457929228, 5767844506473771020, 1156140892639105036, 3096241924603916, 8073652329704759308, 10379565707394207756, 6920642864436097036, 17297112325610725388, 14991163763817639948, 3462019086761754636, 9226696980150763532, 16144208412921458700, 2309185543353536524, 4615046146363891724, 12685021685830500357, 11532082588769144837, 13837908004186185733, 5767563027202027525, 1155859413367361541, 2814762652860421, 8073370850433015813, 10379284228122464261, 6920361385164353541, 17296830846338981893, 14990882284545896453, 3461737607490011141, 9226415500879020037, 16143926933649715205, 2308904064081793029, 4614764667092148229, 12685584631488561158, 11532645534427205638, 13838470949844246534, 5768125972860088326, 1156422359025422342, 3377708310921222, 8073933796091076614, 10379847173780525062, 6920924330822414342, 17297393791997042694, 14991445230203957254, 3462300553148071942, 9226978446537080838, 16144489879307776006, 2309467009739853830, 4615327612750209030, 12683614332421914635, 11530675235360559115, 13836500650777600011, 5766155673793441803, 1154452059958775819, 1407409244274699, 8071963497024430091, 10377876874713878539, 6918954031755767819, 17295423492930396171, 14989474931137310731, 3460330254081425419, 9225008147470434315, 16142519580241129483, 2307496710673207307, 4613357313683562507, 12682488428219318281, 11529549331157962761, 13835374746575003657, 5765029769590845449, 1153326155756179465, 281505041678345, 8070837592821833737, 10376750970511282185, 6917828127553171465, 17294297588727799817, 14988349026934714377, 3459204349878829065, 9223882243267837961, 16141393676038533129, 2306370806470610953, 4612231409480966153, 12682206923177639936, 11529267826116284416, 13835093241533325312, 5764748264549167104, 1153044650714501120, 0, 8070556087780155392, 10376469465469603840, 6917546622511493120, 17294016083686121472, 14988067521893036032, 3458922844837150720, 9223600738226159616, 16141112170996854784, 2306089301428932608, 4611949904439287808, 12684177273785008138, 11531238176723652618, 13837063592140693514, 5766718615156535306, 1155015001321869322, 1970350607368202, 8072526438387523594, 10378439816076972042, 6919516973118861322, 17295986434293489674, 14990037872500404234, 3460893195444518922, 9225571088833527818, 16143082521604222986, 2308059652036300810, 4613920255046656010, 12684740240918233101, 11531801143856877581, 13837626559273918477, 5767281582289760269, 1155577968455094285, 2533317740593165, 8073089405520748557, 10379002783210197005, 6920079940252086285, 17296549401426714637, 14990600839633629197, 3461456162577743885, 9226134055966752781, 16143645488737447949, 2308622619169525773, 4614483222179880973, 12683895777333526531, 11530956680272171011, 13836782095689211907, 5766437118705053699, 1154733504870387715, 1688854155886595, 8072244941936041987, 10378158319625490435, 6919235476667379715, 17295704937842008067, 14989756376048922627, 3460611698993037315, 9225289592382046211, 16142801025152741379, 2307778155584819203, 4613638758595174403, 12686429095073071118, 11533489998011715598, 13839315413428756494, 5768970436444598286, 1157266822609932302, 4222171895431182, 8074778259675586574, 10380691637365035022, 6921768794406924302, 17298238255581552654, 14992289693788467214, 3463145016732581902, 9227822910121590798, 16145334342892285966, 2310311473324363790, 4616172076334718990, 12685866119349977103, 11532927022288621583, 13838752437705662479, 5768407460721504271, 1156703846886838287, 3659196172337167, 8074215283952492559, 10380128661641941007, 6921205818683830287, 17297675279858458639, 14991726718065373199, 3462582041009487887, 9227259934398496783, 16144771367169191951, 2309748497601269775, 4615609100611624975, 12683051386762805256, 11530112289701449736, 13835937705118490632, 5765592728134332424, 1153889114299666440, 844463585165320, 8071400551365320712, 10377313929054769160, 6918391086096658440, 17294860547271286792, 14988911985478201352, 3459767308422316040, 9224445201811324936, 16141956634582020104, 2306933765014097928, 4612794368024453128, 12684458778826620932, 11531519681765265412, 13837345097182306308, 5767000120198148100, 1155296506363482116, 2251855648980996, 8072807943429136388, 10378721321118584836, 6919798478160474116, 17296267939335102468, 14990319377542017028, 3461174700486131716, 9225852593875140612, 16143364026645835780, 2308341157077913604, 4614201760088268804, 12686147624391262215, 11533208527329906695, 13839033942746947591, 5768688965762789383, 1156985351928123399, 3940701213622279, 8074496788993777671, 10380410166683226119, 6921487323725115399, 17297956784899743751, 14992008223106658311, 3462863546050772999, 9227541439439781895, 16145052872210477063, 2310030002642554887, 4615890605652910087, 12682769933260996609, 11529830836199641089, 13835656251616681985, 5765311274632523777, 1153607660797857793, 563010083356673, 8071119097863512065, 10377032475552960513, 6918109632594849793, 17294579093769478145, 14988630531976392705, 3459485854920507393, 9224163748309516289, 16141675181080211457, 2306652311512289281, 4612512914522644481, 12683332887509778434, 11530393790448422914, 13836219205865463810, 5765874228881305602, 1154170615046639618, 1125964332138498, 8071682052112293890, 10377595429801742338, 6918672586843631618, 17295142048018259970, 14989193486225174530, 3460048809169289218, 9224726702558298114, 16142238135328993282, 2307215265761071106, 4613075868771426306] t3 = [842177803492265152, 837674135144369232, 846681265673342048, 815156480606997680, 797142013365456016, 792637932698602496, 824163542416493728, 833171016548093136, 819659599192788016, 860192683025501408, 851185071455997168, 806149350061247616, 828667623082298432, 855689152116558960, 801646094032309264, 810653362012818464, 770119109925930432, 765615441578034512, 774622572107007328, 743097787040662960, 725083319799121296, 720579239132267776, 752104848850159008, 761112322981758416, 747600905626453296, 788133989459166688, 779126377889662448, 734090656494912896, 756608929515963712, 783630458550224240, 729587400465974544, 738594668446483744, 914233198389495488, 909729530041599568, 918736660570572384, 887211875504228016, 869197408262686352, 864693327595832832, 896218937313724064, 905226411445323472, 891714994090018352, 932248077922731744, 923240466353227504, 878204744958477952, 900723017979528768, 927744547013789296, 873701488929539600, 882708756910048800, 409836637327985600, 405332968980089680, 414340099509062496, 382815314442718128, 364800847201176464, 360296766534322944, 391822376252214176, 400829850383813584, 387318433028508464, 427851516861221856, 418843905291717616, 373808183896968064, 396326456918018880, 423347985952279408, 369304927868029712, 378312195848538912, 121605161463318976, 117101493115423056, 126108623644395872, 94583838578051504, 76569371336509840, 72065290669656320, 103590900387547552, 112598374519146960, 99086957163841840, 139620040996555232, 130612429427050992, 85576708032301440, 108094981053352256, 135116510087612784, 81073452003363088, 90080719983872288, 49539870793662656, 45036202445766736, 54043332974739552, 22518547908395184, 4504080666853520, 0, 31525609717891232, 40533083849490640, 27021666494185520, 67554750326898912, 58547138757394672, 13511417362645120, 36029690383695936, 63051219417956464, 9008161333706768, 18015429314215968, 553949626279922368, 549445957932026448, 558453088460999264, 526928303394654896, 508913836153113232, 504409755486259712, 535935365204150944, 544942839335750352, 531431421980445232, 571964505813158624, 562956894243654384, 517921172848904832, 540439445869955648, 567460974904216176, 513417916819966480, 522425184800475680, 698069212385512896, 693565544037616976, 702572674566589792, 671047889500245424, 653033422258703760, 648529341591850240, 680054951309741472, 689062425441340880, 675551008086035760, 716084091918749152, 707076480349244912, 662040758954495360, 684559031975546176, 711580561009806704, 657537502925557008, 666544770906066208, 481886534700630976, 477382866352735056, 486389996881707872, 454865211815363504, 436850744573821840, 432346663906968320, 463872273624859552, 472879747756458960, 459368330401153840, 499901414233867232, 490893802664362992, 445858081269613440, 468376354290664256, 495397883324924784, 441354825240675088, 450362093221184288, 1130415876024045248, 1125912207676149328, 1134919338205122144, 1103394553138777776, 1085380085897236112, 1080876005230382592, 1112401614948273824, 1121409089079873232, 1107897671724568112, 1148430755557281504, 1139423143987777264, 1094387422593027712, 1116905695614078528, 1143927224648339056, 1089884166564089360, 1098891434544598560, 986294090911977408, 981790422564081488, 990797553093054304, 959272768026709936, 941258300785168272, 936754220118314752, 968279829836205984, 977287303967805392, 963775886612500272, 1004308970445213664, 995301358875709424, 950265637480959872, 972783910502010688, 999805439536271216, 945762381452021520, 954769649432530720, 265722548595984576, 261218880248088656, 270226010777061472, 238701225710717104, 220686758469175440, 216182677802321920, 247708287520213152, 256715761651812560, 243204344296507440, 283737428129220832, 274729816559716592, 229694095164967040, 252212368186017856, 279233897220278384, 225190839136028688, 234198107116537888, 626014916932797632, 621511248584901712, 630518379113874528, 598993594047530160, 580979126805988496, 576475046139134976, 608000655857026208, 617008129988625616, 603496712633320496, 644029796466033888, 635022184896529648, 589986463501780096, 612504736522830912, 639526265557091440, 585483207472841744, 594490475453350944, 1058359381480966080, 1053855713133070160, 1062862843662042976, 1031338058595698608, 1013323591354156944, 1008819510687303424, 1040345120405194656, 1049352594536794064, 1035841177181488944, 1076374261014202336, 1067366649444698096, 1022330928049948544, 1044849201070999360, 1071870730105259888, 1017827672021010192, 1026834940001519392, 193670452132970944, 189166783785075024, 198173914314047840, 166649129247703472, 148634662006161808, 144130581339308288, 175656191057199520, 184663665188798928, 171152247833493808, 211685331666207200, 202677720096702960, 157641998701953408, 180160271723004224, 207181800757264752, 153138742673015056, 162146010653524256, 337786739821118144, 333283071473222224, 342290202002195040, 310765416935850672, 292750949694309008, 288246869027455488, 319772478745346720, 328779952876946128, 315268535521641008, 355801619354354400, 346794007784850160, 301758286390100608, 324276559411151424, 351298088445411952, 297255030361162256, 306262298341671456] t4 = [9799851483422833408, 9655739593764420096, 9511629903431252992, 9439564612610602240, 10232201445730464000, 9223389631456784384, 10088089556072052480, 9727804884551514368, 9367519113435461120, 9583684198766526208, 9943978766076263680, 9295463718404010752, 9871923371078367232, 10016026464543096320, 10304264537225867776, 10160146050699015168, 7494061248888220416, 7349949359229807104, 7205839668896640000, 7133774378075989248, 7926411211195851008, 6917599396922171392, 7782299321537439488, 7422014650016901376, 7061728878900848128, 7277893964231913216, 7638188531541650688, 6989673483869397760, 7566133136543754240, 7710236230008483328, 7998474302691254784, 7854355816164402176, 5188306203557546752, 5044194313899133440, 4900084623565966336, 4828019332745315584, 5620656165865177344, 4611844351591497728, 5476544276206765824, 5116259604686227712, 4755973833570174464, 4972138918901239552, 5332433486210977024, 4683918438538724096, 5260378091213080576, 5404481184677809664, 5692719257360581120, 5548600770833728512, 4035261550427134720, 3891149660768721408, 3747039970435554304, 3674974679614903552, 4467611512734765312, 3458799698461085696, 4323499623076353792, 3963214951555815680, 3602929180439762432, 3819094265770827520, 4179388833080564992, 3530873785408312064, 4107333438082668544, 4251436531547397632, 4539674604230169088, 4395556117703316480, 16717450880344922880, 16573338990686509568, 16429229300353342464, 16357164009532691712, 17149800842652553472, 16140989028378873856, 17005688952994141952, 16645404281473603840, 16285118510357550592, 16501283595688615680, 16861578162998353152, 16213063115326100224, 16789522768000456704, 16933625861465185792, 17221863934147957248, 17077745447621104640, 576461851966049024, 432349962307635712, 288240271974468608, 216174981153817856, 1008811814273679616, 0, 864699924615268096, 504415253094729984, 144129481978676736, 360294567309741824, 720589134619479296, 72074086947226368, 648533739621582848, 792636833086311936, 1080874905769083392, 936756419242230784, 14411660645810338560, 14267548756151925248, 14123439065818758144, 14051373774998107392, 14844010608117969152, 13835198793844289536, 14699898718459557632, 14339614046939019520, 13979328275822966272, 14195493361154031360, 14555787928463768832, 13907272880791515904, 14483732533465872384, 14627835626930601472, 14916073699613372928, 14771955213086520320, 8647105901481728768, 8502994011823315456, 8358884321490148352, 8286819030669497600, 9079455863789359360, 8070644049515679744, 8935343974130947840, 8575059302610409728, 8214773531494356480, 8430938616825421568, 8791233184135159040, 8142718136462906112, 8719177789137262592, 8863280882601991680, 9151518955284763136, 9007400468757910528, 2882533563624876800, 2738421673966463488, 2594311983633296384, 2522246692812645632, 3314883525932507392, 2306071711658827776, 3170771636274095872, 2810486964753557760, 2450201193637504512, 2666366278968569600, 3026660846278307072, 2378145798606054144, 2954605451280410624, 3098708544745139712, 3386946617427911168, 3242828130901058560, 6341174928921918208, 6197063039263504896, 6052953348930337792, 5980888058109687040, 6773524891229548800, 5764713076955869184, 6629413001571137280, 6269128330050599168, 5908842558934545920, 6125007644265611008, 6485302211575348480, 5836787163903095552, 6413246816577452032, 6557349910042181120, 6845587982724952576, 6701469496198099968, 12105888005877717760, 11961776116219304448, 11817666425886137344, 11745601135065486592, 12538237968185348352, 11529426153911668736, 12394126078526936832, 12033841407006398720, 11673555635890345472, 11889720721221410560, 12250015288531148032, 11601500240858895104, 12177959893533251584, 12322062986997980672, 12610301059680752128, 12466182573153899520, 1729647243121670912, 1585535353463257600, 1441425663130090496, 1369360372309439744, 2161997205429301504, 1153185391155621888, 2017885315770889984, 1657600644250351872, 1297314873134298624, 1513479958465363712, 1873774525775101184, 1225259478102848256, 1801719130777204736, 1945822224241933824, 2234060296924705280, 2089941810397852672, 10953001685911374592, 10808889796252961280, 10664780105919794176, 10592714815099143424, 11385351648219005184, 10376539833945325568, 11241239758560593664, 10880955087040055552, 10520669315924002304, 10736834401255067392, 11097128968564804864, 10448613920892551936, 11025073573566908416, 11169176667031637504, 11457414739714408960, 11313296253187556352, 13258651181347040000, 13114539291688626688, 12970429601355459584, 12898364310534808832, 13691001143654670592, 12682189329380990976, 13546889253996259072, 13186604582475720960, 12826318811359667712, 13042483896690732800, 13402778464000470272, 12754263416328217344, 13330723069002573824, 13474826162467302912, 13763064235150074368, 13618945748623221760, 17870460344271383296, 17726348454612969984, 17582238764279802880, 17510173473459152128, 18302810306579013888, 17293998492305334272, 18158698416920602368, 17798413745400064256, 17438127974284011008, 17654293059615076096, 18014587626924813568, 17366072579252560640, 17942532231926917120, 18086635325391646208, 18374873398074417664, 18230754911547565056, 15564564559841741568, 15420452670183328256, 15276342979850161152, 15204277689029510400, 15996914522149372160, 14988102707875692544, 15852802632490960640, 15492517960970422528, 15132232189854369280, 15348397275185434368, 15708691842495171840, 15060176794822918912, 15636636447497275392, 15780739540962004480, 16068977613644775936, 15924859127117923328] t5 = [38280669857120443, 37717732788142266, 37154804310278332, 36873299268010165, 39969536897384625, 36028865747878064, 39406599828406455, 37999237830279353, 36591871536857270, 37436266401431743, 38843667054985405, 36310405150015667, 38562200668274872, 39125103377121470, 40251033348538546, 39688070510543028, 29273676753469611, 28710739684491434, 28147811206627500, 27866306164359333, 30962543793733793, 27021872644227232, 30399606724755623, 28992244726628521, 27584878433206438, 28429273297780911, 29836673951334573, 27303412046364835, 29555207564624040, 30118110273470638, 31244040244887714, 30681077406892196, 20266821107646667, 19703884038668490, 19140955560804556, 18859450518536389, 21955688147910849, 18015016998404288, 21392751078932679, 19985389080805577, 18578022787383494, 19422417651957967, 20829818305511629, 18296556400541891, 20548351918801096, 21111254627647694, 22237184599064770, 21674221761069252, 15762740431355995, 15199803362377818, 14636874884513884, 14355369842245717, 17451607471620177, 13510936322113616, 16888670402642007, 15481308404514905, 14073942111092822, 14918336975667295, 16325737629220957, 13792475724251219, 16044271242510424, 16607173951357022, 17733103922774098, 17170141084778580, 65302542501347355, 64739605432369178, 64176676954505244, 63895171912237077, 66991409541611537, 63050738392104976, 66428472472633367, 65021110474506265, 63613744181084182, 64458139045658655, 65865539699212317, 63332277794242579, 65584073312501784, 66146976021348382, 67272905992765458, 66709943154769940, 2251804109242379, 1688867040264202, 1125938562400268, 844433520132101, 3940671149506561, 0, 3377734080528391, 1970372082401289, 563005788979206, 1407400653553679, 2814801307107341, 281539402137603, 2533334920396808, 3096237629243406, 4222167600660482, 3659204762664964, 56295549397696635, 55732612328718458, 55169683850854524, 54888178808586357, 57984416437960817, 54043745288454256, 57421479368982647, 56014117370855545, 54606751077433462, 55451145942007935, 56858546595561597, 54325284690591859, 56577080208851064, 57139982917697662, 58265912889114738, 57702950051119220, 33777757427663003, 33214820358684826, 32651891880820892, 32370386838552725, 35466624467927185, 31525953318420624, 34903687398949015, 33496325400821913, 32088959107399830, 32933353971974303, 34340754625527965, 31807492720558227, 34059288238817432, 34622190947664030, 35748120919081106, 35185158081085588, 11259896732909675, 10696959663931498, 10134031186067564, 9852526143799397, 12948763773173857, 9008092623667296, 12385826704195687, 10978464706068585, 9571098412646502, 10415493277220975, 11822893930774637, 9289632025804899, 11541427544064104, 12104330252910702, 13230260224327778, 12667297386332260, 24770214566101243, 24207277497123066, 23644349019259132, 23362843976990965, 26459081606365425, 22518410456858864, 25896144537387255, 24488782539260153, 23081416245838070, 23925811110412543, 25333211763966205, 22799949858996467, 25051745377255672, 25614648086102270, 26740578057519346, 26177615219523828, 47288625022959835, 46725687953981658, 46162759476117724, 45881254433849557, 48977492063224017, 45036820913717456, 48414554994245847, 47007192996118745, 45599826702696662, 46444221567271135, 47851622220824797, 45318360315855059, 47570155834114264, 48133058542960862, 49258988514377938, 48696025676382420, 6756434543444027, 6193497474465850, 5630568996601916, 5349063954333749, 8445301583708209, 4504630434201648, 7882364514730039, 6475002516602937, 5067636223180854, 5912031087755327, 7319431741308989, 4786169836339251, 7037965354598456, 7600868063445054, 8726798034862130, 8163835196866612, 42785162835591307, 42222225766613130, 41659297288749196, 41377792246481029, 44474029875855489, 40533358726348928, 43911092806877319, 42503730808750217, 41096364515328134, 41940759379902607, 43348160033456269, 40814898128486531, 43066693646745736, 43629596355592334, 44755526327009410, 44192563489013892, 51791606177136875, 51228669108158698, 50665740630294764, 50384235588026597, 53480473217401057, 49539802067894496, 52917536148422887, 51510174150295785, 50102807856873702, 50947202721448175, 52354603375001837, 49821341470032099, 52073136988291304, 52636039697137902, 53761969668554978, 53199006830559460, 69806485719810091, 69243548650831914, 68680620172967980, 68399115130699813, 71495352760074273, 67554681610567712, 70932415691096103, 69525053692969001, 68117687399546918, 68962082264121391, 70369482917675053, 67836221012705315, 70088016530964520, 70650919239811118, 71776849211228194, 71213886373232676, 60799080311881803, 60236143242903626, 59673214765039692, 59391709722771525, 62487947352145985, 58547276202639424, 61925010283167815, 60517648285040713, 59110281991618630, 59954676856193103, 61362077509746765, 58828815604777027, 61080611123036232, 61643513831882830, 62769443803299906, 62206480965304388] t6 = [995302527285070768, 941259675352959904, 1004309520374041536, 977288541093497680, 990799408682502928, 936755319797713664, 945762862659275632, 963777948362476432, 999806264347200352, 972784597855112176, 950267080756693968, 968280792072457008, 981791453521906560, 954770405503011808, 986295534180371232, 959273386666625856, 130616896371296944, 76574044439186080, 139623889460267712, 112602910179723856, 126113777768729104, 72069688883939840, 81077231745501808, 99092317448702608, 135120633433426528, 108098966941338352, 85581449842920144, 103595161158683184, 117105822608132736, 90084774589237984, 121609903266597408, 94587755752852032, 1139414416708603056, 1085371564776492192, 1148421409797573824, 1121400430517029968, 1134911298106035216, 1080867209221245952, 1089874752082807920, 1107889837786008720, 1143918153770732640, 1116896487278644464, 1094378970180226256, 1112392681495989296, 1125903342945438848, 1098882294926544096, 1130407423603903520, 1103385276090158144, 707078748219901360, 653035896287790496, 716085741308872128, 689064762028328272, 702575629617333520, 648531540732544256, 657539083594106224, 675554169297307024, 711582485282030944, 684560818789942768, 662043301691524560, 680057013007287600, 693567674456737152, 666546626437842400, 698071755115201824, 671049607601456448, 923252629643985328, 869209777711874464, 932259622732956096, 905238643452412240, 918749511041417488, 864705422156628224, 873712965018190192, 891728050721390992, 927756366706114912, 900734700214026736, 878217183115608528, 896230894431371568, 909741555880821120, 882720507861926368, 914245636539285792, 887223489025540416, 58547207487357104, 4504355555246240, 67554200576327872, 40533221295784016, 54044088884789264, 0, 9007542861561968, 27022628564762768, 63050944549486688, 36029278057398512, 13511760958980304, 31525472274743344, 45036133724192896, 18015085705298144, 49540214382657568, 22518066868912192, 202667893272348592, 148625041340237728, 211674886361319360, 184653907080775504, 198164774669780752, 144120685784991488, 153128228646553456, 171143314349754256, 207171630334478176, 180149963842390000, 157632446743971792, 175646158059734832, 189156819509184384, 162135771490289632, 193660900167649056, 166638752653903680, 490909264523561392, 436866412591450528, 499916257612532160, 472895278331988304, 486406145920993552, 432362057036204288, 441369599897766256, 459384685600967056, 495413001585690976, 468391335093602800, 445873817995184592, 463887529310947632, 477398190760397184, 450377142741502432, 481902271418861856, 454880123905116480, 1067362320279144112, 1013319468347033248, 1076369313368114880, 1049348334087571024, 1062859201676576272, 1008815112791787008, 1017822655653348976, 1035837741356549776, 1071866057341273696, 1044844390849185520, 1022326873750767312, 1040340585066530352, 1053851246515979904, 1026830198497085152, 1058355327174444576, 1031333179660699200, 635015656405733296, 580972804473622432, 644022649494704064, 617001670214160208, 630512537803165456, 576468448918376192, 585475991779938160, 603491077483138960, 639519393467862880, 612497726975774704, 589980209877356496, 607993921193119536, 621504582642569088, 594483534623674336, 626008663301033760, 598986515787288384, 274735382831041968, 220692530898931104, 283742375920012736, 256721396639468880, 270232264228474128, 216188175343684864, 225195718205246832, 243210803908447632, 279239119893171552, 252217453401083376, 229699936302665168, 247713647618428208, 261224309067877760, 234203261048983008, 265728389726342432, 238706242212597056, 562954763883250608, 508911911951139744, 571961756972221376, 544940777691677520, 558451645280682768, 504407556395893504, 513415099257455472, 531430184960656272, 567458500945380192, 540436834453292016, 517919317354873808, 535933028670636848, 549443690120086400, 522422642101191648, 553947770778551072, 526925623264805696, 779125347074443440, 725082495142332576, 788132340163414208, 761111360882870352, 774622228471875600, 720578139587086336, 729585682448648304, 747600768151849104, 783629084136573024, 756607417644484848, 734089900546066640, 752103611861829680, 765614273311279232, 738593225292384480, 770118353969743904, 743096206455998528, 346788578772127408, 292745726840016544, 355795571861098176, 328774592580554320, 342285460169559568, 288241371284770304, 297248914146332272, 315263999849533072, 351292315834256992, 324270649342168816, 301753132243750608, 319766843559513648, 333277505008963200, 306256456990068448, 337781585667427872, 310759438153682496, 851190637609878192, 797147785677767328, 860197630698848960, 833176651418305104, 846687519007310352, 792643430122521088, 801650972984083056, 819666058687283856, 855694374672007776, 828672708179919600, 806155191081501392, 824168902397264432, 837679563846713984, 810658515827819232, 842183644505178656, 815161496991433280, 418836277389952176, 364793425457841312, 427843270478922944, 400822291198379088, 414333158787384336, 360289069902595072, 369296612764157040, 387311698467357840, 423340014452081760, 396318347959993584, 373800830861575376, 391814542177338416, 405325203626787968, 378304155607893216, 409829284285252640, 382807136771507264] t7 = [14991744317231378443, 1156774222610997259, 17297534548007895051, 10380163852188667915, 13838945954974011403, 3659200467959819, 2309590173027823627, 6921452113047228427, 16144701005136551947, 9227154383161978891, 3462670005966917643, 8074180102802255883, 11532909433861341195, 4615521141024284683, 12685954082428297227, 5768284318909480971, 14988366638985621514, 1153396544365240330, 17294156869762138122, 10376786173942910986, 13835568276728254474, 281522222202890, 2306212494782066698, 6918074434801471498, 16141323326890795018, 9223776704916221962, 3459292327721160714, 8070802424556498954, 11529531755615584266, 4612143462778527754, 12682576404182540298, 5764906640663724042, 14992307254299439116, 1157337159679057932, 17298097485075955724, 10380726789256728588, 13839508892042072076, 4222137536020492, 2310153110095884300, 6922015050115289100, 16145263942204612620, 9227717320230039564, 3463232943034978316, 8074743039870316556, 11533472370929401868, 4616084078092345356, 12686517019496357900, 5768847255977541644, 14990618443094405125, 1155648348474023941, 17296408673870921733, 10379037978051694597, 13837820080837038085, 2533326330986501, 2308464298890850309, 6920326238910255109, 16143575130999578629, 9226028509025005573, 3461544131829944325, 8073054228665282565, 11531783559724367877, 4614395266887311365, 12684828208291323909, 5767158444772507653, 14991462872318717953, 1156492777698336769, 17297253103095234561, 10379882407276007425, 13838664510061350913, 3377755555299329, 2309308728115163137, 6921170668134567937, 16144419560223891457, 9226872938249318401, 3462388561054257153, 8073898657889595393, 11532627988948680705, 4615239696111624193, 12685672637515636737, 5768002873996820481, 14988085116763418624, 1153115022143037440, 17293875347539935232, 10376504651720708096, 13835286754506051584, 0, 2305930972559863808, 6917792912579268608, 16141041804668592128, 9223495182694019072, 3459010805498957824, 8070520902334296064, 11529250233393381376, 4611861940556324864, 12682294881960337408, 5764625118441521152, 14988648088192266247, 1153677993571885063, 17294438318968782855, 10377067623149555719, 13835849725934899207, 562971428847623, 2306493943988711431, 6918355884008116231, 16141604776097439751, 9224058154122866695, 3459573776927805447, 8071083873763143687, 11529813204822228999, 4612424911985172487, 12682857853389185031, 5765188089870368775, 14989774031048716297, 1154803936428335113, 17295564261825232905, 10378193566006005769, 13836975668791349257, 1688914285297673, 2307619886845161481, 6919481826864566281, 16142730718953889801, 9225184096979316745, 3460699719784255497, 8072209816619593737, 11530939147678679049, 4613550854841622537, 12683983796245635081, 5766314032726818825, 14992025800797761542, 1157055706177380358, 17297816031574278150, 10380445335755051014, 13839227438540394502, 3940684034342918, 2309871656594206726, 6921733596613611526, 16144982488702935046, 9227435866728361990, 3462951489533300742, 8074461586368638982, 11533190917427724294, 4615802624590667782, 12686235565994680326, 5768565802475864070, 14990336946642006031, 1155366852021624847, 17296127177418522639, 10378756481599295503, 13837538584384638991, 2251829878587407, 2308182802438451215, 6920044742457856015, 16143293634547179535, 9225747012572606479, 3461262635377545231, 8072772732212883471, 11531502063271968783, 4614113770434912271, 12684546711838924815, 5766876948320108559, 14988929601823354893, 1153959507202973709, 17294719832599871501, 10377349136780644365, 13836131239565987853, 844485059936269, 2306775457619800077, 6918637397639204877, 16141886289728528397, 9224339667753955341, 3459855290558894093, 8071365387394232333, 11530094718453317645, 4612706425616261133, 12683139367020273677, 5765469603501457421, 14990055458780590083, 1155085364160208899, 17295845689557106691, 10378474993737879555, 13837257096523223043, 1970342017171459, 2307901314577035267, 6919763254596440067, 16143012146685763587, 9225465524711190531, 3460981147516129283, 8072491244351467523, 11531220575410552835, 4613832282573496323, 12684265223977508867, 5766595460458692611, 14990899875121180680, 1155929780500799496, 17296690105897697288, 10379319410078470152, 13838101512863813640, 2814758357762056, 2308745730917625864, 6920607670937030664, 16143856563026354184, 9226309941051781128, 3461825563856719880, 8073335660692058120, 11532064991751143432, 4614676698914086920, 12685109640318099464, 5767439876799283208, 14989211059619999758, 1154240964999618574, 17295001290396516366, 10377630594577289230, 13836412697362632718, 1125942856581134, 2307056915416444942, 6918918855435849742, 16142167747525173262, 9224621125550600206, 3460136748355538958, 8071646845190877198, 11530376176249962510, 4612987883412905998, 12683420824816918542, 5765751061298102286, 14991181380162334722, 1156211285541953538, 17296971610938851330, 10379600915119624194, 13838383017904967682, 3096263398916098, 2309027235958779906, 6920889175978184706, 16144138068067508226, 9226591446092935170, 3462107068897873922, 8073617165733212162, 11532346496792297474, 4614958203955240962, 12685391145359253506, 5767721381840437250, 14989492495942725636, 1154522401322344452, 17295282726719242244, 10377912030900015108, 13836694133685358596, 1407379179307012, 2307338351739170820, 6919200291758575620, 16142449183847899140, 9224902561873326084, 3460418184678264836, 8071928281513603076, 11530657612572688388, 4613269319735631876, 12683702261139644420, 5766032497620828164] r_cand_key_size_const_long = [5348033148747781, 14355232405585925, 32369630919262213, 32369699638738965, 32369837077692469, 27866512327180405, 23362912698761333, 14355713441923189, 32370043236122725, 32369974516645973, 27866237449273397, 18859313070342261, 5348514185085045, 14355644722446437, 32369905797169221, 27866100010319893, 23362637820854325, 9852113813504117, 23362843979284581, 14355576002969685, 27866168729796645, 18859175631388757, 844639678758965, 844845837189221, 5348308026654789, 9851632777166853, 23362431662424069, 14355301125062677, 32369768358215717, 27866374888226901, 18859038192435253, 844914556665973, 5348445465608293, 14355507283492933, 27866031290843141, 23362500381900821, 14355438564016181, 27866443607703653, 23362775259807829, 9851838935597109, 18859244350865509, 5348376746131541, 9851770216120357, 18859106911912005, 844502239805461, 5348170587701285, 9851907655073861, 18858832034004997] @classmethod def byte2ulong(cls, b, offSet): x = 0 for i in range(7, -1, -1): x = x << 8 ^ b[i + offSet] return x @classmethod def ulong2byte(cls, x): b = [None] * 8 for i in range(0, 8, 1): b[i] = x >> i * 8 & 255 return b @classmethod def ulong2byte_copy(cls, x, b, offSet): for i in range(0, 8, 1): b[offSet + i] = x >> i * 8 & 255 return @classmethod def add_key(cls, state, roundKey): return state ^ roundKey @classmethod def add_constants(cls, state, round): return state ^ cls.RCandKeySizeConstLong[round] @classmethod def sub_cell_shift_row_and_mix_columns(cls, state): temp = cls.T0[state >> 0 & 255] temp ^= cls.T1[state >> 8 & 255] temp ^= cls.T2[state >> 16 & 255] temp ^= cls.T3[state >> 24 & 255] temp ^= cls.T4[state >> 32 & 255] temp ^= cls.T5[state >> 40 & 255] temp ^= cls.T6[state >> 48 & 255] temp ^= cls.T7[state >> 56 & 255] return temp @classmethod def step(cls, state, step): for i in range(0, 4, 1): state = cls.AddConstants(state, step * 4 + i) state = cls.SubCellShiftRowAndMixColumns(state) return state @classmethod def encrypt_one_block(cls, state, sk0, sk1): for i in range(0, 12, 2): state = cls.AddKey(state, sk0) state = cls.Step(state, i) state = cls.AddKey(state, sk1) state = cls.Step(state, i + 1) state = cls.AddKey(state, sk0) return state @classmethod def encrypt(cls, plainText, key): cipher_text = [None] * len(plainText) sk0 = cls.byte2ulong(key, 0) sk2 = [None] * 8 for i in range(0, 8, 1): sk2[i] = key[(8 + i) % 10] sk1 = cls.byte2ulong(sk2, 0) for i in range(0, len(plainText), 8): state = cls.byte2ulong(plainText, i) state = cls.EncryptOneBlock(state, sk0, sk1) cls.ulong2byteCopy(state, cipherText, i) return cipherText
#!python class BinaryMinHeap(object): """BinaryMinHeap: a partially ordered collection with efficient methods to insert new items in partial order and to access and remove its minimum item. Items are stored in a dynamic array that implicitly represents a complete binary tree with root node at index 0 and last leaf node at index n-1.""" def __init__(self, items=None): """Initialize this heap and insert the given items, if any.""" # Initialize an empty list to store the items self.items = [] if items: for item in items: self.insert(item) def __repr__(self): """Return a string representation of this heap.""" return 'BinaryMinHeap({})'.format(self.items) def is_empty(self): """Return True if this heap is empty, or False otherwise.""" # TODO: Check if empty based on how many items are in the list # ... def size(self): """Return the number of items in this heap.""" return len(self.items) def insert(self, item): """Insert the given item into this heap. TODO: Best case running time: ??? under what conditions? TODO: Worst case running time: ??? under what conditions?""" # Insert the item at the end and bubble up to the root self.items.append(item) if self.size() > 1: self._bubble_up(self._last_index()) def get_min(self): """Return the minimum item at the root of this heap. Best and worst case running time: O(1) because min item is the root.""" if self.size() == 0: raise ValueError('Heap is empty and has no minimum item') assert self.size() > 0 return self.items[0] def delete_min(self): """Remove and return the minimum item at the root of this heap. TODO: Best case running time: ??? under what conditions? TODO: Worst case running time: ??? under what conditions?""" if self.size() == 0: raise ValueError('Heap is empty and has no minimum item') elif self.size() == 1: # Remove and return the only item return self.items.pop() assert self.size() > 1 min_item = self.items[0] # Move the last item to the root and bubble down to the leaves last_item = self.items.pop() self.items[0] = last_item if self.size() > 1: self._bubble_down(0) return min_item def replace_min(self, item): """Remove and return the minimum item at the root of this heap, and insert the given item into this heap. This method is more efficient than calling delete_min and then insert. TODO: Best case running time: ??? under what conditions? TODO: Worst case running time: ??? under what conditions?""" if self.size() == 0: raise ValueError('Heap is empty and has no minimum item') assert self.size() > 0 min_item = self.items[0] # Replace the root and bubble down to the leaves self.items[0] = item if self.size() > 1: self._bubble_down(0) return min_item def _bubble_up(self, index): """Ensure the heap ordering property is true above the given index, swapping out of order items, or until the root node is reached. Best case running time: O(1) if parent item is smaller than this item. Worst case running time: O(log n) if items on path up to root node are out of order. Maximum path length in complete binary tree is log n.""" if index == 0: return # This index is the root node (does not have a parent) if not (0 <= index <= self._last_index()): raise IndexError('Invalid index: {}'.format(index)) # Get the item's value item = self.items[index] # Get the parent's index and value parent_index = self._parent_index(index) parent_item = self.items[parent_index] # TODO: Swap this item with parent item if values are out of order # ... # TODO: Recursively bubble up again if necessary # ... def _bubble_down(self, index): """Ensure the heap ordering property is true below the given index, swapping out of order items, or until a leaf node is reached. Best case running time: O(1) if item is smaller than both child items. Worst case running time: O(log n) if items on path down to a leaf are out of order. Maximum path length in complete binary tree is log n.""" if not (0 <= index <= self._last_index()): raise IndexError('Invalid index: {}'.format(index)) # Get the index of the item's left and right children left_index = self._left_child_index(index) right_index = self._right_child_index(index) if left_index > self._last_index(): return # This index is a leaf node (does not have any children) # Get the item's value item = self.items[index] # TODO: Determine which child item to compare this node's item to child_index = 0 # ... # TODO: Swap this item with a child item if values are out of order child_item = self.items[child_index] # ... # TODO: Recursively bubble down again if necessary # ... def _last_index(self): """Return the last valid index in the underlying array of items.""" return len(self.items) - 1 def _parent_index(self, index): """Return the parent index of the item at the given index.""" if index <= 0: raise IndexError('Heap index {} has no parent index'.format(index)) return (index - 1) >> 1 # Shift right to divide by 2 def _left_child_index(self, index): """Return the left child index of the item at the given index.""" return (index << 1) + 1 # Shift left to multiply by 2 def _right_child_index(self, index): """Return the right child index of the item at the given index.""" return (index << 1) + 2 # Shift left to multiply by 2 def test_binary_min_heap(): # Create a binary min heap of 7 items items = [9, 25, 86, 3, 29, 5, 55] heap = BinaryMinHeap() print('heap: {}'.format(heap)) print('\nInserting items:') for index, item in enumerate(items): heap.insert(item) print('insert({})'.format(item)) print('heap: {}'.format(heap)) print('size: {}'.format(heap.size())) heap_min = heap.get_min() real_min = min(items[: index + 1]) correct = heap_min == real_min print('get_min: {}, correct: {}'.format(heap_min, correct)) print('\nDeleting items:') for item in sorted(items): heap_min = heap.delete_min() print('delete_min: {}'.format(heap_min)) print('heap: {}'.format(heap)) print('size: {}'.format(heap.size())) if __name__ == '__main__': test_binary_min_heap()
class Binaryminheap(object): """BinaryMinHeap: a partially ordered collection with efficient methods to insert new items in partial order and to access and remove its minimum item. Items are stored in a dynamic array that implicitly represents a complete binary tree with root node at index 0 and last leaf node at index n-1.""" def __init__(self, items=None): """Initialize this heap and insert the given items, if any.""" self.items = [] if items: for item in items: self.insert(item) def __repr__(self): """Return a string representation of this heap.""" return 'BinaryMinHeap({})'.format(self.items) def is_empty(self): """Return True if this heap is empty, or False otherwise.""" def size(self): """Return the number of items in this heap.""" return len(self.items) def insert(self, item): """Insert the given item into this heap. TODO: Best case running time: ??? under what conditions? TODO: Worst case running time: ??? under what conditions?""" self.items.append(item) if self.size() > 1: self._bubble_up(self._last_index()) def get_min(self): """Return the minimum item at the root of this heap. Best and worst case running time: O(1) because min item is the root.""" if self.size() == 0: raise value_error('Heap is empty and has no minimum item') assert self.size() > 0 return self.items[0] def delete_min(self): """Remove and return the minimum item at the root of this heap. TODO: Best case running time: ??? under what conditions? TODO: Worst case running time: ??? under what conditions?""" if self.size() == 0: raise value_error('Heap is empty and has no minimum item') elif self.size() == 1: return self.items.pop() assert self.size() > 1 min_item = self.items[0] last_item = self.items.pop() self.items[0] = last_item if self.size() > 1: self._bubble_down(0) return min_item def replace_min(self, item): """Remove and return the minimum item at the root of this heap, and insert the given item into this heap. This method is more efficient than calling delete_min and then insert. TODO: Best case running time: ??? under what conditions? TODO: Worst case running time: ??? under what conditions?""" if self.size() == 0: raise value_error('Heap is empty and has no minimum item') assert self.size() > 0 min_item = self.items[0] self.items[0] = item if self.size() > 1: self._bubble_down(0) return min_item def _bubble_up(self, index): """Ensure the heap ordering property is true above the given index, swapping out of order items, or until the root node is reached. Best case running time: O(1) if parent item is smaller than this item. Worst case running time: O(log n) if items on path up to root node are out of order. Maximum path length in complete binary tree is log n.""" if index == 0: return if not 0 <= index <= self._last_index(): raise index_error('Invalid index: {}'.format(index)) item = self.items[index] parent_index = self._parent_index(index) parent_item = self.items[parent_index] def _bubble_down(self, index): """Ensure the heap ordering property is true below the given index, swapping out of order items, or until a leaf node is reached. Best case running time: O(1) if item is smaller than both child items. Worst case running time: O(log n) if items on path down to a leaf are out of order. Maximum path length in complete binary tree is log n.""" if not 0 <= index <= self._last_index(): raise index_error('Invalid index: {}'.format(index)) left_index = self._left_child_index(index) right_index = self._right_child_index(index) if left_index > self._last_index(): return item = self.items[index] child_index = 0 child_item = self.items[child_index] def _last_index(self): """Return the last valid index in the underlying array of items.""" return len(self.items) - 1 def _parent_index(self, index): """Return the parent index of the item at the given index.""" if index <= 0: raise index_error('Heap index {} has no parent index'.format(index)) return index - 1 >> 1 def _left_child_index(self, index): """Return the left child index of the item at the given index.""" return (index << 1) + 1 def _right_child_index(self, index): """Return the right child index of the item at the given index.""" return (index << 1) + 2 def test_binary_min_heap(): items = [9, 25, 86, 3, 29, 5, 55] heap = binary_min_heap() print('heap: {}'.format(heap)) print('\nInserting items:') for (index, item) in enumerate(items): heap.insert(item) print('insert({})'.format(item)) print('heap: {}'.format(heap)) print('size: {}'.format(heap.size())) heap_min = heap.get_min() real_min = min(items[:index + 1]) correct = heap_min == real_min print('get_min: {}, correct: {}'.format(heap_min, correct)) print('\nDeleting items:') for item in sorted(items): heap_min = heap.delete_min() print('delete_min: {}'.format(heap_min)) print('heap: {}'.format(heap)) print('size: {}'.format(heap.size())) if __name__ == '__main__': test_binary_min_heap()
def moveZeroes(nums): """ Move all zeros to the end of the given array (nums) with keeping the order of other elements. Do not return anything, modify nums in-place instead. """ # counter = 0 # for i in range(len(nums) - 1): # if nums[counter] == 0: # nums.pop(counter) # nums.append(0) # else: # counter += 1 # return nums """O(n) solution""" last_zero = 0 for i in range(len(nums)): if nums[i] != 0: nums[i], nums[last_zero] = nums[last_zero], nums[i] last_zero += 1 return nums print(moveZeroes([0, 1, 0, 3, 12]))
def move_zeroes(nums): """ Move all zeros to the end of the given array (nums) with keeping the order of other elements. Do not return anything, modify nums in-place instead. """ 'O(n) solution' last_zero = 0 for i in range(len(nums)): if nums[i] != 0: (nums[i], nums[last_zero]) = (nums[last_zero], nums[i]) last_zero += 1 return nums print(move_zeroes([0, 1, 0, 3, 12]))
# https://leetcode.com/problems/jump-game/ class Solution: def canJump(self, nums: list[int]) -> bool: last = 0 for index in range(len(nums)): if index > last: return False last = max(last, index + nums[index]) if last >= len(nums) - 1: return True return True nums = [2, 3, 1, 1, 4] print(Solution().canJump(nums)) nums = [3, 2, 1, 0, 4] print(Solution().canJump(nums))
class Solution: def can_jump(self, nums: list[int]) -> bool: last = 0 for index in range(len(nums)): if index > last: return False last = max(last, index + nums[index]) if last >= len(nums) - 1: return True return True nums = [2, 3, 1, 1, 4] print(solution().canJump(nums)) nums = [3, 2, 1, 0, 4] print(solution().canJump(nums))
def calculate(mass): if mass < 6: return 0 return int(mass/3-2) + calculate(int(mass/3-2)) with open("1.txt", "r") as infile: print("First part solution: ", sum([int(int(x)/3)-2 for x in infile.readlines()])) print("Second part solution: ", sum([calculate(int(x)) for x in infile.readlines()]))
def calculate(mass): if mass < 6: return 0 return int(mass / 3 - 2) + calculate(int(mass / 3 - 2)) with open('1.txt', 'r') as infile: print('First part solution: ', sum([int(int(x) / 3) - 2 for x in infile.readlines()])) print('Second part solution: ', sum([calculate(int(x)) for x in infile.readlines()]))
# -*- coding: utf-8 -*- """ meraki This file was automatically generated for meraki by APIMATIC v2.0 ( https://apimatic.io ). """ class Type2Enum(object): """Implementation of the 'Type2' enum. Type of the L7 Rule. Must be 'application', 'applicationCategory', 'host', 'port' or 'ipRange' Attributes: APPLICATION: TODO: type description here. APPLICATIONCATEGORY: TODO: type description here. HOST: TODO: type description here. PORT: TODO: type description here. IPRANGE: TODO: type description here. """ APPLICATION = 'application' APPLICATIONCATEGORY = 'applicationCategory' HOST = 'host' PORT = 'port' IPRANGE = 'ipRange'
""" meraki This file was automatically generated for meraki by APIMATIC v2.0 ( https://apimatic.io ). """ class Type2Enum(object): """Implementation of the 'Type2' enum. Type of the L7 Rule. Must be 'application', 'applicationCategory', 'host', 'port' or 'ipRange' Attributes: APPLICATION: TODO: type description here. APPLICATIONCATEGORY: TODO: type description here. HOST: TODO: type description here. PORT: TODO: type description here. IPRANGE: TODO: type description here. """ application = 'application' applicationcategory = 'applicationCategory' host = 'host' port = 'port' iprange = 'ipRange'
class Dimension: def __init__(self, x1, y1, x2, y2): self.x1 = x1 self.y1 = y1 self.x2 = x2 self.y2 = y2 @property def width(self): return self.x2 - self.x1 @property def height(self): return self.y2 - self.y1 @property def aspect_ratio(self): if self.height > 0: return self.width / self.height return self.width def wider(self, other_dimension): return self.aspect_ratio > other_dimension.aspect_ratio def __str__(self): return "{} {} {} {}".format(self.x1, self.y1, self.x2, self.y2) class Decider: def __init__(self, np_array): self.upvote = True self.decided = True self.__process__(np_array) def __process__(self, np_array): if len(np_array) < 2: self.decided = False return dimensions = [] def give_me_dimensions(block): min_x = block[0][0][0] min_y = block[0][0][1] max_x = block[0][0][0] max_y = block[0][0][1] for point in block: x = point[0][0] y = point[0][1] if min_x > x: min_x = x elif max_x < x: max_x = x if min_y > y: min_y = y elif max_y < y: max_y = y return Dimension(min_x, min_y, max_x, max_y) self.thumb_area = 0 self.palm_area = 0 i = 0 for i, hull in enumerate(np_array): hull_rectangle = give_me_dimensions(hull) dimensions.append(hull_rectangle) if hull_rectangle.wider(dimensions[self.palm_area]): self.palm_area = i elif dimensions[self.thumb_area].wider(hull_rectangle): self.thumb_area = i if dimensions[self.thumb_area].aspect_ratio < 0.2: print( "Too low aspect ratio {}".format( dimensions[self.thumb_area].aspect_ratio ) ) self.decided = False return upvote_patterns = 0 downvote_patterns = 0 if (dimensions[self.thumb_area].y2 + dimensions[self.thumb_area].y1) / 2 > ( dimensions[self.palm_area].y2 + dimensions[self.palm_area].y1 ) / 2: upvote_patterns += 1 else: downvote_patterns += 1 if dimensions[self.thumb_area].y1 < dimensions[self.palm_area].y1: higher = 0 lower = 0 total = 0 for dimension in dimensions: if dimension not in ( dimensions[self.thumb_area], dimensions[self.palm_area], ): total += 1 if dimensions[self.thumb_area].y2 > dimension.y2: higher += 1 if dimensions[self.thumb_area].y1 < dimension.y1: lower += 1 if higher + lower < total * 1.5: if higher > lower + 1 + total * 0.2: upvote_patterns += 1 elif lower > higher + 1 + total * 0.2: downvote_patterns += 1 if dimensions[self.thumb_area].y2 > dimensions[self.palm_area].y2: downvote_patterns += 1 if dimensions[self.thumb_area].y1 < dimensions[self.palm_area].y1: upvote_patterns += 1 rules_count = 3 if upvote_patterns > rules_count / 2: self.upvote = True elif downvote_patterns > rules_count / 2: self.upvote = False else: self.decided = False def is_upvote(self): return self.upvote def is_decided(self): return self.decided def __thumb_area(self): return self.thumb_area def __palm_area(self): return self.palm_area
class Dimension: def __init__(self, x1, y1, x2, y2): self.x1 = x1 self.y1 = y1 self.x2 = x2 self.y2 = y2 @property def width(self): return self.x2 - self.x1 @property def height(self): return self.y2 - self.y1 @property def aspect_ratio(self): if self.height > 0: return self.width / self.height return self.width def wider(self, other_dimension): return self.aspect_ratio > other_dimension.aspect_ratio def __str__(self): return '{} {} {} {}'.format(self.x1, self.y1, self.x2, self.y2) class Decider: def __init__(self, np_array): self.upvote = True self.decided = True self.__process__(np_array) def __process__(self, np_array): if len(np_array) < 2: self.decided = False return dimensions = [] def give_me_dimensions(block): min_x = block[0][0][0] min_y = block[0][0][1] max_x = block[0][0][0] max_y = block[0][0][1] for point in block: x = point[0][0] y = point[0][1] if min_x > x: min_x = x elif max_x < x: max_x = x if min_y > y: min_y = y elif max_y < y: max_y = y return dimension(min_x, min_y, max_x, max_y) self.thumb_area = 0 self.palm_area = 0 i = 0 for (i, hull) in enumerate(np_array): hull_rectangle = give_me_dimensions(hull) dimensions.append(hull_rectangle) if hull_rectangle.wider(dimensions[self.palm_area]): self.palm_area = i elif dimensions[self.thumb_area].wider(hull_rectangle): self.thumb_area = i if dimensions[self.thumb_area].aspect_ratio < 0.2: print('Too low aspect ratio {}'.format(dimensions[self.thumb_area].aspect_ratio)) self.decided = False return upvote_patterns = 0 downvote_patterns = 0 if (dimensions[self.thumb_area].y2 + dimensions[self.thumb_area].y1) / 2 > (dimensions[self.palm_area].y2 + dimensions[self.palm_area].y1) / 2: upvote_patterns += 1 else: downvote_patterns += 1 if dimensions[self.thumb_area].y1 < dimensions[self.palm_area].y1: higher = 0 lower = 0 total = 0 for dimension in dimensions: if dimension not in (dimensions[self.thumb_area], dimensions[self.palm_area]): total += 1 if dimensions[self.thumb_area].y2 > dimension.y2: higher += 1 if dimensions[self.thumb_area].y1 < dimension.y1: lower += 1 if higher + lower < total * 1.5: if higher > lower + 1 + total * 0.2: upvote_patterns += 1 elif lower > higher + 1 + total * 0.2: downvote_patterns += 1 if dimensions[self.thumb_area].y2 > dimensions[self.palm_area].y2: downvote_patterns += 1 if dimensions[self.thumb_area].y1 < dimensions[self.palm_area].y1: upvote_patterns += 1 rules_count = 3 if upvote_patterns > rules_count / 2: self.upvote = True elif downvote_patterns > rules_count / 2: self.upvote = False else: self.decided = False def is_upvote(self): return self.upvote def is_decided(self): return self.decided def __thumb_area(self): return self.thumb_area def __palm_area(self): return self.palm_area
with open("../documentation/resource-doc.txt", "r") as DOC_FILE: __doc__ = DOC_FILE.read() def repositionItemInList(__index, __item, __list): __list.remove(__item) __list.insert(__index, __item) return __list def removeItems(__item_list, __list): for item in __item_list: try: __list.remove(item) except ValueError: continue return __list def removeNonePyExtensions(__list): has_py_extension_conditional = {1: (lambda: 0)} invalid_items = [] for item in __list: try: has_py_extension_conditional[(item.split(".")[1] == "py") + 0]() except (KeyError, IndexError): invalid_items.append(item) __list = removeItems(invalid_items, __list) return __list
with open('../documentation/resource-doc.txt', 'r') as doc_file: __doc__ = DOC_FILE.read() def reposition_item_in_list(__index, __item, __list): __list.remove(__item) __list.insert(__index, __item) return __list def remove_items(__item_list, __list): for item in __item_list: try: __list.remove(item) except ValueError: continue return __list def remove_none_py_extensions(__list): has_py_extension_conditional = {1: lambda : 0} invalid_items = [] for item in __list: try: has_py_extension_conditional[(item.split('.')[1] == 'py') + 0]() except (KeyError, IndexError): invalid_items.append(item) __list = remove_items(invalid_items, __list) return __list
# SPDX-License-Identifier: Apache-2.0 """ Constants used with this package. For more details about this api, please refer to the documentation at https://github.com/G-Two/subarulink """ COUNTRY_USA = "USA" COUNTRY_CAN = "CAN" MOBILE_API_SERVER = { COUNTRY_USA: "mobileapi.prod.subarucs.com", COUNTRY_CAN: "mobileapi.ca.prod.subarucs.com", } MOBILE_API_VERSION = "/g2v17" MOBILE_APP = { COUNTRY_USA: "com.subaru.telematics.app.remote", COUNTRY_CAN: "ca.subaru.telematics.remote", } WEB_API_SERVER = {COUNTRY_USA: "www.mysubaru.com", COUNTRY_CAN: "www.mysubaru.ca"} WEB_API_LOGIN = "/login" WEB_API_AUTHORIZE_DEVICE = "/profile/updateDeviceEntry.json" WEB_API_NAME_DEVICE = "/profile/addDeviceName.json" # Same API for g1 and g2 API_LOGIN = "/login.json" API_REFRESH_VEHICLES = "/refreshVehicles.json" API_SELECT_VEHICLE = "/selectVehicle.json" API_VALIDATE_SESSION = "/validateSession.json" API_VEHICLE_STATUS = "/vehicleStatus.json" API_AUTHORIZE_DEVICE = "/authenticateDevice.json" API_NAME_DEVICE = "/nameThisDevice.json" # Similar API for g1 and g2 -- controller should replace 'api_gen' with either 'g1' or 'g2' API_LOCK = "/service/api_gen/lock/execute.json" API_LOCK_CANCEL = "/service/api_gen/lock/cancel.json" API_UNLOCK = "/service/api_gen/unlock/execute.json" API_UNLOCK_CANCEL = "/service/api_gen/unlock/cancel.json" API_HORN_LIGHTS = "/service/api_gen/hornLights/execute.json" API_HORN_LIGHTS_CANCEL = "/service/api_gen/hornLights/cancel.json" API_HORN_LIGHTS_STOP = "/service/api_gen/hornLights/stop.json" API_LIGHTS = "/service/api_gen/lightsOnly/execute.json" API_LIGHTS_CANCEL = "/service/api_gen/lightsOnly/cancel.json" API_LIGHTS_STOP = "/service/api_gen/lightsOnly/stop.json" API_CONDITION = "/service/api_gen/condition/execute.json" API_LOCATE = "/service/api_gen/locate/execute.json" API_REMOTE_SVC_STATUS = "/service/api_gen/remoteService/status.json" # Different API for g1 and g2 API_G1_LOCATE_UPDATE = "/service/g1/vehicleLocate/execute.json" API_G1_LOCATE_STATUS = "/service/g1/vehicleLocate/status.json" API_G2_LOCATE_UPDATE = "/service/g2/vehicleStatus/execute.json" API_G2_LOCATE_STATUS = "/service/g2/vehicleStatus/locationStatus.json" # g1-Only API API_G1_HORN_LIGHTS_STATUS = "/service/g1/hornLights/status.json" # g2-Only API API_G2_SEND_POI = "/service/g2/sendPoi/execute.json" API_G2_SPEEDFENCE = "/service/g2/speedFence/execute.json" API_G2_GEOFENCE = "/service/g2/geoFence/execute.json" API_G2_CURFEW = "/service/g2/curfew/execute.json" API_G2_REMOTE_ENGINE_START = "/service/g2/engineStart/execute.json" API_G2_REMOTE_ENGINE_START_CANCEL = "/service/g2/engineStart/cancel.json" API_G2_REMOTE_ENGINE_STOP = "/service/g2/engineStop/execute.json" API_G2_FETCH_CLIMATE_SETTINGS = "/service/g2/remoteEngineStart/fetch.json" API_G2_SAVE_CLIMATE_SETTINGS = "/service/g2/remoteEngineStart/save.json" # EV-Only API API_EV_CHARGE_NOW = "/service/g2/phevChargeNow/execute.json" API_EV_FETCH_CHARGE_SETTINGS = "/service/g2/phevGetTimerSettings/execute.json" API_EV_SAVE_CHARGE_SETTINGS = "/service/g2/phevSendTimerSetting/execute.json" API_EV_DELETE_CHARGE_SCHEDULE = "/service/g2/phevDeleteTimerSetting/execute.json" SERVICE_REQ_ID = "serviceRequestId" # Remote start constants TEMP_F = "climateZoneFrontTemp" TEMP_F_MAX = 85 TEMP_F_MIN = 60 TEMP_C = "climateZoneFrontTempCelsius" TEMP_C_MAX = 30 TEMP_C_MIN = 15 CLIMATE = "climateSettings" CLIMATE_DEFAULT = "climateSettings" RUNTIME = "runTimeMinutes" RUNTIME_DEFAULT = "10" MODE = "climateZoneFrontAirMode" MODE_DEFROST = "WINDOW" MODE_FEET_DEFROST = "FEET_WINDOW" MODE_FACE = "FACE" MODE_FEET = "FEET" MODE_SPLIT = "FEET_FACE_BALANCED" MODE_AUTO = "AUTO" HEAT_SEAT_LEFT = "heatedSeatFrontLeft" HEAT_SEAT_RIGHT = "heatedSeatFrontRight" HEAT_SEAT_HI = "HIGH_HEAT" HEAT_SEAT_MED = "MEDIUM_HEAT" HEAT_SEAT_LOW = "LOW_HEAT" HEAT_SEAT_OFF = "OFF" REAR_DEFROST = "heatedRearWindowActive" REAR_DEFROST_ON = "true" REAR_DEFROST_OFF = "false" FAN_SPEED = "climateZoneFrontAirVolume" FAN_SPEED_LOW = "2" FAN_SPEED_MED = "4" FAN_SPEED_HI = "7" FAN_SPEED_AUTO = "AUTO" RECIRCULATE = "outerAirCirculation" RECIRCULATE_OFF = "outsideAir" RECIRCULATE_ON = "recirculation" REAR_AC = "airConditionOn" REAR_AC_ON = "true" REAR_AC_OFF = "false" START_CONFIG = "startConfiguration" START_CONFIG_DEFAULT_EV = "start_Climate_Control_only_allow_key_in_ignition" START_CONFIG_DEFAULT_RES = "START_ENGINE_ALLOW_KEY_IN_IGNITION" VALID_CLIMATE_OPTIONS = { CLIMATE: [CLIMATE_DEFAULT], TEMP_C: [str(_) for _ in range(TEMP_C_MIN, TEMP_C_MAX + 1)], TEMP_F: [str(_) for _ in range(TEMP_F_MIN, TEMP_F_MAX + 1)], FAN_SPEED: [FAN_SPEED_AUTO, FAN_SPEED_LOW, FAN_SPEED_MED, FAN_SPEED_HI], HEAT_SEAT_LEFT: [HEAT_SEAT_OFF, HEAT_SEAT_LOW, HEAT_SEAT_MED, HEAT_SEAT_HI], HEAT_SEAT_RIGHT: [HEAT_SEAT_OFF, HEAT_SEAT_LOW, HEAT_SEAT_MED, HEAT_SEAT_HI], MODE: [ MODE_DEFROST, MODE_FEET_DEFROST, MODE_FACE, MODE_FEET, MODE_SPLIT, MODE_AUTO, ], RECIRCULATE: [RECIRCULATE_OFF, RECIRCULATE_ON], REAR_AC: [REAR_AC_OFF, REAR_AC_ON], REAR_DEFROST: [REAR_DEFROST_OFF, REAR_DEFROST_ON], START_CONFIG: [START_CONFIG_DEFAULT_EV, START_CONFIG_DEFAULT_RES], RUNTIME: [str(RUNTIME_DEFAULT)], } # Unlock doors constants WHICH_DOOR = "unlockDoorType" ALL_DOORS = "ALL_DOORS_CMD" DRIVERS_DOOR = "FRONT_LEFT_DOOR_CMD" # Location data constants HEADING = "heading" LATITUDE = "latitude" LONGITUDE = "longitude" LOCATION_TIME = "locationTimestamp" SPEED = "speed" BAD_LATITUDE = 90.0 BAD_LONGITUDE = 180.0 # Vehicle status constants AVG_FUEL_CONSUMPTION = "AVG_FUEL_CONSUMPTION" BATTERY_VOLTAGE = "BATTERY_VOLTAGE" DIST_TO_EMPTY = "DISTANCE_TO_EMPTY_FUEL" DOOR_BOOT_POSITION = "DOOR_BOOT_POSITION" DOOR_ENGINE_HOOD_POSITION = "DOOR_ENGINE_HOOD_POSITION" DOOR_FRONT_LEFT_POSITION = "DOOR_FRONT_LEFT_POSITION" DOOR_FRONT_RIGHT_POSITION = "DOOR_FRONT_RIGHT_POSITION" DOOR_REAR_LEFT_POSITION = "DOOR_REAR_LEFT_POSITION" DOOR_REAR_RIGHT_POSITION = "DOOR_REAR_RIGHT_POSITION" EV_CHARGER_STATE_TYPE = "EV_CHARGER_STATE_TYPE" EV_CHARGE_SETTING_AMPERE_TYPE = "EV_CHARGE_SETTING_AMPERE_TYPE" EV_CHARGE_VOLT_TYPE = "EV_CHARGE_VOLT_TYPE" EV_DISTANCE_TO_EMPTY = "EV_DISTANCE_TO_EMPTY" EV_IS_PLUGGED_IN = "EV_IS_PLUGGED_IN" EV_STATE_OF_CHARGE_MODE = "EV_STATE_OF_CHARGE_MODE" EV_STATE_OF_CHARGE_PERCENT = "EV_STATE_OF_CHARGE_PERCENT" EV_TIME_TO_FULLY_CHARGED = "EV_TIME_TO_FULLY_CHARGED" EV_TIME_TO_FULLY_CHARGED_UTC = "EV_TIME_TO_FULLY_CHARGED_UTC" EXTERNAL_TEMP = "EXT_EXTERNAL_TEMP" ODOMETER = "ODOMETER" POSITION_TIMESTAMP = "POSITION_TIMESTAMP" TIMESTAMP = "TIMESTAMP" TIRE_PRESSURE_FL = "TYRE_PRESSURE_FRONT_LEFT" TIRE_PRESSURE_FR = "TYRE_PRESSURE_FRONT_RIGHT" TIRE_PRESSURE_RL = "TYRE_PRESSURE_REAR_LEFT" TIRE_PRESSURE_RR = "TYRE_PRESSURE_REAR_RIGHT" VEHICLE_STATE = "VEHICLE_STATE_TYPE" WINDOW_FRONT_LEFT_STATUS = "WINDOW_FRONT_LEFT_STATUS" WINDOW_FRONT_RIGHT_STATUS = "WINDOW_FRONT_RIGHT_STATUS" WINDOW_REAR_LEFT_STATUS = "WINDOW_REAR_LEFT_STATUS" WINDOW_REAR_RIGHT_STATUS = "WINDOW_REAR_RIGHT_STATUS" CHARGING = "CHARGING" LOCKED_CONNECTED = "LOCKED_CONNECTED" UNLOCKED_CONNECTED = "UNLOCKED_CONNECTED" DOOR_OPEN = "OPEN" DOOR_CLOSED = "CLOSED" WINDOW_OPEN = "OPEN" WINDOW_CLOSED = "CLOSE" IGNITION_ON = "IGNITION_ON" NOT_EQUIPPED = "NOT_EQUIPPED" # vehicleStatus.json keys VS_AVG_FUEL_CONSUMPTION = "avgFuelConsumptionLitersPer100Kilometers" VS_DIST_TO_EMPTY = "distanceToEmptyFuelKilometers" VS_TIMESTAMP = "eventDate" VS_LATITUDE = "latitude" VS_LONGITUDE = "longitude" VS_HEADING = "positionHeadingDegree" VS_ODOMETER = "odometerValueKilometers" VS_VEHICLE_STATE = "vehicleStateType" VS_TIRE_PRESSURE_FL = "tirePressureFrontLeft" VS_TIRE_PRESSURE_FR = "tirePressureFrontRight" VS_TIRE_PRESSURE_RL = "tirePressureRearLeft" VS_TIRE_PRESSURE_RR = "tirePressureRearRight" # Erroneous Values BAD_AVG_FUEL_CONSUMPTION = "16383" BAD_DISTANCE_TO_EMPTY_FUEL = "16383" BAD_EV_TIME_TO_FULLY_CHARGED = "65535" BAD_TIRE_PRESSURE = "32767" BAD_ODOMETER = None BAD_EXTERNAL_TEMP = "-64.0" BAD_SENSOR_VALUES = [ BAD_AVG_FUEL_CONSUMPTION, BAD_DISTANCE_TO_EMPTY_FUEL, BAD_EV_TIME_TO_FULLY_CHARGED, BAD_TIRE_PRESSURE, BAD_ODOMETER, BAD_EXTERNAL_TEMP, ] UNKNOWN = "UNKNOWN" VENTED = "VENTED" BAD_BINARY_SENSOR_VALUES = [UNKNOWN, VENTED, NOT_EQUIPPED] LOCATION_VALID = "location_valid" # Timestamp Formats TIMESTAMP_FMT = "%Y-%m-%dT%H:%M:%S%z" # "2020-04-25T23:35:55+0000" POSITION_TIMESTAMP_FMT = "%Y-%m-%dT%H:%M:%SZ" # "2020-04-25T23:35:55Z" # G2 Error Codes ERROR_SOA_403 = "403-soa-unableToParseResponseBody" ERROR_INVALID_CREDENTIALS = "InvalidCredentials" ERROR_SERVICE_ALREADY_STARTED = "ServiceAlreadyStarted" ERROR_INVALID_ACCOUNT = "invalidAccount" ERROR_PASSWORD_WARNING = "passwordWarning" ERROR_ACCOUNT_LOCKED = "accountLocked" ERROR_NO_VEHICLES = "noVehiclesOnAccount" ERROR_NO_ACCOUNT = "accountNotFound" ERROR_TOO_MANY_ATTEMPTS = "tooManyAttempts" ERROR_VEHICLE_NOT_IN_ACCOUNT = "vehicleNotInAccount" # G1 Error Codes ERROR_G1_NO_SUBSCRIPTION = "SXM40004" ERROR_G1_STOLEN_VEHICLE = "SXM40005" ERROR_G1_INVALID_PIN = "SXM40006" ERROR_G1_SERVICE_ALREADY_STARTED = "SXM40009" ERROR_G1_PIN_LOCKED = "SXM40017" # Controller Vehicle Data Dict Keys VEHICLE_ATTRIBUTES = "attributes" VEHICLE_STATUS = "status" VEHICLE_ID = "id" VEHICLE_NAME = "nickname" VEHICLE_API_GEN = "api_gen" VEHICLE_LOCK = "lock" VEHICLE_LAST_UPDATE = "last_update_time" VEHICLE_LAST_FETCH = "last_fetch_time" VEHICLE_FEATURES = "features" VEHICLE_SUBSCRIPTION_FEATURES = "subscriptionFeatures" VEHICLE_SUBSCRIPTION_STATUS = "subscriptionStatus" FEATURE_PHEV = "PHEV" FEATURE_REMOTE_START = "RES" FEATURE_G1_TELEMATICS = "g1" """Vehicle has 2016-2018 telematics version.""" FEATURE_G2_TELEMATICS = "g2" """Vehicle has 2019+ telematics version.""" FEATURE_REMOTE = "REMOTE" FEATURE_SAFETY = "SAFETY" FEATURE_ACTIVE = "ACTIVE" DEFAULT_UPDATE_INTERVAL = 7200 DEFAULT_FETCH_INTERVAL = 300
""" Constants used with this package. For more details about this api, please refer to the documentation at https://github.com/G-Two/subarulink """ country_usa = 'USA' country_can = 'CAN' mobile_api_server = {COUNTRY_USA: 'mobileapi.prod.subarucs.com', COUNTRY_CAN: 'mobileapi.ca.prod.subarucs.com'} mobile_api_version = '/g2v17' mobile_app = {COUNTRY_USA: 'com.subaru.telematics.app.remote', COUNTRY_CAN: 'ca.subaru.telematics.remote'} web_api_server = {COUNTRY_USA: 'www.mysubaru.com', COUNTRY_CAN: 'www.mysubaru.ca'} web_api_login = '/login' web_api_authorize_device = '/profile/updateDeviceEntry.json' web_api_name_device = '/profile/addDeviceName.json' api_login = '/login.json' api_refresh_vehicles = '/refreshVehicles.json' api_select_vehicle = '/selectVehicle.json' api_validate_session = '/validateSession.json' api_vehicle_status = '/vehicleStatus.json' api_authorize_device = '/authenticateDevice.json' api_name_device = '/nameThisDevice.json' api_lock = '/service/api_gen/lock/execute.json' api_lock_cancel = '/service/api_gen/lock/cancel.json' api_unlock = '/service/api_gen/unlock/execute.json' api_unlock_cancel = '/service/api_gen/unlock/cancel.json' api_horn_lights = '/service/api_gen/hornLights/execute.json' api_horn_lights_cancel = '/service/api_gen/hornLights/cancel.json' api_horn_lights_stop = '/service/api_gen/hornLights/stop.json' api_lights = '/service/api_gen/lightsOnly/execute.json' api_lights_cancel = '/service/api_gen/lightsOnly/cancel.json' api_lights_stop = '/service/api_gen/lightsOnly/stop.json' api_condition = '/service/api_gen/condition/execute.json' api_locate = '/service/api_gen/locate/execute.json' api_remote_svc_status = '/service/api_gen/remoteService/status.json' api_g1_locate_update = '/service/g1/vehicleLocate/execute.json' api_g1_locate_status = '/service/g1/vehicleLocate/status.json' api_g2_locate_update = '/service/g2/vehicleStatus/execute.json' api_g2_locate_status = '/service/g2/vehicleStatus/locationStatus.json' api_g1_horn_lights_status = '/service/g1/hornLights/status.json' api_g2_send_poi = '/service/g2/sendPoi/execute.json' api_g2_speedfence = '/service/g2/speedFence/execute.json' api_g2_geofence = '/service/g2/geoFence/execute.json' api_g2_curfew = '/service/g2/curfew/execute.json' api_g2_remote_engine_start = '/service/g2/engineStart/execute.json' api_g2_remote_engine_start_cancel = '/service/g2/engineStart/cancel.json' api_g2_remote_engine_stop = '/service/g2/engineStop/execute.json' api_g2_fetch_climate_settings = '/service/g2/remoteEngineStart/fetch.json' api_g2_save_climate_settings = '/service/g2/remoteEngineStart/save.json' api_ev_charge_now = '/service/g2/phevChargeNow/execute.json' api_ev_fetch_charge_settings = '/service/g2/phevGetTimerSettings/execute.json' api_ev_save_charge_settings = '/service/g2/phevSendTimerSetting/execute.json' api_ev_delete_charge_schedule = '/service/g2/phevDeleteTimerSetting/execute.json' service_req_id = 'serviceRequestId' temp_f = 'climateZoneFrontTemp' temp_f_max = 85 temp_f_min = 60 temp_c = 'climateZoneFrontTempCelsius' temp_c_max = 30 temp_c_min = 15 climate = 'climateSettings' climate_default = 'climateSettings' runtime = 'runTimeMinutes' runtime_default = '10' mode = 'climateZoneFrontAirMode' mode_defrost = 'WINDOW' mode_feet_defrost = 'FEET_WINDOW' mode_face = 'FACE' mode_feet = 'FEET' mode_split = 'FEET_FACE_BALANCED' mode_auto = 'AUTO' heat_seat_left = 'heatedSeatFrontLeft' heat_seat_right = 'heatedSeatFrontRight' heat_seat_hi = 'HIGH_HEAT' heat_seat_med = 'MEDIUM_HEAT' heat_seat_low = 'LOW_HEAT' heat_seat_off = 'OFF' rear_defrost = 'heatedRearWindowActive' rear_defrost_on = 'true' rear_defrost_off = 'false' fan_speed = 'climateZoneFrontAirVolume' fan_speed_low = '2' fan_speed_med = '4' fan_speed_hi = '7' fan_speed_auto = 'AUTO' recirculate = 'outerAirCirculation' recirculate_off = 'outsideAir' recirculate_on = 'recirculation' rear_ac = 'airConditionOn' rear_ac_on = 'true' rear_ac_off = 'false' start_config = 'startConfiguration' start_config_default_ev = 'start_Climate_Control_only_allow_key_in_ignition' start_config_default_res = 'START_ENGINE_ALLOW_KEY_IN_IGNITION' valid_climate_options = {CLIMATE: [CLIMATE_DEFAULT], TEMP_C: [str(_) for _ in range(TEMP_C_MIN, TEMP_C_MAX + 1)], TEMP_F: [str(_) for _ in range(TEMP_F_MIN, TEMP_F_MAX + 1)], FAN_SPEED: [FAN_SPEED_AUTO, FAN_SPEED_LOW, FAN_SPEED_MED, FAN_SPEED_HI], HEAT_SEAT_LEFT: [HEAT_SEAT_OFF, HEAT_SEAT_LOW, HEAT_SEAT_MED, HEAT_SEAT_HI], HEAT_SEAT_RIGHT: [HEAT_SEAT_OFF, HEAT_SEAT_LOW, HEAT_SEAT_MED, HEAT_SEAT_HI], MODE: [MODE_DEFROST, MODE_FEET_DEFROST, MODE_FACE, MODE_FEET, MODE_SPLIT, MODE_AUTO], RECIRCULATE: [RECIRCULATE_OFF, RECIRCULATE_ON], REAR_AC: [REAR_AC_OFF, REAR_AC_ON], REAR_DEFROST: [REAR_DEFROST_OFF, REAR_DEFROST_ON], START_CONFIG: [START_CONFIG_DEFAULT_EV, START_CONFIG_DEFAULT_RES], RUNTIME: [str(RUNTIME_DEFAULT)]} which_door = 'unlockDoorType' all_doors = 'ALL_DOORS_CMD' drivers_door = 'FRONT_LEFT_DOOR_CMD' heading = 'heading' latitude = 'latitude' longitude = 'longitude' location_time = 'locationTimestamp' speed = 'speed' bad_latitude = 90.0 bad_longitude = 180.0 avg_fuel_consumption = 'AVG_FUEL_CONSUMPTION' battery_voltage = 'BATTERY_VOLTAGE' dist_to_empty = 'DISTANCE_TO_EMPTY_FUEL' door_boot_position = 'DOOR_BOOT_POSITION' door_engine_hood_position = 'DOOR_ENGINE_HOOD_POSITION' door_front_left_position = 'DOOR_FRONT_LEFT_POSITION' door_front_right_position = 'DOOR_FRONT_RIGHT_POSITION' door_rear_left_position = 'DOOR_REAR_LEFT_POSITION' door_rear_right_position = 'DOOR_REAR_RIGHT_POSITION' ev_charger_state_type = 'EV_CHARGER_STATE_TYPE' ev_charge_setting_ampere_type = 'EV_CHARGE_SETTING_AMPERE_TYPE' ev_charge_volt_type = 'EV_CHARGE_VOLT_TYPE' ev_distance_to_empty = 'EV_DISTANCE_TO_EMPTY' ev_is_plugged_in = 'EV_IS_PLUGGED_IN' ev_state_of_charge_mode = 'EV_STATE_OF_CHARGE_MODE' ev_state_of_charge_percent = 'EV_STATE_OF_CHARGE_PERCENT' ev_time_to_fully_charged = 'EV_TIME_TO_FULLY_CHARGED' ev_time_to_fully_charged_utc = 'EV_TIME_TO_FULLY_CHARGED_UTC' external_temp = 'EXT_EXTERNAL_TEMP' odometer = 'ODOMETER' position_timestamp = 'POSITION_TIMESTAMP' timestamp = 'TIMESTAMP' tire_pressure_fl = 'TYRE_PRESSURE_FRONT_LEFT' tire_pressure_fr = 'TYRE_PRESSURE_FRONT_RIGHT' tire_pressure_rl = 'TYRE_PRESSURE_REAR_LEFT' tire_pressure_rr = 'TYRE_PRESSURE_REAR_RIGHT' vehicle_state = 'VEHICLE_STATE_TYPE' window_front_left_status = 'WINDOW_FRONT_LEFT_STATUS' window_front_right_status = 'WINDOW_FRONT_RIGHT_STATUS' window_rear_left_status = 'WINDOW_REAR_LEFT_STATUS' window_rear_right_status = 'WINDOW_REAR_RIGHT_STATUS' charging = 'CHARGING' locked_connected = 'LOCKED_CONNECTED' unlocked_connected = 'UNLOCKED_CONNECTED' door_open = 'OPEN' door_closed = 'CLOSED' window_open = 'OPEN' window_closed = 'CLOSE' ignition_on = 'IGNITION_ON' not_equipped = 'NOT_EQUIPPED' vs_avg_fuel_consumption = 'avgFuelConsumptionLitersPer100Kilometers' vs_dist_to_empty = 'distanceToEmptyFuelKilometers' vs_timestamp = 'eventDate' vs_latitude = 'latitude' vs_longitude = 'longitude' vs_heading = 'positionHeadingDegree' vs_odometer = 'odometerValueKilometers' vs_vehicle_state = 'vehicleStateType' vs_tire_pressure_fl = 'tirePressureFrontLeft' vs_tire_pressure_fr = 'tirePressureFrontRight' vs_tire_pressure_rl = 'tirePressureRearLeft' vs_tire_pressure_rr = 'tirePressureRearRight' bad_avg_fuel_consumption = '16383' bad_distance_to_empty_fuel = '16383' bad_ev_time_to_fully_charged = '65535' bad_tire_pressure = '32767' bad_odometer = None bad_external_temp = '-64.0' bad_sensor_values = [BAD_AVG_FUEL_CONSUMPTION, BAD_DISTANCE_TO_EMPTY_FUEL, BAD_EV_TIME_TO_FULLY_CHARGED, BAD_TIRE_PRESSURE, BAD_ODOMETER, BAD_EXTERNAL_TEMP] unknown = 'UNKNOWN' vented = 'VENTED' bad_binary_sensor_values = [UNKNOWN, VENTED, NOT_EQUIPPED] location_valid = 'location_valid' timestamp_fmt = '%Y-%m-%dT%H:%M:%S%z' position_timestamp_fmt = '%Y-%m-%dT%H:%M:%SZ' error_soa_403 = '403-soa-unableToParseResponseBody' error_invalid_credentials = 'InvalidCredentials' error_service_already_started = 'ServiceAlreadyStarted' error_invalid_account = 'invalidAccount' error_password_warning = 'passwordWarning' error_account_locked = 'accountLocked' error_no_vehicles = 'noVehiclesOnAccount' error_no_account = 'accountNotFound' error_too_many_attempts = 'tooManyAttempts' error_vehicle_not_in_account = 'vehicleNotInAccount' error_g1_no_subscription = 'SXM40004' error_g1_stolen_vehicle = 'SXM40005' error_g1_invalid_pin = 'SXM40006' error_g1_service_already_started = 'SXM40009' error_g1_pin_locked = 'SXM40017' vehicle_attributes = 'attributes' vehicle_status = 'status' vehicle_id = 'id' vehicle_name = 'nickname' vehicle_api_gen = 'api_gen' vehicle_lock = 'lock' vehicle_last_update = 'last_update_time' vehicle_last_fetch = 'last_fetch_time' vehicle_features = 'features' vehicle_subscription_features = 'subscriptionFeatures' vehicle_subscription_status = 'subscriptionStatus' feature_phev = 'PHEV' feature_remote_start = 'RES' feature_g1_telematics = 'g1' 'Vehicle has 2016-2018 telematics version.' feature_g2_telematics = 'g2' 'Vehicle has 2019+ telematics version.' feature_remote = 'REMOTE' feature_safety = 'SAFETY' feature_active = 'ACTIVE' default_update_interval = 7200 default_fetch_interval = 300
# An example with subplots, so an array of axes is returned. axes = df.plot.line(subplots=True) type(axes) # <class 'numpy.ndarray'>
axes = df.plot.line(subplots=True) type(axes)
class problem(object): """docstring for problem""" def __init__(self, arg): super(problem, self).__init__() self.arg = arg
class Problem(object): """docstring for problem""" def __init__(self, arg): super(problem, self).__init__() self.arg = arg
class Statistics(): def __init__(self): self.time_cfg_constr = 0 #ok self.time_verify = 0 #ok self.time_smt = 0 #ok self.time_smt_pure = 0 self.time_interp = 0 #ok self.time_interp_pure = 0 #ok self.time_to_lia = 0 #ok self.time_from_lia = 0 #ok self.time_process_lia = 0 self.sizes_interpol = [] #ok self.num_smt = 0 #ok self.num_interp = 0 #ok self.num_interp_failure = 0 #ok self.num_boxing = 0 self.num_boxing_multi_variable = 0 self.giveup_print_unwind = False #ok self.counter_path_id = None self.counter_model = None self.counter_path_pred = None self.bitwidth = None self.theory = None def to_dict(self): return {"time_cfg_constr": self.time_cfg_constr, "time_verify": self.time_verify, "time_smt": self.time_smt, "time_interp": self.time_interp, "time_to_lia": self.time_to_lia, "time_from_lia": self.time_from_lia, "sizes_interpol": self.sizes_interpol, "num_smt": self.num_smt, "num_interp": self.num_interp, "num_interp_failure": self.num_interp_failure, "giveup_print_unwind": self.giveup_print_unwind, "counter_path_id": self.counter_path_id, "counter_model": self.counter_model, "counter_path_pred": self.counter_path_pred, "time_smt_pure": self.time_smt_pure, "time_interp_pure": self.time_interp_pure, "time_process_lia": self.time_process_lia, "bitwidth": self.bitwidth, "theory": self.theory, "num_boxing": self.num_boxing, "num_boxing_multi_variable": self.num_boxing_multi_variable }
class Statistics: def __init__(self): self.time_cfg_constr = 0 self.time_verify = 0 self.time_smt = 0 self.time_smt_pure = 0 self.time_interp = 0 self.time_interp_pure = 0 self.time_to_lia = 0 self.time_from_lia = 0 self.time_process_lia = 0 self.sizes_interpol = [] self.num_smt = 0 self.num_interp = 0 self.num_interp_failure = 0 self.num_boxing = 0 self.num_boxing_multi_variable = 0 self.giveup_print_unwind = False self.counter_path_id = None self.counter_model = None self.counter_path_pred = None self.bitwidth = None self.theory = None def to_dict(self): return {'time_cfg_constr': self.time_cfg_constr, 'time_verify': self.time_verify, 'time_smt': self.time_smt, 'time_interp': self.time_interp, 'time_to_lia': self.time_to_lia, 'time_from_lia': self.time_from_lia, 'sizes_interpol': self.sizes_interpol, 'num_smt': self.num_smt, 'num_interp': self.num_interp, 'num_interp_failure': self.num_interp_failure, 'giveup_print_unwind': self.giveup_print_unwind, 'counter_path_id': self.counter_path_id, 'counter_model': self.counter_model, 'counter_path_pred': self.counter_path_pred, 'time_smt_pure': self.time_smt_pure, 'time_interp_pure': self.time_interp_pure, 'time_process_lia': self.time_process_lia, 'bitwidth': self.bitwidth, 'theory': self.theory, 'num_boxing': self.num_boxing, 'num_boxing_multi_variable': self.num_boxing_multi_variable}
class Gen: def __init__(self, type, sequence, data_object): self.type = type self.sequence = sequence self.data_object = data_object class GenType: CDNA = 'cdna' DNA = 'dna' CDS = 'cds' class DnaType: dna = '.dna.' dna_sm = '.dna_sm.' dna_rm = '.dna_rm.'
class Gen: def __init__(self, type, sequence, data_object): self.type = type self.sequence = sequence self.data_object = data_object class Gentype: cdna = 'cdna' dna = 'dna' cds = 'cds' class Dnatype: dna = '.dna.' dna_sm = '.dna_sm.' dna_rm = '.dna_rm.'
def for_G(): """printing capital 'G' using for loop""" for row in range(6): for col in range(5): if col==0 and row not in(0,5) or row==0 and col in(1,2,3) or row==5 and col not in(0,4) or row==3 and col!=1 or col==4 and row in(1,4): print("*",end=" ") else: print(" ",end=" ") print() def while_G(): """printing capital 'G' using while loop""" i=0 while i<6: j=0 while j<6: if j==0 and i not in(0,4,5) or i==0 and j not in(0,4,5) or i==1 and j not in(1,2,3,4,5)or i==2 and j not in(1,2)or i==3 and j not in(1,2,4)or i==4 and j not in(1,2,4) or i==5 and j not in(0,3,4): print("*",end=" ") else: print(" ",end=" ") j+=1 i+=1 print()
def for_g(): """printing capital 'G' using for loop""" for row in range(6): for col in range(5): if col == 0 and row not in (0, 5) or (row == 0 and col in (1, 2, 3)) or (row == 5 and col not in (0, 4)) or (row == 3 and col != 1) or (col == 4 and row in (1, 4)): print('*', end=' ') else: print(' ', end=' ') print() def while_g(): """printing capital 'G' using while loop""" i = 0 while i < 6: j = 0 while j < 6: if j == 0 and i not in (0, 4, 5) or (i == 0 and j not in (0, 4, 5)) or (i == 1 and j not in (1, 2, 3, 4, 5)) or (i == 2 and j not in (1, 2)) or (i == 3 and j not in (1, 2, 4)) or (i == 4 and j not in (1, 2, 4)) or (i == 5 and j not in (0, 3, 4)): print('*', end=' ') else: print(' ', end=' ') j += 1 i += 1 print()
_css_basic = """ .card { font-family: arial; font-size: 20px; text-align: center; color: black; background-color: white; } """ _css_cloze = """ .card { font-family: arial; font-size: 20px; text-align: center; color: black; background-color: white; } .cloze { font-weight: bold; color: blue; } .nightMode .cloze { color: lightblue; } """ _css_roam = """ code { border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; border: 1px solid #BCBEC0; padding: 2px; font:12px Monaco,Consolas,"Andale Mono","DejaVu Sans Mono",monospace } .centered-block{ display: inline-block; align: center; text-align: left; marge:auto; } .rm-page-ref-brackets { color: #a7b6c2; } .rm-page-ref-link-color { color: #106ba3; } .rm-page-ref-tag { color: #a7b6c2; } .rm-block-ref { padding: 2px 2px; margin: -2px 0px; display: inline; border-bottom: 0.5px solid #d8e1e8; cursor: alias; } .roam-highlight { background-color: #fef09f; margin: -2px; padding: 2px; } .bp3-button.bp3-small, .bp3-small .bp3-button { min-height: 24px; min-width: 24px; padding: 0 7px; } pre { text-align: left; border-radius: 5px; border: 1px solid #BCBEC0; display: block; padding: 10px; margin: 0 0 10px; font:12px Monaco,Consolas,"Andale Mono","DejaVu Sans Mono",monospace color: #333; background-color: #f5f5f5; } """ ROAM_BASIC = { "modelName": "Roam Basic", "inOrderFields": ["Front", "Back", "Extra", "uid"], "css": _css_basic+_css_roam, "cardTemplates": [ { "Name": "Card 1", "Front": "{{Front}}", "Back": "{{FrontSide}}<hr id=answer>{{Back}}<br><br>{{Extra}}" } ] } ROAM_CLOZE = { "modelName": "Roam Cloze", "inOrderFields": ["Text", "Extra", "uid"], "css": _css_cloze+_css_roam, "cardTemplates": [ { "Name": "Cloze", "Front": "{{cloze:Text}}", "Back": "{{cloze:Text}}<br><br>{{Extra}}" } ] }
_css_basic = '\n.card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n' _css_cloze = '\n.card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n\n.cloze {\n font-weight: bold;\n color: blue;\n}\n.nightMode .cloze {\n color: lightblue;\n}\n' _css_roam = '\ncode {\n border-radius: 5px; \n -moz-border-radius: 5px; \n -webkit-border-radius: 5px; \n border: 1px solid #BCBEC0;\n padding: 2px;\n font:12px Monaco,Consolas,"Andale Mono","DejaVu Sans Mono",monospace\n}\n\n.centered-block{\n display: inline-block;\n align: center;\n text-align: left;\n marge:auto;\n}\n\n.rm-page-ref-brackets {\n color: #a7b6c2;\n}\n\n.rm-page-ref-link-color {\n color: #106ba3;\n}\n\n.rm-page-ref-tag {\n color: #a7b6c2;\n}\n\n.rm-block-ref {\n padding: 2px 2px;\n margin: -2px 0px;\n display: inline;\n border-bottom: 0.5px solid #d8e1e8;\n cursor: alias;\n}\n\n.roam-highlight {\n background-color: #fef09f;\n margin: -2px;\n padding: 2px;\n}\n\n.bp3-button.bp3-small, .bp3-small .bp3-button {\n min-height: 24px;\n min-width: 24px;\n padding: 0 7px;\n}\n\npre {\n text-align: left;\n border-radius: 5px;\n border: 1px solid #BCBEC0;\n display: block;\n padding: 10px;\n margin: 0 0 10px;\n font:12px Monaco,Consolas,"Andale Mono","DejaVu Sans Mono",monospace\n color: #333;\n background-color: #f5f5f5;\n}\n' roam_basic = {'modelName': 'Roam Basic', 'inOrderFields': ['Front', 'Back', 'Extra', 'uid'], 'css': _css_basic + _css_roam, 'cardTemplates': [{'Name': 'Card 1', 'Front': '{{Front}}', 'Back': '{{FrontSide}}<hr id=answer>{{Back}}<br><br>{{Extra}}'}]} roam_cloze = {'modelName': 'Roam Cloze', 'inOrderFields': ['Text', 'Extra', 'uid'], 'css': _css_cloze + _css_roam, 'cardTemplates': [{'Name': 'Cloze', 'Front': '{{cloze:Text}}', 'Back': '{{cloze:Text}}<br><br>{{Extra}}'}]}
# Insert line numbers in_file = open('Resources/02. Line Numbers/Input.txt', 'r').read().split('\n') result = [str(number + 1) + '. ' + item for number, item in enumerate(in_file)][:-1] print(*result, sep = '\n') out_str = '\n'.join(result) open('output/02.txt', 'w').write(out_str)
in_file = open('Resources/02. Line Numbers/Input.txt', 'r').read().split('\n') result = [str(number + 1) + '. ' + item for (number, item) in enumerate(in_file)][:-1] print(*result, sep='\n') out_str = '\n'.join(result) open('output/02.txt', 'w').write(out_str)
fib = lambda n: n if n <= 2 else fib(n - 1) + fib(n - 2) ''' print(fib(10)) #89 '''
fib = lambda n: n if n <= 2 else fib(n - 1) + fib(n - 2) '\nprint(fib(10)) #89 \n'
# https://leetcode.com/problems/rotate-array/ class Solution: def rotate(self, nums, k): """ :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. """ def reverse(s, e): while s < e: nums[s], nums[e] = nums[e], nums[s] s += 1 e -= 1 k %= len(nums) reverse(0, len(nums) - 1) reverse(0, k - 1) reverse(k, len(nums) - 1)
class Solution: def rotate(self, nums, k): """ :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. """ def reverse(s, e): while s < e: (nums[s], nums[e]) = (nums[e], nums[s]) s += 1 e -= 1 k %= len(nums) reverse(0, len(nums) - 1) reverse(0, k - 1) reverse(k, len(nums) - 1)
""" PASSENGERS """ numPassengers = 3191 passenger_arriving = ( (5, 8, 7, 5, 1, 0, 3, 5, 8, 3, 0, 0), # 0 (2, 8, 13, 5, 0, 0, 12, 10, 6, 1, 0, 0), # 1 (1, 10, 5, 4, 2, 0, 13, 13, 5, 2, 3, 0), # 2 (5, 11, 16, 2, 3, 0, 8, 0, 6, 3, 4, 0), # 3 (5, 8, 6, 2, 1, 0, 7, 10, 6, 5, 1, 0), # 4 (1, 10, 8, 5, 1, 0, 3, 10, 4, 2, 2, 0), # 5 (6, 8, 4, 5, 2, 0, 6, 6, 4, 4, 2, 0), # 6 (5, 9, 5, 2, 1, 0, 10, 12, 2, 5, 3, 0), # 7 (6, 3, 5, 3, 1, 0, 8, 7, 3, 6, 0, 0), # 8 (5, 7, 5, 5, 2, 0, 6, 6, 5, 4, 2, 0), # 9 (5, 11, 8, 3, 0, 0, 5, 8, 5, 4, 1, 0), # 10 (7, 5, 9, 6, 3, 0, 4, 5, 11, 6, 2, 0), # 11 (6, 7, 11, 2, 1, 0, 7, 6, 14, 8, 1, 0), # 12 (3, 6, 10, 4, 2, 0, 10, 9, 9, 2, 3, 0), # 13 (2, 8, 3, 4, 4, 0, 6, 12, 1, 2, 2, 0), # 14 (4, 12, 10, 7, 1, 0, 5, 16, 9, 7, 1, 0), # 15 (2, 11, 5, 1, 1, 0, 8, 9, 5, 6, 0, 0), # 16 (0, 10, 9, 4, 5, 0, 4, 8, 3, 4, 1, 0), # 17 (2, 7, 6, 3, 3, 0, 5, 12, 7, 6, 5, 0), # 18 (5, 8, 4, 5, 1, 0, 11, 9, 4, 3, 2, 0), # 19 (0, 9, 4, 2, 1, 0, 9, 13, 5, 3, 2, 0), # 20 (2, 8, 7, 2, 3, 0, 3, 11, 9, 2, 4, 0), # 21 (4, 11, 8, 5, 1, 0, 7, 8, 4, 6, 3, 0), # 22 (3, 4, 6, 0, 3, 0, 4, 11, 4, 7, 0, 0), # 23 (6, 14, 9, 3, 1, 0, 5, 5, 9, 6, 5, 0), # 24 (4, 8, 4, 7, 5, 0, 8, 6, 7, 3, 2, 0), # 25 (4, 8, 14, 2, 7, 0, 8, 9, 9, 4, 5, 0), # 26 (3, 5, 9, 8, 1, 0, 10, 6, 7, 5, 3, 0), # 27 (5, 13, 5, 3, 3, 0, 4, 10, 10, 4, 1, 0), # 28 (5, 8, 7, 3, 5, 0, 10, 10, 3, 0, 0, 0), # 29 (1, 10, 3, 3, 4, 0, 10, 10, 3, 7, 3, 0), # 30 (8, 6, 10, 5, 0, 0, 6, 9, 4, 4, 1, 0), # 31 (3, 10, 9, 2, 1, 0, 8, 10, 3, 5, 2, 0), # 32 (4, 9, 5, 1, 3, 0, 3, 7, 6, 6, 2, 0), # 33 (7, 6, 5, 6, 4, 0, 10, 9, 8, 2, 1, 0), # 34 (6, 6, 6, 5, 2, 0, 4, 5, 5, 8, 2, 0), # 35 (3, 15, 7, 4, 4, 0, 7, 8, 10, 5, 4, 0), # 36 (4, 15, 11, 4, 2, 0, 9, 11, 3, 9, 4, 0), # 37 (3, 13, 5, 3, 4, 0, 8, 8, 3, 6, 3, 0), # 38 (2, 5, 8, 1, 0, 0, 5, 7, 3, 8, 5, 0), # 39 (6, 8, 11, 5, 3, 0, 10, 13, 4, 4, 1, 0), # 40 (4, 9, 6, 6, 0, 0, 6, 9, 3, 1, 0, 0), # 41 (2, 10, 8, 3, 4, 0, 10, 7, 5, 1, 0, 0), # 42 (4, 17, 7, 3, 3, 0, 7, 6, 6, 3, 1, 0), # 43 (6, 13, 3, 2, 2, 0, 5, 11, 7, 5, 4, 0), # 44 (3, 11, 6, 2, 2, 0, 3, 5, 5, 3, 2, 0), # 45 (7, 8, 9, 4, 0, 0, 10, 8, 6, 5, 3, 0), # 46 (3, 10, 10, 8, 2, 0, 6, 10, 7, 7, 3, 0), # 47 (4, 10, 5, 8, 1, 0, 6, 9, 8, 6, 2, 0), # 48 (3, 12, 9, 2, 2, 0, 3, 11, 8, 3, 0, 0), # 49 (5, 13, 6, 5, 1, 0, 5, 7, 2, 3, 5, 0), # 50 (4, 9, 7, 5, 2, 0, 4, 9, 6, 5, 4, 0), # 51 (3, 8, 4, 3, 3, 0, 4, 7, 6, 3, 8, 0), # 52 (6, 10, 8, 6, 2, 0, 3, 6, 8, 4, 2, 0), # 53 (0, 11, 11, 5, 4, 0, 8, 8, 6, 5, 8, 0), # 54 (1, 9, 4, 3, 2, 0, 5, 8, 3, 5, 2, 0), # 55 (5, 7, 7, 3, 3, 0, 3, 9, 5, 3, 2, 0), # 56 (4, 7, 10, 6, 5, 0, 6, 12, 5, 5, 3, 0), # 57 (3, 6, 7, 6, 3, 0, 2, 8, 6, 7, 3, 0), # 58 (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 59 ) station_arriving_intensity = ( (3.7095121817383676, 9.515044981060607, 11.19193043059126, 8.87078804347826, 10.000240384615385, 6.659510869565219), # 0 (3.7443308140669203, 9.620858238197952, 11.252381752534994, 8.920190141908213, 10.075193108974359, 6.657240994867151), # 1 (3.7787518681104277, 9.725101964085297, 11.31139817195087, 8.968504830917876, 10.148564102564103, 6.654901690821256), # 2 (3.8127461259877085, 9.827663671875001, 11.368936576156813, 9.01569089673913, 10.22028605769231, 6.652493274456523), # 3 (3.8462843698175795, 9.928430874719417, 11.424953852470724, 9.061707125603865, 10.290291666666668, 6.6500160628019325), # 4 (3.879337381718857, 10.027291085770905, 11.479406888210512, 9.106512303743962, 10.358513621794872, 6.647470372886473), # 5 (3.9118759438103607, 10.12413181818182, 11.53225257069409, 9.150065217391306, 10.424884615384617, 6.644856521739131), # 6 (3.943870838210907, 10.218840585104518, 11.58344778723936, 9.19232465277778, 10.489337339743592, 6.64217482638889), # 7 (3.975292847039314, 10.311304899691358, 11.632949425164242, 9.233249396135266, 10.551804487179488, 6.639425603864735), # 8 (4.006112752414399, 10.401412275094698, 11.680714371786634, 9.272798233695653, 10.61221875, 6.636609171195653), # 9 (4.03630133645498, 10.489050224466892, 11.72669951442445, 9.310929951690824, 10.670512820512823, 6.633725845410628), # 10 (4.065829381279876, 10.5741062609603, 11.7708617403956, 9.347603336352659, 10.726619391025642, 6.630775943538648), # 11 (4.094667669007903, 10.656467897727273, 11.813157937017996, 9.382777173913043, 10.780471153846154, 6.627759782608695), # 12 (4.122786981757876, 10.736022647920176, 11.85354499160954, 9.416410250603866, 10.832000801282053, 6.624677679649759), # 13 (4.15015810164862, 10.81265802469136, 11.891979791488144, 9.448461352657004, 10.881141025641025, 6.621529951690821), # 14 (4.1767518107989465, 10.886261541193182, 11.928419223971721, 9.478889266304348, 10.92782451923077, 6.618316915760871), # 15 (4.202538891327675, 10.956720710578002, 11.96282017637818, 9.507652777777778, 10.971983974358976, 6.61503888888889), # 16 (4.227490125353625, 11.023923045998176, 11.995139536025421, 9.53471067330918, 11.013552083333336, 6.611696188103866), # 17 (4.25157629499561, 11.087756060606061, 12.025334190231364, 9.560021739130436, 11.052461538461543, 6.608289130434783), # 18 (4.274768182372451, 11.148107267554012, 12.053361026313912, 9.58354476147343, 11.088645032051284, 6.604818032910629), # 19 (4.297036569602966, 11.204864179994388, 12.079176931590974, 9.60523852657005, 11.122035256410259, 6.601283212560387), # 20 (4.318352238805971, 11.257914311079544, 12.102738793380466, 9.625061820652174, 11.152564903846153, 6.597684986413044), # 21 (4.338685972100283, 11.307145173961842, 12.124003499000287, 9.642973429951692, 11.180166666666667, 6.5940236714975855), # 22 (4.358008551604722, 11.352444281793632, 12.142927935768354, 9.658932140700484, 11.204773237179488, 6.590299584842997), # 23 (4.3762907594381035, 11.393699147727272, 12.159468991002571, 9.672896739130437, 11.226317307692307, 6.586513043478261), # 24 (4.393503377719247, 11.430797284915124, 12.173583552020853, 9.684826011473431, 11.244731570512819, 6.582664364432368), # 25 (4.409617188566969, 11.46362620650954, 12.185228506141103, 9.694678743961353, 11.259948717948719, 6.5787538647343), # 26 (4.424602974100088, 11.492073425662877, 12.194360740681233, 9.702413722826089, 11.271901442307694, 6.574781861413045), # 27 (4.438431516437421, 11.516026455527497, 12.200937142959157, 9.707989734299519, 11.280522435897437, 6.570748671497586), # 28 (4.4510735976977855, 11.535372809255753, 12.204914600292774, 9.711365564613528, 11.285744391025641, 6.566654612016909), # 29 (4.4625, 11.55, 12.20625, 9.7125, 11.287500000000001, 6.562500000000001), # 30 (4.47319183983376, 11.56215031960227, 12.205248928140096, 9.712295118464054, 11.286861125886526, 6.556726763701484), # 31 (4.4836528452685425, 11.574140056818184, 12.202274033816424, 9.711684477124184, 11.28495815602837, 6.547834661835751), # 32 (4.493887715792838, 11.585967720170455, 12.197367798913046, 9.710674080882354, 11.281811569148937, 6.535910757121439), # 33 (4.503901150895141, 11.597631818181819, 12.19057270531401, 9.709269934640524, 11.277441843971632, 6.521042112277196), # 34 (4.513697850063939, 11.609130859374998, 12.181931234903383, 9.707478043300654, 11.27186945921986, 6.503315790021656), # 35 (4.523282512787724, 11.62046335227273, 12.171485869565219, 9.705304411764708, 11.265114893617023, 6.482818853073463), # 36 (4.532659838554988, 11.631627805397729, 12.159279091183576, 9.70275504493464, 11.257198625886524, 6.4596383641512585), # 37 (4.5418345268542195, 11.642622727272729, 12.145353381642513, 9.699835947712419, 11.248141134751775, 6.433861385973679), # 38 (4.5508112771739135, 11.653446626420456, 12.129751222826087, 9.696553125000001, 11.23796289893617, 6.40557498125937), # 39 (4.559594789002558, 11.664098011363638, 12.11251509661836, 9.692912581699348, 11.22668439716312, 6.37486621272697), # 40 (4.568189761828645, 11.674575390625, 12.093687484903382, 9.68892032271242, 11.214326108156028, 6.34182214309512), # 41 (4.576600895140665, 11.684877272727276, 12.07331086956522, 9.684582352941177, 11.2009085106383, 6.3065298350824595), # 42 (4.584832888427111, 11.69500216619318, 12.051427732487923, 9.679904677287583, 11.186452083333334, 6.26907635140763), # 43 (4.592890441176471, 11.704948579545455, 12.028080555555556, 9.674893300653595, 11.17097730496454, 6.229548754789272), # 44 (4.600778252877237, 11.714715021306818, 12.003311820652177, 9.669554227941177, 11.15450465425532, 6.188034107946028), # 45 (4.6085010230179035, 11.724300000000003, 11.97716400966184, 9.663893464052288, 11.137054609929079, 6.144619473596536), # 46 (4.616063451086957, 11.733702024147728, 11.9496796044686, 9.65791701388889, 11.118647650709221, 6.099391914459438), # 47 (4.623470236572891, 11.742919602272728, 11.920901086956523, 9.651630882352942, 11.099304255319149, 6.052438493253375), # 48 (4.630726078964194, 11.751951242897727, 11.890870939009663, 9.645041074346407, 11.079044902482272, 6.003846272696985), # 49 (4.6378356777493615, 11.760795454545454, 11.85963164251208, 9.638153594771243, 11.057890070921987, 5.953702315508913), # 50 (4.6448037324168805, 11.769450745738636, 11.827225679347826, 9.630974448529413, 11.035860239361703, 5.902093684407797), # 51 (4.651634942455243, 11.777915625, 11.793695531400965, 9.623509640522876, 11.012975886524824, 5.849107442112278), # 52 (4.658334007352941, 11.786188600852274, 11.759083680555555, 9.615765175653596, 10.989257491134753, 5.794830651340996), # 53 (4.6649056265984665, 11.79426818181818, 11.723432608695653, 9.60774705882353, 10.964725531914894, 5.739350374812594), # 54 (4.671354499680307, 11.802152876420456, 11.686784797705313, 9.599461294934642, 10.939400487588653, 5.682753675245711), # 55 (4.677685326086957, 11.809841193181818, 11.649182729468599, 9.59091388888889, 10.913302836879433, 5.625127615358988), # 56 (4.683902805306906, 11.817331640625003, 11.610668885869565, 9.582110845588236, 10.886453058510638, 5.566559257871065), # 57 (4.690011636828645, 11.824622727272727, 11.57128574879227, 9.573058169934642, 10.858871631205675, 5.507135665500583), # 58 (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59 ) passenger_arriving_acc = ( (5, 8, 7, 5, 1, 0, 3, 5, 8, 3, 0, 0), # 0 (7, 16, 20, 10, 1, 0, 15, 15, 14, 4, 0, 0), # 1 (8, 26, 25, 14, 3, 0, 28, 28, 19, 6, 3, 0), # 2 (13, 37, 41, 16, 6, 0, 36, 28, 25, 9, 7, 0), # 3 (18, 45, 47, 18, 7, 0, 43, 38, 31, 14, 8, 0), # 4 (19, 55, 55, 23, 8, 0, 46, 48, 35, 16, 10, 0), # 5 (25, 63, 59, 28, 10, 0, 52, 54, 39, 20, 12, 0), # 6 (30, 72, 64, 30, 11, 0, 62, 66, 41, 25, 15, 0), # 7 (36, 75, 69, 33, 12, 0, 70, 73, 44, 31, 15, 0), # 8 (41, 82, 74, 38, 14, 0, 76, 79, 49, 35, 17, 0), # 9 (46, 93, 82, 41, 14, 0, 81, 87, 54, 39, 18, 0), # 10 (53, 98, 91, 47, 17, 0, 85, 92, 65, 45, 20, 0), # 11 (59, 105, 102, 49, 18, 0, 92, 98, 79, 53, 21, 0), # 12 (62, 111, 112, 53, 20, 0, 102, 107, 88, 55, 24, 0), # 13 (64, 119, 115, 57, 24, 0, 108, 119, 89, 57, 26, 0), # 14 (68, 131, 125, 64, 25, 0, 113, 135, 98, 64, 27, 0), # 15 (70, 142, 130, 65, 26, 0, 121, 144, 103, 70, 27, 0), # 16 (70, 152, 139, 69, 31, 0, 125, 152, 106, 74, 28, 0), # 17 (72, 159, 145, 72, 34, 0, 130, 164, 113, 80, 33, 0), # 18 (77, 167, 149, 77, 35, 0, 141, 173, 117, 83, 35, 0), # 19 (77, 176, 153, 79, 36, 0, 150, 186, 122, 86, 37, 0), # 20 (79, 184, 160, 81, 39, 0, 153, 197, 131, 88, 41, 0), # 21 (83, 195, 168, 86, 40, 0, 160, 205, 135, 94, 44, 0), # 22 (86, 199, 174, 86, 43, 0, 164, 216, 139, 101, 44, 0), # 23 (92, 213, 183, 89, 44, 0, 169, 221, 148, 107, 49, 0), # 24 (96, 221, 187, 96, 49, 0, 177, 227, 155, 110, 51, 0), # 25 (100, 229, 201, 98, 56, 0, 185, 236, 164, 114, 56, 0), # 26 (103, 234, 210, 106, 57, 0, 195, 242, 171, 119, 59, 0), # 27 (108, 247, 215, 109, 60, 0, 199, 252, 181, 123, 60, 0), # 28 (113, 255, 222, 112, 65, 0, 209, 262, 184, 123, 60, 0), # 29 (114, 265, 225, 115, 69, 0, 219, 272, 187, 130, 63, 0), # 30 (122, 271, 235, 120, 69, 0, 225, 281, 191, 134, 64, 0), # 31 (125, 281, 244, 122, 70, 0, 233, 291, 194, 139, 66, 0), # 32 (129, 290, 249, 123, 73, 0, 236, 298, 200, 145, 68, 0), # 33 (136, 296, 254, 129, 77, 0, 246, 307, 208, 147, 69, 0), # 34 (142, 302, 260, 134, 79, 0, 250, 312, 213, 155, 71, 0), # 35 (145, 317, 267, 138, 83, 0, 257, 320, 223, 160, 75, 0), # 36 (149, 332, 278, 142, 85, 0, 266, 331, 226, 169, 79, 0), # 37 (152, 345, 283, 145, 89, 0, 274, 339, 229, 175, 82, 0), # 38 (154, 350, 291, 146, 89, 0, 279, 346, 232, 183, 87, 0), # 39 (160, 358, 302, 151, 92, 0, 289, 359, 236, 187, 88, 0), # 40 (164, 367, 308, 157, 92, 0, 295, 368, 239, 188, 88, 0), # 41 (166, 377, 316, 160, 96, 0, 305, 375, 244, 189, 88, 0), # 42 (170, 394, 323, 163, 99, 0, 312, 381, 250, 192, 89, 0), # 43 (176, 407, 326, 165, 101, 0, 317, 392, 257, 197, 93, 0), # 44 (179, 418, 332, 167, 103, 0, 320, 397, 262, 200, 95, 0), # 45 (186, 426, 341, 171, 103, 0, 330, 405, 268, 205, 98, 0), # 46 (189, 436, 351, 179, 105, 0, 336, 415, 275, 212, 101, 0), # 47 (193, 446, 356, 187, 106, 0, 342, 424, 283, 218, 103, 0), # 48 (196, 458, 365, 189, 108, 0, 345, 435, 291, 221, 103, 0), # 49 (201, 471, 371, 194, 109, 0, 350, 442, 293, 224, 108, 0), # 50 (205, 480, 378, 199, 111, 0, 354, 451, 299, 229, 112, 0), # 51 (208, 488, 382, 202, 114, 0, 358, 458, 305, 232, 120, 0), # 52 (214, 498, 390, 208, 116, 0, 361, 464, 313, 236, 122, 0), # 53 (214, 509, 401, 213, 120, 0, 369, 472, 319, 241, 130, 0), # 54 (215, 518, 405, 216, 122, 0, 374, 480, 322, 246, 132, 0), # 55 (220, 525, 412, 219, 125, 0, 377, 489, 327, 249, 134, 0), # 56 (224, 532, 422, 225, 130, 0, 383, 501, 332, 254, 137, 0), # 57 (227, 538, 429, 231, 133, 0, 385, 509, 338, 261, 140, 0), # 58 (227, 538, 429, 231, 133, 0, 385, 509, 338, 261, 140, 0), # 59 ) passenger_arriving_rate = ( (3.7095121817383676, 7.612035984848484, 6.715158258354756, 3.5483152173913037, 2.000048076923077, 0.0, 6.659510869565219, 8.000192307692307, 5.322472826086956, 4.476772172236504, 1.903008996212121, 0.0), # 0 (3.7443308140669203, 7.696686590558361, 6.751429051520996, 3.5680760567632848, 2.0150386217948717, 0.0, 6.657240994867151, 8.060154487179487, 5.352114085144928, 4.500952701013997, 1.9241716476395903, 0.0), # 1 (3.7787518681104277, 7.780081571268237, 6.786838903170522, 3.58740193236715, 2.0297128205128203, 0.0, 6.654901690821256, 8.118851282051281, 5.381102898550726, 4.524559268780347, 1.9450203928170593, 0.0), # 2 (3.8127461259877085, 7.8621309375, 6.821361945694087, 3.6062763586956517, 2.044057211538462, 0.0, 6.652493274456523, 8.176228846153847, 5.409414538043478, 4.547574630462725, 1.965532734375, 0.0), # 3 (3.8462843698175795, 7.942744699775533, 6.854972311482434, 3.624682850241546, 2.0580583333333333, 0.0, 6.6500160628019325, 8.232233333333333, 5.437024275362319, 4.569981540988289, 1.9856861749438832, 0.0), # 4 (3.879337381718857, 8.021832868616723, 6.887644132926307, 3.6426049214975844, 2.0717027243589743, 0.0, 6.647470372886473, 8.286810897435897, 5.463907382246377, 4.591762755284204, 2.005458217154181, 0.0), # 5 (3.9118759438103607, 8.099305454545455, 6.919351542416455, 3.660026086956522, 2.084976923076923, 0.0, 6.644856521739131, 8.339907692307692, 5.490039130434783, 4.612901028277636, 2.0248263636363637, 0.0), # 6 (3.943870838210907, 8.175072468083613, 6.950068672343615, 3.6769298611111116, 2.0978674679487184, 0.0, 6.64217482638889, 8.391469871794873, 5.515394791666668, 4.633379114895743, 2.043768117020903, 0.0), # 7 (3.975292847039314, 8.249043919753085, 6.979769655098544, 3.693299758454106, 2.1103608974358976, 0.0, 6.639425603864735, 8.44144358974359, 5.5399496376811594, 4.653179770065696, 2.062260979938271, 0.0), # 8 (4.006112752414399, 8.321129820075758, 7.00842862307198, 3.709119293478261, 2.12244375, 0.0, 6.636609171195653, 8.489775, 5.563678940217391, 4.672285748714653, 2.0802824550189394, 0.0), # 9 (4.03630133645498, 8.391240179573513, 7.03601970865467, 3.724371980676329, 2.134102564102564, 0.0, 6.633725845410628, 8.536410256410257, 5.586557971014494, 4.690679805769779, 2.0978100448933783, 0.0), # 10 (4.065829381279876, 8.459285008768239, 7.06251704423736, 3.739041334541063, 2.145323878205128, 0.0, 6.630775943538648, 8.581295512820512, 5.608562001811595, 4.70834469615824, 2.1148212521920597, 0.0), # 11 (4.094667669007903, 8.525174318181818, 7.087894762210797, 3.7531108695652167, 2.156094230769231, 0.0, 6.627759782608695, 8.624376923076923, 5.6296663043478254, 4.725263174807198, 2.1312935795454546, 0.0), # 12 (4.122786981757876, 8.58881811833614, 7.112126994965724, 3.766564100241546, 2.1664001602564102, 0.0, 6.624677679649759, 8.665600641025641, 5.649846150362319, 4.741417996643816, 2.147204529584035, 0.0), # 13 (4.15015810164862, 8.650126419753088, 7.135187874892886, 3.779384541062801, 2.1762282051282047, 0.0, 6.621529951690821, 8.704912820512819, 5.669076811594202, 4.756791916595257, 2.162531604938272, 0.0), # 14 (4.1767518107989465, 8.709009232954545, 7.157051534383032, 3.7915557065217387, 2.1855649038461538, 0.0, 6.618316915760871, 8.742259615384615, 5.6873335597826085, 4.771367689588688, 2.177252308238636, 0.0), # 15 (4.202538891327675, 8.7653765684624, 7.177692105826908, 3.803061111111111, 2.194396794871795, 0.0, 6.61503888888889, 8.77758717948718, 5.7045916666666665, 4.785128070551272, 2.1913441421156, 0.0), # 16 (4.227490125353625, 8.81913843679854, 7.197083721615253, 3.8138842693236716, 2.202710416666667, 0.0, 6.611696188103866, 8.810841666666668, 5.720826403985508, 4.798055814410168, 2.204784609199635, 0.0), # 17 (4.25157629499561, 8.870204848484848, 7.215200514138818, 3.824008695652174, 2.2104923076923084, 0.0, 6.608289130434783, 8.841969230769234, 5.736013043478262, 4.810133676092545, 2.217551212121212, 0.0), # 18 (4.274768182372451, 8.918485814043208, 7.232016615788346, 3.8334179045893717, 2.2177290064102566, 0.0, 6.604818032910629, 8.870916025641026, 5.750126856884058, 4.8213444105255645, 2.229621453510802, 0.0), # 19 (4.297036569602966, 8.96389134399551, 7.247506158954584, 3.8420954106280196, 2.2244070512820517, 0.0, 6.601283212560387, 8.897628205128207, 5.76314311594203, 4.831670772636389, 2.2409728359988774, 0.0), # 20 (4.318352238805971, 9.006331448863634, 7.261643276028279, 3.8500247282608693, 2.2305129807692303, 0.0, 6.597684986413044, 8.922051923076921, 5.775037092391305, 4.841095517352186, 2.2515828622159084, 0.0), # 21 (4.338685972100283, 9.045716139169473, 7.274402099400172, 3.8571893719806765, 2.2360333333333333, 0.0, 6.5940236714975855, 8.944133333333333, 5.785784057971015, 4.849601399600115, 2.2614290347923682, 0.0), # 22 (4.358008551604722, 9.081955425434906, 7.285756761461012, 3.8635728562801934, 2.2409546474358972, 0.0, 6.590299584842997, 8.963818589743589, 5.79535928442029, 4.857171174307341, 2.2704888563587264, 0.0), # 23 (4.3762907594381035, 9.114959318181818, 7.295681394601543, 3.869158695652174, 2.2452634615384612, 0.0, 6.586513043478261, 8.981053846153845, 5.803738043478262, 4.863787596401028, 2.2787398295454544, 0.0), # 24 (4.393503377719247, 9.1446378279321, 7.304150131212511, 3.8739304045893723, 2.2489463141025636, 0.0, 6.582664364432368, 8.995785256410255, 5.810895606884059, 4.869433420808341, 2.286159456983025, 0.0), # 25 (4.409617188566969, 9.17090096520763, 7.311137103684661, 3.8778714975845405, 2.2519897435897436, 0.0, 6.5787538647343, 9.007958974358974, 5.816807246376811, 4.874091402456441, 2.2927252413019077, 0.0), # 26 (4.424602974100088, 9.193658740530301, 7.31661644440874, 3.880965489130435, 2.2543802884615385, 0.0, 6.574781861413045, 9.017521153846154, 5.821448233695653, 4.877744296272493, 2.2984146851325753, 0.0), # 27 (4.438431516437421, 9.212821164421996, 7.320562285775494, 3.8831958937198072, 2.256104487179487, 0.0, 6.570748671497586, 9.024417948717948, 5.824793840579711, 4.8803748571836625, 2.303205291105499, 0.0), # 28 (4.4510735976977855, 9.228298247404602, 7.322948760175664, 3.884546225845411, 2.257148878205128, 0.0, 6.566654612016909, 9.028595512820512, 5.826819338768117, 4.881965840117109, 2.3070745618511506, 0.0), # 29 (4.4625, 9.24, 7.32375, 3.885, 2.2575000000000003, 0.0, 6.562500000000001, 9.030000000000001, 5.8275, 4.8825, 2.31, 0.0), # 30 (4.47319183983376, 9.249720255681815, 7.323149356884057, 3.884918047385621, 2.257372225177305, 0.0, 6.556726763701484, 9.02948890070922, 5.827377071078432, 4.882099571256038, 2.312430063920454, 0.0), # 31 (4.4836528452685425, 9.259312045454546, 7.3213644202898545, 3.884673790849673, 2.2569916312056737, 0.0, 6.547834661835751, 9.027966524822695, 5.82701068627451, 4.880909613526569, 2.3148280113636366, 0.0), # 32 (4.493887715792838, 9.268774176136363, 7.3184206793478275, 3.8842696323529413, 2.2563623138297872, 0.0, 6.535910757121439, 9.025449255319149, 5.826404448529412, 4.878947119565218, 2.3171935440340907, 0.0), # 33 (4.503901150895141, 9.278105454545454, 7.314343623188405, 3.8837079738562093, 2.2554883687943263, 0.0, 6.521042112277196, 9.021953475177305, 5.825561960784314, 4.876229082125604, 2.3195263636363634, 0.0), # 34 (4.513697850063939, 9.287304687499997, 7.3091587409420296, 3.882991217320261, 2.2543738918439717, 0.0, 6.503315790021656, 9.017495567375887, 5.824486825980392, 4.872772493961353, 2.3218261718749993, 0.0), # 35 (4.523282512787724, 9.296370681818182, 7.302891521739131, 3.8821217647058828, 2.253022978723404, 0.0, 6.482818853073463, 9.012091914893617, 5.823182647058824, 4.868594347826087, 2.3240926704545455, 0.0), # 36 (4.532659838554988, 9.305302244318183, 7.295567454710145, 3.881102017973856, 2.2514397251773044, 0.0, 6.4596383641512585, 9.005758900709218, 5.821653026960784, 4.86371163647343, 2.3263255610795457, 0.0), # 37 (4.5418345268542195, 9.314098181818181, 7.287212028985508, 3.8799343790849674, 2.249628226950355, 0.0, 6.433861385973679, 8.99851290780142, 5.819901568627452, 4.858141352657005, 2.3285245454545453, 0.0), # 38 (4.5508112771739135, 9.322757301136363, 7.277850733695652, 3.87862125, 2.247592579787234, 0.0, 6.40557498125937, 8.990370319148935, 5.817931875, 4.8519004891304345, 2.330689325284091, 0.0), # 39 (4.559594789002558, 9.33127840909091, 7.267509057971015, 3.8771650326797387, 2.245336879432624, 0.0, 6.37486621272697, 8.981347517730496, 5.815747549019608, 4.845006038647344, 2.3328196022727274, 0.0), # 40 (4.568189761828645, 9.3396603125, 7.256212490942029, 3.8755681290849675, 2.2428652216312055, 0.0, 6.34182214309512, 8.971460886524822, 5.813352193627452, 4.837474993961353, 2.334915078125, 0.0), # 41 (4.576600895140665, 9.34790181818182, 7.2439865217391315, 3.8738329411764707, 2.2401817021276598, 0.0, 6.3065298350824595, 8.960726808510639, 5.810749411764706, 4.829324347826088, 2.336975454545455, 0.0), # 42 (4.584832888427111, 9.356001732954544, 7.230856639492753, 3.8719618709150327, 2.2372904166666667, 0.0, 6.26907635140763, 8.949161666666667, 5.80794280637255, 4.820571092995169, 2.339000433238636, 0.0), # 43 (4.592890441176471, 9.363958863636363, 7.216848333333333, 3.8699573202614377, 2.2341954609929076, 0.0, 6.229548754789272, 8.93678184397163, 5.804935980392157, 4.811232222222222, 2.3409897159090907, 0.0), # 44 (4.600778252877237, 9.371772017045453, 7.201987092391306, 3.8678216911764705, 2.230900930851064, 0.0, 6.188034107946028, 8.923603723404256, 5.801732536764706, 4.80132472826087, 2.3429430042613633, 0.0), # 45 (4.6085010230179035, 9.379440000000002, 7.186298405797103, 3.8655573856209147, 2.2274109219858156, 0.0, 6.144619473596536, 8.909643687943262, 5.798336078431372, 4.790865603864735, 2.3448600000000006, 0.0), # 46 (4.616063451086957, 9.386961619318182, 7.16980776268116, 3.8631668055555552, 2.223729530141844, 0.0, 6.099391914459438, 8.894918120567375, 5.794750208333333, 4.77987184178744, 2.3467404048295455, 0.0), # 47 (4.623470236572891, 9.394335681818182, 7.152540652173913, 3.8606523529411763, 2.21986085106383, 0.0, 6.052438493253375, 8.87944340425532, 5.790978529411765, 4.7683604347826085, 2.3485839204545456, 0.0), # 48 (4.630726078964194, 9.401560994318181, 7.134522563405797, 3.8580164297385626, 2.2158089804964543, 0.0, 6.003846272696985, 8.863235921985817, 5.787024644607844, 4.7563483756038645, 2.3503902485795454, 0.0), # 49 (4.6378356777493615, 9.408636363636361, 7.115778985507247, 3.8552614379084966, 2.211578014184397, 0.0, 5.953702315508913, 8.846312056737588, 5.782892156862745, 4.743852657004831, 2.3521590909090904, 0.0), # 50 (4.6448037324168805, 9.415560596590907, 7.096335407608696, 3.852389779411765, 2.2071720478723407, 0.0, 5.902093684407797, 8.828688191489363, 5.778584669117648, 4.73089027173913, 2.353890149147727, 0.0), # 51 (4.651634942455243, 9.4223325, 7.0762173188405795, 3.84940385620915, 2.2025951773049646, 0.0, 5.849107442112278, 8.810380709219858, 5.774105784313726, 4.717478212560386, 2.355583125, 0.0), # 52 (4.658334007352941, 9.428950880681818, 7.055450208333333, 3.8463060702614382, 2.1978514982269504, 0.0, 5.794830651340996, 8.791405992907801, 5.769459105392158, 4.703633472222222, 2.3572377201704544, 0.0), # 53 (4.6649056265984665, 9.435414545454544, 7.034059565217391, 3.843098823529412, 2.192945106382979, 0.0, 5.739350374812594, 8.771780425531915, 5.764648235294119, 4.689373043478261, 2.358853636363636, 0.0), # 54 (4.671354499680307, 9.441722301136364, 7.012070878623187, 3.8397845179738566, 2.1878800975177306, 0.0, 5.682753675245711, 8.751520390070922, 5.759676776960785, 4.674713919082125, 2.360430575284091, 0.0), # 55 (4.677685326086957, 9.447872954545453, 6.989509637681159, 3.8363655555555556, 2.1826605673758865, 0.0, 5.625127615358988, 8.730642269503546, 5.754548333333334, 4.65967309178744, 2.361968238636363, 0.0), # 56 (4.683902805306906, 9.453865312500001, 6.966401331521738, 3.832844338235294, 2.1772906117021273, 0.0, 5.566559257871065, 8.70916244680851, 5.749266507352941, 4.644267554347826, 2.3634663281250003, 0.0), # 57 (4.690011636828645, 9.459698181818181, 6.942771449275362, 3.8292232679738563, 2.1717743262411346, 0.0, 5.507135665500583, 8.687097304964539, 5.743834901960785, 4.628514299516908, 2.3649245454545453, 0.0), # 58 (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59 ) passenger_allighting_rate = ( (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 0 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 1 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 2 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 3 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 4 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 5 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 6 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 7 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 8 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 9 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 10 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 11 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 12 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 13 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 14 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 15 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 16 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 17 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 18 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 19 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 20 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 21 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 22 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 23 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 24 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 25 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 26 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 27 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 28 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 29 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 30 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 31 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 32 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 33 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 34 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 35 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 36 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 37 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 38 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 39 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 40 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 41 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 42 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 43 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 44 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 45 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 46 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 47 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 48 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 49 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 50 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 51 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 52 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 53 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 54 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 55 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 56 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 57 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 58 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 59 ) """ parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html """ #initial entropy entropy = 258194110137029475889902652135037600173 #index for seed sequence child child_seed_index = ( 1, # 0 17, # 1 )
""" PASSENGERS """ num_passengers = 3191 passenger_arriving = ((5, 8, 7, 5, 1, 0, 3, 5, 8, 3, 0, 0), (2, 8, 13, 5, 0, 0, 12, 10, 6, 1, 0, 0), (1, 10, 5, 4, 2, 0, 13, 13, 5, 2, 3, 0), (5, 11, 16, 2, 3, 0, 8, 0, 6, 3, 4, 0), (5, 8, 6, 2, 1, 0, 7, 10, 6, 5, 1, 0), (1, 10, 8, 5, 1, 0, 3, 10, 4, 2, 2, 0), (6, 8, 4, 5, 2, 0, 6, 6, 4, 4, 2, 0), (5, 9, 5, 2, 1, 0, 10, 12, 2, 5, 3, 0), (6, 3, 5, 3, 1, 0, 8, 7, 3, 6, 0, 0), (5, 7, 5, 5, 2, 0, 6, 6, 5, 4, 2, 0), (5, 11, 8, 3, 0, 0, 5, 8, 5, 4, 1, 0), (7, 5, 9, 6, 3, 0, 4, 5, 11, 6, 2, 0), (6, 7, 11, 2, 1, 0, 7, 6, 14, 8, 1, 0), (3, 6, 10, 4, 2, 0, 10, 9, 9, 2, 3, 0), (2, 8, 3, 4, 4, 0, 6, 12, 1, 2, 2, 0), (4, 12, 10, 7, 1, 0, 5, 16, 9, 7, 1, 0), (2, 11, 5, 1, 1, 0, 8, 9, 5, 6, 0, 0), (0, 10, 9, 4, 5, 0, 4, 8, 3, 4, 1, 0), (2, 7, 6, 3, 3, 0, 5, 12, 7, 6, 5, 0), (5, 8, 4, 5, 1, 0, 11, 9, 4, 3, 2, 0), (0, 9, 4, 2, 1, 0, 9, 13, 5, 3, 2, 0), (2, 8, 7, 2, 3, 0, 3, 11, 9, 2, 4, 0), (4, 11, 8, 5, 1, 0, 7, 8, 4, 6, 3, 0), (3, 4, 6, 0, 3, 0, 4, 11, 4, 7, 0, 0), (6, 14, 9, 3, 1, 0, 5, 5, 9, 6, 5, 0), (4, 8, 4, 7, 5, 0, 8, 6, 7, 3, 2, 0), (4, 8, 14, 2, 7, 0, 8, 9, 9, 4, 5, 0), (3, 5, 9, 8, 1, 0, 10, 6, 7, 5, 3, 0), (5, 13, 5, 3, 3, 0, 4, 10, 10, 4, 1, 0), (5, 8, 7, 3, 5, 0, 10, 10, 3, 0, 0, 0), (1, 10, 3, 3, 4, 0, 10, 10, 3, 7, 3, 0), (8, 6, 10, 5, 0, 0, 6, 9, 4, 4, 1, 0), (3, 10, 9, 2, 1, 0, 8, 10, 3, 5, 2, 0), (4, 9, 5, 1, 3, 0, 3, 7, 6, 6, 2, 0), (7, 6, 5, 6, 4, 0, 10, 9, 8, 2, 1, 0), (6, 6, 6, 5, 2, 0, 4, 5, 5, 8, 2, 0), (3, 15, 7, 4, 4, 0, 7, 8, 10, 5, 4, 0), (4, 15, 11, 4, 2, 0, 9, 11, 3, 9, 4, 0), (3, 13, 5, 3, 4, 0, 8, 8, 3, 6, 3, 0), (2, 5, 8, 1, 0, 0, 5, 7, 3, 8, 5, 0), (6, 8, 11, 5, 3, 0, 10, 13, 4, 4, 1, 0), (4, 9, 6, 6, 0, 0, 6, 9, 3, 1, 0, 0), (2, 10, 8, 3, 4, 0, 10, 7, 5, 1, 0, 0), (4, 17, 7, 3, 3, 0, 7, 6, 6, 3, 1, 0), (6, 13, 3, 2, 2, 0, 5, 11, 7, 5, 4, 0), (3, 11, 6, 2, 2, 0, 3, 5, 5, 3, 2, 0), (7, 8, 9, 4, 0, 0, 10, 8, 6, 5, 3, 0), (3, 10, 10, 8, 2, 0, 6, 10, 7, 7, 3, 0), (4, 10, 5, 8, 1, 0, 6, 9, 8, 6, 2, 0), (3, 12, 9, 2, 2, 0, 3, 11, 8, 3, 0, 0), (5, 13, 6, 5, 1, 0, 5, 7, 2, 3, 5, 0), (4, 9, 7, 5, 2, 0, 4, 9, 6, 5, 4, 0), (3, 8, 4, 3, 3, 0, 4, 7, 6, 3, 8, 0), (6, 10, 8, 6, 2, 0, 3, 6, 8, 4, 2, 0), (0, 11, 11, 5, 4, 0, 8, 8, 6, 5, 8, 0), (1, 9, 4, 3, 2, 0, 5, 8, 3, 5, 2, 0), (5, 7, 7, 3, 3, 0, 3, 9, 5, 3, 2, 0), (4, 7, 10, 6, 5, 0, 6, 12, 5, 5, 3, 0), (3, 6, 7, 6, 3, 0, 2, 8, 6, 7, 3, 0), (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) station_arriving_intensity = ((3.7095121817383676, 9.515044981060607, 11.19193043059126, 8.87078804347826, 10.000240384615385, 6.659510869565219), (3.7443308140669203, 9.620858238197952, 11.252381752534994, 8.920190141908213, 10.075193108974359, 6.657240994867151), (3.7787518681104277, 9.725101964085297, 11.31139817195087, 8.968504830917876, 10.148564102564103, 6.654901690821256), (3.8127461259877085, 9.827663671875001, 11.368936576156813, 9.01569089673913, 10.22028605769231, 6.652493274456523), (3.8462843698175795, 9.928430874719417, 11.424953852470724, 9.061707125603865, 10.290291666666668, 6.6500160628019325), (3.879337381718857, 10.027291085770905, 11.479406888210512, 9.106512303743962, 10.358513621794872, 6.647470372886473), (3.9118759438103607, 10.12413181818182, 11.53225257069409, 9.150065217391306, 10.424884615384617, 6.644856521739131), (3.943870838210907, 10.218840585104518, 11.58344778723936, 9.19232465277778, 10.489337339743592, 6.64217482638889), (3.975292847039314, 10.311304899691358, 11.632949425164242, 9.233249396135266, 10.551804487179488, 6.639425603864735), (4.006112752414399, 10.401412275094698, 11.680714371786634, 9.272798233695653, 10.61221875, 6.636609171195653), (4.03630133645498, 10.489050224466892, 11.72669951442445, 9.310929951690824, 10.670512820512823, 6.633725845410628), (4.065829381279876, 10.5741062609603, 11.7708617403956, 9.347603336352659, 10.726619391025642, 6.630775943538648), (4.094667669007903, 10.656467897727273, 11.813157937017996, 9.382777173913043, 10.780471153846154, 6.627759782608695), (4.122786981757876, 10.736022647920176, 11.85354499160954, 9.416410250603866, 10.832000801282053, 6.624677679649759), (4.15015810164862, 10.81265802469136, 11.891979791488144, 9.448461352657004, 10.881141025641025, 6.621529951690821), (4.1767518107989465, 10.886261541193182, 11.928419223971721, 9.478889266304348, 10.92782451923077, 6.618316915760871), (4.202538891327675, 10.956720710578002, 11.96282017637818, 9.507652777777778, 10.971983974358976, 6.61503888888889), (4.227490125353625, 11.023923045998176, 11.995139536025421, 9.53471067330918, 11.013552083333336, 6.611696188103866), (4.25157629499561, 11.087756060606061, 12.025334190231364, 9.560021739130436, 11.052461538461543, 6.608289130434783), (4.274768182372451, 11.148107267554012, 12.053361026313912, 9.58354476147343, 11.088645032051284, 6.604818032910629), (4.297036569602966, 11.204864179994388, 12.079176931590974, 9.60523852657005, 11.122035256410259, 6.601283212560387), (4.318352238805971, 11.257914311079544, 12.102738793380466, 9.625061820652174, 11.152564903846153, 6.597684986413044), (4.338685972100283, 11.307145173961842, 12.124003499000287, 9.642973429951692, 11.180166666666667, 6.5940236714975855), (4.358008551604722, 11.352444281793632, 12.142927935768354, 9.658932140700484, 11.204773237179488, 6.590299584842997), (4.3762907594381035, 11.393699147727272, 12.159468991002571, 9.672896739130437, 11.226317307692307, 6.586513043478261), (4.393503377719247, 11.430797284915124, 12.173583552020853, 9.684826011473431, 11.244731570512819, 6.582664364432368), (4.409617188566969, 11.46362620650954, 12.185228506141103, 9.694678743961353, 11.259948717948719, 6.5787538647343), (4.424602974100088, 11.492073425662877, 12.194360740681233, 9.702413722826089, 11.271901442307694, 6.574781861413045), (4.438431516437421, 11.516026455527497, 12.200937142959157, 9.707989734299519, 11.280522435897437, 6.570748671497586), (4.4510735976977855, 11.535372809255753, 12.204914600292774, 9.711365564613528, 11.285744391025641, 6.566654612016909), (4.4625, 11.55, 12.20625, 9.7125, 11.287500000000001, 6.562500000000001), (4.47319183983376, 11.56215031960227, 12.205248928140096, 9.712295118464054, 11.286861125886526, 6.556726763701484), (4.4836528452685425, 11.574140056818184, 12.202274033816424, 9.711684477124184, 11.28495815602837, 6.547834661835751), (4.493887715792838, 11.585967720170455, 12.197367798913046, 9.710674080882354, 11.281811569148937, 6.535910757121439), (4.503901150895141, 11.597631818181819, 12.19057270531401, 9.709269934640524, 11.277441843971632, 6.521042112277196), (4.513697850063939, 11.609130859374998, 12.181931234903383, 9.707478043300654, 11.27186945921986, 6.503315790021656), (4.523282512787724, 11.62046335227273, 12.171485869565219, 9.705304411764708, 11.265114893617023, 6.482818853073463), (4.532659838554988, 11.631627805397729, 12.159279091183576, 9.70275504493464, 11.257198625886524, 6.4596383641512585), (4.5418345268542195, 11.642622727272729, 12.145353381642513, 9.699835947712419, 11.248141134751775, 6.433861385973679), (4.5508112771739135, 11.653446626420456, 12.129751222826087, 9.696553125000001, 11.23796289893617, 6.40557498125937), (4.559594789002558, 11.664098011363638, 12.11251509661836, 9.692912581699348, 11.22668439716312, 6.37486621272697), (4.568189761828645, 11.674575390625, 12.093687484903382, 9.68892032271242, 11.214326108156028, 6.34182214309512), (4.576600895140665, 11.684877272727276, 12.07331086956522, 9.684582352941177, 11.2009085106383, 6.3065298350824595), (4.584832888427111, 11.69500216619318, 12.051427732487923, 9.679904677287583, 11.186452083333334, 6.26907635140763), (4.592890441176471, 11.704948579545455, 12.028080555555556, 9.674893300653595, 11.17097730496454, 6.229548754789272), (4.600778252877237, 11.714715021306818, 12.003311820652177, 9.669554227941177, 11.15450465425532, 6.188034107946028), (4.6085010230179035, 11.724300000000003, 11.97716400966184, 9.663893464052288, 11.137054609929079, 6.144619473596536), (4.616063451086957, 11.733702024147728, 11.9496796044686, 9.65791701388889, 11.118647650709221, 6.099391914459438), (4.623470236572891, 11.742919602272728, 11.920901086956523, 9.651630882352942, 11.099304255319149, 6.052438493253375), (4.630726078964194, 11.751951242897727, 11.890870939009663, 9.645041074346407, 11.079044902482272, 6.003846272696985), (4.6378356777493615, 11.760795454545454, 11.85963164251208, 9.638153594771243, 11.057890070921987, 5.953702315508913), (4.6448037324168805, 11.769450745738636, 11.827225679347826, 9.630974448529413, 11.035860239361703, 5.902093684407797), (4.651634942455243, 11.777915625, 11.793695531400965, 9.623509640522876, 11.012975886524824, 5.849107442112278), (4.658334007352941, 11.786188600852274, 11.759083680555555, 9.615765175653596, 10.989257491134753, 5.794830651340996), (4.6649056265984665, 11.79426818181818, 11.723432608695653, 9.60774705882353, 10.964725531914894, 5.739350374812594), (4.671354499680307, 11.802152876420456, 11.686784797705313, 9.599461294934642, 10.939400487588653, 5.682753675245711), (4.677685326086957, 11.809841193181818, 11.649182729468599, 9.59091388888889, 10.913302836879433, 5.625127615358988), (4.683902805306906, 11.817331640625003, 11.610668885869565, 9.582110845588236, 10.886453058510638, 5.566559257871065), (4.690011636828645, 11.824622727272727, 11.57128574879227, 9.573058169934642, 10.858871631205675, 5.507135665500583), (0.0, 0.0, 0.0, 0.0, 0.0, 0.0)) passenger_arriving_acc = ((5, 8, 7, 5, 1, 0, 3, 5, 8, 3, 0, 0), (7, 16, 20, 10, 1, 0, 15, 15, 14, 4, 0, 0), (8, 26, 25, 14, 3, 0, 28, 28, 19, 6, 3, 0), (13, 37, 41, 16, 6, 0, 36, 28, 25, 9, 7, 0), (18, 45, 47, 18, 7, 0, 43, 38, 31, 14, 8, 0), (19, 55, 55, 23, 8, 0, 46, 48, 35, 16, 10, 0), (25, 63, 59, 28, 10, 0, 52, 54, 39, 20, 12, 0), (30, 72, 64, 30, 11, 0, 62, 66, 41, 25, 15, 0), (36, 75, 69, 33, 12, 0, 70, 73, 44, 31, 15, 0), (41, 82, 74, 38, 14, 0, 76, 79, 49, 35, 17, 0), (46, 93, 82, 41, 14, 0, 81, 87, 54, 39, 18, 0), (53, 98, 91, 47, 17, 0, 85, 92, 65, 45, 20, 0), (59, 105, 102, 49, 18, 0, 92, 98, 79, 53, 21, 0), (62, 111, 112, 53, 20, 0, 102, 107, 88, 55, 24, 0), (64, 119, 115, 57, 24, 0, 108, 119, 89, 57, 26, 0), (68, 131, 125, 64, 25, 0, 113, 135, 98, 64, 27, 0), (70, 142, 130, 65, 26, 0, 121, 144, 103, 70, 27, 0), (70, 152, 139, 69, 31, 0, 125, 152, 106, 74, 28, 0), (72, 159, 145, 72, 34, 0, 130, 164, 113, 80, 33, 0), (77, 167, 149, 77, 35, 0, 141, 173, 117, 83, 35, 0), (77, 176, 153, 79, 36, 0, 150, 186, 122, 86, 37, 0), (79, 184, 160, 81, 39, 0, 153, 197, 131, 88, 41, 0), (83, 195, 168, 86, 40, 0, 160, 205, 135, 94, 44, 0), (86, 199, 174, 86, 43, 0, 164, 216, 139, 101, 44, 0), (92, 213, 183, 89, 44, 0, 169, 221, 148, 107, 49, 0), (96, 221, 187, 96, 49, 0, 177, 227, 155, 110, 51, 0), (100, 229, 201, 98, 56, 0, 185, 236, 164, 114, 56, 0), (103, 234, 210, 106, 57, 0, 195, 242, 171, 119, 59, 0), (108, 247, 215, 109, 60, 0, 199, 252, 181, 123, 60, 0), (113, 255, 222, 112, 65, 0, 209, 262, 184, 123, 60, 0), (114, 265, 225, 115, 69, 0, 219, 272, 187, 130, 63, 0), (122, 271, 235, 120, 69, 0, 225, 281, 191, 134, 64, 0), (125, 281, 244, 122, 70, 0, 233, 291, 194, 139, 66, 0), (129, 290, 249, 123, 73, 0, 236, 298, 200, 145, 68, 0), (136, 296, 254, 129, 77, 0, 246, 307, 208, 147, 69, 0), (142, 302, 260, 134, 79, 0, 250, 312, 213, 155, 71, 0), (145, 317, 267, 138, 83, 0, 257, 320, 223, 160, 75, 0), (149, 332, 278, 142, 85, 0, 266, 331, 226, 169, 79, 0), (152, 345, 283, 145, 89, 0, 274, 339, 229, 175, 82, 0), (154, 350, 291, 146, 89, 0, 279, 346, 232, 183, 87, 0), (160, 358, 302, 151, 92, 0, 289, 359, 236, 187, 88, 0), (164, 367, 308, 157, 92, 0, 295, 368, 239, 188, 88, 0), (166, 377, 316, 160, 96, 0, 305, 375, 244, 189, 88, 0), (170, 394, 323, 163, 99, 0, 312, 381, 250, 192, 89, 0), (176, 407, 326, 165, 101, 0, 317, 392, 257, 197, 93, 0), (179, 418, 332, 167, 103, 0, 320, 397, 262, 200, 95, 0), (186, 426, 341, 171, 103, 0, 330, 405, 268, 205, 98, 0), (189, 436, 351, 179, 105, 0, 336, 415, 275, 212, 101, 0), (193, 446, 356, 187, 106, 0, 342, 424, 283, 218, 103, 0), (196, 458, 365, 189, 108, 0, 345, 435, 291, 221, 103, 0), (201, 471, 371, 194, 109, 0, 350, 442, 293, 224, 108, 0), (205, 480, 378, 199, 111, 0, 354, 451, 299, 229, 112, 0), (208, 488, 382, 202, 114, 0, 358, 458, 305, 232, 120, 0), (214, 498, 390, 208, 116, 0, 361, 464, 313, 236, 122, 0), (214, 509, 401, 213, 120, 0, 369, 472, 319, 241, 130, 0), (215, 518, 405, 216, 122, 0, 374, 480, 322, 246, 132, 0), (220, 525, 412, 219, 125, 0, 377, 489, 327, 249, 134, 0), (224, 532, 422, 225, 130, 0, 383, 501, 332, 254, 137, 0), (227, 538, 429, 231, 133, 0, 385, 509, 338, 261, 140, 0), (227, 538, 429, 231, 133, 0, 385, 509, 338, 261, 140, 0)) passenger_arriving_rate = ((3.7095121817383676, 7.612035984848484, 6.715158258354756, 3.5483152173913037, 2.000048076923077, 0.0, 6.659510869565219, 8.000192307692307, 5.322472826086956, 4.476772172236504, 1.903008996212121, 0.0), (3.7443308140669203, 7.696686590558361, 6.751429051520996, 3.5680760567632848, 2.0150386217948717, 0.0, 6.657240994867151, 8.060154487179487, 5.352114085144928, 4.500952701013997, 1.9241716476395903, 0.0), (3.7787518681104277, 7.780081571268237, 6.786838903170522, 3.58740193236715, 2.0297128205128203, 0.0, 6.654901690821256, 8.118851282051281, 5.381102898550726, 4.524559268780347, 1.9450203928170593, 0.0), (3.8127461259877085, 7.8621309375, 6.821361945694087, 3.6062763586956517, 2.044057211538462, 0.0, 6.652493274456523, 8.176228846153847, 5.409414538043478, 4.547574630462725, 1.965532734375, 0.0), (3.8462843698175795, 7.942744699775533, 6.854972311482434, 3.624682850241546, 2.0580583333333333, 0.0, 6.6500160628019325, 8.232233333333333, 5.437024275362319, 4.569981540988289, 1.9856861749438832, 0.0), (3.879337381718857, 8.021832868616723, 6.887644132926307, 3.6426049214975844, 2.0717027243589743, 0.0, 6.647470372886473, 8.286810897435897, 5.463907382246377, 4.591762755284204, 2.005458217154181, 0.0), (3.9118759438103607, 8.099305454545455, 6.919351542416455, 3.660026086956522, 2.084976923076923, 0.0, 6.644856521739131, 8.339907692307692, 5.490039130434783, 4.612901028277636, 2.0248263636363637, 0.0), (3.943870838210907, 8.175072468083613, 6.950068672343615, 3.6769298611111116, 2.0978674679487184, 0.0, 6.64217482638889, 8.391469871794873, 5.515394791666668, 4.633379114895743, 2.043768117020903, 0.0), (3.975292847039314, 8.249043919753085, 6.979769655098544, 3.693299758454106, 2.1103608974358976, 0.0, 6.639425603864735, 8.44144358974359, 5.5399496376811594, 4.653179770065696, 2.062260979938271, 0.0), (4.006112752414399, 8.321129820075758, 7.00842862307198, 3.709119293478261, 2.12244375, 0.0, 6.636609171195653, 8.489775, 5.563678940217391, 4.672285748714653, 2.0802824550189394, 0.0), (4.03630133645498, 8.391240179573513, 7.03601970865467, 3.724371980676329, 2.134102564102564, 0.0, 6.633725845410628, 8.536410256410257, 5.586557971014494, 4.690679805769779, 2.0978100448933783, 0.0), (4.065829381279876, 8.459285008768239, 7.06251704423736, 3.739041334541063, 2.145323878205128, 0.0, 6.630775943538648, 8.581295512820512, 5.608562001811595, 4.70834469615824, 2.1148212521920597, 0.0), (4.094667669007903, 8.525174318181818, 7.087894762210797, 3.7531108695652167, 2.156094230769231, 0.0, 6.627759782608695, 8.624376923076923, 5.6296663043478254, 4.725263174807198, 2.1312935795454546, 0.0), (4.122786981757876, 8.58881811833614, 7.112126994965724, 3.766564100241546, 2.1664001602564102, 0.0, 6.624677679649759, 8.665600641025641, 5.649846150362319, 4.741417996643816, 2.147204529584035, 0.0), (4.15015810164862, 8.650126419753088, 7.135187874892886, 3.779384541062801, 2.1762282051282047, 0.0, 6.621529951690821, 8.704912820512819, 5.669076811594202, 4.756791916595257, 2.162531604938272, 0.0), (4.1767518107989465, 8.709009232954545, 7.157051534383032, 3.7915557065217387, 2.1855649038461538, 0.0, 6.618316915760871, 8.742259615384615, 5.6873335597826085, 4.771367689588688, 2.177252308238636, 0.0), (4.202538891327675, 8.7653765684624, 7.177692105826908, 3.803061111111111, 2.194396794871795, 0.0, 6.61503888888889, 8.77758717948718, 5.7045916666666665, 4.785128070551272, 2.1913441421156, 0.0), (4.227490125353625, 8.81913843679854, 7.197083721615253, 3.8138842693236716, 2.202710416666667, 0.0, 6.611696188103866, 8.810841666666668, 5.720826403985508, 4.798055814410168, 2.204784609199635, 0.0), (4.25157629499561, 8.870204848484848, 7.215200514138818, 3.824008695652174, 2.2104923076923084, 0.0, 6.608289130434783, 8.841969230769234, 5.736013043478262, 4.810133676092545, 2.217551212121212, 0.0), (4.274768182372451, 8.918485814043208, 7.232016615788346, 3.8334179045893717, 2.2177290064102566, 0.0, 6.604818032910629, 8.870916025641026, 5.750126856884058, 4.8213444105255645, 2.229621453510802, 0.0), (4.297036569602966, 8.96389134399551, 7.247506158954584, 3.8420954106280196, 2.2244070512820517, 0.0, 6.601283212560387, 8.897628205128207, 5.76314311594203, 4.831670772636389, 2.2409728359988774, 0.0), (4.318352238805971, 9.006331448863634, 7.261643276028279, 3.8500247282608693, 2.2305129807692303, 0.0, 6.597684986413044, 8.922051923076921, 5.775037092391305, 4.841095517352186, 2.2515828622159084, 0.0), (4.338685972100283, 9.045716139169473, 7.274402099400172, 3.8571893719806765, 2.2360333333333333, 0.0, 6.5940236714975855, 8.944133333333333, 5.785784057971015, 4.849601399600115, 2.2614290347923682, 0.0), (4.358008551604722, 9.081955425434906, 7.285756761461012, 3.8635728562801934, 2.2409546474358972, 0.0, 6.590299584842997, 8.963818589743589, 5.79535928442029, 4.857171174307341, 2.2704888563587264, 0.0), (4.3762907594381035, 9.114959318181818, 7.295681394601543, 3.869158695652174, 2.2452634615384612, 0.0, 6.586513043478261, 8.981053846153845, 5.803738043478262, 4.863787596401028, 2.2787398295454544, 0.0), (4.393503377719247, 9.1446378279321, 7.304150131212511, 3.8739304045893723, 2.2489463141025636, 0.0, 6.582664364432368, 8.995785256410255, 5.810895606884059, 4.869433420808341, 2.286159456983025, 0.0), (4.409617188566969, 9.17090096520763, 7.311137103684661, 3.8778714975845405, 2.2519897435897436, 0.0, 6.5787538647343, 9.007958974358974, 5.816807246376811, 4.874091402456441, 2.2927252413019077, 0.0), (4.424602974100088, 9.193658740530301, 7.31661644440874, 3.880965489130435, 2.2543802884615385, 0.0, 6.574781861413045, 9.017521153846154, 5.821448233695653, 4.877744296272493, 2.2984146851325753, 0.0), (4.438431516437421, 9.212821164421996, 7.320562285775494, 3.8831958937198072, 2.256104487179487, 0.0, 6.570748671497586, 9.024417948717948, 5.824793840579711, 4.8803748571836625, 2.303205291105499, 0.0), (4.4510735976977855, 9.228298247404602, 7.322948760175664, 3.884546225845411, 2.257148878205128, 0.0, 6.566654612016909, 9.028595512820512, 5.826819338768117, 4.881965840117109, 2.3070745618511506, 0.0), (4.4625, 9.24, 7.32375, 3.885, 2.2575000000000003, 0.0, 6.562500000000001, 9.030000000000001, 5.8275, 4.8825, 2.31, 0.0), (4.47319183983376, 9.249720255681815, 7.323149356884057, 3.884918047385621, 2.257372225177305, 0.0, 6.556726763701484, 9.02948890070922, 5.827377071078432, 4.882099571256038, 2.312430063920454, 0.0), (4.4836528452685425, 9.259312045454546, 7.3213644202898545, 3.884673790849673, 2.2569916312056737, 0.0, 6.547834661835751, 9.027966524822695, 5.82701068627451, 4.880909613526569, 2.3148280113636366, 0.0), (4.493887715792838, 9.268774176136363, 7.3184206793478275, 3.8842696323529413, 2.2563623138297872, 0.0, 6.535910757121439, 9.025449255319149, 5.826404448529412, 4.878947119565218, 2.3171935440340907, 0.0), (4.503901150895141, 9.278105454545454, 7.314343623188405, 3.8837079738562093, 2.2554883687943263, 0.0, 6.521042112277196, 9.021953475177305, 5.825561960784314, 4.876229082125604, 2.3195263636363634, 0.0), (4.513697850063939, 9.287304687499997, 7.3091587409420296, 3.882991217320261, 2.2543738918439717, 0.0, 6.503315790021656, 9.017495567375887, 5.824486825980392, 4.872772493961353, 2.3218261718749993, 0.0), (4.523282512787724, 9.296370681818182, 7.302891521739131, 3.8821217647058828, 2.253022978723404, 0.0, 6.482818853073463, 9.012091914893617, 5.823182647058824, 4.868594347826087, 2.3240926704545455, 0.0), (4.532659838554988, 9.305302244318183, 7.295567454710145, 3.881102017973856, 2.2514397251773044, 0.0, 6.4596383641512585, 9.005758900709218, 5.821653026960784, 4.86371163647343, 2.3263255610795457, 0.0), (4.5418345268542195, 9.314098181818181, 7.287212028985508, 3.8799343790849674, 2.249628226950355, 0.0, 6.433861385973679, 8.99851290780142, 5.819901568627452, 4.858141352657005, 2.3285245454545453, 0.0), (4.5508112771739135, 9.322757301136363, 7.277850733695652, 3.87862125, 2.247592579787234, 0.0, 6.40557498125937, 8.990370319148935, 5.817931875, 4.8519004891304345, 2.330689325284091, 0.0), (4.559594789002558, 9.33127840909091, 7.267509057971015, 3.8771650326797387, 2.245336879432624, 0.0, 6.37486621272697, 8.981347517730496, 5.815747549019608, 4.845006038647344, 2.3328196022727274, 0.0), (4.568189761828645, 9.3396603125, 7.256212490942029, 3.8755681290849675, 2.2428652216312055, 0.0, 6.34182214309512, 8.971460886524822, 5.813352193627452, 4.837474993961353, 2.334915078125, 0.0), (4.576600895140665, 9.34790181818182, 7.2439865217391315, 3.8738329411764707, 2.2401817021276598, 0.0, 6.3065298350824595, 8.960726808510639, 5.810749411764706, 4.829324347826088, 2.336975454545455, 0.0), (4.584832888427111, 9.356001732954544, 7.230856639492753, 3.8719618709150327, 2.2372904166666667, 0.0, 6.26907635140763, 8.949161666666667, 5.80794280637255, 4.820571092995169, 2.339000433238636, 0.0), (4.592890441176471, 9.363958863636363, 7.216848333333333, 3.8699573202614377, 2.2341954609929076, 0.0, 6.229548754789272, 8.93678184397163, 5.804935980392157, 4.811232222222222, 2.3409897159090907, 0.0), (4.600778252877237, 9.371772017045453, 7.201987092391306, 3.8678216911764705, 2.230900930851064, 0.0, 6.188034107946028, 8.923603723404256, 5.801732536764706, 4.80132472826087, 2.3429430042613633, 0.0), (4.6085010230179035, 9.379440000000002, 7.186298405797103, 3.8655573856209147, 2.2274109219858156, 0.0, 6.144619473596536, 8.909643687943262, 5.798336078431372, 4.790865603864735, 2.3448600000000006, 0.0), (4.616063451086957, 9.386961619318182, 7.16980776268116, 3.8631668055555552, 2.223729530141844, 0.0, 6.099391914459438, 8.894918120567375, 5.794750208333333, 4.77987184178744, 2.3467404048295455, 0.0), (4.623470236572891, 9.394335681818182, 7.152540652173913, 3.8606523529411763, 2.21986085106383, 0.0, 6.052438493253375, 8.87944340425532, 5.790978529411765, 4.7683604347826085, 2.3485839204545456, 0.0), (4.630726078964194, 9.401560994318181, 7.134522563405797, 3.8580164297385626, 2.2158089804964543, 0.0, 6.003846272696985, 8.863235921985817, 5.787024644607844, 4.7563483756038645, 2.3503902485795454, 0.0), (4.6378356777493615, 9.408636363636361, 7.115778985507247, 3.8552614379084966, 2.211578014184397, 0.0, 5.953702315508913, 8.846312056737588, 5.782892156862745, 4.743852657004831, 2.3521590909090904, 0.0), (4.6448037324168805, 9.415560596590907, 7.096335407608696, 3.852389779411765, 2.2071720478723407, 0.0, 5.902093684407797, 8.828688191489363, 5.778584669117648, 4.73089027173913, 2.353890149147727, 0.0), (4.651634942455243, 9.4223325, 7.0762173188405795, 3.84940385620915, 2.2025951773049646, 0.0, 5.849107442112278, 8.810380709219858, 5.774105784313726, 4.717478212560386, 2.355583125, 0.0), (4.658334007352941, 9.428950880681818, 7.055450208333333, 3.8463060702614382, 2.1978514982269504, 0.0, 5.794830651340996, 8.791405992907801, 5.769459105392158, 4.703633472222222, 2.3572377201704544, 0.0), (4.6649056265984665, 9.435414545454544, 7.034059565217391, 3.843098823529412, 2.192945106382979, 0.0, 5.739350374812594, 8.771780425531915, 5.764648235294119, 4.689373043478261, 2.358853636363636, 0.0), (4.671354499680307, 9.441722301136364, 7.012070878623187, 3.8397845179738566, 2.1878800975177306, 0.0, 5.682753675245711, 8.751520390070922, 5.759676776960785, 4.674713919082125, 2.360430575284091, 0.0), (4.677685326086957, 9.447872954545453, 6.989509637681159, 3.8363655555555556, 2.1826605673758865, 0.0, 5.625127615358988, 8.730642269503546, 5.754548333333334, 4.65967309178744, 2.361968238636363, 0.0), (4.683902805306906, 9.453865312500001, 6.966401331521738, 3.832844338235294, 2.1772906117021273, 0.0, 5.566559257871065, 8.70916244680851, 5.749266507352941, 4.644267554347826, 2.3634663281250003, 0.0), (4.690011636828645, 9.459698181818181, 6.942771449275362, 3.8292232679738563, 2.1717743262411346, 0.0, 5.507135665500583, 8.687097304964539, 5.743834901960785, 4.628514299516908, 2.3649245454545453, 0.0), (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)) passenger_allighting_rate = ((0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1)) '\nparameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html\n' entropy = 258194110137029475889902652135037600173 child_seed_index = (1, 17)
""" Copyright 2020 Skyscanner Ltd 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. """ class ARN(object): def __init__( self, full, partition=None, service=None, region=None, account_id=None, resource_type=None, resource=None, ): self.full = full self.partition = partition self.service = service self.region = region self.account_id = account_id self.resource_type = resource_type self.resource = resource def to_dict(self): return { "full": self.full, "partition": self.partition, "service": self.service, "region": self.region, "account_id": self.account_id, "resource_type": self.resource_type, "resource": self.resource, } def empty_str_to_none(str_): if str_ == "": return None return str_ def arnparse(arn_str): # https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html if not arn_str.startswith("arn:") or len(arn_str.split(":")) < 4: raise ValueError("Invalid ARN format: {}".format(arn_str)) elements = arn_str.split(":", 5) elements += [""] * (6 - len(elements)) resource = elements[5].split("/")[-1] resource_type = None service = elements[2] if service == "execute-api": service = "apigateway" if service == "iam": resource_type = "/".join(elements[5].split("/")[:-1]) # role type elif service == "sts": res = elements[5].split("/") if len(res) > 1: resource_type = res[0] # assumed-role resource = res[1] # group elif service == "dynamodb": resource_type = elements[5].split("/")[0] # table resource = elements[5].split("/")[1] # table name elif service == "s3": if len(elements[5].split("/")) > 1: resource_type = elements[5].split("/", 1)[1] # objects resource = elements[5].split("/")[0] # bucket name elif service == "kms": resource_type = elements[5].split("/")[0] elif service == "logs": resource_type = elements[5].split(":")[0] resource = ":".join(elements[5].split(":")[1:]) elif service == "apigateway": resource_type, *resource = elements[5].split("/") resource = "/".join(resource) elif "/" in resource: resource_type, resource = resource.split("/", 1) elif ":" in resource: resource_type, resource = resource.split(":", 1) return ARN( full=arn_str, partition=elements[1], service=service, region=empty_str_to_none(elements[3]), account_id=empty_str_to_none(elements[4]), resource_type=resource_type, resource=resource, )
""" Copyright 2020 Skyscanner Ltd 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. """ class Arn(object): def __init__(self, full, partition=None, service=None, region=None, account_id=None, resource_type=None, resource=None): self.full = full self.partition = partition self.service = service self.region = region self.account_id = account_id self.resource_type = resource_type self.resource = resource def to_dict(self): return {'full': self.full, 'partition': self.partition, 'service': self.service, 'region': self.region, 'account_id': self.account_id, 'resource_type': self.resource_type, 'resource': self.resource} def empty_str_to_none(str_): if str_ == '': return None return str_ def arnparse(arn_str): if not arn_str.startswith('arn:') or len(arn_str.split(':')) < 4: raise value_error('Invalid ARN format: {}'.format(arn_str)) elements = arn_str.split(':', 5) elements += [''] * (6 - len(elements)) resource = elements[5].split('/')[-1] resource_type = None service = elements[2] if service == 'execute-api': service = 'apigateway' if service == 'iam': resource_type = '/'.join(elements[5].split('/')[:-1]) elif service == 'sts': res = elements[5].split('/') if len(res) > 1: resource_type = res[0] resource = res[1] elif service == 'dynamodb': resource_type = elements[5].split('/')[0] resource = elements[5].split('/')[1] elif service == 's3': if len(elements[5].split('/')) > 1: resource_type = elements[5].split('/', 1)[1] resource = elements[5].split('/')[0] elif service == 'kms': resource_type = elements[5].split('/')[0] elif service == 'logs': resource_type = elements[5].split(':')[0] resource = ':'.join(elements[5].split(':')[1:]) elif service == 'apigateway': (resource_type, *resource) = elements[5].split('/') resource = '/'.join(resource) elif '/' in resource: (resource_type, resource) = resource.split('/', 1) elif ':' in resource: (resource_type, resource) = resource.split(':', 1) return arn(full=arn_str, partition=elements[1], service=service, region=empty_str_to_none(elements[3]), account_id=empty_str_to_none(elements[4]), resource_type=resource_type, resource=resource)
""" Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character but a character may map to itself. For example, Given "egg", "add", return true. Given "foo", "bar", return false. Given "paper", "title", return true. Note: You may assume both s and t have the same length. """ __author__ = 'Daniel' class Solution: def isIsomorphic(self, s, t): """ :param s: :param t: :rtype: bool """ m = {} mapped = set() # case "ab", "aa" for i in xrange(len(s)): if s[i] not in m and t[i] not in mapped: m[s[i]] = t[i] mapped.add(t[i]) elif s[i] in m and m[s[i]] == t[i]: pass else: return False return True
""" Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character but a character may map to itself. For example, Given "egg", "add", return true. Given "foo", "bar", return false. Given "paper", "title", return true. Note: You may assume both s and t have the same length. """ __author__ = 'Daniel' class Solution: def is_isomorphic(self, s, t): """ :param s: :param t: :rtype: bool """ m = {} mapped = set() for i in xrange(len(s)): if s[i] not in m and t[i] not in mapped: m[s[i]] = t[i] mapped.add(t[i]) elif s[i] in m and m[s[i]] == t[i]: pass else: return False return True
# Searvice Check Config #### Global DOMAIN = 'TEAM' ### HTTP HTTP_PAGES = [ { 'url':'', 'expected':'index.html', 'tolerance': 0.05 }, ] ### HTTPS HTTPS_PAGES = [ { 'url':'', 'expected':'index.html', 'tolerance': 0.05 }, ] ### DNS DNS_QUERIES = [ { 'type':'A', 'query':'team.local', 'expected':'216.239.32.10' }, ] ### FTP FTP_FILES = [ { 'path':'/testfile.txt', 'checksum':'12345ABCDEF' }, ] ### SMB SMB_FILES = [ { 'sharename':'ftproot', 'path':'/index.html', 'checksum':'83e503650ffd301b55538ea896afbcedea0c79c2' }, ] ### MSSQL MSSQL_QUERIES = [ { 'db': 'employee_data', 'query': 'SELECT SSN FROM dbo.hr_info WHERE LastName LIKE \'Erikson\'', 'response': '122751924' }, ] ### MYSQL MYSQL_QUERIES = [ { 'db': 'mysql', 'query': 'SELECT password FROM user WHERE user=\'root\' AND host=\'localhost\'', 'response': '*9CFBBC772F3F6C106020035386DA5BBBF1249A11' } ] ### SMTP SMTP_ADDRESSES = [ '[email protected]', '[email protected]', ] ### LDAP LDAP_QUERIES = [ { 'dn': '%[email protected]', 'base': 'cn=users,dc=team,dc=vnet', 'filter':'(&(objectClass=*)(cn=Administrator))', 'attributes':['sAMAccountName'], 'expected':{'sAMAccountName': ['Administrator']} }, ] # Services Config SERVICES = [ { 'name':'http', 'subnet_host':'152', 'port':80, 'plugin':'http' }, { 'name':'ssh', 'subnet_host':'152', 'port':22, 'plugin':'ssh' }, { 'name':'dns', 'subnet_host':'152', 'port':53, 'plugin':'dns' }, { 'name':'imap', 'subnet_host':'152', 'port':143, 'plugin':'imap' }, { 'name':'pop', 'subnet_host':'152', 'port':110, 'plugin':'pop' }, { 'name':'smtp', 'subnet_host':'152', 'port':25, 'plugin':'smtp' }, { 'name':'ldap', 'subnet_host':'134', 'port':389, 'plugin':'ldap' }, { 'name':'ftp', 'subnet_host':'152', 'port':21, 'plugin':'ftp' }, { 'name':'mssql', 'subnet_host':'152', 'port':3308, 'plugin':'mssql' }, { 'name':'mysql', 'subnet_host':'152', 'port':3309, 'plugin':'mysql' }, { 'name':'https', 'subnet_host':'152', 'port':443, 'plugin':'https' }, { 'name':'smb', 'subnet_host':'134', 'port':139, 'plugin':'smb' }, ] # Default Credentials Config DEFAULT_CREDS = [ { 'username':'joe', 'password':'toor', 'services':['http', 'ssh', 'dns', 'imap', 'pop', 'smtp', 'ftp', 'mssql', 'mysql', 'https'] }, { 'username':'nic', 'password':'toor', 'services':['http', 'ssh', 'dns', 'imap', 'pop', 'smtp'] }, { 'username':'Administrator', 'password':'P@ssword1', 'services':['ldap', 'smb'] }, ] # Team Config TEAMS = [ { 'name': 'Team 1', 'subnet': '192.168.1.0', 'netmask': '255.255.255.0' }, { 'name': 'Team 2', 'subnet': '192.168.2.0', 'netmask': '255.255.255.0' }, ]
domain = 'TEAM' http_pages = [{'url': '', 'expected': 'index.html', 'tolerance': 0.05}] https_pages = [{'url': '', 'expected': 'index.html', 'tolerance': 0.05}] dns_queries = [{'type': 'A', 'query': 'team.local', 'expected': '216.239.32.10'}] ftp_files = [{'path': '/testfile.txt', 'checksum': '12345ABCDEF'}] smb_files = [{'sharename': 'ftproot', 'path': '/index.html', 'checksum': '83e503650ffd301b55538ea896afbcedea0c79c2'}] mssql_queries = [{'db': 'employee_data', 'query': "SELECT SSN FROM dbo.hr_info WHERE LastName LIKE 'Erikson'", 'response': '122751924'}] mysql_queries = [{'db': 'mysql', 'query': "SELECT password FROM user WHERE user='root' AND host='localhost'", 'response': '*9CFBBC772F3F6C106020035386DA5BBBF1249A11'}] smtp_addresses = ['[email protected]', '[email protected]'] ldap_queries = [{'dn': '%[email protected]', 'base': 'cn=users,dc=team,dc=vnet', 'filter': '(&(objectClass=*)(cn=Administrator))', 'attributes': ['sAMAccountName'], 'expected': {'sAMAccountName': ['Administrator']}}] services = [{'name': 'http', 'subnet_host': '152', 'port': 80, 'plugin': 'http'}, {'name': 'ssh', 'subnet_host': '152', 'port': 22, 'plugin': 'ssh'}, {'name': 'dns', 'subnet_host': '152', 'port': 53, 'plugin': 'dns'}, {'name': 'imap', 'subnet_host': '152', 'port': 143, 'plugin': 'imap'}, {'name': 'pop', 'subnet_host': '152', 'port': 110, 'plugin': 'pop'}, {'name': 'smtp', 'subnet_host': '152', 'port': 25, 'plugin': 'smtp'}, {'name': 'ldap', 'subnet_host': '134', 'port': 389, 'plugin': 'ldap'}, {'name': 'ftp', 'subnet_host': '152', 'port': 21, 'plugin': 'ftp'}, {'name': 'mssql', 'subnet_host': '152', 'port': 3308, 'plugin': 'mssql'}, {'name': 'mysql', 'subnet_host': '152', 'port': 3309, 'plugin': 'mysql'}, {'name': 'https', 'subnet_host': '152', 'port': 443, 'plugin': 'https'}, {'name': 'smb', 'subnet_host': '134', 'port': 139, 'plugin': 'smb'}] default_creds = [{'username': 'joe', 'password': 'toor', 'services': ['http', 'ssh', 'dns', 'imap', 'pop', 'smtp', 'ftp', 'mssql', 'mysql', 'https']}, {'username': 'nic', 'password': 'toor', 'services': ['http', 'ssh', 'dns', 'imap', 'pop', 'smtp']}, {'username': 'Administrator', 'password': 'P@ssword1', 'services': ['ldap', 'smb']}] teams = [{'name': 'Team 1', 'subnet': '192.168.1.0', 'netmask': '255.255.255.0'}, {'name': 'Team 2', 'subnet': '192.168.2.0', 'netmask': '255.255.255.0'}]
class FakeTwilioMessage(object): status = 'sent' def __init__(self, price, num_segments=1): self.price = price self.num_segments = str(num_segments) def fetch(self): return self class FakeMessageFactory(object): backend_message_id_to_num_segments = {} backend_message_id_to_price = {} @classmethod def add_price_for_message(cls, backend_message_id, price): cls.backend_message_id_to_price[backend_message_id] = price @classmethod def get_price_for_message(cls, backend_message_id): return cls.backend_message_id_to_price.get(backend_message_id) @classmethod def add_num_segments_for_message(cls, backend_message_id, num_segments): cls.backend_message_id_to_num_segments[backend_message_id] = num_segments @classmethod def get_num_segments_for_message(cls, backend_message_id): return cls.backend_message_id_to_num_segments.get(backend_message_id) or 1 @classmethod def get_twilio_message(cls, backend_message_id): return FakeTwilioMessage( cls.get_price_for_message(backend_message_id) * -1, num_segments=cls.get_num_segments_for_message(backend_message_id), ) @classmethod def get_infobip_message(cls, backend_message_id): return { 'messageCount': cls.get_num_segments_for_message(backend_message_id), 'status': { 'name': 'sent' }, 'price': { 'pricePerMessage': cls.get_price_for_message(backend_message_id) } }
class Faketwiliomessage(object): status = 'sent' def __init__(self, price, num_segments=1): self.price = price self.num_segments = str(num_segments) def fetch(self): return self class Fakemessagefactory(object): backend_message_id_to_num_segments = {} backend_message_id_to_price = {} @classmethod def add_price_for_message(cls, backend_message_id, price): cls.backend_message_id_to_price[backend_message_id] = price @classmethod def get_price_for_message(cls, backend_message_id): return cls.backend_message_id_to_price.get(backend_message_id) @classmethod def add_num_segments_for_message(cls, backend_message_id, num_segments): cls.backend_message_id_to_num_segments[backend_message_id] = num_segments @classmethod def get_num_segments_for_message(cls, backend_message_id): return cls.backend_message_id_to_num_segments.get(backend_message_id) or 1 @classmethod def get_twilio_message(cls, backend_message_id): return fake_twilio_message(cls.get_price_for_message(backend_message_id) * -1, num_segments=cls.get_num_segments_for_message(backend_message_id)) @classmethod def get_infobip_message(cls, backend_message_id): return {'messageCount': cls.get_num_segments_for_message(backend_message_id), 'status': {'name': 'sent'}, 'price': {'pricePerMessage': cls.get_price_for_message(backend_message_id)}}
class ValueNotRequired(Exception): pass class RaggedListError(Exception): pass
class Valuenotrequired(Exception): pass class Raggedlisterror(Exception): pass
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"AttStats": "att_stats.ipynb", "Attribute": "attribute.ipynb", "Data": "data.ipynb", "DataScrambler": "data_scrambler.ipynb", "configuration": "data_scrambler.ipynb", "EntropyEvaluator": "entropy_evaluator.ipynb", "Instance": "instance.ipynb", "ParseException": "parse_exception.ipynb", "Reading": "reading.ipynb", "ToHMLDemo": "to_HML_demo.ipynb", "Tree": "tree.ipynb", "Condition": "tree.ipynb", "TreeEdge": "tree_edge.ipynb", "TreeEvaluator": "tree_evaluator.ipynb", "BenchmarkResult": "tree_evaluator.ipynb", "Prediction": "tree_evaluator.ipynb", "Stats": "tree_evaluator.ipynb", "TreeNode": "tree_node.ipynb", "UId3": "uId3.ipynb", "UncertainEntropyEvaluator": "uncertain_entropy_evaluator.ipynb", "Value": "value.ipynb"} modules = ["att_stats.py", "attribute.py", "data.py", "data_scrambler.py", "entropy_evaluator.py", "instance.py", "parse_exception.py", "reading.py", "to_hml_demo.py", "tree.py", "tree_edge.py", "tree_evaluator.py", "tree_node.py", "uid3.py", "uncertain_entropy_evaluator.py", "value.py"] doc_url = "https://anetakaczynska.github.io/uid3/" git_url = "https://github.com/anetakaczynska/uid3/tree/master/" def custom_doc_links(name): return None
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'AttStats': 'att_stats.ipynb', 'Attribute': 'attribute.ipynb', 'Data': 'data.ipynb', 'DataScrambler': 'data_scrambler.ipynb', 'configuration': 'data_scrambler.ipynb', 'EntropyEvaluator': 'entropy_evaluator.ipynb', 'Instance': 'instance.ipynb', 'ParseException': 'parse_exception.ipynb', 'Reading': 'reading.ipynb', 'ToHMLDemo': 'to_HML_demo.ipynb', 'Tree': 'tree.ipynb', 'Condition': 'tree.ipynb', 'TreeEdge': 'tree_edge.ipynb', 'TreeEvaluator': 'tree_evaluator.ipynb', 'BenchmarkResult': 'tree_evaluator.ipynb', 'Prediction': 'tree_evaluator.ipynb', 'Stats': 'tree_evaluator.ipynb', 'TreeNode': 'tree_node.ipynb', 'UId3': 'uId3.ipynb', 'UncertainEntropyEvaluator': 'uncertain_entropy_evaluator.ipynb', 'Value': 'value.ipynb'} modules = ['att_stats.py', 'attribute.py', 'data.py', 'data_scrambler.py', 'entropy_evaluator.py', 'instance.py', 'parse_exception.py', 'reading.py', 'to_hml_demo.py', 'tree.py', 'tree_edge.py', 'tree_evaluator.py', 'tree_node.py', 'uid3.py', 'uncertain_entropy_evaluator.py', 'value.py'] doc_url = 'https://anetakaczynska.github.io/uid3/' git_url = 'https://github.com/anetakaczynska/uid3/tree/master/' def custom_doc_links(name): return None
# -*- coding: utf-8 -*- """ __title__ = '' __author__ = xiongliff __mtime__ = '2019/7/20' """
""" __title__ = '' __author__ = xiongliff __mtime__ = '2019/7/20' """