index int64 0 100k | blob_id stringlengths 40 40 | code stringlengths 7 7.27M | steps listlengths 1 1.25k | error bool 2
classes |
|---|---|---|---|---|
8,400 | 829910af55ca84838537a2e1fa697713c7a6c6ca | # This program just for testing push from Mac.
def subset2(num):
mid_result = []
result = []
subset2_helper(num, mid_result, result, 0)
print(result)
def subset2_helper(num, mid_result, result, position):
result.append(mid_result[:])
for i in range(position, len(num)):
mid_result.append... | [
"# This program just for testing push from Mac.\ndef subset2(num):\n mid_result = []\n result = []\n subset2_helper(num, mid_result, result, 0)\n print(result)\n\ndef subset2_helper(num, mid_result, result, position):\n result.append(mid_result[:])\n for i in range(position, len(num)):\n mi... | false |
8,401 | 98b27c268fe1f47a899269e988ddf798faf827df | #part-handler
# vi: syntax=python ts=4
#
# Copyright (C) 2012 Silpion IT-Solutions GmbH
#
# Author: Malte Stretz <stretz@silpion.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by the Free Softwa... | [
"#part-handler\n# vi: syntax=python ts=4\n#\n# Copyright (C) 2012 Silpion IT-Solutions GmbH\n#\n# Author: Malte Stretz <stretz@silpion.de>\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License version 3, as\n# published by t... | false |
8,402 | 321dc411b003949a6744216a13c59c70d919a675 | #@@range_begin(list1) # ←この行は無視してください。本文に引用するためのものです。
#ファイル名 Chapter07/0703person.py
# __metaclass__ = type #← python 2を使っている場合は行頭の「#」を取る
class Person:
def set_name(self, name):
self.name = name
def get_name(self):
return self.name
def greet(self): # あいさつをする
print(f"こんにちは。私は{self... | [
"#@@range_begin(list1) # ←この行は無視してください。本文に引用するためのものです。\n#ファイル名 Chapter07/0703person.py\n# __metaclass__ = type #← python 2を使っている場合は行頭の「#」を取る\nclass Person:\n def set_name(self, name):\n self.name = name\n def get_name(self):\n return self.name\n def greet(self): # あいさつをする\n print(f... | false |
8,403 | c1fd6e940b3b15ae01a102b3c0aba9bd327c77b2 | import numpy as np
def layer_forward(x, w):
"""
input:
- inputs (x): (N, d_1, ..., d_k),
- weights (w): (D, M)
"""
# intermediate value (z)
z = None
output = []
cache = (x, w, z, output)
return output, cache
def layer_backward(d_output, cache):
""" Re... | [
"import numpy as np\n\n\ndef layer_forward(x, w):\n \"\"\"\n input:\n - inputs (x): (N, d_1, ..., d_k),\n - weights (w): (D, M)\n \"\"\"\n # intermediate value (z)\n z = None\n output = []\n cache = (x, w, z, output)\n\n return output, cache\n\n\ndef layer_backward(... | false |
8,404 | 3d1f7794763b058cc22c543709a97cb021d0fd23 | import pygame
pygame.init()
class Tiles:
Size = 32
Blocked = []
Blocked_Types = ["5", "6", "7", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "25", "27", "28", "29"]
def Blocked_At(pos):
if list(pos) in Tiles.Blocked:
return True
else:
... | [
"import pygame\n\npygame.init()\n\n\n\nclass Tiles:\n Size = 32\n Blocked = []\n Blocked_Types = [\"5\", \"6\", \"7\", \"9\", \"10\", \"11\", \"12\", \"13\", \"14\", \"15\", \"16\", \"17\", \"18\", \"19\", \"20\", \"25\", \"27\", \"28\", \"29\"]\n\n def Blocked_At(pos):\n if list(pos) in Tiles.Bl... | false |
8,405 | db8c2f6f5da0b52c268634043e1132984f610eed | import MySQLdb
import MySQLdb.cursors
from flask import _app_ctx_stack, current_app
class MySQL(object):
def __init__(self, app=None):
self.app = app
if app is not None:
self.init_app(app)
def init_app(self, app):
"""Initialize the `app` for use with this
:class:`... | [
"import MySQLdb\nimport MySQLdb.cursors\nfrom flask import _app_ctx_stack, current_app\n\n\nclass MySQL(object):\n\n def __init__(self, app=None):\n self.app = app\n if app is not None:\n self.init_app(app)\n\n def init_app(self, app):\n \"\"\"Initialize the `app` for use with ... | false |
8,406 | e3e50df47ef074f13382e249832c065ebdce18a6 | a = []
for i in range((2 * int(input()))):
a.append(int(input()))
if 1 in a:
c = a.index(max(a))
if a[c + 1] == 1:
print(c)
else:
del a[c]
s = a.index(max(a))
if a[s + 1] == 1:
print(s)
else:
print('-1')
| [
"a = []\nfor i in range((2 * int(input()))):\n a.append(int(input()))\nif 1 in a:\n c = a.index(max(a))\n if a[c + 1] == 1:\n print(c)\n else:\n del a[c]\n s = a.index(max(a))\n if a[s + 1] == 1:\n print(s)\nelse:\n print('-1')\n",
"a = []\nfor i in range(2 * ... | false |
8,407 | 14971842092c7aa41477f28cec87628a73a8ffd6 | from urllib.request import urlopen
from bs4 import BeautifulSoup
import json
def get_webcasts(year):
url = "https://www.sans.org/webcasts/archive/" + str(year)
page = urlopen(url)
soup = BeautifulSoup(page, 'html.parser')
table = soup.find('table', {"class": "table table-bordered table-striped"})
... | [
"from urllib.request import urlopen\nfrom bs4 import BeautifulSoup\nimport json\n\ndef get_webcasts(year):\n url = \"https://www.sans.org/webcasts/archive/\" + str(year)\n page = urlopen(url)\n soup = BeautifulSoup(page, 'html.parser')\n table = soup.find('table', {\"class\": \"table table-bordered tabl... | false |
8,408 | 2809ed3a5ea1e527609e169bca1440e0db2761b9 | import time
import pytest
from pytest_bdd import scenarios, given, when, then
from conf import Constants
from page_components.page import PageComponent
from page_components.overall import OverallPage
# Scenarios
scenarios('overall_rating.feature', features_base_dir=Constants.FEATURE_FILES_BASE_DIR)
# Fixtures
... | [
"import time\nimport pytest\n\nfrom pytest_bdd import scenarios, given, when, then\n\nfrom conf import Constants\n\nfrom page_components.page import PageComponent\nfrom page_components.overall import OverallPage\n\n\n\n\n# Scenarios\n\nscenarios('overall_rating.feature', features_base_dir=Constants.FEATURE_FILES_BA... | false |
8,409 | a3bcd383656284a2236e79b5d5d7acdfe433a13b | # list audio files
import glob
def listFiles(path):
return glob.glob(path + '*.wav')
import random
def getNextFile(files):
return random.choice(files)
import pyaudio
import wave
CHUNK = 1024
def getRandomFile(folder = 'test/'):
files = listFiles(folder)
filename = getNextFile(files)
return filename
def pl... | [
"# list audio files\nimport glob\ndef listFiles(path):\n return glob.glob(path + '*.wav')\n\nimport random\ndef getNextFile(files):\n return random.choice(files)\n\nimport pyaudio\nimport wave\nCHUNK = 1024\n\ndef getRandomFile(folder = 'test/'):\n files = listFiles(folder)\n filename = getNextFile(files)\n re... | false |
8,410 | 26bb5dc2679a4375d0950667ed02369df10857a8 | import numpy as np
from django.contrib.auth import logout, login, authenticate
from django.contrib.auth.decorators import login_required
from django.core.mail import EmailMessage
from django.shortcuts import render, redirect
from django.template.loader import get_template
from dashboard.notebook.creditcard import cred... | [
"import numpy as np\nfrom django.contrib.auth import logout, login, authenticate\nfrom django.contrib.auth.decorators import login_required\nfrom django.core.mail import EmailMessage\nfrom django.shortcuts import render, redirect\nfrom django.template.loader import get_template\n\nfrom dashboard.notebook.creditcard... | false |
8,411 | d1ed43bab6171c876b2ad9ef9db834ab8f9026d5 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from trest.utils import utime
from trest.logger import SysLogger
from trest.config import settings
from trest.exception import JsonError
from applications.common.models.user import User
class UserService(object):
@staticmethod
def page_list(where, page, per_page):... | [
"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom trest.utils import utime\nfrom trest.logger import SysLogger\nfrom trest.config import settings\nfrom trest.exception import JsonError\nfrom applications.common.models.user import User\n\n\nclass UserService(object):\n @staticmethod\n def page_list(where, ... | false |
8,412 | 4cbb78234ef6e63b856099060ecaeea1779d6ac5 | # -*- coding: utf-8 -*-
# Copyright (c) 2018, masonarmani38@gmail.com and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class LogisticsPlanningTool(Document):
def autoname(self):
if self.cust... | [
"# -*- coding: utf-8 -*-\n# Copyright (c) 2018, masonarmani38@gmail.com and contributors\n# For license information, please see license.txt\n\nfrom __future__ import unicode_literals\nimport frappe\nfrom frappe.model.document import Document\n\n\nclass LogisticsPlanningTool(Document):\n def autoname(self):\n ... | false |
8,413 | fe581ca8176fed01309f0d852f72564863aa0895 | import json
from aioredis import Redis
from aiologger.loggers.json import ExtendedLogRecord
from aiologger.handlers.base import Handler
from app.core import config
class RedisHandler(Handler):
def __init__(
self,
redis_client,
key=f"{config.APP_NAME}-log",
*args,
**kwargs... | [
"import json\n\nfrom aioredis import Redis\nfrom aiologger.loggers.json import ExtendedLogRecord\nfrom aiologger.handlers.base import Handler\n\nfrom app.core import config\n\n\nclass RedisHandler(Handler):\n def __init__(\n self,\n redis_client,\n key=f\"{config.APP_NAME}-log\",\n *a... | false |
8,414 | 6b4af452778bdf13ac18e8d260cf1c9176ca95e0 | __author__ = 'Vicio'
from Conexion.conexion import Conexion
class ConexionList():
def __init__(self):
self.conexion = Conexion()
def selectClientes(self):
pass
def selectProveedores(self):
pass
| [
"__author__ = 'Vicio'\nfrom Conexion.conexion import Conexion\n\n\nclass ConexionList():\n\n def __init__(self):\n self.conexion = Conexion()\n\n\n\n def selectClientes(self):\n pass\n\n\n def selectProveedores(self):\n pass\n\n\n\n\n\n",
"__author__ = 'Vicio'\nfrom Conexion.conexion... | false |
8,415 | 5fd54de3b2f9c2e18a283d016fc16e0e622dc6a0 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 20 09:54:08 2017
@author: chuang
"""
import os
import pickle
#from collections import Counter
#import user_replace
import jieba
import re
from multiprocessing import Pool
#%%
# parameters for processing the dataset
DATA_PATH = '../data/weibo_single... | [
"# -*- coding: utf-8 -*-\r\n\"\"\"\r\nCreated on Wed Dec 20 09:54:08 2017\r\n\r\n@author: chuang\r\n\"\"\"\r\n\r\nimport os \r\nimport pickle \r\n#from collections import Counter\r\n#import user_replace\r\nimport jieba\r\nimport re\r\nfrom multiprocessing import Pool \r\n\r\n#%%\r\n\r\n# parameters for processing t... | false |
8,416 | a8df6b575afbf6db415e0676a796623f2a9b7a70 | import unittest
from app.party import Party
from app.guest import Guest
from app.shoppingList import ShoppingList
def test_aPartywithNoGuestsShouldHaveNoPartyGuests():
party = Party()
assert 0 == party.numberOfGuests()
def test_aPartywithOneGuestShouldHaveOnePartyGuest():
party = Party()
lisa = Guest("Lisa", 'fe... | [
"import unittest\nfrom app.party import Party\nfrom app.guest import Guest\nfrom app.shoppingList import ShoppingList\n\ndef test_aPartywithNoGuestsShouldHaveNoPartyGuests():\n\tparty = Party()\n\tassert 0 == party.numberOfGuests()\n\n\ndef test_aPartywithOneGuestShouldHaveOnePartyGuest():\n\tparty = Party()\n\tlis... | false |
8,417 | 83c3193ea40c9328d16fb91774762a76352d8e09 | import dash_html_components as html
import dash_core_components as dcc
layout = html.Div([
html.Div([
html.Div([
html.H6('Répartition des biens'),
dcc.Graph(
id = "pieGraph",
figure = {
"data": [{
"values"... | [
"import dash_html_components as html\nimport dash_core_components as dcc\n\n\n\nlayout = html.Div([\n html.Div([\n html.Div([\n html.H6('Répartition des biens'),\n dcc.Graph(\n id = \"pieGraph\",\n figure = {\n \"data\": [{\n ... | false |
8,418 | c945dc4df68fe110e8b38713fb77e2dce9efad8d | # vim: set et ts=4 sw=4 fileencoding=utf-8:
'''
tests.integration.test_pipeline
===============================
'''
import unittest
import yaml
import subprocess
import time
import pickle
from datetime import datetime
from amqp.exceptions import ChannelError
from yalp.config import settings
@unittest.skip('need to... | [
"# vim: set et ts=4 sw=4 fileencoding=utf-8:\n'''\ntests.integration.test_pipeline\n===============================\n'''\nimport unittest\n\nimport yaml\nimport subprocess\nimport time\nimport pickle\nfrom datetime import datetime\n\nfrom amqp.exceptions import ChannelError\n\nfrom yalp.config import settings\n\n\n... | false |
8,419 | 301a6ec56bd265ff63a924ecd64d6708cb6b139c | import random
import profile_handler
import re
class RollBot():
"""A class that handles the bulk of functionality"""
def __init__(self):
"""initializes the attributes of the class"""
# this is where the procesed user input gets stored for easy readbacks
self.input_last_roll = ''
... | [
"import random\nimport profile_handler\nimport re\n\n\nclass RollBot():\n \"\"\"A class that handles the bulk of functionality\"\"\"\n\n def __init__(self):\n \"\"\"initializes the attributes of the class\"\"\"\n # this is where the procesed user input gets stored for easy readbacks\n sel... | false |
8,420 | a14a6c015ed3063015973b5376a1351a70808dc0 | casosteste = int(input())
for testes in range(casosteste):
num_instru = int(input())
lista = []
for intru in range(num_instru):
p = input().upper()
if p == 'LEFT':
lista.append(-1)
elif p == 'RIGHT':
lista.append(+1)
elif p.startswith('SAME AS'):
... | [
"casosteste = int(input())\n\nfor testes in range(casosteste):\n num_instru = int(input())\n lista = []\n for intru in range(num_instru):\n p = input().upper()\n if p == 'LEFT':\n lista.append(-1)\n elif p == 'RIGHT':\n lista.append(+1)\n elif p.startswith(... | false |
8,421 | 6eb8172e7e26ad6ec9cb0d30c5a0613ce79296e6 | import pickle
import saveClass as sc
import libcell as lb
import numpy as np
import struct
import os
# def save_Ldend(Ldends, bfname):
# # create a binary file
# bfname='Dend_length.bin'
# binfile = file(bfname, 'wb')
# # and write out two integers with the row and column dimension
# header = struc... | [
"import pickle\nimport saveClass as sc\nimport libcell as lb\nimport numpy as np\nimport struct\nimport os\n\n# def save_Ldend(Ldends, bfname):\n# # create a binary file\n# bfname='Dend_length.bin'\n# binfile = file(bfname, 'wb')\n# # and write out two integers with the row and column dimension\n# ... | false |
8,422 | deb0cd745eae97a6dbabdfab37e1c6d75e5372f0 | import numpy
from math import cos, sin, radians, tan
class Window:
# construtor
def __init__(self, world, xyw_min=None, xyw_max=None):
self.world = world
# caso em q é None
if xyw_min is None or xyw_max is None:
self.xyw_min = (-100, -100)
self.xyw_max = (100, 10... | [
"import numpy\nfrom math import cos, sin, radians, tan\n\nclass Window:\n # construtor\n def __init__(self, world, xyw_min=None, xyw_max=None):\n self.world = world\n # caso em q é None\n if xyw_min is None or xyw_max is None:\n self.xyw_min = (-100, -100)\n self.xyw... | false |
8,423 | dbea2b1555368460b7d14369d2dfe4f0a01f9e4f | # Generated by Django 3.1.6 on 2021-04-03 20:16
import django.contrib.postgres.fields
from django.db import migrations, models
import enrolments.validators
class Migration(migrations.Migration):
dependencies = [
("enrolments", "0007_merge_20210320_1853"),
]
operations = [
migrations.Add... | [
"# Generated by Django 3.1.6 on 2021-04-03 20:16\n\nimport django.contrib.postgres.fields\nfrom django.db import migrations, models\nimport enrolments.validators\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n (\"enrolments\", \"0007_merge_20210320_1853\"),\n ]\n\n operations = [\... | false |
8,424 | de3a96d46b7eaf198b33efe78b21ef0207dcc609 | from .base import Sort
| [
"from .base import Sort\n",
"<import token>\n"
] | false |
8,425 | 5119b1b6817e002c870b4d6a19fe9aee661fff7e | import unittest
from unflatten import _path_tuples_with_values_to_dict_tree, dot_colon_join, dot_colon_split
from unflatten import _recognize_lists
from unflatten import _tree_to_path_tuples_with_values
from unflatten import brackets_join
from unflatten import flatten
from unflatten import unflatten
class BracketsRe... | [
"import unittest\n\nfrom unflatten import _path_tuples_with_values_to_dict_tree, dot_colon_join, dot_colon_split\nfrom unflatten import _recognize_lists\nfrom unflatten import _tree_to_path_tuples_with_values\nfrom unflatten import brackets_join\nfrom unflatten import flatten\nfrom unflatten import unflatten\n\n\nc... | false |
8,426 | 542602a42eb873508ce2ec39d0856f10cc1e04ff | '''
Created on 2021. 4. 8.
@author: user
'''
import matplotlib.pyplot as plt
import numpy as np
plt.rc("font", family="Malgun Gothic")
def scoreBarChart(names, score):
plt.bar(names, score)
plt.show()
def multiBarChart(names, score):
plt.plot(names, score, "ro--")
plt.plot([1, 2, 3], [70, 8... | [
"'''\nCreated on 2021. 4. 8.\n\n@author: user\n'''\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nplt.rc(\"font\", family=\"Malgun Gothic\")\n\ndef scoreBarChart(names, score):\n plt.bar(names, score)\n plt.show()\n \ndef multiBarChart(names, score):\n plt.plot(names, score, \"ro--\")\n \n ... | false |
8,427 | 3065c87f79433e9fbbd2ff45c2915dfd5b1fa7cc | # 玩家(攻击力)攻击敌人(血量)敌人受伤(减血)可能死亡(播放动画)
# 敌人攻击玩家 玩家受伤(减血 碎屏) 可能死亡(游戏结束)
# class Player:
# def __init__(self,name,hp,atk):
# self.name = name
# self.hp = hp
# self.atk = atk
#
# @property
# def hp(self):
# return self.__hp
# @hp.setter
# def hp(self,value):
# if 0... | [
"# 玩家(攻击力)攻击敌人(血量)敌人受伤(减血)可能死亡(播放动画)\n# 敌人攻击玩家 玩家受伤(减血 碎屏) 可能死亡(游戏结束)\n\n# class Player:\n# def __init__(self,name,hp,atk):\n# self.name = name\n# self.hp = hp\n# self.atk = atk\n#\n# @property\n# def hp(self):\n# return self.__hp\n# @hp.setter\n# def hp(self,valu... | false |
8,428 | f3dad6a474d5882beaac7d98f8f60c347730ee55 | #!/usr/bin/env python3
import argparse
import logging
import tango
def delete_devices():
"""."""
db = tango.Database()
class_list = db.get_class_list('*')
print('class list = ', class_list)
server_list = db.get_server_list('*')
print('server list = ', server_list)
# for index in range(nu... | [
"#!/usr/bin/env python3\nimport argparse\nimport logging\n\nimport tango\n\n\ndef delete_devices():\n \"\"\".\"\"\"\n db = tango.Database()\n class_list = db.get_class_list('*')\n print('class list = ', class_list)\n server_list = db.get_server_list('*')\n print('server list = ', server_list)\n\n ... | false |
8,429 | 7ac15f422ca2cd0d30e936b7dd17c96e1f3abff0 | """
Carl Bunge
Washington State University
June 2018
Adapted from @author: Luka Denies from TU Delft.
Changelog:
11/2017 - Integration of CoolProp
06/2018 - Update to OpenFOAM-5.x (Mass-based thermodynamics (for example: cpMcv to CpMCv))
03/2019 - Update to include parahydrogen properties from Refprop
"""
import Co... | [
"\"\"\"\nCarl Bunge\nWashington State University\nJune 2018\n\nAdapted from @author: Luka Denies from TU Delft.\n\nChangelog:\n11/2017 - Integration of CoolProp\n06/2018 - Update to OpenFOAM-5.x (Mass-based thermodynamics (for example: cpMcv to CpMCv))\n03/2019 - Update to include parahydrogen properties from Refpr... | true |
8,430 | 591ac07e735e08bcafa8274eb1a1547a01261f55 | #!/usr/local/bin/python3
from sys import stdin
import argparse
# Default values
alignment = 'l'
border = 'none'
stretch_factor = '1.0'
toprule = ''
# Default options
custom_header = False
standalone = False
stretch = False
booktabs = False
# Parsing command-line options
parser = argparse.ArgumentParser('<stdin> | cs... | [
"#!/usr/local/bin/python3\nfrom sys import stdin\nimport argparse\n\n# Default values\nalignment = 'l'\nborder = 'none'\nstretch_factor = '1.0'\ntoprule = ''\n\n# Default options\ncustom_header = False\nstandalone = False\nstretch = False\nbooktabs = False\n\n# Parsing command-line options\nparser = argparse.Argume... | false |
8,431 | 7eb8fe491a88bcfadf2a38eaa158b74b21514a1c | ###########Seq_Profile_Blast_Parser_tool################################
import csv
import time
import re
import os
import sys
from collections import Counter
import operator
from fractions import *
import glob
import ntpath
from collections import defaultdict
path = open('config.txt').read().splitlines()[0].split('... | [
"###########Seq_Profile_Blast_Parser_tool################################\nimport csv\nimport time\nimport re\nimport os\nimport sys\nfrom collections import Counter\nimport operator\nfrom fractions import *\nimport glob\nimport ntpath\nfrom collections import defaultdict\n\n\n\npath = open('config.txt').read().spl... | true |
8,432 | 3adb50a6375a73f786369dd22712a657b66f758e | #!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import os
import time
import glob
import torch
import random
import signal
import argparse
from models.trainer import build_trainer
from models import data_loader, model_builder
from models.pytorch_pretrained_bert.modeling import... | [
"#!/usr/bin/env python\n\"\"\"\n Main training workflow\n\"\"\"\nfrom __future__ import division\n\nimport os\nimport time\nimport glob\nimport torch\nimport random\nimport signal\nimport argparse\n\nfrom models.trainer import build_trainer\nfrom models import data_loader, model_builder\nfrom models.pytorch_pret... | false |
8,433 | bdf2c35c12820dd31bd242ce1b6dae7271ceb2b7 | class TimeEntry:
def __init__(self,date,duration,togglproject = 'default toggl', tdproject = 'default td', togglID = 'NULL', tdID = 'Null' ):
self.duration = duration
self.date = date
self.togglProject = togglproject
self.tdProject = tdproject
self.togglID = togglID
s... | [
"class TimeEntry:\n def __init__(self,date,duration,togglproject = 'default toggl', tdproject = 'default td', togglID = 'NULL', tdID = 'Null' ):\n self.duration = duration\n self.date = date\n self.togglProject = togglproject\n self.tdProject = tdproject\n self.togglID = togglI... | false |
8,434 | 14bf4befdce4270b4514b4e643964182f9c49ff4 | import sys
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sea
import sklearn
import glob
import pydub
from pydub import AudioSegment
import time
import librosa
import noisereduce as nr
from scipy.io import wavfile
import IPython
import sounddevice as sd
from pysndfx ... | [
"import sys\nimport os\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport seaborn as sea\nimport sklearn \nimport glob\nimport pydub\nfrom pydub import AudioSegment\nimport time\nimport librosa\nimport noisereduce as nr\nfrom scipy.io import wavfile\nimport IPython\nimport sounddevice... | false |
8,435 | e81da535408cc36655328b37ca99b4f775f3a78e | from gerador_senha import gerar_senha
gerar_senha() | [
"from gerador_senha import gerar_senha\n\ngerar_senha()",
"from gerador_senha import gerar_senha\ngerar_senha()\n",
"<import token>\ngerar_senha()\n",
"<import token>\n<code token>\n"
] | false |
8,436 | a7f2791e359b848a217beadc77fc983d971ef8b0 | from django.urls import path
from . import views as user_views
from produtos import views as prod_views
from django.contrib.auth import views as auth_views
app_name = 'user'
urlpatterns = [
path('detalhes/', user_views.painel, name="painel"),
path('produto/ajax/delete_prod/', prod_views.deleteProd, name="dele... | [
"from django.urls import path\nfrom . import views as user_views\nfrom produtos import views as prod_views\nfrom django.contrib.auth import views as auth_views\n\napp_name = 'user'\n\nurlpatterns = [\n path('detalhes/', user_views.painel, name=\"painel\"),\n path('produto/ajax/delete_prod/', prod_views.delete... | false |
8,437 | e7b30353fd25beb9d5cdeee688e4ffa6955d4221 | {
'variables': {
'node_shared_openssl%': 'true'
},
'targets': [
{
'target_name': 'keypair',
'sources': [
'secp256k1/keypair.cc'
],
'conditions': [
# For Windows, require either a 32-bit or 64-bit
# separately-compiled OpenSSL library.
# Currently set up to ... | [
"{\n 'variables': {\n 'node_shared_openssl%': 'true'\n },\n 'targets': [\n {\n 'target_name': 'keypair',\n 'sources': [\n 'secp256k1/keypair.cc'\n ],\n 'conditions': [\n # For Windows, require either a 32-bit or 64-bit\n # separately-compiled OpenSSL library.\n\t# C... | false |
8,438 | c0f3a957613a4f4e04aeb3eb2e3fa4053bd0122c | import pandas as pd
import numpy as np
import logging
import sklearn
from joblib import load
import sys
import warnings
import os
if not sys.warnoptions:
warnings.simplefilter("ignore")
class model:
def __init__(self):
#from number to labels
self.number_to_label = {1 : "Bot",2 : 'DoS attack',3... | [
"import pandas as pd\nimport numpy as np\nimport logging\nimport sklearn\nfrom joblib import load\nimport sys\nimport warnings\nimport os\n\nif not sys.warnoptions:\n warnings.simplefilter(\"ignore\")\n\nclass model:\n def __init__(self):\n #from number to labels\n self.number_to_label = {1 : \"... | false |
8,439 | 0f916a1f638bf149f6992355cf8f33f74bc9bdb1 | {
"targets": [
{
"target_name": "force-layout",
"sources": [ "src/main.cc", "src/layout.cc", "src/quadTree.cc" ],
'conditions': [
['OS=="win"', {
'cflags': [
'/WX', "/std:latest", "/m"
],
}, { # OS != "win"
'cflags': [
... | [
"{\n \"targets\": [\n {\n \"target_name\": \"force-layout\",\n \"sources\": [ \"src/main.cc\", \"src/layout.cc\", \"src/quadTree.cc\" ],\n 'conditions': [\n ['OS==\"win\"', {\n 'cflags': [\n '/WX', \"/std:latest\", \"/m\"\n ],\n }, { # OS != \... | false |
8,440 | 89256a38208be92f87115b110edc986cebc95306 | class Solution:
def containsDuplicate(self, nums) -> bool:
d = {} # store the elements which already exist
for elem in nums:
if elem in d:
return True
else:
d[elem] = 1
return False
print(Solution().containsDuplicate([0])) | [
"class Solution:\n def containsDuplicate(self, nums) -> bool:\n d = {} # store the elements which already exist\n\n for elem in nums:\n if elem in d:\n return True\n else:\n d[elem] = 1\n\n return False\n\nprint(Solution().containsDuplicate... | false |
8,441 | 7b18c967cf50d87b089dc22f3fbe6d40d708483f | import osfrom setuptools import setup
def read(fname): with open(fname) as fhandle: return fhandle.read()
def readMD(fname): # Utility function to read the README file. full_fname = os.path.join(os.path.dirname(__file__), fname) if 'PANDOC_PATH' in os.environ: import pandoc pandoc.core.PANDOC_PATH = os.enviro... | [
"import osfrom setuptools import setup\ndef read(fname): with open(fname) as fhandle: return fhandle.read()\ndef readMD(fname): # Utility function to read the README file. full_fname = os.path.join(os.path.dirname(__file__), fname) if 'PANDOC_PATH' in os.environ: import pandoc pandoc.core.PANDOC_PATH = os... | true |
8,442 | fdbb64159b72bf902efc3aa2eaa534e199dccf84 | if input is not None:
element = S(input)
if newChild is not None:
newChild = S(newChild)
element.replaceChild(existingChild, newChild)
| [
"if input is not None:\n element = S(input)\n\nif newChild is not None:\n newChild = S(newChild)\n\nelement.replaceChild(existingChild, newChild)\n\n",
"if input is not None:\n element = S(input)\nif newChild is not None:\n newChild = S(newChild)\nelement.replaceChild(existingChild, newChild)\n",
"<... | false |
8,443 | 2342a651ec45623b887c4bc1168adb0731ba5ff6 | # encoding: utf-8
import paramiko
import select
import os
import sys
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
host = "47.107.229.100"
user = "root"
pwd = "aliyun1996874353...A"
class SSH:
def __init__(self, host, user, pwd, port=22):
self.host = host
sel... | [
"# encoding: utf-8\nimport paramiko\nimport select\nimport os\nimport sys\n\nssh = paramiko.SSHClient()\nssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())\nhost = \"47.107.229.100\"\nuser = \"root\"\npwd = \"aliyun1996874353...A\"\n\nclass SSH:\n def __init__(self, host, user, pwd, port=22):\n sel... | false |
8,444 | 7ae6ed8797d6ee02effd04750e243c5a59840177 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/2/18 22:27
# @Author : name
# @File : 01.requests第一血.py
import requests
if __name__ == "__main__":
# step1:指定url
url = r'https://www.sogou.com/'
# step2:发起请求
reponse = requests.get(url = url)
# setp3:获取响应数据 text返回的是字... | [
"#!/usr/bin/env python\r\n# -*- coding: utf-8 -*-\r\n# @Time : 2021/2/18 22:27\r\n# @Author : name\r\n# @File : 01.requests第一血.py\r\n\r\nimport requests\r\n\r\nif __name__ == \"__main__\":\r\n # step1:指定url\r\n url = r'https://www.sogou.com/'\r\n # step2:发起请求\r\n reponse = requests.get(url = url)... | false |
8,445 | dc4de382ab16f036c6174e711f5c9fe52868ccc9 | from django.shortcuts import render,redirect
from django.http import HttpResponse
from .tasks import read_all_models, update_a_model, delete_a_model, read_a_model, create_a_model
from .forms import MyModelForm
def home(request):
content = read_all_models()
sorted_list = sorted(content, key=lambda k: k['title'].title... | [
"from django.shortcuts import render,redirect\nfrom django.http import HttpResponse\nfrom .tasks import read_all_models, update_a_model, delete_a_model, read_a_model, create_a_model\nfrom .forms import MyModelForm\n\ndef home(request):\n\tcontent = read_all_models()\n\tsorted_list = sorted(content, key=lambda k: k[... | false |
8,446 | 7e33c6ada3d141ba8067dbf88c2e85a91802a067 | # coding:utf-8
__author__ = 'yinzishao'
# dic ={}
class operation():
def GetResult(self):
pass
class operationAdd(operation):
def GetResult(self):
return self.numberA + self.numberB
class operationDev(operation):
def GetResult(self):
# if(self.numberB!=0):
# return sel... | [
"# coding:utf-8\n__author__ = 'yinzishao'\n# dic ={}\n\nclass operation():\n def GetResult(self):\n pass\n\nclass operationAdd(operation):\n def GetResult(self):\n return self.numberA + self.numberB\n\nclass operationDev(operation):\n def GetResult(self):\n # if(self.numberB!=0):\n ... | true |
8,447 | 7817a42e5aee1786cfb3e8018bd7ca0a5e74749d | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2017-05-29 04:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nomenclature', '0002_saloon_default'),
]
operations = [
migrations.AlterFiel... | [
"# -*- coding: utf-8 -*-\n# Generated by Django 1.9.6 on 2017-05-29 04:28\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('nomenclature', '0002_saloon_default'),\n ]\n\n operations = [\n m... | false |
8,448 | 696b9db78cc7f6002eb39b640e0e5b2b53e52e91 | from import_.Import import Import
from classifier.Classifier import Classifier
from export.Export import Export
from preprocessing.PreProcess import PreProcess
def main():
date_column = "date of last vet visit"
target = "age at death"
export_file_dir = "./output/"
export_model_dir = "./model/xgb_mode... | [
"from import_.Import import Import\nfrom classifier.Classifier import Classifier\nfrom export.Export import Export\nfrom preprocessing.PreProcess import PreProcess\n\n\ndef main():\n\n date_column = \"date of last vet visit\"\n target = \"age at death\"\n export_file_dir = \"./output/\"\n export_model_d... | false |
8,449 | b381d1110e6a7570cd872d689a43aba2d2580a23 | year = int(input('西暦>'))
if year % 4 == 0 and year % 100 != 0:
print('閏年')
pass
elif year % 400 == 0:
print('閏年')
pass
else:
print('平年')
pass
| [
"year = int(input('西暦>'))\n\nif year % 4 == 0 and year % 100 != 0:\n print('閏年')\n pass\nelif year % 400 == 0:\n print('閏年')\n pass\nelse:\n print('平年')\n pass\n",
"year = int(input('西暦>'))\nif year % 4 == 0 and year % 100 != 0:\n print('閏年')\n pass\nelif year % 400 == 0:\n print('閏年')\... | false |
8,450 | 56b5faf925d9a1bfaef348caeb35a7d3c323d57f | from django.db.models import Q
from rest_framework.generics import get_object_or_404
from rest_framework.permissions import BasePermission
from relations.models import Relation
from .. import models
class ConversationAccessPermission(BasePermission):
message = 'You cant see others conversations!'
def has_o... | [
"from django.db.models import Q\n\nfrom rest_framework.generics import get_object_or_404\nfrom rest_framework.permissions import BasePermission\n\nfrom relations.models import Relation\nfrom .. import models\n\n\nclass ConversationAccessPermission(BasePermission):\n message = 'You cant see others conversations!'... | false |
8,451 | 27f162f2e350fdb284740bd67f4293535f0ab593 | import os, sys
import json
import paramiko
"""
Copies the credentials.json file locally from robot
"""
def copy_credentials_file(hostname, username, password, src_path, dst_path):
# create ssh connection
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.... | [
"import os, sys\nimport json\nimport paramiko\n\n\"\"\"\n\tCopies the credentials.json file locally from robot\n\"\"\"\ndef copy_credentials_file(hostname, username, password, src_path, dst_path):\n\t# create ssh connection\n\tssh_client = paramiko.SSHClient()\n\tssh_client.set_missing_host_key_policy(paramiko.Auto... | false |
8,452 | ec4725b5b60d10e86b29aab3723917ace5cf52f6 | print("gist test file4") | [
"print(\"gist test file4\")",
"print('gist test file4')\n",
"<code token>\n"
] | false |
8,453 | e9af8f7830be7db3ca57b0a24de48ef7fcb08d6c | from psycopg2 import extras as ex
import psycopg2 as pg
import json
import datetime
import os
from functools import reduce
data_list = [{'projectName': '伊犁哈萨克自治州友谊医院开发区分院保洁服务项目', 'pingmu': '服务', 'purUnit': '新疆伊犁哈萨克自治州友谊医院', 'adminiArea': '新疆维吾尔自治区', 'bulletTime': '2020年09月02日 19:20', 'obtBidTime': '2020年09月02日至2020年... | [
"from psycopg2 import extras as ex\nimport psycopg2 as pg\nimport json\nimport datetime\nimport os\nfrom functools import reduce\n\n\ndata_list = [{'projectName': '伊犁哈萨克自治州友谊医院开发区分院保洁服务项目', 'pingmu': '服务', 'purUnit': '新疆伊犁哈萨克自治州友谊医院', 'adminiArea': '新疆维吾尔自治区', 'bulletTime': '2020年09月02日 19:20', 'obtBidTime': '2020... | false |
8,454 | 12442e4debc7fbf102ab88b42464f4ca8eb91351 | #!/usr/bin/python
# coding=utf8
# author: Sun yang
import running
if __name__ == '__main__':
running.go() | [
"#!/usr/bin/python\r\n# coding=utf8\r\n# author: Sun yang\r\n\r\nimport running\r\n\r\n\r\nif __name__ == '__main__':\r\n running.go()",
"import running\nif __name__ == '__main__':\n running.go()\n",
"<import token>\nif __name__ == '__main__':\n running.go()\n",
"<import token>\n<code token>\n"
] | false |
8,455 | 516ea681a55255e4c98e7106393180f9ad2e0250 | # csv URL
url = "https://covid19-dashboard.ages.at/data/CovidFallzahlen.csv"
# read csv from URL
import pandas as pd
import geopandas as gpd
import numpy as np
df=pd.read_csv(url,sep=";")
df.to_csv("/var/www/FlaskApp/FlaskApp/data/covid_data.csv",sep=";",index=False)
# transforming timestamps to proper DateTime forma... | [
"# csv URL\nurl = \"https://covid19-dashboard.ages.at/data/CovidFallzahlen.csv\"\n\n# read csv from URL\nimport pandas as pd\nimport geopandas as gpd\nimport numpy as np\ndf=pd.read_csv(url,sep=\";\")\ndf.to_csv(\"/var/www/FlaskApp/FlaskApp/data/covid_data.csv\",sep=\";\",index=False)\n\n# transforming timestamps t... | false |
8,456 | 53380810a3d9787fe7c373cf1829f2d849a91c3c | import csv
from matplotlib import pyplot as plt
from datetime import datetime
file_one = 'data/dwifh_all_sales.csv'
file_two = 'data/dwifh_bc_sales.csv'
# create code to automatically build a dictionary for each album?
with open(file_one) as fo:
reader = csv.reader(fo)
header = next(reader)
album = {}
... | [
"import csv\nfrom matplotlib import pyplot as plt\nfrom datetime import datetime\n\nfile_one = 'data/dwifh_all_sales.csv'\nfile_two = 'data/dwifh_bc_sales.csv'\n\n# create code to automatically build a dictionary for each album?\n\nwith open(file_one) as fo:\n reader = csv.reader(fo)\n header = next(reader)\n... | false |
8,457 | 0a5e30483c1fde10410c442a1ccd1f79bfb329c8 | import pandas as pd
import glob
import string
import os
ALLOWED_CHARS = string.ascii_letters + "-,. \"()'"
def concat_all_data(path : str = 'Data/*.csv', save_path : str = 'Data/final.csv'):
csvs = glob.glob(path)
li = []
for csv in csvs:
df = pd.read_csv(csv)
li.append(df)
final_... | [
"import pandas as pd \nimport glob\nimport string \nimport os\n\nALLOWED_CHARS = string.ascii_letters + \"-,. \\\"()'\"\n\ndef concat_all_data(path : str = 'Data/*.csv', save_path : str = 'Data/final.csv'):\n csvs = glob.glob(path)\n\n li = []\n\n for csv in csvs:\n df = pd.read_csv(csv)\n li... | false |
8,458 | c3d0a9bdbfd5b6f2b960ee2c1f11ec4acf508310 | def fibonacci(num):
f_1 = 0
f_2 = 1
answer = 0
for i in range(num-1):
answer = f_1 + f_2
f_1 = f_2
f_2 = answer
return answer
# 아래는 테스트로 출력해 보기 위한 코드입니다.
print(fibonacci(3))
| [
"def fibonacci(num):\n f_1 = 0\n f_2 = 1\n answer = 0\n for i in range(num-1):\n answer = f_1 + f_2\n f_1 = f_2\n f_2 = answer\n return answer\n\n# 아래는 테스트로 출력해 보기 위한 코드입니다.\nprint(fibonacci(3))\n",
"def fibonacci(num):\n f_1 = 0\n f_2 = 1\n answer = 0\n for i in ra... | false |
8,459 | 676aec735dd7441b0c481956ad18b012b8d98ea4 | # Question : determine whether given number is power of 2
# logic : every no. of the form 2^i has bit represetntaion of the form :
# 2 -> 10 1->01
# 4 -> 100 3->011
# 8 -> 1000 7->0111
# 16 -> 10000 15->01111
# 32 -> 100000 31->011111
# ... and so on
# Thus there is a pattern here, ever p... | [
"# Question : determine whether given number is power of 2\n\n# logic : every no. of the form 2^i has bit represetntaion of the form : \n# 2 -> 10 1->01\n# 4 -> 100 3->011\n# 8 -> 1000 7->0111\n# 16 -> 10000 15->01111\n# 32 -> 100000 31->011111\n# ... and so on\n\n# Thus there is a patte... | false |
8,460 | 50b630b762251f8646044b234ac4b82b8e4b645b | import asyncio
import logging
import os.path
from serial_asyncio import open_serial_connection
from typing import NewType, cast
# Type annotations and converters
AsciiBytes = NewType('AsciiBytes', bytes)
def to_ascii(s: str) -> AsciiBytes:
if s[-1] != '\n':
s += '\n'
return cast(AsciiBytes, s.encode(... | [
"import asyncio\nimport logging\nimport os.path\nfrom serial_asyncio import open_serial_connection\nfrom typing import NewType, cast\n\n# Type annotations and converters\nAsciiBytes = NewType('AsciiBytes', bytes)\n\n\ndef to_ascii(s: str) -> AsciiBytes:\n if s[-1] != '\\n':\n s += '\\n'\n return cast(A... | false |
8,461 | 3a9987ac326131878b80cb819e3d06ce2f4cb054 | # -*- coding: utf-8 -*-
from .log_config import LogBase
import os
__all__ = ['MyLog']
class MyLog(LogBase):
"""
功能:
将日志分日志等级记录,并自动压缩2019-11-11.info.log.gz
参数:
:param dir_path: 日志记录的路径,默认是当前路径下的log文件夹
:param logger_name: logger对象的名字
:param info_name: 保存inf... | [
"# -*- coding: utf-8 -*-\r\n\r\nfrom .log_config import LogBase\r\nimport os\r\n\r\n__all__ = ['MyLog']\r\n\r\n\r\nclass MyLog(LogBase):\r\n \"\"\"\r\n 功能:\r\n 将日志分日志等级记录,并自动压缩2019-11-11.info.log.gz\r\n\r\n 参数:\r\n :param dir_path: 日志记录的路径,默认是当前路径下的log文件夹\r\n :param logger_name: logger... | false |
8,462 | 8d6c58e9ef4e14a089a7eb33a92214d081ed7692 | import splunk.admin as admin
import splunk.entity as en
class ConfigApp(admin.MConfigHandler):
def setup(self):
if self.requestedAction == admin.ACTION_EDIT:
for myarg in ['api_key']:
self.supportedArgs.addOptArg(myarg)
def handleList(self, confInfo):
confDict = self.readConf("appsetup")
if None != c... | [
"import splunk.admin as admin\nimport splunk.entity as en\n \nclass ConfigApp(admin.MConfigHandler):\n\tdef setup(self):\n\t\tif self.requestedAction == admin.ACTION_EDIT:\n\t\t\tfor myarg in ['api_key']:\n\t\t\t\tself.supportedArgs.addOptArg(myarg)\n \n\tdef handleList(self, confInfo):\n\t\tconfDict = self.readCon... | false |
8,463 | 1c171c67ca5ef0e9b5f2941eec7a625a8823271f | import sys
def isPalin(s):
result = True
for i in range(len(s)/2):
if s[i] != s[-(i + 1)]:
result = False
break
return result
def main():
curr_large = 0
for i in xrange(900, 1000):
for j in xrange(900, 1000):
prod = i * j
# Turns out list comprehension is more succint, but I... | [
"import sys\n\ndef isPalin(s):\n result = True\n for i in range(len(s)/2):\n if s[i] != s[-(i + 1)]:\n result = False\n break\n return result\n\n\ndef main():\n curr_large = 0\n for i in xrange(900, 1000):\n for j in xrange(900, 1000):\n prod = i * j\n # Turns out list comprehension i... | true |
8,464 | d6e06a78c9a5d8184e5adf9b99cc6030c3434558 | # Generated by Django 2.2.2 on 2019-07-09 20:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0015_auto_20190709_1543'),
]
operations = [
migrations.CreateModel(
name='ExampleModel',
fields=[
... | [
"# Generated by Django 2.2.2 on 2019-07-09 20:04\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('blog', '0015_auto_20190709_1543'),\n ]\n\n operations = [\n migrations.CreateModel(\n name='ExampleModel',\n ... | false |
8,465 | cef904b70eb9a997c3c48884ee34665a77e18897 | # -*- coding: utf-8 -*-
'''
LE JEU DE LA VIE
Mini projet numéro 2 de NSI
Modélisation Objet :
Q1) On peut dégager, au premier abord : une classe cellule (avec un attribut état et un autre voisins) et une classe grille (avec un attribut ordonnée et un autre abscisse). En effet, ce sont les deux éléments du jeu.... | [
"# -*- coding: utf-8 -*-\r\n'''\r\nLE JEU DE LA VIE\r\nMini projet numéro 2 de NSI\r\n\r\nModélisation Objet :\r\n\r\nQ1) On peut dégager, au premier abord : une classe cellule (avec un attribut état et un autre voisins) et une classe grille (avec un attribut ordonnée et un autre abscisse). En effet, ce sont les de... | false |
8,466 | 24ed29dfaaf7ce508b2d80740bad1304b291c596 | # Generated by Django 3.1.6 on 2021-04-22 07:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0004_project_is_featured'),
]
operations = [
migrations.AlterField(
model_name='project',
name='pin_id',... | [
"# Generated by Django 3.1.6 on 2021-04-22 07:46\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('projects', '0004_project_is_featured'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='project',\n ... | false |
8,467 | 58058065ac78ffbf7550416b751e1440976c7898 | # -*- coding: utf-8 -*-
import urllib
from pingpp import http_client, util
class WxpubOauth:
"""
用于微信公众号OAuth2.0鉴权,用户授权后获取授权用户唯一标识openid
WxpubOAuth中的方法都是可选的,开发者也可根据实际情况自行开发相关功能
详细内容可参考http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html
"""
@staticmethod
def get_openid(a... | [
"# -*- coding: utf-8 -*-\nimport urllib\n\nfrom pingpp import http_client, util\n\n\nclass WxpubOauth:\n \"\"\"\n 用于微信公众号OAuth2.0鉴权,用户授权后获取授权用户唯一标识openid\n WxpubOAuth中的方法都是可选的,开发者也可根据实际情况自行开发相关功能\n 详细内容可参考http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html\n \"\"\"\n\n @staticmet... | true |
8,468 | 388e43850a2e114cfe7869293ee814831a088b3e | from django.conf.urls import url
from myapp import views
urlpatterns = [
url(r'^$', views.homepage, name='homepage'),
url(r'^search/', views.my_search_view, name = 'article_detail')
] | [
"from django.conf.urls import url\nfrom myapp import views\n\nurlpatterns = [\n url(r'^$', views.homepage, name='homepage'),\n url(r'^search/', views.my_search_view, name = 'article_detail')\n ]",
"from django.conf.urls import url\nfrom myapp import views\nurlpatterns = [url('^$', views.homepage, name='h... | false |
8,469 | 75393d39b147097a7ac1d82938ac102491ea9441 | # drop data to file filter
import tarr.compiler_base
def format_data(data):
return '{0.id}: {0.payload}'.format(data)
class WRITE_TO_FILE(tarr.compiler_base.Instruction):
@property
def __name__(self):
return 'POINT OF INTEREST - WRITE("{}")'.format(self.filename)
def __init__(self, filenam... | [
"# drop data to file filter\nimport tarr.compiler_base\n\n\ndef format_data(data):\n return '{0.id}: {0.payload}'.format(data)\n\n\nclass WRITE_TO_FILE(tarr.compiler_base.Instruction):\n\n @property\n def __name__(self):\n return 'POINT OF INTEREST - WRITE(\"{}\")'.format(self.filename)\n\n def _... | false |
8,470 | 167bd2c405171443c11fbd13575f8c7b20877289 | import logging
import terrestrial.config as config
logger = logging.getLogger(f'{__name__}.common')
def health():
return 'OK', 200
def verify_token(token):
"""
Verifies Token from Authorization header
"""
if config.API_TOKEN is None:
logger.error(
'API token is not configur... | [
"import logging\nimport terrestrial.config as config\n\n\nlogger = logging.getLogger(f'{__name__}.common')\n\n\ndef health():\n return 'OK', 200\n\n\ndef verify_token(token):\n \"\"\"\n Verifies Token from Authorization header\n \"\"\"\n if config.API_TOKEN is None:\n logger.error(\n ... | false |
8,471 | 78d59e903fecd211aa975ae4c8dc01b17c8fad44 | import io
import socket
import ssl
from ..exceptions import ProxySchemeUnsupported
from ..packages import six
SSL_BLOCKSIZE = 16384
class SSLTransport:
"""
The SSLTransport wraps an existing socket and establishes an SSL connection.
Contrary to Python's implementation of SSLSocket, it allows you to cha... | [
"import io\nimport socket\nimport ssl\n\nfrom ..exceptions import ProxySchemeUnsupported\nfrom ..packages import six\n\nSSL_BLOCKSIZE = 16384\n\n\nclass SSLTransport:\n \"\"\"\n The SSLTransport wraps an existing socket and establishes an SSL connection.\n\n Contrary to Python's implementation of SSLSocket... | false |
8,472 | e47223622a2718830d830dbb779800659d659ae3 | import cv2
import numpy as np
from pycocotools.coco import maskUtils
# from dataset.augmentors import FlipTransform, joints_to_point8, point8_to_joints, AugImgMetadata
# from dataset.base_dataflow import Meta
from dataset.augmentors import FlipTransform, joints_to_point8, point8_to_joints, AugImgMetadata
from data... | [
"import cv2\nimport numpy as np\n\nfrom pycocotools.coco import maskUtils\n\n# from dataset.augmentors import FlipTransform, joints_to_point8, point8_to_joints, AugImgMetadata\n\n# from dataset.base_dataflow import Meta\n\nfrom dataset.augmentors import FlipTransform, joints_to_point8, point8_to_joints, AugImgMetad... | false |
8,473 | 501d50fa933f55c178b4b2eba6cfc5b85592beaa | #!/usr/bin/env python3
#
# compare-sorts.py
# Copyright (c) 2017 Dylan Brown. All rights reserved.
#
# Use Python 3. Run from within the scripts/ directory.
import os
import sys
import re
import subprocess
# Ensure we don't silently fail by running Python 2.
assert sys.version_info[0] >= 3, "This script requires P... | [
"#!/usr/bin/env python3\n#\n# compare-sorts.py\n# Copyright (c) 2017 Dylan Brown. All rights reserved.\n#\n\n# Use Python 3. Run from within the scripts/ directory.\n\nimport os\nimport sys\nimport re\nimport subprocess\n\n# Ensure we don't silently fail by running Python 2.\nassert sys.version_info[0] >= 3, \"Th... | false |
8,474 | 3aee336956ac6f962c34f51a27dc4abebf2cc7c8 | """
You are given pre-order traversal with a slight modification.
It includes null pointers when a particular node has nil left/right child.
Reconstruct the binary tree with this information.
Ex. [H, B, F, None, None, E, A, None, None, None, C, None, D, None, G, I, None, None, None]
H
/ \
B C
/ \ ... | [
"\"\"\"\nYou are given pre-order traversal with a slight modification. \nIt includes null pointers when a particular node has nil left/right child. \nReconstruct the binary tree with this information.\n\nEx. [H, B, F, None, None, E, A, None, None, None, C, None, D, None, G, I, None, None, None]\n\n H\n / \\... | false |
8,475 | 9e525eccbf10a710d6f37c903370cc10f7d2c62b | # -*- coding: utf-8 -*-
# Author:sen
# Date:2020/4/2 14:15
class TreeNode:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def find(root, val):
if not root:
return None
if val < root.val:
return find(root.left, val)
elif val > root.va... | [
"# -*- coding: utf-8 -*-\n# Author:sen\n# Date:2020/4/2 14:15\n\nclass TreeNode:\n def __init__(self, val):\n self.val = val \n self.left = None\n self.right = None\n\ndef find(root, val):\n if not root:\n return None\n if val < root.val:\n return find(root.left, val)\n ... | false |
8,476 | 3875d85bef37900f9066c108dc720b364cbafffa | import os
from distutils.core import setup
from Cython.Distutils import Extension
from Cython.Build import cythonize
CUR_DIR = os.path.dirname(os.path.abspath(__file__))
SRC_DIR = os.path.join(CUR_DIR, 'src')
TPM_DIR = os.path.join(SRC_DIR, 'tpm')
include_dirs = [SRC_DIR]
src_files = ["pytpm/_tpm.pyx"]
# TPM library ... | [
"import os\nfrom distutils.core import setup\nfrom Cython.Distutils import Extension\nfrom Cython.Build import cythonize\n\nCUR_DIR = os.path.dirname(os.path.abspath(__file__))\nSRC_DIR = os.path.join(CUR_DIR, 'src')\nTPM_DIR = os.path.join(SRC_DIR, 'tpm')\ninclude_dirs = [SRC_DIR]\nsrc_files = [\"pytpm/_tpm.pyx\"]... | false |
8,477 | f2bb00d06023ef7b3ea3dc33f7ec00d1f48d46ae | from openerp import models, fields, api, _
class priority_customer(models.Model):
_inherit = 'res.partner'
is_priority = fields.Boolean("Is Priority Partner:?")
registration_date = fields.Date("Registration Date:")
liability_card_number = fields.Char("Liability Card Number:")
| [
"from openerp import models, fields, api, _\n\n\nclass priority_customer(models.Model):\n\n _inherit = 'res.partner'\n\n is_priority = fields.Boolean(\"Is Priority Partner:?\")\n registration_date = fields.Date(\"Registration Date:\")\n liability_card_number = fields.Char(\"Liability Card Number:\")\n",... | false |
8,478 | b3fb210bcdec2ed552c37c6221c1f0f0419d7469 | import boto3
from time import sleep
cfn = boto3.client('cloudformation')
try:
# Get base stack outputs.
stack_id = cfn.describe_stacks(StackName='MinecraftInstance')['Stacks'][0]['StackId']
cfn.delete_stack(StackName=stack_id)
print(f"Deleting Stack: {stack_id}")
except Exception as e:
print('Some... | [
"import boto3\nfrom time import sleep\n\ncfn = boto3.client('cloudformation')\n\ntry:\n # Get base stack outputs.\n stack_id = cfn.describe_stacks(StackName='MinecraftInstance')['Stacks'][0]['StackId']\n cfn.delete_stack(StackName=stack_id)\n print(f\"Deleting Stack: {stack_id}\")\nexcept Exception as e... | false |
8,479 | cce645073ba117b9e297dfccf5a39710b0c6cd14 | #! /usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'raek'
web = '910d59f0-30bd-495b-a54c-bf5addc81a8a'
app = '21ec74fb-e941-43be-8772-a2f8dc6ccc4f' | [
"#! /usr/bin/python\n# -*- coding: utf-8 -*-\n__author__ = 'raek'\n\nweb = '910d59f0-30bd-495b-a54c-bf5addc81a8a'\napp = '21ec74fb-e941-43be-8772-a2f8dc6ccc4f'",
"__author__ = 'raek'\nweb = '910d59f0-30bd-495b-a54c-bf5addc81a8a'\napp = '21ec74fb-e941-43be-8772-a2f8dc6ccc4f'\n",
"<assignment token>\n"
] | false |
8,480 | 32b22cccac75c87b8638c76c0c6d27db0de4d750 | # joiner = '+'
# seq = ["Sushil","Bahadur","KC"]
# txt = joiner.join(seq)
# txt
# txt = " Sam "
# ljus = txt.ljust(7,"*")
# ljus
# txtstrip = txt.strip().strip('S')
# txtstrip
# txt = "This is my world."
# txtSplit = txt.split(maxsplit=1)
# txtSplit
# name = input("Enter your full name")
# name = name.strip()
# txt = ... | [
"# joiner = '+'\n# seq = [\"Sushil\",\"Bahadur\",\"KC\"]\n# txt = joiner.join(seq)\n# txt\n# txt = \" Sam \"\n# ljus = txt.ljust(7,\"*\")\n# ljus\n# txtstrip = txt.strip().strip('S')\n# txtstrip\n# txt = \"This is my world.\"\n# txtSplit = txt.split(maxsplit=1)\n# txtSplit\n\n# name = input(\"Enter your full name\"... | false |
8,481 | 8faaf9eb2e78b7921dd1cac4772e2415671201c7 | # -*- coding: utf-8 -*-
# Copyright 2013, Achim Köhler
# All rights reserved, see accompanied file license.txt for details.
# $REV$
import argparse
import traylauncher
if __name__ == "__main__":
args = argparse.Namespace()
args.notray = False
traylauncher.start(args) | [
"# -*- coding: utf-8 -*-\n# Copyright 2013, Achim Köhler\n# All rights reserved, see accompanied file license.txt for details.\n\n# $REV$\n\nimport argparse\nimport traylauncher\n\nif __name__ == \"__main__\":\n\targs = argparse.Namespace()\n\targs.notray = False\n\ttraylauncher.start(args)",
"import argparse\ni... | false |
8,482 | d332ddd6c66bb22d60190ab8f94931eac6fd2394 | # Bisection recursion algo for sqrt of 2
def bisectionSqrt(x, epsilon = 0.01, low = None, high = None):
"""
Performs a recursive bisection search to find the
square root of x, within epsilon
"""
if low == None:
low = 0.0
if high == None:
high = x
midPoint = (high + low)/2.0
# If the difference of the ... | [
"# Bisection recursion algo for sqrt of 2\n\ndef bisectionSqrt(x, epsilon = 0.01, low = None, high = None):\n\t\"\"\" \n\t\tPerforms a recursive bisection search to find the\n\t\tsquare root of x, within epsilon\n\t\"\"\"\n\n\tif low == None:\n\t\tlow = 0.0\n\tif high == None:\n\t\thigh = x\n\n\tmidPoint = (high + ... | true |
8,483 | e6fa1202d829fb553423998cdbad13684405437c | # adventofcode.com
# day19
from collections import defaultdict
INPUTFILE = 'input/input19'
TEST = False
TESTCASE = ('HOH', ['H => HO\n', 'H => OH\n', 'O => HH\n'], ['OHOH', 'HOOH', 'HHHH', 'HOHO'])
def find_idx(string, substring):
""" iterator that returns the index of the next occurence of substring
wr... | [
"# adventofcode.com\n# day19\n\nfrom collections import defaultdict\n\nINPUTFILE = 'input/input19'\n\nTEST = False\nTESTCASE = ('HOH', ['H => HO\\n', 'H => OH\\n', 'O => HH\\n'], ['OHOH', 'HOOH', 'HHHH', 'HOHO'])\n\ndef find_idx(string, substring):\n \"\"\" iterator that returns the index of the next occurence o... | true |
8,484 | fa46bd784dcfeee4f9012ffb6ab6731d2764c9fa | # 来源知乎 https://zhuanlan.zhihu.com/p/51987247
# 博客 https://www.cnblogs.com/yangecnu/p/Introduce-Binary-Search-Tree.html
"""
二叉查找树 (Binary Search Tree, BST)
特点 : left < root < right
若任意节点的左子树不空,则左子树上所有结点的 值均小于它的根结点的值;
若任意节点的右子树不空,则右子树上所有结点的值均大于它的根结点的值;
任意节点的左、右子树也分别为二叉查找树;
没有键值相等的节点(no ... | [
"# 来源知乎 https://zhuanlan.zhihu.com/p/51987247\n# 博客 https://www.cnblogs.com/yangecnu/p/Introduce-Binary-Search-Tree.html\n\"\"\"\n二叉查找树 (Binary Search Tree, BST)\n特点 : left < root < right\n 若任意节点的左子树不空,则左子树上所有结点的 值均小于它的根结点的值;\n 若任意节点的右子树不空,则右子树上所有结点的值均大于它的根结点的值;\n 任意节点的左、右子树也分别为二叉查找树;\n ... | false |
8,485 | 464be943f4fe34dda826ebada9e128f1d7d671ac | from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/"
def test_guest_should_see_button_add_to_basket(browser):
browser.get(lin... | [
"from selenium.webdriver.common.by import By\nfrom selenium.webdriver.support.ui import WebDriverWait\nfrom selenium.webdriver.support import expected_conditions as EC\n\nlink = \"http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/\"\n\ndef test_guest_should_see_button_add_to_basket(browser):\n b... | false |
8,486 | 41f71589d3fb9f5df218d8ffa0f608a890c73ad2 | # coding: utf-8
# 2021/5/29 @ tongshiwei
import logging
def get_logger():
_logger = logging.getLogger("EduNLP")
_logger.setLevel(logging.INFO)
_logger.propagate = False
ch = logging.StreamHandler()
ch.setFormatter(logging.Formatter('[%(name)s, %(levelname)s] %(message)s'))
ch.setLevel(logging.... | [
"# coding: utf-8\n# 2021/5/29 @ tongshiwei\nimport logging\n\n\ndef get_logger():\n _logger = logging.getLogger(\"EduNLP\")\n _logger.setLevel(logging.INFO)\n _logger.propagate = False\n ch = logging.StreamHandler()\n ch.setFormatter(logging.Formatter('[%(name)s, %(levelname)s] %(message)s'))\n ch... | false |
8,487 | e2489f9d3041c45129fdd71da6652a6093c96d2d | #!/usr/bin/env python
# coding=utf-8
import sys,os
dir = '/home/ellen/yjoqm/fdfs_client/pic'
def scp_file(filename):
cmd = 'scp ellen@61.147.182.142:/home/ellen/yjoqm/fdfs_client/pic/%s .' %filename
os.system(cmd)
def main(args):
args = sys.argv[1]
scp_file(args)
print 'done~~~~'
if __name_... | [
"#!/usr/bin/env python\n# coding=utf-8\nimport sys,os\n\ndir = '/home/ellen/yjoqm/fdfs_client/pic'\n\ndef scp_file(filename):\n cmd = 'scp ellen@61.147.182.142:/home/ellen/yjoqm/fdfs_client/pic/%s .' %filename\n os.system(cmd)\n\ndef main(args):\n args = sys.argv[1]\n \n scp_file(args)\n print 'do... | true |
8,488 | 155b243ad7d93bcf2b74cd5b2bd3409ab7ec7473 | from numpy import*
a=int(input('numero: '))
b='*'
c='o'
for i in range(a):
d=(b*(a-i))+(c*(a-(a-i)))+(c*(a-(a-i)))+(b*(a-i))
print(d)
| [
"from numpy import*\n\na=int(input('numero: '))\nb='*'\nc='o'\nfor i in range(a):\n\td=(b*(a-i))+(c*(a-(a-i)))+(c*(a-(a-i)))+(b*(a-i))\n\tprint(d)\n",
"from numpy import *\na = int(input('numero: '))\nb = '*'\nc = 'o'\nfor i in range(a):\n d = b * (a - i) + c * (a - (a - i)) + c * (a - (a - i)) + b * (a - i)\n... | false |
8,489 | e90fb3b6009dd4fb780649c04398b361fa1ae195 | from collections import defaultdict
from django.shortcuts import render
from django.views.decorators.cache import cache_control
from peterbecom.plog.models import BlogItem, Category
from peterbecom.plog.utils import utc_now
from peterbecom.plog.views import json_view
ONE_MONTH = 60 * 60 * 24 * 30
@cache_control(pu... | [
"from collections import defaultdict\n\nfrom django.shortcuts import render\nfrom django.views.decorators.cache import cache_control\n\nfrom peterbecom.plog.models import BlogItem, Category\nfrom peterbecom.plog.utils import utc_now\nfrom peterbecom.plog.views import json_view\n\nONE_MONTH = 60 * 60 * 24 * 30\n\n\n... | false |
8,490 | aee009b37b99bf44e27c608470c43834a58e0cc7 | # coding: UTF-8
from PIL import ImageFont,Image,ImageDraw
def min_element(table_d,ignoring_index = None):
min_i,min_j,min_e = 0,0,max(table_d.values())
for key in table_d.keys():
# ignore if i in key or j in key
if ignoring_index is not None:
i,j = key
if i in ignoring_index or j in ignoring_i... | [
"# coding: UTF-8\r\n\r\nfrom PIL import ImageFont,Image,ImageDraw\r\n\r\ndef min_element(table_d,ignoring_index = None):\r\n\tmin_i,min_j,min_e = 0,0,max(table_d.values())\r\n\tfor key in table_d.keys():\r\n\r\n\t\t# ignore if i in key or j in key\r\n\t\tif ignoring_index is not None:\r\n\t\t\ti,j = key\r\n\t\t\tif... | false |
8,491 | 9d1b795b561a26ae28e82833485ca6034438e78b | #!/usr/bin/env python
'''
Created on 2011-08-27
@author: xion
Setup script for the seejoo project.
'''
import ast
import os
from setuptools import find_packages, setup
def read_tags(filename):
"""Reads values of "magic tags" defined in the given Python file.
:param filename: Python filename to read the tag... | [
"#!/usr/bin/env python\n'''\nCreated on 2011-08-27\n\n@author: xion\n\nSetup script for the seejoo project.\n'''\nimport ast\nimport os\nfrom setuptools import find_packages, setup\n\n\ndef read_tags(filename):\n \"\"\"Reads values of \"magic tags\" defined in the given Python file.\n\n :param filename: Pytho... | false |
8,492 | 66b7d928bc2c98a12f7adb8a375ced21edce8333 | # Imports
import os
import time
import math
import random
from lib import *
def MT19937_keystream_generator(seed: int) -> bytes:
"""
Generate keystream for MT19937
"""
# Verify that the seed is atmost 16 bit long.
assert math.log2(seed) <= 16
prng = MT19937(seed)
while True:
nu... | [
"# Imports\nimport os\nimport time\nimport math\nimport random\nfrom lib import *\n\ndef MT19937_keystream_generator(seed: int) -> bytes:\n \"\"\"\n Generate keystream for MT19937\n \"\"\"\n # Verify that the seed is atmost 16 bit long.\n assert math.log2(seed) <= 16\n \n prng = MT19937(seed)\n... | false |
8,493 | 5f8a9d82a3245671b438475d1fac7be4db769fbe | from Monument import Monument, Dataset
import importer_utils as utils
import importer as importer
class RoRo(Monument):
def set_adm_location(self):
counties = self.data_files["counties"]
self.set_from_dict_match(counties, "iso_code",
"judetul_iso", "located_adm")
... | [
"from Monument import Monument, Dataset\nimport importer_utils as utils\nimport importer as importer\n\n\nclass RoRo(Monument):\n\n def set_adm_location(self):\n counties = self.data_files[\"counties\"]\n self.set_from_dict_match(counties, \"iso_code\",\n \"judetul_i... | false |
8,494 | 9683c7df01eda0d97615fb3e8f9496ecc95d1d32 | # -*- coding: utf-8 -*-
"""
Created on Wed May 15 17:05:30 2019
@author: qinzhen
"""
import numpy as np
# =============================================================================
# Q5
# =============================================================================
#### Part 1 计算MLE
File = "ner_proc.counts"
q2 = ... | [
"# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed May 15 17:05:30 2019\n\n@author: qinzhen\n\"\"\"\n\nimport numpy as np\n\n# =============================================================================\n# Q5\n# =============================================================================\n#### Part 1 计算MLE\nFile =... | false |
8,495 | 1280ab66b817011e22e560a78104bbc4340989e7 | planet_list = ["Mercury", "Mars"]
planet_list.append("Jupiter")
planet_list.append("Saturn")
planet_list.extend(["Uranus", "Neptune"])
planet_list.insert(1, "Earth")
planet_list.insert(1, "Venus")
planet_list.append("Pluto")
del planet_list[-1]
print(planet_list) | [
"planet_list = [\"Mercury\", \"Mars\"]\n\nplanet_list.append(\"Jupiter\")\nplanet_list.append(\"Saturn\")\nplanet_list.extend([\"Uranus\", \"Neptune\"])\nplanet_list.insert(1, \"Earth\")\nplanet_list.insert(1, \"Venus\")\nplanet_list.append(\"Pluto\")\ndel planet_list[-1]\n\nprint(planet_list)",
"planet_list = ['... | false |
8,496 | d7b830890400203ee45c9ec59611c0b20ab6bfc7 | import xadmin
from xadmin import views
from .models import EmailVerifyRecord, Banner
class BaseMyAdminView(object):
'''
enable_themes 启动更改主题
use_bootswatch 启用网上主题
'''
enable_themes = True
use_bootswatch = True
class GlobalSettings(object):
'''
site_title 左上角名称
site_footer 底部名称
... | [
"import xadmin\nfrom xadmin import views\n\nfrom .models import EmailVerifyRecord, Banner\n\n\nclass BaseMyAdminView(object):\n '''\n enable_themes 启动更改主题\n use_bootswatch 启用网上主题\n '''\n enable_themes = True\n use_bootswatch = True\n\n\nclass GlobalSettings(object):\n '''\n site_title 左上角名称\... | false |
8,497 | 35e61add90b5c12f94d5f8071f00d98316461dd6 | #!/usr/bin/python
from cagd.polyline import polyline
from cagd.spline import spline, knots
from cagd.vec import vec2
import cagd.scene_2d as scene_2d
from math import sin,cos,pi, sqrt
#returns a list of num_samples points that are uniformly distributed on the unit circle
def unit_circle_points(num_samples):
a = 2... | [
"#!/usr/bin/python\n\nfrom cagd.polyline import polyline\nfrom cagd.spline import spline, knots\nfrom cagd.vec import vec2\nimport cagd.scene_2d as scene_2d\nfrom math import sin,cos,pi, sqrt\n\n#returns a list of num_samples points that are uniformly distributed on the unit circle\ndef unit_circle_points(num_sampl... | false |
8,498 | 1253e052865860a6895f91204a70152745b04652 | # -*- coding: utf-8 -*-
from math import acos, pi, sqrt
from decimal import Decimal, getcontext
getcontext().prec = 30
class Vector(object):
NO_NONZERO_ELTS_FOUND_MSG = 'No nonzero elements found'
def __init__(self, coordinates):
try:
if not coordinates:
raise ValueError
self.coordin... | [
"# -*- coding: utf-8 -*-\n\nfrom math import acos, pi, sqrt\nfrom decimal import Decimal, getcontext\n\ngetcontext().prec = 30\n\nclass Vector(object):\n NO_NONZERO_ELTS_FOUND_MSG = 'No nonzero elements found'\n \n def __init__(self, coordinates):\n try:\n if not coordinates:\n raise ValueError\... | false |
8,499 | 15a7f6a63536ed24b6cf17395643476c689ec99b | N, M, T = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(M)]
now_time = 0
battery = N
ans = 'Yes'
for a, b in AB:
# カフェに付くまでにの消費
battery -= a-now_time
if battery <= 0:
ans = 'No'
break
# カフェでの充電
battery += b-a
battery = min(battery, N)
# 現... | [
"N, M, T = map(int, input().split())\nAB = [list(map(int, input().split())) for i in range(M)]\n\nnow_time = 0\nbattery = N\n\nans = 'Yes'\nfor a, b in AB:\n\n # カフェに付くまでにの消費\n battery -= a-now_time\n if battery <= 0:\n ans = 'No'\n break\n\n # カフェでの充電\n battery += b-a\n battery = mi... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.