content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
d = {
'name': 'setayesh',
'last_name': 'pasanadideh',
'age': 14,
'b_p': 'tehran',
'p': print,
'wear_glass': False
}
print(d)
print(d['last_name'])
d['p']( 'amirreza') | d = {'name': 'setayesh', 'last_name': 'pasanadideh', 'age': 14, 'b_p': 'tehran', 'p': print, 'wear_glass': False}
print(d)
print(d['last_name'])
d['p']('amirreza') |
COCO_PERSON_SKELETON = [[2, 3], [3,4], [4, 5], [2, 6], [6,7], [7,8], [2,1]]
COCO_KEYPOINTS = [
'nose', # 1
'left_eye', # 2
'right_eye', # 3
'left_ear', # 4
'right_ear', # 5
'left_shoulder', # 6
'right_shoulder', # 7
'left_elbow', # 8
... | coco_person_skeleton = [[2, 3], [3, 4], [4, 5], [2, 6], [6, 7], [7, 8], [2, 1]]
coco_keypoints = ['nose', 'left_eye', 'right_eye', 'left_ear', 'right_ear', 'left_shoulder', 'right_shoulder', 'left_elbow', 'right_elbow', 'left_wrist', 'right_wrist', 'left_hip', 'right_hip', 'left_knee', 'right_knee', 'left_ankle', 'righ... |
class StaticConnection():
def __init__(self, src, dst, bandwidth, delay, loss):
self.src = src
self.dst = dst
self.bandwidth = bandwidth
self.delay = delay
self.loss = loss | class Staticconnection:
def __init__(self, src, dst, bandwidth, delay, loss):
self.src = src
self.dst = dst
self.bandwidth = bandwidth
self.delay = delay
self.loss = loss |
{
'conditions' : [
[ 'skia_os != "ios"', {
'error': '<!(set GYP_DEFINES=\"skia_os=\'ios\'\")'
}],
],
'targets': [
{
'target_name': 'SimpleiOSApp',
'type': 'executable',
'mac_bundle' : 1,
'include_dirs' : [
'../experimental/iOSSampleApp/Shared',
],
'sou... | {'conditions': [['skia_os != "ios"', {'error': '<!(set GYP_DEFINES="skia_os=\'ios\'")'}]], 'targets': [{'target_name': 'SimpleiOSApp', 'type': 'executable', 'mac_bundle': 1, 'include_dirs': ['../experimental/iOSSampleApp/Shared'], 'sources': ['../src/views/ios/SkOSWindow_iOS.mm', '../src/views/mac/SkEventNotifier.h', '... |
vogais = {
'a': 0,
'e': 0,
'i': 0,
'o': 0,
'u': 0
}
texto = str(input('insira um texto: ')).strip().lower()
for letra in texto:
if letra in 'a':
vogais['a'] += 1
elif letra in 'e':
vogais['e'] += 1
elif letra in 'i':
vogais['i'] += 1
elif letra in 'o':
... | vogais = {'a': 0, 'e': 0, 'i': 0, 'o': 0, 'u': 0}
texto = str(input('insira um texto: ')).strip().lower()
for letra in texto:
if letra in 'a':
vogais['a'] += 1
elif letra in 'e':
vogais['e'] += 1
elif letra in 'i':
vogais['i'] += 1
elif letra in 'o':
vogais['o'] += 1
... |
# Copyright 2014 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | load('@io_bazel_rules_go//go/private:rules/binary.bzl', 'go_binary')
load('@io_bazel_rules_go//go/private:rules/library.bzl', 'go_library')
load('@io_bazel_rules_go//go/private:rules/test.bzl', 'go_test')
load('@io_bazel_rules_go//go/private:rules/cgo.bzl', 'setup_cgo_library')
def go_library_macro(name, srcs=None, cg... |
alien_0 = {'color': 'green', 'points': 5} #create a dictionary
print(alien_0['color'])
print(alien_0['points'])
new_points = alien_0['points']
print("You just earned " + str(new_points) + " points!")
print(alien_0)
alien_0['x_position'] = 0 # add to the dictionary
alien_0['y_position'] = 25 # add to the dictionary
... | alien_0 = {'color': 'green', 'points': 5}
print(alien_0['color'])
print(alien_0['points'])
new_points = alien_0['points']
print('You just earned ' + str(new_points) + ' points!')
print(alien_0)
alien_0['x_position'] = 0
alien_0['y_position'] = 25
print(alien_0)
alien_0 = {}
alien_0['color'] = 'green'
alien_0['points'] ... |
class SETTINGS:
__slots__ = ("TOKEN","DB_NAME")
def __init__(self):
self.TOKEN = '415193750:AAFNBxqmF5ow24TwzuJlzYKpYSPmt_K5p_A'
self.DB_NAME = 'vk2tl.db'
| class Settings:
__slots__ = ('TOKEN', 'DB_NAME')
def __init__(self):
self.TOKEN = '415193750:AAFNBxqmF5ow24TwzuJlzYKpYSPmt_K5p_A'
self.DB_NAME = 'vk2tl.db' |
###############################################################################
#
# $Id$
#
###############################################################################
__all__ = ["client","constants","file_list","enq_message","messages","md_client","mw_client","pe_client"]
| __all__ = ['client', 'constants', 'file_list', 'enq_message', 'messages', 'md_client', 'mw_client', 'pe_client'] |
class Node(object):
def __init__(self, id):
self.id = id
self.vec = []
self.neighbours = []
def add_neighbour(self, node_id):
self.neighbours.append(node_id)
class Graph(object):
def __init__(self):
# id -> node
self.nodes = {}
self.edges = []
... | class Node(object):
def __init__(self, id):
self.id = id
self.vec = []
self.neighbours = []
def add_neighbour(self, node_id):
self.neighbours.append(node_id)
class Graph(object):
def __init__(self):
self.nodes = {}
self.edges = []
def add_node(self, n... |
n = int(input())
matrix = [[int(n) for n in input().split(", ")] for _ in range(n)]
flat_matrix = [number for row in matrix for number in row]
print(flat_matrix)
| n = int(input())
matrix = [[int(n) for n in input().split(', ')] for _ in range(n)]
flat_matrix = [number for row in matrix for number in row]
print(flat_matrix) |
INTENT = "intent"
INTENTS = "intents"
ENTITIES = "entities"
UTTERANCES = "utterances"
USE_SYNONYMS = "use_synonyms"
SYNONYMS = "synonyms"
DATA = "data"
VALUE = "value"
TEXT = "text"
ENTITY = "entity"
SLOT_NAME = "slot_name"
TRUE_POSITIVE = "true_positive"
FALSE_POSITIVE = "false_positive"
FALSE_NEGATIVE = "false_negati... | intent = 'intent'
intents = 'intents'
entities = 'entities'
utterances = 'utterances'
use_synonyms = 'use_synonyms'
synonyms = 'synonyms'
data = 'data'
value = 'value'
text = 'text'
entity = 'entity'
slot_name = 'slot_name'
true_positive = 'true_positive'
false_positive = 'false_positive'
false_negative = 'false_negati... |
def to_hex(hh: bytes, for_c=False):
hex_values = ("{:02x}".format(c) for c in hh)
if for_c:
return "{" + ", ".join("0x{}".format(x) for x in hex_values) + "}"
else:
return " ".join(hex_values)
| def to_hex(hh: bytes, for_c=False):
hex_values = ('{:02x}'.format(c) for c in hh)
if for_c:
return '{' + ', '.join(('0x{}'.format(x) for x in hex_values)) + '}'
else:
return ' '.join(hex_values) |
IP =input("enter your ip address ")
count_seg = 0
len_seg = 0
i = ''
for i in range(0,len(IP)):
if(IP[i] =='.'):
print("segment {} contain {} characters".format(count_seg+1,len_seg))
count_seg += 1
len_seg = 0
else:
len_seg +=1
if i != "." :
print("segment... | ip = input('enter your ip address ')
count_seg = 0
len_seg = 0
i = ''
for i in range(0, len(IP)):
if IP[i] == '.':
print('segment {} contain {} characters'.format(count_seg + 1, len_seg))
count_seg += 1
len_seg = 0
else:
len_seg += 1
if i != '.':
print('segment {} contain {} ... |
"""Custom errors goes here"""
class Error(Exception):
"""Base error class"""
pass
class InvalidUserInput(Error):
"""Exception raised for invalid user input"""
pass
| """Custom errors goes here"""
class Error(Exception):
"""Base error class"""
pass
class Invaliduserinput(Error):
"""Exception raised for invalid user input"""
pass |
numero=int(input("Digite numero: "))
if(numero%2==0):
print("el numero es par")
else:
print("el numero es impar")
| numero = int(input('Digite numero: '))
if numero % 2 == 0:
print('el numero es par')
else:
print('el numero es impar') |
# could be set as random or defined by node num
def getdelay(source,destination,size):
return 1
def getdownloadspeed(id):
return 1000 | def getdelay(source, destination, size):
return 1
def getdownloadspeed(id):
return 1000 |
def has_print_function(tokens):
p = 0
while p < len(tokens):
if tokens[p][0] != 'FROM':
p += 1
continue
if tokens[p + 1][0:2] != ('NAME', '__future__'):
p += 1
continue
if tokens[p + 2][0] != 'IMPORT':
p += 1
continu... | def has_print_function(tokens):
p = 0
while p < len(tokens):
if tokens[p][0] != 'FROM':
p += 1
continue
if tokens[p + 1][0:2] != ('NAME', '__future__'):
p += 1
continue
if tokens[p + 2][0] != 'IMPORT':
p += 1
continu... |
SCREEN_WIDTH = 700
SCREEN_HEIGHT = 450
SCREEN_CENTER = (SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2)
BUTTON_COLOR = (0, 0, 0)
PADDLE_WIDTH = 10
PADDLE_HEIGHT = 50
BALL_WIDTH = 10
BALL_HEIGHT = 10
AUDIO_ICON_WIDTH = 20
AUDIO_ICON_HEIGHT = 20
AUDIO_ICON_X = SCREEN_WIDTH - AUDIO_ICON_WIDTH
AUDIO_ICON_Y = SCREEN_HEIGHT - AUDI... | screen_width = 700
screen_height = 450
screen_center = (SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2)
button_color = (0, 0, 0)
paddle_width = 10
paddle_height = 50
ball_width = 10
ball_height = 10
audio_icon_width = 20
audio_icon_height = 20
audio_icon_x = SCREEN_WIDTH - AUDIO_ICON_WIDTH
audio_icon_y = SCREEN_HEIGHT - AUDIO_ICO... |
# Source : https://leetcode.com/problems/longest-continuous-increasing-subsequence/
# Author : foxfromworld
# Date : 07/12/2021
# First attempt
class Solution:
def findLengthOfLCIS(self, nums: List[int]) -> int:
start, ret = 0, 0
for i, num in enumerate(nums):
if i > 0 and nums[i-1] >=... | class Solution:
def find_length_of_lcis(self, nums: List[int]) -> int:
(start, ret) = (0, 0)
for (i, num) in enumerate(nums):
if i > 0 and nums[i - 1] >= num:
start = i
ret = max(ret, i - start + 1)
return ret |
def print_translation(args):
"""
Parses calls to print to convert to the C++ equivalent
Parameters
----------
args : list of str
List of arguments to add to the print statement
Returns
-------
str
The converted print statement
"""
return_str = "std::cout << "
... | def print_translation(args):
"""
Parses calls to print to convert to the C++ equivalent
Parameters
----------
args : list of str
List of arguments to add to the print statement
Returns
-------
str
The converted print statement
"""
return_str = 'std::cout << '
... |
"""
protocolDefinitions.py
The following module consists of a list of commands or definitions to be used in the communication between devices and the control system
Michael Xynidis
Fluvio L Lobo Fenoglietto
09/26/2016
"""
# Definition Name Valu... | """
protocolDefinitions.py
The following module consists of a list of commands or definitions to be used in the communication between devices and the control system
Michael Xynidis
Fluvio L Lobo Fenoglietto
09/26/2016
"""
soh = chr(1)
enq = chr(5)
eot = chr(4)
ack = chr(6)
nak = chr(21)
can = chr(24)
dc1 = chr(17)
dc... |
"""
Given the root of a binary tree, determine if it is a valid binary search tree (BST).
A valid BST is defined as follows:
The left subtree of a node contains only nodes with keys less than the node's key.
The right subtree of a node contains only nodes with keys greater than the node's key.
Both the left and right... | """
Given the root of a binary tree, determine if it is a valid binary search tree (BST).
A valid BST is defined as follows:
The left subtree of a node contains only nodes with keys less than the node's key.
The right subtree of a node contains only nodes with keys greater than the node's key.
Both the left and right... |
"""
Copyright (R) @huawei.com, all rights reserved
-*- coding:utf-8 -*-
CREATED: 2020-6-04 20:12:13
MODIFIED: 2020-6-06 14:04:45
"""
SUCCESS = 0
FAILED = 1
ACL_DEVICE = 0
ACL_HOST = 1
MEMORY_NORMAL = 0
MEMORY_HOST = 1
MEMORY_DEVICE = 2
MEMORY_DVPP = 3
# error code
ACL_ERROR_NONE = 0
ACL_ERROR_INVALID_PARAM = 100000... | """
Copyright (R) @huawei.com, all rights reserved
-*- coding:utf-8 -*-
CREATED: 2020-6-04 20:12:13
MODIFIED: 2020-6-06 14:04:45
"""
success = 0
failed = 1
acl_device = 0
acl_host = 1
memory_normal = 0
memory_host = 1
memory_device = 2
memory_dvpp = 3
acl_error_none = 0
acl_error_invalid_param = 100000
acl_error_unini... |
# -*- coding: utf-8 -*-
########################################################################
#
# License: BSD
# Created: 2005-12-01
# Author: Ivan Vilata i Balaguer - ivan@selidor.net
#
# $Id$
#
########################################################################
"""Utility scripts for PyTables.
... | """Utility scripts for PyTables.
This package contains some modules which provide a ``main()`` function
(with no arguments), so that they can be used as scripts.
""" |
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"\n",
"from finnhub.exceptions import FinnhubAPIException\n",
"from finnhub.exceptions import FinnhubRequestException\n",
"\n",
"class Client:\n",
" ... | {'cells': [{'cell_type': 'code', 'execution_count': null, 'metadata': {}, 'outputs': [], 'source': ['import requests\n', '\n', 'from finnhub.exceptions import FinnhubAPIException\n', 'from finnhub.exceptions import FinnhubRequestException\n', '\n', 'class Client:\n', ' API_URL = "https://finnhub.io/api/v1"\n', '\n',... |
class ObjectList(object):
""""""
def __init__(self):
self._items = []
def __getitem__(self, index):
if index >= 0 and index < len(self._items):
return self._items[index]
else:
raise IndexError()
def __len__(self):
return len(self._items)
de... | class Objectlist(object):
""""""
def __init__(self):
self._items = []
def __getitem__(self, index):
if index >= 0 and index < len(self._items):
return self._items[index]
else:
raise index_error()
def __len__(self):
return len(self._items)
d... |
# Comment1
class Module2(object):
command_name = 'module2'
targets = [r'products/module2_target.txt']
dependencies = [('module1_target.txt', True)]
configs = ['module2a.conf', 'module2b.conf']
| class Module2(object):
command_name = 'module2'
targets = ['products/module2_target.txt']
dependencies = [('module1_target.txt', True)]
configs = ['module2a.conf', 'module2b.conf'] |
class ValidDate(object):
@classmethod
def special_char(self,char):
"""Check to see if char is in a list of special date chars
"""
if(char == '-'):
return True
else:
return False
@classmethod
def check_and_store(self,char):
"""Check to se... | class Validdate(object):
@classmethod
def special_char(self, char):
"""Check to see if char is in a list of special date chars
"""
if char == '-':
return True
else:
return False
@classmethod
def check_and_store(self, char):
"""Check to se... |
# pylint: disable=line-too-long
"""
Implement a compiler for the interpreter developed in Exercise 12, Problem 1.
The program should be compiled in a language based on operand stack.
The following operations are supported:
* ``CONST c``: push the value ``c`` on the stack,
* ``LOAD v``: load the value of the variable ... | """
Implement a compiler for the interpreter developed in Exercise 12, Problem 1.
The program should be compiled in a language based on operand stack.
The following operations are supported:
* ``CONST c``: push the value ``c`` on the stack,
* ``LOAD v``: load the value of the variable ``v`` and push it on the stack,
... |
n = int(input())
arr = list(map(int, input().rstrip().split()))
arr.reverse()
for num in arr:
print(num , end=" ")
| n = int(input())
arr = list(map(int, input().rstrip().split()))
arr.reverse()
for num in arr:
print(num, end=' ') |
class Node(object):
def __init__(self, name):
"""Assumes name is a string"""
self.name = name
def get_name(self):
return self.name
def __str__(self):
return self.name
class Edge(object):
def __init__(self, source, destination):
"""Assumes source and destinat... | class Node(object):
def __init__(self, name):
"""Assumes name is a string"""
self.name = name
def get_name(self):
return self.name
def __str__(self):
return self.name
class Edge(object):
def __init__(self, source, destination):
"""Assumes source and destinati... |
"""
You want to find people who have as much exposure to different cultures as yourself.
Complete the uncommon_cities helper that takes the cities you have visited (my_cities) and the cities the other person has visited (other_cities) and returns the number of cities that both sequences do NOT have in common.
So give... | """
You want to find people who have as much exposure to different cultures as yourself.
Complete the uncommon_cities helper that takes the cities you have visited (my_cities) and the cities the other person has visited (other_cities) and returns the number of cities that both sequences do NOT have in common.
So give... |
## Advent of Code 2018: Day 14
## https://adventofcode.com/2018/day/14
## Jesse Williams
## Answers: [Part 1]: 8176111038, [Part 2]: 20225578
INPUT = 890691
def createNewRecipes(recipes, elves):
newRcpSum = recipes[elves[0]] + recipes[elves[1]] # add current recipes together
newRcpDigits = list(map(int, lis... | input = 890691
def create_new_recipes(recipes, elves):
new_rcp_sum = recipes[elves[0]] + recipes[elves[1]]
new_rcp_digits = list(map(int, list(str(newRcpSum))))
return newRcpDigits
def choose_new_current_recipes(recipes, elves):
new_elves = [0, 0]
for (i, elf) in enumerate(elves):
newElves... |
#!/usr/local/bin/python3.6
def is_ztest(m):
if int(m.author.id) == int(zigID):
return True
else:
return False
| def is_ztest(m):
if int(m.author.id) == int(zigID):
return True
else:
return False |
def read_matrix(c, r):
matrix = []
for _ in range(c):
row = input().split(' ')
matrix.append(row)
return matrix
c, r = [int(n) for n in input().split(' ')]
matrix = read_matrix(c, r)
matches = 0
for col in range(c - 1):
for row in range(r - 1):
if matrix[col][row] == matrix[... | def read_matrix(c, r):
matrix = []
for _ in range(c):
row = input().split(' ')
matrix.append(row)
return matrix
(c, r) = [int(n) for n in input().split(' ')]
matrix = read_matrix(c, r)
matches = 0
for col in range(c - 1):
for row in range(r - 1):
if matrix[col][row] == matrix[col... |
# Option for variable 'simulation_type':
# 1: cylindrical roller bearing
# 2:
# 3: cylindrical roller thrust bearing
# 4: ball on disk (currently not fully supported)
# 5: pin on disk
# 6: 4 ball
# 7: ball on three plates
# 8: ring on ring
# global simulation setup
simulation_type = 5 # one of the above types
simulat... | simulation_type = 5
simulation_name = 'PinOnDisk'
auto_print = True
auto_plot = True
auto_report = False
tribo_system_name = 'foo'
number_pins = 1
sliding_diameter = 50
e_cb1 = 210000
ny_cb1 = 0.3
diameter_cb1 = 12.7
length_cb1 = 12.7
type_profile_cb1 = 'Circle'
path_profile_cb1 = ''
profile_radius_cb1 = 6.35
e_cb2 = 2... |
BUSINESS_METRICS_VIEW_CONFIG = {
'Write HBase' : [['write operation', 'Write/HBase'],
['log length', 'Write/Log'],
['memory/thread', 'Write/MemoryThread'],
],
'Read HBase' : [['read operation', 'Read/HBase'],
['result size', 'Read/ResultSize'],
... | business_metrics_view_config = {'Write HBase': [['write operation', 'Write/HBase'], ['log length', 'Write/Log'], ['memory/thread', 'Write/MemoryThread']], 'Read HBase': [['read operation', 'Read/HBase'], ['result size', 'Read/ResultSize'], ['memory/thread', 'Read/MemoryThread']]}
online_metrics_menu_config = {'Online W... |
n=int(input())
for i in range(1,n):
if i+sum(map(int,list(str(i))))==n:
print(i)
exit()
print(0) | n = int(input())
for i in range(1, n):
if i + sum(map(int, list(str(i)))) == n:
print(i)
exit()
print(0) |
"""
Doctests
You have the option to write tests into your docstring in python.
"""
def add(a, b):
"""
>>> add(2, 3)
5
>>> add(100, 200)
300
"""
return a + b
# command line command to run the doctests:
# python -m doctest -v filename.py | """
Doctests
You have the option to write tests into your docstring in python.
"""
def add(a, b):
"""
>>> add(2, 3)
5
>>> add(100, 200)
300
"""
return a + b |
edge_array = [];
par =[0,0,0,0,0,0]
for par[0] in range(0,3):
for par[1] in range(0,3):
for par[2] in range(0,3):
for par[3] in range(0,3):
for par[4] in range(0,3):
for par[5] in range(0,3):
edge_array.append(str(par[0])+" "+str(par[1])+" "+str(par[2])+" "+str(par[3])+" "+str(par[4])+" "+str(par[5... | edge_array = []
par = [0, 0, 0, 0, 0, 0]
for par[0] in range(0, 3):
for par[1] in range(0, 3):
for par[2] in range(0, 3):
for par[3] in range(0, 3):
for par[4] in range(0, 3):
for par[5] in range(0, 3):
edge_array.append(str(par[0]) + '... |
# -*- coding: utf-8 -*-
class Node(object):
def __init__(self, type_, value, children=None):
self.type = type_ # Options: 'operator', 'identifier', 'value'
self.value = value
self.children = children or []
def dump(self, recursive=False):
"""Return a formatted dump of the tr... | class Node(object):
def __init__(self, type_, value, children=None):
self.type = type_
self.value = value
self.children = children or []
def dump(self, recursive=False):
"""Return a formatted dump of the tree in current node.
:param recursive: whether show children rec... |
levels = {
1: {
'ship': (80, 60),
'enemies': ((24, 24), (50, 24), (100, 24), (120, 24))
},
2: {
'ship': (80, 110),
'enemies': ((10, 10), (80, 10), (150, 10),
(10, 30), (80, 30), (150, 30))
},
3: {
'ship': (10, 60),
'enemies': ((90, ... | levels = {1: {'ship': (80, 60), 'enemies': ((24, 24), (50, 24), (100, 24), (120, 24))}, 2: {'ship': (80, 110), 'enemies': ((10, 10), (80, 10), (150, 10), (10, 30), (80, 30), (150, 30))}, 3: {'ship': (10, 60), 'enemies': ((90, 10), (90, 50), (90, 90), (110, 10), (110, 50), (110, 90), (130, 10), (130, 50), (130, 90))}, 4... |
class HttpRequest:
def __init__(self, path, method, headers, path_params, query_params, body):
self.path = path
self.method = method
self.headers = headers
self.path_params = path_params
self.query_params = query_params
self.body = body
| class Httprequest:
def __init__(self, path, method, headers, path_params, query_params, body):
self.path = path
self.method = method
self.headers = headers
self.path_params = path_params
self.query_params = query_params
self.body = body |
"""
3.2 Stack Min: How would you design a stack which, in addition to push and pop, has a function min
which returns the minimum eiement? Push, pop and min should ail operate in 0 ( 1 ) time.
"""
"""
Solution --> keep track of what is min at each stage of opertaion
"""
class Stack:
def __init__(self):
se... | """
3.2 Stack Min: How would you design a stack which, in addition to push and pop, has a function min
which returns the minimum eiement? Push, pop and min should ail operate in 0 ( 1 ) time.
"""
'\nSolution --> keep track of what is min at each stage of opertaion \n'
class Stack:
def __init__(self):
self... |
CURRENT_NEWS_API_KEY = '' # Replace with your news.org API keys
news = {
'api_key': '',
'base_everything_url': 'https://newsapi.org/v2/everything'
} | current_news_api_key = ''
news = {'api_key': '', 'base_everything_url': 'https://newsapi.org/v2/everything'} |
'''
Given a square matrix of N rows and columns, find out whether it is symmetric or not.
>>Input Format:
The first line of the input contains an integer number n which represents the number of rows and the number of columns.
From the second line, take n lines input with each line containing n integer elements with ea... | """
Given a square matrix of N rows and columns, find out whether it is symmetric or not.
>>Input Format:
The first line of the input contains an integer number n which represents the number of rows and the number of columns.
From the second line, take n lines input with each line containing n integer elements with ea... |
ENV='development'
DEBUG=True
SQLALCHEMY_DATABASE_URI='sqlite:///data_base.db'
#SQLALCHEMY_ECHO=True
SQLALCHEMY_TRACK_MODIFICATIONS=False
SCHEDULER_API_ENABLED = True
| env = 'development'
debug = True
sqlalchemy_database_uri = 'sqlite:///data_base.db'
sqlalchemy_track_modifications = False
scheduler_api_enabled = True |
# Exercise number 2 - Python WorkOut
# Author: Barrios Ramirez Luis Fernando
# Language: Python3 3.8.2 64-bit
def my_sum(*numbers): # The "splat" operator is used when we need an arbitrary amount of arguments
output = numbers[0]
for i in numbers[1:]: # It returns a tuple
output += i
return output... | def my_sum(*numbers):
output = numbers[0]
for i in numbers[1:]:
output += i
return output
print(my_sum(4, 6)) |
n = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'B', 'H']
i = sorted(n.index(x) for x in input().split())
c = (i[1] - i[0], i[2] - i[1])
if c in ((4, 3), (3, 5), (5, 4)):
print('major')
elif c in ((3, 4), (4, 5), (5, 3)):
print('minor')
else:
print('strange')
| n = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'B', 'H']
i = sorted((n.index(x) for x in input().split()))
c = (i[1] - i[0], i[2] - i[1])
if c in ((4, 3), (3, 5), (5, 4)):
print('major')
elif c in ((3, 4), (4, 5), (5, 3)):
print('minor')
else:
print('strange') |
template='''
def __init__(self, base_space, **kwargs):
super().__init__() # Time scheme is set from Model.__init__()
# Set base space (manifold)
#------------------------------
assert base_space.dimension == len(self.coordinates), \
"... | template = '\n def __init__(self, base_space, **kwargs):\n\n super().__init__() # Time scheme is set from Model.__init__()\n\n # Set base space (manifold)\n #------------------------------\n assert base_space.dimension == len(self.coordinates), ... |
class Solution(object):
def isBoomerang(self, points):
"""
:type points: List[List[int]]
:rtype: bool
"""
p1, p2, p3 = points[0], points[1], points[2]
if p2[0] != p1[0]:
a = (p2[1] - p1[1]) / float(p2[0] - p1[0])
b = p1[1] - a * p1[0]
... | class Solution(object):
def is_boomerang(self, points):
"""
:type points: List[List[int]]
:rtype: bool
"""
(p1, p2, p3) = (points[0], points[1], points[2])
if p2[0] != p1[0]:
a = (p2[1] - p1[1]) / float(p2[0] - p1[0])
b = p1[1] - a * p1[0]
... |
aPL = 4.412E-10
nPL = 5.934
G13 = 5290.
enerPlas = aPL/G13*90.65**(nPL + 1.)*nPL/(nPL + 1.)*0.2**3
enerFrac = 0.788*0.2*0.2
enerTotal = enerPlas+enerFrac
parameters = {
"results": [
{
"type": "max",
"step": "Step-7",
"identifier":
{
"symbo... | a_pl = 4.412e-10
n_pl = 5.934
g13 = 5290.0
ener_plas = aPL / G13 * 90.65 ** (nPL + 1.0) * nPL / (nPL + 1.0) * 0.2 ** 3
ener_frac = 0.788 * 0.2 * 0.2
ener_total = enerPlas + enerFrac
parameters = {'results': [{'type': 'max', 'step': 'Step-7', 'identifier': {'symbol': 'S13', 'elset': 'ALL_ELEMS', 'position': 'Element 1 I... |
# -*- coding: utf-8 -*-
# Scrapy settings for jn_scraper project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://doc.scrapy.org/en/latest/topics/settings.html
# https://doc.scrapy.org/en/latest/to... | bot_name = 'jn_scraper'
spider_modules = ['scraper.spiders']
newspider_module = 'scraper.spiders'
robotstxt_obey = True
item_pipelines = {'scraper.pipelines.ProductItemPipeline': 200} |
def rounding(numbers):
num = [round(float(x)) for x in numbers]
return num
print(rounding(input().split(" "))) | def rounding(numbers):
num = [round(float(x)) for x in numbers]
return num
print(rounding(input().split(' '))) |
expected_output={
'interface': {
'HundredGigE2/0/1': {
'if_id': '0x3',
'inst': 0,
'asic': 0,
'core': 5,
'ifg_id': 1,
'port': 0,
'subport': 0,
'mac': 1,
'last_serdes': 1,
'cntx': 0,
'lpn': 1,
'gpn': 769,
'type': 'NIF',
'active': 'Y... | expected_output = {'interface': {'HundredGigE2/0/1': {'if_id': '0x3', 'inst': 0, 'asic': 0, 'core': 5, 'ifg_id': 1, 'port': 0, 'subport': 0, 'mac': 1, 'last_serdes': 1, 'cntx': 0, 'lpn': 1, 'gpn': 769, 'type': 'NIF', 'active': 'Y'}, 'HundredGigE2/0/2': {'if_id': '0x485', 'inst': 0, 'asic': 0, 'core': 5, 'ifg_id': 1, 'p... |
"""
In a town, there are n people labeled from 1 to n. There is a rumor that one of these people is secretly the town judge.
If the town judge exists, then:
The town judge trusts nobody.
Everybody (except for the town judge) trusts the town judge.
There is exactly one person that satisfies properties 1 an... | """
In a town, there are n people labeled from 1 to n. There is a rumor that one of these people is secretly the town judge.
If the town judge exists, then:
The town judge trusts nobody.
Everybody (except for the town judge) trusts the town judge.
There is exactly one person that satisfies properties 1 an... |
class Hero:
def __init__(self, nama, attack,health,defense):
self.name = nama
self.attack = attack
self.health = health
self.defense = defense
| class Hero:
def __init__(self, nama, attack, health, defense):
self.name = nama
self.attack = attack
self.health = health
self.defense = defense |
def compress(string):
counter = 1
result = []
for i in range(len(string)):
if not (i + 1) == len(string) and string[i] == string[i + 1]:
counter += 1
else:
result.append(string[i] + str(counter))
counter = 1
final = "".join(result)
if len(string... | def compress(string):
counter = 1
result = []
for i in range(len(string)):
if not i + 1 == len(string) and string[i] == string[i + 1]:
counter += 1
else:
result.append(string[i] + str(counter))
counter = 1
final = ''.join(result)
if len(string) > l... |
__project__ = "nerblackbox"
__author__ = "Felix Stollenwerk"
__version__ = "0.0.13"
__license__ = "Apache 2.0"
| __project__ = 'nerblackbox'
__author__ = 'Felix Stollenwerk'
__version__ = '0.0.13'
__license__ = 'Apache 2.0' |
s=input()
s=s.split(" ")
n=int(s[0])
k=int(s[1])
m=n//2
if n%2==1:
m+=1
if k<=m:
print(2*k-1)
else:
k=k-m
print(2*k) | s = input()
s = s.split(' ')
n = int(s[0])
k = int(s[1])
m = n // 2
if n % 2 == 1:
m += 1
if k <= m:
print(2 * k - 1)
else:
k = k - m
print(2 * k) |
class ImproperlyConfigured(Exception):
""" Raised in the event ``operations-api`` has not been properly configured
"""
pass
class HTTPError(Exception):
""" Raised in the event ``operations-api`` was not able to get data from remote server
"""
pass
| class Improperlyconfigured(Exception):
""" Raised in the event ``operations-api`` has not been properly configured
"""
pass
class Httperror(Exception):
""" Raised in the event ``operations-api`` was not able to get data from remote server
"""
pass |
def merge(A, n1i, n2j):
for k in range(len(A)):
if(len(n2j) == 0 and len(n1i) != 0):
A[k] = n1i.pop(0);
elif(len(n1i) == 0 and len(n2j) != 0):
A[k] = n2j.pop(0);
else:
if(n1i[0] >= n2j[0]):
A[k] = n1i.pop(0);
... | def merge(A, n1i, n2j):
for k in range(len(A)):
if len(n2j) == 0 and len(n1i) != 0:
A[k] = n1i.pop(0)
elif len(n1i) == 0 and len(n2j) != 0:
A[k] = n2j.pop(0)
elif n1i[0] >= n2j[0]:
A[k] = n1i.pop(0)
else:
A[k] = n2j.pop(0)
return A
... |
class Solution:
d = {
'I': 1,
'V': 5,
'X': 10,
'L': 50,
'C': 100,
'D': 500,
'M': 1000,
'IV': 4,
'IX': 9,
'XL': 40,
'XC': 90,
'CD': 400,
'CM': 900
}
def romanToInt(self, s):
n,i = 0,0
whil... | class Solution:
d = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000, 'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900}
def roman_to_int(self, s):
(n, i) = (0, 0)
while i < len(s):
if i + 1 < len(s) and s[i:i + 2] in Solution.d:
n += Solutio... |
def between_markers(text: str, begin: str, end: str) -> str:
"""
returns substring between two given markers
"""
return ('' if len(text.split(begin)[0]) > len(text.split(end)[0]) and
begin in text and end in text else
text.split(begin)[-1].split(end)[0] if begin i... | def between_markers(text: str, begin: str, end: str) -> str:
"""
returns substring between two given markers
"""
return '' if len(text.split(begin)[0]) > len(text.split(end)[0]) and begin in text and (end in text) else text.split(begin)[-1].split(end)[0] if begin in text and end in text else text.sp... |
class Person:
def __init__(self, fname, lname):
self.fname = fname
self.lname = lname
def __repr__(self):
return f'{self.fname} {self.lname}'
p1 = Person('John', 'Smith')
class Student(Person):
pass
if __name__ == '__main__':
s = Student('Tom', 'Adams')
print(s)
p... | class Person:
def __init__(self, fname, lname):
self.fname = fname
self.lname = lname
def __repr__(self):
return f'{self.fname} {self.lname}'
p1 = person('John', 'Smith')
class Student(Person):
pass
if __name__ == '__main__':
s = student('Tom', 'Adams')
print(s)
print(... |
# Solution to exercise PermMissingElem
# http://www.codility.com/train/
def solution(A):
N = len(A)
# The array with the missing entry added should sum to (N+2)(N+1)/2
# so the missing entry can be determined by subtracting the sum of
# the entries of A
missing_element = (N+2)*(N+1)/2 - sum(A)... | def solution(A):
n = len(A)
missing_element = (N + 2) * (N + 1) / 2 - sum(A)
return missing_element |
with open("input.txt") as f:
lines = f.readlines()
S = lines.pop(0).strip()
lines.pop(0)
rules = {}
for r in lines:
s = r.strip().split(" -> ")
rules[s[0]] = s[1]
for n in range(10):
S = S[0] + "".join(list(map(lambda x,y: rules[x+y] + y, S[0:-1], S[1:])))
# Histogram
f = {}
for c in S:
... | with open('input.txt') as f:
lines = f.readlines()
s = lines.pop(0).strip()
lines.pop(0)
rules = {}
for r in lines:
s = r.strip().split(' -> ')
rules[s[0]] = s[1]
for n in range(10):
s = S[0] + ''.join(list(map(lambda x, y: rules[x + y] + y, S[0:-1], S[1:])))
f = {}
for c in S:
f[c] = f.get(c, 0) + ... |
class dataManager():
""" This class manage all data about scores and teams """
def __init__(self):
""" Constructor """
self.choix = 0
self.nameBlueTeam = ""
self.nameGreyTeam = ""
self.nameBlackTeam = ""
| class Datamanager:
""" This class manage all data about scores and teams """
def __init__(self):
""" Constructor """
self.choix = 0
self.nameBlueTeam = ''
self.nameGreyTeam = ''
self.nameBlackTeam = '' |
"""
A Libraray to initilize the avaiable modules and data structures
"""
| """
A Libraray to initilize the avaiable modules and data structures
""" |
class Solution:
def countArrangement(self, n: int) -> int:
state = '1' * n
# dp[state] means number of targ arrangement
# easily dp[state] = sum(dp[possible_next_state])
dp = {}
dp['0'*n] = 1
def dfs(state_now, index):
# basic
if state_now in ... | class Solution:
def count_arrangement(self, n: int) -> int:
state = '1' * n
dp = {}
dp['0' * n] = 1
def dfs(state_now, index):
if state_now in dp:
return dp[state_now]
else:
dp[state_now] = 0
for i in range(len(sta... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"AlreadyImportedError": "00_core.ipynb",
"InvalidFilePath": "00_core.ipynb",
"InvalidFolderPath": "00_core.ipynb",
"InvalidFileExtension": "00_core.ipynb",
"Pdf": "00_core.... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'AlreadyImportedError': '00_core.ipynb', 'InvalidFilePath': '00_core.ipynb', 'InvalidFolderPath': '00_core.ipynb', 'InvalidFileExtension': '00_core.ipynb', 'Pdf': '00_core.ipynb'}
modules = ['core.py']
doc_url = 'https://fabraz.github.io/vigilant/'
... |
class Solution:
def maxPower(self, s: str) -> int:
ans = cur = 0
prev = ''
for c in s:
if c == prev:
cur += 1
else:
cur = 1
prev = c
if cur > ans:
ans = cur
return ans | class Solution:
def max_power(self, s: str) -> int:
ans = cur = 0
prev = ''
for c in s:
if c == prev:
cur += 1
else:
cur = 1
prev = c
if cur > ans:
ans = cur
return ans |
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython
"""
suma = 0
# si son 100 personas, se cambia 10 por 100 (dentro de range)
for _ in range(10):
peso = float(input("Ingresar peso: "))
suma += peso
print(f"Peso acumulado {suma}") | """AyudaEnPython: https://www.facebook.com/groups/ayudapython
"""
suma = 0
for _ in range(10):
peso = float(input('Ingresar peso: '))
suma += peso
print(f'Peso acumulado {suma}') |
class CommandError(Exception):
def __init__(self, msg):
self.msg = msg
class SilentError(Exception):
# log and drop, don't reveal details to caller. The timing difference is
# ok.
pass
class ReplayError(Exception):
pass
class WrongVerfkeyError(Exception):
pass
class BadSignatureErro... | class Commanderror(Exception):
def __init__(self, msg):
self.msg = msg
class Silenterror(Exception):
pass
class Replayerror(Exception):
pass
class Wrongverfkeyerror(Exception):
pass
class Badsignatureerror(Exception):
pass
class Unknownchannelerror(Exception):
"""Message not decryp... |
# For Capstone Engine. AUTO-GENERATED FILE, DO NOT EDIT [x86_const.py]
X86_REG_INVALID = 0
X86_REG_AH = 1
X86_REG_AL = 2
X86_REG_AX = 3
X86_REG_BH = 4
X86_REG_BL = 5
X86_REG_BP = 6
X86_REG_BPL = 7
X86_REG_BX = 8
X86_REG_CH = 9
X86_REG_CL = 10
X86_REG_CS = 11
X86_REG_CX = 12
X86_REG_DH = 13
X86_REG_DI = 14
X86_REG_DIL ... | x86_reg_invalid = 0
x86_reg_ah = 1
x86_reg_al = 2
x86_reg_ax = 3
x86_reg_bh = 4
x86_reg_bl = 5
x86_reg_bp = 6
x86_reg_bpl = 7
x86_reg_bx = 8
x86_reg_ch = 9
x86_reg_cl = 10
x86_reg_cs = 11
x86_reg_cx = 12
x86_reg_dh = 13
x86_reg_di = 14
x86_reg_dil = 15
x86_reg_dl = 16
x86_reg_ds = 17
x86_reg_dx = 18
x86_reg_eax = 19
x8... |
class FileParser:
def __init__(self, filepath):
self.filepath = filepath
def GetNonEmptyLinesAsList(self):
with open(self.filepath, "r") as f:
return [line for line in f.readlines() if line and line != "\n"]
| class Fileparser:
def __init__(self, filepath):
self.filepath = filepath
def get_non_empty_lines_as_list(self):
with open(self.filepath, 'r') as f:
return [line for line in f.readlines() if line and line != '\n'] |
#Altere os exercicios e armazene em um vetor as idades.
a=int(input("Digite quantas vezes vc quer informar a idade"))
i=0
n=[]
for i in range(a):
n.append(int(input("Digite uma idade")))
i=i+1
print (n)
| a = int(input('Digite quantas vezes vc quer informar a idade'))
i = 0
n = []
for i in range(a):
n.append(int(input('Digite uma idade')))
i = i + 1
print(n) |
# -*- coding: utf-8 -*-
"""
Settings for the game that can be modified.
"""
__author__ = "Jakrin Juangbhanich"
__email__ = "juangbhanich.k@gmail.com"
N_HINT_TOKENS_MAX = 8
N_FUSE_TOKENS_MAX = 3
N_PLAYERS = 4
N_SIMULATIONS = 1
CARD_DECK_DISTRIBUTION = [1, 1, 1, 2, 2, 3, 3, 4, 4, 5]
| """
Settings for the game that can be modified.
"""
__author__ = 'Jakrin Juangbhanich'
__email__ = 'juangbhanich.k@gmail.com'
n_hint_tokens_max = 8
n_fuse_tokens_max = 3
n_players = 4
n_simulations = 1
card_deck_distribution = [1, 1, 1, 2, 2, 3, 3, 4, 4, 5] |
num = int(input("Enter Any Number : "))
if num % 2 == 1:
print(num, " is odd!")
elif num % 2 == 0:
print(num, " is even!")
else:
print("Error")
| num = int(input('Enter Any Number : '))
if num % 2 == 1:
print(num, ' is odd!')
elif num % 2 == 0:
print(num, ' is even!')
else:
print('Error') |
def conference_picker(cities_visited, cities_offered):
for city in cities_offered:
if city not in cities_visited:
return city
return 'No worthwhile conferences this year!' | def conference_picker(cities_visited, cities_offered):
for city in cities_offered:
if city not in cities_visited:
return city
return 'No worthwhile conferences this year!' |
#!/usr/bin/env python
"""
@package package_generator_template
@file functions.py
@author Anthony Remazeilles
@brief List of aditional functions that can be used in the template
Copyright (C) 2018 Tecnalia Research and Innovation
Distributed under the Apache 2.0 license.
"""
def get_package_type(context):
"""extr... | """
@package package_generator_template
@file functions.py
@author Anthony Remazeilles
@brief List of aditional functions that can be used in the template
Copyright (C) 2018 Tecnalia Research and Innovation
Distributed under the Apache 2.0 license.
"""
def get_package_type(context):
"""extract the package the typ... |
# -*- coding: utf-8 -*-
#
# Automatically generated from unicode.xml by gen_xml_dic.py
#
uni2latex = {
0x0023: '\\#',
0x0024: '\\textdollar',
0x0025: '\\%',
0x0026: '\\&',
0x0027: '\\textquotesingle',
0x002A: '\\ast',
0x005C: '\\textbackslash',
0x005E: '\\^{}',
0x005F: '\\_',
0x0060: '\\textasciigrave',
0x007B: '\\lbr... | uni2latex = {35: '\\#', 36: '\\textdollar', 37: '\\%', 38: '\\&', 39: '\\textquotesingle', 42: '\\ast', 92: '\\textbackslash', 94: '\\^{}', 95: '\\_', 96: '\\textasciigrave', 123: '\\lbrace', 124: '\\vert', 125: '\\rbrace', 126: '\\textasciitilde', 160: '~', 161: '\\textexclamdown', 162: '\\textcent', 163: '\\textsterl... |
n1 = int(input('Enter number 1: '))
n2 = int(input('Enter number 2: '))
n3 = int(input('Enter number 3: '))
menor = n1
if n2 < n1 and n2 < n3:
menor = n2
if n3 < n1 and n3 < n2:
menor = n3
maior = n1
if n2 > n1 and n2 > n3:
maior = n2
if n3 > n1 and n3 > n2:
maior = n3
print("Menor e {}".format(menor))
print... | n1 = int(input('Enter number 1: '))
n2 = int(input('Enter number 2: '))
n3 = int(input('Enter number 3: '))
menor = n1
if n2 < n1 and n2 < n3:
menor = n2
if n3 < n1 and n3 < n2:
menor = n3
maior = n1
if n2 > n1 and n2 > n3:
maior = n2
if n3 > n1 and n3 > n2:
maior = n3
print('Menor e {}'.format(menor))
... |
# *********************************
# ****** SECTION 1 - CLASSES ******
# *********************************
# A "Class" is like a blueprint for an object
# Objects can be many different things
# In a grade tracking program objects might be: Course, Period, Teacher, Student, Gradable Assignment, Comment, Etc.
# In Mari... | class Unknownstudent:
name = 'Unknown'
age = 'Unknown'
first_student = unknown_student()
first_student.name = 'John Smith'
first_student.age = 15
print(f"The student's name is {first_student.name} and he is {first_student.age} years old.")
class Student:
def __init__(self, _name, _age):
self.name ... |
_base_ = [
# './_base_/models/segformer.py',
'../configs/_base_/datasets/mapillary.py',
'../configs/_base_/default_runtime.py',
'./_base_/schedules/schedule_1600k_adamw.py'
]
norm_cfg = dict(type='BN', requires_grad=True)
backbone_norm_cfg = dict(type='LN', requires_grad=True)
model = dict(
type='E... | _base_ = ['../configs/_base_/datasets/mapillary.py', '../configs/_base_/default_runtime.py', './_base_/schedules/schedule_1600k_adamw.py']
norm_cfg = dict(type='BN', requires_grad=True)
backbone_norm_cfg = dict(type='LN', requires_grad=True)
model = dict(type='EncoderDecoder', pretrained='https://github.com/SwinTransfo... |
"""
https://leetcode.com/problems/average-of-levels-in-binary-tree/
Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.
Example 1:
Input:
3
/ \
9 20
/ \
15 7
Output: [3, 14.5, 11]
Explanation:
The average value of nodes on level 0 is 3, on lev... | """
https://leetcode.com/problems/average-of-levels-in-binary-tree/
Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.
Example 1:
Input:
3
/ 9 20
/ 15 7
Output: [3, 14.5, 11]
Explanation:
The average value of nodes on level 0 is 3, on level 1... |
M1, D1 = [int(x) for x in input().split()]
M2, D2 = [int(x) for x in input().split()]
if M1 != M2:
print(1)
else:
print(0)
| (m1, d1) = [int(x) for x in input().split()]
(m2, d2) = [int(x) for x in input().split()]
if M1 != M2:
print(1)
else:
print(0) |
def start_streaming_dataframe():
"Start a Spark Streaming DataFrame from a Kafka Input source"
schema = StructType(
[StructField(f["name"], f["type"], True) for f in field_metadata]
)
kafka_options = {
"kafka.ssl.protocol":"TLSv1.2",
"kafka.ssl.enabled.protocols":"TLSv1.2",
... | def start_streaming_dataframe():
"""Start a Spark Streaming DataFrame from a Kafka Input source"""
schema = struct_type([struct_field(f['name'], f['type'], True) for f in field_metadata])
kafka_options = {'kafka.ssl.protocol': 'TLSv1.2', 'kafka.ssl.enabled.protocols': 'TLSv1.2', 'kafka.ssl.endpoint.identifi... |
{
'targets': [
{
'target_name': 'rdpcred',
'conditions': [ [
'OS=="win"',
{
'sources': [ 'rdpcred.cc' ],
'msvs_settings': {
'VCLinkerTool': {
'AdditionalDependencies': [
'Crypt32.lib'
]
}
}
}
] ]
}
]
} | {'targets': [{'target_name': 'rdpcred', 'conditions': [['OS=="win"', {'sources': ['rdpcred.cc'], 'msvs_settings': {'VCLinkerTool': {'AdditionalDependencies': ['Crypt32.lib']}}}]]}]} |
class Fibo(object):
"""docstring for Fibo"""
def __init__(self):
self.memo = []
def fibonacci(self, n, debug=False):
if debug:
print(self.memo)
if self.memo[n] != 0:
return self.memo[n]
if n==1 or n==2:
self.memo[n] = 1
el... | class Fibo(object):
"""docstring for Fibo"""
def __init__(self):
self.memo = []
def fibonacci(self, n, debug=False):
if debug:
print(self.memo)
if self.memo[n] != 0:
return self.memo[n]
if n == 1 or n == 2:
self.memo[n] = 1
else:
... |
"""
0944. Delete Columns to Make Sorted
Easy
We are given an array A of N lowercase letter strings, all of the same length.
Now, we may choose any set of deletion indices, and for each string, we delete all the characters in those indices.
For example, if we have an array A = ["abcdef","uvwxyz"] and deletion indices... | """
0944. Delete Columns to Make Sorted
Easy
We are given an array A of N lowercase letter strings, all of the same length.
Now, we may choose any set of deletion indices, and for each string, we delete all the characters in those indices.
For example, if we have an array A = ["abcdef","uvwxyz"] and deletion indices... |
class Solution:
def connect(self, root: 'Optional[Node]') -> 'Optional[Node]':
if not root:
return
d = collections.deque()
d.append(root)
while d:
node = d.popleft()
if node.left and node.right:
node.left.... | class Solution:
def connect(self, root: 'Optional[Node]') -> 'Optional[Node]':
if not root:
return
d = collections.deque()
d.append(root)
while d:
node = d.popleft()
if node.left and node.right:
node.left.next = node.right
... |
pro = 1
tar = 1
cur = 1
pos = 1
i = 1
while i < 8 :
lcur = list(str(cur))
if len(lcur) > tar - pos:
pro *= int(lcur[tar-pos])
i += 1
tar *= 10
pos += len(lcur)
cur += 1
print(pro)
| pro = 1
tar = 1
cur = 1
pos = 1
i = 1
while i < 8:
lcur = list(str(cur))
if len(lcur) > tar - pos:
pro *= int(lcur[tar - pos])
i += 1
tar *= 10
pos += len(lcur)
cur += 1
print(pro) |
n = int(input())
for _ in range(n):
store = int(input())
loc = list(map(int, input().split()))
dist = 2 * (max(loc) - min(loc))
print(dist)
| n = int(input())
for _ in range(n):
store = int(input())
loc = list(map(int, input().split()))
dist = 2 * (max(loc) - min(loc))
print(dist) |
graph_file_name="/home/cluster_share/graph/soc-LiveJournal1_notmap.txt"
out_put_file_name='/home/amax/Graph_json/livejournal_not_mapped_json'
graph_file = open(graph_file_name)
output_file = open(out_put_file_name, 'w')
edge = dict()
for line in graph_file:
#line = line[:-2]
res = line.split()
#print(res... | graph_file_name = '/home/cluster_share/graph/soc-LiveJournal1_notmap.txt'
out_put_file_name = '/home/amax/Graph_json/livejournal_not_mapped_json'
graph_file = open(graph_file_name)
output_file = open(out_put_file_name, 'w')
edge = dict()
for line in graph_file:
res = line.split()
source = int(res[0])
dest =... |
"""
Melwin memberships
==================
Connects the melwin code for membership with human readable description
"_id" : ObjectId("54970947a01ed2381196c9f5"),
"name" : "Familie Medlemsskap",
"id" : "FAM"
"""
_schema = {
'id': {'type': 'string',
'r... | """
Melwin memberships
==================
Connects the melwin code for membership with human readable description
"_id" : ObjectId("54970947a01ed2381196c9f5"),
"name" : "Familie Medlemsskap",
"id" : "FAM"
"""
_schema = {'id': {'type': 'string', 'required': True}, 'name': {'type':... |
class ParkingLot(object):
def __init__(self, commands: str, first_ticket_number: int = 5000, parking_lot_size: int = 10):
# Counter set to 5k by default.
self.counter = first_ticket_number
self.parking_lot_size = parking_lot_size
# Save as a dictionary. Keys will serve as the parki... | class Parkinglot(object):
def __init__(self, commands: str, first_ticket_number: int=5000, parking_lot_size: int=10):
self.counter = first_ticket_number
self.parking_lot_size = parking_lot_size
self.parking_lot = {i: '' for i in range(0, self.parking_lot_size)}
self.commands = [c fo... |
text = input()
for i in range(len(text)):
if text[i] == ":":
print(text[i] + text[i + 1]) | text = input()
for i in range(len(text)):
if text[i] == ':':
print(text[i] + text[i + 1]) |
class ExternalFileUtils(object):
""" A utility class containing functions related to external file references. """
@staticmethod
def GetAllExternalFileReferences(aDoc):
"""
GetAllExternalFileReferences(aDoc: Document) -> ICollection[ElementId]
Gets the ids of all elements which are external file r... | class Externalfileutils(object):
""" A utility class containing functions related to external file references. """
@staticmethod
def get_all_external_file_references(aDoc):
"""
GetAllExternalFileReferences(aDoc: Document) -> ICollection[ElementId]
Gets the ids of all elements which are ex... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.