seq_id
stringlengths
4
11
text
stringlengths
113
2.92M
repo_name
stringlengths
4
125
sub_path
stringlengths
3
214
file_name
stringlengths
3
160
file_ext
stringclasses
18 values
file_size_in_byte
int64
113
2.92M
program_lang
stringclasses
1 value
lang
stringclasses
93 values
doc_type
stringclasses
1 value
stars
int64
0
179k
dataset
stringclasses
3 values
pt
stringclasses
78 values
23179600632
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Nov 17 13:48:21 2020 @author: zuoxichen """ def get_array_numbers(integer): ''' Parameters ---------- int1 : integer int. Returns ------- a set that contains all the number in a part. ''' a=integer//3 ...
bic-potato/codeforces_learning
Python/未命名4.py
未命名4.py
py
518
python
en
code
0
github-code
90
72681504297
import re from flask import jsonify from sqlalchemy import text from db import db class IcuDevelopments: __build_obj = """ json_build_object( 'timestamp', agg.timestamp, 'inserted', agg.last_insert_date, 'last_updated', agg.last_update, 'num_hospitals'...
dbvis-ukon/coronavis
Backend/models/icuDevelopments.py
icuDevelopments.py
py
20,272
python
en
code
16
github-code
90
40674763444
import pandas as pd import time import math myinput = '2018_Speed_QCpassed.tsv' print("loading csv in to dataframe ... ") # load csv into pandas dataframe df1 = pd.read_csv(myinput, header=0, delimiter='\t') # count the number of times a gene is reported per patient and generate a df to hold the tally print("counting ...
AmyAmelia/Playground
SPEED_columnUpdate2.py
SPEED_columnUpdate2.py
py
2,571
python
en
code
0
github-code
90
30525517184
import pyomo.environ as pyo import numpy as np import random import time import copy import sys from matplotlib import pyplot as plt c = np.empty(1)#placeholder to define them as global d = np.empty(1) t = np.empty(1) f = np.empty(1) model = pyo.ConcreteModel() # This function reads the instance file and extracts all...
Maxlanglet/Proj_Combi
flp.py
flp.py
py
16,370
python
en
code
0
github-code
90
11785599904
"""The Game of Hog.""" from dice import four_sided, six_sided, make_test_dice from ucb import main, trace, log_current_line, interact GOAL_SCORE = 100 # The goal of Hog is to score 100 points. ###################### # Phase 1: Simulator # ###################### def roll_dice(num_rolls, dice=six_sided): """Si...
Seanxiaao/cs61a
projects/hog/hog.py
hog.py
py
11,648
python
en
code
0
github-code
90
18111385159
from collections import deque data = input() tmp = deque() se = list() ase = list() lakes = list() x = 0 #check start - end for a in data: if a == '\\': tmp.append(x) if a == '/' and len(tmp) > 0 : s = tmp.pop() se.append([s,x]) x += 1 se.sort() # analyse s -e if len(se) > 0 : ase.append(se[0]) ...
Aasthaengg/IBMdataset
Python_codes/p02266/s418978537.py
s418978537.py
py
831
python
en
code
0
github-code
90
18295989099
import math import sys input = sys.stdin.readline def isPrime(n): i = 2 flag = True while i * i <= n: if n % i == 0: flag = False break else: i += 1 return flag x = int(input()) while True: if isPrime(x): print(x) break else...
Aasthaengg/IBMdataset
Python_codes/p02819/s178001014.py
s178001014.py
py
339
python
en
code
0
github-code
90
33193857229
from application.models.UserPreference import UserPreference from application.utils.validation import BusinessValidationError from application.utils.check_headers import check_headers from application.database.database import db from flask_restful import fields, marshal_with from flask_restful import Resource from fla...
Vishvam10/ReMark-Backend
application/base_apis/UserPreferenceAPI.py
UserPreferenceAPI.py
py
3,617
python
en
code
1
github-code
90
71440951656
#!/usr/bin/env python3 import argparse import os import sys import shutil from time import time, sleep import cv2 CLEAR_SCREEN_CODE = '\x1b[2J' RESET_COLOR_CODE = '\x1b[0m' def grayscale(pixel): return '\x1b[48;5;%dm ' % (232 + pixel // (256 / 23)) def rgb(pixel): p = pixel // (256 / 5) return '\x1b[48;5...
Dront/term-video
play.py
play.py
py
1,749
python
en
code
0
github-code
90
18140690019
while True: value = list(map(int, str(input()).split())) if value[0] == -1 and value[1] == -1 and value[2] == -1: break sum = value[0] + value[1] if value[0] == -1 or value[1] == -1: print("F") elif sum >= 80: print("A") elif sum >= 65: print("B") elif sum...
Aasthaengg/IBMdataset
Python_codes/p02411/s770592116.py
s770592116.py
py
461
python
en
code
0
github-code
90
8605492592
name=input("Enter your name:") praise=int(input("Enter number of times you want to be praised:")) l1=[] l2=[] l3=[name]+["is"] l4=[] for n in range(1,praise+1): l1.append(n) pr1=input("Enter the phrase you want to praise yourself with:") l2.append(pr1) for i in range(len(l1)): l3+=[l1[i]]+[l2...
Pabsthegreat/python-class-11
combinationseasy.py
combinationseasy.py
py
357
python
en
code
0
github-code
90
18046644929
# ans = 売る可能性がある場所の数 = 売って利益が最大値になる可能性がある場所 # Tは関係ない N,T=map(int,input().split()) A=list(map(int,input().split())) # 売る場所を一つず右にずらす # それより前の場所の最安値を持っておく # 差分のmaxvalを満たす回数をカウント、maxvalが更新されたら回数は1に戻す INF=10**9+1 maxval=0 minval=INF ans=0 for i in range(1,len(A)): minval=min(A[i-1],minval) diff=A[i]-minval if diff>...
Aasthaengg/IBMdataset
Python_codes/p03946/s342361988.py
s342361988.py
py
590
python
ja
code
0
github-code
90
72736983017
# Utility Functions from random import randint def bits_to_int(bits): return int(sum([2 ** (len(bits) - i - 1) * bit for (i, bit) in enumerate(bits)])) def int_to_bits(number, bit_len=0): bits = [int(bit) for bit in list(bin(number))[2:]] if bit_len: bits = ([0] * (bit_len - len(bits))) + bits ...
kvietcong/pytorch-practice
simple-gan/utility.py
utility.py
py
574
python
en
code
0
github-code
90
28769896760
# The spec module # Manages specification to run things in lab import itertools import json import os from string import Template import pydash as ps from convlab.lib import logger, util SPEC_DIR = 'convlab/spec' ''' All spec values are already param, inferred automatically. To change from a value into param range, ...
ConvLab/ConvLab
convlab/spec/spec_util.py
spec_util.py
py
9,264
python
en
code
398
github-code
90
19511180376
from bitcoin.rpc import RawProxy import sys if (len(sys.argv) > 1): txid = sys.argv[1] else: txid = "0627052b6f28912f2703066a912ea577f2ce4da4caa5a5fbd8a57286c345c2f2" p = RawProxy() decoded_tx = p.decoderawtransaction(p.getrawtransaction(txid)) out_value = 0 for output in decoded_tx...
gertruda1/Python-bitcoinlib-project
1uzduotis.py
1uzduotis.py
py
692
python
en
code
0
github-code
90
74157135977
from selenium.webdriver.common.by import By import time link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/" def test_productpage_contains_button_basket(browser): browser.get(link) time.sleep(30) result = browser.find_elements(By.CSS_SELECTOR, "button.btn-add-to-basket") asser...
Thunderbo1t28/stepik_auto_test_multylanguage
test_items.py
test_items.py
py
356
python
en
code
0
github-code
90
13997936538
from selenium import webdriver from selenium.webdriver.support.ui import Select import os import time PATH = "../selenium/chromedriver.exe" driver = webdriver.Chrome(PATH) # visit page # click span w/ Search for Sections text # select option value 2020FA # select appropriate option value # click SUBMIT # get total pa...
jamisonvalentine/CSC490-Capstone-Project
data/scraping/src/wa_scraper.py
wa_scraper.py
py
2,714
python
en
code
2
github-code
90
27308704901
from gold.statistic.MagicStatFactory import MagicStatFactory from gold.statistic.Statistic import Statistic from gold.statistic.RawDataStat import RawDataStat from gold.track.TrackFormat import TrackFormatReq from gold.util.CustomExceptions import ShouldNotOccurError class BpLevelArrayRawDataStat(MagicStatFactory): ...
uio-bmi/track_rand
lib/hb/quick/statistic/BpLevelArrayRawDataStat.py
BpLevelArrayRawDataStat.py
py
1,448
python
en
code
1
github-code
90
17989681406
""" 中国大学 MOOC - 陈越、何钦铭-数据结构-起步能力自测题 自测 - 3 数组元素循环右移问题 wanghao 2022.08.16 """ # parse input s = input().split(' ') n, m = eval(s[0]), eval(s[1]) data = input().split(' ') # print m %= n if m == 0: print(' '.join(data)) else: print(' '.join(data[-m:]) + ' ' + ' '.join(data[:n - m]))
wanghao6736/LearningRepo
DataStructureAndAlgorithm/Self-testing/3-ArrayLoop.py
3-ArrayLoop.py
py
355
python
zh
code
0
github-code
90
7636148556
import logging import time from storageClient import DatastoreClient from patient import Patient from encounter import Encounter from medication import Medication from medication_dispense import MedicationDispense from report import DiagnosticReport from procedure import Procedure from observations import Observations ...
priyasingh16/Fully-Automated-GCP-Healthcare-API
FHIR/driver.py
driver.py
py
3,342
python
en
code
1
github-code
90
40192414169
#!/usr/bin/env python from __future__ import print_function import sys,os import re import gzip import bz2 import pickle import copy import logging import argparse import collections import numpy as np from pprint import pprint desc = 'Identify species-specific genes' epi = """DESCRIPTION: Updating a metaphlan3 databa...
leylabmpi/Struo2
bin/scripts/metaphlan_db_from_uniref.py
metaphlan_db_from_uniref.py
py
15,991
python
en
code
49
github-code
90
18424689459
import sys sys.setrecursionlimit(10 ** 7) input = sys.stdin.readline f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): a, b, c = map(int, input().split()) print("Yes" if a == b == c else "No") if __name__ == '__main__': resolve()
Aasthaengg/IBMdataset
Python_codes/p03079/s644362464.py
s644362464.py
py
251
python
en
code
0
github-code
90
25753497462
#!/usr/bin/env python3 # Created by: Liam Csiffary # Created on: May 20, 2021 # This program determines the sum of the users num plus # all the numbers preceding it down to 0 # get user num and reset the variables (only necessary # if making a loop) user_num = input("what is your number: ") total = 0 counter = 0 # ...
ICS3U-Programming-LiamC/Unit4-01-Python
sum_num.py
sum_num.py
py
997
python
en
code
0
github-code
90
33062488466
import numpy as np # noinspection PyUnresolvedReferences,PyPackageRequirements from .geometry import EX, EY, EZ, Box as _Box, GLOBAL_BOX as _GLOBAL_BOX class Box(_Box): __doc__ = _Box.__doc__ def __init__(self, center, wx, wy, wz, ex=EX, ey=EY, ez=EZ): _Box.__init__(self, center, wx, wy, wz, ex=ex, e...
rorni/mckit
mckit/box.py
box.py
py
1,483
python
en
code
3
github-code
90
18590899179
n = int(input()) a = list(map(int, input().split())) b = 0 by = 0 flg = 0 for i,j in enumerate(a): if abs(j) > abs(b): b = j by = i+1 if j > 0: flg = 1 else: flg = 0 ans = [] if flg == 1: x = min(a) if x < 0: for i in range(n): if a[i] != b: a[i] += b ans.append([by,i+1]) for i in range(...
Aasthaengg/IBMdataset
Python_codes/p03496/s662723486.py
s662723486.py
py
591
python
en
code
0
github-code
90
14886879386
# 21. 合并两个有序链表 # 将两个有序链表合并为一个新的有序链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。  # # 示例: # # 输入:1->2->4, 1->3->4 # 输出:1->1->2->3->4->4 # # 来源:力扣(LeetCode) # 链接:https://leetcode-cn.com/problems/merge-two-sorted-lists # 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 # Definition for singly-linked list. class ListNode: def __init__(self, x): ...
zhouyuzhouyu/leetcode
p21.py
p21.py
py
1,829
python
en
code
0
github-code
90
9642186387
##https://github.com/madmaze/pytesseract try: from PIL import Image except ImportError: import Image import pytesseract pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files (x86)\Tesseract-OCR\tesseract' #full path to your tesseract excutable img = Image.open('[Input your data name]') print(img) imgAr...
Jihyeon0928/imageprocessing_group3
tesseract_kjs.py
tesseract_kjs.py
py
597
python
en
code
0
github-code
90
9723257604
from character import * # comes with character_armor and character_stats from items import * from menu_placeholders import * # remove this later once all frames are set up from tkinter import * from tkinter.ttk import Combobox courier_new = 'Courier New' options_br = {'background': 'black', 'foreground': 'red'} # bl...
mmishere/Cyberpunk-2020-DM-Kit
__main__.py
__main__.py
py
22,235
python
en
code
1
github-code
90
18375984319
N = int(input()) A = list(map(int,input().split())) A.sort() mida = A[N//2-1] midb = A[N//2] if mida == midb: print(0) else: ans = midb-mida print(ans)
Aasthaengg/IBMdataset
Python_codes/p02989/s286713048.py
s286713048.py
py
158
python
en
code
0
github-code
90
35383530684
# -*- coding: utf-8 -*- from datetime import datetime from sqlalchemy import Column, Integer, String, DateTime from sqlalchemy.ext.declarative import declarative_base from application import engine Base = declarative_base() class UseCase(Base): __tablename__ = 'use_case' __table_args__ = { "mysql_en...
cnboysliber/AutoTest
application/model/use_case.py
use_case.py
py
3,574
python
en
code
4
github-code
90
7150366684
from utils import Jugador from src.const import barcos #class Game ?? : tamTablero = 10 # ambos tienen el mismo tamaöo de tablero j1 = Jugador(False, tamTablero, "Aída") ordena = Jugador(True, tamTablero, "PC") j1.initTablero() ordena.initTablero() for i, v in barcos.items(): print(i,v) j1.colocarBarcos(i,...
marinagoju/Battleship
backup/main.py
main.py
py
400
python
es
code
0
github-code
90
5064121119
from core.config.base import Format from core.output import * class JsAnalyzerReportInText(TxtOutput): def __init__(self, fileName): TxtOutput.__init__(self, fileName) def write(self, results): line = "*" * 50 for result in results.GetFilesHaveSensitives(): TxtOutp...
abdallah-elsharif/WRock
core/jsanalyzer/report.py
report.py
py
1,631
python
en
code
26
github-code
90
73269066535
import pygame import random from random import randint from time import * def midpoint(x1,y1,x2,y2): #function to comoute the midpoint x=(x1+x2)/2 y=(y1+y2)/2 return x,y black = (0, 0, 0) white = (255, 255, 255) green = (0, 255, 0) red = (255, 0, 0) pygame.init() size = [1024, 1024] screen=pygame.displ...
HarigovindV10/Fractal
ChaosGame.py
ChaosGame.py
py
1,077
python
en
code
0
github-code
90
29399690321
import gevent import sys import time from apscheduler.schedulers.gevent import GeventScheduler from toolz import partial from corens.ns import * from corens.mod import f, lf from corens.tpl import nsMk from corens.console import nsConsoleDaemon from corens.log import nsLogDaemon def nsGInput(ns): prompt = nsGet(ns...
vulogov/core.ns
corens/gevt.py
gevt.py
py
3,658
python
en
code
0
github-code
90
18020350179
def hasB(A, B, M, x, y): has = True for i in range(M): for j in range(M): if A[y + i][x + j] != B[i][j]: has = False return has N, M = list(map(lambda x: int(x), input().split(" "))) A = [] B = [] for i in range(N): A.append(list(input())) for j in range(M): B.append(list(input())) has = ...
Aasthaengg/IBMdataset
Python_codes/p03804/s747087360.py
s747087360.py
py
538
python
en
code
0
github-code
90
72208153898
""" 使用队列实现栈的下列操作: push(x) -- 元素 x 入栈 pop() -- 移除栈顶元素 top() -- 获取栈顶元素 empty() -- 返回栈是否为空 注意: 你只能使用队列的基本操作-- 也就是 push to back, peek/pop from front, size, 和 is empty 这些操作是合法的。 你所使用的语言也许不支持队列。 你可以使用 list 或者 deque(双端队列)来模拟一个队列 , 只要是标准的队列操作即可。 你可以假设所有操作都是有效的(例如, 对一个空的栈不会调用 pop 或者 top 操作)。 """ from collections import deque ...
Asunqingwen/LeetCode
简单/用队列实现栈.py
用队列实现栈.py
py
1,874
python
zh
code
0
github-code
90
5230653641
import os from flask import Flask, send_from_directory, abort app = Flask(__name__) @app.route("/techquest/<filename>") def get_file(filename): try: return send_from_directory( os.path.join(os.getcwd(), 'gi_python_dwh/reports'), filename=filename, as_attachment=True ...
alex-axel/TestGI
python_dwh/snap_datastream_center.py
snap_datastream_center.py
py
465
python
en
code
0
github-code
90
38333104925
# -------------- #Importing header files import pandas as pd import numpy as np import matplotlib.pyplot as plt #Path of the file data = pd.read_csv(path) data.rename(columns = {'Total':'Total_Medals'},inplace = True) data.head() # -------------- data['Better_Event']=np.where(data['Total_Summer']>data['Tot...
ThatCADataScientist/olympic-hero
code.py
code.py
py
2,892
python
en
code
0
github-code
90
19371464465
from torch.utils.data import Dataset class ISLES2018Dataset_MTT(Dataset): def __init__(self, folder, modalities=None): self.samples = [] for case_name in os.listdir(folder): case_path = os.path.join(folder, case_name) case = {} for file_path in os.listdi...
fzbuzz/HeMIS_ISLES2018
dataloader.py
dataloader.py
py
1,320
python
en
code
0
github-code
90
11029118033
from test.fixtures import * import pytest from mock import patch from data import model from data.users.shared import can_create_user @pytest.mark.parametrize( "open_creation, invite_only, email, has_invite, can_create", [ # Open user creation => always allowed. (True, False, None, False, Tr...
quay/quay
data/users/test/test_shared.py
test_shared.py
py
2,662
python
en
code
2,281
github-code
90
44364216735
import numpy as np import matplotlib.pyplot as plt from Environment import Environment from RL_brain import DQN import matplotlib.pyplot as plt MAX_EPISODES = 1 # 训练回合数 STATE_DIM_LIGHT = 4 # 状态维度:四个相位的停车数目 ACTION_DIM_LIGHT = 4 # [周期,四个相位的绿信比] MAX_ACTION = 1 # 输出动作边界 MEMORY_CAPACITY = 5000 # 记忆库大小 MAX...
H-9786/CVIS-DRL
DQN/test/run_this.py
run_this.py
py
8,626
python
en
code
10
github-code
90
74946804775
""" Problem 9 - Special Pythagorean triplet A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2 For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. """ def solution(): # a + b + c =...
yred/euler
python/problem_009.py
problem_009.py
py
636
python
en
code
1
github-code
90
15826805736
from random import randint #"def play_battleship():" #this code here will allow me to put the whole game code into a method/funtion so that for reqierment 5 i can replay the game if the user says yes. However when i implement this line of code i cant get the whole programe to run, so i am unsure of the issue. board =...
JakkCHN/JakkCHN
BattleShipsGame.py
BattleShipsGame.py
py
6,393
python
en
code
0
github-code
90
38419822604
import preprocessing as pp import transformers as tr import ensemble as em from cv_lab import score_sq from sklearn.pipeline import Pipeline import feature_selection as fs import numpy as np from sklearn.kernel_ridge import KernelRidge from xgboost import XGBRegressor import lightgbm as lgb from sklearn.svm import SVR,...
fpcarneiro/Kaggle-Python
House Prices - Advanced Regression Techniques/model_11343/house_prices.py
house_prices.py
py
8,059
python
en
code
1
github-code
90
75085722
import sys input=sys.stdin.readline N = int(input()) list_AB = [] list_B = [] dp = [0 for _ in range(N)] for i in range(N): list_AB.append(list(map(int, input().strip().split()))) list_AB.sort(key = lambda x : x[0]) for i in range(N): list_B.append(list_AB[i][1]) for i in range(N): for j in range(i): ...
YeongHyeon-Kim/BaekJoon_study
0830/2565_전깃줄.py
2565_전깃줄.py
py
428
python
en
code
1
github-code
90
18515135329
n,m = map(int, input().split()) t = [[n] for i in range(n)] for i in range(m): a,b = map(int, input().split()) t[a-1].append(b-1) g = [] for i in t: g.append(sorted(i)) k = 0 ans=0 while k <=n-1: e = n for i in g[k:]: e = min(e,i[0]) if e==n: break ans+=1 k = e print(ans)
Aasthaengg/IBMdataset
Python_codes/p03295/s772170597.py
s772170597.py
py
296
python
en
code
0
github-code
90
26960871687
from re import S import numpy as np import torch import jieba.posseg as posseg from torch.autograd import Variable import torch.nn as nn import json def multi_label_accuracy(outputs, label, config = None, result=None): if len(label[0]) != len(outputs[0]): raise ValueError('Input dimensions of labels and o...
fatcatofbupt/medical-algo-dev
datasets/clinical_criteria.py
clinical_criteria.py
py
10,502
python
en
code
null
github-code
90
35196645701
from django.urls import path, re_path from lesion_bank import views urlpatterns = [ ## Root and core pages path('', views.index_view, name='index'), path('faq/', views.faq, name='faq'), path('register/', views.RegisterView.as_view(), name='register'), ## Data imports and metadata editing ...
JosephIsaacTurner/LesionBank
lesion_bank/urls.py
urls.py
py
1,915
python
en
code
0
github-code
90
19292020775
from keras.models import Sequential, Model from keras.layers import Convolution2D, Input, merge from keras.callbacks import ModelCheckpoint from keras.utils.io_utils import HDF5Matrix from keras.optimizers import Adam from drcn_merge import DRCN_Merge BATCH_SIZE = 20 input_data = Input(batch_shape=(BATCH_SIZE, 1, 41,...
invisiblearts/DRCN
drcn_main.py
drcn_main.py
py
2,229
python
en
code
14
github-code
90
18297272229
N, K = map(int, input().split()) R, S, P = map(int, input().split()) T = input() li = [[] for _ in range(K)] for k in range(N): if T[k] == 'r': li[k%K].append([P, 'r']) elif T[k] == 's': li[k%K].append([R, 's']) else: li[k%K].append([S, 'p']) ans = 0 for k in range(K): j = 0 while j < len(li[k])-1...
Aasthaengg/IBMdataset
Python_codes/p02820/s780414101.py
s780414101.py
py
755
python
en
code
0
github-code
90
18397778699
N, K = map(int, input().split()) V = list(map(int, input().split())) ans = 0 for left in range(min(N, K) + 1): for right in range(min(N - left, K - left) + 1): tmp = V[:left] + V[N - right:] tmp.sort() score = 0 count = K - left - right for i in tmp: if count <= ...
Aasthaengg/IBMdataset
Python_codes/p03032/s294465256.py
s294465256.py
py
562
python
en
code
0
github-code
90
10684937912
####################################################### # Module: process.py # Description: definition of Process Class ####################################################### import numpy as np from pack.utilities.const import EN, EMIN from pack.utilities.bondCounting import bond_dicts, theta class Process: ...
Merlingot/kMC-simulation
pack/include/process.py
process.py
py
3,080
python
en
code
0
github-code
90
38226806883
import sys,os razdel = ['_',':',';'] def uniq(seq): seen = set() seen_add = seen.add return [x for x in seq if not (x in seen or seen_add(x))] def parol(words): new_words1 = [] for i in words: new_words1.append(i) new_words1.append(i[0].upper() + i[1:]) new_words1.append(i[0]...
Vladimir-Voronin/Different
Pycheck/4.py
4.py
py
903
python
en
code
0
github-code
90
18389759809
N, M = map(int, input().split()) A = [True] * (N + 1) for _ in range(M): a = int(input()) A[a] = False dp = [0] * (N + 1) dp[0] = 1 for i in range(N): for j in range(i + 1, min(N, i + 2) + 1): if A[j] is True: dp[j] += dp[i] dp[j] %= 10 ** 9 + 7 print(dp[N])
Aasthaengg/IBMdataset
Python_codes/p03013/s385788036.py
s385788036.py
py
306
python
en
code
0
github-code
90
73885055657
#!/usr/bin/env python3 import pickle import pandas as pd import numpy as np import evaluate_communities import argparse from plot_styles import basic_algorithms, clique_algorithms, dashed_algorithms def write_table(data, out_name): algos = list(filter(lambda x : x not in dashed_algorithms or x == "Cl", basic_alg...
kit-algo/LCD-cliques-experiments
time_table.py
time_table.py
py
1,391
python
en
code
3
github-code
90
4302299669
from stellargraph import datasets from pprint import pprint from stellar_graph_demo.gnn.train_gnn_functions import ( get_model_and_generator, create_gnn_generators_flows, train_gnn_model, evaluate_gnn_model_on_test_dataset, visualise_gnn_embedding, ) if __name__ == "__main__": """Trains the G...
CuriousKomodo/gnn_experiments
stellar_graph_demo/train_gnn.py
train_gnn.py
py
1,525
python
en
code
4
github-code
90
74442114856
import logging from flask import Flask, request app = Flask(__name__) # Configure logging to stdout logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s') @app.route('/', methods=['GET', 'POST']) def log_data(): if request.method == 'GET': logging.info(f"Received GET requ...
joaops95/morsecode
app.py
app.py
py
752
python
en
code
0
github-code
90
9519172612
# 백준 2493 import sys input = sys.stdin.readline n = int(input().rstrip()) tower = list(map(int, sys.stdin.readline().split())) stack = [] check = [0] * n for i in range(n): # 타워를 하나씩 본다 t = tower[i] while stack and tower[stack[-1]] < t: # 스택의 탑보다 현재 타워가 stack.pop() # 크면 계속 팝 if stack: # 스택이 남았으면 ...
whwogur/BOJ
2493.py
2493.py
py
571
python
ko
code
0
github-code
90
18057079439
s = list(input()) k = int(input()) #print(ord("z")) for i in range(len(s)): if s[i] != 'a' and 123 - ord(s[i]) <= k: k -= (123 - ord(s[i])) s[i] = "a" #print(k) #print(s, k) k %= 26 if ord(s[-1]) + k > 122: s[-1] = chr(ord(s[-1]) + k - 26) else: s[-1] = chr(ord(s[-1]) + k) ans = "" for i in s: ans +...
Aasthaengg/IBMdataset
Python_codes/p03994/s255807477.py
s255807477.py
py
334
python
en
code
0
github-code
90
17449809167
from cleo import Command import pika import json import requests import os import csv from lxml import html import psycopg2 import re LOOKUP_URL = 'https://osm-dev.eos.com/nominatim/lookup?osm_ids={}&format=json' DETAILS_URL = 'https://osm-dev.eos.com/nominatim/details.php?place_id={}' class WorkerCommand(Command): ...
filevgenij/osm-update-tsv
app/command/WorkerCommand.py
WorkerCommand.py
py
5,610
python
en
code
0
github-code
90
14065049501
import numpy as np import pytest from iris.coords import AuxCoord, CellMethod # Test successful outputs (input cubes in alphabetical order by fixture) from improver.developer_tools.metadata_interpreter import SPOT_COORDS def test_realizations(ensemble_cube, interpreter): """Test interpretation of temperature rea...
metoppv/improver
improver_tests/developer_tools/test_MOMetadataInterpreter.py
test_MOMetadataInterpreter.py
py
23,908
python
en
code
95
github-code
90
72208019498
""" 给定一个链表,旋转链表,将链表每个节点向右移动 k 个位置,其中 k 是非负数。 示例 1: 输入: 1->2->3->4->5->NULL, k = 2 输出: 4->5->1->2->3->NULL 解释: 向右旋转 1 步: 5->1->2->3->4->NULL 向右旋转 2 步: 4->5->1->2->3->NULL 示例 2: 输入: 0->1->2->NULL, k = 4 输出: 2->0->1->NULL 解释: 向右旋转 1 步: 2->0->1->NULL 向右旋转 2 步: 1->2->0->NULL 向右旋转 3 步: 0->1->2->NULL 向右旋转 4 步: 2->0->1->NUL...
Asunqingwen/LeetCode
中等/旋转链表.py
旋转链表.py
py
1,279
python
en
code
0
github-code
90
18278646669
H = int(input()) num = {} lis = [H] h = H while h > 1: h //= 2 num[h] = 0 lis = [h] + lis num[1] = 1 for n in lis[1:]: num[n] = 2*num[n//2] + 1 print(num[H])
Aasthaengg/IBMdataset
Python_codes/p02786/s688481554.py
s688481554.py
py
178
python
en
code
0
github-code
90
74206655976
# -*- coding: utf-8 -*- """ Write a program in Python to find mean, median and mode without importing additional #module. @author: Sagnik """ #mean def mean(a): b=len(a) sum=0 for i in range (0,b): sum+=a[i] avg = sum/b print("Mean:",avg) #median def median(a): ...
codehopperreddit/DataScienceusingpython
3.py
3.py
py
864
python
en
code
0
github-code
90
33042872912
# 피보나치 수 n = int(input()) store = [] for i in range(n + 1): if i in (0, 1): store.append(i) else: store.append(store[i - 2] + store[i - 1]) print(store[n])
kyw624/algorithm
BOJ/legacy/bronze/2747.py
2747.py
py
193
python
ko
code
0
github-code
90
29849323740
import numpy as np import Simulators, Logger, Evaluators import warnings import argparse import pickle import sys class OfflineExp(object): def __init__(self, n=1000, K=10, L=5, dataset="synth", feat_noise=0.25, reward_noise=1.0): self.n = n self.K = K self.L = L self.weight = np.ar...
akshaykr/oracle_cb
OfflineExp.py
OfflineExp.py
py
4,258
python
en
code
29
github-code
90
18266781079
# C - Rally n = int(input()) x = list(map(int,input().split())) c = [] x_ave = int(sum(x)/n) s = 0 for i in range(n): s += (x[i]-x_ave)**2 c.append(s) s = 0 for i in range(n): s += (x[i]-x_ave-1)**2 c.append(s) print(min(c))
Aasthaengg/IBMdataset
Python_codes/p02767/s982785556.py
s982785556.py
py
237
python
en
code
0
github-code
90
11643446936
import psycopg2 from mqtt2psql.data import PlugSensor, PlugState class PlugsSql: def __init__( self, host: str, user: str, password: str, database: str ): self.conn = psycopg2.connect( dbname = database, host = host, user = use...
polygon/mqtt2psql
mqtt2psql/plugs_sql.py
plugs_sql.py
py
2,233
python
en
code
0
github-code
90
36270130477
import dataclasses import itertools import logging from celery import shared_task from django.db import transaction from magiccube.collections.cubeable import cardboardize from magiccube.laps.traps.trap import CardboardTrap, IntentionType from elo.utils import rescale_eloeds, adjust_eloeds from api.models import C...
guldfisk/cubeapp
rating/tasks.py
tasks.py
py
8,790
python
en
code
1
github-code
90
8531627957
# var = open('info.txt','r') # var1 = open('hello.txt','w') # var1.write(var.read()) # var1.close() # var1 = var.read() # This variable object is storing the information present in the file. # If you familiar with the concept of pointers then here this variable var is actually a pointer to this file. # Basically i...
yashu762001/Python-Tutorial
FileHandling/ReadingToAFile.py
ReadingToAFile.py
py
1,109
python
en
code
1
github-code
90
40026521796
class Solution: def permute(self, nums): """ :type n: int :rtype: List[str] """ self.result=list() self.step(list(),nums) return self.result def step(self,state,bag): if len(bag)==0: self.result.append(state) return ...
lanpartis/LeetCodePractice
46.py
46.py
py
512
python
en
code
0
github-code
90
34562623459
''' Learning Generic Sentence Representations Using Convolutional Neural Networks https://arxiv.org/pdf/1611.07897.pdf Developed by Zhe Gan, zhe.gan@duke.edu, April, 19, 2016 ''' #import os import time import logging import cPickle import numpy as np import theano import theano.tensor as tensor from model.autoencod...
zhegan27/ConvSent
train_autoencoder.py
train_autoencoder.py
py
8,982
python
en
code
34
github-code
90
9917462086
import ccxt import time import pandas as pd import os from requests import Request, Session from requests.exceptions import ConnectionError, Timeout, TooManyRedirects import json # region API KEY Binance_API_KEY = "90IGrd6MtBRv1ZPOgAWjQv8Zo8grIBTPMTkDQ8bWYkUW3NDFNQ8gcdaouDGKjCFr" Binance_SECRET_KEY = "T37EykRUnTJWl7AU...
taewoo0703/CryptoTradingManager
DataScraper.py
DataScraper.py
py
12,105
python
en
code
0
github-code
90
41188806307
import scrapy import csv import urllib.parse import re class CassavaPriceSpider(scrapy.Spider): name = 'cassava_spider' start_urls = ['http://www.oae.go.th/view/1/%E0%B8%A3%E0%B8%B2%E0%B8%84%E0%B8%B2%E0%B8%AA%E0%B8%B4%E0%B8%99%E0%B8%84%E0%B9%89%E0%B8%B2%E0%B8%A3%E0%B8%B2%E0%B8%A2%E0%B8%A7%E0%B8%B1%E0%B8%99/%E...
napatwongchr/price-scraper
cassava_spider.py
cassava_spider.py
py
2,014
python
en
code
0
github-code
90
10042764973
flags = [ '-Wall', '-Werror', '-std=c11', # std is required # clang won't know which language to use compiling headers # '-x' and 'c++' also required # use 'c' for C projects 'c', '-I./', '-I./antisaccades', '-I/opt/local/include/', '-I/usr/local/MATLAB/R2017a/extern/include', '-I/Applications/MATLAB_R2017b.app/extern...
translationalneuromodeling/tapas
sem/src/.ycm_extra_conf.py
.ycm_extra_conf.py
py
669
python
en
code
194
github-code
90
42196918857
import os p = r'E:\учёба\python' lst = os.listdir(p) s = [] for i in lst: s.append(os.path.join(p, i)) k = 0 while k < len(s): if os.path.isdir(s[k]): print(f'{lst[k]} - dir.') if os.path.isfile(s[k]): print(f'{lst[k]} - file - {os.path.getsize(s[k])} bytes.') k += 1
alexeiakimenko/portfolio
HomeWork/hw13.03/scan.py
scan.py
py
306
python
en
code
0
github-code
90
31809327679
"""Support for Anthem Network Receivers and Processors.""" from __future__ import annotations import logging from anthemav.connection import Connection from anthemav.protocol import AVR from homeassistant.components.media_player import ( MediaPlayerDeviceClass, MediaPlayerEntity, MediaPlayerEntityFeature...
Hyralex/hass-anthemav
anthemav_custom/media_player.py
media_player.py
py
4,892
python
en
code
5
github-code
90
18194194119
# from sys import stdin # input = stdin.readline from collections import Counter MOD = 10**9 + 7 MAX = 2000001 def solve(): k = int(input()) s = input().strip() ns = len(s) res = 0 fac = [1,1] + [0] * MAX inv = [1,1] + [0] * MAX for i in range(2,MAX+1): fac[i] = fac[i-1] * i % MOD ...
Aasthaengg/IBMdataset
Python_codes/p02632/s051151356.py
s051151356.py
py
757
python
en
code
0
github-code
90
74691600295
import torch import torch.nn as nn import torch.nn.functional as F class Latent2Class(nn.Module): def __init__(self, cls=1000) -> None: super().__init__() self.cls = nn.Sequential( nn.Linear(2048, 1000), nn.Softmax() ) def forward(self, x): x = x.permut...
cddchen/MAE
latent2class_model.py
latent2class_model.py
py
416
python
en
code
0
github-code
90
26924755745
import re from django.shortcuts import redirect,HttpResponse from django.conf import settings class MiddlewareMixin(object): def __init__(self, get_response=None): self.get_response = get_response super(MiddlewareMixin, self).__init__() def __call__(self, request): response = None ...
wangxingping123/crmpro
app01/middleware/middle.py
middle.py
py
997
python
en
code
0
github-code
90
14618734806
import time from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait import os import pathlib target_path = './hanime_images/' driver_path = "./chromedriver" image_links = [] def init_driver(): driver = webdriver.Chrome(executable_path=driver_path) driver.wait = WebDriverWait(dr...
Kingularity/hanime-scraper
hanime.py
hanime.py
py
4,164
python
en
code
3
github-code
90
11618136646
import time from requests import get from pandas import read_excel inicio = time.time() arquivo = read_excel('Telecom.xlsb') #ler arquivo em excel, que deverá estar na mesma pasta onde o programa for executado e com o mesmo nome. count = 0 for seq, coluna in arquivo.iterrows(): link = get(coluna['link']) nome...
Dawisonms/Python
Aprendix/Versoes/Aprendix3.1.py
Aprendix3.1.py
py
782
python
pt
code
1
github-code
90
15772322556
import numpy as np def get_wrapped_slice(arr, x_start, x_end, y_start, y_end): height, width = arr.shape[0], arr.shape[1] x_start, x_end = x_start % width, x_end % width y_start, y_end = y_start % height, y_end % height if x_start < x_end and y_start < y_end: return arr[y_start:y_end, x_start:x_end] ...
Hexcss/personal_py_ecosystem_simulation
utils/functions/functions.py
functions.py
py
655
python
en
code
0
github-code
90
37595266
#从Aminer提供的数据中挖掘出所有学者以及他们之间的关系 import json def fetch_authors(lines): authors = [] for line in lines: list = line.split("\"") author_pair = [] author_pair.append(int(list[0].strip())) author_pair.append(list[1]) author_pair.append(int(list[2].strip())) authors.app...
leezythu/Nodefocus
backend/data/process_data.py
process_data.py
py
3,021
python
en
code
5
github-code
90
28756567738
import pytest import datetime import calendar @pytest.fixture() def sns_event_success(): return { "Records": [ { "EventSource": "aws:sns", "EventVersion": "1.0", "EventSubscriptionArn": "arn:aws:sns:ap-northeast-1:705427061380:oura-score-get-noti...
Akiyoshi999/Oura_data_get_for_AWS
tests/unit/conftest.py
conftest.py
py
3,539
python
en
code
0
github-code
90
42256590977
from qgis.PyQt.QtCore import Qt, QUrl from qgis.PyQt.QtGui import QColor from qgis.core import Qgis, QgsCoordinateTransform, QgsProject, QgsSettings from qgis.gui import QgsMapToolEmitPoint, QgsVertexMarker from .util import epsg4326, tr from .settings import settings import os import webbrowser import tempfile import ...
NationalSecurityAgency/qgis-latlontools-plugin
showOnMapTool.py
showOnMapTool.py
py
4,776
python
en
code
283
github-code
90
25688235443
# DO NOT MODIFY THIS CLASS import datetime from DB import DBAccess from .tools import static_initializer @static_initializer class UserDataAccess: @classmethod def static_init(cls): cls.__table_name = 'users' cls.__table_description = ['client_id', 'date_of_birth', 'email_address'...
ssjinkaido/ProgrammingTechniques
Part2/project/LegacyApp/UserDataAccess.py
UserDataAccess.py
py
1,073
python
en
code
0
github-code
90
72367682538
from conexao.conexaoBD import ConexaoBD class MonitorTutorDao: _conexaoBD = ConexaoBD() _conexao = _conexaoBD.criarConexao() def __init__(self): pass def AdicionarMonitorTutor(self, vetorAtributos): cursor = self._conexao.cursor() sql = "INSERT INTO interprete (int_id, int_nom...
ArthurOliveira173/Repositorio-Estagio
dao/monitorTutorDao.py
monitorTutorDao.py
py
1,701
python
en
code
0
github-code
90
39253655208
from package.setlist_data import data from package.models import * def make_artists(data): list_of_artists = [] for item in data: if item['artist']['name'] not in set([art.name for art in list_of_artists]): list_of_artists.append(Artist(name = item['artist']['name'])) return list_of_art...
davidmasse/international-artists
etl_old.py
etl_old.py
py
3,340
python
en
code
0
github-code
90
1370371831
from django.http import HttpResponse from tastypie.exceptions import BadRequest from tastypie.utils import is_valid_jsonp_callback_value from tastypie.utils.mime import determine_format, build_content_type from core.api.serializers import HTMLSerializer from .constants import ERRORS def error_response(request, err...
gannetson/poc
source/core/api/functions.py
functions.py
py
1,223
python
en
code
1
github-code
90
18407021539
N, M = map(int, input().split()) G = [[] for _ in range(N)] for i in range(M): x, y, z = map(int, input().split()) G[x-1].append(y-1) G[y-1].append(x-1) lst = [] visited = [0]*N for i in range(N): if visited[i] == 1:continue temp = [i] lst1 = [i] visited[i] = 1 while temp: p = ...
Aasthaengg/IBMdataset
Python_codes/p03045/s761887424.py
s761887424.py
py
534
python
en
code
0
github-code
90
11407765201
from abc import ABC, abstractmethod import keras def age_relu(x): return keras.backend.relu(x, max_value=100) STANDARD_CLASSES = { "gender": 2, # "age": 5, "age": 1, "ethnicity": 4, "emotion": 7 } STANDARD_ACT = { "gender": "softmax", # "age": "softmax", "age": age_relu, "eth...
gdiprisco/Multitask_CNNs_for_efficient_face_analysis_in_the_wild
training/model_abstract.py
model_abstract.py
py
4,197
python
en
code
1
github-code
90
35859359557
#This file will need to use the DataManager,FlightSearch, FlightData, NotificationManager classes to achieve the program requirements. from pprint import pprint from data_manager import DataManager from flight_search import FlightSearch from notification_manager import NotificationManager import datetime as dt ORIGIN...
fkajose/100-Days-of-Code
40. Flight Club/main.py
main.py
py
1,951
python
en
code
1
github-code
90
18528130719
n = int(input()) sum_min = 100000 for i in range(1,n): i_sum = 0; j_sum = 0 j = n-i i = str(i); j = str(j) for k in range(len(i)): i_sum += int(i[k]) for k in range(len(j)): j_sum += int(j[k]) tmp_sum = i_sum + j_sum if sum_min >tmp_sum : sum_min = tmp_sum print(sum_...
Aasthaengg/IBMdataset
Python_codes/p03331/s847419598.py
s847419598.py
py
324
python
en
code
0
github-code
90
31293945202
import telebot import const bot = telebot.TeleBot(const.token) print(bot.get_me()) @bot.message_handler(content_types=['text']) def handle_text(message): if message.text == "User_Message": bot.send_sticker(message.chat.id, const.Sticker_id) bot.polling(none_stop=True, interval=0)
Junkwolves/Telegram-Bot
Message_Sticker/Message_Sticker.py
Message_Sticker.py
py
304
python
en
code
0
github-code
90
29632356411
import numpy as np def swap(a, i, j): temp = np.copy(a[i, 0:]) a[i, 0:] = a[j, 0:] a[j, 0:] = temp print("Example input : 1,2,3,4") row1 = list(eval(input("Row 1: "))) row2 = list(eval(input("Row 2: "))) row3 = list(eval(input("Row 3: "))) a = np.array([row1, row2, row3], float) swap(a, 0, 2) print(a...
jayGetsuka/Home-work-1
Matrix.py
Matrix.py
py
850
python
en
code
0
github-code
90
24465213502
from PyQt4 import QtGui from fancytools.os.PathStr import PathStr #own from RunTutorial import RunTutorial from CreateTutorial import CreateTutorial class TutorialMenu(QtGui.QMenu): ''' A QMenu containing * 'Run' - listing all saved tutorials to run * 'Create/Edit' - open the ...
radjkarl/interactiveTutorial
interactiveTutorial/TutorialMenu.py
TutorialMenu.py
py
4,522
python
en
code
1
github-code
90
37632139343
import pandas as pd df = pd.read_csv('merged.csv') df.drop(['Unnamed: 0', 'Luminosity'], axis = 1, inplace = True) final_data = df.dropna() print(final_data.describe()) final_data.to_csv('final.csv')
Zackster310/Star-WebScraping-Merged
clean.py
clean.py
py
214
python
en
code
0
github-code
90
8136370121
import numpy as np import sympy as sp x = sp.symbols('x') funcion = sp.sympify("2*x-4*sin(x)") intervaloUno = int(input("Ingrese el intervalor inferior")) intervaloDos = int(input("Ingrese el intervalor superior")) n = 0 tabla = [] if funcion.subs(x,intervaloUno)*funcion.subs(x,intervaloDos) < 0: cifras =-1 ...
Moises-png993/AnalisisNumerico
Ejercicio_Biseccion.py
Ejercicio_Biseccion.py
py
1,303
python
es
code
0
github-code
90
15300499163
#!/usr/bin/env python2 import cv2 # from rrt import map_img import numpy as np import rrt import rospy from nav_msgs.msg import OccupancyGrid def extend_obstacles(my_map, radius): # Threshold the grayscale image to get the binary map _, binary_map = cv2.threshold(my_map, 127, 255, cv2.THRESH_BINARY_INV) ...
rpalfini/EECS_221
src/TurtleBot/scripts/test_obstacle_radius_exten.py
test_obstacle_radius_exten.py
py
2,261
python
en
code
0
github-code
90