content
stringlengths 7
1.05M
|
|---|
"""
Use the Eratoshenes Algorithm to generate first 1229 prime numbers.
"""
max = 10000
smax = 100 # sqrt(10000)
lst = [] # number list, all True (is prime) at first
for i in range(max + 1): # initialization
lst.append(True)
for i in range(2, smax + 1): # Eratoshenes Algorithm
sieve = 2 * i
while sieve <= max:
lst[sieve] = False
sieve += i
for i in range(2, max + 1): # output in a line
if lst[i] == True:
print(i, end=',')
|
#Votes
Voter0 = int(input("Vote:"))
Voter1 = int(input("Vote:"))
Voter2 = int(input("Vote:"))
#Count
def count_votes():
#Accounts
voter0_account = 0
voter1_account = 0
voter2_account = 0
#Total
total = Voter0 + Voter1 + Voter2
#Return
if total > 1:
voter2_account =+ 1
print(voter2_account)
else:
print(voter2_account)
count_votes()
|
# EXERCÍCIO 22
# Crie um programa que leia o nome completo de uma pessoa e mostre:
# O nome com todas as letras maiúsculas e minúsculas.
# Quantas letras ao todo (sem considerar espaços).
# Quantas letras tem o primeiro nome.
#strip - remove espaços desnecessários
nome = str(input('Digite o seu nome completo: ')).strip()
pnome = nome.split()
print('Nome completo: {}'.format(nome).title())
print('Nome nome em maiúsculo é: {}'.format(nome.upper()))
print('Nome nome em minúsculo é: {}'.format(nome.lower()))
print('Seu nome completo possui {} letras'.format(len(nome) - nome.count(' ')))
print('Seu primeiro nome é {} e possui {} letras'.format(pnome[0].upper(), len(pnome[0])))
|
otra_coordenada=(0, 1)
new=otra_coordenada.x
print(new)
|
#!/usr/bin/env python
# coding: utf-8
# Given two arrays, write a function to compute their intersection.
#
# Example 1:
#
# Input: nums1 = [1,2,2,1], nums2 = [2,2]
# Output: [2]
# Example 2:
#
# Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4]
# Output: [9,4]
# In[1]:
def intersection(nums1, nums2):
return list(set(nums1) & set(nums2))
print(intersection([4,9,5],[9,4,9,8,4]))
# In[2]:
def intersection(nums1, nums2):
stack =[]
for i in nums1:
if i not in stack and i in nums2:
stack.append(i)
return stack
print(intersection([4,9,5],[9,4,9,8,4]))
# In[ ]:
|
s = 0
for c in range(0, 6):
n = int(input('Digite numero inteiro: '))
if n%2==0:
s += n
print(f'A soma dos valores par e {s}')
|
# Unique Binary Search Trees II
# https://www.interviewbit.com/problems/unique-binary-search-trees-ii/
#
# Given A, how many structurally unique BST’s (binary search trees) that store values 1...A?
#
# Example :
#
# Given A = 3, there are a total of 5 unique BST’s.
#
#
# 1 3 3 2 1
# \ / / / \ \
# 3 2 1 1 3 2
# / / \ \
# 2 1 2 3
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class Solution:
def _numTrees(self, A, dp={}):
if A == 1:
return 1
if A not in dp:
s = 0
for i in range(1, A):
s += self._numTrees(i) * self._numTrees(A - i)
dp[A] = s
return dp[A]
# @param A : integer
# @return an integer
def numTrees(self, A):
return self._numTrees(A + 1)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
C=float(input('Informe a temperatura em ºC:'))
F=C*1.8+32
#print('A temperatura de {}ºC corresponde a {}ºF!'.format(C,C*1.8+32))
print('A temperatura de {}ºC corresponde a {}ºF!'.format(C,F))
|
#stringCaps.py
msg = "john nash"
print(msg)
# ALL CAPS
msg_upper = msg.upper()
print(msg_upper)
# First Letter Of Each Word Capitalized
msg_title = msg.title()
print(msg_title)
|
def create_500M_file(name):
native.genrule(
name = name + "_target",
outs = [name],
output_to_bindir = 1,
cmd = "truncate -s 500M $@",
)
|
hotels = pois[pois['fclass']=='hotel']
citylondon = boroughs.loc[boroughs['name'] == 'City of London', 'geometry'].squeeze()
cityhotels = hotels[hotels.within(citylondon)]
[fig,ax] = plt.subplots(1, figsize=(12, 8))
base = boroughs.plot(color='lightblue', edgecolor='black',ax=ax);
cityhotels.plot(ax=ax, marker='o', color='red', markersize=8);
ax.axis('off');
|
class Config:
PROXY_WEBPAGE = "https://free-proxy-list.net/"
TESTING_URL = "https://google.com"
REDIS_CONFIG = {
"host": "redis",
"port": "6379",
"db": 0
}
REDIS_KEY = "proxies"
MAX_WORKERS = 50
NUMBER_OF_PROXIES = 50
RSS_FEEDS = {
"en": [
"https://www.goal.com/feeds/en/news",
"https://www.eyefootball.com/football_news.xml",
"https://www.101greatgoals.com/feed/",
"https://sportslens.com/feed/",
"https://deadspin.com/rss"
],
"pl": [
"https://weszlo.com/feed/",
"https://sportowefakty.wp.pl/rss.xml",
"https://futbolnews.pl/feed",
"https://igol.pl/feed/"
],
"es": [
"https://as.com/rss/tags/ultimas_noticias.xml",
"https://e00-marca.uecdn.es/rss/futbol/mas-futbol.xml",
"https://www.futbolred.com/rss-news/liga-de-espana.xml",
"https://www.futbolya.com/rss/noticias.xml"
],
"de": [
"https://www.spox.com/pub/rss/sport-media.xml",
"https://www.dfb.de/news/rss/feed/"
]
}
BOOTSTRAP_SERVERS = ["kafka:9092"]
TOPIC = "rss_news"
VALIDATOR_CONFIG = {
"description_length": 10,
"languages": [
"en", "pl", "es", "de"
]
}
REFERENCE_RATES = {
"secured": ["https://markets.newyorkfed.org/api/rates/secured/all/latest.xml"],
"unsecured": ["https://markets.newyorkfed.org/api/rates/unsecured/all/latest.xml"]
}
|
# This file describes some constants which stay the same in every testing environment
# Total number of fish
N_FISH = 70
# Total number of fish species
N_SPECIES = 7
# Total number of time steps per environment
N_STEPS = 180
# Number of possible emissions, i.e. fish movements
# (all emissions are represented with integers from 0 to this constant (exclusive))
N_EMISSIONS = 8
# Time limit per each guess (in seconds)
# You can change this value locally, but it will be fixed to 5 on Kattis
STEP_TIME_THRESHOLD = 5
|
somaidade = 0
maioridadehomen = 0
nomevelho = ''
totmulher20 = 0
for c in range(0, 4):
print('---- {}ª Pessoa -----'.format(c+1))
nome = str(input('Nome: ')).strip()
idade = int(input('Idade: '))
sexo = str(input('Sexo [M/F]: ')).strip()
somaidade += idade
if c == 1 and sexo in 'Mm':
maioridadehomen = idade
nomevelho = nome
if sexo in 'Mm' and idade > maioridadehomen:
maioridadehomen = idade
nomevelho = nome
if sexo in 'Ff' and idade < 20:
totmulher20 += 1
médiaidade = somaidade / 4
print('A média de idade do grupo é de {:.0f} anos.'.format(médiaidade))
print('A idade do homem mais velho é {} e ele se chama {}.'.format(maioridadehomen,nomevelho))
print('Existem {} mulheres com menos de 20 anos.'.format(totmulher20))
|
class Pessoa:
olhos = 2
def __init__(self,*filhos, nome = None, idade = 35):
self.idade = idade
self.nome = nome
self.filhos = list(filhos)
def cumprimentar(self):
return 'Olá mundo!'
if __name__ == '__main__':
marcio = Pessoa(nome='Marcio')
max = Pessoa(marcio, nome='Max')
print(max.cumprimentar())
print(max.nome)
print(max.idade)
for filho in max.filhos:
print(filho.nome)
max.sobrenome = 'Maia'
print(max.sobrenome)
del max.filhos
marcio.olhos = 1
del marcio.olhos
print(max.__dict__)
print(marcio.__dict__)
Pessoa.olhos = 3
print(Pessoa.olhos)
print(max.olhos)
print(marcio.olhos)
|
def print_idp(file_name: str, vocabulary_strings: list, theory_strings: list, structure_strings: list) -> None:
"""Takes all contents of vocab and theory as list of strings and prints it as IDP code in file_name
:param file_name: Name of output file
:param vocabulary_strings: list of strings, with every string denoting one line in the vocabulary
:param theory_strings: list of strings, with every string denoting one line in the theory
:param structure_strings: list of strings, with every string denoting one line in the structure
"""
# Header
# TODO make header for transformed files?
# start with vocab
lines = ['vocabulary V{']
lines.extend(__indent(vocabulary_strings))
# end vocab and start theory
lines.extend(['}', '\n', 'theory T:V {'])
lines.extend(__indent(theory_strings))
lines.append('}')
# Structure
lines.extend(['\n', 'structure S:V{'])
lines.extend(__indent(structure_strings))
lines.extend(['', '\t // INSERT INPUT HERE', '}'])
# main
lines.extend(['\n', 'procedure main(){', 'stdoptions.nbmodels=200', 'printmodels(modelexpand(T,S))', '}'])
with open(file_name, 'w') as text_file:
print('\n'.join(lines), file=text_file)
def __indent(text: list) -> list:
"""
Adds 1-tab indentation to a list of strings
:param text:
:return:
"""
indented = ['\t' + line for line in text]
return indented
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def insert_sort(inputlist):
"""
直接插入排序,升序
:param inputlist: a list of number
:return: the ascending list
"""
length = len(inputlist)
for x in range(1, length):
key = inputlist[x] # 要插入的数
i = x - 1
while i >= 0:
if inputlist[i] > key:
inputlist[i + 1]=inputlist[i]
else:
break
i -= 1
inputlist[i + 1] = key
return inputlist
def bubble_sort(inputlist):
"""
冒泡排序
:param inputlist: a list of number
:return: the ascending list
"""
length = len(inputlist)
for j in range(1, length):
for i in range(length-j):
if inputlist[i] > inputlist[i+1]:
inputlist[i], inputlist[i+1] = inputlist[i+1], inputlist[i]
return inputlist
def select_sort(inputlist):
"""
简单选择排序
:param inputlist: a list of number
:return: the ascending list
"""
length = len(inputlist)
for i in range(length):
minimum = i
for j in range(i, length):
if inputlist[j] < inputlist[minimum]:
minimum = j
inputlist[i], inputlist[minimum] = inputlist[minimum], inputlist[i]
return inputlist
def shell_sort(inputlist):
pass
return inputlist
def quick_sort(inputlist):
pass
return inputlist
# 堆排序
def heap_sort(inputlist):
def heap_rebuild(inputlist, index, length):
"""
堆排序
:param inputlist:
:param index:
:param length:
:return:
"""
lchild = index * 2 + 1
rchild = lchild + 1
if lchild < length:
heap_rebuild(inputlist, lchild, length)
if inputlist[lchild] > inputlist[index]:
inputlist[index], inputlist[lchild] = inputlist[lchild], inputlist[index]
if rchild < length:
heap_rebuild(inputlist, rchild, length)
if inputlist[rchild] > inputlist[index]:
inputlist[index], inputlist[rchild] = inputlist[rchild], inputlist[index]
length = len(inputlist)
# 重建完之后最大的元素在下标为0的位置
heap_rebuild(inputlist, 0, length)
while length > 0:
# inputlist[length-1]为末尾元素
length -= 1
# 交换到表尾
inputlist[0], inputlist[length] = inputlist[length], inputlist[0]
heap_rebuild(inputlist, 0, length)
return inputlist
L1 = [5, 9, 6]
heap_sort(L1)
print(L1)
|
"""
* Setup and Draw.
*
* The code inside the draw() function runs continuously
* from top to bottom until the program is stopped.
"""
y = 100
def setup():
"""
The statements in the setup() function
execute once when the program begins
"""
size(640, 360) # Size must be the first statement
stroke(255) # Set line drawing color to white
frameRate(30)
def draw():
"""
The statements in draw() are executed until the
program is stopped. Each statement is executed in
sequence and after the last line is read, the first
line is executed again.
"""
background(0) # Set the background to black
y = y - 1
if y < 0:
y = height
line(0, y, width, y)
|
{
"name": "Custom Apps",
"summary": """Simplify Apps Interface""",
"images": [],
"vesion": "12.0.1.0.0",
"application": False,
"author": "IT-Projects LLC, Dinar Gabbasov",
"support": "apps@itpp.dev",
"website": "https://twitter.com/gabbasov_dinar",
"category": "Access",
"license": "Other OSI approved licence", # MIT
"depends": ["access_apps"],
"data": ["views/apps_view.xml", "security.xml", "data/ir_config_parameter.xml"],
"post_load": None,
"pre_init_hook": None,
"post_init_hook": None,
"auto_install": False,
"installable": False,
}
|
class Solution:
def getLucky(self, s: str, k: int) -> int:
nums = ''
for char in s:
nums += str(ord(char) - ord('a') + 1)
for i in range(k):
nums = str(sum((int(c) for c in nums)))
return nums
|
#from sec.core.models import Meeting
"""
import datetime
class GeneralInfo(models.Model):
id = models.IntegerField(primary_key=True)
info_name = models.CharField(max_length=150, blank=True)
info_text = models.TextField(blank=True)
info_header = models.CharField(max_length=765, blank=True)
class Meta:
db_table = u'general_info'
class MeetingVenue(models.Model):
meeting_num = models.ForeignKey(Meeting, db_column='meeting_num', unique=True, editable=False)
break_area_name = models.CharField(max_length=255)
reg_area_name = models.CharField(max_length=255)
def __str__(self):
return "IETF %s" % (self.meeting_num_id)
class Meta:
db_table = 'meeting_venues'
verbose_name = "Meeting public areas"
verbose_name_plural = "Meeting public areas"
class NonSessionRef(models.Model):
name = models.CharField(max_length=255)
def __str__(self):
return self.name
class Meta:
db_table = 'non_session_ref'
verbose_name = "Non-session slot name"
class NonSession(models.Model):
non_session_id = models.AutoField(primary_key=True, editable=False)
day_id = models.IntegerField(blank=True, null=True, editable=False)
non_session_ref = models.ForeignKey(NonSessionRef, editable=False)
meeting = models.ForeignKey(Meeting, db_column='meeting_num', editable=False)
time_desc = models.CharField(blank=True, max_length=75, default='0')
show_break_location = models.BooleanField(editable=False, default=True)
def __str__(self):
if self.day_id != None:
return "%s %s %s @%s" % ((self.meeting.start_date + datetime.timedelta(self.day_id)).strftime('%A'), self.time_desc, self.non_session_ref, self.meeting_id)
else:
return "** %s %s @%s" % (self.time_desc, self.non_session_ref, self.meeting_id)
def day(self):
if self.day_id != None:
return (self.meeting.start_date + datetime.timedelta(self.day_id)).strftime('%A')
else:
return ""
class Meta:
db_table = 'non_session'
verbose_name = "Meeting non-session slot"
"""
|
keys = ['red', 'green', 'blue']
values = ['#FF0000','#008000', '#0000FF']
color_dictionary = dict(zip(keys, values))
print(color_dictionary)
|
#!/bin/python
# list
lauguage = 'Python'
lst = list(lauguage)
print(type(lst))
print(lst)
print("-------------------------------")
# [i for i in iterable if expression]
lst = [i for i in lauguage]
print(type(lst))
print(lst)
print("-------------------------------")
add_two_nums = lambda a, b: a + b
print(add_two_nums(2, 3))
|
class Local(object):
__slots__ = ("__storage__", "__ident_func__")
def __init__(self):
object.__setattr__(self, "__storage__", {})
object.__setattr__(self, "__ident_func__", get_ident)
def __iter__(self):
return iter(self.__storage__.items())
def __call__(self, proxy):
"""Create a proxy for a name."""
return LocalProxy(self, proxy)
def __release_local__(self):
self.__storage__.pop(self.__ident_func__(), None)
def __getattr__(self, name):
try:
return self.__storage__[self.__ident_func__()][name]
except KeyError:
raise AttributeError(name)
def __setattr__(self, name, value):
ident = self.__ident_func__()
storage = self.__storage__
try:
storage[ident][name] = value
except KeyError:
storage[ident] = {name: value}
def __delattr__(self, name):
try:
del self.__storage__[self.__ident_func__()][name]
except KeyError:
raise AttributeError(name)
|
"""
Module: 'json' on esp32_LoBo
MCU: (sysname='esp32_LoBo', nodename='esp32_LoBo', release='3.2.24', version='ESP32_LoBo_v3.2.24 on 2018-09-06', machine='ESP32 board with ESP32')
Stubber: 1.0.0
"""
def dump():
pass
def dumps():
pass
def load():
pass
def loads():
pass
|
def time2sec(timestr):
"""
Conver time specs to seconds
"""
if timestr[-1] == "s":
return int(timestr[0:-1])
elif timestr[-1] == "m":
return int(timestr[0:-1]) * 60
elif timestr[-1] == "h":
return int(timestr[0:-1]) * 60 * 60
else:
return int(timestr)
|
nome = input('\nInsira seu nome: \n')
if 'SILVA' in nome.upper():
print('O seu nome tem SILAVA\n')
else:
print('Você não faz parte da família SILVA\n')
|
SERIAL_DEVICE = '/dev/ttyAMA0'
SERIAL_SPEED = 115200
CALIBRATION_FILE = '/home/pi/stephmeter/calibration.json'
TIMEOUT = 300 # 5 minutes
MQTT_SERVER = '192.168.1.2'
MQTT_PORT = 1883
MQTT_TOPIC_PWM = 'traccar/eta'
MQTT_TOPIC_LED = 'traccar/led'
|
def example():
print('basic function')
z=3+9
print(z)
#Function with parameter
def add(a,b):
c=a+b
print('the result is',c)
add(5,3)
add(a=3,b=5)
#Function with default parameters
def add_new(a,b=6):
print(a,b)
add_new(2)
def basic_window(width,height,font='TNR',bgc='w',scrollbar=True):
print(width,height,font,bgc)
basic_window(500,350,bgc='a')
|
class Test:
"""
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
deserunt mollit anim id est laborum.
.. sourcecode:: pycon
>>> # extract 100 LDA topics, using default parameters
>>> lda = LdaModel(corpus=mm, id2word=id2word, num_topics=100, distributed=True)
using distributed version with 4 workers
running online LDA training, 100 topics, 1 passes over the supplied corpus of 3199665 documets,
updating model once every 40000 documents
..
Some another text
"""
some_field = 1
|
# This program will compute the factorial of any number given by user
# until user enter some negative values.
n = int(input("please input a number: "))
# the loop for getting user inputs
while n >= 0:
# initializing
fact = 1
# calculating the factorial
for i in range(1, n+1):
fact *= i
# fact = fact * i
print("%d ! = %d"%(n,fact))
n = int(input("please input a number: "))
|
class Lang_EN:
LabelFrame = "Controls"
runBt = "Show result"
fileBtn = "Load image"
dropLab = "Choose mask"
maskSlider = "Size of the mask"
# options = {"Low pass Round": self.LPround(), "High pass Round": self.LPround(), "Low pass square": self.LPround(),
# "High pass square": self.LPround(), "Gauss LP": self.LPround(),
# "Gauss HP": self.LPround(), "Butterworth LP": self.LPround(), "Butterworth HP": self.LPround(),
# "Middle square LP": self.LPround(), "Middle square HP": self.LPround(), "Middle ring LP": self.LPround(),
# "Middle ring HP": self.LPround()}
test1 = "Lowpass Round"
test2 = "Highpass Round"
test3 = "Lowpass square"
test4 = "Highpass square"
test5 = "Gauss LP"
test6 = "Gauss HP"
test7 = "Butterworth LP"
test8 = "Butterworth HP"
test9 = "Middle square LP"
test10 = "Middle square HP"
test11 = "Middle ring LP"
test12 = "Middle ring HP"
orgplot = "Original image"
ampl = "Spectrum"
angle = "Angle"
filtr = "Filter"
result = "Filtered image"
exit = "Close program"
maskwidthLab = "Width of the mask"
class Lang_PL:
LabelFrame = "Przyciski kontrolne"
runBt = "Pokaż wynik"
fileBtn = "Wczytaj obraz"
dropLab = "Wybór maski"
maskSlider = "Rozmiar maski"
# options = ("Dolnoprzepustowa Okrągła", "Górnoprzepustowa Okrągła", "Dolnoprzepustowa Kwadratowa",
# "Górnoprzepustowa Kwadratowa", "Gaussian LP",
# "Gaussian HP", "Butterworth LP", "Butterworth HP",
# "Środkowo-p kwadrat LP", "Środkowo-p kwadrat HP", "Środkowo-p pierścień LP",
# "Środkowo-p pierścień HP")
test1 = "Dolnoprzepustowa Okrągła"
test2 = "Górnoprzepustowa Okrągła"
test3 = "Dolnoprzepustowa Kwadratowa"
test4 = "Górnoprzepustowa Kwadratowa"
test5 = "Gaussian LP"
test6 = "Gaussian HP"
test7 = "Butterworth LP"
test8 = "Butterworth HP"
test9 = "Środkowo-p kwadrat LP"
test10 = "Środkowo-p kwadrat HP"
test11 = "Środkowo-p pierścień LP"
test12 = "Środkowo-p pierścień HP"
orgplot = "Oryginalny obraz"
ampl = "Amplituda"
angle = "Faza"
filtr = "Filtr"
result = "Obraz po przekształceniach"
exit = "Zamknij program"
maskwidthLab = "Szerokość maski"
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
KanjiVG stub
"""
class KanjiVG:
pass
|
class GroupDirectoryError(Exception):
pass
class NoSuchRoleIdError(GroupDirectoryError):
def __init__(self, *args, role_id, **kwargs):
super().__init__(*args, **kwargs)
self.role_id = role_id
class NoSuchRoleNameError(GroupDirectoryError):
def __init__(self, *args, role_name, **kwargs):
super().__init__(*args, **kwargs)
self.role_name = role_name
class GroupDirectoryGroupError(GroupDirectoryError):
def __init__(self, *args, group, **kwargs):
super().__init__(*args, **kwargs)
self.group = group
class NoSuchGroupError(GroupDirectoryGroupError):
pass
class GroupAlreadyExistsError(GroupDirectoryGroupError):
pass
|
def test():
assert (
"patterns = list(nlp.pipe(people))" in __solution__
), "Você está usando nlp.pipe envolvido em uma lista (list)?"
__msg__.good(
"Bom trabalho! Vamos seguir agora com um exemplo prático que "
"usa nlp.pipe para processar documentos com metadados adicionais."
)
|
consultation_mention = [
"rendez-vous pris",
r"consultation",
r"consultation.{1,8}examen",
"examen clinique",
r"de compte rendu",
r"date de l'examen",
r"examen realise le",
"date de la visite",
]
town_mention = [
"paris",
"kremlin.bicetre",
"creteil",
"boulogne.billancourt",
"villejuif",
"clamart",
"bobigny",
"clichy",
"ivry.sur.seine",
"issy.les.moulineaux",
"draveil",
"limeil",
"champcueil",
"roche.guyon",
"bondy",
"colombes",
"hendaye",
"herck.sur.mer",
"labruyere",
"garches",
"sevran",
"hyeres",
]
document_date_mention = [
"imprime le",
r"signe electroniquement",
"signe le",
"saisi le",
"dicte le",
"tape le",
"date de reference",
r"date\s*:",
"dactylographie le",
"date du rapport",
]
|
class Solution:
def myPow(self, x: float, n: int) -> float:
memo = {}
def power(x,n):
if n in memo:return memo[n]
if n==0: return 1
elif n==1:return x
elif n < 0:
memo[n] = power(1/x,-n)
return memo[n]
elif n%2==0:
memo[n] = power(x*x,n//2)
return memo[n]
else:
memo[n] = x * power(x*x,(n-1)//2)
return memo[n]
return power(x,n)
|
def sum_Natural(n):
if n == 0:
return 0
else:
return sum_Natural(n - 1) + n
n = int(input())
result = sum_Natural(n)
print(f"Sum of first {n} natural numbers -> {result}")
|
class Ultrapassagem(object):
"""
Métodos para resolução de tópicos de física: Ultrapassagem
Obs: Utilize parâmetros nomeados
"""
ERROR = "Argumentos invalidos, verifique a documentação do método."
@classmethod
def velocidade_relativa(cls, V1: float=None, V2: float=None, sentidos_opostos: bool=False) -> float:
"""
Velocidade de ultrapassagem relativa depende do sentido de
ultrapassagem, se o tiver o mesmo sentido que no caso é o padrão,
(sentido_contrario=False) vai subtrair as velocidade, caso contrario
irá somar.
:param V1: Velocidade do objeto ultrapassando
:param V2: Velocidade do objeto ultrapassado
:param sentidos_opostos: Sentido da ultrapassagem, False se for no mesmo sentido (padrão) e True em
sentidos contrarios
:return: Velocidade Relativa (Vr)
"""
if V1 is None or V2 is None:
raise Exception(cls.ERROR)
if sentidos_opostos:
Vr = V1 + V2
else:
Vr = V1 - V2
return Vr
@classmethod
def velocidade_de_ultrapassagem(cls, DS :float=None, DT :float=None) -> float:
"""
Velocidade de ultrapassagem (Vu)
:param DS: Comprimento dos corpos
:param DT: Intervalo de duração da ultrapassagem
:return: Velocidade de ultrapassagem (Vu)
"""
if DS is None or DT is None:
raise Exception(cls.ERROR)
Vu = DS/DT
return Vu
@classmethod
def comprimento_dos_corpos(cls, Vu :float=None, DT :float=None) -> float:
"""
Comprimento do corpo (DS) ultrapassado
:param Vu: Velocidade de ultrapassagem
:param DT: Intervalo de duração da ultrapassagem
:return: Comprimento do corpo ultrapassado (DS)
"""
if Vu is None or DT is None:
raise Exception(cls.ERROR)
DS = Vu * DT
return DS
@classmethod
def tempo_de_ultrapassagem(cls, DS :float=None, Vu :float=None) -> float:
"""
Intervalo de duração da ultrapassagem (DT)
:param DS: Comprimento dos corpos
:param Vu: Velocidade de ultrapassagem
:return: Intervalo de duração da ultrapassagem (DT)
"""
if DS is None or Vu is None:
raise Exception(cls.ERROR)
DT = DS/Vu
return DT
|
config = {
'cf_template_description': 'This template is generated with python'
'using troposphere framework to create'
'dynamic Cloudfront templates with'
'different vars according to the'
'PYTHON_ENV environment variable for'
'ECS fargate.',
'project_name': 'demo-ecs-fargate',
'network_stack_name': 'ansible-demo-network'
}
|
outputdir = "/map"
rendermode = "smooth_lighting"
world_name = "MCServer"
worlds[world_name] = "/data/world"
renders["North"] = {
'world': world_name,
'title': 'North',
'dimension': "overworld",
'rendermode': rendermode,
'northdirection': 'upper-left'
}
renders["East"] = {
'world': world_name,
'title': 'East',
'dimension': "overworld",
'rendermode': rendermode,
'northdirection': 'upper-right'
}
renders["South"] = {
'world': world_name,
'title': 'South',
'dimension': "overworld",
'rendermode': rendermode,
'northdirection': 'lower-right'
}
renders["West"] = {
'world': world_name,
'title': 'West',
'dimension': "overworld",
'rendermode': rendermode,
'northdirection': 'lower-left'
}
renders["Nether-North"] = {
'world': world_name,
'title': 'Nether-North',
'dimension': 'nether',
'rendermode': 'nether_smooth_lighting',
'northdirection': 'upper-left'
}
renders["Nether-South"] = {
'world': world_name,
'title': 'Nether-South',
'dimension': 'nether',
'rendermode': 'nether_smooth_lighting',
'northdirection': 'lower-right'
}
renders["End-North"] = {
'world': world_name,
'title': 'End-North',
'dimension': 'end',
'rendermode': 'smooth_lighting',
'northdirection': 'upper-left'
}
renders["End-South"] = {
'world': world_name,
'title': 'End-South',
'dimension': 'end',
'rendermode': 'smooth_lighting',
'northdirection': 'lower-right'
}
renders["Caves-North"] = {
'world': world_name,
'title': 'Caves-North',
'dimension': "overworld",
'rendermode': 'cave',
'northdirection': 'upper-left'
}
renders["Caves-South"] = {
'world': world_name,
'title': 'Caves-South',
'dimension': "overworld",
'rendermode': 'cave',
'northdirection': 'lower-right'
}
|
def load(filename):
lines = [s.strip() for s in open(filename,'r').readlines()]
time = int(lines[0])
busses = [int(value) for value in lines[1].split(",") if value != "x"]
return time,busses
t,busses = load("input")
print(f"Tiempo buscado {t}");
print(busses)
for i in range(t,t+1000):
for bus in busses:
if (i % bus) == 0:
print(f"Hemos encontrado {i} el bus {bus})")
print(f"Resultado: {(i - t) * bus}")
exit(0)
|
ALL = 'All servers'
def caller_check(servers = ALL):
def func_wrapper(func):
# TODO: To be implemented. Could get current_app and check it. Useful for anything?
return func
return func_wrapper
|
def max_sub_array(nums):
""" Returns the max subarray of the given list of numbers.
Returns 0 if nums is None or an empty list.
Time Complexity: O(n)
Space Complexity: O(1)
"""
if nums == None:
return 0
if len(nums) == 0:
return 0
dp = [0 for i in range(len(nums))]
dp[0] = nums[0]
for i in range(1,len(nums)):
dp[i] = max(dp[i-1]+nums[i],nums[i])
#print(dp)
return max(dp)
|
print('Conversor de números\n')
while True:
n = input('Digite um número inteiro: ')
if n.isnumeric():
print('Escolha uma opção para conversão: \n[1] para binário \n[2] para octal \n[3] para hexadeximal')
break
else:
print('Digite uma opção válida!')
while True:
o = input('Digite uma opção para conversão: ')
if o.isnumeric():
o = int(o)
n = int(n)
if o == 1:
nb = str(bin(n))
nb = nb[2:]
print(f'O número {n} em binário é: {nb}')
break
elif o == 2:
no = str(oct(n))
no = no[2:]
print(f'O número {n} em octal é: {no}')
break
elif o == 3:
nh = str(hex(n))
nh = nh[2:]
print(f'O número {n} em hexadecimal é: {nh}')
break
else:
print('Escolha uma opção válida: \n[1] para binário \n[2] para octal \n[3] para hexadeximal')
else:
print('Escolha uma opção válida: \n[1] para binário \n[2] para octal \n[3] para hexadeximal')
|
#Programming I
#######################
# Mission 5.1 #
# Vitality Points #
#######################
#Background
#==========
#To encourage their customers to exercise more, insurance companies are giving
#vouchers for the distances that customers had clocked in a week as follows:
######################################################
# Distance (km) # Gift #
######################################################
# Less than 25 # $2 Popular eVoucher #
# 25 <= distance < 50 # $5 Cold Storage eVoucher #
# 50 <= distance < 75 # $10 Starbucks eVoucher #
# More than 75 # $20 Subway eVoucher #
######################################################
#Write a Python program to check and display the gift that customer will recieve.
#The program is to prompt user for the total distance he had travelled (by walking or running)
#in a week and check which gift he will get and display the information to him.
#The return value of the function is the eVoucher value (e.g., 2 for the Popular eVoucher)
#Important Notes
#===============
#1) Comment out ALL input prompts before submitting.
#2) You MUST use the following variables
# - distance
# - gift
# - value
#START CODING FROM HERE
#======================
#Prompt user for the total distance travelled (either by walking or running).
#Check gifts to be given to customer
def check_gift(distance):
#Check gift to be given
if distance < 25:
value = 2
elif distance < 50:
value = 5
elif distance < 75:
value = 10
else:
value = 20
print(str(value) + ' eVoucher') #Modify to display gift to be given
return value #Do not remove this line
#Do not remove the next line
check_gift(distance)
#input 10 output 2
#input 25 output 5
#input 50 output 10
#input 76 output 20
|
def resumo(num, aument=0, descont=0):
print('=' * 41)
print(f'{"Resumo do valor":^41}')
print('=' * 41)
print(f'Preço Analisado: \t{moeda(num):>20}')
print(f'Dobro do preço: \t{dobro(num, True):>20}')
print(f'Metade do preço: \t{metade(num, True):>20}')
print(f'{aument}% de aumento: \t{aumento(num, aument, True):>20}')
print(f'{descont}% de desconto: \t{desconto(num, descont, True):>20}')
def metade(num, formato=False):
resp = num / 2
return resp if formato is False else moeda(resp)
def dobro(num, formato=False):
resp = num * 2
return resp if not formato else moeda(resp)
def aumento(num, tax, formato=False):
resp = num + (num * tax / 100)
return resp if formato is False else moeda(resp)
def desconto(num, tax, formato=False):
resp = num - (num * tax / 100)
return resp if formato is False else moeda(resp)
def moeda(num, cifrao='R$'):
return f'{cifrao}{num:>.2f}'.replace('.', ',')
|
#program to get all strobogrammatic numbers that are of length n.
def gen_strobogrammatic(n):
"""
:type n: int
:rtype: List[str]
"""
result = helper(n, n)
return result
def helper(n, length):
if n == 0:
return [""]
if n == 1:
return ["1", "0", "8"]
middles = helper(n-2, length)
result = []
for middle in middles:
if n != length:
result.append("0" + middle + "0")
result.append("8" + middle + "8")
result.append("1" + middle + "1")
result.append("9" + middle + "6")
result.append("6" + middle + "9")
return result
print("n = 2: \n",gen_strobogrammatic(2))
print("n = 3: \n",gen_strobogrammatic(3))
print("n = 4: \n",gen_strobogrammatic(4))
|
# Sage version information for Python scripts
# This file is auto-generated by the sage-update-version script, do not edit!
version = '9.6.beta5'
date = '2022-03-12'
banner = 'SageMath version 9.6.beta5, Release Date: 2022-03-12'
|
ls = list(input().split())
count = 0
for l in ls:
if l == 1:
count += 1
print(count)
|
def solve(n):
F = [1, 1]
while len(str(F[-1])) < n:
F.append(F[-1] + F[-2])
return len(F)
# n = 3
n = 1000
answer = solve(n)
print(answer)
|
def isunique(s):
for i in range(len(s)):
for j in range(len(s)):
if i != j:
if(s[i] == s[j]):
return False
return True
if __name__ == "__main__":
res = isunique("hsjdfhjdhjfk")
print(res)
|
uctable = [ [ 48 ],
[ 49 ],
[ 50 ],
[ 51 ],
[ 52 ],
[ 53 ],
[ 54 ],
[ 55 ],
[ 56 ],
[ 57 ],
[ 194, 178 ],
[ 194, 179 ],
[ 194, 185 ],
[ 194, 188 ],
[ 194, 189 ],
[ 194, 190 ],
[ 217, 160 ],
[ 217, 161 ],
[ 217, 162 ],
[ 217, 163 ],
[ 217, 164 ],
[ 217, 165 ],
[ 217, 166 ],
[ 217, 167 ],
[ 217, 168 ],
[ 217, 169 ],
[ 219, 176 ],
[ 219, 177 ],
[ 219, 178 ],
[ 219, 179 ],
[ 219, 180 ],
[ 219, 181 ],
[ 219, 182 ],
[ 219, 183 ],
[ 219, 184 ],
[ 219, 185 ],
[ 223, 128 ],
[ 223, 129 ],
[ 223, 130 ],
[ 223, 131 ],
[ 223, 132 ],
[ 223, 133 ],
[ 223, 134 ],
[ 223, 135 ],
[ 223, 136 ],
[ 223, 137 ],
[ 224, 165, 166 ],
[ 224, 165, 167 ],
[ 224, 165, 168 ],
[ 224, 165, 169 ],
[ 224, 165, 170 ],
[ 224, 165, 171 ],
[ 224, 165, 172 ],
[ 224, 165, 173 ],
[ 224, 165, 174 ],
[ 224, 165, 175 ],
[ 224, 167, 166 ],
[ 224, 167, 167 ],
[ 224, 167, 168 ],
[ 224, 167, 169 ],
[ 224, 167, 170 ],
[ 224, 167, 171 ],
[ 224, 167, 172 ],
[ 224, 167, 173 ],
[ 224, 167, 174 ],
[ 224, 167, 175 ],
[ 224, 167, 180 ],
[ 224, 167, 181 ],
[ 224, 167, 182 ],
[ 224, 167, 183 ],
[ 224, 167, 184 ],
[ 224, 167, 185 ],
[ 224, 169, 166 ],
[ 224, 169, 167 ],
[ 224, 169, 168 ],
[ 224, 169, 169 ],
[ 224, 169, 170 ],
[ 224, 169, 171 ],
[ 224, 169, 172 ],
[ 224, 169, 173 ],
[ 224, 169, 174 ],
[ 224, 169, 175 ],
[ 224, 171, 166 ],
[ 224, 171, 167 ],
[ 224, 171, 168 ],
[ 224, 171, 169 ],
[ 224, 171, 170 ],
[ 224, 171, 171 ],
[ 224, 171, 172 ],
[ 224, 171, 173 ],
[ 224, 171, 174 ],
[ 224, 171, 175 ],
[ 224, 173, 166 ],
[ 224, 173, 167 ],
[ 224, 173, 168 ],
[ 224, 173, 169 ],
[ 224, 173, 170 ],
[ 224, 173, 171 ],
[ 224, 173, 172 ],
[ 224, 173, 173 ],
[ 224, 173, 174 ],
[ 224, 173, 175 ],
[ 224, 173, 178 ],
[ 224, 173, 179 ],
[ 224, 173, 180 ],
[ 224, 173, 181 ],
[ 224, 173, 182 ],
[ 224, 173, 183 ],
[ 224, 175, 166 ],
[ 224, 175, 167 ],
[ 224, 175, 168 ],
[ 224, 175, 169 ],
[ 224, 175, 170 ],
[ 224, 175, 171 ],
[ 224, 175, 172 ],
[ 224, 175, 173 ],
[ 224, 175, 174 ],
[ 224, 175, 175 ],
[ 224, 175, 176 ],
[ 224, 175, 177 ],
[ 224, 175, 178 ],
[ 224, 177, 166 ],
[ 224, 177, 167 ],
[ 224, 177, 168 ],
[ 224, 177, 169 ],
[ 224, 177, 170 ],
[ 224, 177, 171 ],
[ 224, 177, 172 ],
[ 224, 177, 173 ],
[ 224, 177, 174 ],
[ 224, 177, 175 ],
[ 224, 177, 184 ],
[ 224, 177, 185 ],
[ 224, 177, 186 ],
[ 224, 177, 187 ],
[ 224, 177, 188 ],
[ 224, 177, 189 ],
[ 224, 177, 190 ],
[ 224, 179, 166 ],
[ 224, 179, 167 ],
[ 224, 179, 168 ],
[ 224, 179, 169 ],
[ 224, 179, 170 ],
[ 224, 179, 171 ],
[ 224, 179, 172 ],
[ 224, 179, 173 ],
[ 224, 179, 174 ],
[ 224, 179, 175 ],
[ 224, 181, 166 ],
[ 224, 181, 167 ],
[ 224, 181, 168 ],
[ 224, 181, 169 ],
[ 224, 181, 170 ],
[ 224, 181, 171 ],
[ 224, 181, 172 ],
[ 224, 181, 173 ],
[ 224, 181, 174 ],
[ 224, 181, 175 ],
[ 224, 181, 176 ],
[ 224, 181, 177 ],
[ 224, 181, 178 ],
[ 224, 181, 179 ],
[ 224, 181, 180 ],
[ 224, 181, 181 ],
[ 224, 183, 166 ],
[ 224, 183, 167 ],
[ 224, 183, 168 ],
[ 224, 183, 169 ],
[ 224, 183, 170 ],
[ 224, 183, 171 ],
[ 224, 183, 172 ],
[ 224, 183, 173 ],
[ 224, 183, 174 ],
[ 224, 183, 175 ],
[ 224, 185, 144 ],
[ 224, 185, 145 ],
[ 224, 185, 146 ],
[ 224, 185, 147 ],
[ 224, 185, 148 ],
[ 224, 185, 149 ],
[ 224, 185, 150 ],
[ 224, 185, 151 ],
[ 224, 185, 152 ],
[ 224, 185, 153 ],
[ 224, 187, 144 ],
[ 224, 187, 145 ],
[ 224, 187, 146 ],
[ 224, 187, 147 ],
[ 224, 187, 148 ],
[ 224, 187, 149 ],
[ 224, 187, 150 ],
[ 224, 187, 151 ],
[ 224, 187, 152 ],
[ 224, 187, 153 ],
[ 224, 188, 160 ],
[ 224, 188, 161 ],
[ 224, 188, 162 ],
[ 224, 188, 163 ],
[ 224, 188, 164 ],
[ 224, 188, 165 ],
[ 224, 188, 166 ],
[ 224, 188, 167 ],
[ 224, 188, 168 ],
[ 224, 188, 169 ],
[ 224, 188, 170 ],
[ 224, 188, 171 ],
[ 224, 188, 172 ],
[ 224, 188, 173 ],
[ 224, 188, 174 ],
[ 224, 188, 175 ],
[ 224, 188, 176 ],
[ 224, 188, 177 ],
[ 224, 188, 178 ],
[ 224, 188, 179 ],
[ 225, 129, 128 ],
[ 225, 129, 129 ],
[ 225, 129, 130 ],
[ 225, 129, 131 ],
[ 225, 129, 132 ],
[ 225, 129, 133 ],
[ 225, 129, 134 ],
[ 225, 129, 135 ],
[ 225, 129, 136 ],
[ 225, 129, 137 ],
[ 225, 130, 144 ],
[ 225, 130, 145 ],
[ 225, 130, 146 ],
[ 225, 130, 147 ],
[ 225, 130, 148 ],
[ 225, 130, 149 ],
[ 225, 130, 150 ],
[ 225, 130, 151 ],
[ 225, 130, 152 ],
[ 225, 130, 153 ],
[ 225, 141, 169 ],
[ 225, 141, 170 ],
[ 225, 141, 171 ],
[ 225, 141, 172 ],
[ 225, 141, 173 ],
[ 225, 141, 174 ],
[ 225, 141, 175 ],
[ 225, 141, 176 ],
[ 225, 141, 177 ],
[ 225, 141, 178 ],
[ 225, 141, 179 ],
[ 225, 141, 180 ],
[ 225, 141, 181 ],
[ 225, 141, 182 ],
[ 225, 141, 183 ],
[ 225, 141, 184 ],
[ 225, 141, 185 ],
[ 225, 141, 186 ],
[ 225, 141, 187 ],
[ 225, 141, 188 ],
[ 225, 155, 174 ],
[ 225, 155, 175 ],
[ 225, 155, 176 ],
[ 225, 159, 160 ],
[ 225, 159, 161 ],
[ 225, 159, 162 ],
[ 225, 159, 163 ],
[ 225, 159, 164 ],
[ 225, 159, 165 ],
[ 225, 159, 166 ],
[ 225, 159, 167 ],
[ 225, 159, 168 ],
[ 225, 159, 169 ],
[ 225, 159, 176 ],
[ 225, 159, 177 ],
[ 225, 159, 178 ],
[ 225, 159, 179 ],
[ 225, 159, 180 ],
[ 225, 159, 181 ],
[ 225, 159, 182 ],
[ 225, 159, 183 ],
[ 225, 159, 184 ],
[ 225, 159, 185 ],
[ 225, 160, 144 ],
[ 225, 160, 145 ],
[ 225, 160, 146 ],
[ 225, 160, 147 ],
[ 225, 160, 148 ],
[ 225, 160, 149 ],
[ 225, 160, 150 ],
[ 225, 160, 151 ],
[ 225, 160, 152 ],
[ 225, 160, 153 ],
[ 225, 165, 134 ],
[ 225, 165, 135 ],
[ 225, 165, 136 ],
[ 225, 165, 137 ],
[ 225, 165, 138 ],
[ 225, 165, 139 ],
[ 225, 165, 140 ],
[ 225, 165, 141 ],
[ 225, 165, 142 ],
[ 225, 165, 143 ],
[ 225, 167, 144 ],
[ 225, 167, 145 ],
[ 225, 167, 146 ],
[ 225, 167, 147 ],
[ 225, 167, 148 ],
[ 225, 167, 149 ],
[ 225, 167, 150 ],
[ 225, 167, 151 ],
[ 225, 167, 152 ],
[ 225, 167, 153 ],
[ 225, 167, 154 ],
[ 225, 170, 128 ],
[ 225, 170, 129 ],
[ 225, 170, 130 ],
[ 225, 170, 131 ],
[ 225, 170, 132 ],
[ 225, 170, 133 ],
[ 225, 170, 134 ],
[ 225, 170, 135 ],
[ 225, 170, 136 ],
[ 225, 170, 137 ],
[ 225, 170, 144 ],
[ 225, 170, 145 ],
[ 225, 170, 146 ],
[ 225, 170, 147 ],
[ 225, 170, 148 ],
[ 225, 170, 149 ],
[ 225, 170, 150 ],
[ 225, 170, 151 ],
[ 225, 170, 152 ],
[ 225, 170, 153 ],
[ 225, 173, 144 ],
[ 225, 173, 145 ],
[ 225, 173, 146 ],
[ 225, 173, 147 ],
[ 225, 173, 148 ],
[ 225, 173, 149 ],
[ 225, 173, 150 ],
[ 225, 173, 151 ],
[ 225, 173, 152 ],
[ 225, 173, 153 ],
[ 225, 174, 176 ],
[ 225, 174, 177 ],
[ 225, 174, 178 ],
[ 225, 174, 179 ],
[ 225, 174, 180 ],
[ 225, 174, 181 ],
[ 225, 174, 182 ],
[ 225, 174, 183 ],
[ 225, 174, 184 ],
[ 225, 174, 185 ],
[ 225, 177, 128 ],
[ 225, 177, 129 ],
[ 225, 177, 130 ],
[ 225, 177, 131 ],
[ 225, 177, 132 ],
[ 225, 177, 133 ],
[ 225, 177, 134 ],
[ 225, 177, 135 ],
[ 225, 177, 136 ],
[ 225, 177, 137 ],
[ 225, 177, 144 ],
[ 225, 177, 145 ],
[ 225, 177, 146 ],
[ 225, 177, 147 ],
[ 225, 177, 148 ],
[ 225, 177, 149 ],
[ 225, 177, 150 ],
[ 225, 177, 151 ],
[ 225, 177, 152 ],
[ 225, 177, 153 ],
[ 226, 129, 176 ],
[ 226, 129, 180 ],
[ 226, 129, 181 ],
[ 226, 129, 182 ],
[ 226, 129, 183 ],
[ 226, 129, 184 ],
[ 226, 129, 185 ],
[ 226, 130, 128 ],
[ 226, 130, 129 ],
[ 226, 130, 130 ],
[ 226, 130, 131 ],
[ 226, 130, 132 ],
[ 226, 130, 133 ],
[ 226, 130, 134 ],
[ 226, 130, 135 ],
[ 226, 130, 136 ],
[ 226, 130, 137 ],
[ 226, 133, 144 ],
[ 226, 133, 145 ],
[ 226, 133, 146 ],
[ 226, 133, 147 ],
[ 226, 133, 148 ],
[ 226, 133, 149 ],
[ 226, 133, 150 ],
[ 226, 133, 151 ],
[ 226, 133, 152 ],
[ 226, 133, 153 ],
[ 226, 133, 154 ],
[ 226, 133, 155 ],
[ 226, 133, 156 ],
[ 226, 133, 157 ],
[ 226, 133, 158 ],
[ 226, 133, 159 ],
[ 226, 133, 160 ],
[ 226, 133, 161 ],
[ 226, 133, 162 ],
[ 226, 133, 163 ],
[ 226, 133, 164 ],
[ 226, 133, 165 ],
[ 226, 133, 166 ],
[ 226, 133, 167 ],
[ 226, 133, 168 ],
[ 226, 133, 169 ],
[ 226, 133, 170 ],
[ 226, 133, 171 ],
[ 226, 133, 172 ],
[ 226, 133, 173 ],
[ 226, 133, 174 ],
[ 226, 133, 175 ],
[ 226, 133, 176 ],
[ 226, 133, 177 ],
[ 226, 133, 178 ],
[ 226, 133, 179 ],
[ 226, 133, 180 ],
[ 226, 133, 181 ],
[ 226, 133, 182 ],
[ 226, 133, 183 ],
[ 226, 133, 184 ],
[ 226, 133, 185 ],
[ 226, 133, 186 ],
[ 226, 133, 187 ],
[ 226, 133, 188 ],
[ 226, 133, 189 ],
[ 226, 133, 190 ],
[ 226, 133, 191 ],
[ 226, 134, 128 ],
[ 226, 134, 129 ],
[ 226, 134, 130 ],
[ 226, 134, 133 ],
[ 226, 134, 134 ],
[ 226, 134, 135 ],
[ 226, 134, 136 ],
[ 226, 134, 137 ],
[ 226, 145, 160 ],
[ 226, 145, 161 ],
[ 226, 145, 162 ],
[ 226, 145, 163 ],
[ 226, 145, 164 ],
[ 226, 145, 165 ],
[ 226, 145, 166 ],
[ 226, 145, 167 ],
[ 226, 145, 168 ],
[ 226, 145, 169 ],
[ 226, 145, 170 ],
[ 226, 145, 171 ],
[ 226, 145, 172 ],
[ 226, 145, 173 ],
[ 226, 145, 174 ],
[ 226, 145, 175 ],
[ 226, 145, 176 ],
[ 226, 145, 177 ],
[ 226, 145, 178 ],
[ 226, 145, 179 ],
[ 226, 145, 180 ],
[ 226, 145, 181 ],
[ 226, 145, 182 ],
[ 226, 145, 183 ],
[ 226, 145, 184 ],
[ 226, 145, 185 ],
[ 226, 145, 186 ],
[ 226, 145, 187 ],
[ 226, 145, 188 ],
[ 226, 145, 189 ],
[ 226, 145, 190 ],
[ 226, 145, 191 ],
[ 226, 146, 128 ],
[ 226, 146, 129 ],
[ 226, 146, 130 ],
[ 226, 146, 131 ],
[ 226, 146, 132 ],
[ 226, 146, 133 ],
[ 226, 146, 134 ],
[ 226, 146, 135 ],
[ 226, 146, 136 ],
[ 226, 146, 137 ],
[ 226, 146, 138 ],
[ 226, 146, 139 ],
[ 226, 146, 140 ],
[ 226, 146, 141 ],
[ 226, 146, 142 ],
[ 226, 146, 143 ],
[ 226, 146, 144 ],
[ 226, 146, 145 ],
[ 226, 146, 146 ],
[ 226, 146, 147 ],
[ 226, 146, 148 ],
[ 226, 146, 149 ],
[ 226, 146, 150 ],
[ 226, 146, 151 ],
[ 226, 146, 152 ],
[ 226, 146, 153 ],
[ 226, 146, 154 ],
[ 226, 146, 155 ],
[ 226, 147, 170 ],
[ 226, 147, 171 ],
[ 226, 147, 172 ],
[ 226, 147, 173 ],
[ 226, 147, 174 ],
[ 226, 147, 175 ],
[ 226, 147, 176 ],
[ 226, 147, 177 ],
[ 226, 147, 178 ],
[ 226, 147, 179 ],
[ 226, 147, 180 ],
[ 226, 147, 181 ],
[ 226, 147, 182 ],
[ 226, 147, 183 ],
[ 226, 147, 184 ],
[ 226, 147, 185 ],
[ 226, 147, 186 ],
[ 226, 147, 187 ],
[ 226, 147, 188 ],
[ 226, 147, 189 ],
[ 226, 147, 190 ],
[ 226, 147, 191 ],
[ 226, 157, 182 ],
[ 226, 157, 183 ],
[ 226, 157, 184 ],
[ 226, 157, 185 ],
[ 226, 157, 186 ],
[ 226, 157, 187 ],
[ 226, 157, 188 ],
[ 226, 157, 189 ],
[ 226, 157, 190 ],
[ 226, 157, 191 ],
[ 226, 158, 128 ],
[ 226, 158, 129 ],
[ 226, 158, 130 ],
[ 226, 158, 131 ],
[ 226, 158, 132 ],
[ 226, 158, 133 ],
[ 226, 158, 134 ],
[ 226, 158, 135 ],
[ 226, 158, 136 ],
[ 226, 158, 137 ],
[ 226, 158, 138 ],
[ 226, 158, 139 ],
[ 226, 158, 140 ],
[ 226, 158, 141 ],
[ 226, 158, 142 ],
[ 226, 158, 143 ],
[ 226, 158, 144 ],
[ 226, 158, 145 ],
[ 226, 158, 146 ],
[ 226, 158, 147 ],
[ 226, 179, 189 ],
[ 227, 128, 135 ],
[ 227, 128, 161 ],
[ 227, 128, 162 ],
[ 227, 128, 163 ],
[ 227, 128, 164 ],
[ 227, 128, 165 ],
[ 227, 128, 166 ],
[ 227, 128, 167 ],
[ 227, 128, 168 ],
[ 227, 128, 169 ],
[ 227, 128, 184 ],
[ 227, 128, 185 ],
[ 227, 128, 186 ],
[ 227, 134, 146 ],
[ 227, 134, 147 ],
[ 227, 134, 148 ],
[ 227, 134, 149 ],
[ 227, 136, 160 ],
[ 227, 136, 161 ],
[ 227, 136, 162 ],
[ 227, 136, 163 ],
[ 227, 136, 164 ],
[ 227, 136, 165 ],
[ 227, 136, 166 ],
[ 227, 136, 167 ],
[ 227, 136, 168 ],
[ 227, 136, 169 ],
[ 227, 137, 136 ],
[ 227, 137, 137 ],
[ 227, 137, 138 ],
[ 227, 137, 139 ],
[ 227, 137, 140 ],
[ 227, 137, 141 ],
[ 227, 137, 142 ],
[ 227, 137, 143 ],
[ 227, 137, 145 ],
[ 227, 137, 146 ],
[ 227, 137, 147 ],
[ 227, 137, 148 ],
[ 227, 137, 149 ],
[ 227, 137, 150 ],
[ 227, 137, 151 ],
[ 227, 137, 152 ],
[ 227, 137, 153 ],
[ 227, 137, 154 ],
[ 227, 137, 155 ],
[ 227, 137, 156 ],
[ 227, 137, 157 ],
[ 227, 137, 158 ],
[ 227, 137, 159 ],
[ 227, 138, 128 ],
[ 227, 138, 129 ],
[ 227, 138, 130 ],
[ 227, 138, 131 ],
[ 227, 138, 132 ],
[ 227, 138, 133 ],
[ 227, 138, 134 ],
[ 227, 138, 135 ],
[ 227, 138, 136 ],
[ 227, 138, 137 ],
[ 227, 138, 177 ],
[ 227, 138, 178 ],
[ 227, 138, 179 ],
[ 227, 138, 180 ],
[ 227, 138, 181 ],
[ 227, 138, 182 ],
[ 227, 138, 183 ],
[ 227, 138, 184 ],
[ 227, 138, 185 ],
[ 227, 138, 186 ],
[ 227, 138, 187 ],
[ 227, 138, 188 ],
[ 227, 138, 189 ],
[ 227, 138, 190 ],
[ 227, 138, 191 ],
[ 234, 152, 160 ],
[ 234, 152, 161 ],
[ 234, 152, 162 ],
[ 234, 152, 163 ],
[ 234, 152, 164 ],
[ 234, 152, 165 ],
[ 234, 152, 166 ],
[ 234, 152, 167 ],
[ 234, 152, 168 ],
[ 234, 152, 169 ],
[ 234, 155, 166 ],
[ 234, 155, 167 ],
[ 234, 155, 168 ],
[ 234, 155, 169 ],
[ 234, 155, 170 ],
[ 234, 155, 171 ],
[ 234, 155, 172 ],
[ 234, 155, 173 ],
[ 234, 155, 174 ],
[ 234, 155, 175 ],
[ 234, 160, 176 ],
[ 234, 160, 177 ],
[ 234, 160, 178 ],
[ 234, 160, 179 ],
[ 234, 160, 180 ],
[ 234, 160, 181 ],
[ 234, 163, 144 ],
[ 234, 163, 145 ],
[ 234, 163, 146 ],
[ 234, 163, 147 ],
[ 234, 163, 148 ],
[ 234, 163, 149 ],
[ 234, 163, 150 ],
[ 234, 163, 151 ],
[ 234, 163, 152 ],
[ 234, 163, 153 ],
[ 234, 164, 128 ],
[ 234, 164, 129 ],
[ 234, 164, 130 ],
[ 234, 164, 131 ],
[ 234, 164, 132 ],
[ 234, 164, 133 ],
[ 234, 164, 134 ],
[ 234, 164, 135 ],
[ 234, 164, 136 ],
[ 234, 164, 137 ],
[ 234, 167, 144 ],
[ 234, 167, 145 ],
[ 234, 167, 146 ],
[ 234, 167, 147 ],
[ 234, 167, 148 ],
[ 234, 167, 149 ],
[ 234, 167, 150 ],
[ 234, 167, 151 ],
[ 234, 167, 152 ],
[ 234, 167, 153 ],
[ 234, 167, 176 ],
[ 234, 167, 177 ],
[ 234, 167, 178 ],
[ 234, 167, 179 ],
[ 234, 167, 180 ],
[ 234, 167, 181 ],
[ 234, 167, 182 ],
[ 234, 167, 183 ],
[ 234, 167, 184 ],
[ 234, 167, 185 ],
[ 234, 169, 144 ],
[ 234, 169, 145 ],
[ 234, 169, 146 ],
[ 234, 169, 147 ],
[ 234, 169, 148 ],
[ 234, 169, 149 ],
[ 234, 169, 150 ],
[ 234, 169, 151 ],
[ 234, 169, 152 ],
[ 234, 169, 153 ],
[ 234, 175, 176 ],
[ 234, 175, 177 ],
[ 234, 175, 178 ],
[ 234, 175, 179 ],
[ 234, 175, 180 ],
[ 234, 175, 181 ],
[ 234, 175, 182 ],
[ 234, 175, 183 ],
[ 234, 175, 184 ],
[ 234, 175, 185 ],
[ 239, 188, 144 ],
[ 239, 188, 145 ],
[ 239, 188, 146 ],
[ 239, 188, 147 ],
[ 239, 188, 148 ],
[ 239, 188, 149 ],
[ 239, 188, 150 ],
[ 239, 188, 151 ],
[ 239, 188, 152 ],
[ 239, 188, 153 ],
[ 240, 144, 132, 135 ],
[ 240, 144, 132, 136 ],
[ 240, 144, 132, 137 ],
[ 240, 144, 132, 138 ],
[ 240, 144, 132, 139 ],
[ 240, 144, 132, 140 ],
[ 240, 144, 132, 141 ],
[ 240, 144, 132, 142 ],
[ 240, 144, 132, 143 ],
[ 240, 144, 132, 144 ],
[ 240, 144, 132, 145 ],
[ 240, 144, 132, 146 ],
[ 240, 144, 132, 147 ],
[ 240, 144, 132, 148 ],
[ 240, 144, 132, 149 ],
[ 240, 144, 132, 150 ],
[ 240, 144, 132, 151 ],
[ 240, 144, 132, 152 ],
[ 240, 144, 132, 153 ],
[ 240, 144, 132, 154 ],
[ 240, 144, 132, 155 ],
[ 240, 144, 132, 156 ],
[ 240, 144, 132, 157 ],
[ 240, 144, 132, 158 ],
[ 240, 144, 132, 159 ],
[ 240, 144, 132, 160 ],
[ 240, 144, 132, 161 ],
[ 240, 144, 132, 162 ],
[ 240, 144, 132, 163 ],
[ 240, 144, 132, 164 ],
[ 240, 144, 132, 165 ],
[ 240, 144, 132, 166 ],
[ 240, 144, 132, 167 ],
[ 240, 144, 132, 168 ],
[ 240, 144, 132, 169 ],
[ 240, 144, 132, 170 ],
[ 240, 144, 132, 171 ],
[ 240, 144, 132, 172 ],
[ 240, 144, 132, 173 ],
[ 240, 144, 132, 174 ],
[ 240, 144, 132, 175 ],
[ 240, 144, 132, 176 ],
[ 240, 144, 132, 177 ],
[ 240, 144, 132, 178 ],
[ 240, 144, 132, 179 ],
[ 240, 144, 133, 128 ],
[ 240, 144, 133, 129 ],
[ 240, 144, 133, 130 ],
[ 240, 144, 133, 131 ],
[ 240, 144, 133, 132 ],
[ 240, 144, 133, 133 ],
[ 240, 144, 133, 134 ],
[ 240, 144, 133, 135 ],
[ 240, 144, 133, 136 ],
[ 240, 144, 133, 137 ],
[ 240, 144, 133, 138 ],
[ 240, 144, 133, 139 ],
[ 240, 144, 133, 140 ],
[ 240, 144, 133, 141 ],
[ 240, 144, 133, 142 ],
[ 240, 144, 133, 143 ],
[ 240, 144, 133, 144 ],
[ 240, 144, 133, 145 ],
[ 240, 144, 133, 146 ],
[ 240, 144, 133, 147 ],
[ 240, 144, 133, 148 ],
[ 240, 144, 133, 149 ],
[ 240, 144, 133, 150 ],
[ 240, 144, 133, 151 ],
[ 240, 144, 133, 152 ],
[ 240, 144, 133, 153 ],
[ 240, 144, 133, 154 ],
[ 240, 144, 133, 155 ],
[ 240, 144, 133, 156 ],
[ 240, 144, 133, 157 ],
[ 240, 144, 133, 158 ],
[ 240, 144, 133, 159 ],
[ 240, 144, 133, 160 ],
[ 240, 144, 133, 161 ],
[ 240, 144, 133, 162 ],
[ 240, 144, 133, 163 ],
[ 240, 144, 133, 164 ],
[ 240, 144, 133, 165 ],
[ 240, 144, 133, 166 ],
[ 240, 144, 133, 167 ],
[ 240, 144, 133, 168 ],
[ 240, 144, 133, 169 ],
[ 240, 144, 133, 170 ],
[ 240, 144, 133, 171 ],
[ 240, 144, 133, 172 ],
[ 240, 144, 133, 173 ],
[ 240, 144, 133, 174 ],
[ 240, 144, 133, 175 ],
[ 240, 144, 133, 176 ],
[ 240, 144, 133, 177 ],
[ 240, 144, 133, 178 ],
[ 240, 144, 133, 179 ],
[ 240, 144, 133, 180 ],
[ 240, 144, 133, 181 ],
[ 240, 144, 133, 182 ],
[ 240, 144, 133, 183 ],
[ 240, 144, 133, 184 ],
[ 240, 144, 134, 138 ],
[ 240, 144, 134, 139 ],
[ 240, 144, 139, 161 ],
[ 240, 144, 139, 162 ],
[ 240, 144, 139, 163 ],
[ 240, 144, 139, 164 ],
[ 240, 144, 139, 165 ],
[ 240, 144, 139, 166 ],
[ 240, 144, 139, 167 ],
[ 240, 144, 139, 168 ],
[ 240, 144, 139, 169 ],
[ 240, 144, 139, 170 ],
[ 240, 144, 139, 171 ],
[ 240, 144, 139, 172 ],
[ 240, 144, 139, 173 ],
[ 240, 144, 139, 174 ],
[ 240, 144, 139, 175 ],
[ 240, 144, 139, 176 ],
[ 240, 144, 139, 177 ],
[ 240, 144, 139, 178 ],
[ 240, 144, 139, 179 ],
[ 240, 144, 139, 180 ],
[ 240, 144, 139, 181 ],
[ 240, 144, 139, 182 ],
[ 240, 144, 139, 183 ],
[ 240, 144, 139, 184 ],
[ 240, 144, 139, 185 ],
[ 240, 144, 139, 186 ],
[ 240, 144, 139, 187 ],
[ 240, 144, 140, 160 ],
[ 240, 144, 140, 161 ],
[ 240, 144, 140, 162 ],
[ 240, 144, 140, 163 ],
[ 240, 144, 141, 129 ],
[ 240, 144, 141, 138 ],
[ 240, 144, 143, 145 ],
[ 240, 144, 143, 146 ],
[ 240, 144, 143, 147 ],
[ 240, 144, 143, 148 ],
[ 240, 144, 143, 149 ],
[ 240, 144, 146, 160 ],
[ 240, 144, 146, 161 ],
[ 240, 144, 146, 162 ],
[ 240, 144, 146, 163 ],
[ 240, 144, 146, 164 ],
[ 240, 144, 146, 165 ],
[ 240, 144, 146, 166 ],
[ 240, 144, 146, 167 ],
[ 240, 144, 146, 168 ],
[ 240, 144, 146, 169 ],
[ 240, 144, 161, 152 ],
[ 240, 144, 161, 153 ],
[ 240, 144, 161, 154 ],
[ 240, 144, 161, 155 ],
[ 240, 144, 161, 156 ],
[ 240, 144, 161, 157 ],
[ 240, 144, 161, 158 ],
[ 240, 144, 161, 159 ],
[ 240, 144, 161, 185 ],
[ 240, 144, 161, 186 ],
[ 240, 144, 161, 187 ],
[ 240, 144, 161, 188 ],
[ 240, 144, 161, 189 ],
[ 240, 144, 161, 190 ],
[ 240, 144, 161, 191 ],
[ 240, 144, 162, 167 ],
[ 240, 144, 162, 168 ],
[ 240, 144, 162, 169 ],
[ 240, 144, 162, 170 ],
[ 240, 144, 162, 171 ],
[ 240, 144, 162, 172 ],
[ 240, 144, 162, 173 ],
[ 240, 144, 162, 174 ],
[ 240, 144, 162, 175 ],
[ 240, 144, 163, 187 ],
[ 240, 144, 163, 188 ],
[ 240, 144, 163, 189 ],
[ 240, 144, 163, 190 ],
[ 240, 144, 163, 191 ],
[ 240, 144, 164, 150 ],
[ 240, 144, 164, 151 ],
[ 240, 144, 164, 152 ],
[ 240, 144, 164, 153 ],
[ 240, 144, 164, 154 ],
[ 240, 144, 164, 155 ],
[ 240, 144, 166, 188 ],
[ 240, 144, 166, 189 ],
[ 240, 144, 167, 128 ],
[ 240, 144, 167, 129 ],
[ 240, 144, 167, 130 ],
[ 240, 144, 167, 131 ],
[ 240, 144, 167, 132 ],
[ 240, 144, 167, 133 ],
[ 240, 144, 167, 134 ],
[ 240, 144, 167, 135 ],
[ 240, 144, 167, 136 ],
[ 240, 144, 167, 137 ],
[ 240, 144, 167, 138 ],
[ 240, 144, 167, 139 ],
[ 240, 144, 167, 140 ],
[ 240, 144, 167, 141 ],
[ 240, 144, 167, 142 ],
[ 240, 144, 167, 143 ],
[ 240, 144, 167, 146 ],
[ 240, 144, 167, 147 ],
[ 240, 144, 167, 148 ],
[ 240, 144, 167, 149 ],
[ 240, 144, 167, 150 ],
[ 240, 144, 167, 151 ],
[ 240, 144, 167, 152 ],
[ 240, 144, 167, 153 ],
[ 240, 144, 167, 154 ],
[ 240, 144, 167, 155 ],
[ 240, 144, 167, 156 ],
[ 240, 144, 167, 157 ],
[ 240, 144, 167, 158 ],
[ 240, 144, 167, 159 ],
[ 240, 144, 167, 160 ],
[ 240, 144, 167, 161 ],
[ 240, 144, 167, 162 ],
[ 240, 144, 167, 163 ],
[ 240, 144, 167, 164 ],
[ 240, 144, 167, 165 ],
[ 240, 144, 167, 166 ],
[ 240, 144, 167, 167 ],
[ 240, 144, 167, 168 ],
[ 240, 144, 167, 169 ],
[ 240, 144, 167, 170 ],
[ 240, 144, 167, 171 ],
[ 240, 144, 167, 172 ],
[ 240, 144, 167, 173 ],
[ 240, 144, 167, 174 ],
[ 240, 144, 167, 175 ],
[ 240, 144, 167, 176 ],
[ 240, 144, 167, 177 ],
[ 240, 144, 167, 178 ],
[ 240, 144, 167, 179 ],
[ 240, 144, 167, 180 ],
[ 240, 144, 167, 181 ],
[ 240, 144, 167, 182 ],
[ 240, 144, 167, 183 ],
[ 240, 144, 167, 184 ],
[ 240, 144, 167, 185 ],
[ 240, 144, 167, 186 ],
[ 240, 144, 167, 187 ],
[ 240, 144, 167, 188 ],
[ 240, 144, 167, 189 ],
[ 240, 144, 167, 190 ],
[ 240, 144, 167, 191 ],
[ 240, 144, 169, 128 ],
[ 240, 144, 169, 129 ],
[ 240, 144, 169, 130 ],
[ 240, 144, 169, 131 ],
[ 240, 144, 169, 132 ],
[ 240, 144, 169, 133 ],
[ 240, 144, 169, 134 ],
[ 240, 144, 169, 135 ],
[ 240, 144, 169, 189 ],
[ 240, 144, 169, 190 ],
[ 240, 144, 170, 157 ],
[ 240, 144, 170, 158 ],
[ 240, 144, 170, 159 ],
[ 240, 144, 171, 171 ],
[ 240, 144, 171, 172 ],
[ 240, 144, 171, 173 ],
[ 240, 144, 171, 174 ],
[ 240, 144, 171, 175 ],
[ 240, 144, 173, 152 ],
[ 240, 144, 173, 153 ],
[ 240, 144, 173, 154 ],
[ 240, 144, 173, 155 ],
[ 240, 144, 173, 156 ],
[ 240, 144, 173, 157 ],
[ 240, 144, 173, 158 ],
[ 240, 144, 173, 159 ],
[ 240, 144, 173, 184 ],
[ 240, 144, 173, 185 ],
[ 240, 144, 173, 186 ],
[ 240, 144, 173, 187 ],
[ 240, 144, 173, 188 ],
[ 240, 144, 173, 189 ],
[ 240, 144, 173, 190 ],
[ 240, 144, 173, 191 ],
[ 240, 144, 174, 169 ],
[ 240, 144, 174, 170 ],
[ 240, 144, 174, 171 ],
[ 240, 144, 174, 172 ],
[ 240, 144, 174, 173 ],
[ 240, 144, 174, 174 ],
[ 240, 144, 174, 175 ],
[ 240, 144, 179, 186 ],
[ 240, 144, 179, 187 ],
[ 240, 144, 179, 188 ],
[ 240, 144, 179, 189 ],
[ 240, 144, 179, 190 ],
[ 240, 144, 179, 191 ],
[ 240, 144, 185, 160 ],
[ 240, 144, 185, 161 ],
[ 240, 144, 185, 162 ],
[ 240, 144, 185, 163 ],
[ 240, 144, 185, 164 ],
[ 240, 144, 185, 165 ],
[ 240, 144, 185, 166 ],
[ 240, 144, 185, 167 ],
[ 240, 144, 185, 168 ],
[ 240, 144, 185, 169 ],
[ 240, 144, 185, 170 ],
[ 240, 144, 185, 171 ],
[ 240, 144, 185, 172 ],
[ 240, 144, 185, 173 ],
[ 240, 144, 185, 174 ],
[ 240, 144, 185, 175 ],
[ 240, 144, 185, 176 ],
[ 240, 144, 185, 177 ],
[ 240, 144, 185, 178 ],
[ 240, 144, 185, 179 ],
[ 240, 144, 185, 180 ],
[ 240, 144, 185, 181 ],
[ 240, 144, 185, 182 ],
[ 240, 144, 185, 183 ],
[ 240, 144, 185, 184 ],
[ 240, 144, 185, 185 ],
[ 240, 144, 185, 186 ],
[ 240, 144, 185, 187 ],
[ 240, 144, 185, 188 ],
[ 240, 144, 185, 189 ],
[ 240, 144, 185, 190 ],
[ 240, 145, 129, 146 ],
[ 240, 145, 129, 147 ],
[ 240, 145, 129, 148 ],
[ 240, 145, 129, 149 ],
[ 240, 145, 129, 150 ],
[ 240, 145, 129, 151 ],
[ 240, 145, 129, 152 ],
[ 240, 145, 129, 153 ],
[ 240, 145, 129, 154 ],
[ 240, 145, 129, 155 ],
[ 240, 145, 129, 156 ],
[ 240, 145, 129, 157 ],
[ 240, 145, 129, 158 ],
[ 240, 145, 129, 159 ],
[ 240, 145, 129, 160 ],
[ 240, 145, 129, 161 ],
[ 240, 145, 129, 162 ],
[ 240, 145, 129, 163 ],
[ 240, 145, 129, 164 ],
[ 240, 145, 129, 165 ],
[ 240, 145, 129, 166 ],
[ 240, 145, 129, 167 ],
[ 240, 145, 129, 168 ],
[ 240, 145, 129, 169 ],
[ 240, 145, 129, 170 ],
[ 240, 145, 129, 171 ],
[ 240, 145, 129, 172 ],
[ 240, 145, 129, 173 ],
[ 240, 145, 129, 174 ],
[ 240, 145, 129, 175 ],
[ 240, 145, 131, 176 ],
[ 240, 145, 131, 177 ],
[ 240, 145, 131, 178 ],
[ 240, 145, 131, 179 ],
[ 240, 145, 131, 180 ],
[ 240, 145, 131, 181 ],
[ 240, 145, 131, 182 ],
[ 240, 145, 131, 183 ],
[ 240, 145, 131, 184 ],
[ 240, 145, 131, 185 ],
[ 240, 145, 132, 182 ],
[ 240, 145, 132, 183 ],
[ 240, 145, 132, 184 ],
[ 240, 145, 132, 185 ],
[ 240, 145, 132, 186 ],
[ 240, 145, 132, 187 ],
[ 240, 145, 132, 188 ],
[ 240, 145, 132, 189 ],
[ 240, 145, 132, 190 ],
[ 240, 145, 132, 191 ],
[ 240, 145, 135, 144 ],
[ 240, 145, 135, 145 ],
[ 240, 145, 135, 146 ],
[ 240, 145, 135, 147 ],
[ 240, 145, 135, 148 ],
[ 240, 145, 135, 149 ],
[ 240, 145, 135, 150 ],
[ 240, 145, 135, 151 ],
[ 240, 145, 135, 152 ],
[ 240, 145, 135, 153 ],
[ 240, 145, 135, 161 ],
[ 240, 145, 135, 162 ],
[ 240, 145, 135, 163 ],
[ 240, 145, 135, 164 ],
[ 240, 145, 135, 165 ],
[ 240, 145, 135, 166 ],
[ 240, 145, 135, 167 ],
[ 240, 145, 135, 168 ],
[ 240, 145, 135, 169 ],
[ 240, 145, 135, 170 ],
[ 240, 145, 135, 171 ],
[ 240, 145, 135, 172 ],
[ 240, 145, 135, 173 ],
[ 240, 145, 135, 174 ],
[ 240, 145, 135, 175 ],
[ 240, 145, 135, 176 ],
[ 240, 145, 135, 177 ],
[ 240, 145, 135, 178 ],
[ 240, 145, 135, 179 ],
[ 240, 145, 135, 180 ],
[ 240, 145, 139, 176 ],
[ 240, 145, 139, 177 ],
[ 240, 145, 139, 178 ],
[ 240, 145, 139, 179 ],
[ 240, 145, 139, 180 ],
[ 240, 145, 139, 181 ],
[ 240, 145, 139, 182 ],
[ 240, 145, 139, 183 ],
[ 240, 145, 139, 184 ],
[ 240, 145, 139, 185 ],
[ 240, 145, 147, 144 ],
[ 240, 145, 147, 145 ],
[ 240, 145, 147, 146 ],
[ 240, 145, 147, 147 ],
[ 240, 145, 147, 148 ],
[ 240, 145, 147, 149 ],
[ 240, 145, 147, 150 ],
[ 240, 145, 147, 151 ],
[ 240, 145, 147, 152 ],
[ 240, 145, 147, 153 ],
[ 240, 145, 153, 144 ],
[ 240, 145, 153, 145 ],
[ 240, 145, 153, 146 ],
[ 240, 145, 153, 147 ],
[ 240, 145, 153, 148 ],
[ 240, 145, 153, 149 ],
[ 240, 145, 153, 150 ],
[ 240, 145, 153, 151 ],
[ 240, 145, 153, 152 ],
[ 240, 145, 153, 153 ],
[ 240, 145, 155, 128 ],
[ 240, 145, 155, 129 ],
[ 240, 145, 155, 130 ],
[ 240, 145, 155, 131 ],
[ 240, 145, 155, 132 ],
[ 240, 145, 155, 133 ],
[ 240, 145, 155, 134 ],
[ 240, 145, 155, 135 ],
[ 240, 145, 155, 136 ],
[ 240, 145, 155, 137 ],
[ 240, 145, 156, 176 ],
[ 240, 145, 156, 177 ],
[ 240, 145, 156, 178 ],
[ 240, 145, 156, 179 ],
[ 240, 145, 156, 180 ],
[ 240, 145, 156, 181 ],
[ 240, 145, 156, 182 ],
[ 240, 145, 156, 183 ],
[ 240, 145, 156, 184 ],
[ 240, 145, 156, 185 ],
[ 240, 145, 156, 186 ],
[ 240, 145, 156, 187 ],
[ 240, 145, 163, 160 ],
[ 240, 145, 163, 161 ],
[ 240, 145, 163, 162 ],
[ 240, 145, 163, 163 ],
[ 240, 145, 163, 164 ],
[ 240, 145, 163, 165 ],
[ 240, 145, 163, 166 ],
[ 240, 145, 163, 167 ],
[ 240, 145, 163, 168 ],
[ 240, 145, 163, 169 ],
[ 240, 145, 163, 170 ],
[ 240, 145, 163, 171 ],
[ 240, 145, 163, 172 ],
[ 240, 145, 163, 173 ],
[ 240, 145, 163, 174 ],
[ 240, 145, 163, 175 ],
[ 240, 145, 163, 176 ],
[ 240, 145, 163, 177 ],
[ 240, 145, 163, 178 ],
[ 240, 146, 144, 128 ],
[ 240, 146, 144, 129 ],
[ 240, 146, 144, 130 ],
[ 240, 146, 144, 131 ],
[ 240, 146, 144, 132 ],
[ 240, 146, 144, 133 ],
[ 240, 146, 144, 134 ],
[ 240, 146, 144, 135 ],
[ 240, 146, 144, 136 ],
[ 240, 146, 144, 137 ],
[ 240, 146, 144, 138 ],
[ 240, 146, 144, 139 ],
[ 240, 146, 144, 140 ],
[ 240, 146, 144, 141 ],
[ 240, 146, 144, 142 ],
[ 240, 146, 144, 143 ],
[ 240, 146, 144, 144 ],
[ 240, 146, 144, 145 ],
[ 240, 146, 144, 146 ],
[ 240, 146, 144, 147 ],
[ 240, 146, 144, 148 ],
[ 240, 146, 144, 149 ],
[ 240, 146, 144, 150 ],
[ 240, 146, 144, 151 ],
[ 240, 146, 144, 152 ],
[ 240, 146, 144, 153 ],
[ 240, 146, 144, 154 ],
[ 240, 146, 144, 155 ],
[ 240, 146, 144, 156 ],
[ 240, 146, 144, 157 ],
[ 240, 146, 144, 158 ],
[ 240, 146, 144, 159 ],
[ 240, 146, 144, 160 ],
[ 240, 146, 144, 161 ],
[ 240, 146, 144, 162 ],
[ 240, 146, 144, 163 ],
[ 240, 146, 144, 164 ],
[ 240, 146, 144, 165 ],
[ 240, 146, 144, 166 ],
[ 240, 146, 144, 167 ],
[ 240, 146, 144, 168 ],
[ 240, 146, 144, 169 ],
[ 240, 146, 144, 170 ],
[ 240, 146, 144, 171 ],
[ 240, 146, 144, 172 ],
[ 240, 146, 144, 173 ],
[ 240, 146, 144, 174 ],
[ 240, 146, 144, 175 ],
[ 240, 146, 144, 176 ],
[ 240, 146, 144, 177 ],
[ 240, 146, 144, 178 ],
[ 240, 146, 144, 179 ],
[ 240, 146, 144, 180 ],
[ 240, 146, 144, 181 ],
[ 240, 146, 144, 182 ],
[ 240, 146, 144, 183 ],
[ 240, 146, 144, 184 ],
[ 240, 146, 144, 185 ],
[ 240, 146, 144, 186 ],
[ 240, 146, 144, 187 ],
[ 240, 146, 144, 188 ],
[ 240, 146, 144, 189 ],
[ 240, 146, 144, 190 ],
[ 240, 146, 144, 191 ],
[ 240, 146, 145, 128 ],
[ 240, 146, 145, 129 ],
[ 240, 146, 145, 130 ],
[ 240, 146, 145, 131 ],
[ 240, 146, 145, 132 ],
[ 240, 146, 145, 133 ],
[ 240, 146, 145, 134 ],
[ 240, 146, 145, 135 ],
[ 240, 146, 145, 136 ],
[ 240, 146, 145, 137 ],
[ 240, 146, 145, 138 ],
[ 240, 146, 145, 139 ],
[ 240, 146, 145, 140 ],
[ 240, 146, 145, 141 ],
[ 240, 146, 145, 142 ],
[ 240, 146, 145, 143 ],
[ 240, 146, 145, 144 ],
[ 240, 146, 145, 145 ],
[ 240, 146, 145, 146 ],
[ 240, 146, 145, 147 ],
[ 240, 146, 145, 148 ],
[ 240, 146, 145, 149 ],
[ 240, 146, 145, 150 ],
[ 240, 146, 145, 151 ],
[ 240, 146, 145, 152 ],
[ 240, 146, 145, 153 ],
[ 240, 146, 145, 154 ],
[ 240, 146, 145, 155 ],
[ 240, 146, 145, 156 ],
[ 240, 146, 145, 157 ],
[ 240, 146, 145, 158 ],
[ 240, 146, 145, 159 ],
[ 240, 146, 145, 160 ],
[ 240, 146, 145, 161 ],
[ 240, 146, 145, 162 ],
[ 240, 146, 145, 163 ],
[ 240, 146, 145, 164 ],
[ 240, 146, 145, 165 ],
[ 240, 146, 145, 166 ],
[ 240, 146, 145, 167 ],
[ 240, 146, 145, 168 ],
[ 240, 146, 145, 169 ],
[ 240, 146, 145, 170 ],
[ 240, 146, 145, 171 ],
[ 240, 146, 145, 172 ],
[ 240, 146, 145, 173 ],
[ 240, 146, 145, 174 ],
[ 240, 150, 169, 160 ],
[ 240, 150, 169, 161 ],
[ 240, 150, 169, 162 ],
[ 240, 150, 169, 163 ],
[ 240, 150, 169, 164 ],
[ 240, 150, 169, 165 ],
[ 240, 150, 169, 166 ],
[ 240, 150, 169, 167 ],
[ 240, 150, 169, 168 ],
[ 240, 150, 169, 169 ],
[ 240, 150, 173, 144 ],
[ 240, 150, 173, 145 ],
[ 240, 150, 173, 146 ],
[ 240, 150, 173, 147 ],
[ 240, 150, 173, 148 ],
[ 240, 150, 173, 149 ],
[ 240, 150, 173, 150 ],
[ 240, 150, 173, 151 ],
[ 240, 150, 173, 152 ],
[ 240, 150, 173, 153 ],
[ 240, 150, 173, 155 ],
[ 240, 150, 173, 156 ],
[ 240, 150, 173, 157 ],
[ 240, 150, 173, 158 ],
[ 240, 150, 173, 159 ],
[ 240, 150, 173, 160 ],
[ 240, 150, 173, 161 ],
[ 240, 157, 141, 160 ],
[ 240, 157, 141, 161 ],
[ 240, 157, 141, 162 ],
[ 240, 157, 141, 163 ],
[ 240, 157, 141, 164 ],
[ 240, 157, 141, 165 ],
[ 240, 157, 141, 166 ],
[ 240, 157, 141, 167 ],
[ 240, 157, 141, 168 ],
[ 240, 157, 141, 169 ],
[ 240, 157, 141, 170 ],
[ 240, 157, 141, 171 ],
[ 240, 157, 141, 172 ],
[ 240, 157, 141, 173 ],
[ 240, 157, 141, 174 ],
[ 240, 157, 141, 175 ],
[ 240, 157, 141, 176 ],
[ 240, 157, 141, 177 ],
[ 240, 157, 159, 142 ],
[ 240, 157, 159, 143 ],
[ 240, 157, 159, 144 ],
[ 240, 157, 159, 145 ],
[ 240, 157, 159, 146 ],
[ 240, 157, 159, 147 ],
[ 240, 157, 159, 148 ],
[ 240, 157, 159, 149 ],
[ 240, 157, 159, 150 ],
[ 240, 157, 159, 151 ],
[ 240, 157, 159, 152 ],
[ 240, 157, 159, 153 ],
[ 240, 157, 159, 154 ],
[ 240, 157, 159, 155 ],
[ 240, 157, 159, 156 ],
[ 240, 157, 159, 157 ],
[ 240, 157, 159, 158 ],
[ 240, 157, 159, 159 ],
[ 240, 157, 159, 160 ],
[ 240, 157, 159, 161 ],
[ 240, 157, 159, 162 ],
[ 240, 157, 159, 163 ],
[ 240, 157, 159, 164 ],
[ 240, 157, 159, 165 ],
[ 240, 157, 159, 166 ],
[ 240, 157, 159, 167 ],
[ 240, 157, 159, 168 ],
[ 240, 157, 159, 169 ],
[ 240, 157, 159, 170 ],
[ 240, 157, 159, 171 ],
[ 240, 157, 159, 172 ],
[ 240, 157, 159, 173 ],
[ 240, 157, 159, 174 ],
[ 240, 157, 159, 175 ],
[ 240, 157, 159, 176 ],
[ 240, 157, 159, 177 ],
[ 240, 157, 159, 178 ],
[ 240, 157, 159, 179 ],
[ 240, 157, 159, 180 ],
[ 240, 157, 159, 181 ],
[ 240, 157, 159, 182 ],
[ 240, 157, 159, 183 ],
[ 240, 157, 159, 184 ],
[ 240, 157, 159, 185 ],
[ 240, 157, 159, 186 ],
[ 240, 157, 159, 187 ],
[ 240, 157, 159, 188 ],
[ 240, 157, 159, 189 ],
[ 240, 157, 159, 190 ],
[ 240, 157, 159, 191 ],
[ 240, 158, 163, 135 ],
[ 240, 158, 163, 136 ],
[ 240, 158, 163, 137 ],
[ 240, 158, 163, 138 ],
[ 240, 158, 163, 139 ],
[ 240, 158, 163, 140 ],
[ 240, 158, 163, 141 ],
[ 240, 158, 163, 142 ],
[ 240, 158, 163, 143 ],
[ 240, 159, 132, 128 ],
[ 240, 159, 132, 129 ],
[ 240, 159, 132, 130 ],
[ 240, 159, 132, 131 ],
[ 240, 159, 132, 132 ],
[ 240, 159, 132, 133 ],
[ 240, 159, 132, 134 ],
[ 240, 159, 132, 135 ],
[ 240, 159, 132, 136 ],
[ 240, 159, 132, 137 ],
[ 240, 159, 132, 138 ],
[ 240, 159, 132, 139 ],
[ 240, 159, 132, 140 ] ]
|
"""Top-level package for zeroml."""
__author__ = """kuba cieslik"""
__email__ = 'kubacieslik@gmail.com'
__version__ = '0.3.3'
|
class LazyDict(dict):
def __init__(self, load_func, *args, **kwargs):
self._load_func = load_func
self._args = args
self._kwargs = kwargs
self._loaded = False
super().__init__()
def load(self):
if not self._loaded:
self.update(self._load_func(*self._args, **self._kwargs))
self._loaded = True
# Clear these out so pickling always works (pickling a func can fail)
self._load_func = None
self._args = None
self._kwargs = None
def __getitem__(self, item):
try:
return super().__getitem__(item)
except KeyError:
self.load()
return super().__getitem__(item)
def __contains__(self, item):
self.load()
return super().__contains__(item)
def keys(self):
self.load()
return super().keys()
def values(self):
self.load()
return super().values()
def items(self):
self.load()
return super().items()
def __len__(self):
self.load()
return super().__len__()
def get(self, key, default=None):
self.load()
return super().get(key, default)
|
def gcd(a, b):
i = min(a, b)
while i>0:
if (a%i) == 0 and (b%i) == 0:
return i
else:
i = i-1
def p(s):
print(s)
if __name__ == "__main__":
p("input a:")
a = int(input())
p("input b:")
b = int(input())
p("gcd of "+str(a)+" and "+str(b)+" is:")
print(gcd(a, b))
|
"""
Tutor allocation algorithm for allocating tutors to the optimal sessions.
"""
__author__ = "Henry O'Brien, Brae Webb"
__all__ = ['allocation', 'doodle', 'model', 'solver', 'csvalidator']
|
class Solution:
def sortedSquares(self, A: List[int]) -> List[int]:
if A[0] >= 0 and A[-1] >= 0:
return [a ** 2 for a in A]
if A[0] <= 0 and A[-1] <= 0:
return [a ** 2 for a in A][::-1]
i = 0
while i < len(A) - 1 and A[i] < 0 and A[i + 1] < 0:
i += 1
left, right = i, i + 1
ans = []
while left >= 0 and right < len(A):
if -A[left] <= A[right]:
ans.append(A[left] ** 2)
left -= 1
else:
ans.append(A[right] ** 2)
right += 1
if left != -1:
ans.extend([A[i] ** 2 for i in range(left, -1, -1)])
else:
ans.extend([A[i] ** 2 for i in range(right, len(A))])
return ans
|
# pylint: disable=missing-docstring,invalid-name,too-few-public-methods
class A:
myfield: int
class B(A):
pass
class C:
pass
class D(C, B):
pass
a = A()
print(a.myfield)
b = B()
print(b.myfield)
d = D()
print(d.myfield)
c = C()
print(c.myfield) # [no-member]
|
'''
The goal of binary search is to search whether a given number is present in the string or not.
'''
lst = [1,3,2,4,5,6,9,8,7,10]
lst.sort()
first=0
last=len(lst)-1
mid = (first+last)//2
item = int(input("enter the number to be search"))
found = False
while( first<=last and not found):
mid = (first + last)//2
if lst[mid] == item :
print(f"found at location {mid}")
found= True
else:
if item < lst[mid]:
last = mid - 1
else:
first = mid + 1
if found == False:
print("Number not found")
|
num = (int(input('Digite um numero: ')),
int(input('Digite outro numero: ')),
int(input('Digite mais um numero: ')),
int(input('Digite o ultimo numero: ')))
print(f'Os numero digitados foram: {num}')
print(f'O numero 9 apareceu {num.count(9)} vezes')
if 3 in num:
print(f'\nO numero 3 foi digita a primeira vez na posição: {num.index(3)+1}ª')
else:
print('O valor três não foi digitado: ')
print('Os numeros pares são: ')
for n in num:
if n % 2 == 0:
print(f'{n}',end= ' ')
|
# SAME BSTS
# O(N^2) time and space
def sameBsts(arrayOne, arrayTwo):
# Write your code here.
if len(arrayOne) != len(arrayTwo):
return False
if len(arrayOne) == 0:
return True
if arrayOne[0] != arrayTwo[0]:
return False
leftSubtreeFirst = [num for num in arrayOne[1:] if num < arrayOne[0]]
rightSubtreeFirst = [num for num in arrayOne[1:] if num >= arrayOne[0]]
leftSubtreeSecond = [num for num in arrayTwo[1:] if num < arrayTwo[0]]
rightSubtreeSecond = [num for num in arrayTwo[1:] if num >= arrayTwo[0]]
return sameBsts(leftSubtreeFirst, leftSubtreeSecond) and sameBsts(rightSubtreeFirst, rightSubtreeSecond)
# O(N^2) time and O(d) space
def sameBsts(arrayOne, arrayTwo):
# Write your code here.
return areSameBsts(arrayOne, arrayTwo, 0, 0, float('-inf'), float('inf'))
def areSameBsts(arrayOne, arrayTwo, rootIdxOne, rootIdxTwo, minVal, maxVal):
if rootIdxOne == -1 or rootIdxTwo == -1:
return rootIdxOne == rootIdxTwo
if arrayOne[rootIdxOne] != arrayTwo[rootIdxTwo]:
return False
leftRootIdxOne = getIdxOfFirstSmaller(arrayOne, rootIdxOne, minVal)
leftRootIdxTwo = getIdxOfFirstSmaller(arrayTwo, rootIdxTwo, minVal)
rightRootIdxOne = getIdxOfFirstBiggerOrEqual(arrayOne, rootIdxOne, maxVal)
rightRootIdxTwo = getIdxOfFirstBiggerOrEqual(arrayTwo, rootIdxTwo, maxVal)
currentValue = arrayOne[rootIdxOne]
leftAreSame = areSameBsts(arrayOne, arrayTwo, leftRootIdxOne, leftRootIdxTwo, minVal, currentValue)
rightAreSame = areSameBsts(arrayOne, arrayTwo, rightRootIdxOne, rightRootIdxTwo, currentValue, maxVal)
return leftAreSame and rightAreSame
def getIdxOfFirstSmaller(array, startingIdx, minVal):
for i in range(startingIdx + 1, len(array)):
if array[i] < array[startingIdx] and array[i] >= minVal:
return i
return -1
def getIdxOfFirstBiggerOrEqual(array, startingIdx, maxVal):
for i in range(startingIdx + 1, len(array)):
if array[i] >= array[startingIdx] and array[i] < maxVal:
return i
return -1
|
consent = """<center><table width="800px"><tr><td>
<font size="16"><b>University of Costa Rica<br/> </font>
INFORMED CONSENT FORM for RESEARCH<br/></b>
<b>Title of Study:</b> Hanabi AI Agents<br/>
<b>Principal Investigator:</b> Dr. Markus Eger <br/>
<h2>What are some general things you should know about research studies?</h2>
<p>You are being asked to take part in a research study. Your participation in this study is voluntary. You have the right to be a part of this study, to choose not to participate or to stop participating at any time without penalty. The purpose of research studies is to gain a better understanding of a certain topic or issue. </p>
<p>You are not guaranteed any personal benefits from being in a study. Research studies also may pose risks to those that participate. In this consent form you will find specific details about the research in which you are being asked to participate. If you do not understand something in this form it is your right to ask the researcher for clarification or more information. A copy of this consent form will be provided to you. If at any time you have questions about your participation, do not hesitate to contact the researcher(s) named above. </p>
<h2>What is the purpose of this study?</h2>
<p>The purpose of the study is to determine which type of AI plays well with humans in the cooperative card game Hanabi. <b>You must be between 18 and 64 years to participate.</b></p>
<h2>What will happen if you take part in the study?</h2>
<p>If you agree to participate in this study, you will play two games of a browser-based implementation of Hanabi with an AI controlled player, and then answer some questions about your experience with the AI and board games in general. If you enjoy your experience (and we hope you do), you can also play more often. </p>
<h2>Risks</h2>
<p>The risks of this study do not exceed normal computer use. </p>
<h2>Benefits</h2>
<p>There are no direct benefits to your participation in the research. The indirect benefits are that you may actually enjoy playing the game with the AI. For participating in this study you will receive <b>no compensation.</b></p>
<h2>Confidentiality</h2>
<p>The information in the study records will be kept confidential to the full extent allowed by law. Data will be stored securely on a secure computer that only the researchers can access. No reference will be made in oral or written reports which could link you to the study. After the conclusion of the study, the information we gathered will be released to the public to foster further research. Note that none of this information can be linked back to you personally, and that you can choose if you want to be included in the published data at the end of the experiment.
</p>
<h2>What if you are a UCR student?</h2>
<p>Participation in this study is not a course requirement and your participation or lack thereof, will not affect your class standing or grades at UCR.</p>
<h2>What if you are a UCR employee?</h2>
<p>Participation in this study is not a requirement of your employment at UCR, and your participation or lack thereof, will not affect your job.</p>
<h2>What if you have questions about this study?</h2>
<p>If you have questions at any time about the study itself or the procedures implemented in this study, you may contact the researcher, Markus Eger by email: markus.eger@ucr.ac.cr
<h2>Consent To Participate</h2>
I have read and understand the above information. I have received a copy of this form. I agree to participate in this study with the understanding that I may choose not to participate or to stop participating at any time without penalty or loss of benefits to which I am otherwise entitled.</td></tr></table></center>
"""
|
def getNextGreaterElement(array: list) -> None:
if len(array) <= 0:
return
print(bruteForce(array))
print(optimizationUsingSpace(array))
# bruteforce
def bruteForce(array: list) -> list:
'''
time complexicity: O(n^2)
space complexicity: O(1)
'''
greater_element_list = [-1] * len(array)
for index, element in enumerate(array):
for next_element in array[index+1:]:
if next_element > element:
greater_element_list[index] = next_element
break
return greater_element_list
# optimized using space
def optimizationUsingSpace(array: list) -> list:
'''
time complexicity: O(n)
space complexicity: O(n)
'''
greater_element_stack: list = []
next_greater_element_list: list = [-1] * len(array)
top = -1
# iterate array from end
for index in range(len(array)-1, -1, -1):
# pop smaller elements
while greater_element_stack and array[index] >= greater_element_stack[top]:
greater_element_stack.pop()
if greater_element_stack:
next_greater_element_list[index] = greater_element_stack[top]
greater_element_stack.append(array[index])
return next_greater_element_list
if __name__ == '__main__':
arr1 = [4,5,2,25]
arr2 = [6,8,0,1,3]
getNextGreaterElement(arr1)
getNextGreaterElement(arr2)
|
#remove duplicates from an unsorted linked list
def foo(linkedlist):
current_node = linkedlist.head
while current_node is not None:
checker_node = current_node
while checker_node.next is not None:
if checker_node.next.value == current_node.value:
checker_node.next = checker_node.next.next
else:
checker_node = checker_node.next
current_node = current_node.next
|
description = 'Verify the user can add an element to a page and save it successfully'
pages = ['common',
'index',
'project_pages',
'page_builder']
def setup(data):
common.access_golem(data.env.url, data.env.admin)
index.create_access_project('test')
common.navigate_menu('Pages')
project_pages.create_access_random_page()
def test(data):
store('element_def', ['some_element', 'id', 'selector_value', 'display_name'])
page_builder.add_element(data.element_def)
wait(1)
page_builder.save_page()
refresh_page()
page_builder.verify_element_exists(data.element_def)
|
"""
Faça um algoritmo que leia o salário de um funcionário e mostre seu
novo salário, com 15% de aumento.
"""
salario = float(input('Salário atual do funcionário: R$'))
salario = salario * 1.15
print('Salário do funcionário com 15% de aumento: R${:.2f}'.format(salario))
|
##
# A collection of functions to search in lists.
#
##
# Returns the minimum element in a list of integers
def maximum_in_list(list):
# Your task:
# - Check if this function works for all possible integers.
# - Throw a ValueError if the input list is empty (see code below)
# if not list:
# raise ValueError('List may not be empty')
max_element = 0
# we loop trough the list and look at each element
for element in list:
if element > max_element:
max_element = element
return max_element
|
def set_fill_color(red, green, blue):
pass
def draw_rectangle(corner, other_corner):
pass
set_fill_color(red=161, green=219, blue=114)
draw_rectangle(corner=(105,20), other_corner=(60,60))
|
#!/usr/bin/env python3
#-*- encoding: UTF-8 -*-
def main():
salario = float(input("Salário-hora: R$ "))
tempo = int(input("Quantidade de horas trabalhadas: "))
ir = (salario * tempo) * (11/100)
inss = (salario * tempo)* (8/100)
sindicato = (salario * tempo) * (5/100)
print("+ Salário bruto: R$", (salario * tempo) )
print("- IR (11%): R$", ir)
print("- INSS(8%): R$", inss)
print("- Sindicato(5%): R$", sindicato)
print("Salário Líquido : R$ ", ((salario * tempo) - (ir + inss + sindicato)))
if __name__ == '__main__':
main()
|
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
def anchore_extra_deps(configure_go=True):
if configure_go:
go_rules_dependencies()
go_register_toolchains(version = "1.17.1")
|
def checkprime(value: int):
factor = 2
sqrt = value ** 0.5
while factor <= sqrt:
if value % factor == 0:
return False
factor += 1
return True
def sum_primes_under(n: int):
num = 2
sum = 0
while num < n:
if checkprime(num):
sum += num
num += 1
return(sum)
if __name__ == "__main__":
print(sum_primes_under(10))
|
month = input()
days = int(input())
cost_a = 0
cost_s = 0
if month == "May" or month == "October":
cost_a = days * 65
cost_s = days * 50
if 7 < days <= 14:
cost_s = cost_s * 0.95
if days > 14:
cost_s = cost_s * 0.7
elif month == "June" or month == "September":
cost_a = days * 68.70
cost_s = days * 75.20
if days > 14:
cost_s = cost_s * 0.8
elif month == "July" or month == "August":
cost_a = days * 77
cost_s = days * 76
if days > 14:
cost_a = cost_a * 0.9
print(f"Apartment: {cost_a:.2f} lv.")
print(f"Studio: {cost_s:.2f} lv.")
|
## creat fct
def raise_to_power(base_num, pow_num): ## fct take 2 input num
result = 1 ## def var call result is going to store result
for index in range(pow_num): ## specify for loop that loop through range of num
result = result * base_num ## math is going to be store in result
return result
print(raise_to_power(2,3))
|
""" Dado un carácter, construya un programa en Python para determinar si el
carácter es un dígito o no. """
def isDigit(char):
if len(char) > 1:
print('Debe ingresar un solo caracter')
return
code = ord(char)
if code > 47 and code < 58:
print('El carácter {} es un dígito'.format(char))
else:
print('El carácter {} no es un dígito'.format(char))
isDigit('01')
isDigit('0')
isDigit('a')
|
CENSUS_YEAR = 2017
COMSCORE_YEAR = 2017
N_PANELS = 500
N_CORES = 8
# income mapping for aggregating ComScore data to fewer
# categories so stratification creates larger panels
INCOME_MAPPING = {
# 1 is 0 to 25k
# 2 is 25k to 50k
# 3 is 50k to 100k
# 4 is 100k +
1: 1, # less than 10k and 10k-15k
2: 1, # 15-25k
3: 2, # 25-35k
4: 2, # 35-50k
5: 3, # 50-75k
6: 3, # 75-100k
7: 4, # 100k+
}
|
def maximo(a, b, c):
if a > b and a > c:
return a
elif b > c and b > a:
return b
elif c > a and c > b:
return c
elif a == b == c:
return a
|
#A loop statement allows us to execute a statement or group of statements multiple times.
def main():
var = 0
# define a while loop
while (var < 5):
print (var)
var = var + 1
# define a for loop
for var in range(5,10):
print (var)
# use a for loop over a collection
days = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
for d in days:
print (d)
# use the break and continue statements
for var in range(5,10):
#if (x == 7): break
#if (x % 2 == 0): continue
print (var)
#using the enumerate() function to get index
days = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
for i, d in enumerate(days):
print (i, d)
if __name__ == "__main__":
main()
|
valor = float(input('Quanto custa o produto? R$'))
avista = valor - (valor *10/100)
parcelado = valor + ( valor *12/100)
#desc = valor - novo
#print ( 'O valor com o desconto de 5% fica de R$ {}.' .format(desc))
print (' O poduto que custava R$ {}, com o desconto de 10% do pagamento avista sai a R$ {} e com o acrescimo de.12% no parcelado fica {}.'.format (valor, avista, parcelado))
'''Faça um algoritmo que leia o preço de um produto e mostre seu novo preço, com 5% de desconto.'''
|
KERNAL_FILENAME = "kernel"
INITRD_FILENAME = "initrd"
DISK_FILENAME = "disk.img"
BOOT_DISK_FILENAME = "boot.img"
CLOUDINIT_ISO_NAME = "cloudinit.img"
|
class DES(object):
## Init boxes that we're going to use
def __init__(self):
# Permutation tables and Sboxes
self.IP = (
58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7
)
self.IP_INV = (
40, 8, 48, 16, 56, 24, 64, 32,
39, 7, 47, 15, 55, 23, 63, 31,
38, 6, 46, 14, 54, 22, 62, 30,
37, 5, 45, 13, 53, 21, 61, 29,
36, 4, 44, 12, 52, 20, 60, 28,
35, 3, 43, 11, 51, 19, 59, 27,
34, 2, 42, 10, 50, 18, 58, 26,
33, 1, 41, 9, 49, 17, 57, 25
)
self.PC1 = (
57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27,
19, 11, 3, 60, 52, 44, 36,
63, 55, 47, 39, 31, 23, 15,
7, 62, 54, 46, 38, 30, 22,
14, 6, 61, 53, 45, 37, 29,
21, 13, 5, 28, 20, 12, 4
)
self.PC2 = (
14, 17, 11, 24, 1, 5,
3, 28, 15, 6, 21, 10,
23, 19, 12, 4, 26, 8,
16, 7, 27, 20, 13, 2,
41, 52, 31, 37, 47, 55,
30, 40, 51, 45, 33, 48,
44, 49, 39, 56, 34, 53,
46, 42, 50, 36, 29, 32
)
self.E = (
32, 1, 2, 3, 4, 5,
4, 5, 6, 7, 8, 9,
8, 9, 10, 11, 12, 13,
12, 13, 14, 15, 16, 17,
16, 17, 18, 19, 20, 21,
20, 21, 22, 23, 24, 25,
24, 25, 26, 27, 28, 29,
28, 29, 30, 31, 32, 1
)
self.S_boxes = {
0: (
14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13
),
1: (
15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9
),
2: (
10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12
),
3: (
7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14
),
4: (
2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3
),
5: (
12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13
),
6: (
4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12
),
7: (
13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11
)
}
self.P = (
16, 7, 20, 21,
29, 12, 28, 17,
1, 15, 23, 26,
5, 18, 31, 10,
2, 8, 24, 14,
32, 27, 3, 9,
19, 13, 30, 6,
22, 11, 4, 25
)
self._msg_bit_len = 64
self._key_bit_len = 64
self._round_function_shift_values = (42,36,30,24,18,12,6,0)
self._round_function_pack_values = (28,24,20,16,12,8,4,0)
self._slice_size_bytes = 8
self._hex_format_padding_string = '{0:016x}'
def encrypt(self, msg, key, decrypt=False):
# only encrypt single blocks
assert isinstance(msg, int) and isinstance(key, int)
assert not msg.bit_length() > self._msg_bit_len
assert not key.bit_length() > self._msg_bit_len
# permutate by table PC1
key = self.permutation_by_table(key, self._key_bit_len, self.PC1) # 64bit -> PC1 -> 56bit
# split up key in two halves
# generate the 16 round keys
key_half_len = key.bit_length()//2
C0 = key >> key_half_len
D0 = key & (2**key_half_len-1)
round_keys = self.generate_round_keys(C0, D0) # 56bit -> PC2 -> 48bit
msg_block = self.permutation_by_table(msg, self._msg_bit_len, self.IP)
L0 = msg_block >> self._msg_bit_len//2
R0 = msg_block & (2**(self._msg_bit_len//2)-1)
# apply the round function 16 times in following scheme (feistel cipher):
L_last = L0
R_last = R0
for i in range(1,17):
if decrypt: # just use the round keys in reversed order
i = 17-i
L_round = R_last
R_round = L_last ^ self.round_function(R_last, round_keys[i])
L_last = L_round
R_last = R_round
# concatenate reversed
cipher_block = (R_round<<self._msg_bit_len//2) + L_round
# final permutation
cipher_block = self.permutation_by_table(cipher_block, self._msg_bit_len, self.IP_INV)
return cipher_block
def permutation_by_table(self,block, block_len, table):
# quick and dirty casting to str
block_str = bin(block)[2:].zfill(block_len)
perm = []
for pos in range(len(table)):
perm.append(block_str[table[pos]-1])
return int(''.join(perm), 2)
def generate_round_keys(self, C0, D0):
# returns dict of 16 keys (one for each round)
round_keys = dict.fromkeys(range(0,17))
lrot_values = (1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1)
# left-rotation function
lrot = lambda val, r_bits, max_bits: \
(val << r_bits%max_bits) & (2**max_bits-1) | \
((val & (2**max_bits-1)) >> (max_bits-(r_bits%max_bits)))
key_half_len = C0.bit_length()
# initial rotation
C0 = lrot(C0, 0, key_half_len)
D0 = lrot(D0, 0, key_half_len)
round_keys[0] = (C0, D0)
# create 16 more different key pairsmsg_bit_len
for i, rot_val in enumerate(lrot_values):
i+=1
Ci = lrot(round_keys[i-1][0], rot_val, key_half_len)
Di = lrot(round_keys[i-1][1], rot_val, key_half_len)
round_keys[i] = (Ci, Di)
# round_keys[1] for first round
# [16] for 16th round
# dont need round_keys[0] anymore, remove
del round_keys[0]
# now form the keys from concatenated CiDi 1<=i<=16 and by applying PC2
for i, (Ci, Di) in round_keys.items():
Ki = (Ci << key_half_len) + Di
round_keys[i] = self.permutation_by_table(Ki, self._key_bit_len, self.PC2) # 56bit -> 48bit
return round_keys
def round_function(self, Ri, Ki):
# expand Ri from 32 to 48 bit using table E
Ri = self.permutation_by_table(Ri, self._key_bit_len//2, self.E)
# xor with round key
Ri ^= Ki
# split Ri into 8 groups of 6 bit
Ri_blocks = [((Ri & (0b111111 << shift_val)) >> shift_val) for shift_val in self._round_function_shift_values]
# interpret each block as address for the S-boxes
for i, block in enumerate(Ri_blocks):
# grab the bits we need
row = ((0b100000 & block) >> 4) + (0b1 & block)
col = (0b011110 & block) >> 1
# sboxes are stored as one-dimensional tuple, so we need to calc the index this way
Ri_blocks[i] = self.S_boxes[i][16*row+col]
# pack the blocks together again by concatenating
Ri_blocks = zip(Ri_blocks, self._round_function_pack_values)
Ri = 0
for block, lshift_val in Ri_blocks:
Ri += (block << lshift_val)
# another permutation 32bit -> 32bit
Ri = self.permutation_by_table(Ri, self._key_bit_len//2, self.P)
return Ri
def encrypt_and_return(self, msg, key):
return self._hex_format_padding_string.format(self.encrypt(msg, key))
def prove(self, key, msg):
print('key: {:x}'.format(key))
print('message: {:x}'.format(msg))
cipher_text = self.encrypt(msg, key)
print('encrypted: {:x}'.format(cipher_text))
plain_text = self.encrypt(cipher_text, key, decrypt=True)
print('decrypted: {:x}'.format(plain_text))
def encrypt_slice(self, msg, key):
#msg_bytes = bytes(msg,"utf-8")
msg_bytes = msg
msg_as_int = int.from_bytes(msg_bytes,byteorder='big')
encrypted_msg_as_int = self.encrypt(msg_as_int, key)
return self._hex_format_padding_string.format(encrypted_msg_as_int)
def decrypt_hex_slice(self, encrypted_msg_as_hex, key):
encrypted_msg_as_int = int(encrypted_msg_as_hex, 16)
decrypted_msg_as_int = self.encrypt(encrypted_msg_as_int, key, decrypt=True)
return self._hex_format_padding_string.format(decrypted_msg_as_int)
def prove(key, msg):
d = DES()
print('key: {:x}'.format(key))
print('message: {:x}'.format(msg))
cipher_text = d.encrypt(msg, key)
print('encrypted: {:x}'.format(cipher_text))
plain_text = d.encrypt(cipher_text, key, decrypt=True)
print('decrypted: {:x}'.format(plain_text))
if __name__ == "__main__":
print("Testing standard DES")
k = 0x0e329232ea6d0d73 # 64 bit
k2 = 0x133457799BBCDFF1
m = 0x8787878787878787
m2 = 0x0123456789ABCDEF
des_test = DES()
msg = """George Orwell coined the useful term unperson for creatures denied personhood because they dont abide by state doctrine.
We may add the term unhistory to refer to the fate of unpersons
expunged from history on similar grounds.
The unhistory of unpersons is illuminated by the fate of anniversaries.
"""
# print(des_test.encrypt(m, k))
# print(hex(des_test.encrypt(m2, k2)))
print(m)
m_enc = des_test.encrypt(m, k)
print(des_test.encrypt(m_enc, k, decrypt= True))
# def prove(key, msg):
# d = DES()
# print('key: {:x}'.format(key))
# print('message: {:x}'.format(msg))
# cipher_text = d.encrypt(msg, key)
# print('encrypted: {:x}'.format(cipher_text))
# plain_text = d.encrypt(cipher_text, key, decrypt=True)
# print('decrypted: {:x}'.format(plain_text))
# if __name__ == "__main__":
# k = 0x0e329232ea6d0d73 # 64 bit
# k2 = 0x133457799BBCDFF1
# m = 0x8787878787878787
# m2 = 0x0123456789ABCDEF
# prove(k, m)
# print('----------')
# prove(k2, m2)
|
"""
Build the CUDA-STREAM benchmark for multiple CUDA compute capabilities.
Make each build available as a SCI-F application.
"""
Stage0 += baseimage(image='nvcr.io/nvidia/cuda:9.1-devel-centos7', _as='devel')
# Install the GNU compiler
Stage0 += gnu(fortran=False)
# Install SCI-F
Stage0 += pip(packages=['scif'], upgrade=True)
# Download a single copy of the source code
Stage0 += packages(ospackages=['ca-certificates', 'git'])
Stage0 += shell(commands=['cd /var/tmp',
'git clone --depth=1 https://github.com/bcumming/cuda-stream.git cuda-stream'])
# Build CUDA-STREAM as a SCI-F application for each CUDA compute capability
for cc in ['35', '60', '70']:
binpath = '/scif/apps/cc{}/bin'.format(cc)
stream = scif(name='cc{}'.format(cc))
stream += comment('CUDA-STREAM built for CUDA compute capability {}'.format(cc))
stream += shell(commands=['nvcc -std=c++11 -ccbin=g++ -gencode arch=compute_{0},code=\\"sm_{0},compute_{0}\\" -o {1}/stream /var/tmp/cuda-stream/stream.cu'.format(cc, binpath)])
stream += environment(variables={'PATH': '{}:$PATH'.format(binpath)})
stream += label(metadata={'COMPUTE_CAPABILITY': cc})
stream += shell(commands=['stream'], _test=True)
stream += runscript(commands=['stream'])
Stage0 += stream
# Runtime stage
Stage1 += baseimage(image='nvcr.io/nvidia/cuda:9.1-base-centos7')
# Install SCI-F
Stage1 += pip(packages=['scif'], upgrade=True)
# Install runtime components from the first stage
Stage1 += Stage0.runtime()
|
# import math
# def longest_palindromic_contiguous(contiguous_substring):
# start_ptr = 0
# end_ptr = 0
# for i in range(len(contiguous_substring)):
# len_1 = expand_from_center(contiguous_substring, i, i)
# len_2 = expand_from_center(contiguous_substring, i, i + 1)
# max_len = max(len_1, len_2)
# if max_len > (end_ptr - start_ptr):
# start_ptr = i - math.floor((max_len - 1) / 2)
# end_ptr = i + math.floor((max_len / 2))
# return contiguous_substring.replace(contiguous_substring[start_ptr:end_ptr + 1], "")
# def expand_from_center(string_s, left_ptr, right_ptr):
# if (not string_s or left_ptr > right_ptr):
# return 0
# while (left_ptr >= 0 and right_ptr < len(string_s) and string_s[left_ptr] == string_s[right_ptr]):
# left_ptr -= 1
# right_ptr += 1
# return right_ptr - left_ptr - 1
# num_gemstones = int(input())
# gemstones_colors = "".join([str(color) for color in input().split(" ")])
# min_seconds = 0
# while gemstones_colors:
# print(gemstones_colors)
# gemstones_colors = longest_palindromic_contiguous(gemstones_colors)
# min_seconds += 1
num_gemstones = int(input())
#print("num_gemstones: {}".format(num_gemstones))
gemstones_colors = "".join([str(color) for color in input().split(" ")])
#print("string_length: {}".format(len(gemstones_colors)))
# num_seconds = [[]] * (num_gemstones + 1)
# print(num_seconds)
# for idx_i in range(num_gemstones + 1):
# for idx_j in range(num_gemstones + 1):
# print(num_seconds[idx_i])
# num_seconds[idx_i].append(0)
num_seconds = [[0 for x in range(num_gemstones + 1)] for y in range(num_gemstones + 1)]
#print(num_seconds[0])
for length in range(1, num_gemstones + 1):
idx_i = 0
idx_j = length - 1
while idx_j < num_gemstones:
if length == 1:
num_seconds[idx_i][idx_j] = 1
idx_i += 1
idx_j += 1
continue
new = num_seconds[idx_i][idx_j] = 1 + num_seconds[idx_i + 1][idx_j]
if (gemstones_colors[idx_i] == gemstones_colors[idx_i + 1]):
num_seconds[idx_i][idx_j] = min(1 + num_seconds[idx_i + 2][idx_j], num_seconds[idx_i][idx_j])
num_seconds[idx_i][idx_j] = min(new, num_seconds[idx_i][idx_j])
first_occurrence = idx_i + 2
while first_occurrence <= idx_j:
if (gemstones_colors[idx_i] == gemstones_colors[first_occurrence]):
new = num_seconds[idx_i + 1][first_occurrence - 1] + num_seconds[first_occurrence + 1][idx_j]
num_seconds[idx_i][idx_j] = min(new, num_seconds[idx_i][idx_j])
first_occurrence += 1
idx_i += 1
idx_j += 1
#print(num_seconds)
#print(num_seconds[0])
min_seconds = num_seconds[0][num_gemstones - 1]
print(min_seconds)
|
# unselectGlyphsWithExtension.py
f = CurrentFont()
for gname in f.selection:
if '.' in gname:
f[gname].selected = 0
|
# Problem: https://www.hackerrank.com/challenges/s10-weighted-mean/problem
# Score: 30
n = int(input())
arr = list(map(int, input().split()))
weights = list(map(int, input().split()))
print(round(sum([arr[x]*weights[x] for x in range(len(arr))]) / sum(weights), 1))
|
a = float(raw_input("What is the coefficients a? "))
b = float(raw_input("What is the coefficients b? "))
c = float(raw_input("What is the coefficients c? "))
d = b*b - 4.*a*c
if d >= 0.0:
print("Solutions are real")
elif b == 0.0:
print("Solutions are imaginary")
else:
print("Solutions are complex")
print("Finished!")
|
class Bank:
def __init__(self, bankName, address):
self.bankName = bankName
self.address = address
self.accounts = []
def toString(self):
print(str(Sparnord.__dict__) + " " + str(self.accounts) + "\n" + str(self.accounts[1].customer.name))
class Account:
def __init__(self, accNumber, dough, customer):
self.accNumber = accNumber
self.dough = dough
self.customer = customer
class Customer:
def __init__(self, name, email):
self.name = name
self.email = email
Sparnord = Bank('Sparnord', 'Hjørring')
AnneLise = Customer('Anne-Lise', 'AL@lol.dk')
ALAcc = Account(1, 3000, AnneLise)
Lars = Customer('Lars', 'Lars@email.dk')
ALars = Account(2, 5000, Lars)
Sparnord.accounts.append(ALAcc)
Sparnord.accounts.append(ALars)
Sparnord.toString()
|
def separador(mano):
lista_valor = []
lista_suit = []
valor_carta = {'2':1, '3':2, '4':3, '5':4, '6':5, '7':6, '8':7, '9':8, 'T':9, 'J':10, 'Q':11, 'K':12, 'A':13}
for i in mano.split(' '):
lista_valor.append(valor_carta.get(i[0]))
lista_suit.append(i[1])
return(sorted(lista_valor), lista_suit)
def Royal_Flush(mano):
valores = separador(mano)
if sorted(valores[0]) == [9,10,11,12,13]:
for i in ('H','S','C','D'):
if valores[1].count(i) == 5:
return True
else:
return False
return False
def Straight_Flush(mano):
valores = separador(mano)
for i in range(4):
if (valores[0][i + 1] - valores[0][i]) != 1:
return False
for i in ('H','S','C','D'):
if valores[1].count(i) == 5:
return True
return False
def Four_of_a_Kind(mano):
valores = separador(mano)
for i in range(14):
if valores[0].count(i) == 4:
return True
return False
def Full_House(mano):
valores = separador(mano)
for i in range(14):
if valores[0].count(i) == 3:
for j in range(14):
if valores[0].count(j) == 2:
return(True, i)
return(False, 0)
def Flush(mano):
valores = separador(mano)
for i in ('H','S','C','D'):
if valores[1].count(i) == 5:
return True
return False
def Straight(mano):
valores = separador(mano)
for i in range(4):
if (valores[0][i + 1] - valores[0][i]) != 1:
return False
return True
def Three_of_a_Kind(mano):
valores = separador(mano)
for i in range(14):
if valores[0].count(i) == 3:
return(True, i)
return(False, 0)
def Two_Pairs(mano):
valores = separador(mano)
for i in range(14):
if valores[0].count(i) == 2:
(valores[0]).remove(i)
for j in range(14):
if valores[0].count(j) == 2:
return True
return False
def One_Pair(mano):
valores = separador(mano)
for i in range(14):
if valores[0].count(i) == 2:
return(True, i)
return(False, 0)
def Crupier(mano):
if Royal_Flush(mano):
return(10, 0)
elif Straight_Flush(mano):
return(9, 0)
elif Four_of_a_Kind(mano):
return(8, 0)
elif Full_House(mano)[0]:
return(7, Full_House(mano)[1])
elif Flush(mano):
return(6, 0)
elif Straight(mano):
return(5, 0)
elif Three_of_a_Kind(mano)[0]:
return(4, Three_of_a_Kind(mano)[1])
elif Two_Pairs(mano):
return(3, 0)
elif One_Pair(mano)[0]:
return(2,One_Pair(mano)[1])
else:#High Card
valores = separador(mano)
return(1, max(valores[0]))
def draw_One_Pair(mano1, mano2): #draw_High_Card, Straight y Flush
valores1 = separador(mano1)[0]
valores2 = separador(mano2)[0]
while True:
c1 = max(valores1)
c2 = max(valores2)
valores1.remove(c1)
valores2.remove(c2)
if c1 > c2:
return(1)
elif c1 == c2:
pass
else:
return(2)
def draw_Full_House(c1, c2):
if c1 > c2:
return(1)
else:
return(2)
def mesa(m1, m2):
mano1 = Crupier(m1)
mano2 = Crupier(m2)
if mano1[0] > mano2[0]:
return(1)
elif mano1[0] < mano2[0]:
return(2)
else:
if mano1[0] in (1, 5, 6):
return(draw_One_Pair(m1, m2))
elif mano1[0] == 2:
if mano1[1] > mano2[1]:
return(1)
elif mano1[1] < mano2[1]:
return(2)
else:
return(draw_One_Pair(m1, m2))
elif mano1[0] in (7, 4):
if mano1[1] > mano2[1]:
return(1)
else:
return(2)
def main():
entrada = open('p054_poker.txt', 'r')
#salida = open('output.txt', 'w')
T = int(entrada.readline())
total = 0
for i in range(T):
xy = entrada.readline()
x = xy[0:14]
y = xy[15:29]
#salida.write("Caso #{}: Jugador {}\n".format(i+1, mesa(x, y)))
if mesa(x, y) == 1:
total += 1
print(total)
entrada.close()
#salida.close()
main()
#376
#[Finished in 0.2s]
|
substring=input()
word=input()
while substring in word:
word=word.replace(substring,"")
print(word)
|
class Solution(object):
def findAllConcatenatedWordsInADict(self, words):
"""
:type words: List[str]
:rtype: List[str]
"""
ans = []
self.wordSet = set(words)
for word in words:
self.wordSet.remove(word)
if self.search(word):
ans.append(word)
self.wordSet.add(word)
return ans
def search(self, word):
if word in self.wordSet:
return True
for idx in range(1, len(word)):
if word[:idx] in self.wordSet and self.search(word[idx:]):
return True
return False
|
# names tuple
names = ('Anonymous','Tazri','Focasa','Troy','Farha','Xenon');
print("names : ",names);
## adding value of names
updating = list(names);
updating.append('solus');
names = tuple(updating);
print("update names : ");
print(names);
|
AUTHOR = 'Name Lastname'
SITENAME = "The name of your website"
SITEURL = 'http://example.com'
TIMEZONE = ""
DISQUS_SITENAME = ''
DEFAULT_DATE_FORMAT = '%d/%m/%Y'
REVERSE_ARCHIVE_ORDER = True
TAG_CLOUD_STEPS = 8
PATH = ''
THEME = ''
OUTPUT_PATH = ''
MARKUP = 'md'
MD_EXTENSIONS = 'extra'
FEED_RSS = 'feeds/all.rss.xml'
TAG_FEED_RSS = 'feeds/%s.rss.xml'
GOOGLE_ANALYTICS = 'UA-XXXXX-X'
HTML_LANG = 'es'
TWITTER_USERNAME = ''
SOCIAL = (('GitHub', 'http://github.com/yourusername'),
('Twitter', 'http://twitter.com/yourusername'),)
|
instructor = {
"name":"Cosmic",
"num_courses":'4',
"favorite_language" :"Python",
"is_hillarious": False,
44 : "is my favorite number"
}
# Way to check if a key exists in a dict and returns True or False as a response
a = "name" in instructor
print(a)
b = "phone" in instructor
print(b)
c = instructor.values()
print(c)
# Direct in goes to find the given stuff in the key of dictionary if you want otherwise then you should go for .values() method defined above.
|
"""
Write a recursive function that implements the run-length compression technique
described in Run-Lenght Decoding Exercise.
Your function will take a list or a string as its only argument.
It should return the run-length compressed list as its only result.
Include a main program that reads a string from the user, compresses it, and displays the run-length encoded result.
Hint: You may want to include a loop inside the body of your recursive function.
"""
# START Definition of FUNCTION
def encodeList(list_to_encode):
# BASE CASE
if list_to_encode == []:
return []
elif len(list_to_encode) == 1:
return [list_to_encode[0], 1]
# RECURSIVE CASES
else:
tmp = []
tmp.append(list_to_encode[0])
tmp.append(1)
i = 1
while list_to_encode[i] == tmp[0]:
tmp[1] += 1
i += 1
if i == (len(list_to_encode)):
break
return tmp + encodeList(list_to_encode[i:len(list_to_encode)])
# END Definition of FUNCTION
# START MAIN PROGRAM
def main():
# LIST TESTING
all_list_to_encode = [
["A", "A", "A", "A", "A", "A", "B", "B",
"B", "B", "B", "C", "C", "C", "C", "D"],
["A", "A", "A", "B", "B", "B", "C", "C", "C", "D", "D"],
["A", "A", "A", "C", "C", "C"],
["A", "C", "C", "C"],
["A"]
]
# Computing and displaying the RESULTS
for list_to_encode in all_list_to_encode:
print("ORIGINAL DECODED LIST -> ", end="")
print(list_to_encode)
print("ENCODED LIST -> ", end="")
print(encodeList(list_to_encode))
if __name__ == "__main__":
main()
|
# Time: O(m * n)
# Space: O(1)
# 419
# Given an 2D board, count how many different battleships are in it.
# The battleships are represented with 'X's, empty slots are represented with
# '.'s.
# You may assume the following rules:
#
# You receive a valid board, made of only battleships or empty slots.
# Battleships can only be placed horizontally or vertically. In other words,
# they can only be made of the shape 1xN (1 row, N columns) or Nx1
# (N rows, 1 column),
# where N can be of any size.
# At least one horizontal or vertical cell separates between two battleships -
# there are no adjacent battleships.
#
# Example:
# X..X
# ...X
# ...X
# In the above board there are 2 battleships.
# Invalid Example:
# ...X
# XXXX
# ...X
# This is not a valid board - as battleships will always have a cell
# separating between them.
# Your algorithm should not modify the value of the board.
try:
xrange # Python 2
except NameError:
xrange = range # Python 3
class Solution(object):
def countBattleships(self, board):
"""
:type board: List[List[str]]
:rtype: int
"""
return sum(board[i][j] == 'X' and
(i==0 or board[i-1][j] != 'X') and
(j==0 or board[i][j-1] != 'X')
for i in range(len(board))
for j in range(len(board[0])))
def countBattleships2(self, board):
if not board or not board[0]:
return 0
cnt = 0
for i in xrange(len(board)):
for j in xrange(len(board[0])):
cnt += int(board[i][j] == 'X' and
(i == 0 or board[i - 1][j] != 'X') and
(j == 0 or board[i][j - 1] != 'X'))
return cnt
print(Solution().countBattleships([
'X..X',
'...X',
'...X'
])) # 2
print(Solution().countBattleships([
'...X',
'.XXX',
'...X'
])) # invalid board won't be given as input.
|
"""
This module pre-defines colors as defined by the W3C CSS standard:
https://www.w3.org/TR/2018/PR-css-color-3-20180315/
"""
ALICE_BLUE = (240, 248, 255)
ANTIQUE_WHITE = (250, 235, 215)
AQUA = (0, 255, 255)
AQUAMARINE = (127, 255, 212)
AZURE = (240, 255, 255)
BEIGE = (245, 245, 220)
BISQUE = (255, 228, 196)
BLACK = (0, 0, 0)
BLANCHED_ALMOND = (255, 235, 205)
BLUE = (0, 0, 255)
BLUE_VIOLET = (138, 43, 226)
BROWN = (165, 42, 42)
BURLYWOOD = (222, 184, 135)
CADET_BLUE = (95, 158, 160)
CHARTREUSE = (127, 255, 0)
CHOCOLATE = (210, 105, 30)
CORAL = (255, 127, 80)
CORNFLOWER_BLUE = (100, 149, 237)
CORNSILK = (255, 248, 220)
CRIMSON = (220, 20, 60)
CYAN = (0, 255, 255)
DARK_BLUE = (0, 0, 139)
DARK_CYAN = (0, 139, 139)
DARK_GOLDENROD = (184, 134, 11)
DARK_GRAY = (169, 169, 169)
DARK_GREEN = (0, 100, 0)
DARK_GREY = (169, 169, 169)
DARK_KHAKI = (189, 183, 107)
DARK_MAGENTA = (139, 0, 139)
DARK_OLIVE_GREEN = (85, 107, 47)
DARK_ORANGE = (255, 140, 0)
DARK_ORCHID = (153, 50, 204)
DARK_RED = (139, 0, 0)
DARK_SALMON = (233, 150, 122)
DARK_SEA_GREEN = (143, 188, 143)
DARK_SLATE_BLUE = (72, 61, 139)
DARK_SLATE_GRAY = (47, 79, 79)
DARK_SLATE_GREY = (47, 79, 79)
DARK_TURQUOISE = (0, 206, 209)
DARK_VIOLET = (148, 0, 211)
DEEP_PINK = (255, 20, 147)
DEEP_SKY_BLUE = (0, 191, 255)
DIM_GRAY = (105, 105, 105)
DIM_GREY = (105, 105, 105)
DODGER_BLUE = (30, 144, 255)
FIREBRICK = (178, 34, 34)
FLORAL_WHITE = (255, 250, 240)
FOREST_GREEN = (34, 139, 34)
FUCHSIA = (255, 0, 255)
GAINSBORO = (220, 220, 220)
GHOST_WHITE = (248, 248, 255)
GOLD = (255, 215, 0)
GOLDENROD = (218, 165, 32)
GRAY = (128, 128, 128)
GREEN = (0, 128, 0)
GREENYELLOW = (173, 255, 47)
GREY = (128, 128, 128)
HONEYDEW = (240, 255, 240)
HOTPINK = (255, 105, 180)
INDIANRED = (205, 92, 92)
INDIGO = (75, 0, 130)
IVORY = (255, 255, 240)
KHAKI = (240, 230, 140)
LAVENDER = (230, 230, 250)
LAVENDER_BLUSH = (255, 240, 245)
LAWNGREEN = (124, 252, 0)
LEMON_CHIFFON = (255, 250, 205)
LIGHT_BLUE = (173, 216, 230)
LIGHT_CORAL = (240, 128, 128)
LIGHT_CYAN = (224, 255, 255)
LIGHT_GOLDENROD_YELLOW = (250, 250, 210)
LIGHT_GRAY = (211, 211, 211)
LIGHT_GREEN = (144, 238, 144)
LIGHT_GREY = (211, 211, 211)
LIGHT_PINK = (255, 182, 193)
LIGHT_SALMON = (255, 160, 122)
LIGHT_SEA_GREEN = (32, 178, 170)
LIGHT_SKY_BLUE = (135, 206, 250)
LIGHT_SLATE_GRAY = (119, 136, 153)
LIGHT_SLATE_GREY = (119, 136, 153)
LIGHT_STEEL_BLUE = (176, 196, 222)
LIGHT_YELLOW = (255, 255, 224)
LIME = (0, 255, 0)
LIME_GREEN = (50, 205, 50)
LINEN = (250, 240, 230)
MAGENTA = (255, 0, 255)
MAROON = (128, 0, 0)
MEDIUM_AQUAMARINE = (102, 205, 170)
MEDIUM_BLUE = (0, 0, 205)
MEDIUM_ORCHID = (186, 85, 211)
MEDIUM_PURPLE = (147, 112, 219)
MEDIUM_SEA_GREEN = (60, 179, 113)
MEDIUM_SLATE_BLUE = (123, 104, 238)
MEDIUM_SPRING_GREEN = (0, 250, 154)
MEDIUM_TURQUOISE = (72, 209, 204)
MEDIUM_VIOLET_RED = (199, 21, 133)
MIDNIGHT_BLUE = (25, 25, 112)
MINT_CREAM = (245, 255, 250)
MISTY_ROSE = (255, 228, 225)
MOCCASIN = (255, 228, 181)
NAVAJO_WHITE = (255, 222, 173)
NAVY = (0, 0, 128)
OLD_LACE = (253, 245, 230)
OLIVE = (128, 128, 0)
OLIVE_DRAB = (107, 142, 35)
ORANGE = (255, 165, 0)
ORANGE_RED = (255, 69, 0)
ORCHID = (218, 112, 214)
PALE_GOLDENROD = (238, 232, 170)
PALE_GREEN = (152, 251, 152)
PALE_TURQUOISE = (175, 238, 238)
PALE_VIOLET_RED = (219, 112, 147)
PAPAYA_WHIP = (255, 239, 213)
PEACH_PUFF = (255, 218, 185)
PERU = (205, 133, 63)
PINK = (255, 192, 203)
PLUM = (221, 160, 221)
POWDER_BLUE = (176, 224, 230)
PURPLE = (128, 0, 128)
RED = (255, 0, 0)
ROSY_BROWN = (188, 143, 143)
ROYAL_BLUE = (65, 105, 225)
SADDLE_BROWN = (139, 69, 19)
SALMON = (250, 128, 114)
SANDY_BROWN = (244, 164, 96)
SEA_GREEN = (46, 139, 87)
SEASHELL = (255, 245, 238)
SIENNA = (160, 82, 45)
SILVER = (192, 192, 192)
SKY_BLUE = (135, 206, 235)
SLATE_BLUE = (106, 90, 205)
SLATE_GRAY = (112, 128, 144)
SLATE_GREY = (112, 128, 144)
SNOW = (255, 250, 250)
SPRING_GREEN = (0, 255, 127)
STEEL_BLUE = (70, 130, 180)
TAN = (210, 180, 140)
TEAL = (0, 128, 128)
THISTLE = (216, 191, 216)
TOMATO = (255, 99, 71)
TURQUOISE = (64, 224, 208)
VIOLET = (238, 130, 238)
WHEAT = (245, 222, 179)
WHITE = (255, 255, 255)
WHITE_SMOKE = (245, 245, 245)
YELLOW = (255, 255, 0)
YELLOW_GREEN = (154, 205)
|
#!/usr/bin/python3
""" Transforms a list into a string. """
l = ["I", "am", "the", "law"]
print(" ".join(l))
|
class Solution:
def twoSum(self, numbers, target):
res = None
left = 0
right = len(numbers) - 1
while left < right:
result = numbers[left] + numbers[right]
if result == target:
res = [left + 1, right + 1]
break
elif result < target:
left += 1
elif result > target:
right -= 1
return res
if __name__ == '__main__':
soul = Solution()
print(soul.twoSum([2, 7, 11, 15], 9))
|
class CaesarShiftCipher:
def __init__(self, shift=1):
self.shift = shift
def encrypt(self, plaintext):
return ''.join(
[self.num_2_char((self.char_2_num(letter) + self.shift) % 26) for letter in plaintext.lower()]
).upper()
def decrypt(self, ciphertext: str) -> str:
return ''.join(
[self.num_2_char((self.char_2_num(letter) - self.shift) % 26) for letter in ciphertext.lower()]
).lower()
@staticmethod
def char_2_num(character: str) -> int:
return ord(character.lower()) - ord('a')
@staticmethod
def num_2_char(number: int) -> str:
return chr(number + ord('a'))
|
# sToken和sEncodingAESKey来自于企业微信创建的应用
# sCorpID为企业微信号
sToken = ""
sEncodingAESKey = ""
sCorpID = ""
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.