content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
MAJOR = "0"
MINOR = "4"
PATCH = "18"
VERSION = f'{MAJOR}.{MINOR}.{PATCH}'
| major = '0'
minor = '4'
patch = '18'
version = f'{MAJOR}.{MINOR}.{PATCH}' |
dados = {}
gols = []
dados['nome'] = str(input('nome: '))
partidas = int(input(f'quantas partidas {dados["nome"]} jogou? '))
for p in range(0, partidas):
gols.append(int(input(f'quantos gols na partida {p+1}: ')))
dados['gols'] = gols
dados['total'] = sum(gols)
print('-='*30)
print(dados)
print('-='*30)
for k, v i... | dados = {}
gols = []
dados['nome'] = str(input('nome: '))
partidas = int(input(f"quantas partidas {dados['nome']} jogou? "))
for p in range(0, partidas):
gols.append(int(input(f'quantos gols na partida {p + 1}: ')))
dados['gols'] = gols
dados['total'] = sum(gols)
print('-=' * 30)
print(dados)
print('-=' * 30)
for (... |
FREE = 0
FIXED = 1
X = 1 # deprecated
Y = 2 # deprecated
ROTZ = 3 # deprecated
DOF_X = 1
DOF_Y = 2
DOF2D_X = 1
DOF2D_Y = 2
DOF2D_ROTZ = 3
DOF2D_PP = 3 # pore pressure
DOF3D_Z = 3
DOF3D_ROTX = 4
DOF3D_ROTY = 5
DOF3D_ROTZ = 6
P = 'P'
M_Z = 'Mz'
V_Y = 'Vy'
M_Y = 'My'
V_Z = 'Vz'
TORSION = 'T'
PLANE_STRAIN = "PlaneSt... | free = 0
fixed = 1
x = 1
y = 2
rotz = 3
dof_x = 1
dof_y = 2
dof2_d_x = 1
dof2_d_y = 2
dof2_d_rotz = 3
dof2_d_pp = 3
dof3_d_z = 3
dof3_d_rotx = 4
dof3_d_roty = 5
dof3_d_rotz = 6
p = 'P'
m_z = 'Mz'
v_y = 'Vy'
m_y = 'My'
v_z = 'Vz'
torsion = 'T'
plane_strain = 'PlaneStrain'
plane_stress = 'PlaneStress' |
class Node:
def __init__(self, value):
self.value = value
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def insert(self, value='null'):
try:
node = Node(value)
if not self.head:
self.head = node
else:
... | class Node:
def __init__(self, value):
self.value = value
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def insert(self, value='null'):
try:
node = node(value)
if not self.head:
self.head = node
... |
description = 'Pressure sensor of Pressure Box'
group = 'optional'
tango_base = 'tango://sans1hw.sans1.frm2:10000/sans1'
devices = dict(
pressure_box = device('nicos.devices.tango.Sensor',
description = 'pressure cell',
tangodevice = tango_base + '/keller/sensor',
fmtstr = '%.2f',
... | description = 'Pressure sensor of Pressure Box'
group = 'optional'
tango_base = 'tango://sans1hw.sans1.frm2:10000/sans1'
devices = dict(pressure_box=device('nicos.devices.tango.Sensor', description='pressure cell', tangodevice=tango_base + '/keller/sensor', fmtstr='%.2f', pollinterval=1, maxage=5, warnlimits=(0, 1))) |
# if-else exercise
# which sentence will be printed here? Is the logic complete here?
if 3 < 5:
print("3 is less than 5.")
else:
print("3 is greater than 5.")
# What if there are three choices?
# Try to change their ages so you may reproduce all three of the possible results.
Amy = 14
Betty = 11
if Amy > ... | if 3 < 5:
print('3 is less than 5.')
else:
print('3 is greater than 5.')
amy = 14
betty = 11
if Amy > Betty:
print('Amy is older than Betty.')
elif Amy < Betty:
print('Amy is younger than Betty.')
else:
print('Amy and Betty are at the same age!')
odds = [1, 3, 5, 7, 9]
test_number = 8
if testNumber ... |
# Constants related to inventory / items
ITEM_PROCESS_RESULT_NORMAL = 1
ITEM_PROCESS_RESULT_EXPIRED = 2
| item_process_result_normal = 1
item_process_result_expired = 2 |
flight_prices = {
"Chicago": 199,
"San Francisco": 499,
"Denver": 295
}
print(flight_prices["Chicago"])
print(flight_prices["Denver"])
# print(flight_prices["Seattle"]) # KeyError: key does not exist
gym_membership_packages = {
29: ["Machines"],
49: ["Machines", "Vitamin Suplements"],
79: ["Ma... | flight_prices = {'Chicago': 199, 'San Francisco': 499, 'Denver': 295}
print(flight_prices['Chicago'])
print(flight_prices['Denver'])
gym_membership_packages = {29: ['Machines'], 49: ['Machines', 'Vitamin Suplements'], 79: ['Machines', 'Vitamin Suplements', 'Sauna']}
print(gym_membership_packages[29])
print(gym_membersh... |
#
# Access log file analyzer
# (c) 2018 ISC Clemenz & Weinbrecht GmbH
#
name = 'aloga.clf' | name = 'aloga.clf' |
N, M = map(int, input().split())
H = list(map(int, input().split()))
W = list(map(int, input().split()))
H.sort()
sum1 = [H[i + 1] - H[i] for i in range(N - 1)]
sum2 = sum1[1::2] + [0]
sum1 = [0] + sum1[::2]
print(sum1)
print(sum2) | (n, m) = map(int, input().split())
h = list(map(int, input().split()))
w = list(map(int, input().split()))
H.sort()
sum1 = [H[i + 1] - H[i] for i in range(N - 1)]
sum2 = sum1[1::2] + [0]
sum1 = [0] + sum1[::2]
print(sum1)
print(sum2) |
## Master run file
## Executes all files related to building a classifier model
## for citation needed and not a claim data set in order
# extract features from raw data
execfile('featureExtract.py')
# pre process features before model building
execfile('featurePreProcessing.py')
# build and cross validate... | execfile('featureExtract.py')
execfile('featurePreProcessing.py')
execfile('crossValidateModel.py')
execfile('buildSaveModel.py')
execfile('useModel_onWikipedia.py') |
class AreWeUnitTesting(object):
# no doc
Value=False
__all__=[]
| class Areweunittesting(object):
value = False
__all__ = [] |
# ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: curve.py
#
# Tests: libsim - connecting to simulation and retrieving data from it.
# mesh - curve
#
# Programmer: Kathleen Biagas
# Date: Jun 17, 2014
#
# Modifications:
#
#... | sim = test_simulation('curve', 'curve.sim2')
sim.addargument('-echo')
(started, connected) = test_sim_start_and_connect('curve00', sim)
if connected:
test_sim_meta_data('curve01', sim.metadata())
add_plot('Curve', 'sine')
curve_atts = curve_attributes(1)
curveAtts.showLabels = 0
curveAtts.lineWidth ... |
# 03. Numbers
# Write a program to read a sequence of integers and find and print the top 5 numbers that are greater than
# the average value in the sequence, sorted in descending order.
sequence = [int(el) for el in input().split()]
average_value = sum(sequence) / len(sequence)
sequence.sort(reverse=True)
numbers_... | sequence = [int(el) for el in input().split()]
average_value = sum(sequence) / len(sequence)
sequence.sort(reverse=True)
numbers_with_property = []
for number in sequence:
if number > average_value:
numbers_with_property.append(number)
numbers_with_property = numbers_with_property[:5]
numbers_with_prope... |
major = 0
minor = 4
micro = 3
fftpack_version = '%(major)d.%(minor)d.%(micro)d' % (locals ())
| major = 0
minor = 4
micro = 3
fftpack_version = '%(major)d.%(minor)d.%(micro)d' % locals() |
# https://leetcode.com/problems/product-of-array-except-self
class Solution:
def productExceptSelf(self, nums):
N = len(nums)
L, R = [0] * N, [0] * N
output = [0] * N
for i in range(N):
if i == 0:
L[i] = nums[i]
else:
L[i] = L... | class Solution:
def product_except_self(self, nums):
n = len(nums)
(l, r) = ([0] * N, [0] * N)
output = [0] * N
for i in range(N):
if i == 0:
L[i] = nums[i]
else:
L[i] = L[i - 1] * nums[i]
for i in reversed(range(N)):
... |
# optimizer
optimizer = dict(type='AdamW', lr=1e-4, betas=(0.95, 0.99), weight_decay=0.01,)
optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
# learning policy
# learning policy
lr_config = dict(
policy='poly',
warmup='linear',
warmup_iters=1500,
warmup_ratio=1e-06,
power=1.0,
mi... | optimizer = dict(type='AdamW', lr=0.0001, betas=(0.95, 0.99), weight_decay=0.01)
optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
lr_config = dict(policy='poly', warmup='linear', warmup_iters=1500, warmup_ratio=1e-06, power=1.0, min_lr=0.0, by_epoch=False)
runner = dict(type='IterBasedRunner', max_iter... |
TOL = 1e-6
def eq_float(x, y):
return abs(x - y) <= TOL
def gt_float(x, y):
return x + TOL > y
def ge_float(x, y):
return x + TOL >= y
def lt_float(x, y):
return x < y + TOL
def le_float(x, y):
return x <= y + TOL
| tol = 1e-06
def eq_float(x, y):
return abs(x - y) <= TOL
def gt_float(x, y):
return x + TOL > y
def ge_float(x, y):
return x + TOL >= y
def lt_float(x, y):
return x < y + TOL
def le_float(x, y):
return x <= y + TOL |
batchsize = 128
epochs = 200
lr = 0.01
momentum = 0.9
use_cuda = True
betas=(0.9, 0.99)
| batchsize = 128
epochs = 200
lr = 0.01
momentum = 0.9
use_cuda = True
betas = (0.9, 0.99) |
#! /usr/bin/env python3.6
#Author : Coslate
#Purpose : This program split the list by non-integer
#Date : 2017/12/02
def IsNumber(s) :
try :
float(s)
return True
except:
return False
def main() :
dict_ans = {}
sample_in = ["i", "j", 123, 999, "k", 462, 777, 97, "h", 444]
... | def is_number(s):
try:
float(s)
return True
except:
return False
def main():
dict_ans = {}
sample_in = ['i', 'j', 123, 999, 'k', 462, 777, 97, 'h', 444]
key = ''
count = 0
for i in sample_in:
if not is_number(i):
count = 0
key = i
... |
class Graph:
def __init__(self, v):
self.V = v
self.l = [[] for _ in range(self.V)]
self.visited = [False for _ in range(self.V)]
def addEdge(self, x, y):
self.l[x].append(y)
self.l[y].append(x)
def printAdjlst(self):
for i in range(self.V):
... | class Graph:
def __init__(self, v):
self.V = v
self.l = [[] for _ in range(self.V)]
self.visited = [False for _ in range(self.V)]
def add_edge(self, x, y):
self.l[x].append(y)
self.l[y].append(x)
def print_adjlst(self):
for i in range(self.V):
p... |
# -*- coding: utf-8 -*-
'''
ANSI escape code utilities, see
http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
'''
graph_prefix = '\x1b['
graph_suffix = 'm'
codes = {
'reset': '0',
'bold': '1',
'faint': '2',
'italic': '3',
'underline': '4',
'blink': '5',
'slow_blink'... | """
ANSI escape code utilities, see
http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf
"""
graph_prefix = '\x1b['
graph_suffix = 'm'
codes = {'reset': '0', 'bold': '1', 'faint': '2', 'italic': '3', 'underline': '4', 'blink': '5', 'slow_blink': '5', 'fast_blink': '6', 'inverse': '7', 'conceal': '8... |
pkgname = "polkit"
pkgver = "0.120"
pkgrel = 0
build_style = "meson"
configure_args = [
"-Dsession_tracking=libelogind",
"-Dsystemdsystemunitdir=/tmp",
"-Dpolkitd_user=_polkitd",
"-Djs_engine=duktape",
"-Dauthfw=pam",
"-Dpam_include=dummy",
"-Dos_type=redhat", # dummy value
"-Dman=true",... | pkgname = 'polkit'
pkgver = '0.120'
pkgrel = 0
build_style = 'meson'
configure_args = ['-Dsession_tracking=libelogind', '-Dsystemdsystemunitdir=/tmp', '-Dpolkitd_user=_polkitd', '-Djs_engine=duktape', '-Dauthfw=pam', '-Dpam_include=dummy', '-Dos_type=redhat', '-Dman=true', '-Dintrospection=true', '-Dtests=false', '-Dgt... |
#!Python
#Chapter 5 Fantasy Game Inventory Practice
inv = {'rope': 1, 'gold coin': 42}
dragonLoot = ['gold coin','dagger','gold coin','gold coin','ruby']
def addToInventory(inventory, addItems):
for k in range(len(addItems)):
if addItems[k] in inventory.keys():
inventory[addItems[k]] += 1
... | inv = {'rope': 1, 'gold coin': 42}
dragon_loot = ['gold coin', 'dagger', 'gold coin', 'gold coin', 'ruby']
def add_to_inventory(inventory, addItems):
for k in range(len(addItems)):
if addItems[k] in inventory.keys():
inventory[addItems[k]] += 1
else:
inventory.setdefault(add... |
# Copyright 2013 OpenStack Foundation.
# 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 req... | edge_id = 'edge_id'
router_id = 'router_id'
external_vnic_index = 0
internal_vnic_index = 1
external_vnic_name = 'external'
internal_vnic_name = 'internal'
integration_lr_ipaddress = '169.254.2.1/28'
integration_edge_ipaddress = '169.254.2.3'
integration_subnet_netmask = '255.255.255.240'
prepend = 0
append = -1
vcns_e... |
# https://en.wikipedia.org/wiki/Sampling_(signal_processing)#Sampling_rate
SAMPLES_PER_SECOND_OPTIONS = {
'DEBUG': 8000,
'TELEPHONE_QUALITY': 16000,
'RADIO_QUALITY': 32000,
'DIGITAL_STANDARD': 48000,
'DIGITAL_RECORDING_STANDARD': 96000,
'HIGH_DEFINITION': 192000,
}
SAMPLE_BIT_DEPTH_OPTIONS = {
... | samples_per_second_options = {'DEBUG': 8000, 'TELEPHONE_QUALITY': 16000, 'RADIO_QUALITY': 32000, 'DIGITAL_STANDARD': 48000, 'DIGITAL_RECORDING_STANDARD': 96000, 'HIGH_DEFINITION': 192000}
sample_bit_depth_options = {'8_BIT': 8, '16_BIT': 16, '32_BIT': 32}
buffer_ms = 100
audio_stream_chunk_size = 1024
samples_per_secon... |
L = [int(input()) for i in range(int(input()))]
d = {}
for i in L:
d[i] = 1
ans = 4
for i in L:
for start in range(i-4,i+1):
cnt = 5
for j in range(5):
try:
d[start + j] +=1
d[start + j] -=1
cnt-=1
except:
co... | l = [int(input()) for i in range(int(input()))]
d = {}
for i in L:
d[i] = 1
ans = 4
for i in L:
for start in range(i - 4, i + 1):
cnt = 5
for j in range(5):
try:
d[start + j] += 1
d[start + j] -= 1
cnt -= 1
except:
... |
for i in range(5):
print ("Hello World")
| for i in range(5):
print('Hello World') |
def solve(moves):
houses = [[0, 0]]
pos = [0, 0]
for move in moves:
pos = [pos[0] + move[0], pos[1] + move[1]]
if pos not in houses:
houses.append(pos)
return len(houses)
def parse(file_name):
moves = []
with open(file_name, "r") as f:
for c in f.readline():... | def solve(moves):
houses = [[0, 0]]
pos = [0, 0]
for move in moves:
pos = [pos[0] + move[0], pos[1] + move[1]]
if pos not in houses:
houses.append(pos)
return len(houses)
def parse(file_name):
moves = []
with open(file_name, 'r') as f:
for c in f.readline():
... |
#/usr/local/bin/python3
# -*- coding: utf-8 -*-
# form __feature__ import print_function
for i in range(9, 0, -1):
for j in range(i, 0, -1):
print (str(i) + '*' + str(j) + '=' + str(i*j), end='')
print('')
for i in range(1, 10, 1):
for j in range(i, 10, 1):
print (str(i) + '*' + str(j) + ... | for i in range(9, 0, -1):
for j in range(i, 0, -1):
print(str(i) + '*' + str(j) + '=' + str(i * j), end='')
print('')
for i in range(1, 10, 1):
for j in range(i, 10, 1):
print(str(i) + '*' + str(j) + '=' + str(i * j), end=' ')
print('') |
{
"targets" : [{
"target_name" : "node_log_json_on_fatal_native",
"sources" : [ "fatal_error.cc" ],
"include_dirs": [
'<!(node -e "require(\'nan\')")'
],
"win_delay_load_hook" : "false"
}]
}
| {'targets': [{'target_name': 'node_log_json_on_fatal_native', 'sources': ['fatal_error.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'win_delay_load_hook': 'false'}]} |
class ixbrlNonNumeric:
def __init__(self, context, name, format_, value):
name = name.split(":", maxsplit=1)
if len(name) == 2:
self.schema = name[0]
self.name = name[1]
else:
self.schema = "unknown"
self.name = name[0]
self.context =... | class Ixbrlnonnumeric:
def __init__(self, context, name, format_, value):
name = name.split(':', maxsplit=1)
if len(name) == 2:
self.schema = name[0]
self.name = name[1]
else:
self.schema = 'unknown'
self.name = name[0]
self.context = ... |
def foo(a, b):
if a < b:
params = {'a': 'b'}
print(params)
else:
params = {'c': 'd'}
print(p<caret>arams)
| def foo(a, b):
if a < b:
params = {'a': 'b'}
print(params)
else:
params = {'c': 'd'}
print(p < caret > arams) |
class Solution:
def sortColors(self, nums):
one, two, three = 0, 0, len(nums) - 1
while two <= three:
if nums[two] == 0:
nums[one], nums[two] = nums[two], nums[one]
one += 1
two += 1
elif nums[two] == 1:
two += 1... | class Solution:
def sort_colors(self, nums):
(one, two, three) = (0, 0, len(nums) - 1)
while two <= three:
if nums[two] == 0:
(nums[one], nums[two]) = (nums[two], nums[one])
one += 1
two += 1
elif nums[two] == 1:
... |
#
# PySNMP MIB module DGS-1210-28XSME-BX (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DGS-1210-28XSME-BX
# Produced by pysmi-0.3.4 at Mon Apr 29 18:27:57 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint, constraints_union) ... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def traverseNode(self, node: TreeNode, array, stringSoFar):
stringSoFar += str(node.val) + "->"
... | class Solution:
def traverse_node(self, node: TreeNode, array, stringSoFar):
string_so_far += str(node.val) + '->'
if node.left:
self.traverseNode(node.left, array, stringSoFar)
if node.right:
self.traverseNode(node.right, array, stringSoFar)
if not node.left... |
class Employee:
__count = 0
def __init__(self, hours=0, rate=50):
Employee.__count += 1
self.__id = 100 + Employee.__count
self.__hours = hours
self.__rate = rate
def get_id(self): return self.__id
def get_hours(self): return self.__hours
def set_hours(self, val): self.__hours... | class Employee:
__count = 0
def __init__(self, hours=0, rate=50):
Employee.__count += 1
self.__id = 100 + Employee.__count
self.__hours = hours
self.__rate = rate
def get_id(self):
return self.__id
def get_hours(self):
return self.__hours
def set_h... |
class Section:
def __init__(self, name: str, notebooks: list):
self.name = name
self.notebooks = notebooks
| class Section:
def __init__(self, name: str, notebooks: list):
self.name = name
self.notebooks = notebooks |
def findLongestConseqSubseq(a,n):
#code here
if n==1:
return 1
else:
ans=[]
c=1
ans.append(0)
#print(m)
b=sorted(a,reverse=False)
#print(b)
for i in range(n-1):
if b[i+1]-b[i]==0:
continu... | def find_longest_conseq_subseq(a, n):
if n == 1:
return 1
else:
ans = []
c = 1
ans.append(0)
b = sorted(a, reverse=False)
for i in range(n - 1):
if b[i + 1] - b[i] == 0:
continue
elif b[i + 1] - b[i] == 1:
c ... |
#
# PySNMP MIB module CISCO-VOICE-URI-CLASS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-VOICE-URI-CLASS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:03:16 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint) ... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | bl_info = {'name': 'Fake Plugin', 'author': 'Dave Keeshan', 'version': (0, 0, 1), 'blender': (2, 92, 0), 'category': 'Object'}
def register():
print('Hello World')
def unregister():
print('Goodbye World') |
classes_includes = {
"std::set<std::string, std::less<std::string>, std::allocator<std::string> >" : "set",
"std::ostream" : "iostream",
"std::istream" : "iostream",
"std::basic_i... | classes_includes = {'std::set<std::string, std::less<std::string>, std::allocator<std::string> >': 'set', 'std::ostream': 'iostream', 'std::istream': 'iostream', 'std::basic_ios<char, std::char_traits<char> >': 'iostream', 'std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >': 'sstream', 'std::... |
del_items(0x801301C8)
SetType(0x801301C8, "struct THEME_LOC themeLoc[50]")
del_items(0x80130910)
SetType(0x80130910, "int OldBlock[4]")
del_items(0x80130920)
SetType(0x80130920, "unsigned char L5dungeon[80][80]")
del_items(0x801305B0)
SetType(0x801305B0, "struct ShadowStruct SPATS[37]")
del_items(0x801306B4)
SetType(0x... | del_items(2148729288)
set_type(2148729288, 'struct THEME_LOC themeLoc[50]')
del_items(2148731152)
set_type(2148731152, 'int OldBlock[4]')
del_items(2148731168)
set_type(2148731168, 'unsigned char L5dungeon[80][80]')
del_items(2148730288)
set_type(2148730288, 'struct ShadowStruct SPATS[37]')
del_items(2148730548)
set_ty... |
class FilterModule(object):
def filters(self):
return {
'normalize_sasl_protocol': self.normalize_sasl_protocol,
'kafka_protocol_normalized': self.kafka_protocol_normalized,
'kafka_protocol': self.kafka_protocol,
'kafka_protocol_defaults': self.kafka_protocol_... | class Filtermodule(object):
def filters(self):
return {'normalize_sasl_protocol': self.normalize_sasl_protocol, 'kafka_protocol_normalized': self.kafka_protocol_normalized, 'kafka_protocol': self.kafka_protocol, 'kafka_protocol_defaults': self.kafka_protocol_defaults, 'get_sasl_mechanisms': self.get_sasl_m... |
n = int(input("Enter a number: "))
kind = input("Do you want to do sum or product? ")
sum = 0
product = 1
if (kind == "sum"):
for i in range(1,n+1):
sum = sum + i
print("The sum of 1 to %d, was %d" % (n, sum))
elif (kind == "product"):
for i in range(1,n+1):
product = product * i
print... | n = int(input('Enter a number: '))
kind = input('Do you want to do sum or product? ')
sum = 0
product = 1
if kind == 'sum':
for i in range(1, n + 1):
sum = sum + i
print('The sum of 1 to %d, was %d' % (n, sum))
elif kind == 'product':
for i in range(1, n + 1):
product = product * i
print... |
#!/usr/bin/env python3
print('foo')
print('bar')
print('baz')
| print('foo')
print('bar')
print('baz') |
# FLASK
DEBUG = True
# DB
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
MONGO_DBNAME = 'eve_blog'
# DOMAIN
DOMAIN = {}
# URL
URL_PREFIX = 'api'
API_VERSION = 'v1'
# METHODS
RESOURCE_METHODS = ['GET', 'POST', 'DELETE']
ITEM_METHODS = ['GET', 'PATCH', 'PUT', 'DELETE']
| debug = True
mongo_host = 'localhost'
mongo_port = 27017
mongo_dbname = 'eve_blog'
domain = {}
url_prefix = 'api'
api_version = 'v1'
resource_methods = ['GET', 'POST', 'DELETE']
item_methods = ['GET', 'PATCH', 'PUT', 'DELETE'] |
ccccc
aaaaaaaaabbbbbbbbcccccccc
aaaaaaa
bbbbbbbb
ccccccccc
| ccccc
aaaaaaaaabbbbbbbbcccccccc
aaaaaaa
bbbbbbbb
ccccccccc |
_base_ = "../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py"
model = dict(
pretrained='torchvision://resnet50',
backbone=dict(depth=50),
roi_head=dict(
type='StandardRoIHead',
bbox_roi_extractor=dict(
type='SingleRoIExtractorAttention',
roi_layer=dict(type='RoIA... | _base_ = '../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
model = dict(pretrained='torchvision://resnet50', backbone=dict(depth=50), roi_head=dict(type='StandardRoIHead', bbox_roi_extractor=dict(type='SingleRoIExtractorAttention', roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=0), out_channels=256, featma... |
class EmptyFileError(Exception):
pass
filenames = ["myFile1.py", "nonExistent.py", "emptyFile.py", "myFile2.py"]
for file in filenames:
try:
f = open(file, 'r')
line = f.readline()
if line == "":
f.close()
raise EmptyFileError("%s: is empty" % file)
except IOE... | class Emptyfileerror(Exception):
pass
filenames = ['myFile1.py', 'nonExistent.py', 'emptyFile.py', 'myFile2.py']
for file in filenames:
try:
f = open(file, 'r')
line = f.readline()
if line == '':
f.close()
raise empty_file_error('%s: is empty' % file)
except I... |
def fprime(n, p):
# counts the number of prime divisors of n!
pk, ans = p, 0
while pk <= n:
ans += n // pk
pk *= p
return ans
def granville(n, k, p, E):
# n choose k (mod p^E)
prime_pow = fprime(n,p)-fprime(k,p)-fprime(n-k,p)
if prime_pow >= E: return 0
e = E -... | def fprime(n, p):
(pk, ans) = (p, 0)
while pk <= n:
ans += n // pk
pk *= p
return ans
def granville(n, k, p, E):
prime_pow = fprime(n, p) - fprime(k, p) - fprime(n - k, p)
if prime_pow >= E:
return 0
e = E - prime_pow
pe = p ** e
(r, f) = (n - k, [1] * pe)
fo... |
l = [0, 1, 2]
print(l)
# [0, 1, 2]
print(*l) # => print(0, 1, 2)
# 0 1 2
print(*l, sep='')
# 012
print(*l, sep='-')
# 0-1-2
s = '-'.join([str(i) for i in l])
print(s)
# 0-1-2
| l = [0, 1, 2]
print(l)
print(*l)
print(*l, sep='')
print(*l, sep='-')
s = '-'.join([str(i) for i in l])
print(s) |
n, k = list(map(int, input().split()))
ar = list(map(int, input().split()))
c=0
for i in ar:
if i > k:
c = c+2
else:
c = c+1
print(c)
| (n, k) = list(map(int, input().split()))
ar = list(map(int, input().split()))
c = 0
for i in ar:
if i > k:
c = c + 2
else:
c = c + 1
print(c) |
def test_update_hook(nested_config, checkpoint):
@nested_config.on_update
def callback(config):
assert nested_config is config
checkpoint()
assert not checkpoint.called
nested_config.root.a.b.value += 1
assert checkpoint.called
| def test_update_hook(nested_config, checkpoint):
@nested_config.on_update
def callback(config):
assert nested_config is config
checkpoint()
assert not checkpoint.called
nested_config.root.a.b.value += 1
assert checkpoint.called |
STANDARD_KEYS: set = {
'index',
'ts',
'transactions',
'proof',
'previous_hash'
}
STANDARD_TRANS_KEYS: set = {
'sender',
'recipient',
'payload',
'amount'
}
| standard_keys: set = {'index', 'ts', 'transactions', 'proof', 'previous_hash'}
standard_trans_keys: set = {'sender', 'recipient', 'payload', 'amount'} |
def main():
with open('in.txt') as input:
lines = input.readlines()
for line1 in lines:
for line2 in lines:
for line3 in lines:
number1 = int(line1)
number2 = int(line2)
number3 = int(line3)
i... | def main():
with open('in.txt') as input:
lines = input.readlines()
for line1 in lines:
for line2 in lines:
for line3 in lines:
number1 = int(line1)
number2 = int(line2)
number3 = int(line3)
i... |
# 12 dots illusion by jacques ninio
# --------
# settings
pw = 900
cell_s = pw/13
ph = cell_s * 9
strokeW = 8
dot_f = 1.8
dot_s = strokeW * dot_f
# --------
# drawings
newPage(pw, ph)
fill(None)
stroke(.45)
strokeWidth(strokeW)
# the grid
for i in range(13):
line((cell_s*i + cell_s/2, 0), (cell_s*i + cell_s/... | pw = 900
cell_s = pw / 13
ph = cell_s * 9
stroke_w = 8
dot_f = 1.8
dot_s = strokeW * dot_f
new_page(pw, ph)
fill(None)
stroke(0.45)
stroke_width(strokeW)
for i in range(13):
line((cell_s * i + cell_s / 2, 0), (cell_s * i + cell_s / 2, ph))
line((0, cell_s * i + cell_s / 2), (pw, cell_s * i + cell_s / 2))
for i ... |
#!/usr/bin/python3
str = 'banana'
count = str.count('a')
print(count)
| str = 'banana'
count = str.count('a')
print(count) |
ELECTION = "Configure Election"
MANIFEST = "Election Manifest"
GUARDIAN = "Guardian"
KEY_CEREMONY = "Key Ceremony"
KEY_CEREMONY_ADMIN = "Key Ceremony Admin"
KEY_GUARDIAN = "Key Ceremony Participant"
BALLOTS = "Query Ballots"
ENCRYPT = "Encrypt Ballots"
TALLY = "Tally Results"
TALLY_DECRYPT = "Tally Decrypt"
PUBLISH = "... | election = 'Configure Election'
manifest = 'Election Manifest'
guardian = 'Guardian'
key_ceremony = 'Key Ceremony'
key_ceremony_admin = 'Key Ceremony Admin'
key_guardian = 'Key Ceremony Participant'
ballots = 'Query Ballots'
encrypt = 'Encrypt Ballots'
tally = 'Tally Results'
tally_decrypt = 'Tally Decrypt'
publish = '... |
# -*- coding: utf-8 -*-
response.logo = A(B('IIIT - H'),XML('™ '),
_class="brand",_href="http://iiit.ac.in")
response.title = request.application.replace('_',' ').title()
response.subtitle = ''
## read more at http://dev.w3.org/html5/markup/meta.name.html
response.meta.author = 'Your Name... | response.logo = a(b('IIIT - H'), xml('™ '), _class='brand', _href='http://iiit.ac.in')
response.title = request.application.replace('_', ' ').title()
response.subtitle = ''
response.meta.author = 'Your Name <you@example.com>'
response.meta.keywords = 'web2py, python, framework'
response.meta.generator = 'Web... |
DEFAULT_CROP_PCT = 0.875
IMAGENET_DEFAULT_MEAN = (0.485, 0.456, 0.406)
IMAGENET_DEFAULT_STD = (0.229, 0.224, 0.225)
IMAGENET_INCEPTION_MEAN = (0.5, 0.5, 0.5)
IMAGENET_INCEPTION_STD = (0.5, 0.5, 0.5)
IMAGENET_DPN_MEAN = (124 / 255, 117 / 255, 104 / 255)
IMAGENET_DPN_STD = tuple([1 / (.0167 * 255)] * 3)
CIFAR10_DEFAULT_M... | default_crop_pct = 0.875
imagenet_default_mean = (0.485, 0.456, 0.406)
imagenet_default_std = (0.229, 0.224, 0.225)
imagenet_inception_mean = (0.5, 0.5, 0.5)
imagenet_inception_std = (0.5, 0.5, 0.5)
imagenet_dpn_mean = (124 / 255, 117 / 255, 104 / 255)
imagenet_dpn_std = tuple([1 / (0.0167 * 255)] * 3)
cifar10_default_... |
#########################################
# SwingGui.py
# description: Service used to graphically display and control other services
# categories: display
# more info @: http://myrobotlab.org/service/SwingGui
#########################################
# start the service
gui = Runtime.start('gui','SwingGui')
# start ... | gui = Runtime.start('gui', 'SwingGui')
python2 = Runtime.start('python2', 'Python')
gui.setActiveTab('python2') |
expected_output = {
"vtp": {
"conf_last_modified_by": "0.0.0.0",
"conf_last_modified_time": "0-0-00 00:00:00",
"configuration_revision": 0,
"domain_name": "<>",
"enabled": False,
"existing_vlans": 100,
"maximum_vlans": 1005,
"md5_digest": "0x11 0x22 0x... | expected_output = {'vtp': {'conf_last_modified_by': '0.0.0.0', 'conf_last_modified_time': '0-0-00 00:00:00', 'configuration_revision': 0, 'domain_name': '<>', 'enabled': False, 'existing_vlans': 100, 'maximum_vlans': 1005, 'md5_digest': '0x11 0x22 0x50 0x77 0x99 0xA1 0xB2 0xC3', 'operating_mode': 'transparent', 'prunin... |
class MyCustomList(list):
def __getitem__(self, index):
if index == 0:
raise ValueError
index = index - 1
return list.__getitem__(self, index)
def __setitem__(self, index, value):
if index == 0:
raise ValueError
index = index - 1
retu... | class Mycustomlist(list):
def __getitem__(self, index):
if index == 0:
raise ValueError
index = index - 1
return list.__getitem__(self, index)
def __setitem__(self, index, value):
if index == 0:
raise ValueError
index = index - 1
return l... |
class JarvisCliConfigError(RuntimeError):
pass
class JarvisPromptError(RuntimeError):
pass
| class Jarviscliconfigerror(RuntimeError):
pass
class Jarvisprompterror(RuntimeError):
pass |
pkgname = "graphene"
pkgver = "1.10.8"
pkgrel = 0
build_style = "meson"
configure_args = [
"-Dinstalled_tests=false",
"-Dgcc_vector=true",
"-Dintrospection=enabled"
]
hostmakedepends = ["meson", "pkgconf", "gobject-introspection"]
makedepends = [
"libglib-devel"
]
pkgdesc = "Thin layer of graphic data t... | pkgname = 'graphene'
pkgver = '1.10.8'
pkgrel = 0
build_style = 'meson'
configure_args = ['-Dinstalled_tests=false', '-Dgcc_vector=true', '-Dintrospection=enabled']
hostmakedepends = ['meson', 'pkgconf', 'gobject-introspection']
makedepends = ['libglib-devel']
pkgdesc = 'Thin layer of graphic data types'
maintainer = '... |
'''27. Remove Element
Easy
1300
2531
Add to List
Share
Given an array nums and a value val, remove all instances of that value in-place and return the new length.
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
The order o... | """27. Remove Element
Easy
1300
2531
Add to List
Share
Given an array nums and a value val, remove all instances of that value in-place and return the new length.
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
The order of elements can... |
def load_sample_data():
data_matrix = ([
[1. , 2.1],
[2. , 1.1],
[1.3, 1. ],
[2., 1.]
])
class_labels = [1, 1, -1, -1, 1]
return data_matrix, class_labels
def stump_classify(data_matrix, dimen, thresh_val, thresh_ineq):
ret_array = ones((shape(data_matrix)[0], 1))
... | def load_sample_data():
data_matrix = [[1.0, 2.1], [2.0, 1.1], [1.3, 1.0], [2.0, 1.0]]
class_labels = [1, 1, -1, -1, 1]
return (data_matrix, class_labels)
def stump_classify(data_matrix, dimen, thresh_val, thresh_ineq):
ret_array = ones((shape(data_matrix)[0], 1))
if thresh_ineq == 'lt':
re... |
# Template parameters:
# test_navbar : The navigation bar.
# tmpl_test_sidebar : The sidebar.
# total_test_result : HTML for total test results.
# single_test_result_listing : HTML for single test result listing.
tmpl_main_html = '''
<!doctype html>
<html lang="en">
<head>... | tmpl_main_html = '\n<!doctype html>\n<html lang="en">\n <head>\n <!-- Required meta tags -->\n <meta charset="utf-8">\n <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">\n <!-- Bootstrap CSS -->\n <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap... |
# -*- coding: utf-8 -*-
class NotFoundException(Exception):
pass
class NotAuthorizedException(Exception):
pass
class NotOnNOSQLError(NotImplementedError):
def __init__(self, message=None):
if message is None:
message = "Not Supported on NoSQL databases"
super(NotOnNOSQLErro... | class Notfoundexception(Exception):
pass
class Notauthorizedexception(Exception):
pass
class Notonnosqlerror(NotImplementedError):
def __init__(self, message=None):
if message is None:
message = 'Not Supported on NoSQL databases'
super(NotOnNOSQLError, self).__init__(message) |
n,k=map(int,input().split())
if k>n:
print(-1)
elif n==1 and k==1:
print("a")
elif k==1:
print(-1)
else:
ans=""
k=k-2
n=n-k
z=99
if n%2==0:
ans+="ab"*(n//2)
while(k>0):
ans+=chr(z)
z+=1
k-=1
else:
x=99
ans+="ab"*(n//... | (n, k) = map(int, input().split())
if k > n:
print(-1)
elif n == 1 and k == 1:
print('a')
elif k == 1:
print(-1)
else:
ans = ''
k = k - 2
n = n - k
z = 99
if n % 2 == 0:
ans += 'ab' * (n // 2)
while k > 0:
ans += chr(z)
z += 1
k -= 1
... |
node = S(input, "application/json")
property1 = node.prop("order")
property2 = node.prop("id")
property3 = node.prop("customers")
property4 = node.prop("orderDetails")
property5 = node.prop("active")
value1 = property1.isString()
value2 = property2.isString()
value3 = property3.isString()
value4 = property4.isString(... | node = s(input, 'application/json')
property1 = node.prop('order')
property2 = node.prop('id')
property3 = node.prop('customers')
property4 = node.prop('orderDetails')
property5 = node.prop('active')
value1 = property1.isString()
value2 = property2.isString()
value3 = property3.isString()
value4 = property4.isString()
... |
class Player:
def __init__(self, stats):
self.stats = stats
self.name = stats['Name']
self.team = stats['Team']
self.position = stats['Position']
self.ovr = stats['OVR']
def __str__(self):
return self.name | class Player:
def __init__(self, stats):
self.stats = stats
self.name = stats['Name']
self.team = stats['Team']
self.position = stats['Position']
self.ovr = stats['OVR']
def __str__(self):
return self.name |
# Parse the input from the input file
input_file = 'example_input.txt'
target_x = ''
target_y = ''
with open(input_file) as input:
line = input.readline().rstrip()
line = line[15:]
target_x, target_y = line.split(', y=')
target_x = tuple([int(x) for x in target_x.split('..')])
target_y = tuple([int(y) for... | input_file = 'example_input.txt'
target_x = ''
target_y = ''
with open(input_file) as input:
line = input.readline().rstrip()
line = line[15:]
(target_x, target_y) = line.split(', y=')
target_x = tuple([int(x) for x in target_x.split('..')])
target_y = tuple([int(y) for y in target_y.split('..')])
... |
reslen=float("-infinity")
resstart = None
def asd(s='aaababaaa'):
if len(s)<2:
return s
for i in range(len(s)-1):
expand(s,i,i)
expand(s,i,i+1)
return s[resstart:resstart+reslen]
def expand(string,begin,end):
while begin>=0 and end<len(string) and string[begin]==string[end]:
... | reslen = float('-infinity')
resstart = None
def asd(s='aaababaaa'):
if len(s) < 2:
return s
for i in range(len(s) - 1):
expand(s, i, i)
expand(s, i, i + 1)
return s[resstart:resstart + reslen]
def expand(string, begin, end):
while begin >= 0 and end < len(string) and (string[be... |
DDD=int(input())
if DDD==61:
print("Brasilia")
elif DDD==71:
print("Salvador")
elif DDD==11:
print("Sao Paulo")
elif DDD==21:
print("Rio de Janeiro")
elif DDD==32:
print("Juiz de Fora")
elif DDD==19:
print("Campinas")
elif DDD==27:
print("Vitoria")
elif DDD==31:
print("Belo Horiz... | ddd = int(input())
if DDD == 61:
print('Brasilia')
elif DDD == 71:
print('Salvador')
elif DDD == 11:
print('Sao Paulo')
elif DDD == 21:
print('Rio de Janeiro')
elif DDD == 32:
print('Juiz de Fora')
elif DDD == 19:
print('Campinas')
elif DDD == 27:
print('Vitoria')
elif DDD == 31:
print('... |
def rule(_):
return True
def title(event):
return f"User [{event.get('user_name','<UNKNOWN_USER>')}] has exceeded the failed logins threshold"
| def rule(_):
return True
def title(event):
return f"User [{event.get('user_name', '<UNKNOWN_USER>')}] has exceeded the failed logins threshold" |
def ask_ok(prompt, retries=4, reminder='Please try again!'):
while True:
ok = input(prompt)
if ok in ('y', 'ye', 'yes'):
return True
if ok in ('n', 'no', 'nop', 'nope'):
return False
retries -= 1
if retries < 0:
raise ValueError('invalid us... | def ask_ok(prompt, retries=4, reminder='Please try again!'):
while True:
ok = input(prompt)
if ok in ('y', 'ye', 'yes'):
return True
if ok in ('n', 'no', 'nop', 'nope'):
return False
retries -= 1
if retries < 0:
raise value_error('invalid u... |
class MinMaxStack:
def __init__(self):
# only contains the min and max value at any given time
# min_max_stack is an array of dictionary, which is the same length of stack
self.min_max_stack = [] # an array of dictionary of min and max key
self.stack = []
# O(1) time | O(1) spac... | class Minmaxstack:
def __init__(self):
self.min_max_stack = []
self.stack = []
def peek(self):
return self.stack[len(self.stack) - 1]
def pop(self):
self.min_max_stack.pop()
return self.stack.pop()
def push(self, number):
new_min_max = {'min': number, ... |
# user_id, record_id, is_readonly
populate_permissions_vals = [
(
"f6bc7939-deb1-4bc9-b77b-aa5dc9e98209",
"ca658fd0-15a6-4830-a69d-4e04b3df8bc2",
True,
),
(
"ba44c2e0-4b70-4d2a-8798-caa5895434a2",
"75e4b97d-bcd1-4d34-a293-bf99c798d53c",
False,
),
(
... | populate_permissions_vals = [('f6bc7939-deb1-4bc9-b77b-aa5dc9e98209', 'ca658fd0-15a6-4830-a69d-4e04b3df8bc2', True), ('ba44c2e0-4b70-4d2a-8798-caa5895434a2', '75e4b97d-bcd1-4d34-a293-bf99c798d53c', False), ('ba44c2e0-4b70-4d2a-8798-caa5895434a2', 'd28c9305-4dae-4849-8023-23b14e332680', False), ('ba44c2e0-4b70-4d2a-8798... |
class TreeNode:
def __init__(self, x, left=None, right=None):
self.val = x
self.left = left
self.right = right
def make_tree(arr, root, i, n):
if i < n:
temp = TreeNode(arr[i])
root = temp
root.left = make_tree(arr, root.left, 2 * i + 1, n)
root.right = ... | class Treenode:
def __init__(self, x, left=None, right=None):
self.val = x
self.left = left
self.right = right
def make_tree(arr, root, i, n):
if i < n:
temp = tree_node(arr[i])
root = temp
root.left = make_tree(arr, root.left, 2 * i + 1, n)
root.right =... |
# 2020.01.15
# Sorry, was not in good mood yesterday
# Problem Statement:
# https://leetcode.com/problems/balanced-binary-tree/
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right... | class Solution:
def is_balanced(self, root: TreeNode) -> bool:
if not root:
return True
self.answer = True
height = self.isBalancedHelper(root)
return self.answer
def is_balanced_helper(self, root):
if not root:
return 0
left_height = sel... |
_base_ = 'yolact_r50_1x8_coco.py'
optimizer = dict(type='SGD', lr=8e-3, momentum=0.9, weight_decay=5e-4)
optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
# learning policy
lr_config = dict(
policy='step',
warmup='linear',
warmup_iters=1000,
warmup_ratio=0.1,
step=[20, 42,... | _base_ = 'yolact_r50_1x8_coco.py'
optimizer = dict(type='SGD', lr=0.008, momentum=0.9, weight_decay=0.0005)
optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2))
lr_config = dict(policy='step', warmup='linear', warmup_iters=1000, warmup_ratio=0.1, step=[20, 42, 49, 52]) |
string=input('Enter a string:')
reverse=string[::-1]
if string == reverse :
print('The string is palindrome.')
else:
print('The string is not a palindrome.')
| string = input('Enter a string:')
reverse = string[::-1]
if string == reverse:
print('The string is palindrome.')
else:
print('The string is not a palindrome.') |
#pass the y_pred list to this finction from ML model.predict and this function returns the name of the peice in the corresponding square.
def predict(probabilities):
target_names = ['BB', 'BK', 'BN', 'BP', 'BQ', 'BR',
'Empty', 'WB', 'WK', 'WN', 'WP', 'WQ', 'WR']
peices = {'B': 'Bishop', 'K... | def predict(probabilities):
target_names = ['BB', 'BK', 'BN', 'BP', 'BQ', 'BR', 'Empty', 'WB', 'WK', 'WN', 'WP', 'WQ', 'WR']
peices = {'B': 'Bishop', 'K': 'King', 'N': 'Knight', 'P': 'pawn', 'Q': 'Queen', 'R': 'Rook'}
current_value = -1
current_index = -1
for i in range(len(probabilities)):
... |
# coding = utf-8
# Create date: 2018-10-31
# Author :Hailong
def test_write_files(ros_kvm_with_paramiko, cloud_config_url):
command = 'sudo cat /test'
feed_back = 'console content'
client = ros_kvm_with_paramiko(cloud_config='{url}/test_write_files.yml'.format(url=cloud_config_url))
stdin, stdout, st... | def test_write_files(ros_kvm_with_paramiko, cloud_config_url):
command = 'sudo cat /test'
feed_back = 'console content'
client = ros_kvm_with_paramiko(cloud_config='{url}/test_write_files.yml'.format(url=cloud_config_url))
(stdin, stdout, stderr) = client.exec_command(command, timeout=10)
output = s... |
d = list(map(int, input().split()))
d.sort()
if d[0]+d[3]==d[1]+d[2] or d[3]==d[0]+d[1]+d[2]:
print('Yes')
else:
print('No')
| d = list(map(int, input().split()))
d.sort()
if d[0] + d[3] == d[1] + d[2] or d[3] == d[0] + d[1] + d[2]:
print('Yes')
else:
print('No') |
#
# Copyright (c) 2017 Electronic Arts Inc. All Rights Reserved
#
# Code version. Jobs are also associated with a version, and can only run on nodes running
# on a version equal or lower.
VERSION = 50
| version = 50 |
'''
The Device Array API is not implemented in the simulator. This module provides
stubs to allow tests to import correctly.
'''
DeviceRecord = None
from_record_like = None
auto_device = None
| """
The Device Array API is not implemented in the simulator. This module provides
stubs to allow tests to import correctly.
"""
device_record = None
from_record_like = None
auto_device = None |
def decompose(n):
D, i = dict(), 2
while n != 1:
if n % i == 0:
n //= i
D[i] = [i, D[i][1] + 1] if i in D else [i, 1]
else:
i += 1
return list(D.values())
print(decompose(99999876400))
| def decompose(n):
(d, i) = (dict(), 2)
while n != 1:
if n % i == 0:
n //= i
D[i] = [i, D[i][1] + 1] if i in D else [i, 1]
else:
i += 1
return list(D.values())
print(decompose(99999876400)) |
class SymbolTable:
_symbols: {}
def __init__(self):
self._symbols = {}
def __contains__(self, key):
return key in self._symbols
def define_sym(self, sym_name: str, def_addr: int):
if sym_name in self._symbols:
if self._symbols[sym_name][0] == None:
self._symbols[sym_name] = (def_addr, self._symbols[... | class Symboltable:
_symbols: {}
def __init__(self):
self._symbols = {}
def __contains__(self, key):
return key in self._symbols
def define_sym(self, sym_name: str, def_addr: int):
if sym_name in self._symbols:
if self._symbols[sym_name][0] == None:
... |
def numero_mayor(x1,x2):
if x1>x2:
return x1
else:
return x2
def numero_menor(x1,x2):
if x1<x2:
return x1
else:
return x2 | def numero_mayor(x1, x2):
if x1 > x2:
return x1
else:
return x2
def numero_menor(x1, x2):
if x1 < x2:
return x1
else:
return x2 |
def solution(start, length):
def bulk_xor(m, n):
m -= 1
f_m = [m, 1, m + 1, 0][m % 4]
f_n = [n, 1, n + 1, 0][n % 4]
return f_m ^ f_n
xor = 0
for i in range(length):
xor ^= bulk_xor(start, start + length - i - 1)
start += length
return xor
| def solution(start, length):
def bulk_xor(m, n):
m -= 1
f_m = [m, 1, m + 1, 0][m % 4]
f_n = [n, 1, n + 1, 0][n % 4]
return f_m ^ f_n
xor = 0
for i in range(length):
xor ^= bulk_xor(start, start + length - i - 1)
start += length
return xor |
class Solution:
def generatePossibleNextMoves(self, s: str) -> List[str]:
res = []
strList = list(s)
for i in range(len(s)-1):
if strList[i] == '+' and strList[i+1] == '+':
strList[i] = strList[i+1] = '-'
res.append(''.join(strList))
... | class Solution:
def generate_possible_next_moves(self, s: str) -> List[str]:
res = []
str_list = list(s)
for i in range(len(s) - 1):
if strList[i] == '+' and strList[i + 1] == '+':
strList[i] = strList[i + 1] = '-'
res.append(''.join(strList))
... |
def solution(n: int, d: int) -> list:
if d <= 0:
return []
else:
return [int(i) for i in str(n)[-d:]]
| def solution(n: int, d: int) -> list:
if d <= 0:
return []
else:
return [int(i) for i in str(n)[-d:]] |
# Wine, New York, NY
#https://www.openstreetmap.org/node/2549960970
assert_has_feature(
18, 77193, 98529, 'pois',
{ 'kind': 'wine' })
# Alcohol, San Francisco, CA
#https://www.openstreetmap.org/node/1713269631
assert_has_feature(
18, 41922, 101345, 'pois',
{ 'kind': 'alcohol' })
| assert_has_feature(18, 77193, 98529, 'pois', {'kind': 'wine'})
assert_has_feature(18, 41922, 101345, 'pois', {'kind': 'alcohol'}) |
t = int(input())
M = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
while t:
A, B = map(int, input().split())
m = 0
S = str(A+B)
for i in S:
i = int(i)
m = m + M[i]
print(m)
t = t-1 | t = int(input())
m = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
while t:
(a, b) = map(int, input().split())
m = 0
s = str(A + B)
for i in S:
i = int(i)
m = m + M[i]
print(m)
t = t - 1 |
chars = input()
chars_list = []
for x in chars:
chars_list.append(x)
ball_position = [True, False, False]
for x in chars_list:
if x == 'A':
placeholder = ball_position[0]
ball_position[0] = ball_position[1]
ball_position[1] = placeholder
elif x == 'B':
placehol... | chars = input()
chars_list = []
for x in chars:
chars_list.append(x)
ball_position = [True, False, False]
for x in chars_list:
if x == 'A':
placeholder = ball_position[0]
ball_position[0] = ball_position[1]
ball_position[1] = placeholder
elif x == 'B':
placeholder = ball_posi... |
'''Crow/AAP Alarm IP Module Status Definition'''
COMMANDS = {
'arm': 'ARM',
'stay': 'STAY',
'disarm': 'KEYS', # Add ' codeE'
'get_memory_events': 'MEME',
'exit_memory_events': 'MEMX',
'panic': 'PANIC',
'toggle_chime': 'CHIME',
'quick_arm_a': 'A',
'quick_arm_b': 'B',
'relay_1_on'... | """Crow/AAP Alarm IP Module Status Definition"""
commands = {'arm': 'ARM', 'stay': 'STAY', 'disarm': 'KEYS', 'get_memory_events': 'MEME', 'exit_memory_events': 'MEMX', 'panic': 'PANIC', 'toggle_chime': 'CHIME', 'quick_arm_a': 'A', 'quick_arm_b': 'B', 'relay_1_on': 'RL1', 'relay_2_on': 'RL2', 'toogle_output_x': 'OO', 'k... |
class Actor:
def __init__(self, name, last_name, role):
self._name = name
self._last_name = last_name
self._role = role
@property
def name(self):
return self._name
@property
def last_name(self):
return self._last_name
@property
def role(self):
... | class Actor:
def __init__(self, name, last_name, role):
self._name = name
self._last_name = last_name
self._role = role
@property
def name(self):
return self._name
@property
def last_name(self):
return self._last_name
@property
def role(self):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.