content stringlengths 7 1.05M |
|---|
# Copyright (c) 2004, The Long Now Foundation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list o... |
#! python3
# -*- coding: utf-8 -*-
"""
Euler description from https://projecteuler.net/
Problem 0002
Each new term in the Fibonacci sequence is generated by adding the previous two
terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibo... |
'''
Created on Mar 30, 2019
@author: PIKU
'''
def justSayHello():
print("Hello ...")
def getHello():
return "Hello guys"
if __name__ == '__main__':
justSayHello()
x = getHello()
print(x)
|
def formstash_to_querystring(formStash):
err = []
for (k, v) in formStash.errors.items():
err.append(("%s--%s" % (k, v)).replace("\n", "+").replace(" ", "+"))
err = sorted(err)
err = "---".join(err)
return err
class _UrlSafeException(Exception):
@property
def as_querystring(self):
... |
"""solution.py"""
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
"""
T: O(?)
S: O(?)
"""
l3 = ListNode(0)
... |
DATA_S3 = "bioanalyze-ec2-test-nf-rnaseq-06o3qdtm7v"
JOB_S3 = DATA_S3
# These come from the terraform code in auto-deployment/terraform
ECR = "dabbleofdevops/nextflow-rnaseq-tutorial"
COMPUTE_ENVIRONMENT = "bioanalyze-ec2-test-nf-rnaseq"
JOB_DEF_NAME = "bioanalyze-ec2-test-nf-rnaseq"
JOB_QUEUE_NAME = "bioanalyze-ec2-... |
# encoding: utf-8
# module _ctypes
# from /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so
# by generator 1.145
""" Create and manipulate C compatible data types in Python. """
# no imports
# Variables with simple values
FUNCFLAG_CDECL = 1
FUNCFLAG_PYTHONAPI = 4
FUNCFLAG_USE_ERRNO = 8
FUNCFLAG_... |
#!/usr/bin/env python3
class stressTestPV:
def __init__( self, pvName ):
self._pvName = pvName
self._tsValues = {} # Dict of collected values, keys are float timestamps
self._tsRates = {} # Dict of collection rates, keys are int secPastEpoch values
self._tsMissR... |
_base_ = ['./rotated-detection_static.py', '../_base_/backends/tensorrt.py']
onnx_config = dict(
output_names=['dets', 'labels'],
input_shape=None,
dynamic_axes={
'input': {
0: 'batch',
2: 'height',
3: 'width'
},
'dets': {
0: 'batch',
... |
#!/usr/bin/env python
class Solution:
def twoCitySchedCost(self, costs):
N = len(costs)//2
costs = list(sorted(costs, key=lambda c: c[0]-c[1]))
s = 0
for i, c in enumerate(costs):
s += c[0] if i < N else c[1]
return s
costs = [[10,20],[30,200],[400,50],[30,20]]
... |
def train_isolation_forest(df, padding_data):
'''
* Isolation Forest model setting
- n_estimators=100
- max_samples='auto'
- n_jobs=-1
- max_features=2
- contamination=0.01
'''
#padding한 data load
data_df = padding_data
# model 정의
model = IsolationForest(n_estimators=100... |
#Jónas Freyr Bjarnason
#25.01.2017
#Forritun
#Liður 1
#Byð notanda um tölu 1
tala1=int(input("Sláðu inn tölu 1 "))
#Byð notanda um tölu 2
tala2=int(input("Sláðu inn tölu 2 "))
#Birti tölu 1 og 2 lagðar saman
print("Tölurnar lagðar saman ",tala1+tala2)
#Birti tölu 1 og 2 margfaldaðar saman
print("Tölurnar margfaldaðar... |
pdu_objects = [
{
'header': {
'command_length': 0,
'command_id': 'bind_transmitter',
'command_status': 'ESME_ROK',
'sequence_number': 0,
},
'body': {
'mandatory_parameters': {
'system_id': 'test_system',
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*--
# Copyright (c) 2021, 2022 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
class Parser:
@property
def pos(self):
raise NotImplementedError()
@property
def no... |
class Template:
def __init__(self, data):
"""Class representing log templates.
Note:
Timestamps are represented in ISO format with timezone information.
e.g, 2021-10-07T13:18:09.178477+02:00.
"""
self._timestamp = data.get("@timestamp", None)
self.... |
def strategy(history, memory):
round = history.shape[1]
GRUDGE = 0
LASTACTION = 1
if round == 0:
mem = []
mem.append(False)
mem.append(0)
return "cooperate", mem
mem = memory
if mem[GRUDGE]:
return "defect", mem
if round >= 5:
sin = 0
f... |
test = [
'nop +0',
'acc +1',
'jmp +4',
'acc +3',
'jmp -3',
'acc -99',
'acc +1',
'jmp -4',
'acc +6',
]
actual = [
'acc +17',
'acc +37',
'acc -13',
'jmp +173',
'nop +100',
'acc -7',
'jmp +447',
'nop +283',
'acc +41',
'acc +32',
'jmp +1',... |
class Solution:
def generateMatrix(self, n):
matrix = []
num = 1
for i in range(n):
matrix.append([0 for i in range(n)])
top = 0
bottom = n - 1
left = 0
right = n - 1
while top <= bottom and left <= right:
for i in range(left, r... |
# classification related details
classification_datasets = ['imagenet', 'coco']
classification_schedulers = ['fixed', 'clr', 'hybrid', 'linear', 'poly']
classification_models = ['espnetv2', 'dicenet', 'shufflenetv2']
classification_exp_choices = ['main', 'ablation']
# segmentation related details
segmentation_schedule... |
# encoding: utf-8
# module win32profile
# from C:\Python27\lib\site-packages\win32\win32profile.pyd
# by generator 1.147
# no doc
# no imports
# Variables with simple values
PI_APPLYPOLICY = 2
PI_NOUI = 1
PT_MANDATORY = 4
PT_ROAMING = 2
PT_TEMPORARY = 1
# functions
def CreateEnvironmentBlock(*args, **kwargs): # re... |
def checkrot(str1,str2):
if len(str1)==len(str2):
str3=str1+str1
ad=str3.__contains__(str2)
if ad==True:
print("it is right rotate")
else:
print("It is not right rotate ")
else:
print("It is invalid string.Out of range")
def main():
str1=input(" Enter the first String : ")
str2=input("Enter the s... |
#
# This file is part of the Ingram Micro CloudBlue Connect EaaS Extension Runner.
#
# Copyright (c) 2021 Ingram Micro. All Rights Reserved.
#
class EaaSError(Exception):
pass
class MaintenanceError(EaaSError):
pass
class CommunicationError(EaaSError):
pass
class StopBackoffError(EaaSError):
pass
|
a=int(input('enter a:'))
b=int(input('enter b:'))
c=int(input('enter c:'))
min_value= a if a<b and a<c else b if b<c else c
print(min_value) |
#!/Usr/bin/env python
"""
Akash and Vishal are quite fond of travelling. They mostly travel by railways. They were travelling in a train one day and they got interested in the seating arrangement of their compartment. The compartment looked something like
So they got interested to know the seat number facing them ... |
class Animals:
def comer(self):
print("Comiendo")
def dormir(self):
print("Durmiendo")
class Perro:
def __init__(self, nombre):
self.nombre = nombre
def comer(self):
print("Comiendo")
def dormir(self):
print("Durmiendo")
def ladrar(self):
print("Ladrando")
print("----------------------... |
_base_ = [
'../_base_/models/resnet50.py', '../_base_/datasets/cancer_bs32_pil_resize.py',
'../_base_/schedules/imagenet_bs256_coslr.py', '../_base_/default_runtime.py'
]
model = dict(
head=dict(
num_classes=2,
topk=(1,))
)
data = dict(
train=dict(
data_prefix='/data3/zzhang/tmp... |
# Criar uma base de dados. O usuário pode adicionar, excluir e listar clientes (que possuem id e nome).
# *utilizar encapsulamento.
class Clientes:
def __init__(self):
self.__lista = {} # Recomenda-se estritamente não modificar essa variável
def adicionar_cliente(self, id, nome):
if 'cliente... |
# 264. Ugly Number II
#
# Write a program to check whether a given number is an ugly number.
#
# Ugly numbers are positive numbers whose prime factors only include
# 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it
# includes another prime factor 7.
#
# Note that 1 is typically treated as an ugly numbe... |
# -*- coding: utf-8 -*-
"""Top-level package for Shipfunk."""
__author__ = """Jaana Sarajärvi"""
__email__ = 'jaana.sarajarvi@vilkas.fi'
__version__ = '0.1.1'
|
'''for c in range(1, 10):
print(c)
print('FIM')'''
'''c = 1
while c < 10:
print(c)
c += 1
print('FIM')'''
'''n = 1
while n != 0: #flag ou condição de parada
n = int(input('Digite um valor: '))
print('FIM')'''
'''r = 'S'
while r == 'S':
n = int(input('Digite um valor: '))
r = str(input('Quer c... |
"""Base utility functions, that manipulate basic data structures, etc."""
###################################################################################################
###################################################################################################
def flatten(lst):
"""Flatten a list of l... |
""" Class description goes here. """
"""Package containing gRPC classes."""
__author__ = 'Enrico La Sala <enrico.lasala@bsc.es>'
__copyright__ = '2017 Barcelona Supercomputing Center (BSC-CNS)'
|
class CircularQueue:
"""
A circlular queue: a first-in-first-out data structure with a fixed buffer size.
"""
def __init__(self, size):
if type(size) is not int:
raise TypeError("Queue size must be a postive integer.")
if size <= 0:
raise ValueError("Queue size m... |
# -*- coding: utf-8 -*
# ALGG 03-01-2017 Creación de módulo jornada_teorica.
class JornadaTeorica(object):
def __init__(self, conn):
'''Constructor'''
# Conexión.
self.__conn = conn
def get_jt(self, centro_fisico_id = None, anno = None):
'''Devuelve: (... |
# -*- coding: utf-8 -*-
class IkazuchiError(Exception):
""" ikazuchi root exception """
pass
class TranslatorError(IkazuchiError):
""" ikazuchi translator exception """
pass
class NeedApiKeyError(TranslatorError): pass
|
XPAHS_CONSULT = {
'jobs_urls': '//div[contains(@class, "listResults")]//div[contains(@data-jobid, "")]//h2//a/@href',
'results': '//span[@class="description fc-light fs-body1"]//text()',
'pagination_indicator': '//a[contains(@class, "s-pagination--item")][last()]//span[contains(text(), "next")]',
'pagi... |
s = 0
cont = 0
for c in range(1, 501, 2):
if c % 3 == 0:
s = s + c
cont = cont + 1
print('A soma de todos os {} valores solicitados é {}'.format(cont, s))
|
"""
Author: bkc@data_analysis
Project: autoencoder_ng
Created: 7/29/20 10:51
Purpose: START SCRIPT FOR AUTOENCODER_NG PROJECT
"""
|
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-proxy-ssl-header
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-ssl-redirect
SECURE_SSL_REDIRECT = True
# https://docs.djangoproject.com/en/dev/ref/settings/#session-cookie-secure
SES... |
# The `Environment` class represents the dynamic environment of McCarthy's original Lisp. The creation of
# this class is actually an interesting story. As many of you probably know, [Paul Graham wrote a paper and
# code for McCarthy's original Lisp](http://www.paulgraham.com/rootsoflisp.html) and it was my first e... |
class Exercises:
def __init__(self, topic, course_name, judge_contest_link, problems):
self.topic = topic
self.course_name = course_name
self.judge_contest_link = judge_contest_link
self.problems = [*problems]
def get_info(self):
info = f'Exercises: {self.topic}\n' \
... |
input = """
% This is a synthetic example documenting a bug in an early version of DLV's
% backjumping algorithm.
% The abstract computation tree looks as follows (choice order should be fixed
% by disabling heuristics with -OH-):
%
% o
% a / \ -a
% / \_..._
% o \
% ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 6 17:38:00 2015
@author: dbwrigh3
"""
|
class Solution(object):
def maxSubArray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
Max = -float("inf")
currMax = -float("inf")
for num in nums:
currMax = max(num, num + currMax)
Max = max(Max, currMax)
retur... |
# =================================================
# SERVER CONFIGURATIONS
# =================================================
CLIENT_ID=''
CLIENT_SECRET=''
REDIRECT_URI='http://ROCKOPY/'
# =================================================
# SERVER CONFIGURATIONS
# =================================================
S... |
Val = int(input('Digite o valor que você quer sacar:'))
c50 = c20 = c10 = c1 = 0
if Val // 50 != 0:
c50 = Val // 50
Val = Val % 50
if Val // 20 != 0:
c20 = Val // 20
Val = Val % 20
if Val // 10 != 0:
c10 = Val // 10
Val = Val % 10
if Val // 1 != 0:
c1 = Val // 1
if c50 != 0:
print(f'{c50... |
"""
Bazel macros for defining proto libraries.
"""
load("@rules_proto//proto:defs.bzl", "proto_library")
# TODO(#4096): Remove this once it's no longer needed.
def oppia_proto_library(name, **kwargs):
"""
Defines a new proto library.
Note that the library is defined with a stripped import prefix which en... |
n = int(input('Insira um número e calcule sua raiz: '))
b = 2
while True:
p = (b + (n / b)) / 2
res = p ** 2
b = p
if abs(n - res) < 0.0001:
break
print(f'p = {p}')
print(f'p² = {res}')
|
allData = {'AK': {'Aleutians East': {'pop': 3141, 'tracts': 1},
'Aleutians West': {'pop': 5561, 'tracts': 2},
'Anchorage': {'pop': 291826, 'tracts': 55},
'Bethel': {'pop': 17013, 'tracts': 3},
'Bristol Bay': {'pop': 997, 'tracts': 1},
'Denali': {'pop': 1826, 'tracts': 1},
... |
#code https://practice.geeksforgeeks.org/problems/swap-and-maximize/0
for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
max = 0
for i in range(n//2):
max -= 2*arr[i]
max += 2*arr[n-i-1]
print(max) |
# coding: utf8
"""
Complete collection of stopwords for the Urdu language.
Maintainer: Ikram Ali(mrikram1989@gmail.com)
version = 2019.04.07
Source = https://github.com/urduhack/urdu-stopwords
"""
# Urdu Language Stop words list
STOP_WORDS = frozenset("""
آ آئی آئیں آئے آتا آتی آتے آس آنا آنی آنے آپ آیا ابھی از اس ا... |
def som(a, b):
"""Bereken de som van twee getallen. Als de som groter is dan nul return je de som.
Als de som kleiner is dan nul, dan return je nul.
Args:
a (int): het eerste getal
b (int): het tweede getal
"""
pass
assert som(1, 2) == 3
assert som(-1, -2) == -3
assert som(0, ... |
# for loops
# for letter in "Cihat Salik":
# print(letter)
friends = ["Hasan", "Mahmut", "Ali", "Veli"]
for friend in friends:
print(friend)
for index in range(3, 10):
print(index)
for index in range(len(friends)):
print(friends[index])
for index in range(5):
if index == 0:
print("Fi... |
"Used to reference the nested workspaces for examples in /WORKSPACE"
ALL_EXAMPLES = [
"angular",
"app",
"kotlin",
"nestjs",
"parcel",
"protocol_buffers",
"user_managed_deps",
"vendored_node",
"vendored_node_and_yarn",
"web_testing",
"webapp",
"worker",
]
|
class Workset(WorksetPreview,IDisposable):
""" Represents a workset in the document. """
@staticmethod
def Create(document,name):
"""
Create(document: Document,name: str) -> Workset
Creates a new workset.
document: The document in which the new instance is created.
name: The wo... |
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2016 Aarón Abraham Velasco Alvarez
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 rig... |
def decode_lines(lines_bytes, encoding: str):
if isinstance(lines_bytes[0], bytes):
lines_str = [line.decode(encoding) for line in lines_bytes]
elif isinstance(lines_bytes[0], str):
lines_str = lines_bytes
else:
raise TypeError(type(lines_bytes[0]))
return lines_str
|
# Fitness monday variables
morning_1 = "10:00"
morning_2 = "8:00"
afternoon_1 = "13:00"
afternoon_2 = "14:30"
afternoon_3 = "15:30"
afternoon_4 = "17:55"
evening_1 = "20:30"
evening_2 = "21:10"
date_announce = [1, 2, 3, 4, 5]
image_file_list = [
'Exercise_Three.png',
'Exercise_Two_2.png'
]
... |
#!/usr/bin/python3
# from time import time
# from math import sqrt
# with open("inp.txt", "r") as f:
# a, b = list(i for i in f.read().split())
a, b = input().split()
# print(a,b,c, type(a), type(int(a)))
a = int(a)
b = int(b)
# st = time()
# -----
s1 = a * (a - 1) // 2
cuoi = b - 2
dau = b - a
s2 = (dau + cuoi) *... |
n = int(input())
a = input().split()
a = [str(m) for m in a]
for i in a:
if i == "Y":
print("Four")
exit()
print("Three") |
""" Solve 2021 Day 1: Sonar Sweep Problem """
def solver_problem1(inputs):
""" Count the number of increasement from given list """
num_increased = 0
for i in range(1, len(inputs)):
if inputs[i] > inputs[i - 1]:
num_increased += 1
return num_increased
def solver_problem2(... |
"""
Card games exercise
"""
def get_rounds(number):
"""
:param number: int - current round number.
:return: list - current round and the two that follow.
"""
return [i + number for i in range(3)]
def concatenate_rounds(rounds_1, rounds_2):
"""
:param rounds_1: list - first rounds... |
# Copyright 2020 Thomas Rogers
# SPDX-License-Identifier: Apache-2.0
LOWER_LINK_TAG = 6
UPPER_LINK_TAG = 7
UPPER_WATER_TAG = 9
LOWER_WATER_TAG = 10
UPPER_STACK_TAG = 11
LOWER_STACK_TAG = 12
UPPER_GOO_TAG = 13
LOWER_GOO_TAG = 14
LOWER_LINK_TYPES = {LOWER_LINK_TAG, LOWER_WATER_TAG, LOWER_STACK_TAG, LOWER_GOO_TAG}
UP... |
def pattern(n):
res=""
for i in range(n,0,-1):
for j in range(i):
res+=str(n-j)
res+="\n"
return res[:-1] |
def generated_file_staleness_test(name, outs, generated_pattern):
"""Tests that checked-in file(s) match the contents of generated file(s).
The resulting test will verify that all output files exist and have the
correct contents. If the test fails, it can be invoked with --fix to
bring the checked-in... |
"""Package list handling"""
load(":private/set.bzl", "set")
def pkg_info_to_ghc_args(pkg_info):
"""
Takes the package info collected by `ghc_info()` and returns the actual
list of command line arguments that should be passed to GHC.
"""
args = [
# In compile.bzl, we pass this just before a... |
# Beispielprogramm für das Buch "Python Challenge"
#
# Copyright 2020 by Michael Inden
def solve_water_jugs(size1, size2, desired_liters):
return __solve_water_jugs_rec(size1, size2,
desired_liters, 0, 0, {})
def __solve_water_jugs_rec(size1, size2, desired_liters,
... |
"""
Escreva um programa que converta uma temperatura,
digitando em graus Celsius e converta para graus Fahrenheit.
"""
celsius = int(input('Digite a temperatura: '))
fahrenheit = (celsius / 5) * 9 + 32
Kelvin = celsius + 273
print(f'A temperatura {celsius}°C em Fahrenheit é {fahrenheit}°F')
print(f'E em Kevin fica {Kel... |
# Copyright (c) 2016 SwiftStack, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
class call_if(object):
def __init__(self, cond):
self.condition = cond
def __call__(self, func):
def inner(*args, **kwargs):
if getattr(args[0], self.condition):
return func(*args, **kwargs)
else:
return None
return inner |
""" This is a test file used for testing the pytest plugin. """
def test_function_passed(snapshot):
""" The snapshot for this function is expected to exist. """
snapshot.assert_match(3 + 4j)
def test_function_new(snapshot):
""" The snapshot for this function is expected to exist, but only one assertion ... |
# -*- coding: utf-8 -*-
#
# -----------------------------------------------------------------------------------
# Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softw... |
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
def length(head) -> int:
"""
The method length, which accepts a linked list
(head), and returns the length of the list.
:param head:
:return:
"""
i = 0
if head is Non... |
#MenuTitle: Generate lowercase from uppercase
"""
Generate lowercase a-z from uppercase A-Z
TODO (M Foley) Generate all lowercase glyphs, not just a-z
"""
font = Glyphs.font
glyphs = list('abcdefghijklmnopqrstuvwxyz')
masters = font.masters
for glyph_name in glyphs:
glyph = GSGlyph(glyph_name)
glyph.updateGl... |
def multiple(first,second):
return first * second
def add(x,y):
return x+y
|
"""Top-level package for gtf2bed."""
__author__ = """João Vitor F. Cavalcante"""
__email__ = "jvfecav@gmail.com"
__version__ = "0.1.0"
|
# Copyright 2020 BlueCat Networks. All rights reserved.
# -*- coding: utf-8 -*-
type = 'ui'
sub_pages = [
{
'name' : 'get_audit_info_page',
'title' : u'Get Audit Info',
'endpoint' : 'get_audit_info/get_audit_info_endpoint',
'description' : u'get_audit_info'
},
]
|
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2016 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
def cat_arrays(vector_arrays):
"""Return a new |VectorArray| which a concatenation of the arr... |
template = """<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/milligram/1.3.0/milligram.min.css">
<style>
.tradingvi... |
a = str(input('Enter the number you want to reverse:'))
b = (a[::-1])
c = int(b)
print('the reversed number is',c)
|
class Solution:
def minPathSum(self, grid: List[List[int]]) -> int:
"""
[1,3,1]
[1,5,1]
[4,2,1]
time O (nm)
space O(nm)
state -> sums[r][c] = min path sum till r, c position
initial state -> sums[0][0…cols] = inf
-> sums... |
class BaseHandler:
def send(self, data, p):
pass
def recv(self, data, p):
pass
def shutdown(self, p, direction=2):
pass
def close(self):
pass
|
enru=open('en-ru.txt','r')
input=open('input.txt','r')
output=open('output.txt','w')
s=enru.read()
x=''
prov={'q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m'}
slovar={}
s=s.replace('\t-\t',' ')
while len(s)>0:
slovar[s[:s.index(' ')]]=s[s.index(' '):s.index('\... |
def conv(x):
return int(''.join(t[c] for c in x))
b = input().split()
N = int(input())
a = [input() for _ in range(N)]
t = {b[i]: str(i) for i in range(10)}
a.sort(key = lambda x: conv(x))
print(*a, sep='\n')
|
IS_TEST = True
REPOSITORY = 'cms-sw/cmssw'
def get_repo_url():
return 'https://github.com/' + REPOSITORY + '/'
CERN_SSO_CERT_FILE = 'private/cert.pem'
CERN_SSO_KEY_FILE = 'private/cert.key'
CERN_SSO_COOKIES_LOCATION = 'private/'
TWIKI_CONTACTS_URL = 'https://ppdcontacts.web.cern.ch/PPDContacts/ppd_contacts'
TWI... |
"""
59.40%
其实是大数相加
"""
class Solution(object):
def addStrings(self, num1, num2):
"""
:type num1: str
:type num2: str
:rtype: str
"""
num1_index = len(num1) - 1
num2_index = len(num2) - 1
if num1_index < 0:
return num2
if num2_inde... |
'''
nome = input('Insira seu nome: ')
if nome == 'Mendes':
print('Que nome lindo você tem!')
else:
print('Seu nome é tão normal!')
print('Bom dia {}!'.format(nome))
'''
#DESAFIO_28
'''
from random import randint
from time import sleep
x = randint(0,5)
y = int(input('Digite um número de 0 à 5: '))
print('Loading... |
class LeapYearFinder(object):
def __init__(self):
pass
def findLeapYear(self, startYear, endYear):
leapYearRecord = []
for i in range(int(startYear),int(endYear)):
year = i
print(year,end = "\t")
#If year is divisible by 4... |
# check to strings that represent version numbers and finds the greatest,
# 'equals' if they are the same version or 'Invalid Format'
# example: “1.2” is greater than “1.1”.
# for reusability this function just returns the version number or the word equals
# if a more elaborated answer is needed an interface would be... |
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'leftIMPLIESSIMPLIESleftANDORleftRPARENLPARENrightNEGATIONALPHABET AND IMPLIES LPAREN NEGATION OR PREDICATE RPAREN SIMPLIESexpr : expr AND exprexpr : ALPHABETexpr : expr... |
def find_paths(start, connections, visited=None, small_cave_visited_twice=False):
if visited is None:
visited = ["start"]
possible_connections = [e for s, e in connections if s == start] + [s for s, e in connections if e == start]
paths = []
if not possible_connections:
raise ValueErro... |
"""An unofficial Python wrapper for the Binance exchange API v3
.. moduleauthor:: Sam McHardy
.. modified by Stephan Avenwedde for Pythonic
"""
|
class Tree:
def __init__(self, val,left = None, right = None):
self.val = val
self.left = left
self.right = right
root = Tree(4, left = Tree(3), right=Tree(5, left= Tree(4)))
#InOrderTraversal
def InOrderTraversal(root, res = []):
if root is None:
return res
... |
def groups_for_user(environ, user):
if user == 'feng':
return ['secret-agents']
return ['']
|
SOLIDITY_TO_BQ_TYPES = {
'address': 'STRING',
}
table_description = ''
def abi_to_table_definitions_for_solana(
abi,
dataset_name,
contract_name,
contract_address=None,
include_functions=False
):
result = {}
for a in abi.get('events') if abi.get('events') else []:
... |
"""Metadata presets for commonly used keywords."""
presets = {
chest : {"Anatomical Region":
{"ID": "0001443",
"Name": "chest",
"Ontology Acronym": "UBERON",
"Ontology Name": "Uber Anatomy Ontology",
"Resource URL":
"http://pur... |
class Solution:
def validPalindrome(self, s):
"""
:type s: str
:rtype: bool
"""
left = 0
right = len(s)-1
while left < right:
if s[left] != s[right]:
return self.isPalindrome(s, left, right-1) or self.isPalindrome(s, left+1, right)... |
roman_dict = {
"I" : 1,
"V" : 5,
"X" : 10,
"L" : 50,
"C" : 100,
"D" : 500,
"M" : 1000
}
class Solution:
def romanToInt(self, s: str) -> int:
previous = 0
current = 0
result = 0
for x in s[::-1]:
current = roman_dict[x]
if (previous > current):
... |
# Usage: execute
# $ python support/generate.py
# at wpt/upgrade-insecure-requests/.
#
# Note: Some tests (link-upgrade.sub.https.html and
# websocket-upgrade.https.html) are not covered by this generator script.
template = '''<!DOCTYPE html>
<html>
<head>
<!-- Generated by wpt/upgrade-insecure-requests/support/genera... |
file_forgot_password = ["""<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<style type="text/css">... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.