content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
with open("input", 'r') as f:
lines = f.readlines()
# lines = [x.strip("\n") for x in lines]
lines.append("\n")
total = 0
answers = set()
for line in lines:
if line == "\n":
total += len(answers)
answers = set()
else:
for letter in line.strip("\n"):
answers.add(letter)
print("Total: {}".format(total))
| with open('input', 'r') as f:
lines = f.readlines()
lines.append('\n')
total = 0
answers = set()
for line in lines:
if line == '\n':
total += len(answers)
answers = set()
else:
for letter in line.strip('\n'):
answers.add(letter)
print('Total: {}'.format(total)) |
#pass is just a placeholder which does nothing
def func():
pass
for i in [1,2,3,4,5]:
pass | def func():
pass
for i in [1, 2, 3, 4, 5]:
pass |
del_items(0x800A0E8C)
SetType(0x800A0E8C, "void VID_OpenModule__Fv()")
del_items(0x800A0F4C)
SetType(0x800A0F4C, "void InitScreens__Fv()")
del_items(0x800A103C)
SetType(0x800A103C, "void MEM_SetupMem__Fv()")
del_items(0x800A1068)
SetType(0x800A1068, "void SetupWorkRam__Fv()")
del_items(0x800A10F8)
SetType(0x800A10F8, "... | del_items(2148142732)
set_type(2148142732, 'void VID_OpenModule__Fv()')
del_items(2148142924)
set_type(2148142924, 'void InitScreens__Fv()')
del_items(2148143164)
set_type(2148143164, 'void MEM_SetupMem__Fv()')
del_items(2148143208)
set_type(2148143208, 'void SetupWorkRam__Fv()')
del_items(2148143352)
set_type(21481433... |
def mergeSort(a, temp, leftStart, rightEnd):
if(leftStart >= rightEnd):
return
middle = int((leftStart + rightEnd) / 2)
mergeSort(a, temp, leftStart, middle)
mergeSort(a, temp, middle + 1, rightEnd)
merge(a, temp, leftStart, middle, rightEnd)
return
def merge(a, temp, leftStart, middle... | def merge_sort(a, temp, leftStart, rightEnd):
if leftStart >= rightEnd:
return
middle = int((leftStart + rightEnd) / 2)
merge_sort(a, temp, leftStart, middle)
merge_sort(a, temp, middle + 1, rightEnd)
merge(a, temp, leftStart, middle, rightEnd)
return
def merge(a, temp, leftStart, middl... |
def ans(n):
global fib
for i in range(1,99):
if fib[i]==n: return n
if fib[i+1]>n: return ans(n-fib[i])
fib=[1]*100
for i in range(2,100):
fib[i]=fib[i-1]+fib[i-2]
n=int(input())
print(ans(n)) | def ans(n):
global fib
for i in range(1, 99):
if fib[i] == n:
return n
if fib[i + 1] > n:
return ans(n - fib[i])
fib = [1] * 100
for i in range(2, 100):
fib[i] = fib[i - 1] + fib[i - 2]
n = int(input())
print(ans(n)) |
#
# This file contains the Python code from Program 7.23 of
# "Data Structures and Algorithms
# with Object-Oriented Design Patterns in Python"
# by Bruno R. Preiss.
#
# Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved.
#
# http://www.brpreiss.com/books/opus7/programs/pgm07_23.txt
#
class SortedList(O... | class Sortedlist(OrderedList):
def __init__(self):
super(SortedList, self).__init__() |
'''Program to read a number and check whether it is duck number or not.
Hint: A duck number is a number which has zeros present in it, but no zero present in the begining of the number.
Input Format
a number from the user
Constraints
n>=0
Output Format
Yes or No
Sample Input 0
123
Sample Output 0
No
Sample Inp... | """Program to read a number and check whether it is duck number or not.
Hint: A duck number is a number which has zeros present in it, but no zero present in the begining of the number.
Input Format
a number from the user
Constraints
n>=0
Output Format
Yes or No
Sample Input 0
123
Sample Output 0
No
Sample Inp... |
consumer_key = "TSKf1HtYKBsnYU9qfpvbRJkxo"
consumer_secret = "Y5lH7u6MDu5DjV5hUxEkwUpPwugYvEuqfpqyvP7y5ulen9XUML"
access_token = '115029611-4TampaXbxHmUHcpK5Cll8h7rioP80SJMNneZiYCN'
access_secret = 'wx4iaVvgvY5ZknCn6bOiKFiTzAU62R5PXC8b29RC6alwU'
| consumer_key = 'TSKf1HtYKBsnYU9qfpvbRJkxo'
consumer_secret = 'Y5lH7u6MDu5DjV5hUxEkwUpPwugYvEuqfpqyvP7y5ulen9XUML'
access_token = '115029611-4TampaXbxHmUHcpK5Cll8h7rioP80SJMNneZiYCN'
access_secret = 'wx4iaVvgvY5ZknCn6bOiKFiTzAU62R5PXC8b29RC6alwU' |
# Breadth First Search and Depth First Search
class BinarySearchTree:
def __init__(self):
self.root = None
# Insert a new node
def insert(self, value):
new_node = {
'value': value,
'left': None,
'right': None
}
if not self.root:
... | class Binarysearchtree:
def __init__(self):
self.root = None
def insert(self, value):
new_node = {'value': value, 'left': None, 'right': None}
if not self.root:
self.root = new_node
else:
current_node = self.root
while True:
i... |
#!/usr/bin/env python3
#encoding=utf-8
#-------------------------------------------------
# Usage: python3 factory.py
# Description: factory function
#-------------------------------------------------
def factory(aClass, *pargs, **kargs): # Varargs tuple, dict
return aClass(*pargs, **kargs) # Call aClass ... | def factory(aClass, *pargs, **kargs):
return a_class(*pargs, **kargs)
class Spam:
def doit(self, message):
print(message)
class Person:
def __init__(self, name, job=None):
self.name = name
self.job = job
if __name__ == '__main__':
object1 = factory(Spam)
object2 = factory... |
with open('input', 'r') as file:
aim = 0
horizontal = 0
depth = 0
simple_depth=0
for line in file:
[com, n] = line.split(' ')
n = int(n)
if com == 'forward':
horizontal += n
depth += aim * n
elif com == 'down':
aim += n
... | with open('input', 'r') as file:
aim = 0
horizontal = 0
depth = 0
simple_depth = 0
for line in file:
[com, n] = line.split(' ')
n = int(n)
if com == 'forward':
horizontal += n
depth += aim * n
elif com == 'down':
aim += n
... |
class Solution:
# 1st solution
# O(n) time | O(n) space
def reverseWords(self, s: str) -> str:
lst = []
start = 0
for i in range(len(s)):
if s[i] == " ":
self.reverse(lst, start, i - 1)
start = i + 1
lst.append(s[i])
sel... | class Solution:
def reverse_words(self, s: str) -> str:
lst = []
start = 0
for i in range(len(s)):
if s[i] == ' ':
self.reverse(lst, start, i - 1)
start = i + 1
lst.append(s[i])
self.reverse(lst, start, len(s) - 1)
retu... |
class Solution:
def containsDuplicate(self, nums: [int]) -> bool:
return len(nums) != len(set(nums))
s = Solution()
print(s.containsDuplicate([1,2,3,1])) | class Solution:
def contains_duplicate(self, nums: [int]) -> bool:
return len(nums) != len(set(nums))
s = solution()
print(s.containsDuplicate([1, 2, 3, 1])) |
# Problem:
# Write a program that introduces hours and minutes of 24 hours a day and calculates how much time it will take
# after 15 minutes. The result is printed in hh: mm format.
# Hours are always between 0 and 23 minutes are always between 0 and 59.
# Hours are written in one or two digits. Minutes are always wri... | hours = int(input())
minutes = int(input())
minutes += 15
if minutes >= 60:
minutes %= 60
hours += 1
if hours >= 24:
hours -= 24
if minutes <= 9:
print(f'{hours}:0{minutes}')
else:
print(f'{hours}:{minutes}')
elif minutes <= 9:
print(f'{hours}:0{mi... |
class Link:
def __init__(self, val, next=None):
self.val = val
self.next = next
def __repr__(self):
if not self.next:
return f"Link({self.val})"
return f"Link({self.val}, {self.next})"
def merge_k_linked_lists(linked_lists):
'''
Merge k sorted linked lists ... | class Link:
def __init__(self, val, next=None):
self.val = val
self.next = next
def __repr__(self):
if not self.next:
return f'Link({self.val})'
return f'Link({self.val}, {self.next})'
def merge_k_linked_lists(linked_lists):
"""
Merge k sorted linked lists ... |
__all__ = [
"ffn",
"rbfn",
"ffn_bn",
"ffn_ace",
"ffn_lae",
"ffn_bn_vat",
"ffn_vat",
"cnn",
"vae1",
"cvae",
"draw_at_lstm1",
"draw_at_lstm2",
"draw_lstm1",
"draw_sgru1",
"lm_lstm",
"lm_lstm_bn",
"lm_gru",
"lm_draw"
]
| __all__ = ['ffn', 'rbfn', 'ffn_bn', 'ffn_ace', 'ffn_lae', 'ffn_bn_vat', 'ffn_vat', 'cnn', 'vae1', 'cvae', 'draw_at_lstm1', 'draw_at_lstm2', 'draw_lstm1', 'draw_sgru1', 'lm_lstm', 'lm_lstm_bn', 'lm_gru', 'lm_draw'] |
'''
num1=1
num2=1
num3=num1+num2
print(num3)
sum=num1+num2+num3
for i in range(1,18,1):
num1=num2
num2=num3
num3=num1+num2
if num3%2==0:
print(num3)
'''
'''
for i in range(1,101):
if 100%i==0:
print(i)
'''
num1=int(input("Please input a number: "))
for i in range(1,num1+1):
if... | """
num1=1
num2=1
num3=num1+num2
print(num3)
sum=num1+num2+num3
for i in range(1,18,1):
num1=num2
num2=num3
num3=num1+num2
if num3%2==0:
print(num3)
"""
'\nfor i in range(1,101):\n if 100%i==0:\n print(i)\n'
num1 = int(input('Please input a number: '))
for i in range(1, num1 + 1):
... |
l = {}
for _ in range(int(input())):
s = input().split()
l[s[0]] = sum([float(a) for a in s[1:]])/(len(s)-1)
print('%.2f' % l[input()]) | l = {}
for _ in range(int(input())):
s = input().split()
l[s[0]] = sum([float(a) for a in s[1:]]) / (len(s) - 1)
print('%.2f' % l[input()]) |
BOT_NAME = 'p5_downloader_middleware_handson'
SPIDER_MODULES = ['p5_downloader_middleware_handson.spiders']
NEWSPIDER_MODULE = 'p5_downloader_middleware_handson.spiders'
ROBOTSTXT_OBEY = True
DOWNLOADER_MIDDLEWARES = {
'p5_downloader_middleware_handson.middlewares.SeleniumDownloaderMiddleware': 543,
}
SELENIUM_E... | bot_name = 'p5_downloader_middleware_handson'
spider_modules = ['p5_downloader_middleware_handson.spiders']
newspider_module = 'p5_downloader_middleware_handson.spiders'
robotstxt_obey = True
downloader_middlewares = {'p5_downloader_middleware_handson.middlewares.SeleniumDownloaderMiddleware': 543}
selenium_enabled = T... |
#!/usr/bin/env python3
# Nick Stucchi
# 03/23/2017
# Filter out words and replace with dashes
def replaceWord(sentence, word):
wordList = sentence.split()
newSentence = []
for w in wordList:
if w == word:
newSentence.append("-" * len(word))
else:
newSentence.append(... | def replace_word(sentence, word):
word_list = sentence.split()
new_sentence = []
for w in wordList:
if w == word:
newSentence.append('-' * len(word))
else:
newSentence.append(w)
return ' '.join(newSentence)
def main():
sentence = input('Enter a sentence: ')
... |
EF_UUID_NAME = "__specialEF__float32_UUID"
EF_ORDERBY_NAME = "__specialEF__int32_dayDiff"
EF_PREDICTION_NAME = "__specialEF__float32_predictions"
EF_DUMMY_GROUP_COLUMN_NAME = "__specialEF__dummy_group"
HMF_MEMMAP_MAP_NAME = "__specialHMF__memmapMap"
HMF_GROUPBY_NAME = "__specialHMF__groupByNumericEncoder"
| ef_uuid_name = '__specialEF__float32_UUID'
ef_orderby_name = '__specialEF__int32_dayDiff'
ef_prediction_name = '__specialEF__float32_predictions'
ef_dummy_group_column_name = '__specialEF__dummy_group'
hmf_memmap_map_name = '__specialHMF__memmapMap'
hmf_groupby_name = '__specialHMF__groupByNumericEncoder' |
SERVICES = [
'UserService',
'ProjectService',
'NotifyService',
'AlocateService',
'ApiGateway',
'Frontend'
]
METRICS = [
'files',
'functions',
'complexity',
'coverage',
'ncloc',
'comment_lines_density',
'duplicated_lines_density',
'security_rating',
'tests',
... | services = ['UserService', 'ProjectService', 'NotifyService', 'AlocateService', 'ApiGateway', 'Frontend']
metrics = ['files', 'functions', 'complexity', 'coverage', 'ncloc', 'comment_lines_density', 'duplicated_lines_density', 'security_rating', 'tests', 'test_success_density', 'test_execution_time', 'reliability_ratin... |
class Vocab:
# pylint: disable=invalid-name,too-many-instance-attributes
ROOT = '<ROOT>'
SPECIAL_TOKENS = ('<PAD>', '<ROOT>', '<UNK>')
def __init__(self, min_count=None):
self._counts = {}
self._pretrained = set([])
self.min_count = min_count
self.size = 3
def idx(... | class Vocab:
root = '<ROOT>'
special_tokens = ('<PAD>', '<ROOT>', '<UNK>')
def __init__(self, min_count=None):
self._counts = {}
self._pretrained = set([])
self.min_count = min_count
self.size = 3
def idx(self, token):
if token not in self._vocab:
re... |
#
# PySNMP MIB module Wellfleet-FNTS-ATM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-FNTS-ATM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:33:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_union, constraints_intersection, single_value_constraint) ... |
routers = dict(
# base router
BASE=dict(
default_application='projeto',
applications=['projeto', 'admin',]
),
projeto=dict(
default_controller='initial',
default_function='principal',
controllers=['initial', 'manager'],
functions=['home', 'contact', 'about', 'user', '... | routers = dict(BASE=dict(default_application='projeto', applications=['projeto', 'admin']), projeto=dict(default_controller='initial', default_function='principal', controllers=['initial', 'manager'], functions=['home', 'contact', 'about', 'user', 'download', 'account', 'register', 'login', 'exemplo', 'teste1', 'teste2... |
class Coffee:
coffeecupcounter =0
def __init__(self, themilk, thesugar, thecoffeemate):
self.milk = themilk
self.sugar = thesugar
self.coffeemate = thecoffeemate
Coffee.coffeecupcounter=Coffee.coffeecupcounter+1
print(f'You now have your coffee with {self.milk} milk, {s... | class Coffee:
coffeecupcounter = 0
def __init__(self, themilk, thesugar, thecoffeemate):
self.milk = themilk
self.sugar = thesugar
self.coffeemate = thecoffeemate
Coffee.coffeecupcounter = Coffee.coffeecupcounter + 1
print(f'You now have your coffee with {self.milk} milk... |
class Solution:
def threeSumMulti(self, arr, target):
c = Counter(arr)
ans, M = 0, 10**9 + 7
for i, j in permutations(c, 2):
if i < j < target - i - j:
ans += c[i]*c[j]*c[target - i - j]
for i in c:
if 3*i != target:
ans += c[i... | class Solution:
def three_sum_multi(self, arr, target):
c = counter(arr)
(ans, m) = (0, 10 ** 9 + 7)
for (i, j) in permutations(c, 2):
if i < j < target - i - j:
ans += c[i] * c[j] * c[target - i - j]
for i in c:
if 3 * i != target:
... |
'''
Created on Jun 4, 2018
@author: nishant.sethi
'''
class Node:
def __init__(self, data):
self.left = None
self.right = None
self.data = data
def insert(self, data):
# Compare the new value with the parent node
if self.data:
if data < self.... | """
Created on Jun 4, 2018
@author: nishant.sethi
"""
class Node:
def __init__(self, data):
self.left = None
self.right = None
self.data = data
def insert(self, data):
if self.data:
if data < self.data:
if self.left is None:
sel... |
name = input("Enter file:")
if len(name) < 1:
name = "mbox-short.txt"
handle = open(name)
hist=dict()
for line in handle:
if line.startswith('From:'):
words=line.split()
if words[1] not in hist:
hist[words[1]]=1
else:
hist[words[1]]=hist[words[1]]+1
#print(hist)
n... | name = input('Enter file:')
if len(name) < 1:
name = 'mbox-short.txt'
handle = open(name)
hist = dict()
for line in handle:
if line.startswith('From:'):
words = line.split()
if words[1] not in hist:
hist[words[1]] = 1
else:
hist[words[1]] = hist[words[1]] + 1
nome... |
maior = 0
menor = 0
totalPessoas = 10
for pessoa in range(1, 11):
idade = int(input("Digite a idade: "))
if idade >= 18:
maior += 1
else:
menor += 1
print("Quantidade de pessoas maior de idade: ", maior)
print("Quantidade de pessoas menor de idade: ", menor)
print("Porcentagem de pessoas menores de idad... | maior = 0
menor = 0
total_pessoas = 10
for pessoa in range(1, 11):
idade = int(input('Digite a idade: '))
if idade >= 18:
maior += 1
else:
menor += 1
print('Quantidade de pessoas maior de idade: ', maior)
print('Quantidade de pessoas menor de idade: ', menor)
print('Porcentagem de pessoas me... |
#
# PySNMP MIB module A3COM-HUAWEI-IFQOS2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-HUAWEI-IFQOS2-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 16:50:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (h3c_common,) = mibBuilder.importSymbols('A3COM-HUAWEI-OID-MIB', 'h3cCommon')
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_c... |
lines = [line.strip() for line in open("input.txt", 'r') if line.strip() != ""]
startingNumbers = [int(i) for i in lines[0].split(",")]
##########################################
# PART 1 #
##########################################
def part1(startingNumbers, target):
i = 0
la... | lines = [line.strip() for line in open('input.txt', 'r') if line.strip() != '']
starting_numbers = [int(i) for i in lines[0].split(',')]
def part1(startingNumbers, target):
i = 0
last_number = -1
history = {}
for n in startingNumbers:
if n not in history:
history[n] = []
his... |
def load(h):
return ({'abbr': 'Reserved', 'code': 0, 'title': 'RESERVED Reserved Reserved'},
{'abbr': 'pres', 'code': 1, 'title': 'PRES Pressure Pa'},
{'abbr': 'msl', 'code': 2, 'title': 'MSL Mean sea level pressure Pa'},
{'abbr': 'ptend', 'code': 3, 'title': 'PTEND Pressure tend... | def load(h):
return ({'abbr': 'Reserved', 'code': 0, 'title': 'RESERVED Reserved Reserved'}, {'abbr': 'pres', 'code': 1, 'title': 'PRES Pressure Pa'}, {'abbr': 'msl', 'code': 2, 'title': 'MSL Mean sea level pressure Pa'}, {'abbr': 'ptend', 'code': 3, 'title': 'PTEND Pressure tendency Pa s**-1'}, {'abbr': 'pv', 'cod... |
def printom(str):
return f"ye hath mujhe {str}"
def add(n1, n2):
return n1 + n2 + 5
print("and the name is", __name__)
if __name__ == '__main__':
print(printom("de de thakur"))
o = add(4, 6)
print(o)
| def printom(str):
return f'ye hath mujhe {str}'
def add(n1, n2):
return n1 + n2 + 5
print('and the name is', __name__)
if __name__ == '__main__':
print(printom('de de thakur'))
o = add(4, 6)
print(o) |
# Class to test the GrapherWindow Class
class GrapherTester:
def __init__(self):
subject = Grapher()
testFileName = 'TestData.csv'
testStockName = 'Test Stock'
testGenerateGraphWithAllPositiveNumbers(testFileName, testStockName)
def createTestData(xAxis, yAxis):
# Genera... | class Graphertester:
def __init__(self):
subject = grapher()
test_file_name = 'TestData.csv'
test_stock_name = 'Test Stock'
test_generate_graph_with_all_positive_numbers(testFileName, testStockName)
def create_test_data(xAxis, yAxis):
plot_data = {'X-Axis': xAxis, 'Y-Ax... |
class Policy:
def select_edge(self, board_state, score=None, opp_score=None):
raise NotImplementedError
| class Policy:
def select_edge(self, board_state, score=None, opp_score=None):
raise NotImplementedError |
class ChocolateBoiler:
unique_instance = None
def __new__(cls, *args, **kwargs):
if not cls.unique_instance:
cls.unique_instance = super().__new__(cls, *args, **kwargs)
return cls.unique_instance
def __init__(self):
self.empty = True
self.boiled = False
def... | class Chocolateboiler:
unique_instance = None
def __new__(cls, *args, **kwargs):
if not cls.unique_instance:
cls.unique_instance = super().__new__(cls, *args, **kwargs)
return cls.unique_instance
def __init__(self):
self.empty = True
self.boiled = False
def... |
class Solution:
def minAvailableDuration(self, slots1: List[List[int]], slots2: List[List[int]], duration: int) -> List[int]:
timeslots = list(filter(lambda x: x[1] - x[0] >= duration, slots1 + slots2))
heapq.heapify(timeslots)
while len(timeslots) > 1:
start1, end1 = heapq.heapp... | class Solution:
def min_available_duration(self, slots1: List[List[int]], slots2: List[List[int]], duration: int) -> List[int]:
timeslots = list(filter(lambda x: x[1] - x[0] >= duration, slots1 + slots2))
heapq.heapify(timeslots)
while len(timeslots) > 1:
(start1, end1) = heapq.... |
someParameters = input("Please Enter some parameters: ")
def createList(*someParameters):
paramList = []
for add in someParameters:
paramList.append(add)
print(paramList)
return paramList
createList(someParameters)
| some_parameters = input('Please Enter some parameters: ')
def create_list(*someParameters):
param_list = []
for add in someParameters:
paramList.append(add)
print(paramList)
return paramList
create_list(someParameters) |
def first_repeating(n,arr):
#initialize with the minimum index possible
Min = -1
#create a empty dictionary
newSet = dict()
# tranversing the array elments from end
for x in range(n - 1, -1, -1):
#check if the element is already present in the dictionary
#then up... | def first_repeating(n, arr):
min = -1
new_set = dict()
for x in range(n - 1, -1, -1):
if arr[x] in newSet.keys():
min = x
else:
newSet[arr[x]] = 1
if Min != -1:
print('The first repeating element is', arr[Min])
else:
print('There are no repeati... |
SECRET_KEY = 'testing'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.staticfiles',
'django.contrib.sessions',
'c... | secret_key = 'testing'
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}}
installed_apps = ['django.contrib.contenttypes', 'django.contrib.auth', 'django.contrib.admin', 'django.contrib.staticfiles', 'django.contrib.sessions', 'cruditor']
root_urlconf = 'django.contrib.staticfiles.url... |
class Drawable():
def draw(self, screen):
pass
def blit(self, screen):
pass | class Drawable:
def draw(self, screen):
pass
def blit(self, screen):
pass |
# Arke
# User-configurable settings.
# Dirty little seeekrits...
SECRET_KEY='much_sekrit_such_secure_wow'
# Database
# See http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html#database-urls
# With DEBUG defined, this is ignored and a SQLite DB in the root folder is used instead.
# SQLite is probably not the best f... | secret_key = 'much_sekrit_such_secure_wow'
db_url = 'sqlite:///arke.db'
debug = True |
def n_choose_m_iterator(N, M, startpoint=None):
if startpoint is None:
subscripts = list(range(M))
else:
subscripts = copy.deepcopy(startpoint)
while True:
yield subscripts
off = M - 1
while off > -1:
rev_off = M - off
if subscripts[off] < N ... | def n_choose_m_iterator(N, M, startpoint=None):
if startpoint is None:
subscripts = list(range(M))
else:
subscripts = copy.deepcopy(startpoint)
while True:
yield subscripts
off = M - 1
while off > -1:
rev_off = M - off
if subscripts[off] < N - ... |
#Author wangheng
class Solution:
def isNStraightHand(self, hand, W):
c = collections.Counter(hand)
for i in sorted(c):
if c[i] > 0:
for j in range(W)[::-1]:
c[i + j] -= c[i]
if c[i + j] < 0:
return False
... | class Solution:
def is_n_straight_hand(self, hand, W):
c = collections.Counter(hand)
for i in sorted(c):
if c[i] > 0:
for j in range(W)[::-1]:
c[i + j] -= c[i]
if c[i + j] < 0:
return False
return Tr... |
class EnumMeta(type):
base = False
def __new__(cls, name, bases, kw):
klass = type.__new__(cls, name, bases, kw)
if not EnumMeta.base:
EnumMeta.base = True
return klass
return klass()
class Enum(metaclass=EnumMeta):
def __getitem__(self, key):
if isinstance(key, int):
for k in dir(self):
if len... | class Enummeta(type):
base = False
def __new__(cls, name, bases, kw):
klass = type.__new__(cls, name, bases, kw)
if not EnumMeta.base:
EnumMeta.base = True
return klass
return klass()
class Enum(metaclass=EnumMeta):
def __getitem__(self, key):
if is... |
#
#.. create syth_test.geo file form this file
#
# python3 mkSyntheticGeoData2D.py test
#
#.. create 3D mesh syth_testmesh.msh
#
# gmsh -3 -format msh2 -o syth_testmesh.msh syth_test.geo
#
#.. run for synthetic data
#
# python3 mkSyntheticData2D.py -s synth -g -m test
#
# creating test_grav.nc and test_mag.... | project = 'test'
km = 1000.0
gravfile = project + '_grav1Noise.nc'
magfile = project + '_mag1Noise.nc'
data_ref_x = 0.0
data_ref_y = 0.0
data_height_above_ground = 0 * km
l_data_y = 40 * km
l_data_x = 70 * km
data_num_x = 141
data_num_y = 81
data_mesh_size_vertical = 0.5 * km
core_thickness = 60 * km
air_layer_thicknes... |
class Item:
def __init__(self, id, quantity, price):
self.__product_id = id
self.__quantity = quantity
self.__price = price
def update_quantity(self, quantity):
None
class ShoppingCart:
def __init__(self):
self.__items = []
def add_item(self, item):
None
def remove_item(self, item... | class Item:
def __init__(self, id, quantity, price):
self.__product_id = id
self.__quantity = quantity
self.__price = price
def update_quantity(self, quantity):
None
class Shoppingcart:
def __init__(self):
self.__items = []
def add_item(self, item):
N... |
a = [1,2,3]
print(a)
a.append(5)
print(a)
list1=[1,2,3,4,5]
list2=['rambutan','langsa','salak','durian','apel']
list1.extend(list2)
c = [1,2,3]
print(c)
c.insert(0,12)
print(c)
### Perbedaan antara fungsi Append,extend,dan insert
# append berfungsi untuk menambahkan elemen ke daftar
# extend berfungsi untuk memp... | a = [1, 2, 3]
print(a)
a.append(5)
print(a)
list1 = [1, 2, 3, 4, 5]
list2 = ['rambutan', 'langsa', 'salak', 'durian', 'apel']
list1.extend(list2)
c = [1, 2, 3]
print(c)
c.insert(0, 12)
print(c)
def reverse(string):
reverse_string = ''
for i in string:
reverse_string = i + reversed_string
print('rev... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def averageOfLevels(self, root: TreeNode) -> List[float]:
queue, levelsData, result = deque([(root, ... | class Solution:
def average_of_levels(self, root: TreeNode) -> List[float]:
(queue, levels_data, result) = (deque([(root, 0)]), defaultdict(lambda : (0, 0)), [])
while queue:
(node, level) = queue.popleft()
if node:
(current_sum, current_count) = levelsData[l... |
af = list(b"\x13\x13\x11\x17\x12\x1d\x48\x45\x45\x41\x0b\x26\x2c\x42\x5f\x09\x0b\x5f\x6c\x3d\x56\x56\x1b\x54\x5f\x41\x45\x29\x3c\x0b\x5c\x58\x00\x5f\x5d\x09\x54\x6c\x2a\x40\x06\x06\x6a\x27\x48\x42\x5f\x4b\x56\x42\x2d\x2c\x43\x5d\x5e\x6c\x2d\x41\x07\x47\x43\x5e\x31\x6b\x5a\x0a\x3b\x6e\x1c\x49\x54\x5e\x1a\x2b\x34\x05\x5e... | af = list(b"\x13\x13\x11\x17\x12\x1dHEEA\x0b&,B_\t\x0b_l=VV\x1bT_AE)<\x0b\\X\x00_]\tTl*@\x06\x06j'HB_KVB-,C]^l-A\x07GC^1kZ\n;n\x1cIT^\x1a+4\x05^G((\x1f\x11&;\x07P\x04\x06\x04\r\x0b\x05\x03Hw\n")
flag = 'r'
char = 'r'
for stuff in af:
flag += chr(ord(char) ^ stuff)
char = flag[-1]
print(flag) |
I = input("Enter the string: ")
S = I.upper()
freq = {}
for i in I:
if i != " ":
if i in freq:
freq[i] += 1
else:
freq[i] = 1
print(freq)
| i = input('Enter the string: ')
s = I.upper()
freq = {}
for i in I:
if i != ' ':
if i in freq:
freq[i] += 1
else:
freq[i] = 1
print(freq) |
# exc. 7.2.4
def seven_boom(end_number):
my_list = []
for i in range(0, end_number + 1):
s = str(i)
if '7' in s or i % 7 == 0:
my_list += ['BOOM']
else:
my_list += [i]
print(my_list)
def main():
end_number = 17
seven_bo... | def seven_boom(end_number):
my_list = []
for i in range(0, end_number + 1):
s = str(i)
if '7' in s or i % 7 == 0:
my_list += ['BOOM']
else:
my_list += [i]
print(my_list)
def main():
end_number = 17
seven_boom(end_number)
if __name__ == '__main__':
... |
def main():
# input
N, K = map(int, input().split())
# compute
def twoN(a: int):
if a%200 == 0:
a = int(a/200)
else:
a = int(str(a) + "200")
return a
for i in range(K):
N = twoN(N)
# output
print(N)
if __name__ == '__main_... | def main():
(n, k) = map(int, input().split())
def two_n(a: int):
if a % 200 == 0:
a = int(a / 200)
else:
a = int(str(a) + '200')
return a
for i in range(K):
n = two_n(N)
print(N)
if __name__ == '__main__':
main() |
def increment_by_one(x):
return x + 1
def test_increment_by_one():
assert increment_by_one(3) == 4
| def increment_by_one(x):
return x + 1
def test_increment_by_one():
assert increment_by_one(3) == 4 |
class CTDConfig(object):
def __init__(self, createStationPlot,
createTSPlot,
createContourPlot,
createTimeseriesPlot,
binDataWriteToNetCDF,
describeStation,
createHistoricalTimeseries,
showSta... | class Ctdconfig(object):
def __init__(self, createStationPlot, createTSPlot, createContourPlot, createTimeseriesPlot, binDataWriteToNetCDF, describeStation, createHistoricalTimeseries, showStats, plotStationMap, tempName, saltName, oxName, ftuName, oxsatName, refdate, selected_depths, write_to_excel, survey=None, ... |
##Generalize orienteering contours=name
##maximumdistancebetweentheoriginalandthesimplifiedcurvedouglaspeuckeralgorithm=number4
##contours=vector
##min=string37
##generalizecontours=output vector
outputs_QGISFIELDCALCULATOR_1=processing.runalg('qgis:fieldcalculator', contours,'length',0,10.0,2.0,True,'round($length,2)'... | outputs_qgisfieldcalculator_1 = processing.runalg('qgis:fieldcalculator', contours, 'length', 0, 10.0, 2.0, True, 'round($length,2)', None)
outputs_qgisextractbyattribute_1 = processing.runalg('qgis:extractbyattribute', outputs_QGISFIELDCALCULATOR_1['OUTPUT_LAYER'], 'length', 3, min, None)
outputs_GRASS7V.GENERALIZE.SI... |
# model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
# norm_cfg = dict(type='BN', requires_grad=True)
model = dict(
type='EncoderDecoder',
pretrained='open-mmlab://resnet18_v1c',
backbone=dict(
type='BiseNetV1',
base_model='ResNetV1c',
depth=18,
out_indices=(0,... | norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(type='EncoderDecoder', pretrained='open-mmlab://resnet18_v1c', backbone=dict(type='BiseNetV1', base_model='ResNetV1c', depth=18, out_indices=(0, 1, 2), with_sp=False, norm_cfg=norm_cfg, align_corners=False), decode_head=dict(type='FCNHead', in_index=-1, in... |
#For packaging
'''
Users api handles JWT auth for users
'''
| """
Users api handles JWT auth for users
""" |
def run(params={}):
return {
'project_name': 'Core',
'bitcode': True,
'min_version': '9.0',
'enable_arc': True,
'enable_visibility': True,
'conan_profile': 'ezored_ios_framework_profile',
'archs': [
{'arch': 'armv7', 'conan_arch': 'armv7', 'platfor... | def run(params={}):
return {'project_name': 'Core', 'bitcode': True, 'min_version': '9.0', 'enable_arc': True, 'enable_visibility': True, 'conan_profile': 'ezored_ios_framework_profile', 'archs': [{'arch': 'armv7', 'conan_arch': 'armv7', 'platform': 'OS'}, {'arch': 'armv7s', 'conan_arch': 'armv7s', 'platform': 'OS'... |
'''
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.
Examp... | """
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
Example 1:
Input: 121
Output: true
Example 2:
Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.
Examp... |
def longestDigitsPrefix(inputString):
# iterate through the string
arr = ''
for i in inputString:
if i.isdigit():
arr += i
else:
break
return arr | def longest_digits_prefix(inputString):
arr = ''
for i in inputString:
if i.isdigit():
arr += i
else:
break
return arr |
class Error:
none_or_invalid_attribute = "main attributes should have value."
unacceptable_json = "json input has unacceptable format."
unacceptable_object_type = "object has unacceptable type"
| class Error:
none_or_invalid_attribute = 'main attributes should have value.'
unacceptable_json = 'json input has unacceptable format.'
unacceptable_object_type = 'object has unacceptable type' |
def decimalni_zapis(deljenec, delitelj):
memo = set()
decimalni_zapis = ''
while (deljenec, delitelj) not in memo:
if deljenec % delitelj == 0:
decimalni_zapis += str(deljenec // delitelj)
return decimalni_zapis, deljenec, delitelj
elif deljenec < delitelj:
... | def decimalni_zapis(deljenec, delitelj):
memo = set()
decimalni_zapis = ''
while (deljenec, delitelj) not in memo:
if deljenec % delitelj == 0:
decimalni_zapis += str(deljenec // delitelj)
return (decimalni_zapis, deljenec, delitelj)
elif deljenec < delitelj:
... |
#!/usr/bin/python3
bridgera = ['Arijit','Soumya','Gunjan','Arptia','Bishwa','Rintu','Satya','Lelin']
# Generator Function iterarates through all items of array
def gen_func(data):
for i in range(len(data)):
yield data[i]
data_gen = list(gen_func(bridgera))
print (data_gen)
# Normal Functio... | bridgera = ['Arijit', 'Soumya', 'Gunjan', 'Arptia', 'Bishwa', 'Rintu', 'Satya', 'Lelin']
def gen_func(data):
for i in range(len(data)):
yield data[i]
data_gen = list(gen_func(bridgera))
print(data_gen)
def norm_func(data):
for i in range(len(data)):
return data[i]
norm_gen = list(norm_func(bri... |
#implicit type conversion
num1 = 12
num2= 13.5
num3 = num1 + num2
print(type(num1))
print(type(num2))
print(num3)
print(type(num3))
| num1 = 12
num2 = 13.5
num3 = num1 + num2
print(type(num1))
print(type(num2))
print(num3)
print(type(num3)) |
load("@rules_cuda//cuda:defs.bzl", "cuda_library")
NVCC_COPTS = ["--expt-relaxed-constexpr", "--expt-extended-lambda"]
def cu_library(name, srcs, copts = [], **kwargs):
cuda_library(name, srcs = srcs, copts = NVCC_COPTS + copts, **kwargs)
| load('@rules_cuda//cuda:defs.bzl', 'cuda_library')
nvcc_copts = ['--expt-relaxed-constexpr', '--expt-extended-lambda']
def cu_library(name, srcs, copts=[], **kwargs):
cuda_library(name, srcs=srcs, copts=NVCC_COPTS + copts, **kwargs) |
'''
Author: jianzhnie
Date: 2022-03-04 17:13:55
LastEditTime: 2022-03-04 17:13:55
LastEditors: jianzhnie
Description:
'''
| """
Author: jianzhnie
Date: 2022-03-04 17:13:55
LastEditTime: 2022-03-04 17:13:55
LastEditors: jianzhnie
Description:
""" |
#!/usr/bin/env python3
#: Program Purpose:
#: Read an integer N. For all non-negative integers i < N
#: print i * i.
#:
#: Program Author: Happi Yvan <ivensteinpoker@gmail.com
#: Program Date : 11/04/2019 (mm/dd/yyyy)
def process(int_val):
for x in range(int_val):
print(x * x)
def main... | def process(int_val):
for x in range(int_val):
print(x * x)
def main():
val = int(input())
process(val)
if __name__ == '__main__':
main() |
def names(name_list):
with open('textfile3.txt', 'w') as myfile:
myfile.writelines(name_list)
myfile.close()
print(name_list)
menu()
def display_name(n):
with open('textfile3.txt', 'r') as myfile:
name_list = myfile.readlines()
print(name_list[n-1])
retu... | def names(name_list):
with open('textfile3.txt', 'w') as myfile:
myfile.writelines(name_list)
myfile.close()
print(name_list)
menu()
def display_name(n):
with open('textfile3.txt', 'r') as myfile:
name_list = myfile.readlines()
print(name_list[n - 1])
return namelist... |
n = int(input())
even_numbers_set = set()
odd_numbers_set = set()
for current_iteration_count in range(1, n+1):
name = input()
current_sum = sum([ord(el) for el in name]) // current_iteration_count
if current_sum % 2 == 0:
even_numbers_set.add(current_sum)
else:
odd_numbers_set.add(cu... | n = int(input())
even_numbers_set = set()
odd_numbers_set = set()
for current_iteration_count in range(1, n + 1):
name = input()
current_sum = sum([ord(el) for el in name]) // current_iteration_count
if current_sum % 2 == 0:
even_numbers_set.add(current_sum)
else:
odd_numbers_set.add(cur... |
num = int(input("Numero: "))
for i in range(1,13):
m = num * i
print(num,"X",i,"=",m) | num = int(input('Numero: '))
for i in range(1, 13):
m = num * i
print(num, 'X', i, '=', m) |
# function type
class function(object):
def __get__(self, obj, objtype):
# when used as attribute a function returns a bound method or the function itself
object = ___id("%object")
method = ___id("%method")
NoneType = ___id("%NoneType")
if obj is None and objtype is not NoneType:
# no obj... | class Function(object):
def __get__(self, obj, objtype):
object = ___id('%object')
method = ___id('%method')
none_type = ___id('%NoneType')
if obj is None and objtype is not NoneType:
return self
else:
new_method = object.__new__(method)
m... |
class GenerationTemplate:
def __init__(
self,
source_path: str,
template: str,
group_template: str,
unit_template: str
):
self.source_path: str = source_path
self.template: str = template
self.group_template: str = group_temp... | class Generationtemplate:
def __init__(self, source_path: str, template: str, group_template: str, unit_template: str):
self.source_path: str = source_path
self.template: str = template
self.group_template: str = group_template
self.unit_template: str = unit_template |
#!/usr/bin/env python3
#
# eask:
# The initialization program (your puzzle input) can either update the bitmask
# or write a value to memory. Values and memory addresses are both 36-bit
# unsigned integers. For example, ignoring bitmasks for a moment, a line
# like mem[8] = 11 would write the value 11 to memory address... | input_file = 'input.txt'
def main():
instructions = [line.strip('\n') for line in open(INPUT_FILE, 'r')]
mask = None
memory = {}
for instruction in instructions:
if instruction.startswith('mask = '):
mask = instruction.split(' = ')[1]
elif instruction.startswith('mem['):
... |
class Email:
client = None
optional_arguments = [
"antispamlevel",
"antivirus",
"autorespond",
"autorespondsaveemail",
"autorespondmessage",
"password",
"quota"
]
def __init__(self, client):
self.client = client
def overview(self):
return self.client.get("/email/overview")
def globalquota(se... | class Email:
client = None
optional_arguments = ['antispamlevel', 'antivirus', 'autorespond', 'autorespondsaveemail', 'autorespondmessage', 'password', 'quota']
def __init__(self, client):
self.client = client
def overview(self):
return self.client.get('/email/overview')
def globa... |
class MyArray:
def __init__(self, *args):
self.elems = list(args)
def __repr__(self):
return str(self.elems)
def __getitem__(self, index):
return self.elems[index]
def __setitem__(self, index, value):
self.elems[index] = value
def __delitem__(self, index):
... | class Myarray:
def __init__(self, *args):
self.elems = list(args)
def __repr__(self):
return str(self.elems)
def __getitem__(self, index):
return self.elems[index]
def __setitem__(self, index, value):
self.elems[index] = value
def __delitem__(self, index):
... |
n = input()
def odd_even(a):
odd = 0
even = 0
for i in range(len(a)):
if int(a[i]) % 2 == 0:
even += int(a[i])
else:
odd += int(a[i])
return (f'Odd sum = {odd}, Even sum = {even}')
print(odd_even(n))
| n = input()
def odd_even(a):
odd = 0
even = 0
for i in range(len(a)):
if int(a[i]) % 2 == 0:
even += int(a[i])
else:
odd += int(a[i])
return f'Odd sum = {odd}, Even sum = {even}'
print(odd_even(n)) |
load("//internal/jsweet_transpile:jsweet_transpile.bzl", "jsweet_transpile","TRANSPILE_ATTRS")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
JWSEET_TRANSPILE_KEYS = TRANSPILE_ATTRS.keys()
def jsweet_ts_lib(name, **kwargs):
transpile_args = dict()
for transpile_key in JWSEET_TRANSPILE_KEYS:
i... | load('//internal/jsweet_transpile:jsweet_transpile.bzl', 'jsweet_transpile', 'TRANSPILE_ATTRS')
load('@npm_bazel_typescript//:index.bzl', 'ts_library')
jwseet_transpile_keys = TRANSPILE_ATTRS.keys()
def jsweet_ts_lib(name, **kwargs):
transpile_args = dict()
for transpile_key in JWSEET_TRANSPILE_KEYS:
i... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
dummy = ListNode()
output = dummy
# l1_eol... | class Solution:
def merge_two_lists(self, l1: ListNode, l2: ListNode) -> ListNode:
dummy = list_node()
output = dummy
while 1:
if l1 is None:
output.next = l2
break
if l2 is None:
output.next = l1
break
... |
# WSADMIN SCRIPT TO SHOW USEFUL ADMINTASK COMMANDS AND HELP TOWARDS THEM
# Santiago Garcia Arango
# Command:
# wsadmin.sh -lang jython -f /tmp/test.py
print("***** Showing AdminTask help *****")
print(AdminTask.help())
print("***** Showing AdminTask commands *****")
print(AdminTask.help("-commands"))
print("***** Sh... | print('***** Showing AdminTask help *****')
print(AdminTask.help())
print('***** Showing AdminTask commands *****')
print(AdminTask.help('-commands'))
print('***** Showing AdminTask commands with <*something*> pattern *****')
print(AdminTask.help('-commands', '*server*'))
print(AdminTask.help('-commands', '*jvm*'))
pri... |
def dummy_function(a):
return a
DUMMY_GLOBAL_CONSTANT_0 = 'FOO';
DUMMY_GLOBAL_CONSTANT_1 = 'BAR';
| def dummy_function(a):
return a
dummy_global_constant_0 = 'FOO'
dummy_global_constant_1 = 'BAR' |
# Matrix solver (TDMA)
# parameters required:
# n: number of unknowns (length of x)
# a: coefficient matrix
# b: RHS/constant array
# return output:
# b: solution array
def solve_TDMA(n, a, b):
# forward substitution
a[0][2] = -a[0][2] / a[0][1]
b[0] = b[0] / a[0][1]
for i in range(1, n):
a[... | def solve_tdma(n, a, b):
a[0][2] = -a[0][2] / a[0][1]
b[0] = b[0] / a[0][1]
for i in range(1, n):
a[i][2] = -a[i][2] / (a[i][1] + a[i][0] * a[i - 1][2])
b[i] = (b[i] - a[i][0] * b[i - 1]) / (a[i][1] + a[i][0] * a[i - 1][2])
for i in range(n - 2, -1, -1):
b[i] = a[i][2] * b[i + 1]... |
allowed_request_categories = [
'stock',
'mutual_fund',
'intraday',
'history',
'history_multi_single_day',
'forex',
'forex_history',
'forex_single_day',
'stock_search'
]
| allowed_request_categories = ['stock', 'mutual_fund', 'intraday', 'history', 'history_multi_single_day', 'forex', 'forex_history', 'forex_single_day', 'stock_search'] |
#Encontrar el menor valor en un array
#con busqueda binaria
def menor (array):
l=0
r=len(array)-1
while l<=r:
mid = l+(r-l)//2
if array[mid] > array[r]:
l=mid+1
if array[mid]< array[r]:
r=mid
if r==l or mid==0:
return array[r]
n... | def menor(array):
l = 0
r = len(array) - 1
while l <= r:
mid = l + (r - l) // 2
if array[mid] > array[r]:
l = mid + 1
if array[mid] < array[r]:
r = mid
if r == l or mid == 0:
return array[r]
nums = [15, 18, 25, 35, 1, 3, 12]
print(menor(num... |
def fun(s):
ans = 0
o = 0
c = 0
for i in s:
if(i=="("):
o+=1
elif(i==")"):
c+=1
if(c>o):
c-=1
o+=1
ans+=1
return ans
t = int(input())
for _ in range(t):
n = int(input())
s = input()
ans = 0
N = 10**9+7
value = ((n+1)*n)//2
value = pow(value,N-2,N)
prin... | def fun(s):
ans = 0
o = 0
c = 0
for i in s:
if i == '(':
o += 1
elif i == ')':
c += 1
if c > o:
c -= 1
o += 1
ans += 1
return ans
t = int(input())
for _ in range(t):
n = int(input())
s = input()
ans = 0
... |
for _ in range(int(input())):
s = set()
n = input().split()
while True:
m = input().split()
if m[-1] == "say?":
break
s.add(m[-1])
for i in n:
if i not in s:
print(i, end=' ')
print()
| for _ in range(int(input())):
s = set()
n = input().split()
while True:
m = input().split()
if m[-1] == 'say?':
break
s.add(m[-1])
for i in n:
if i not in s:
print(i, end=' ')
print() |
# Copyright (c) 2018 Stephen Bunn <stephen@bunn.io>
# MIT License <https://opensource.org/licenses/MIT>
__name__ = "standardfile"
__repo__ = "https://github.com/stephen-bunn/standardfile"
__description__ = "A library for accessing and interacting with a Standard File server."
__version__ = "0.0.0"
__author__ = "Stephe... | __name__ = 'standardfile'
__repo__ = 'https://github.com/stephen-bunn/standardfile'
__description__ = 'A library for accessing and interacting with a Standard File server.'
__version__ = '0.0.0'
__author__ = 'Stephen Bunn'
__contact__ = 'stephen@bunn.io'
__license__ = 'MIT License' |
class Dataset(object):
def __init__(self, env_spec):
self._env_spec = env_spec
def get_batch(self, batch_size, horizon):
raise NotImplementedError
def get_batch_iterator(self, batch_size, horizon, randomize_order=False, is_tf=True):
raise NotImplementedError
| class Dataset(object):
def __init__(self, env_spec):
self._env_spec = env_spec
def get_batch(self, batch_size, horizon):
raise NotImplementedError
def get_batch_iterator(self, batch_size, horizon, randomize_order=False, is_tf=True):
raise NotImplementedError |
# --------------
##File path for the file
file_path
def read_file(path):
f=open(path,'r')
sentence=f.readline()
f.close()
return sentence
sample_message=read_file(file_path)
#Code starts here
# --------------
#Code starts here
file_path_1
file_path_2
message_1=read_file(file_pa... | file_path
def read_file(path):
f = open(path, 'r')
sentence = f.readline()
f.close()
return sentence
sample_message = read_file(file_path)
file_path_1
file_path_2
message_1 = read_file(file_path_1)
message_2 = read_file(file_path_2)
(message_1, message_2)
def fuse_msg(message_a, message_b):
ima = ... |
class Agent(object):
def __init__(self, id):
self.id = id
def act(self, state):
raise NotImplementedError()
def transition(self, state, actions, new_state, reward):
pass
| class Agent(object):
def __init__(self, id):
self.id = id
def act(self, state):
raise not_implemented_error()
def transition(self, state, actions, new_state, reward):
pass |
n = int(input())
arr = [list(map(int,input().split())) for i in range(n)]
ans = [0]*n
ans[0] = int(pow((arr[0][1]*arr[0][2])//arr[1][2], 0.5))
for i in range(1,n):
ans[i]=(arr[0][i]//ans[0])
print(*ans) | n = int(input())
arr = [list(map(int, input().split())) for i in range(n)]
ans = [0] * n
ans[0] = int(pow(arr[0][1] * arr[0][2] // arr[1][2], 0.5))
for i in range(1, n):
ans[i] = arr[0][i] // ans[0]
print(*ans) |
class Relaxation:
def __init__(self):
self.predecessors = {}
def buildPath(self, graph, node_from, node_to):
nodes = []
current = node_to
while current != node_from:
if self.predecessors[current] == current and current != node_from:
return None
... | class Relaxation:
def __init__(self):
self.predecessors = {}
def build_path(self, graph, node_from, node_to):
nodes = []
current = node_to
while current != node_from:
if self.predecessors[current] == current and current != node_from:
return None
... |
'''
It is also possible to construct a DataFrame with hierarchically indexed columns. For this exercise, you'll start with pandas imported and a list of three DataFrames called dataframes. All three DataFrames contain 'Company', 'Product', and 'Units' columns with a 'Date' column as the index pertaining to sales transa... | """
It is also possible to construct a DataFrame with hierarchically indexed columns. For this exercise, you'll start with pandas imported and a list of three DataFrames called dataframes. All three DataFrames contain 'Company', 'Product', and 'Units' columns with a 'Date' column as the index pertaining to sales transa... |
# Copyright 2015 Google Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
{
'includes': [
],
'targets': [
{
'target_name': 'mkvmuxer',
'type': 'static_libr... | {'includes': [], 'targets': [{'target_name': 'mkvmuxer', 'type': 'static_library', 'sources': ['src/mkvmuxer.cpp', 'src/mkvmuxer.hpp', 'src/mkvmuxerutil.cpp', 'src/mkvmuxerutil.hpp', 'src/mkvwriter.cpp', 'src/mkvwriter.hpp']}]} |
class Address(object):
def __init__(self,addr):
self.addr=addr
@classmethod
def fromhex(cls,addr):
return cls(bytes.fromhex(addr))
def equal(self,other):
if not isinstance(other, Address):
raise Exception('peer is not an address')
if not len(self.addr) == le... | class Address(object):
def __init__(self, addr):
self.addr = addr
@classmethod
def fromhex(cls, addr):
return cls(bytes.fromhex(addr))
def equal(self, other):
if not isinstance(other, Address):
raise exception('peer is not an address')
if not len(self.addr)... |
# job_list_one_shot.py ---
#
# Filename: job_list_one_shot.py
# Author: Abhishek Udupa
# Created: Tue Jan 26 15:13:19 2016 (-0500)
#
#
# Copyright (c) 2015, Abhishek Udupa, University of Pennsylvania
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permit... | [(['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_103_10.sl'], 'icfp_103_10-one-shot', 'icfp_103_10-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchmarks/icfp/icfp_113_1000.sl'], 'icfp_113_1000-one-shot', 'icfp_113_1000-one-shot'), (['python3', 'solvers.py', '3600', 'icfp', '../benchm... |
class OnlyStaffMixin(object):
def dispatch(self, request, *args, **kwargs):
if not request.user.is_staff:
messages.error(request, "Only Staff members can do this.")
try:
return HttpResponseRedirect(request.META['HTTP_REFERER'])
except KeyEr... | class Onlystaffmixin(object):
def dispatch(self, request, *args, **kwargs):
if not request.user.is_staff:
messages.error(request, 'Only Staff members can do this.')
try:
return http_response_redirect(request.META['HTTP_REFERER'])
except KeyError:
... |
def plant_recommendation(care):
if care == 'low':
print('aloe')
elif care == 'medium':
print('pothos')
elif care == 'high':
print('orchid')
plant_recommendation('low')
plant_recommendation('medium')
plant_recommendation('high')
| def plant_recommendation(care):
if care == 'low':
print('aloe')
elif care == 'medium':
print('pothos')
elif care == 'high':
print('orchid')
plant_recommendation('low')
plant_recommendation('medium')
plant_recommendation('high') |
class Settings():
def __init__(self):
self.screen_width = 1024 # screen Width
self.screen_height = 512 # screen height
self.bg_color = (255, 255, 255) # overall background color
self.init_speed = 30 # speed factor of dino
self.dhmax = 23
self.alt_freq... | class Settings:
def __init__(self):
self.screen_width = 1024
self.screen_height = 512
self.bg_color = (255, 255, 255)
self.init_speed = 30
self.dhmax = 23
self.alt_freq = 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.