content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
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... | 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 Leakage': 0.00662954, 'Peak Dynamic': 0.0, 'Runtime Dynamic': 0.0, 'Subthres... |
#takes the input of the size of the array
print("Enter the size of the array")
n = int(input())
#reads the elements in the array
print("Enter the array elements seperated by space")
arr = list(map(int, input().split()))
#take the input for the search element
print("Enter the element to be searched")
search = int(inpu... | print('Enter the size of the array')
n = int(input())
print('Enter the array elements seperated by space')
arr = list(map(int, input().split()))
print('Enter the element to be searched')
search = int(input())
flag = 0
for i in range(n):
if search == arr[i]:
flag = 1
print('Element found at the index... |
class Node:
__slots__ = ("value", "children")
def __init__(self):
self.value = None
self.children = None
class Trie:
def __init__(self):
self.root = Node()
def add(self, key, value):
curr_node = self.root
for part in key:
if curr_node.children is ... | class Node:
__slots__ = ('value', 'children')
def __init__(self):
self.value = None
self.children = None
class Trie:
def __init__(self):
self.root = node()
def add(self, key, value):
curr_node = self.root
for part in key:
if curr_node.children is N... |
class Stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def peek(self):
return self.items[len(self.items) - 1]
def size(self):
... | class Stack:
def __init__(self):
self.items = []
def is_empty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def peek(self):
return self.items[len(self.items) - 1]
def size(self):
... |
class Timezone:
when: datetime
tzname: str
def __init__(self, when):
self.when = when
@classmethod
def convert(cls, dt: datetime):
return cls(dt)
class CET(Timezone):
tzname = 'Central European Time'
class CEST(Timezone):
tzname = 'Central European Summer Time'
| class Timezone:
when: datetime
tzname: str
def __init__(self, when):
self.when = when
@classmethod
def convert(cls, dt: datetime):
return cls(dt)
class Cet(Timezone):
tzname = 'Central European Time'
class Cest(Timezone):
tzname = 'Central European Summer Time' |
# <auto-generated>
# This code was generated by the UnitCodeGenerator tool
#
# Changes to this file will be lost if the code is regenerated
# </auto-generated>
def to_kilojoules(value):
return value / 6241509744511500156928.00
def to_kilocalories(value):
return value / 26131952998320305078272.00
def to_joules(valu... | def to_kilojoules(value):
return value / 6.2415097445115e+21
def to_kilocalories(value):
return value / 2.6131952998320305e+22
def to_joules(value):
return value / 6.2415093433e+18
def to_btu(value):
return value / 6.585141385224143e+21
def to_calories(value):
return value / 2.6131936951817e+19
... |
def bin_search(arr, x, low=0, high=None):
if high is None:
high = len(arr) - 1
if high < low:
return -1
mid = (high + low) // 2
if arr[mid] == x:
return mid
elif arr[mid] < x:
return bin_search(arr, x, mid+1, high)
elif arr[mid] > x:
return bin_search(arr,... | def bin_search(arr, x, low=0, high=None):
if high is None:
high = len(arr) - 1
if high < low:
return -1
mid = (high + low) // 2
if arr[mid] == x:
return mid
elif arr[mid] < x:
return bin_search(arr, x, mid + 1, high)
elif arr[mid] > x:
return bin_search(ar... |
class ApiException(Exception):
status_code = 500
def __init__(self, message):
super(ApiException, self).__init__()
self.message = message
def to_dict(self):
rv = dict(code=self.status_code, message=self.message)
return rv
class PlatformNotFoundException(ApiException):
... | class Apiexception(Exception):
status_code = 500
def __init__(self, message):
super(ApiException, self).__init__()
self.message = message
def to_dict(self):
rv = dict(code=self.status_code, message=self.message)
return rv
class Platformnotfoundexception(ApiException):
... |
def sumUpNumbers(inputString):
'''
CodeMaster has just returned from shopping. He scanned the check of the items he bought and
gave the resulting string to Ratiorg to figure out the total number of purchased items.
Since Ratiorg is a bot he is definitely going to automate it, so he needs a program tha... | def sum_up_numbers(inputString):
"""
CodeMaster has just returned from shopping. He scanned the check of the items he bought and
gave the resulting string to Ratiorg to figure out the total number of purchased items.
Since Ratiorg is a bot he is definitely going to automate it, so he needs a program t... |
class Solution:
def isPalindrome(self, x: int) -> bool:
if x< 0:
return False
p, res = x, 0
while p:
res = res*10 + p%10
p=int(p/10)
return res == x | class Solution:
def is_palindrome(self, x: int) -> bool:
if x < 0:
return False
(p, res) = (x, 0)
while p:
res = res * 10 + p % 10
p = int(p / 10)
return res == x |
# noqa
audio_response_multipart = b'--22b41228-f803-447b-9cde-f99d0a1652b1\r\nContent-Type: application/json; charset=UTF-8\r\n\r\n{"directive":{"header":{"namespace":"SpeechSynthesizer","name":"Speak","messageId":"3009890b-a556-48bd-87f6-cae9476f3cd8","dialogRequestId":"f3bd01b3-fb8b-4468-ba30-32bad766b3e6"},"payload"... | audio_response_multipart = b'--22b41228-f803-447b-9cde-f99d0a1652b1\r\nContent-Type: application/json; charset=UTF-8\r\n\r\n{"directive":{"header":{"namespace":"SpeechSynthesizer","name":"Speak","messageId":"3009890b-a556-48bd-87f6-cae9476f3cd8","dialogRequestId":"f3bd01b3-fb8b-4468-ba30-32bad766b3e6"},"payload":{"url"... |
START = 10
END = 30
SERVER_HOST = "nas.korov.org"
# Mongo
MONGO_URL = "mongodb://spider:spider@%s:27017/spider" % (SERVER_HOST)
# Redis
REDIS_HOST = SERVER_HOST
REDIS_PORT = 6379
REDIS_USER = "root"
REDIS_PASSWORD = "***"
PROXY_SET = {'60.191.11.249:3128', '27.128.242.141:8089', '183.247.152.98:53281', '172.104.84.1... | start = 10
end = 30
server_host = 'nas.korov.org'
mongo_url = 'mongodb://spider:spider@%s:27017/spider' % SERVER_HOST
redis_host = SERVER_HOST
redis_port = 6379
redis_user = 'root'
redis_password = '***'
proxy_set = {'60.191.11.249:3128', '27.128.242.141:8089', '183.247.152.98:53281', '172.104.84.161:443', '60.185.205.... |
# Stack OverFlow: 'Python Finding Prime Factors'
def prime_factors(x):
x=2520
'''x=232792560 # lcm of the first 10 natural numbers'''
A=[]
for i in range (2, x):
while x%i==0:
x=x/i
A.append(i)
if sum(A)==0:
A.append(x)
return A
... | def prime_factors(x):
x = 2520
'x=232792560 # lcm of the first 10 natural numbers'
a = []
for i in range(2, x):
while x % i == 0:
x = x / i
A.append(i)
if sum(A) == 0:
A.append(x)
return A
print(prime_factors(2520))
def primes(y):
if y == 1:
... |
class CommandsMap:
commands_hash_map = {"login": "LoginCommand",
"get": "GetUrl",
"createproject": "CreateProjectCommand",
"deleteproject": "DeleteProjectCommand",
"creategroup": "CreateGroupCommand",
... | class Commandsmap:
commands_hash_map = {'login': 'LoginCommand', 'get': 'GetUrl', 'createproject': 'CreateProjectCommand', 'deleteproject': 'DeleteProjectCommand', 'creategroup': 'CreateGroupCommand', 'deletegroup': 'DeleteGroupCommand', 'createusers': 'CreateUserCommand', 'removeusers': 'RemoveUserCommand', 'expor... |
'''
Created on Nov 30, 2016
@author: User
'''
def manipulate_data(data = []):
#data = []
solutions = []
count_positives = 0
sum_negatives = 0
if data == []:
return "[]"
#elif len(data) > 2:
#raise TypeError("takes only two argument " + str((len(data))) + " given")
elif not ... | """
Created on Nov 30, 2016
@author: User
"""
def manipulate_data(data=[]):
solutions = []
count_positives = 0
sum_negatives = 0
if data == []:
return '[]'
elif not isinstance(data, list):
return 'argument must be a list'
for i in data:
if not type(i) == int and float:
... |
# Given three integers between 1 and 11, if their sum is less than or equal to 21, return their sum. If their sum exceeds 21 and a number
# is '11', reduce the total sum by 10. Finally, if teh sum (even after adjustment) exceeds 21, return 'BUST'
def blackJack(a, b, c):
if((a <= 11 and a >= 1) or (b <= 11 and b >... | def black_jack(a, b, c):
if a <= 11 and a >= 1 or (b <= 11 and b >= 1) or (c <= 11 and c >= 1):
sum = a + b + c
if sum < 21:
return sum
elif sum > 21 and (a == 11 or b == 11 or c == 11):
sum = sum - 10
if sum > 21:
return 'BUST'
... |
class ListNode:
def __init__(self, data=0):
self.data = data
self.prev = None
self.next = None
class DoublyLinkedList:
def __init__(self):
self.head = None
self.tail = None
def is_empty(self):
return False if self.head else True
def append(self, data):
... | class Listnode:
def __init__(self, data=0):
self.data = data
self.prev = None
self.next = None
class Doublylinkedlist:
def __init__(self):
self.head = None
self.tail = None
def is_empty(self):
return False if self.head else True
def append(self, data)... |
suma = 0
def multiple(n):
global suma
if n < 3:
return suma
n -= 1
suma += n if n % 3 == 0 or n % 5 == 0 else 0
return multiple(n)
print(multiple(10))
| suma = 0
def multiple(n):
global suma
if n < 3:
return suma
n -= 1
suma += n if n % 3 == 0 or n % 5 == 0 else 0
return multiple(n)
print(multiple(10)) |
class Solution:
def numRookCaptures(self, board: List[List[str]]) -> int:
# find R's position
m = 0 # record the line of R
n = 0 # record the column of R
# B = []
# p = []
for i in range(len(board)):
for j in range(len(board[i])):
if bo... | class Solution:
def num_rook_captures(self, board: List[List[str]]) -> int:
m = 0
n = 0
for i in range(len(board)):
for j in range(len(board[i])):
if board[i][j] == 'R':
m = i
n = j
line = board[m]
column = ... |
def enum_defaults(schema):
try:
return schema["enum"][0]
except IndexError:
return None
def object_defaults(schema):
return {k: compute_defaults(s) for k, s in schema["properties"].items()}
def array_defaults(schema):
items_schema = schema['items']
if isinstance(items_schema, dic... | def enum_defaults(schema):
try:
return schema['enum'][0]
except IndexError:
return None
def object_defaults(schema):
return {k: compute_defaults(s) for (k, s) in schema['properties'].items()}
def array_defaults(schema):
items_schema = schema['items']
if isinstance(items_schema, dic... |
for i in range(int(input())):
n,k,x,y = [int(i) for i in input().split()]
e=(x+k)%n
f = 0
while(e!=x):
if(e==y):
f=1
break
e=(e+k)%n
if(x==y):
f=1
if f==1:
print('YES')
if f==0:
print("NO") | for i in range(int(input())):
(n, k, x, y) = [int(i) for i in input().split()]
e = (x + k) % n
f = 0
while e != x:
if e == y:
f = 1
break
e = (e + k) % n
if x == y:
f = 1
if f == 1:
print('YES')
if f == 0:
print('NO') |
class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
if len(nums) <= 1:
return len(nums)
slow = 1
for h in range(1, len(nums)):
if nums[h] != nums[h - 1]:
nums[slow] = nums[h]
slow += 1
return slow
nums = [1, 1,... | class Solution:
def remove_duplicates(self, nums: List[int]) -> int:
if len(nums) <= 1:
return len(nums)
slow = 1
for h in range(1, len(nums)):
if nums[h] != nums[h - 1]:
nums[slow] = nums[h]
slow += 1
return slow
nums = [1, 1,... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def deleteDuplicates(self, head: ListNode) -> ListNode:
if not head:
return
memo = head
rst = head
while head and head.n... | class Solution:
def delete_duplicates(self, head: ListNode) -> ListNode:
if not head:
return
memo = head
rst = head
while head and head.next:
if head.val != head.next.val:
memo = memo.next
head = head.next
else:
... |
'''
02 - The speed of cats
You're working on a new web service that processes Instagram feeds
to identify which pictures contain cats (don't ask why -- it's the
internet). The code that processes the data is slower than you would
like it to be, so you are working on tuning it up to run faster. Given
an i... | """
02 - The speed of cats
You're working on a new web service that processes Instagram feeds
to identify which pictures contain cats (don't ask why -- it's the
internet). The code that processes the data is slower than you would
like it to be, so you are working on tuning it up to run faster. Given
an i... |
GenerateDSNamespaceDefs = {
"ConsultarLoteRpsEnvio": 'xmlns="http://www.ginfes.com.br/servico_consultar_lote_rps_envio_v03.xsd" xmlns:tipos="http://www.ginfes.com.br/tipos_v03.xsd"',
"EnviarLoteRpsEnvio": 'xmlns="http://www.ginfes.com.br/servico_enviar_lote_rps_envio_v03.xsd" xmlns:tipos="http://www.ginfes.com... | generate_ds_namespace_defs = {'ConsultarLoteRpsEnvio': 'xmlns="http://www.ginfes.com.br/servico_consultar_lote_rps_envio_v03.xsd" xmlns:tipos="http://www.ginfes.com.br/tipos_v03.xsd"', 'EnviarLoteRpsEnvio': 'xmlns="http://www.ginfes.com.br/servico_enviar_lote_rps_envio_v03.xsd" xmlns:tipos="http://www.ginfes.com.br/tip... |
# This algorithm search the minimum path between every node in a graph #
# Input: graph.
# graph contains every value between nodes
# Output: graph
# The same graph, but with the best routes. #
def floyd(graph):
for m in range(len(graph)):
for i in range(len(graph)):
for j in range(len(grap... | def floyd(graph):
for m in range(len(graph)):
for i in range(len(graph)):
for j in range(len(graph)):
if graph[i][j] >= 0 and graph[i][m] >= 0 and (graph[m][j] >= 0):
graph[i][j] = min(graph[i][j], graph[i][m] + graph[m][j])
elif graph[i][j] ==... |
#!/usr/bin/env python
# coding=utf-8
class ListNode:
def __init__(self,x):
self.val = x
self.next = None
def has_cycle(head):
if head == None or head.next == None:
return False
node1 = head
node2 = head.next
while node1 != node2:
if node2 == None or node2.next == No... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
def has_cycle(head):
if head == None or head.next == None:
return False
node1 = head
node2 = head.next
while node1 != node2:
if node2 == None or node2.next == None:
return False
... |
def parse(data):
return [int(x) for x in data.split(",")]
def moves(data, cost=lambda c: c):
for target in range(min(data), max(data)):
yield sum(cost(abs(d - target)) for d in data)
def aoc(data):
return min(moves(parse(data)))
| def parse(data):
return [int(x) for x in data.split(',')]
def moves(data, cost=lambda c: c):
for target in range(min(data), max(data)):
yield sum((cost(abs(d - target)) for d in data))
def aoc(data):
return min(moves(parse(data))) |
def judge(n, a, b):
str_n = str(n)
sum = 0
for i in range(len(str_n)):
sum += int(str_n[i])
return a <= sum <= b
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
if judge(i, a, b):
ans += i
print(ans) | def judge(n, a, b):
str_n = str(n)
sum = 0
for i in range(len(str_n)):
sum += int(str_n[i])
return a <= sum <= b
(n, a, b) = map(int, input().split())
ans = 0
for i in range(1, n + 1):
if judge(i, a, b):
ans += i
print(ans) |
class Solution:
def addToArrayForm(self, num: List[int], k: int) -> List[int]:
num1 = ""
res = []
for i in num:
num1 += str(i)
result = str(int(num1)+int(k))
res[:0] = result
return res
| class Solution:
def add_to_array_form(self, num: List[int], k: int) -> List[int]:
num1 = ''
res = []
for i in num:
num1 += str(i)
result = str(int(num1) + int(k))
res[:0] = result
return res |
__all__ = [
'grapheneapi',
"rpc",
"api",
"exceptions",
"http",
"websocket"
]
| __all__ = ['grapheneapi', 'rpc', 'api', 'exceptions', 'http', 'websocket'] |
#
# PySNMP MIB module GBOND-ATM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/GBOND-ATM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:18:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, value_size_constraint, single_value_constraint, constraints_intersection) ... |
block = (22,0)
empty = (0,0)
class TempHouse: #inheritance
blueprint = [
[
[block, block, block, block, block],
[block, block, block, block, block],
[block, block, block, block, block],
[block, block, block, block, block],
[block, block, block, bl... | block = (22, 0)
empty = (0, 0)
class Temphouse:
blueprint = [[[block, block, block, block, block], [block, block, block, block, block], [block, block, block, block, block], [block, block, block, block, block], [block, block, block, block, block]], [[block, block, block, block, block], [block, empty, empty, empty, ... |
class Test1:
def __init__(self):
pass
def Prerequests(self,name):
print('this is Prerequests jeevan',name)
def TestCase1(self):
print('Test Case1')
def TestCase2(self):
print('Test Case1')
def TestCase3(self):
print('Test Case1')
def TestCase4(self):
print('Test Case1')
def closer(self):
p... | class Test1:
def __init__(self):
pass
def prerequests(self, name):
print('this is Prerequests jeevan', name)
def test_case1(self):
print('Test Case1')
def test_case2(self):
print('Test Case1')
def test_case3(self):
print('Test Case1')
def test_case4(... |
''' A Palindromic Sequence is a sequence of numbers which is
the same when read both forward and backward.
Example: 1, 2, 3, 2, 1 '''
def isPalindromic(arr, N):
for i in range(0, int(N / 2) - 1):
if arr[i] != arr[N - i -1]:
return False
return True
print("Enter number of elements in arra... | """ A Palindromic Sequence is a sequence of numbers which is
the same when read both forward and backward.
Example: 1, 2, 3, 2, 1 """
def is_palindromic(arr, N):
for i in range(0, int(N / 2) - 1):
if arr[i] != arr[N - i - 1]:
return False
return True
print('Enter number of elements in arra... |
def foo():
return (
r"<caret>oo"
r"ps",
)
| def foo():
return ('<caret>oops',) |
def add_native_methods(clazz):
def init____(a0):
raise NotImplementedError()
def getSystemProxy__java_lang_String__java_lang_String__(a0, a1, a2):
raise NotImplementedError()
clazz.init____ = staticmethod(init____)
clazz.getSystemProxy__java_lang_String__java_lang_String__ = getSystemP... | def add_native_methods(clazz):
def init____(a0):
raise not_implemented_error()
def get_system_proxy__java_lang__string__java_lang__string__(a0, a1, a2):
raise not_implemented_error()
clazz.init____ = staticmethod(init____)
clazz.getSystemProxy__java_lang_String__java_lang_String__ = ge... |
i = 1
while i <= 3000:
print("i love you",i)
i += 1
print(">>>>>>>>>>>><<<<<<<<<<<<")
| i = 1
while i <= 3000:
print('i love you', i)
i += 1
print('>>>>>>>>>>>><<<<<<<<<<<<') |
# type: ignore
__all__ = [
"isdicom",
"rgb2hsv",
"rgb2gray",
"im2double",
"isnitf",
"getrangefromclass",
"isdpx",
"hsv2rgb",
"imshow",
]
def isdicom(*args):
raise NotImplementedError("isdicom")
def rgb2hsv(*args):
raise NotImplementedError("rgb2hsv")
def rgb2gray(*args... | __all__ = ['isdicom', 'rgb2hsv', 'rgb2gray', 'im2double', 'isnitf', 'getrangefromclass', 'isdpx', 'hsv2rgb', 'imshow']
def isdicom(*args):
raise not_implemented_error('isdicom')
def rgb2hsv(*args):
raise not_implemented_error('rgb2hsv')
def rgb2gray(*args):
raise not_implemented_error('rgb2gray')
def im... |
#Programa_Calculo_do_Salario
salario = 0.0
print("Calculo do salario")
hora = int(input("Informe o numero de horas trabalhadas: "))
valor = float(input("Informe o valor que voce recebe por hora trabalhada: "))
salario = hora*valor
print("Salario: R$ %.2f" %salario)
| salario = 0.0
print('Calculo do salario')
hora = int(input('Informe o numero de horas trabalhadas: '))
valor = float(input('Informe o valor que voce recebe por hora trabalhada: '))
salario = hora * valor
print('Salario: R$ %.2f' % salario) |
#
# PySNMP MIB module WWP-LEOS-SYSTEM-CONTROL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-LEOS-SYSTEM-CONTROL-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:31:42 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python versio... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, value_range_constraint, constraints_intersection, single_value_constraint) ... |
# WA - End of Knight-in-Training - Start
sm.setSpeakerID(1101002)
response = sm.sendAskYesNo("#h #, you have done surprisingly well. Do you wish to take the #b Knighthood Exam#k? If you pass, "
"you will become a full-fledged knight. #b\r\n(Note, if you accept, you will be ported to Ereve. Talk to your ... | sm.setSpeakerID(1101002)
response = sm.sendAskYesNo('#h #, you have done surprisingly well. Do you wish to take the #b Knighthood Exam#k? If you pass, you will become a full-fledged knight. #b\r\n(Note, if you accept, you will be ported to Ereve. Talk to your instructor there.)')
if response:
if not sm.getFieldID()... |
# class union
advanced.union1(advanced.a)
advanced.union1(advanced.b)
# primative union
advanced.union2(123)
advanced.union2("foo") | advanced.union1(advanced.a)
advanced.union1(advanced.b)
advanced.union2(123)
advanced.union2('foo') |
class Sorting:
@staticmethod
def radix_sort(L):
if len(L) == 0:
return []
bins = [list() for i in range(10)]
main = L[:]
digit = 1
Max = max(main)
while (Max > digit):
for i in main:
bins[(i//digit) % 10].appe... | class Sorting:
@staticmethod
def radix_sort(L):
if len(L) == 0:
return []
bins = [list() for i in range(10)]
main = L[:]
digit = 1
max = max(main)
while Max > digit:
for i in main:
bins[i // digit % 10].append(i)
... |
money = float(input())
year_must_live = int(input())
ivan_years = 18 - 1
for years in range(1800, year_must_live + 1):
if years % 2 == 0:
money -= 12000
ivan_years += 1
if years % 2 != 0:
ivan_years += 1
money -= abs(12000 + (ivan_years * 50))
if money >= 0:
print(f"Yes! He ... | money = float(input())
year_must_live = int(input())
ivan_years = 18 - 1
for years in range(1800, year_must_live + 1):
if years % 2 == 0:
money -= 12000
ivan_years += 1
if years % 2 != 0:
ivan_years += 1
money -= abs(12000 + ivan_years * 50)
if money >= 0:
print(f'Yes! He wil... |
## Odd or Even?
## 7 kyu
## https://www.codewars.com/kata/5949481f86420f59480000e7
def oddOrEven(arr):
return 'even' if sum(arr) % 2 == 0 else 'odd' | def odd_or_even(arr):
return 'even' if sum(arr) % 2 == 0 else 'odd' |
def SomaImposto(taxaImposto,custo):
taxaImposto = taxaImposto/100
ValorFinal = custo + (custo*taxaImposto)
print(F"Valor final do produto: R${ValorFinal}")
taxaImposto = float(input("Digite a taxa de imposto: "))
custo = float(input("Digite o custo do produto: "))
SomaImposto(taxaImposto,custo) | def soma_imposto(taxaImposto, custo):
taxa_imposto = taxaImposto / 100
valor_final = custo + custo * taxaImposto
print(f'Valor final do produto: R${ValorFinal}')
taxa_imposto = float(input('Digite a taxa de imposto: '))
custo = float(input('Digite o custo do produto: '))
soma_imposto(taxaImposto, custo) |
def factorial(x):
if x <= 1:
return x
else:
return x * factorial(x-1)
n = int(input())
print(factorial(n)) | def factorial(x):
if x <= 1:
return x
else:
return x * factorial(x - 1)
n = int(input())
print(factorial(n)) |
n = int(input())
a = list(map(int, input().split()))
parity = 0 if sum(a) % 2 == 0 else 1
print(len([x for x in a if x % 2 == parity]))
| n = int(input())
a = list(map(int, input().split()))
parity = 0 if sum(a) % 2 == 0 else 1
print(len([x for x in a if x % 2 == parity])) |
def test_entry_get(saucelog):
response = (saucelog.get("/entry/1"))
assert response.status_code_is(200)
def test_entry_patch(saucelog):
example_post = {
"title": "Habenero Sizzle",
"description": "",
"heat_level": "medium"
}
example_patch = {
"title": "Habenero Si... | def test_entry_get(saucelog):
response = saucelog.get('/entry/1')
assert response.status_code_is(200)
def test_entry_patch(saucelog):
example_post = {'title': 'Habenero Sizzle', 'description': '', 'heat_level': 'medium'}
example_patch = {'title': 'Habenero Sizzle', 'description': "It's really hot!", 'h... |
def modpow(a, b, m):
res = 1
while b != 0:
if b % 2 == 1:
res = res * a % m
a = a * a % m
b >>= 1
return res
| def modpow(a, b, m):
res = 1
while b != 0:
if b % 2 == 1:
res = res * a % m
a = a * a % m
b >>= 1
return res |
# This problem was recently asked by Facebook:
# Given a list of building in the form of (left, right, height), return what the skyline should look like.
# The skyline should be in the form of a list of (x-axis, height),
# where x-axis is the next point where there is a change in height starting from 0,
# and height ... | def generate_skyline(buildings):
if not buildings:
return []
if len(buildings) == 1:
(l, r, h) = buildings[0]
return [[l, h], [r, 0]]
mid = len(buildings) // 2
left = generate_skyline(buildings[:mid])
right = generate_skyline(buildings[mid:])
return merge(left, right)
de... |
class DatabaseRepository:
def __init__(self, client):
self._client = client
def store_model(self, name):
return self._client.post("/models/", data={"file": name})
def store_prediction(self, prediction):
return self._client.post("/predictions/", data=prediction)
def list_predic... | class Databaserepository:
def __init__(self, client):
self._client = client
def store_model(self, name):
return self._client.post('/models/', data={'file': name})
def store_prediction(self, prediction):
return self._client.post('/predictions/', data=prediction)
def list_predi... |
data={101:'ABC',102:'DEF',102:'XYZ'}
print(data)
Employee = {"Name": "John", "Age": 29, "salary":25000,"Company":"GOOGLE"}
print(type(Employee))
print("printing Employee data .... ")
print(Employee)
print(Employee["Age"])
Employee["Company"]="wipro"
print(Employee)
del Employee['Age']
print(Employee)
| data = {101: 'ABC', 102: 'DEF', 102: 'XYZ'}
print(data)
employee = {'Name': 'John', 'Age': 29, 'salary': 25000, 'Company': 'GOOGLE'}
print(type(Employee))
print('printing Employee data .... ')
print(Employee)
print(Employee['Age'])
Employee['Company'] = 'wipro'
print(Employee)
del Employee['Age']
print(Employee) |
a = [3, 6, 7, 8, 9, 2, 4, 23, 75, 23, 123, 67]
# b = []
# for item in a:
# if item%2==0:
# b.append(item)
# print(b)
# Shortcut to write the same:
b = [i for i in a if i%2==0]
print(b)
t = [1, 4, 2, 4, 1, 2, 3]
s = {i for i in t}
print(s) | a = [3, 6, 7, 8, 9, 2, 4, 23, 75, 23, 123, 67]
b = [i for i in a if i % 2 == 0]
print(b)
t = [1, 4, 2, 4, 1, 2, 3]
s = {i for i in t}
print(s) |
#!/usr/bin/python3
def roman_to_int(roman_string):
arab = {'M': 1000, 'D': 500, 'C': 100, 'L': 50, 'X': 10, 'V': 5, 'I': 1}
values = {}
counter = 0
product = 0
for letter in roman_string:
if values.get(letter):
values[letter] = values[letter] + arab[letter]
else:
... | def roman_to_int(roman_string):
arab = {'M': 1000, 'D': 500, 'C': 100, 'L': 50, 'X': 10, 'V': 5, 'I': 1}
values = {}
counter = 0
product = 0
for letter in roman_string:
if values.get(letter):
values[letter] = values[letter] + arab[letter]
else:
values[letter] ... |
patchkeymap = [
"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t",
"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T",
"1","2","3","4","5","6","7","8","9","0"
]
effectkeymap = ["F1","F2","F3","F4","F5","F6"]
tunerkey = "F9"
emptypatch = [
0xf0,0x52,0x0... | patchkeymap = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0']
effectkeymap = ['F1', 'F2', 'F3', 'F4', 'F5', 'F6']
tun... |
def watch_pyramid_from_the_side(characters):
if not characters:
return characters
res=[]
length=len(characters)
for i in range(length):
res.append(" "*(length-i-1)+characters[-i-1]*(i*2+1)+" "*(length-i-1))
return "\n".join(res)
def watch_pyramid_from_above(characters):
if not ch... | def watch_pyramid_from_the_side(characters):
if not characters:
return characters
res = []
length = len(characters)
for i in range(length):
res.append(' ' * (length - i - 1) + characters[-i - 1] * (i * 2 + 1) + ' ' * (length - i - 1))
return '\n'.join(res)
def watch_pyramid_from_abo... |
# Write a program to check whether a number is an even multiple of 3
# for more info on this quiz, go to this url: http://www.programmr.com/even-multiple-3
def even_multiple_of_3(number):
if number % 3 == 0 and number % 2 == 0:
return True
else:
return False
if __name__ == "__main__":
pr... | def even_multiple_of_3(number):
if number % 3 == 0 and number % 2 == 0:
return True
else:
return False
if __name__ == '__main__':
print(even_multiple_of_3(6)) |
# PROBLEM LINK:- https://leetcode.com/problems/minimum-depth-of-binary-tree/
class Solution:
def minDepth(self, root: Optional[TreeNode]) -> int:
if not root:
return 0
if None in [root.left, root.right]:
return 1 + max(self.minDepth(root.left), self.minDepth(root.ri... | class Solution:
def min_depth(self, root: Optional[TreeNode]) -> int:
if not root:
return 0
if None in [root.left, root.right]:
return 1 + max(self.minDepth(root.left), self.minDepth(root.right))
return 1 + min(self.minDepth(root.left), self.minDepth(root.right)) |
class Cell:
def __init__(self, arg):
self.arg = arg
def to_string(self):
if isinstance(self.arg, list):
v = "\n".join([f"'{el}'" for el in self.arg])
else:
v = self.arg
return v
class NestedCell(Cell):
def __str__(self):
return "{{%s}}" % se... | class Cell:
def __init__(self, arg):
self.arg = arg
def to_string(self):
if isinstance(self.arg, list):
v = '\n'.join([f"'{el}'" for el in self.arg])
else:
v = self.arg
return v
class Nestedcell(Cell):
def __str__(self):
return '{{%s}}' % s... |
TrainingDays = 6
epochs = 50
avg_days = 5
std_days = 5
avg_window = 5
std_window = 5 | training_days = 6
epochs = 50
avg_days = 5
std_days = 5
avg_window = 5
std_window = 5 |
class Message(object):
__slots__ = ('id', 'sender', 'recipients', 'created_at', 'body')
def __init__(self, id, sender, recipients, created_at, body):
self.id = id
self.sender = sender
self.recipients = recipients
self.created_at = created_at
self.body = body
def ... | class Message(object):
__slots__ = ('id', 'sender', 'recipients', 'created_at', 'body')
def __init__(self, id, sender, recipients, created_at, body):
self.id = id
self.sender = sender
self.recipients = recipients
self.created_at = created_at
self.body = body
def __e... |
x = input("Write x: ")
n = input("Write n: ")
def rec(x, n):
if n == 0:
print(1)
return
elif n < 0:
rec(n - 1)
if __name__ == '__main__':
num = int(input('Enter the number: '))
rec(num)
| x = input('Write x: ')
n = input('Write n: ')
def rec(x, n):
if n == 0:
print(1)
return
elif n < 0:
rec(n - 1)
if __name__ == '__main__':
num = int(input('Enter the number: '))
rec(num) |
def resolve():
'''
code here
'''
S_dash = input()
T = input()
is_flag = False
res = ''
res_list = ['zzzzz']
for i in range(len(S_dash) - len(T) +1):
res = S_dash[:i]
# print(i, res)
if len(S_dash) - len(res) >= len(T):
for j in range(len(T)):
... | def resolve():
"""
code here
"""
s_dash = input()
t = input()
is_flag = False
res = ''
res_list = ['zzzzz']
for i in range(len(S_dash) - len(T) + 1):
res = S_dash[:i]
if len(S_dash) - len(res) >= len(T):
for j in range(len(T)):
if S_dash[i ... |
class Solution:
def maxProfit(self, prices: List[int]) -> int:
# normal solution
min_price = inf
max_profit = 0
for i in prices:
if i < min_price:
min_price = i
elif i - min_price > max_profit:
max_profit = i - min_pr... | class Solution:
def max_profit(self, prices: List[int]) -> int:
min_price = inf
max_profit = 0
for i in prices:
if i < min_price:
min_price = i
elif i - min_price > max_profit:
max_profit = i - min_price
return max_profit |
#
# PySNMP MIB module XYLO-MIB-SMI (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYLO-MIB-SMI
# Produced by pysmi-0.3.4 at Wed May 1 15:45:55 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,... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, constraints_union, value_range_constraint, single_value_constraint) ... |
# MIT License
# Copyright (c) 2019 Saranraj Nambusubramaniyan
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, mo... | class Callbacks:
def __init__(self, timesteps, avail_callbacks, *argv):
self.timesteps = timesteps
self.argv = argv
if argv:
self.dispatcher = validate().callbacks(argv, avail_callbacks)
self.callbacks = []
for class_name in list(self.dispatcher.keys()):
... |
def naive_solution(N, A):
# Goal is to calculate the value of every counter after all operations.
counter = [0] * N
for x in A:
if 1 <= x and x <= N:
counter[x] += 1
elif x == N + 1:
counter = [max(counter) for _ in counter] # O(MN) for worst case.
return counte... | def naive_solution(N, A):
counter = [0] * N
for x in A:
if 1 <= x and x <= N:
counter[x] += 1
elif x == N + 1:
counter = [max(counter) for _ in counter]
return counter
def lazy_solution(N, A):
counter = [0] * N
max_counter = 0
local_max = 0
for x in A... |
with open('hightemp.txt') as f:
data = map(lambda s: s.split('\t'), f.readlines())
with open('col1.txt', mode='w') as fo1:
fo1.writelines(map(lambda l: l[0]+'\n', data))
with open('col2.txt', mode='w') as fo2:
fo2.writelines(map(lambda l: l[1]+'\n', data))
| with open('hightemp.txt') as f:
data = map(lambda s: s.split('\t'), f.readlines())
with open('col1.txt', mode='w') as fo1:
fo1.writelines(map(lambda l: l[0] + '\n', data))
with open('col2.txt', mode='w') as fo2:
fo2.writelines(map(lambda l: l[1] + '\n', data)) |
# lists.py
x = [1, 2, 3]
y = [4, 5]
print(x) # [1, 2, 3]
print(x[0]) # 1
print(x[2]) # 3
x.append(4)
print(x) # [1, 2, 3, 4]
print(x + y) # [1, 2, 3, 4, 5]
| x = [1, 2, 3]
y = [4, 5]
print(x)
print(x[0])
print(x[2])
x.append(4)
print(x)
print(x + y) |
def test_get_nonce(provider, account, contract):
initial_nonce = provider.get_nonce(account.contract_address) # type: ignore
# Transact to increase nonce
contract.increase_balance(account.address, 123, sender=account)
actual = provider.get_nonce(account.contract_address) # type: ignore
assert ac... | def test_get_nonce(provider, account, contract):
initial_nonce = provider.get_nonce(account.contract_address)
contract.increase_balance(account.address, 123, sender=account)
actual = provider.get_nonce(account.contract_address)
assert actual == initial_nonce + 1
def test_contract_at(contract, provider)... |
frames = []
env.reset()
observation, reward, done, _ = env.step(env.action_space.sample())
reward_sum = 0
while not(done):
img = env.render(mode = "rgb_array")
env.close()
frames.append(img)
reward_sum += reward
p_left = pg.model_predict.predict(np.expand_dims(observation,axis=0))
action = 0 if... | frames = []
env.reset()
(observation, reward, done, _) = env.step(env.action_space.sample())
reward_sum = 0
while not done:
img = env.render(mode='rgb_array')
env.close()
frames.append(img)
reward_sum += reward
p_left = pg.model_predict.predict(np.expand_dims(observation, axis=0))
action = 0 if ... |
ALPH = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
def to_base_64(string):
binarystr = ''
encoded = []
for ch in string:
eightbits = str(bin(ord(ch)))[2:]
eightbits = eightbits.rjust(8,'0')
binarystr += eightbits
if len(binarystr)%6 != 0:
... | alph = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
def to_base_64(string):
binarystr = ''
encoded = []
for ch in string:
eightbits = str(bin(ord(ch)))[2:]
eightbits = eightbits.rjust(8, '0')
binarystr += eightbits
if len(binarystr) % 6 != 0:
binary... |
def myfunc(a,b,*c):
print(a)
print(b)
for i in c:
print(i)
myfunc(1,2)
myfunc('a','b','c','d')
myfunc(3,4,5,6,'hello')
| def myfunc(a, b, *c):
print(a)
print(b)
for i in c:
print(i)
myfunc(1, 2)
myfunc('a', 'b', 'c', 'd')
myfunc(3, 4, 5, 6, 'hello') |
class Inventory:
def __init__(self, ID, name, numInStock, img, cost):
self.ID = ID
self.name = name
self.numInStock = numInStock
self.img = img
self.cost = cost
| class Inventory:
def __init__(self, ID, name, numInStock, img, cost):
self.ID = ID
self.name = name
self.numInStock = numInStock
self.img = img
self.cost = cost |
print("\tSOLVE A SECOND GRADE EQUATION")
print("Please insert a,b,c like in (ax^2+bx+c=0)")
try:
a = float(input("Insert a: "))
b = float(input("Insert b: "))
c = float(input("Insert c: "))
except ValueError:
print("You didn't enter a valid number, exiting.")
delta = b*b-4*a*c
print("Delta is: " + str(d... | print('\tSOLVE A SECOND GRADE EQUATION')
print('Please insert a,b,c like in (ax^2+bx+c=0)')
try:
a = float(input('Insert a: '))
b = float(input('Insert b: '))
c = float(input('Insert c: '))
except ValueError:
print("You didn't enter a valid number, exiting.")
delta = b * b - 4 * a * c
print('Delta is: '... |
#
# This file contains the Python code from Program 6.18 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/pgm06_18.txt
#
class DequeAsArray... | class Dequeasarray(QueueAsArray, Deque):
def __init__(self, size=0):
super(DequeAsArray, self).__init__(size)
def enqueue_head(self, obj):
if self._count == len(self._array):
raise ContainerFull
if self._head == 0:
self._head = len(self._array) - 1
else:... |
class TaskError(Exception):
def __init__(self, *msg, **value):
Exception.__init__(self, *msg)
for key, value in value.items():
self.key = value
| class Taskerror(Exception):
def __init__(self, *msg, **value):
Exception.__init__(self, *msg)
for (key, value) in value.items():
self.key = value |
def fibo(n):
a,b=0,1
while a < n:
print(a,end='')
a,b=b,a+b
print()
fibo(1000)
fibo(n)
| def fibo(n):
(a, b) = (0, 1)
while a < n:
print(a, end='')
(a, b) = (b, a + b)
print()
fibo(1000)
fibo(n) |
c = 1 # global variable
def add():
print(c)
add()
| c = 1
def add():
print(c)
add() |
print('\033[1;35;40mHello word!\033[m')
print('\033[7;40mInvertido\033[m')
#criando cores
cores = {'Limpa':'\033[m', 'azul':'\033[34m', 'rosa':'\033[35m'}
print(cores['rosa'],'life is a beauteful') | print('\x1b[1;35;40mHello word!\x1b[m')
print('\x1b[7;40mInvertido\x1b[m')
cores = {'Limpa': '\x1b[m', 'azul': '\x1b[34m', 'rosa': '\x1b[35m'}
print(cores['rosa'], 'life is a beauteful') |
if 0: # i < 1:
doSomething()
while 0: # j < k:
j = fleep(j, k)
| if 0:
do_something()
while 0:
j = fleep(j, k) |
car = 'subaru'
print("Is car == 'subaru'? I predict TRUE")
print(car == 'subaru')
print("\nIs car == 'audi'? I predict FALSE")
print(car == 'audi') | car = 'subaru'
print("Is car == 'subaru'? I predict TRUE")
print(car == 'subaru')
print("\nIs car == 'audi'? I predict FALSE")
print(car == 'audi') |
# WRITE YOUR SOLUTION HERE:
class Recording:
def __init__(self, length: float):
self.__length = length
if length < 0:
raise ValueError("Sorry, no numbers below zero")
@property
def length(self):
return self.__length
@length.setter
def length(self, lengt... | class Recording:
def __init__(self, length: float):
self.__length = length
if length < 0:
raise value_error('Sorry, no numbers below zero')
@property
def length(self):
return self.__length
@length.setter
def length(self, length):
if length >= 0:
... |
K = int(input())
ans = ""
while K != 1:
if K % 2 == 1:
ans += "2"
else:
ans += "0"
K //= 2
ans += "2"
print(ans[::-1])
| k = int(input())
ans = ''
while K != 1:
if K % 2 == 1:
ans += '2'
else:
ans += '0'
k //= 2
ans += '2'
print(ans[::-1]) |
#!/usr/bin/env python
errorCatalog = {
1000: [1000, 'Undefined Error'],
1001: [1001, 'You must supply an output type to run nodebuilder'],
1002: [1002, 'XML Documents must have unique keys in order to be imported into database']
}
| error_catalog = {1000: [1000, 'Undefined Error'], 1001: [1001, 'You must supply an output type to run nodebuilder'], 1002: [1002, 'XML Documents must have unique keys in order to be imported into database']} |
class BaseInvestment:
def __init__(self):
self.amount_invested = 0
self.initial_balance = 0
self.target_balance = 0
self.target_percentage = 0
self.initial_percentage = 0
def is_deficit(self):
return self.initial_balance + self.amount_invested < self.target_balan... | class Baseinvestment:
def __init__(self):
self.amount_invested = 0
self.initial_balance = 0
self.target_balance = 0
self.target_percentage = 0
self.initial_percentage = 0
def is_deficit(self):
return self.initial_balance + self.amount_invested < self.target_bala... |
def g(a):
s = [a[0]]
for x, y in zip(a[1:], a[:-1]):
i = len(s) - 1
if u(x) ^ u(y):
s += [x]
else:
s[i] += x
return s == a and a or g(s)
simplifiedArray = g
u = lambda n: n>1 and all([n % j for j in range(2,n//2+1)])
print(simplifiedArray([-3, 4, 5, 2, 0, ... | def g(a):
s = [a[0]]
for (x, y) in zip(a[1:], a[:-1]):
i = len(s) - 1
if u(x) ^ u(y):
s += [x]
else:
s[i] += x
return s == a and a or g(s)
simplified_array = g
u = lambda n: n > 1 and all([n % j for j in range(2, n // 2 + 1)])
print(simplified_array([-3, 4, 5,... |
# Exists primarily to allow a constant value that has the same interface as Value
class ConstantValue:
def __init__(self, value):
self._value = value
def getValue(self, tagchar, outputFormatter):
return self._value | class Constantvalue:
def __init__(self, value):
self._value = value
def get_value(self, tagchar, outputFormatter):
return self._value |
for i in range(50):
if i < 3:
continue
else:
if i % 3 == 0:
continue
else:
print(i)
| for i in range(50):
if i < 3:
continue
elif i % 3 == 0:
continue
else:
print(i) |
class Node:
def __init__(self,item, left = None, right = None):
self.item = item
self.left = left
self.right = right
class BinaryTree:
def __init__(self):
self.root = None
def preorder(self,n):
if n != None :
print(str(n.item),'', end = '')
i... | class Node:
def __init__(self, item, left=None, right=None):
self.item = item
self.left = left
self.right = right
class Binarytree:
def __init__(self):
self.root = None
def preorder(self, n):
if n != None:
print(str(n.item), '', end='')
if ... |
# Acorn tree reactor | edelstein
REQUEST_FROM_A_DOCTOR = 23003
WHOLE_ACORN = 4034738
reactor.incHitCount()
if reactor.getHitCount() >= 3:
if sm.hasQuest(REQUEST_FROM_A_DOCTOR) and not sm.hasItem(WHOLE_ACORN, 2):
sm.dropItem(WHOLE_ACORN, sm.getPosition(objectID).getX(), sm.getPosition(objectID).getY())
sm.remo... | request_from_a_doctor = 23003
whole_acorn = 4034738
reactor.incHitCount()
if reactor.getHitCount() >= 3:
if sm.hasQuest(REQUEST_FROM_A_DOCTOR) and (not sm.hasItem(WHOLE_ACORN, 2)):
sm.dropItem(WHOLE_ACORN, sm.getPosition(objectID).getX(), sm.getPosition(objectID).getY())
sm.removeReactor() |
a = 1
b = 1.2
c = 'hello'
print(a, b, c)
print(a, b, c, 'world')
| a = 1
b = 1.2
c = 'hello'
print(a, b, c)
print(a, b, c, 'world') |
class UnknownPathException(Exception):
pass
class UnknownOrderingException(Exception):
pass
| class Unknownpathexception(Exception):
pass
class Unknownorderingexception(Exception):
pass |
class RuleExecutionError(RuntimeError):
def __init__(self, arg):
self.args = arg
| class Ruleexecutionerror(RuntimeError):
def __init__(self, arg):
self.args = arg |
# This function returns true if contents of arr1[] and arr2[] are same, otherwise false.
def compare(arr1, arr2):
MAX=256
for i in range(MAX):
if arr1[i] != arr2[i]:
return False
return True
# This function search for all permutations of pat[] in txt[]
def search(pat, txt):
MAX=256
M = len(pat)
N =... | def compare(arr1, arr2):
max = 256
for i in range(MAX):
if arr1[i] != arr2[i]:
return False
return True
def search(pat, txt):
max = 256
m = len(pat)
n = len(txt)
count_p = [0] * MAX
count_tw = [0] * MAX
for i in range(M):
countP[ord(pat[i])] += 1
... |
if __name__ == "__main__":
digits = list(map(int, input().rstrip() * 10000))
offset = int("".join(map(str, digits[:7])))
assert(offset >= len(digits) / 2)
for phase in range(100):
print("phase={}".format(phase), end="\r")
for i in range(len(digits) - 2, offset - 2, -1):
di... | if __name__ == '__main__':
digits = list(map(int, input().rstrip() * 10000))
offset = int(''.join(map(str, digits[:7])))
assert offset >= len(digits) / 2
for phase in range(100):
print('phase={}'.format(phase), end='\r')
for i in range(len(digits) - 2, offset - 2, -1):
digits... |
def create_graph (num_nodes, num_edges, array_bi):
global nodes_edges, nodes_values
i = 0
u = v = cost = 0
count_nodes_numbers = 0
root = 1
array_bi[root-1] = nodes_values[root-1]
while i < num_edges:
u = nodes_edges[count_nodes_numbers]
count_nodes_numbers += 1
v = n... | def create_graph(num_nodes, num_edges, array_bi):
global nodes_edges, nodes_values
i = 0
u = v = cost = 0
count_nodes_numbers = 0
root = 1
array_bi[root - 1] = nodes_values[root - 1]
while i < num_edges:
u = nodes_edges[count_nodes_numbers]
count_nodes_numbers += 1
v ... |
# File: arboraps_consts.py
#
# Copyright (c) 2017-2021 Splunk Inc.
#
# 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 ap... | arboraps_ta_config_server_url = 'server_url'
arboraps_ta_config_username = 'username'
arboraps_ta_config_password = 'password'
arboraps_ta_config_verify_ssl = 'verify_server_cert'
arboraps_ta_connection_test_msg = 'Querying endpoint to verify the credentials provided'
arboraps_ta_rest_login = '/platform/login'
arboraps... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.