content stringlengths 7 1.05M |
|---|
'''
A linked list of length n is given such that each node contains an additional random pointer, which could point to any node in the list, or null.
Construct a deep copy of the list. The deep copy should consist of exactly n brand new nodes, where each new node has its value set to the value of its corresponding ori... |
# logic:
# a function which would accept a number
#the number would be tried agains all the positive numbers less than itself excpet 0 wo see if it is a prime number
#the result would be returned
def prime(number):
divi=[ i for i in range(1,number) if number%i==0]
if number==1:
return print('the number... |
def stop():
pass
class Load():
def __init__(self, chan):
self.channel = chan.channel
self.all_channels = chan.owner.channels
self.botnick = chan.botnick
self.sendmsg = chan.sendmsg
self.name = "broadcast"
def run(self, ircmsg):
if ircmsg.lowe... |
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
longest, current = "", ""
for j in range(len(s)):
i = current.find(s[j])
if i >= 0:
current = current[i + 1:]
current += s[j]
if len(longest) < len(current):
... |
"""ex097 - Um print especial
Faca um programa que tenha uma funcao chamada escreva(), que receba um texto
qualquer como parametro e mostre uma mensagem com tamanho adaptavel.
Ex:
escreva("Ola, Mundo!")
saida:
~~~~~~~~~~~~~~
Ola, Mundo!
~~~~~~~~~~~~~~"""
def escreva(msg):
tam = len(msg) + 4
print("~" * tam)
... |
'''
.. _snippets-pythonapi-metadata:
Python API: Managing Metadata
=============================
This is the tested source code for the snippets used in
:ref:`pythonapi-metadata`. The config file we're using in this example
can be downloaded
:download:`here <../../examples/snippets/resources/datafs_mongo.yml>`.
Se... |
#!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software... |
"""Constants used by yggdrasil."""
# ======================================================
# Do not edit this file past this point as the following
# is generated by yggdrasil.schema.update_constants
# ======================================================
LANG2EXT = {
'R': '.R',
'c': '.c',
'c++': '.cpp... |
#
# PySNMP MIB module NV-ATKK-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NV-ATKK-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:25:52 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... |
# https://www.codewars.com/kata/521c2db8ddc89b9b7a0000c1/
'''
Instructions :
Snail Sort
Given an n x n array, return the array elements arranged from outermost elements to the middle element, traveling clockwise.
array = [[1,2,3],
[4,5,6],
[7,8,9]]
snail(array) #=> [1,2,3,6,9,8,7,4,5]
For better u... |
"""
问题: 统计所有小于非负数整数 n 的质数的数量。
示例:
输入: 10
输出: 4
解释: 小于 10 的质数一共有 4 个, 它们是 2, 3, 5, 7 。
"""
class Solution:
def countPrimes(self, n):
"""
:type n: int
:rtype: int
"""
bit_arr = [0 for i in range(n)]
count = 0
index = 2
while index < n:
if ... |
command = '/home/slunk/code/racks_project/env/bin/gunicorn'
pythonpath = '/home/slunk/code/racks_project/racks'
bind = '127.0.0.1:8001'
workers = 5
user = 'slunk'
limit_request_fields = 32000
limit_request_field_size = 0
raw_enw = 'DJANGO_SETTINGS_MODULE=racks.settings'
|
# Faça um programa que leia o nome de uma pessoa e mostre uma mensagem de boas-vindas. #
nome = str(input('Digite seu nome: '))
print(f'Ola {nome} Seja bem vindo(a)')
|
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... |
def calculate_max_profit(prices):
'''Calculates the maximum profit given a list of prices of a stock
by buying and selling exactly once.
>>> calculate_max_profit([9, 11, 8, 5, 7, 10])
5
>>> calculate_max_profit([10, 9, 8, 5, 2])
0
'''
smallest_element_so_far = float('inf'... |
degf = float(input("Zadej stupně: "))
deg = int(degf)
minf = (degf-deg)*60
min = int(minf)
sec = (minf-min)*60
print("Výsledek:",deg,"stupňů",min,"minut",sec,"vteřin")
|
class FailedRequestingEcoCounterError(Exception):
pass
class PublishError(Exception):
pass
|
fname = input('Enter file: ')
try:
fhandle = open(fname, 'r')
except:
print('No such file.')
quit()
hrs = dict()
for line in fhandle:
if not line.startswith('From '):
continue
tmp = line.find(':')
hour = line[tmp-2:tmp]
hrs[hour] = hrs.get(hour, 0) + 1
for (k, v) in sorted(hrs.it... |
sides = {}
data = input()
while not data == "Lumpawaroo":
keep_it = True
idk = False
if "|" in data:
side, name = data.split(" | ")
if side in sides:
for person in sides[side]:
if name in person:
idk = True
break
... |
class Customer:
#function to update the details of the customer
def __init__(self,name,email):
self.name = name
self.email = email
self.purchases = []
#function to have a customer make a purchase
def purchase(self,inventory, product):
inventory_dict = inventory.i... |
"""
Copyright (c) 2020, Souvik Ghosh.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on Mar 15, 2020
@author
"""
def Solve():
m = []
for j in range(1, i):
if i % j == 0:
m.append(j)
yiel... |
samples = [
{
"input": {
"array": [5, 1, 22, 25, 6, -1, 8, 10],
},
"output": [1, 6, -1, 10],
},
]
|
def process_flags(all_flags):
"""
Argument:
Return:
list of
"""
fixed_map = {'fixed': True, 'param': False}
flags = [Flags(name, fixed_map[flag_type]) for name, flag_type in all_flags.items()]
return flags
def process_hparams(all_hparams):
"""
Argument:
Return:
""... |
def doNothing(rawSolutions):
#TODO - accept some sort of number QoI from somewhere
number_qoi = 1
list_of_qoi = []
for _ in range(number_qoi):
qoi_values = []
for raw_solution in rawSolutions:
qoi_values.append(raw_solution)
list_of_qoi.append(qoi_values)
return... |
class SaleorAppError(Exception):
"""Generic Saleor App Error, all framework errros inherit from this"""
class InstallAppError(SaleorAppError):
"""Install App error"""
class ConfigurationError(SaleorAppError):
"""App is misconfigured"""
|
class Plan:
def __init__(self):
self.tasks = []
def add_task(self, task):
assert task.task_id is None
self.tasks.append(task)
def take_tasks(self):
tasks = self.tasks
self.tasks = []
return tasks
|
# Program : Linear search in an array.
# Input : size = 5, array = [1, 3, 5, 2, 4], target = 5
# Output : 2
# Explanation : The index of the element 5 is 2.
# Language : Python3
# O(n) time | O(1) space
def linear_search(size, array, target):
# Do for each element in the array.
for i in range(size):
#... |
# -*- coding: utf-8 -*-
"""
Used to space/separate choices group
"""
class Separator:
line = '-' * 15
def __init__(self, line=None):
if line:
self.line = line
def __str__(self):
return self.line
|
def pego_correndo(speed, is_birthday):
retorno = 0
if is_birthday == True:
if speed <= 65:
retorno = 0
elif 65 < speed <= 85 :
retorno = 1
elif speed > 85 :
retorno = 2
elif is_birthday == False:
if speed <= 60 :
retorno = 0
elif 60 < speed <= 80 :
retorno = 1
elif speed > 80 :
retorno ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@created: 11.01.21
@author: felix
"""
|
n = int(input())
if 0 <= n <= 1000:
if n == 0:
print(n, "программистов", sep=" ")
elif n % 100 >= 10 and n % 100 <= 20:
print(n, "программистов", sep=" ")
elif n % 10 == 1:
print(n, "программист", sep=" ")
elif n % 10 >= 2 and n % 10 <= 4:
print(n, "программиста", sep=" ... |
class Solution:
def checkInclusion(self, s1: str, s2: str) -> bool:
s1_len = len(s1)
s2_len = len(s2)
flag = False
for i,v in enumerate(s2):
for k in s1:
if k != v:
flag = False
break;
else:
... |
my_list = ["one", 2, "three"]
print(my_list)
print(type(my_list))
l = [] # an empty list
|
# -*- coding: utf-8 -*-
# 列表元素之和-递归写法
def sum(list):
if list == []:
return 0
return list[0] + sum(list[1:])
|
class Solution:
def minimumDeviation(self, nums: List[int]) -> int:
# since heapq is a min-heap
# we use negative of the numbers to mimic a max-heap
evens = []
minimum = inf
for num in nums:
if num % 2 == 0:
evens.append(-num)
minim... |
def scanstring(s, end, strict=True, _b=BACKSLASH, _m=STRINGCHUNK.match):
"""Scan the string s for a JSON string. End is the index of the
character in s after the quote that started the JSON string.
Unescapes all valid JSON string escape sequences and raises ValueError
on attempt to decode an invalid string. If stri... |
#
# PySNMP MIB module HPN-ICF-TE-TUNNEL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-TE-TUNNEL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:41:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... |
co1 = 0
co2 = 0
co3 = 0
while True:
sexo = 'ana'
idade = -1
lu = 'ana'
print('=='*10)
while sexo not in 'fm':
sexo = str(input('\nQual seu sexo?[F/M]: ')).lower()
while 100 < idade or idade < 0:
idade = int(input('Qual sua idade?: '))
if idade >= 18:
co1 += 1
if s... |
# Escreva um programa que converta uma temperatura digitando em
# graus Celsius e converta para graus Fahrenheit.
temp_c = float(input('Temperatura em Celsius: '))
temp_f = (temp_c * 9)/5 + 32
print(f'{temp_c}ºC = {temp_f}ºF')
|
class Solution:
def swapNodes(self, head: ListNode, k: int) -> ListNode:
n1, n2, p = None, None, head
while p:
k -= 1
if n2:
n2 = n2.next
if k == 0:
n1 = p
n2 = head
p = p.next
n1.val, n2.val = n... |
# # Define a generator
# def test():
# print("phase one")
# yield 5
# print("phase two")
# yield 10
# # call and return the generator
# gen=test()
# # print(gen) #"only print the object of generator"
# # work with for-loop
# for data in gen:
# print(data)
def generateEven(maxNumber):
number ... |
c, r = 'ABCDEFGH', '12345678'
cell = input("Which chess square? ")
cc, cr = c.index(cell[0]), r.index(cell[1])
print("black") if (int(cc)+int(cr)) % 2 == 0 else print("white")
|
"""
An example FDW driver for accessing apps built using
`Falcon-API <https://github.com/Opentopic/falcon-api>`.
"""
__author__ = 'Jan Waś (jan.was@opentopic.com)'
__license__ = 'MIT'
|
#!/usr/bin/env python3
def encrypt(text, s):
result = ""
# transverse the plain text
for i in range(len(text)):
char = text[i]
# Encrypt uppercase characters in plain text
if (char.isupper()):
result += chr((ord(char) + s-65) % 26 + 65)
# Encrypt lowercase charac... |
# explicit conversion
a="32"
b=str(32)
print(a+b)
a=int(a)
b=int(b)
print(a+b)
# python does not convert implicitly in these cases |
def part_1(data):
return sum(int(line) for line in data)
def part_2(data):
cumulative = 0
reached = {0}
while True:
for line in data:
cumulative += int(line)
if cumulative in reached:
return cumulative
reached.add(cumulative)
if __name__ ==... |
# Массив частей речи для отзеркаливания
reflections = {
#----Личные местоимоения--------
"я": "ты", "ты": "я",
"мы": "вы", "вы": "мы",
"меня": "тебя", "тебя": "меня",
"мне": "тебе","тебе": "мне",
"мой": "твой", "твой": "мой",
"моя": "твоя", "твоя": "моя",
"мое": "т... |
class Resistor:
def __init__(self, p, R):
self.type = 'R'
self.p = p
self.p1 = p.split('-')[0]
self.p2 = p.split('-')[1]
self.R = R
self.Y = 1/R
self.v = []
self.ic = []
def resolveInitialConditions(self):
# self.v.append(0)
# se... |
def read_file(file_path):
with open(file_path) as file:
return file.read().split("|")
def parser_list(questions):
return [question.strip() for question in questions if question.strip()]
|
def main():
phrase = input("Choose a phrase: ")
# Write your code here
main() |
COMPONENTS_BANNER_DOMESTIC = 'eu-exit-banner-domestic'
COMPONENTS_BANNER_INTERNATIONAL = 'eu-exit-banner-international'
EUEXIT_DOMESTIC_NEWS = 'eu-exit-news'
EUEXIT_INTERNATIONAL_NEWS = 'international-eu-exit-news'
EUEXIT_DOMESTIC_FORM = 'eu-exit-domestic'
EUEXIT_FORM_SUCCESS = 'eu-exit-form-success'
EUEXIT_INTERNATIO... |
class APIException(Exception):
"""General exception thrown by an API view, contains a message for the JSON response."""
def __init__(self, message, status_code=400) -> None:
super().__init__(self)
self.message: str = message
self.status_code: int = status_code
def __repr__(self) ->... |
def extractFujitranslationWordpressCom(item):
'''
Parser for 'fujitranslation.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('My Wife is a Martial Alliance Head', ... |
class Solution:
def subarraySum(self, nums: List[int], k: int) -> int:
# We will construct an additional dictionary to keep the sum of
# all the elements before the index, for example
# given nums = [1, 4, 0, 3, 2]
# the element sum list: sum_list = [0, 1, 5, 5, 8, 10]
# Then... |
# -*- coding: utf-8 -*-
"""SF-TOOLS PACKAGE INFO
This module provides some basic information about the sf_tools package.
:Author: Samuel Farrens <samuel.farrens@cea.fr>
:Version: 2.0.4
"""
# Package Version
version_info = (2, 0, 4)
__version__ = '.'.join(str(c) for c in version_info)
__about__ = ('sf_tools \n\n ... |
"""Hershey Vector Font.
See http://paulbourke.net/dataformats/hershey/
"""
# print(hershey.simplex[0])
simplex = [
[0,16, # Ascii 32
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,... |
chars_to_remove = [',', '.', '!', ':', ';', '-', ' ', '?']
def get_longest_palendromes(text):
if not text: return []
if len(text) <= 2: return [text]
palendromes = []
for window_size in range(len(text), 1, -1):
num_shifts = len(text) - window_size
for start_index in range(0, num_shif... |
"""Problem 30 of https://projecteuler.net"""
def problem_30():
"""Solution to problem 30."""
count = 0
# No solution can exist above 9^5 * 6.
for number in range(2, (9 ** 5) * 6):
digit_sum = sum([int(x) ** 5 for x in str(number)])
if number == digit_sum:
count += number
... |
# %%
#######################################
# THIS IS NOT THE SAME AS: my_pcap.getlayer(TCP)
def scapyget_tcp(packet_list: scapy.plist.PacketList):
result_list = [ pckt for pckt in packet_list if pckt.haslayer('TCP')]
return PacketList(result_list)
|
# SPDX-License-Identifier: MIT
# Copyright (C) 2020-2021 Mobica Limited
"""Provide error handling helpers"""
NO_ERROR = 0
CONFIGURATION_ERROR = 1
REQUEST_ERROR = 2
FILESYSTEM_ERROR = 3
INTEGRATION_ERROR = 4 # Indicates that some assumption about how the Jira works seems to be false
INVALID_ARGUMENT_ERROR = 5
INPUT_DA... |
def change_variation(change: float) -> float:
"""Helper to convert change variation
Parameters
----------
change: float
percentage change
Returns
-------
float:
converted value
"""
return (100 + change) / 100
def calculate_hold_value(changeA: float, changeB: float... |
# -*- coding: utf-8 -*-
def formatter(name=None):
def decorate(func):
func._formatter = name
return func
return decorate
|
_UNSET = object()
class PyErr:
def __init__(self, type=_UNSET, value=_UNSET, traceback=_UNSET):
if not(type is _UNSET):
self.type = type
if not(value is _UNSET):
self.value = value
if not(traceback is _UNSET):
self.traceback = traceback
|
def repeat_string(string, times):
return string * times
text = input()
number = int(input())
result = repeat_string(text, number)
print(result)
|
#Ask the user for a string and print out whether this string is a palindrome or not.
# (A palindrome is a string that reads the same forwards and backwards.)
str = input("Let's have a string, shall we?")
palindrome = str[::-1]==str
if palindrome:
print(str,"is a palindrome")
else:
print(str, "is not a palindr... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 12 14:43:23 2017
@author: Nadiar
"""
def deep_reverse(L):
""" assumes L is a list of lists whose elements are ints
Mutates L such that it reverses its elements and also
reverses the order of the int elements in every element of L.
... |
# Problem URL: https://leetcode.com/problems/reverse-integer/
class Solution:
def reverse(self, x: int) -> int:
# Handling Negative Input
neg_flag = 0
if x<0:
neg_flag = 1
string = [i for i in str(x)]
if neg_flag == 1:
string = string[1:]
... |
def binaryToDecimal(arr):
arr = str(arr)
arr = arr[::-1]
length = len(arr)-1
if int(arr[length]) != 1:
length -= 1
count = 0
for i in range(length,-1,-1):
count += int(arr[i])*(2**i)
return count
def binaryToDecimal2(value):
return int(str(value),2)
def binaryToDeci... |
"""
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
n,k=map(int,input().split())
a=[]
for _ in[0]*n:
x,y=map(int,input().split())
a+=[51*(100-x)+y]
a=sorted(a)
r=i=l=0
while i<n and (a[i]==l or i<k):
if a[i]!=l:r=0
r+=1
l=a[i]
i+=1
print(r)
|
#/ <reference path="./testBlocks/mb.ts" />
item = images.createBigImage("""
. . . . . . . . . . . . . . .
. # # # . . # # # . . # # # .
. # . # . . # . # . . # . # .
. # # # . . # # # . . # # # .
. . . . . . . . . . . . . . .
""")
z = images.createBigImage("""
. .
. ... |
"""
Sort method works only for lists
Sorted functions works for any iterable
you can specify the params reverse in both of then
and you can also specify a key
IMPORTANT functions never modify args
"""
list = ["abacate", "kiwi", "caju", "damasco", "coco"]
s = sorted(list, reverse=True)
print(s)
|
# coding=utf-8
class DijkstraAlgorithm:
def find_min_cost_vertice(self, costs: dict, processed: set):
""" Find the minimum cost and not processed vertice in costs."""
not_processed_vertice_costs = {
vertice: cost for vertice, cost in costs.items()
if vertice not in processe... |
print("********** BIENVENIDO AL MENU INTERACTIVO ********** ")
print("Que opcion desea Seleccionar? ")
print("1)Saludar")
print("2)Sumar dos numeros")
print("3)Salir del sistema")
Opcion = int( input() )
while Opcion<=3:
if (Opcion==1):
nombre = input("Enter your name : ")
print("Hola, mucho gusto... |
def bicepup():
i01.setArmSpeed("right", 1.0, 1.0, 1.0, 1.0)
i01.rightArm.bicep.attach()
i01.rightArm.bicep.moveTo(180)
sleep(1)
i01.rightArm.bicep.detach()
|
class Car:
def __init__(self, maker, model):
carManufacturer = maker
carModel = model
carModel = ""
carManufacturer = ""
carYear = 0
def setModel(self, model):
self.carModel = model
def setManufacturer(self, manufacturer):
self.carManufacturer = manufacturer... |
def atividade():
print( "Olá professor" )
atividade()
|
"""
Character Picture Grid.
Makes a heart.
"""
grid = [['.', '.', '.', '.', '.', '.'],
['.', 'O', 'O', '.', '.', '.'],
['O', 'O', 'O', 'O', '.', '.'],
['O', 'O', 'O', 'O', 'O', '.'],
['.', 'O', 'O', 'O', 'O', 'O'],
['O', 'O', 'O', 'O', 'O', '.'],
['O', 'O', 'O', 'O', '.'... |
def hash_key(string):
multiplication = 1
for i in string:
multiplication *= ord(i)
return (multiplication % 97)
for i in range(int(input())):
str1, str2 = input().split()
str1_key = hash_key(str1)
str2_key = hash_key(str2)
if str1_key == str2_key:
print("YES")
else:
... |
#!/usr/bin/env python
"""Tests for `oops_fhir` package."""
def test_test():
"""Sample pytest test function with the pytest fixture as an argument."""
assert True
|
def sim_shift(ref, ref_center, ref_length, shift=0, rec=None, padding=False):
"""
:param ref: Reference signal.
:param ref_center: Where to center the simulated signal set.
:param ref_length: The length of the signal equidistant around center.
:param shift: How much shift should be added to the sim... |
{
"targets": [{
"target_name": "opendkim",
"sources": [
"src/opendkim_body_async.cc",
"src/opendkim_chunk_async.cc",
"src/opendkim_chunk_end_async.cc",
"src/opendkim_eoh_async.cc",
"src/opendkim_eom_async.cc",
"src/opendkim_flus... |
# Objective
# Today, we're delving into Inheritance. Check out the attached tutorial for learning materials and an instructional video.
# Task
# You are given two classes, Person and Student, where Person is the base class and Student is the derived class. Completed code for Person and a declaration for Student are pr... |
class ChannelDoesNotExist(Exception):
pass
class LevelDoesNotExist(Exception):
pass
class HandlerError(Exception):
pass
|
# -*- coding: utf-8 -*-
################################################
#
# URL:
# =====
# https://leetcode.com/problems/PROBLEM_TITLE/
#
# DESC:
# =====
# PROBLEM DESCRIPTION
################################################
class Solution:
def method(self) -> int:
return 0
|
"""Checks view access for Permissions"""
METHODS = (
'GET',
'POST',
)
# pylint: disable=too-few-public-methods
class CheckAcess:
"""
Checks the permissions for Request.
"""
def __init__(self, request, permissions):
self.request = request
self.permissions = permissions
def ... |
# -*- coding: utf-8 -*-
class _CommitOnSuccess(object):
def __init__(self, session):
self.session = session
def __enter__(self):
self.transaction = self.session.begin_nested()
def __exit__(self, exc_type, exc_value, traceback):
try:
if exc_value is not None:
... |
#
# PySNMP MIB module IEEE8021-EVB-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IEEE8021-EVB-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:52:20 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
c,b=map(int,input().split())
x=[*map(int,input().split())]
oioi=set()
ans=0
oioi.add(0)
for i in x:
tmp=[]
for j in oioi:
tmp.append(i+j)
if i+j<=c: ans=max(ans,i+j)
for j in tmp:
oioi.add(j)
print(ans) |
#!/usr/bin/env python
NAME = 'Naxsi'
def is_waf(self):
# Sometimes naxsi waf returns 'x-data-origin: naxsi/waf'
if self.matchheader(('X-Data-Origin', '^naxsi(.*)?')):
return True
# Found samples returning 'server: naxsi/2.0'
if self.matchheader(('server', 'naxsi(.*)?')):
return True
for att... |
consumer_key = 'v5bb7HD9PmYTvXuCBgCwa44qZ'
consumer_secret = 'tlONgznY4y9S0E4D9JkDVABGGT8ACVgOySt3CPpsKUxU9IE2RS'
twitter_token = '2888299528-05kwbmRfd82mneeJg2EMGhcMXXlFci6yaBWjxCA'
twitter_token_secret = 'h0WLEeq7PNkC1Rd56eyM1oxi1KL4S9sXP8kigYxEB527B'
|
def ip_to_int32(ip):
temp=""
ip=ip.split(".")
for i in ip:
temp+="{0:08b}".format(int(i))
return int(temp,2) |
array = []
with open('input-p22.txt') as f:
array = f.readlines()
array = array[0].split(',')
array.sort()
print(array)
asciA = ord('A')
print("ascii A:", asciA)
answer = 0
for i in range(0, len(array)):
sum = 0
for letter in array[i]:
if letter == '"':
continue
print(letter, ... |
# Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def bigIntegerCpp():
http_archive(
name="big_integer_cpp" ,
build_file="//bazel/deps/big_integer_cpp:build.BUILD" ,
... |
# -*- coding: utf-8 -*-
"""
演習4
■ 仕様
以下のアスキーアートを表示するコンソールプログラムを作成してください。
■ 実行画面
■■■■■■■■■■
□□□□□□□□□□
■■■■■■■■■■
□□□□□□□□□□
■■■■■■■■■■
□□□□□□□□□□
"""
# 変数初期化
filled = "■"
blank = "□"
# カウンター変数(ループのカウントする為)
count = 0
# 0~6回ループする (6行作る為)
for i in range(0, 6):
#)0~10回ループする(10文字入れる為)
for j in range(0, 10):
... |
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'file',
'isolated',
'json',
'path',
'runtime',
'step',
]
def RunSteps(api):
# Inspect the associated isolated server.
... |
#!-*- encoding=utf-8
class MegNoriBaseException(Exception):
pass
class NoAvaliableVolumeError(MegNoriBaseException):
pass
class PutFileException(MegNoriBaseException):
pass
class GetFileException(MegNoriBaseException):
pass
|
print("""O cardápio da lanchonete é o seguinte:
Especificação Código Preço
Cachorro Quente 100 R$ 1,20
Bauru Simples 101 R$ 1,30
Bauru com ovo 102 R$ 1,50
Hambúrguer 103 R$ 1,20
Cheeseburguer 104 R$ 1,30
Refrigerante 105 R$ 1,00
""")
perg... |
{
'target_defaults': {
'conditions': [
['OS != "win"', {
'defines': [
'_GNU_SOURCE',
],
'conditions': [
['OS=="solaris"', {
'cflags': ['-pthreads'],
'ldlags': ['-pthreads'],
}, {
'cflags': ['-pthread'],
'ld... |
#
# PySNMP MIB module CHEETAH-TRAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CHEETAH-TRAP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:48:47 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
def imagecreate():
image = open("theimage.ppm", "w")
image.write("P3\n")
image.write("500 500\n")
image.write("255\n\n")
for i in range(500):
curline = ""
for j in range(500):
if i > 250:
i = 250 - (i % 250)
if j > 250:
j = 250 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.