content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
customers = [ { "customer id": 0, "first name":"Shakeel", "last name": "Haider", "address": "S.I.T.E Town", }, { "customer id": 1, "first name":"Zeeshan", "last name": "Khan", "address": "Orangi Town", }, { "customer id":...
customers = [{'customer id': 0, 'first name': 'Shakeel', 'last name': 'Haider', 'address': 'S.I.T.E Town'}, {'customer id': 1, 'first name': 'Zeeshan', 'last name': 'Khan', 'address': 'Orangi Town'}, {'customer id': 2, 'first name': 'Ibrar', 'last name': 'Shah', 'address': 'Mardan'}] print(str(customers))
class PermissionsError(Exception): pass class DuplicatePermissionError(PermissionsError): def __init__(self, name): super(DuplicatePermissionError, self).__init__('Permission exists: {0}'.format(name)) class NoSuchPermissionError(PermissionsError): def __init__(self, name): super(NoSu...
class Permissionserror(Exception): pass class Duplicatepermissionerror(PermissionsError): def __init__(self, name): super(DuplicatePermissionError, self).__init__('Permission exists: {0}'.format(name)) class Nosuchpermissionerror(PermissionsError): def __init__(self, name): super(NoSuchP...
# a piece of text with leading spaces def useless_function(): a = 123 ab=927 abc = 215 if abc <= 500: abcd = ab + abc abcd += a if abcd == abc: abcd = 0
def useless_function(): a = 123 ab = 927 abc = 215 if abc <= 500: abcd = ab + abc abcd += a if abcd == abc: abcd = 0
#!/usr/bin/env python class browserNavToolbar(NavigationToolbar2WxAgg): """wx/mpl NavToolbar hack with an additional tools user interaction. This class is necessary because simply adding a new togglable tool to the toolbar won't (1) radio-toggle between the new tool and the pan/zoom tools. (2) disable ...
class Browsernavtoolbar(NavigationToolbar2WxAgg): """wx/mpl NavToolbar hack with an additional tools user interaction. This class is necessary because simply adding a new togglable tool to the toolbar won't (1) radio-toggle between the new tool and the pan/zoom tools. (2) disable the pan/zoom tool modes...
# # ------------------------------------------------------------------------- # Copyright (c) 2019 AT&T Intellectual Property # # 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 # # ...
class Memfilter(object): def __init__(self): self.name = 'mem' self.status = None def init_condition(self): self.status = None def check_pre_condition(self, _level, _v, _avail_hosts, _avail_groups): return True def filter_candidates(self, _level, _v, _candidate_list):...
bind = '0.0.0.0:8000' pid = 'gunicorn.pid' django_settings = 'ourrevolution.settings' debug = False errorlog = 'gunicorn_error.log' workers = 20 max_requests = 200 timeout = 30 graceful_timeout = 30
bind = '0.0.0.0:8000' pid = 'gunicorn.pid' django_settings = 'ourrevolution.settings' debug = False errorlog = 'gunicorn_error.log' workers = 20 max_requests = 200 timeout = 30 graceful_timeout = 30
def calc(len, wid,tree): if len==wid==tree: print("eq") elif len==wid or wid==tree or tree==len: print("iso") else: print("sce") l = int(input("ENTER ")) w = int(input("ENTER ")) k = int(input("ENTER ")) for x in range(0,20): calc(l,w,k)
def calc(len, wid, tree): if len == wid == tree: print('eq') elif len == wid or wid == tree or tree == len: print('iso') else: print('sce') l = int(input('ENTER ')) w = int(input('ENTER ')) k = int(input('ENTER ')) for x in range(0, 20): calc(l, w, k)
# # PySNMP MIB module CADANT-CMTS-EQUIPMENT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CADANT-CMTS-EQUIPMENT-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:44:44 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3....
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) ...
#!/usr/bin/env python """ Written by and Copyright (C) Noah Spurrier 2003/11/10 source: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/251871 latin1_to_ascii -- The UNICODE Hammer -- AKA "The Stupid American" This takes a UNICODE string and replaces Latin-1 characters with something equivalent in 7-bit ASCII...
""" Written by and Copyright (C) Noah Spurrier 2003/11/10 source: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/251871 latin1_to_ascii -- The UNICODE Hammer -- AKA "The Stupid American" This takes a UNICODE string and replaces Latin-1 characters with something equivalent in 7-bit ASCII. This returns a plain...
class StopMessageProcessing(Exception): pass class TelegramServerError(RuntimeError): pass class MalformedMessageDetectedError(TelegramServerError): pass
class Stopmessageprocessing(Exception): pass class Telegramservererror(RuntimeError): pass class Malformedmessagedetectederror(TelegramServerError): pass
num1 = float(input()) num2 = float(input()) num3 = float(input()) mp = (num1*2 + num2*3 + num3*5)/10 print('MEDIA = {:.1f}' .format(mp))
num1 = float(input()) num2 = float(input()) num3 = float(input()) mp = (num1 * 2 + num2 * 3 + num3 * 5) / 10 print('MEDIA = {:.1f}'.format(mp))
class ConverterClass: TEXT = "text" SPREADSHEET = "spreadsheet" PRESENTATION = "presentation" GRAPHIC = "graphic" # MIME TYPES TEXT_MIME_TYPES = { "application/pdf": ["pdf"], "application/msword": ["doc"], "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ["docx"]...
class Converterclass: text = 'text' spreadsheet = 'spreadsheet' presentation = 'presentation' graphic = 'graphic' text_mime_types = {'application/pdf': ['pdf'], 'application/msword': ['doc'], 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': ['docx'], 'application/vnd.oasis.open...
# pma.py --maxTransitions 100 msocket # 59 states, 100 transitions, 1 accepting states, 0 unsafe states, 0 finished and 0 deadend states # actions here are just labels, but must be symbols with __name__ attribute def send_call(): pass def send_return(): pass def recv_call(): pass def recv_return(): pass # states, k...
def send_call(): pass def send_return(): pass def recv_call(): pass def recv_return(): pass states = {0: {'msocket': {'send_arg': '', 'recv_arg': 0, 'buffers': ''}}, 1: {'msocket': {'send_arg': 'a', 'recv_arg': 0, 'buffers': ''}}, 2: {'msocket': {'send_arg': '', 'recv_arg': 4, 'buffers': ''}}, 3: {'m...
# The JupyterLab user interface c.Spawner.default_url = '/lab' # Jupyterhub Log level c.JupyterHub.log_level = 'DEBUG' # LDAP configurations c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator' c.LDAPAuthenticator.use_ssl = False c.LDAPAuthenticator.server_address = '103.127.28.120' c.LDAPAuthent...
c.Spawner.default_url = '/lab' c.JupyterHub.log_level = 'DEBUG' c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator' c.LDAPAuthenticator.use_ssl = False c.LDAPAuthenticator.server_address = '103.127.28.120' c.LDAPAuthenticator.bind_dn_template = 'uid={username},cn=users,cn=accounts,dc=pdcloudex,dc=c...
cities = [ 'Adak', 'Akiachak', 'Akiak', 'Akutan', 'Alakanuk', 'Aleknagik', 'Allakaket', 'Ambler', 'Anaktuvuk Pass', 'Anchor Point', 'Anchorage', 'Anderson', 'Angoon', 'Aniak', 'Anvik', 'Arctic Village', 'Atka', 'Atqasuk', 'Auke Bay', 'Barro...
cities = ['Adak', 'Akiachak', 'Akiak', 'Akutan', 'Alakanuk', 'Aleknagik', 'Allakaket', 'Ambler', 'Anaktuvuk Pass', 'Anchor Point', 'Anchorage', 'Anderson', 'Angoon', 'Aniak', 'Anvik', 'Arctic Village', 'Atka', 'Atqasuk', 'Auke Bay', 'Barrow', 'Beaver', 'Bethel', 'Bettles Field', 'Big Lake', 'Brevig Mission', 'Buckland'...
#Programa Palindromo -> una palabra palindromo que se lee al derecho y al reves #Ejemplo Luz azul def palindromo(palabra): palabra = palabra.replace(' ', '') palabra = palabra.lower() palabraInvertida = palabra[::-1] if (palabra == palabraInvertida): return True else: return False...
def palindromo(palabra): palabra = palabra.replace(' ', '') palabra = palabra.lower() palabra_invertida = palabra[::-1] if palabra == palabraInvertida: return True else: return False def run(): print('Validemos si es un palindromo') palabra = input('Escribe tu palabra para v...
class Solution(object): def minimumDeleteSum(self, s1, s2): """ :type s1: str :type s2: str :rtype: int """ list1 = {} list2 = {} i = 1 tot1 = 0 tot2 = 0 for x in s1: list1[i] = ord(x) tot1 += ord(x) ...
class Solution(object): def minimum_delete_sum(self, s1, s2): """ :type s1: str :type s2: str :rtype: int """ list1 = {} list2 = {} i = 1 tot1 = 0 tot2 = 0 for x in s1: list1[i] = ord(x) tot1 += ord(x) ...
class signup_locators(): # Locators for facebook Signup page userfirstnametextbox_id = "u_0_j" userlastnametextbox_id = "u_0_l"
class Signup_Locators: userfirstnametextbox_id = 'u_0_j' userlastnametextbox_id = 'u_0_l'
"""Fontsize settings.""" def icml2022(): r"""Font size for ICML 2022. Source: https://media.icml.cc/Conferences/ICML2022/Styles/example_paper.pdf """ # ICML text size is 10, but captions are in size 9. # Therefore, we use base 9 instead of 10. return _from_base(base=9) def neurips2021(): ...
"""Fontsize settings.""" def icml2022(): """Font size for ICML 2022. Source: https://media.icml.cc/Conferences/ICML2022/Styles/example_paper.pdf """ return _from_base(base=9) def neurips2021(): """Font size for Neurips 2021.""" return _from_base(base=10) def neurips2022(): """Font size f...
# model settings model = dict( type='CAE', backbone=dict(type='CAEViT', arch='b', patch_size=16, init_values=0.1), neck=dict( type='CAENeck', patch_size=16, embed_dims=768, num_heads=12, regressor_depth=4, decoder_depth=4, mlp_ratio=4, init_val...
model = dict(type='CAE', backbone=dict(type='CAEViT', arch='b', patch_size=16, init_values=0.1), neck=dict(type='CAENeck', patch_size=16, embed_dims=768, num_heads=12, regressor_depth=4, decoder_depth=4, mlp_ratio=4, init_values=0.1), head=dict(type='CAEHead', tokenizer_path='cae_ckpt/dalle_encoder.pth', lambd=2), base...
# # MIT License # # (C) Copyright 2019, 2021-2022 Hewlett Packard Enterprise Development LP # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation...
""" Mock Node Group Table """ class Nodegroup: """A class representing a Node Group """ def __init__(self, label, data): """Constructor - name is the name of the Boot Set, data is a dictionary containing the data provided by the caller. """ self.label = label sel...
# Databricks notebook source datFileReadOptions = {"header":"true", "delimiter":"|", "inferSchema":"false"} csvFileReadOptions = {"header":"true", "delimiter":",", "inferSchema":"false"} # COMMAND ---------- webSalesSchema = "ws_...
dat_file_read_options = {'header': 'true', 'delimiter': '|', 'inferSchema': 'false'} csv_file_read_options = {'header': 'true', 'delimiter': ',', 'inferSchema': 'false'} web_sales_schema = 'ws_sold_date_sk LONG,ws_sold_time_sk LONG,ws_ship_date_sk LONG,ws_item_sk LONG,ws_bill_customer_sk LONG,ws_bill_cdemo_sk LONG,ws_b...
VAULT_ASSETS = { "1.6.3": { "linux": ( "https://releases.hashicorp.com/vault/1.6.3/vault_1.6.3_linux_amd64.zip", "844adaf632391be41f945143de7dccfa9b39c52a72e8e22a5d6bad9c32404c46", ), "darwin": ( "https://releases.hashicorp.com/vault/1.6.3/vault_1.6.3_darw...
vault_assets = {'1.6.3': {'linux': ('https://releases.hashicorp.com/vault/1.6.3/vault_1.6.3_linux_amd64.zip', '844adaf632391be41f945143de7dccfa9b39c52a72e8e22a5d6bad9c32404c46'), 'darwin': ('https://releases.hashicorp.com/vault/1.6.3/vault_1.6.3_darwin_amd64.zip', '7250ab8c5e9aa05eb223cfdc3f07a4a437341ee258244062b2d0fd...
""" Includes the help page of the program having information about the different flags and options. Most importantly includes examples of how the different flags are going to be used. This page is going to be implemented iteratively i.e when a new feature is implemented this page is updated to include info about it. "...
""" Includes the help page of the program having information about the different flags and options. Most importantly includes examples of how the different flags are going to be used. This page is going to be implemented iteratively i.e when a new feature is implemented this page is updated to include info about it. "...
pessoa = list() pessoas = list() maior = manor = 0 while True: pessoa.append(str(input('Nome: '))) pessoa.append(float(input('Peso: '))) if len(pessoas) == 0: maior = pessoa[1] menor = pessoa[1] elif pessoa[1] > maior: maior = pessoa[1] elif pessoa[1] < menor: menor ...
pessoa = list() pessoas = list() maior = manor = 0 while True: pessoa.append(str(input('Nome: '))) pessoa.append(float(input('Peso: '))) if len(pessoas) == 0: maior = pessoa[1] menor = pessoa[1] elif pessoa[1] > maior: maior = pessoa[1] elif pessoa[1] < menor: menor =...
#!/usr/bin/python """ unroll certain for loops and generate C++ code """ def ao_ordering(l): """list of Cartesian basis function with angular momentum l""" if l == 0: return [(0,0,0)] elif l == 1: return [(1,0,0), (0,1,0), (0,0,1)] elif l == 2: # ordering of d-functions in TeraC...
""" unroll certain for loops and generate C++ code """ def ao_ordering(l): """list of Cartesian basis function with angular momentum l""" if l == 0: return [(0, 0, 0)] elif l == 1: return [(1, 0, 0), (0, 1, 0), (0, 0, 1)] elif l == 2: return [(1, 1, 0), (1, 0, 1), (0, 1, 1), (2,...
print("Nhap n:") n = int(input()) total = 0 for num in range(n): total = total + num print(total)
print('Nhap n:') n = int(input()) total = 0 for num in range(n): total = total + num print(total)
#!/usr/bin/python3 def roman_to_int(roman_string): result = 0 convert_roman = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} if roman_string is None: return 0 if type(roman_string) is not str: return 0 if len(roman_string) > 0: vlr_prev...
def roman_to_int(roman_string): result = 0 convert_roman = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} if roman_string is None: return 0 if type(roman_string) is not str: return 0 if len(roman_string) > 0: vlr_previous = 0 for letter in roman_string:...
# ------------------------------ # c720. Longest Word in Dictionary # Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other words in words. If there is more than one possible answer, return the longest word with the smallest l...
class Solution(object): def longest_word(self, words): """ :type words: List[str] :rtype: str """ words.sort() candidates = [] res = '' max_len = 0 first_flag = True for item in words: if len(item) == 1: can...
# 51st week # cofo 690 div3 # No. 1 ''' if __name__ == "__main__": for _ in range(int(input())): n = int(input()) l = list(map(int,input().split(' '))) res = [] sig = 1 while len(l) > 0: res.append(l.pop(0) if sig == 1 else l.pop(-1)) sig *= -1 ...
""" if __name__ == "__main__": for _ in range(int(input())): n = int(input()) l = list(map(int,input().split(' '))) res = [] sig = 1 while len(l) > 0: res.append(l.pop(0) if sig == 1 else l.pop(-1)) sig *= -1 print(" ".join(map(str, res))) """ ...
cnt = 0 a = [] for i in range(100): x = int(input()) a.append(x) for x in a: cnt += x print(cnt)
cnt = 0 a = [] for i in range(100): x = int(input()) a.append(x) for x in a: cnt += x print(cnt)
# Time: O(n), n=len(nums) # Space: O(n) class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: imap = {} for index, num in enumerate(nums): if target-num in imap: return [imap[target-num], index] else: imap[num] = index...
class Solution: def two_sum(self, nums: List[int], target: int) -> List[int]: imap = {} for (index, num) in enumerate(nums): if target - num in imap: return [imap[target - num], index] else: imap[num] = index return [None, None]
# Created by Lukas on 15.04.2019 # # this utils file provides some nice format stuff # Formatter def add_start(text, symbol = "*"): start = " start ".center(80, symbol) +"\n" nice_text = start + text return nice_text def add_fin(text, symbol = "*"): fin = "\n" + " fin ".center(80,symbol) nice_te...
def add_start(text, symbol='*'): start = ' start '.center(80, symbol) + '\n' nice_text = start + text return nice_text def add_fin(text, symbol='*'): fin = '\n' + ' fin '.center(80, symbol) nice_text = text + fin return nice_text def surround_text_with_and_fin(text, symbol='*'): nice_text ...
aux = 0 k = int(input("Ingrese numero K: ")) for i in range(0,k+1): aux = -1*i + 12*i aux = 4*aux print(aux)
aux = 0 k = int(input('Ingrese numero K: ')) for i in range(0, k + 1): aux = -1 * i + 12 * i aux = 4 * aux print(aux)
""" Exercise 7 - Card Games """ def get_rounds (number): """Creates a list containing the current and next two round numbers. :param number: int - current round number. :return: list - current round and the two that follow. """ return list ({number, number + 1, number + 2}) def concatenate_ro...
""" Exercise 7 - Card Games """ def get_rounds(number): """Creates a list containing the current and next two round numbers. :param number: int - current round number. :return: list - current round and the two that follow. """ return list({number, number + 1, number + 2}) def concatenate_rounds...
class SpaceValue(object): def __init__(self, value='blank'): self.FLAG_MODIFIER = 10 self.BLANK = 0 self.MINE = 9 self._revealed = False self._space_value_dict = {'mine' : self.MINE, 'blank' : self.BLANK} self.SPACE_VALUE_RANGE = r...
class Spacevalue(object): def __init__(self, value='blank'): self.FLAG_MODIFIER = 10 self.BLANK = 0 self.MINE = 9 self._revealed = False self._space_value_dict = {'mine': self.MINE, 'blank': self.BLANK} self.SPACE_VALUE_RANGE = range(10) self.set_value(value)...
n= 1 temp= 0 while n<97 : temp +=n n= n+2 print(temp)
n = 1 temp = 0 while n < 97: temp += n n = n + 2 print(temp)
""" The Car Wash binary sensor. For more details about this platform, please refer to the documentation at https://github.com/Limych/ha-car_wash/ """
""" The Car Wash binary sensor. For more details about this platform, please refer to the documentation at https://github.com/Limych/ha-car_wash/ """
array([[2.88738855, 0.72646774], [3.16759122, 0.70478649], [3.45517317, 0.69217863], [3.75325158, 0.68581005], [4.07281434, 0.68360819], [4.50000223, 0.68376092], [4.54999507, 0.68377879], [5.11738115, 0.69080411], [5.44798256, 0.7112322 ], [5.71126558, 0.7...
array([[2.88738855, 0.72646774], [3.16759122, 0.70478649], [3.45517317, 0.69217863], [3.75325158, 0.68581005], [4.07281434, 0.68360819], [4.50000223, 0.68376092], [4.54999507, 0.68377879], [5.11738115, 0.69080411], [5.44798256, 0.7112322], [5.71126558, 0.7422347], [5.94137211, 0.78496462], [6.1491271, 0.84078035], [6.3...
#--------------------------------------------------------------------------------------- #-------------------Author : itsjaysuthar ---------------------------------------------- #--------------------------------------------------------------------------------------- t = int(input()) i = 0 while i<t: num = int(inp...
t = int(input()) i = 0 while i < t: num = int(input()) if num < 10: print('Thanks for helping Chef!') else: print(-1) i += 1
def printDecimal(x): print(" ", x, end='') def printOctal(x): print(" ", oct(x), end='') def printHexadecimal(x): print(" ", hex(x), end='') def printBinario(x): print(" ", bin(x), end='') def imprimirTabela(): x = 0 print(" Decimal Octal Hexadecima...
def print_decimal(x): print(' ', x, end='') def print_octal(x): print(' ', oct(x), end='') def print_hexadecimal(x): print(' ', hex(x), end='') def print_binario(x): print(' ', bin(x), end='') def imprimir_tabela(): x = 0 print(' Decimal Octal H...
# -*- coding: utf-8 -*- """ Created on Sun Oct 3 02:24:08 2021 @author: shubhransu """ num = input("Enter Your Numbers:").split() for i in range(0,len(num)): num[i] = int(num[i]) print(num) max = num[0] for j in range(0,len(num)): if max<num[j]: max = num[j] print(f"...
""" Created on Sun Oct 3 02:24:08 2021 @author: shubhransu """ num = input('Enter Your Numbers:').split() for i in range(0, len(num)): num[i] = int(num[i]) print(num) max = num[0] for j in range(0, len(num)): if max < num[j]: max = num[j] print(f'Maximum value or number is {max}')
class Configuration: shop_id = None secret_key = None def configure(self, shop_id, secret_key): self.shop_id = shop_id self.secret_key = secret_key configuration = Configuration()
class Configuration: shop_id = None secret_key = None def configure(self, shop_id, secret_key): self.shop_id = shop_id self.secret_key = secret_key configuration = configuration()
N = int(input()) a_list = [] for i in range(N): a_list.append(int(input())) checked = set() if a_list[0] == 2: print(1) exit() checked.add(a_list[0]) count = 1 btn = a_list[0] for i in range(1, N): ai = a_list[btn-1] count +=1 if ai in checked: print(-1) exit() else: ...
n = int(input()) a_list = [] for i in range(N): a_list.append(int(input())) checked = set() if a_list[0] == 2: print(1) exit() checked.add(a_list[0]) count = 1 btn = a_list[0] for i in range(1, N): ai = a_list[btn - 1] count += 1 if ai in checked: print(-1) exit() elif ai == ...
class Point(object): def __init__(self, coordinate): self.x_coordinate = coordinate[0] self.y_coordinate = coordinate[1] self.order = 0 self.maximal_manhattan_distance = 0 self.maximal_manhattan_distance_coordinate = ( self.x_coordinate, self.y_coordinate) ...
class Point(object): def __init__(self, coordinate): self.x_coordinate = coordinate[0] self.y_coordinate = coordinate[1] self.order = 0 self.maximal_manhattan_distance = 0 self.maximal_manhattan_distance_coordinate = (self.x_coordinate, self.y_coordinate) def update_man...
class Moon: def __init__(self, coords): self.coords = coords self.velocity = [0, 0, 0] def adjust_from_other(self, other): for n in range(3): if (self.coords[n] < other.coords[n]): self.velocity[n] += 1 elif (self.coords[n] > other.coords[n]): ...
class Moon: def __init__(self, coords): self.coords = coords self.velocity = [0, 0, 0] def adjust_from_other(self, other): for n in range(3): if self.coords[n] < other.coords[n]: self.velocity[n] += 1 elif self.coords[n] > other.coords[n]: ...
""" Django app for: - Generate favicon in multiple format - Put in a storage backend - Include HTML tags for use favicon """ VERSION = (0, 7, 0) __version__ = '.'.join([str(i) for i in VERSION]) __author__ = 'Anthony Monthe (ZuluPro)' __email__ = 'anthony.monthe@gmail.com' __url__ = 'https://github.com/ZuluPro/django-s...
""" Django app for: - Generate favicon in multiple format - Put in a storage backend - Include HTML tags for use favicon """ version = (0, 7, 0) __version__ = '.'.join([str(i) for i in VERSION]) __author__ = 'Anthony Monthe (ZuluPro)' __email__ = 'anthony.monthe@gmail.com' __url__ = 'https://github.com/ZuluPro/django-s...
""" https://leetcode.com/problems/water-bottles/ Given numBottles full water bottles, you can exchange numExchange empty water bottles for one full water bottle. The operation of drinking a full water bottle turns it into an empty bottle. Return the maximum number of water bottles you can drink. Example 1: Inp...
""" https://leetcode.com/problems/water-bottles/ Given numBottles full water bottles, you can exchange numExchange empty water bottles for one full water bottle. The operation of drinking a full water bottle turns it into an empty bottle. Return the maximum number of water bottles you can drink. Example 1: Inp...
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ @File : dictHelper.py @Time : 2020/08/14 @Author : Yaronzz @Version : 2.0 @Contact : yaronhuang@foxmail.com @Desc : """ def get(obj, array: list): for item in array: if obj is None: return obj if ...
""" @File : dictHelper.py @Time : 2020/08/14 @Author : Yaronzz @Version : 2.0 @Contact : yaronhuang@foxmail.com @Desc : """ def get(obj, array: list): for item in array: if obj is None: return obj if item in obj: obj = obj[item] return obj class Di...
class FtpCrawler: def __init__(self, base_path, ftplib): self.base_path = base_path self.ftplib = ftplib def get_all_entries(self): def make_path(components): return '/'.join(components) self.ftplib.login() result = list() stack = [self.base_path] ...
class Ftpcrawler: def __init__(self, base_path, ftplib): self.base_path = base_path self.ftplib = ftplib def get_all_entries(self): def make_path(components): return '/'.join(components) self.ftplib.login() result = list() stack = [self.base_path] ...
""" Submission Scheduler The provided Scheduler modules are scheduling gromos runs to a give job-queue. """
""" Submission Scheduler The provided Scheduler modules are scheduling gromos runs to a give job-queue. """
# A program that displays the square, cube, and fourth power. x = int (input("Enter the number: ")) print("Square: {}\nCube: {}\nFourth Power: {}". format(x * x, x ** 3, pow(x, 4)))
x = int(input('Enter the number: ')) print('Square: {}\nCube: {}\nFourth Power: {}'.format(x * x, x ** 3, pow(x, 4)))
__author__ = 'Aaron Yang' __email__ = 'byang971@usc.edu' __date__ = '12/2/2020 10:49 PM' class Solution: def minDistance(self, word1: str, word2: str) -> int: row = len(word1) col = len(word2) dp = [[0] * (col + 1) for j in range(row + 1)] temp = 0 for j in range(1, col + ...
__author__ = 'Aaron Yang' __email__ = 'byang971@usc.edu' __date__ = '12/2/2020 10:49 PM' class Solution: def min_distance(self, word1: str, word2: str) -> int: row = len(word1) col = len(word2) dp = [[0] * (col + 1) for j in range(row + 1)] temp = 0 for j in range(1, col + ...
#!/usr/bin/env python3 def gate_AND(input1: int, input2: int, output: int) -> str: return 'GATE {} AND {} {}'.format(output, input1, input2) def gate_OR(input1: int, input2: int, output: int) -> str: return 'GATE {} OR {} {}'.format(output, input1, input2) def gate_NOT(input1: int, output: int) -> str: ...
def gate_and(input1: int, input2: int, output: int) -> str: return 'GATE {} AND {} {}'.format(output, input1, input2) def gate_or(input1: int, input2: int, output: int) -> str: return 'GATE {} OR {} {}'.format(output, input1, input2) def gate_not(input1: int, output: int) -> str: return 'GATE {} NOT {}'.f...
# Fill out these fields and rename this file to config.py to run. flask_key: str = "" # secret key used by flask flask_port: int = 5000 # port the run flask on (5000 for dev, 80 for prod) discord_client: str = "" # bot application client id - used for oauth2 discord_secret: str = "" # bot application client secre...
flask_key: str = '' flask_port: int = 5000 discord_client: str = '' discord_secret: str = '' discord_redirect: str = '' discord_webhook: str = '' bot_token: str = '' admin_role: str = '' guild_id: str = '' db_user: str = '' db_pass: str = '' db_host: str = '' db_port: str = '' db_name: str = ''
DEFAULT_CSV_SEPERATOR = "\t" DEFAULT_PRE_CHUNK_SIZE = 500 # end of string # EOS = '~'
default_csv_seperator = '\t' default_pre_chunk_size = 500
#Define a list of the Greek Alphabet for Latex greek_alph = ['alpha','beta','gamma','delta','epsilon', 'varepsilon','zeta','eta','theta','vartheta', 'iota','kappa','lambda','mu','nu','xi','pi', 'varpi','rho','varrho','sigma','varsigma', 'tau','upsilon','phi','varphi','chi','psi',...
greek_alph = ['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'varepsilon', 'zeta', 'eta', 'theta', 'vartheta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'pi', 'varpi', 'rho', 'varrho', 'sigma', 'varsigma', 'tau', 'upsilon', 'phi', 'varphi', 'chi', 'psi', 'omega', 'Gamma', 'Delta', 'Theta', 'Lambda', 'Xi', 'Pi', 'Sigm...
""" We also have to declare a method called __radd__. This happens because when we type [5, 3, 10, -2, 1] + u python try to call [5, 3, 10, -2, 1].__add__(u). But python list type doesn't know anything about how to add the Vector instance, so it tries to call the reverse add method __radd__ which is not yet defined. "...
""" We also have to declare a method called __radd__. This happens because when we type [5, 3, 10, -2, 1] + u python try to call [5, 3, 10, -2, 1].__add__(u). But python list type doesn't know anything about how to add the Vector instance, so it tries to call the reverse add method __radd__ which is not yet defined. "...
class InvalidStateError(Exception): def __init__(self, message = "The environment state received is not contained in the observation space."): self.message = message def __str__(self): return self.message class RobotServerError(Exception): def __init__(self, service): if service == ...
class Invalidstateerror(Exception): def __init__(self, message='The environment state received is not contained in the observation space.'): self.message = message def __str__(self): return self.message class Robotservererror(Exception): def __init__(self, service): if service ==...
class Solution: def XXX(self, x: int) -> bool: x=str(x) return True if x==x[::-1] else False
class Solution: def xxx(self, x: int) -> bool: x = str(x) return True if x == x[::-1] else False
############################ cost functin of epolar line ###################################### def epolar_cost_function(list_kp_4,list_kp_6,P4,P6, filtered_index_C4, filtered_index_C6): """calculate cost matrix epolar, consider n people altogether in one frame Call one function, namely, getEpolar, getTotaldist...
def epolar_cost_function(list_kp_4, list_kp_6, P4, P6, filtered_index_C4, filtered_index_C6): """calculate cost matrix epolar, consider n people altogether in one frame Call one function, namely, getEpolar, getTotaldistance Args: -list_kp_4 69*m key points from one image, format: x1, y1, score1, x2...
""" Created on Fri May 17 13:10:07 2019 @author: Bogdan """
""" Created on Fri May 17 13:10:07 2019 @author: Bogdan """
def fn(): x = [] if a % 2 == 1: return "bad" for i in range(len(b)): if b[i] == c[i]: return "bad" if b[i] < c[i]: x.append(b[i] + c[i]) else: x.append(c[i] + b[i]) for i in x: if x.count(i) != 2: return "bad" re...
def fn(): x = [] if a % 2 == 1: return 'bad' for i in range(len(b)): if b[i] == c[i]: return 'bad' if b[i] < c[i]: x.append(b[i] + c[i]) else: x.append(c[i] + b[i]) for i in x: if x.count(i) != 2: return 'bad' re...
# -*- coding: utf-8 -*- __author__ = 'Karl Palsson' __email__ = 'karlp@tweak.net.au' __version__ = '0.1.0'
__author__ = 'Karl Palsson' __email__ = 'karlp@tweak.net.au' __version__ = '0.1.0'
""" Mock Transports for use in testing and performan analysis.""" class FetchOnceMockTransport(object): """ A mock transport that will fetch the file specified at instantiation time and return that payload for all subsequent calls to get(). """ def __init__(self, transport, replay_file): self....
""" Mock Transports for use in testing and performan analysis.""" class Fetchoncemocktransport(object): """ A mock transport that will fetch the file specified at instantiation time and return that payload for all subsequent calls to get(). """ def __init__(self, transport, replay_file): self....
def Xmastree(): str = "*" strsp = "" for i in range(51): strsp += " " for i in range(100): print(strsp+str) str += "**" spaces = 50-(i) strsp = "" for i in range(spaces): strsp += " "
def xmastree(): str = '*' strsp = '' for i in range(51): strsp += ' ' for i in range(100): print(strsp + str) str += '**' spaces = 50 - i strsp = '' for i in range(spaces): strsp += ' '
ReLU [[0.0553801, 0.190198, -0.0377036, -1.32009, -0.704992], [-0.010481, -0.118571, 0.153946, -0.736114, -1.00878], [0.482564, 0.0565022, 0.0443098, 0.0600691, 0.0020876], [-0.0778212, -0.0577902, -0.153575, 0.0605465, 0.450204], [0.0143941, -0.25066, -0.132743, 0.533158, -0.0781143], [-0.00869665, -0.447464, -0.05171...
ReLU [[0.0553801, 0.190198, -0.0377036, -1.32009, -0.704992], [-0.010481, -0.118571, 0.153946, -0.736114, -1.00878], [0.482564, 0.0565022, 0.0443098, 0.0600691, 0.0020876], [-0.0778212, -0.0577902, -0.153575, 0.0605465, 0.450204], [0.0143941, -0.25066, -0.132743, 0.533158, -0.0781143], [-0.00869665, -0.447464, -0.05171...
# FIBONACCI """ 0 1 1 2 3 5 8 13 21 ... n terms """ a=0 b=1 n = int(input("Enter number of terms : ")) print(a) print(b) for i in range (0,n-2): s=a+b print(s) a=b b=s
""" 0 1 1 2 3 5 8 13 21 ... n terms """ a = 0 b = 1 n = int(input('Enter number of terms : ')) print(a) print(b) for i in range(0, n - 2): s = a + b print(s) a = b b = s
expected_output = { "bay": "0", "chassis": { 1: { "boot_hashes": { "17.9.0.3r": "CD187702DD2CB79BC1B8E62BF8EF596E9227F76254E19BE0F5A0AB9E9D9A3F1FF643FA1AE9354037355119E974B62903FBD045C152EB66C19412FA78FB13AE17", "MA0081R06.1307262016": "80F5629CB70F2B4ABD89F11...
expected_output = {'bay': '0', 'chassis': {1: {'boot_hashes': {'17.9.0.3r': 'CD187702DD2CB79BC1B8E62BF8EF596E9227F76254E19BE0F5A0AB9E9D9A3F1FF643FA1AE9354037355119E974B62903FBD045C152EB66C19412FA78FB13AE17', 'MA0081R06.1307262016': '80F5629CB70F2B4ABD89F118BF402A105E82E0A8A0AE5E7CD9E4D21F898CEFF5'}, 'os': {'hashes': {'...
# -*- coding: utf-8 -*- """ uru_crm.modules.frontend ~~~~~~~~~~~~~~~~~~~~~~~~ frontend management commands """
""" uru_crm.modules.frontend ~~~~~~~~~~~~~~~~~~~~~~~~ frontend management commands """
# Question 9 - Convert binary to decimal # Asmit De # 03/24/2017 # Enter binary binary = int(input('Enter binary number: ')) # Duplicate variable for modification b = binary # Initialize decimal decimal = 0 # Initialize bit position i = 0 # Set a valid flag isValid = True # Extract each bit and...
binary = int(input('Enter binary number: ')) b = binary decimal = 0 i = 0 is_valid = True while b > 0: bit = b % 10 if bit > 1: is_valid = False break decimal += 2 ** i * bit b //= 10 i += 1 if isValid == True: print('The decimal equivalent of', binary, 'is', decimal) else: p...
def B(): s = input() o_bracket = set() c_bracket = set() colon = set() for i in range(len(s)): if(s[i]=='['): o_bracket.add(i) if(s[i]==']'): c_bracket.add(i) if(len(o_bracket)*len(c_bracket)==0): print(-1) return l , r = min(o_bracket) , max(c_bracket) for i in range(l,r+1): if(s[i]==':'): colo...
def b(): s = input() o_bracket = set() c_bracket = set() colon = set() for i in range(len(s)): if s[i] == '[': o_bracket.add(i) if s[i] == ']': c_bracket.add(i) if len(o_bracket) * len(c_bracket) == 0: print(-1) return (l, r) = (min(o_b...
class Model: """ Base class for all machine learning models. """ def __repr__(self): """ Returns a pretty representation of the model. Note: DO NOT OVERRIDE THIS. You may override `extra_repr` instead. """ return '%s(%s)' % (self.__class__.__name__, s...
class Model: """ Base class for all machine learning models. """ def __repr__(self): """ Returns a pretty representation of the model. Note: DO NOT OVERRIDE THIS. You may override `extra_repr` instead. """ return '%s(%s)' % (self.__class__.__name__, ...
# MIT License # # Copyright (c) 2018 Herbert Shin # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
__all__ = ['SIP_BUSY'] sip_busy = {'status_line': 'SIP/%(sip_version)s 486 Busy Here', 'sip': ['Contact']} sip_busy_sample = 'SIP/2.0 486 Busy Here\n'
#q5.Write a program to check whether the entered year is leap year or not. year=int(input ("enter year: ")) if (year%4==0 or year%100==0 or year%400==0): print("its leap year.") else: print("its not leap year.")
year = int(input('enter year: ')) if year % 4 == 0 or year % 100 == 0 or year % 400 == 0: print('its leap year.') else: print('its not leap year.')
# -*- coding: utf-8 -*- extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx'] source_suffix = '.rst' master_doc = 'index' project = u'unleash' copyright = u'2015, Marc Brinkmann' version = '0.7.2' release = '0.7.2.dev1' exclude_patterns = ['_build'] pygments_style = 'sphinx' html_theme = 'alabaster' inters...
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx'] source_suffix = '.rst' master_doc = 'index' project = u'unleash' copyright = u'2015, Marc Brinkmann' version = '0.7.2' release = '0.7.2.dev1' exclude_patterns = ['_build'] pygments_style = 'sphinx' html_theme = 'alabaster' intersphinx_mapping = {'http://docs...
# Created by MechAviv # ID :: [865020001] # Commerci Republic : Canal 1 sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.setStandAloneMode(True) sm.forcedInput(2) sm.curNodeEventEnd(True)
sm.curNodeEventEnd(True) sm.setTemporarySkillSet(0) sm.setInGameDirectionMode(True, True, False, False) sm.setStandAloneMode(True) sm.forcedInput(2) sm.curNodeEventEnd(True)
def pedra_papel_tesoura(j1, j2): if j1 not in "pedrapapeltesoura": return "Escolha pedra, papel ou tesoura para jogar" if j2 not in "pedrapapeltesoura": return "Escolha pedra, papel ou tesoura para jogar" if j1 == "pedra" and j2 == "tesoura": return "um" elif j1 ...
def pedra_papel_tesoura(j1, j2): if j1 not in 'pedrapapeltesoura': return 'Escolha pedra, papel ou tesoura para jogar' if j2 not in 'pedrapapeltesoura': return 'Escolha pedra, papel ou tesoura para jogar' if j1 == 'pedra' and j2 == 'tesoura': return 'um' elif j1 == 'tesoura' and ...
def enlarge(n): """ param n is a number Fuction will enlarge tge number """ return n* 100 if __name__=="__main__": print(enlarge(5))
def enlarge(n): """ param n is a number Fuction will enlarge tge number """ return n * 100 if __name__ == '__main__': print(enlarge(5))
"""Functions with no external dependencies. These can be tested without actually installing (if we also avoid the C extension module). """
"""Functions with no external dependencies. These can be tested without actually installing (if we also avoid the C extension module). """
# variables that contain user credentials CONSUMER_KEY = "tMFjs33CpuKRq4MUqK3A87tPV" CONSUMER_SECRET = "x9sKeTeUvXPLhkqkHutQYZInpNVNCjxqmyrR4Ve8R4kRzNsaCL" ACCESS_TOKEN = "1005899876742377474-Fd44TJWSfTUiGBapM8YOtjah9Kv8Ef" ACCESS_TOKEN_SECRET = "dlkbbp3Ibc7nSH6f1tHZeopMCn4XKPANqYAahQgXgheot"
consumer_key = 'tMFjs33CpuKRq4MUqK3A87tPV' consumer_secret = 'x9sKeTeUvXPLhkqkHutQYZInpNVNCjxqmyrR4Ve8R4kRzNsaCL' access_token = '1005899876742377474-Fd44TJWSfTUiGBapM8YOtjah9Kv8Ef' access_token_secret = 'dlkbbp3Ibc7nSH6f1tHZeopMCn4XKPANqYAahQgXgheot'
def smooth_number_3(n): res = [0 for i in range(n)] res[0] = 1 p2, p3 = 0, 0 for i in range(1, n): if res[p2] * 2 == res[i - 1]: p2 += 1 if res[p3] * 3 == res[i - 1]: p3 += 1 u2 = res[p2] * 2 u3 = res[p3] * 3 if u2 < u3: ...
def smooth_number_3(n): res = [0 for i in range(n)] res[0] = 1 (p2, p3) = (0, 0) for i in range(1, n): if res[p2] * 2 == res[i - 1]: p2 += 1 if res[p3] * 3 == res[i - 1]: p3 += 1 u2 = res[p2] * 2 u3 = res[p3] * 3 if u2 < u3: p2 ...
class ActionSerializerMixin: """Mixin to allow per-action serializer.""" def get_serializer_class(self): if hasattr(self, "action_serializers"): return self.action_serializers.get(self.action, self.serializer_class) return super().get_serializer_class()
class Actionserializermixin: """Mixin to allow per-action serializer.""" def get_serializer_class(self): if hasattr(self, 'action_serializers'): return self.action_serializers.get(self.action, self.serializer_class) return super().get_serializer_class()
#Read source file try: f=open("Bereishis 1.txt", "r+", encoding="utf8") print(f.readline()) finally: f.close() #It works!
try: f = open('Bereishis 1.txt', 'r+', encoding='utf8') print(f.readline()) finally: f.close()
print("Name: Aderinsola Adebisi") print("Email: adebisiaderinsola@gmail.com") print("Slack username: @Aderinsola") print("Biostack: Drug Development") print("Twitter username: @Derinsolar") print("Hamming distance: 2")
print('Name: Aderinsola Adebisi') print('Email: adebisiaderinsola@gmail.com') print('Slack username: @Aderinsola') print('Biostack: Drug Development') print('Twitter username: @Derinsolar') print('Hamming distance: 2')
class NumberingSchemaType(GuidEnum): """ A type for identifying a Autodesk.Revit.DB.NumberingSchema of a particular kind. NumberingSchemaType(guid: Guid) """ @staticmethod def __new__(self,guid): """ __new__(cls: type,guid: Guid) """ pass
class Numberingschematype(GuidEnum): """ A type for identifying a Autodesk.Revit.DB.NumberingSchema of a particular kind. NumberingSchemaType(guid: Guid) """ @staticmethod def __new__(self, guid): """ __new__(cls: type,guid: Guid) """ pass
# Deklarasi semua type rumah dan harga rumah!! semuaTypeRumah = ['Rose', 'Gold', 'Platinum'] semuaHargaRumah = { semuaTypeRumah[0]: 120000000, semuaTypeRumah[1]: 300000000, semuaTypeRumah[2]: 360000000 } # Display input print(".------------------->") print("| 1. Rose\t120.000.000") print("| 2. Gold\t300.00...
semua_type_rumah = ['Rose', 'Gold', 'Platinum'] semua_harga_rumah = {semuaTypeRumah[0]: 120000000, semuaTypeRumah[1]: 300000000, semuaTypeRumah[2]: 360000000} print('.------------------->') print('| 1. Rose\t120.000.000') print('| 2. Gold\t300.000.000') print('| 3. Platinum\t360.000.000') print('`------------------->')...
# Radix sort in Python # Using counting sort to sort the elements in the basis of significant places def countingSort(array, place): size = len(array) output = [0] * size count = [0] * 10 # Calculate count of elements for i in range(0, size): index = array[i] // place count[index ...
def counting_sort(array, place): size = len(array) output = [0] * size count = [0] * 10 for i in range(0, size): index = array[i] // place count[index % 10] += 1 for i in range(1, 10): count[i] += count[i - 1] i = size - 1 while i >= 0: index = array[i] // pla...
# deftools.py -- contains functions related to reading and writing dataset # and pipeline definition files. def parse_stream(f): contents = f.read() lines = contents.splitlines() tokens = [] for l in lines: stripped = l.strip() if len(stripped)!=0: if strip...
def parse_stream(f): contents = f.read() lines = contents.splitlines() tokens = [] for l in lines: stripped = l.strip() if len(stripped) != 0: if stripped[len(stripped) - 1] == ':': tokens.append([stripped[:len(stripped) - 1]]) else: ...
def solve(): n = int(input()) binary = [2**i for i in range(30)] remaining = [10**9-i for i in range(n-30)] a = binary + remaining print(*a, flush=True) b = list(map(int, input().split())) x, y = [], [] judge = b + remaining for i in judge: if sum(x) >= sum(y): ...
def solve(): n = int(input()) binary = [2 ** i for i in range(30)] remaining = [10 ** 9 - i for i in range(n - 30)] a = binary + remaining print(*a, flush=True) b = list(map(int, input().split())) (x, y) = ([], []) judge = b + remaining for i in judge: if sum(x) >= sum(y): ...
### OLD VERSION ### # Set online input_select option_list from entity state, attribute or string # Must be entity of the input_select like 'input_select.sonos_favs' entity_inputselect = data.get('entity_id')[0] # A entity or string to make a list from # entity attribute: media_player.buro.source_list # entity state:...
entity_inputselect = data.get('entity_id')[0] entity_optionsstring = data.get('data_source') if entity_inputselect is None and entity_optionsstring is None: logger.warning('No data!') exit() current_selection = hass.states.get(entity_inputselect).state option_list = ['None'] if '.' not in entity_optionsstring: ...
# -*- coding: utf-8 -*- """ Created on Sun Dec 17 23:58:16 2017 @author: James Jiang """ def is_int(x): try: int(x) return True except ValueError: return False all_lines = [line.rstrip('\n') for line in open('Data.txt')] all_instructions = [] for line in all_lines: components = l...
""" Created on Sun Dec 17 23:58:16 2017 @author: James Jiang """ def is_int(x): try: int(x) return True except ValueError: return False all_lines = [line.rstrip('\n') for line in open('Data.txt')] all_instructions = [] for line in all_lines: components = line.split(' ') all_ins...
# # PySNMP MIB module CISCO-DOCS-REMOTE-QUERY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DOCS-REMOTE-QUERY-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:55:31 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python versio...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) ...
for _ in range(int(input())): x,n=map(int,input().split()) ans=0 if n%4==1: ans=-n if n%4==2: ans=1 if n%4==3: ans=n+1 if n%4==0: ans=0 if abs(x)%2==1: ans=-ans print(ans+x)
for _ in range(int(input())): (x, n) = map(int, input().split()) ans = 0 if n % 4 == 1: ans = -n if n % 4 == 2: ans = 1 if n % 4 == 3: ans = n + 1 if n % 4 == 0: ans = 0 if abs(x) % 2 == 1: ans = -ans print(ans + x)
def is_palindrome(number): n = str(number) if n.startswith('0'): return False return str(number) == str(number)[::-1] def to_binary(number): return bin(number).replace('0b', '') def main(number): palindromes = [] for n in range(1, number + 1): if is_palindrome(n): ...
def is_palindrome(number): n = str(number) if n.startswith('0'): return False return str(number) == str(number)[::-1] def to_binary(number): return bin(number).replace('0b', '') def main(number): palindromes = [] for n in range(1, number + 1): if is_palindrome(n): b...
class Node: def __init__(self): self.left = None self.right = None self.value = 0 def is_less_than_max(value, max_value): return value < max_value if max_value != -1 else True def is_bst(node, min_value, max_value): if node is None: return True if min_value < node.val...
class Node: def __init__(self): self.left = None self.right = None self.value = 0 def is_less_than_max(value, max_value): return value < max_value if max_value != -1 else True def is_bst(node, min_value, max_value): if node is None: return True if min_value < node.valu...
class model(): def __init__(self): print("Initialising model") def process(self, frame): raise NotImplementedError("Add this function")
class Model: def __init__(self): print('Initialising model') def process(self, frame): raise not_implemented_error('Add this function')
class GeneralizeStorageLocationException(Exception): pass class UninitializedStorageLocationException(Exception): pass
class Generalizestoragelocationexception(Exception): pass class Uninitializedstoragelocationexception(Exception): pass
mod = 1000000007 dp = [[0] * 6 for _ in range(1010)] n = int(input()) for i in range(1, n + 1): dp[i][0] = 1 dp[i][1] = (dp[i - 1][0] + dp[i - 1][1] * 2) % mod dp[i][2] = (dp[i - 1][0] + dp[i - 1][2]) % mod dp[i][3] = (dp[i - 1][1] + dp[i - 1][3] * 2) % mod dp[i][4] = (dp[i - 1][1] + d...
mod = 1000000007 dp = [[0] * 6 for _ in range(1010)] n = int(input()) for i in range(1, n + 1): dp[i][0] = 1 dp[i][1] = (dp[i - 1][0] + dp[i - 1][1] * 2) % mod dp[i][2] = (dp[i - 1][0] + dp[i - 1][2]) % mod dp[i][3] = (dp[i - 1][1] + dp[i - 1][3] * 2) % mod dp[i][4] = (dp[i - 1][1] + dp[i - 1][2] + ...
"""This problem was asked by Twitter. Given a string, sort it in decreasing order based on the frequency of characters. If there are multiple possible solutions, return any of them. For example, given the string tweet, return tteew. eettw would also be acceptable. """
"""This problem was asked by Twitter. Given a string, sort it in decreasing order based on the frequency of characters. If there are multiple possible solutions, return any of them. For example, given the string tweet, return tteew. eettw would also be acceptable. """