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
30443738428
#!/usr/bin/env python # coding: utf-8 import tensorflow_datasets as tfds import tensorflow as tf from tensorflow.keras.layers import Dense, Flatten, Conv2D from tensorflow.keras import Model #使用tensorflow dataset加载数据 dataset, info = tfds.load('fashion_mnist', with_info=True, as_supervised=True) #查看训练数据和标签信息 print(inf...
easytf/enjoy_tensorflow
tf2.0/tf5/fashion-mnist-advanced.py
fashion-mnist-advanced.py
py
3,599
python
en
code
0
github-code
90
70297693738
# 중복 순열 # 연산기호들의 모든 경우의 수를 product로 구한다. import sys from itertools import product input = sys.stdin.readline T = int(input().rstrip()) for _ in range(T): n = int(input().rstrip()) operators = [' ', '+', '-'] array = [i for i in range(1, n+1)] for i in product(operators, repeat=n-1): ...
JKbin/Study-of-Coding-with-Python
BaekJoon/Gold_V/7490-1.py
7490-1.py
py
586
python
ko
code
0
github-code
90
18332000129
N = int(input()) L = list(map(int,input().split())) L.sort() cnt = 0 for i in range(N-2): for j in range(i+1,N-1): h_min = j h_max = N while h_max - h_min != 1: h_mid = (h_max + h_min) // 2 if L[i] + L[j] > L[h_mid]: h_min = h_mid else: ...
Aasthaengg/IBMdataset
Python_codes/p02888/s807860397.py
s807860397.py
py
382
python
en
code
0
github-code
90
18406809029
class UnionFind: def __init__(self, n): '木の初期化をする' self.p = [-1] * n self.rank = [1]*n self.root = n def find(self, x): 'x の親を返す' if self.p[x] == -1: return x else: self.p[x] = self.find(self.p[x]) return self.p[x] ...
Aasthaengg/IBMdataset
Python_codes/p03045/s480898558.py
s480898558.py
py
998
python
en
code
0
github-code
90
18373340049
import sys input = sys.stdin.readline sys.setrecursionlimit(10**8) N,K = map(int,input().split()) AB = [tuple(map(int,input().split())) for i in range(N-1)] es = [[] for _ in range(N)] for a,b in AB: a,b = a-1,b-1 es[a].append(b) es[b].append(a) MOD = 10**9+7 ans = K def rec(v,p=-1,d=0): global ans ...
Aasthaengg/IBMdataset
Python_codes/p02985/s021525263.py
s021525263.py
py
482
python
en
code
0
github-code
90
2365128370
# auto grade sat tests def innput(number): ''' number -> number of questions return: a list of answers, warning raised if it's not complete ''' answers = [] i = 0 while len(answers) != number: if i>0: print('!WARNING: Not complete! ReType it!') answers.clear()...
CarlatBuffalo/AutoGrade
AutoGrade.py
AutoGrade.py
py
2,754
python
en
code
0
github-code
90
302603305
import collections import warnings from lxml import etree import myokit import myokit.formats.mathml import myokit.formats.cellml as cellml import myokit.formats.cellml.v1 from myokit.formats.xml import split def parse_file(path): """ Parses a CellML 1.0 or 1.1 model at the given path and returns a :cl...
myokit/myokit
myokit/formats/cellml/v1/_parser.py
_parser.py
py
43,407
python
en
code
29
github-code
90
14323168367
import isobmfflib import sys from isobmfflib import log import os arg_infile = sys.argv[1] #input heif file, next arg is infile name arg_outdir = sys.argv.index('-outdir') if '-outdir' in sys.argv[2:] else 0 #destination directory arg_map = sys.argv.index('-map') if '-map' in sys.argv[2:] else 0 ...
PawQualityProducts/HeifER
Prototype/HeifER/heifer_test.py
heifer_test.py
py
5,752
python
en
code
0
github-code
90
14685511290
#!/usr/bin/env python3 from pwn import * from hashlib import sha256 import re import time exe = ELF("chall") context.binary = exe context.terminal = "kitty" def solvepow(p, n): s = p.recvline() starting = s.split(b'with ')[1][:10].decode() s1 = s.split(b'in ')[-1][:n] i = 0 print("Solving PoW..."...
tsheinen/tsheinen.github.io
static/ctf/m0lecon-2021-teaser/another_login/solve.py
solve.py
py
1,124
python
en
code
0
github-code
90
43397651467
#! /usr/bin/python3 import requests, json BASEURL = "http://localhost:8983/solr/OAG" def getLatestIds(query="*:*"): url = BASEURL + "/select" querystring = {"q":query, "fl": "id", "start": 1430000, "rows": 14163} ids_list = None response = requests.request("GET", url, params=querystring) json_data = json.loads...
sleek-geek/Rosetta
solrLib.py
solrLib.py
py
729
python
en
code
0
github-code
90
25588600614
import os import time from six import string_types class DirWatcher(object): """Helper to watch a (set) of directories for modifications.""" def __init__(self, paths): if isinstance(paths, string_types): paths = [paths] self._done = False self.paths = list(paths) ...
grpc/grpc
tools/run_tests/python_utils/watch_dirs.py
watch_dirs.py
py
1,578
python
en
code
39,468
github-code
90
13090478555
from sys import maxsize as MAX_INT def findMinimumVertex(weights, visited): minVertex = None for i in range(len(weights)): if (visited[i] is False): if (minVertex is None or weights[i] < weights[minVertex]): minVertex = i return minVertex def prim(adjMatrix, nVertices...
magdumsuraj07/data-structures-algorithms
algorithms/graph/PrimsMST.py
PrimsMST.py
py
1,136
python
en
code
0
github-code
90
18306211099
import sys input = sys.stdin.readline from collections import defaultdict, deque n, a, s, h = int(input()), [], [], [] for i in range(n): a.append(int(input())); s.append(list(list(map(int, input().split())) for _ in range(a[i]))) for i in range(2 ** n): flag = False for j in range(n): if (i >> j) & 1:...
Aasthaengg/IBMdataset
Python_codes/p02837/s867776330.py
s867776330.py
py
480
python
en
code
0
github-code
90
41675279361
import os import sys import pickle ents = open('dataset_ents.txt','r').readlines() ent_pairs = [] ent_pairs_train = open('/afs/crc.nd.edu/group/dmsquare/vol3/xdong2/graph2seq/nqgln/data/redistribute/QG/train/mention_train.txt.source.txt','r').readlines() ent_pairs_dev = open('/afs/crc.nd.edu/group/dmsquare/vol3/xdong...
xdong2ps/KgGen
read_kg.py
read_kg.py
py
2,331
python
en
code
0
github-code
90
33946610697
#!/usr/bin python3 import rospy from custom_msg_cpp_pkg.msg import JointAngle def talker(): pub = rospy.Publisher('/joint_angle', JointAngle, queue_size=10) rospy.init_node('py_topic_publisher', anonymous=True) rate = rospy.Rate(10) # 10hz number_count = 1 while not rospy.is_shutdown(): ms...
ake1999/Robotics_Course_ROS_2023
demo_ros_basics/custom_msg_py_pkg/scripts/python_topic_publisher.py
python_topic_publisher.py
py
662
python
en
code
3
github-code
90
75054175656
""" https://www.wwt.com/article/rest-api-integration-testing-using-python """ """ 1. pytest --> test all python files of that dir where names of files are started with test_ 2. pytest test_abc.py 3. pytest -v 4. pytest -sv --html report.html 5. pytest -s --> able to print() in testing """ BASE_URL='https://todo.pixe...
Utsavch189/Advance-Python
testing/rapid-api-testing/test_rest_api.py
test_rest_api.py
py
2,440
python
en
code
2
github-code
90
9255143809
import sys from PySide2.QtCore import QThread,Signal import asyncio import websockets import json import time import threading Clients =[] class SocketThread(QThread): thread = "" websocket = "" server = None finished = Signal(str,object) host = '127.0.0.1' port = 8989 def __init__(self,...
pan-goofy/proUsb-py-32-dll-api
web_socket.py
web_socket.py
py
3,452
python
en
code
2
github-code
90
18523221469
n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(n): x = 0 ai = a[i] while(ai%2==0): ai = ai//2 x+=1 ans+=x print(ans)
Aasthaengg/IBMdataset
Python_codes/p03325/s787802882.py
s787802882.py
py
178
python
en
code
0
github-code
90
22473908647
#!/usr/bin/env python3 file = open('Python_06.fastq.txt','r') lineCount = 0 charCount = 0 for line in file: lineCount += 1 charCount += len(line.rstrip()) print('lines:',lineCount) print('chars:',charCount) print('ave line len:',charCount/lineCount)
mrwaas/PFB_problem_sets
Python_06/ps6q4.py
ps6q4.py
py
259
python
en
code
0
github-code
90
6573703390
import datetime from chatbot.chat_utils import ChatUtils from chatbot.station_utils import StationUtils from common.ot_gtfs_utils import get_trips_from_to from . import chat_step class DestinationStationStep(chat_step.ChatStep): @staticmethod def get_name(): return 'destination_station' ...
hasadna/OpenTrainCommunity
train2/chatbot/steps/destination_station_step.py
destination_station_step.py
py
4,868
python
en
code
24
github-code
90
8619082474
from flask_login.utils import login_required from . import main from flask import render_template, redirect, url_for, flash from flask_login import login_required, current_user from datetime import date from .forms import QuestionForm from .. import db from ..models import User @main.route("/") def index(): if not...
RafalKornel/NoNugatNotifier
app/main/views.py
views.py
py
2,459
python
en
code
1
github-code
90
73405583336
import nltk import numpy as np import spacy import random import math def get_data(file): f = open(file) mat = [] for line in f: sentence = nltk.word_tokenize(line) sentence = [word.lower() for word in sentence] mat.append(sentence) f.close() return mat def shuffle(data, porcentage = 0.7): random.shuffle(...
ArielM24/pln-reg-log
reg_log.py
reg_log.py
py
2,858
python
en
code
0
github-code
90
24996493878
# SPDX-License-Identifier: MIT import struct from construct import * from m1n1.utils import * from m1n1.proxyutils import * from m1n1.constructutils import * from m1n1.trace.asc import ASCTracer, EP, EPState, msg, msg_log, DIR from m1n1.trace.dockchannel import DockChannelTracer from m1n1.trace.dart import DARTTracer ...
eiln/m1n1
proxyclient/hv/trace_mtp.py
trace_mtp.py
py
4,575
python
en
code
null
github-code
90
39035555388
from fastapi import APIRouter from managers.user import UserManager from schemas.request.user import UserRegisterIn, UserLoginIn router = APIRouter(tags=["Auth"]) # Saves the user into the database and passes to authenication manager # Authentication manager should return the login token @router.post("/register/", ...
keithdavis92/portfolio
FastAPIComplaintSystem/resources/auth.py
auth.py
py
635
python
en
code
0
github-code
90
27924333001
import torch from .Module import Module from .utils import clear class SoftSign(Module): def __init__(self): super(SoftSign, self).__init__() self.temp = None self.tempgrad = None def updateOutput(self, input): if self.temp is None: self.temp = input.new() ...
sibozhang/Text2Video
venv_vid2vid/lib/python3.7/site-packages/torch/legacy/nn/SoftSign.py
SoftSign.py
py
916
python
en
code
381
github-code
90
18306445129
# -*- coding: utf-8 -*- """ D - Xor Sum 4 https://atcoder.jp/contests/abc147/tasks/abc147_d """ import sys def solve(N, A): MOD = 10**9 + 7 bit_len = max(map(int.bit_length, A)) ans = 0 for i in range(bit_len): zeros, ones = 0, 0 for a in A: if (a & 1<<i): ...
Aasthaengg/IBMdataset
Python_codes/p02838/s140757703.py
s140757703.py
py
614
python
en
code
0
github-code
90
13503810507
""" Iterate over a random sample of the parameter space """ import numpy as np from kernel_tuner.searchspace import Searchspace from kernel_tuner.strategies.minimize import _cost_func from kernel_tuner import util def tune(runner, kernel_options, device_options, tuning_options): """ Tune a random sample of sample...
webclinic017/kernel_tuner
kernel_tuner/strategies/random_sample.py
random_sample.py
py
2,050
python
en
code
null
github-code
90
71432247338
from src.game.level.level import Level from src.management.scene import Scene from src.game.dice import Dice from src.common import * class MainGame(Scene): def setup(self) -> None: super().setup() self.spracks = [] self.player = Dice(self) self.level = Level(self, 1) print...
DaNubCoding/The-Dungeon-of-Die-Reimagined
src/game/main_game.py
main_game.py
py
666
python
en
code
0
github-code
90
31800617621
# favorite_sports = {} # print(type(favorite_sports)) # favorite_sports = { # 'sepehr': 'football', # 'pendar': 'basketball', # 'nika': 'tennis', # 'iliya': 'football', # 'atay': 'pingpong', # } # print(favorite_sports['iliya']) # print(favorite_sports['sepehr']) # print(favorite_sports['atay']) ...
mostafa-sadeghi/810
about_dictionary.py
about_dictionary.py
py
1,741
python
fa
code
0
github-code
90
43314616463
from torch.utils.data import Dataset import numpy as np from PIL import Image from tqdm import tqdm from collections import OrderedDict import cv2 import matplotlib.pyplot as plt from torch import nn import os import torch import torch.nn.functional as F from torch.autograd import Variable from sklearn.metrics import f...
Nishita-Kapoor-zz/skin_cancer
utils.py
utils.py
py
5,907
python
en
code
0
github-code
90
6185512102
# sqliteEx02.py import sqlite3 conn = sqlite3.connect(database='sqlitedb.db') mycursor = conn.cursor() try: mycursor.execute("drop table sungjuk") except sqlite3.OperationalError as err: print(err) mycursor.execute("create table sungjuk(id text, subject text, jumsu integer)") mydatalist = [('lee', 'java', 10),...
super1947/AICourse
DAY06/sqliteEx02.py
sqliteEx02.py
py
650
python
en
code
0
github-code
90
42603089875
# -*-coding: utf-8 -*- # Created by samwell import boto3 import logging import copy from botocore.exceptions import ClientError from .awsservice import check_awsenv, remove_awsenv, _get_template _logger = logging.getLogger(__name__) def initialize_awsenv(funclist): checkset = set() for func, task_name, tas...
samwellzuk/awsfrwk
awsmgr.py
awsmgr.py
py
5,742
python
en
code
0
github-code
90
41417472529
import torch from torch import nn from torch.nn import functional as F class GatedConv1dWithActivation(torch.nn.Module): """ Gated Convlution layer with activation (default activation:LeakyReLU) Params: same as conv1d Input: The feature from last layer "I" Output:\phi(f(I))*\sigmoid(g(I)) """ ...
EricLDS/Load_Profile_Inpainting
network_module.py
network_module.py
py
3,314
python
en
code
0
github-code
90
38747203677
import sys import re import os.path from pyspark import SparkContext if __name__ == "__main__": if len(sys.argv) != 2: print("Usage: hw3_2.py <input>") sys.exit(1) if not os.path.isfile("stopwords.txt"): print("stopwords.txt could not be found") sys.exit(1) stopFile = open("...
huyeunten/wq23
CPSC4330/hw3/hw3_2.py
hw3_2.py
py
948
python
en
code
0
github-code
90
3995774248
# 내풀이 from itertools import combinations def solution(relation): row = len(relation) col = len(relation[0]) combins = [] cols = [i for i in range(col)] for i in range(1, col + 1): combins.extend(combinations(cols,i)) result = [] for combin in combins: temp = set([tuple(...
WonyJeong/algorithm-study
koalakid1/Implementation/programmers-candidate_key.py
programmers-candidate_key.py
py
1,776
python
en
code
2
github-code
90
40850439201
from openai import OpenAI import os import time import re import imageGen testKey = os.environ.get("API_KEY") # in your terminal, please add export API_KEY=<api key> def extract_and_save(text, filename): # Use a regular expression to find text between triple backticks match = re.search(r'```(?:Python|python)(....
mrwadepro/ai-gameplay-generator
miniGame/assistants2.py
assistants2.py
py
6,620
python
en
code
0
github-code
90
20841533257
import socket import os import time server = socket.socket() server.bind(('localhost', 6969)) # 绑定地址&端口 server.listen(5) # 监听 while True: conn, addr = server.accept() # 等待接受 while True: data = conn.recv(1024) print('server receive:', data.decode()) if not data: print('cl...
hi-andy/python-study
socket/ssh_server.py
ssh_server.py
py
815
python
en
code
0
github-code
90
18258616929
from sys import stdin input = stdin.readline def main(): A, B = list(map(int, input().split())) for i in range(10000): if int(i * 0.08) == A and \ int(i * 0.10) == B: print(i) return print(-1) if(__name__ == '__main__'): main()
Aasthaengg/IBMdataset
Python_codes/p02755/s896735249.py
s896735249.py
py
265
python
en
code
0
github-code
90
42996564243
## import modules here import pandas as pd import numpy as np ################# Question 1 ################# def cal_sse(L): # To calculate the sse if (len(L) < 0): # if there is no ele in the bin return -1 variance = np.var(L) result = variance * len(L) if result==0.0: result=0 ...
15851826258/UNSW_courses_XinchenWang
COMP9318/9318 Lab/lab2.py
lab2.py
py
3,005
python
en
code
0
github-code
90
30573972153
''' # count変数が0より大きい間、繰り返す例 count = 10 while count > 0: print(count) count -= 1 print('処理を終了する') ''' ''' while True: command = input('pybot> ') if 'こんにちは' in command: print('コンニチワ') elif 'ありがとう' in command: print('ドウイタシマシテ') elif 'さようなら' in command: print('サヨウナラ') ...
gavretB/work
pybotweb/pybot.py
pybot.py
py
4,534
python
en
code
0
github-code
90
72555175658
from patbert.common import medical from patbert.common import common import os import torch from os.path import dirname, realpath, join base_dir = dirname(dirname(dirname(realpath(__file__)))) main_vocab = torch.load(join(base_dir, 'data', 'vocabs', 'synthetic.pt')) sks = medical.SKSVocabConstructor(main_vocab) de...
kirilklein/patbert
patbert/tests/test_medical.py
test_medical.py
py
2,456
python
en
code
1
github-code
90
4295964802
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.15.2 # kernelspec: # display_name: Python3 # language: python # name: python3 # --- # # Introduksjon # ## Bestilling # # Epost fra Terje L...
statisticsnorway/speshelse
experimental/aarsverk_per_NACE-kode.py
aarsverk_per_NACE-kode.py
py
4,167
python
no
code
0
github-code
90
29619923309
# https://www.urionlinejudge.com.br/judge/en/problems/view/1079 n = int (input()) t = 0 l = [] while t < n: a,b,c = (float(x) for x in input().split()) media = ((a * 2) + (b * 3) + (c * 5))/ 10 media = "{:.1f}".format(media) l.append (media) t = t + 1 t = 0 while t < n: print (l[t]) t = t...
octav1oaugusto/uri
1-Beginner/1079 - Weighted Averages.py
1079 - Weighted Averages.py
py
329
python
en
code
0
github-code
90
31952384728
import os from collections.abc import Iterable import numpy as np from mindspore.common.tensor import Tensor from mindspore.common.dtype import dtype_to_nptype, pytype_to_dtype from mindspore.common import dtype as mstype from mindspore import log as logger from mindspore.common.api import _executor from .lineage_pb...
imyzx2017/mindspore_pcl
mindspore/train/_utils.py
_utils.py
py
6,857
python
en
code
5
github-code
90
5555723998
#Priority Queue import heapq class PriorityQueue: def __init__(pq): pq.heap = [] pq.count = 0 def pop(pq): # Check if the heap is empty before popping an element if pq.isEmpty(): print("The heap is empty.") return False pq.count -...
nassosanagn/Berkeley-Pacman-Projects
Berkeley-Pacman-Project-0/priorityQueue.py
priorityQueue.py
py
1,573
python
en
code
2
github-code
90
34423875945
from setuptools import setup def readme_file_contents(): with open('README.rst') as readme_file: data = readme_file.read() return data setup( name='PotX', version='1.0.0', description='TCP honeypot', long_description=readme_file_contents(), author='Dhruvil', author_email='dhruv...
dhruvil237/PotX
setup.py
setup.py
py
434
python
en
code
1
github-code
90
29955511565
# coding=utf-8 import pandas as pd import numpy as np def cmp_rank_list(base, new, gold=None): """ Parameters ---------- base and new: compare new to base. 1. array-like: items only, whose order is the rank. 2. 2darray-like: shape=(N, 2), N samples. (hashable, float/int). ...
JHWu92/my_toolkit
wKit/stat/cmp.py
cmp.py
py
3,304
python
en
code
0
github-code
90
17961016849
S = input() gou = 1 N = len(S) for i in range(N): gou += i import collections c = collections.Counter(S) c = c.items() for a,b in c: gou -= b*(b-1)/2 print(int(gou))
Aasthaengg/IBMdataset
Python_codes/p03618/s244732446.py
s244732446.py
py
170
python
en
code
0
github-code
90
71027424937
#!/usr/bin/python import ram.widgets def RunDictEntry( header, text, title, values, format_fn=None, filter_fn=None, create_fn=None, modify_fn=None, switch_fn=None, itemExit=False ): values = values[:] modify_fn = modify_fn or switch_fn def __modify_fn(index): if not modify_f...
KasperskyLab/RAM
lib/ram/wiz/entry_iterable.py
entry_iterable.py
py
4,388
python
en
code
4
github-code
90
18045017479
w,h,n=map(int,input().split()) S=w*h h1=0 w1=0 xmax=0 ymax=0 xmax_r=0 ymax_r=0 for i in range(n): x,y,a=map(int,input().split()) if a==1: if xmax<x: xmax=x if a==2: if xmax_r<w-x: xmax_r=w-x if a==3: if ymax<y: ymax=y if a...
Aasthaengg/IBMdataset
Python_codes/p03944/s307517069.py
s307517069.py
py
480
python
ru
code
0
github-code
90
72881833898
import numpy def matrixFac(R, P, Q, K, steps=500, alpha=0.0002, beta=0.02): Q = Q.T for step in xrange(steps): for i in xrange(len(R)): for j in xrange(len(R[i])): if R[i][j] > 0: eij = R[i][j] - numpy.dot(P[i,:],Q[:,j]) for...
dreamcxy/DataMining
Answer/Assignment 3/Clustering/Code/nmf.py
nmf.py
py
1,409
python
en
code
1
github-code
90
15801656925
# -*- coding: utf-8 -*- """ 1295. Find Numbers with Even Number of Digits Given an array nums of integers, return how many of them contain an even number of digits. Constraints: 1 <= nums.length <= 500 1 <= nums[i] <= 10^5 """ class Solution: def findNumbers(self, nums) -> int: res = 0 for num ...
tjyiiuan/LeetCode
solutions/python3/problem1295.py
problem1295.py
py
413
python
en
code
0
github-code
90
18318359139
h, w, k = map(int, input().split()) ans = [] num = 0 for _ in range(h): s_ = input() s_ = [i for i in range(w) if s_[i] == "#"] if not s_: ans.append([]) continue l = [0]*w for i in s_: num += 1 l[i] = num n_ = 0 for wi in range(w): if l[wi] == 0: ...
Aasthaengg/IBMdataset
Python_codes/p02855/s878883385.py
s878883385.py
py
771
python
en
code
0
github-code
90
22282517909
#!/usr/bin/env python __version__ = "0.1" __author__ = "Mihaela Zavolan" __contact__ = "mihaela.zavolan@unibas.ch" __doc__ = "Extract the assembly versions for a set of species for which pairwise genome alignments with a reference are available" # ______________________________________________________________________...
fgypas/AlignmentExtraction
docker/python/extract_assembly_versions.py
extract_assembly_versions.py
py
6,667
python
en
code
0
github-code
90
4047640054
import codecs import os.path import re from setuptools import setup # The directory containing this file HERE = os.path.abspath(os.path.dirname(__file__)) def load(filename): # use utf-8 if this throws up an error return open(filename, "rb").read().decode("utf-8") def read(*parts): return codecs.open(...
abhaykoduru/gitlab_client
setup.py
setup.py
py
1,470
python
en
code
0
github-code
90
4739629187
# 결국 못 풀었습니다. numbers = [1, 1, 1, 1, 1] target_number = 3 result_count = 0 # target 을 달성할 수 있는 모든 방법의 수를 담기 위한 변수 def get_count_of_ways_to_target_by_doing_plus_or_minus(array, target, current_index, current_sum): # 베이스 케이스 if current_index == len(array): # 현재 합계가 target이면 if current_sum == ta...
arch-spatula/technical-interview-for-FE
academy/2st_week/02_10_get_count_of_ways_to_target_by_doing_plus_or_minus.py
02_10_get_count_of_ways_to_target_by_doing_plus_or_minus.py
py
1,102
python
ko
code
2
github-code
90
40004019945
#!/home/smartcity/virtualenv/bin python # -*- coding: utf-8 -*- # pylint: disable=W0613, C0116 # type: ignore[union-attr] # Marco Baldassarri <marco.baldassarri2@studio.unibo.it> # Francesco Vignola <francesco.vignola@studio.unibo.it> """ Agricolture Drone launch script. """ import time from controller import awsclie...
frank-vi/smart-irrigation-system
control-unit-irrigation/feeding-drone/start.py
start.py
py
659
python
en
code
1
github-code
90
70366504617
import csv from objects import Task, TaskList # CSV names are "personal.csv" and "business.csv" def get_task_listnames(): task_lists = [] filename = "task_list" with open(filename) as file: for line in file: line = line.replace('\n','') task_lists.append(line) retur...
thedonflo/Flo-Python
Murach/.idea/Section 3/Chapter 16 - Design an Object-Oriented Program/db.py
db.py
py
1,647
python
en
code
0
github-code
90
32520251797
from flask_apispec import use_kwargs, marshal_with from flask import Blueprint, jsonify, request from flask_jwt_extended import jwt_required, get_jwt_identity from flask_cors import cross_origin from backend.models.User import User from backend.schemas import UserSchema, DreamSchema from backend.storage.UserStorage im...
k3rnlpnc/GoldenFish
GoldenFish/backend/controllers/FriendController.py
FriendController.py
py
5,337
python
en
code
2
github-code
90
30946066487
########################### # Setup # ########################### import datetime import sys from os import makedirs, environ, path import re from os.path import dirname from sys import maxsize import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow imp...
ArturBarreto/GenerativeModelTextualDescriptionsMedicalImages
main.py
main.py
py
37,196
python
en
code
0
github-code
90
18583552789
def resolve(): l1, l2, r1, r2 = map(int, input().split()) lw = l1 + l2 rw = r1 + r2 ans = "" if lw < rw: ans = "Right" elif lw > rw: ans = "Left" else: ans = "Balanced" print(ans) resolve()
Aasthaengg/IBMdataset
Python_codes/p03477/s469113640.py
s469113640.py
py
250
python
en
code
0
github-code
90
5390106075
# -*- coding: utf-8 -*- import json import mimetypes import os import time import datetime from werkzeug.exceptions import BadRequest, MethodNotAllowed, InternalServerError from werkzeug.wrappers import Request, Response from jinja2 import Environment, FileSystemLoader # Settings DEBUG = \ (os.environ.get('DEBU...
sergio-bershadsky/templating-service
src/templating_service/application.py
application.py
py
2,309
python
en
code
0
github-code
90
18058650399
a = list(input()) b = list(input()) c = list(input()) # print('a',a) # print('b',b) # print('c',c) # exit() ptr = 'a' while (True): if ptr == 'a': if a == []: print('A') break ptr = a.pop(0) if ptr == 'b': if b == []: print('B') break ptr = b.pop(0) if ptr == 'c': if c == []: print('C') b...
Aasthaengg/IBMdataset
Python_codes/p03998/s224801407.py
s224801407.py
py
342
python
en
code
0
github-code
90
73415323175
from rigel.loggers import get_logger from rigel.plugins import Plugin as PluginBase from rigel.models.application import Application from rigel.models.builder import ModelBuilder from rigel.models.plugin import PluginRawData from rigel.models.rigelfile import RigelfileGlobalData from typing import Any, Dict from .model...
Kazadhum/file_intro_plugin
file_intro_plugin/plugin.py
plugin.py
py
6,625
python
en
code
0
github-code
90
28258328778
import math from graphics import * def square(x): return x * x def distance(p1, p2): dist = math.sqrt(square(p2.getX() - p1.getX()) + square(p2.getY() - p1.getY())) return dist def main(): win = GraphWin("Placeholder",500,500) win.setCoords(0.0, 0.0, 10.0, 10.0) win.setBa...
RyanDikeman/python
graphic2.py
graphic2.py
py
1,570
python
en
code
0
github-code
90
9164474745
import os, sys with open(os.path.join(sys.path[0], "5.txt"), "r") as file: lines = file.readlines() lines = [line.strip() for line in lines] lines = [[(int(line[0]), int(line[1].split(" -> ")[0])), (int(line[1].split(" -> ")[1]), int(line[2]))] for line in [line.split(",") for line in lines]] non_diag = list(...
rrickfox/AdventOfCode
2021/05/5.2.py
5.2.py
py
1,271
python
en
code
0
github-code
90
36321477266
# ENPM661, Spring 2020, Project 1 # Shelly Bagchi import numpy as np import time indexCounter = 0; class Node: node_state = []; node_index = 0; parent_node_index = 0; (i,j) = (0,0); code = ""; def __init__(self, list=[[0,0,0],[0,0,0],[0,0,0]], parent_index=0): self.node_state...
shllybkwrm/enpm661-planning
Project1/ENPM661_Project1/ENPM661_Project1.py
ENPM661_Project1.py
py
7,833
python
en
code
0
github-code
90
73466914536
## Se ingresa el primer valor def condicion_valores(valor_funcion): num1 = int(input("Ingrese el primer valor: \n")) ## Se ingresa el segundo valor. num2 = int(input("Ingrese el segundo valor: \n")) ## Se ingresa el ultimo valor que es el tercero. num3 = int(input("Ingrese el tercer valor: \n")...
D1egoS4nchez/Ejercicios
Ejercicios/ejercicio19.py
ejercicio19.py
py
879
python
es
code
0
github-code
90
13224822541
from typing import Any import pytest from safeds.data.tabular.containers import Row, Table @pytest.mark.parametrize( ("table1", "table2", "expected"), [ (Table(), Table(), True), (Table({"a": [], "b": []}), Table({"a": [], "b": []}), True), (Table({"col1": [1]}), Table({"col1": [1]}),...
Safe-DS/Library
tests/safeds/data/tabular/containers/_table/test_eq.py
test_eq.py
py
1,493
python
en
code
11
github-code
90
18306536589
N = int(input()) A = list(map(int,input().split())) mod = 10**9+7 ans = 0 for bit in range(60): m = 1 << bit # bit桁目のbitが立っている時の数 c = sum(a&m for a in A) >> bit # bit桁目の1の合計 ans += (c*(N-c))<<bit # 繰り上がりのない足し算 ans %= mod print(ans)
Aasthaengg/IBMdataset
Python_codes/p02838/s240369041.py
s240369041.py
py
318
python
ja
code
0
github-code
90
33675020227
#!/usr/bin/env python3 import argparse import sys class opt: def check(self): p = argparse.ArgumentParser(prog='spinfo') eps = p.add_mutually_exclusive_group() etu = p.add_mutually_exclusive_group() eps.add_argument('-S','--service',nargs='+') eps.add_argument('-P','--port'...
visarbha/spinfo
lib/python3.5/site-packages/spi/ap.py
ap.py
py
480
python
fa
code
0
github-code
90
12287696558
#!/usr/bin/env python3 from http.server import HTTPServer from http.server import BaseHTTPRequestHandler from urllib.parse import urlparse, parse_qs import simplejson import cgi import json import base64 class RestHTTPRequestHandler(BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) ...
acpointer2010/IDS-Connector
camel-ids/ttpsim/script/ttp.py
ttp.py
py
1,096
python
en
code
0
github-code
90
9353925985
from sqlalchemy.sql.schema import Table from sqlalchemy.sql import exists, and_, select, func, or_, insert from sqlalchemy.sql.functions import now from sqlalchemy.sql.expression import literal_column from datetime import datetime from ninjasql.db.sqa_table_loads import TableLoad class SqaExtractor(object): """ ...
dondaum/ninjasql
ninjasql/db/sqa_dml_extractor.py
sqa_dml_extractor.py
py
12,671
python
en
code
4
github-code
90
17947459249
import sys input = sys.stdin.readline N = int(input()) ab = [tuple(map(int, input().split())) for _ in range(N)] ab.sort() ans = ab[-1][0] - ab[0][0] + 1 ans += ab[0][0] - 1 ans += ab[-1][1] print(ans)
Aasthaengg/IBMdataset
Python_codes/p03588/s427225700.py
s427225700.py
py
203
python
en
code
0
github-code
90
16337854711
import json import os from django import setup os.environ['DJANGO_SETTINGS_MODULE'] = 'genesis.api.settings' setup() from anacore.annotVcf import AnnotVCFIO from genesis.variant.model_data.variantData import Variant from genesis.api.variantAPI import VariantAPI """ VARIANT CREATING WS """ print('VARIANT CREATING ...
noelmaurice/py_django_genesis_server
genesis/api/main_variant_api_example.py
main_variant_api_example.py
py
1,627
python
en
code
1
github-code
90
46488829913
#JACKPOT SIMULATION ET BECOME BILLIARD PERSON #GET WHAT YOU NEED AND MAKE YOUR DREAM POSSIBLE #Le 22/07/2018 Par Oscar KALONJI #Mise à jour Séparation de chiffre comme string afin de le recuperer 27/08/2018 #--------------------------------++++++++++++------------------------------- L = ["1","2","3","4","5","6","7","8...
chaptal/MyPython
MyJackPot.py
MyJackPot.py
py
1,487
python
en
code
0
github-code
90
20024712136
import requests from icalendar import Calendar, prop from datetime import datetime from BrianTools import ApiError, IsNullOrEmpty class Event: def __init__(self, name, date): self.name = name self.date = date def toDict(self): return { "Name": self.name, "Date": self.date.strftime("%a ...
BrianHooper/blinkenlights
PageParseApi/GoogleCalendarApi.py
GoogleCalendarApi.py
py
2,217
python
en
code
0
github-code
90
14193241297
from django.test import TestCase from user.models import User class UserTestCase(TestCase): def setUp(self): self.user = User.objects.create( name='John Doe', cpf='12345678900', email='johndoe@example.com', phone_number='(555) 555-5555' ) def te...
vitorkayron/api-user-order
user/tests_user/test_model_user.py
test_model_user.py
py
976
python
en
code
0
github-code
90
11145320812
import sys input = sys.stdin.readline def boom(board): temp = [['O'] * c for _ in range(r)] for x in range(r): for y in range(c): if board[x][y] == 'O': temp[x][y] = '.' for k in range(4): nx = x + dx[k] ...
haegomm/Algorithm
백준/Silver/16918. 봄버맨/봄버맨.py
봄버맨.py
py
947
python
en
code
0
github-code
90
70760089258
import os, shutil # Comprobar si existe carpete y crearla sino existe if not os.path.isdir("./mi_carpeta"): os.mkdir("./mi_carpeta") print("Carpeta creada.") else: print("El directorio 'mi_carpeta' ya existe.") # Copiar original_path = "./mi_carpeta" new_path = "./mi_carpeta_copiada" if os.path.isdir("....
AlexSR2590/master_python
14-sistema_archivos/directorios.py
directorios.py
py
799
python
es
code
0
github-code
90
8506575916
import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from scipy.stats import norm class FragilityModel: def __init__(self, name): """Initiates the fragility model with a name :param name: name of the fragility model :type name: str """ ...
srijithbalakrishnan/fragility
fragility/src/fragility_curves/fragility_models.py
fragility_models.py
py
5,308
python
en
code
0
github-code
90
33656696097
from typing import List class Solution: """ 栈 """ def trap(self, height: List[int]) -> int: if len(height) < 3: return 0 result, stack = 0, [] for i in range(len(height)): while len(stack) > 0 and height[i] > height[stack[-1]]: top = stack.pop() ...
algorithm004-04/algorithm004-04
Week 01/id_169/LeetCode_42_169.py
LeetCode_42_169.py
py
1,024
python
en
code
66
github-code
90
1199233956
#Definition of inputs and outputs #================================== ##Toole=group ##Connect destinations=name ##Road_layer=vector ##Destinations_layer=vector ##Network_table=table ##Maximum_stress=number 2 ##Output_paths=output vector #Algorithm body #================================== from qgis.core import * from P...
spencerrecneps/mpls_west_lake
connect_destionations.py
connect_destionations.py
py
3,721
python
en
code
0
github-code
90
3994894618
import sys input = sys.stdin.readline def getTime(T, arr): arr = sorted(arr, key=lambda x: x[0]) arr = sorted(arr, key=lambda x: x[1]) answer = 0 cursor = 0 for i, j in arr: if i >= cursor: answer += 1 cursor = j print(answer) print(arr) if __name__ == "...
WonyJeong/algorithm-study
WonyJeong/greedy/1931.py
1931.py
py
494
python
en
code
2
github-code
90
18011898199
import math def pcount(n, r): return math.factorial(n) // (math.factorial(r)* math.factorial(n - r)) n, a, b = map(int, input().split()) L = [int(i) for i in input().split()] L.sort(reverse=True) T = L[:a] print(sum(T)/a) s = 0 Tmin = min(T) countTminT = T.count(Tmin) countTminL = L.count(Tmin) if a == 1 and co...
Aasthaengg/IBMdataset
Python_codes/p03776/s303052843.py
s303052843.py
py
512
python
en
code
0
github-code
90
9999068689
from ._chartobject import ChartObject from ..models import (Range1d, GMapPlot, GMapOptions) #----------------------------------------------------------------------------- # Classes and functions #----------------------------------------------------------------------------- class GMap(ChartObject): """This is the...
DaveRichmond-/bokeh
bokeh/charts/gmap.py
gmap.py
py
5,474
python
en
code
null
github-code
90
28064457791
import torch import torch.nn as nn class ConvBlock(nn.Module): def __init__(self, in_c, out_c, k, s, p): """ This is a sequential which includes conv,batchnorm,prelu :param in_c: in_channels :param out_c: out_channels """ super(ConvBlock, self).__init__() se...
baroibeo/Portrait-Segmentation
ENet/model/Components.py
Components.py
py
5,857
python
en
code
0
github-code
90
41422922467
# -*- coding: utf-8 -*- """ Created on Wed Dec 6 18:19:46 2017 @author: mkw5c """ from GEO_metadata_scraper_functions_final import * import pandas as pd import numpy as np #create an empty dataframe to store the metadata in columns = ["series", "exptype", "organism", "mouseline", "cellline", "strain", "source",\ ...
caitdreis/NeuroimmunologyCapstone
Metadata_scraper/using_the_search_functions_final.py
using_the_search_functions_final.py
py
10,936
python
en
code
0
github-code
90
4579810906
import spidev from numpy import log as ln class TemperatureRegulator: def __init__(self): self.temperature_center = 70 # set to medium temperature by default self.temperature_offset = 3 # the allowable offset the actual temperature can have from the center temperature def set_tempera...
kamielsabo/PWMPiezo
src/temperature_regulator.py
temperature_regulator.py
py
2,284
python
en
code
0
github-code
90
34191825867
import logging from collections import OrderedDict from django.contrib import admin from django.contrib.contenttypes.models import ContentType from django_celery_beat.admin import PeriodicTaskAdmin from django_celery_beat.models import PeriodicTask, SolarSchedule logger = logging.getLogger('kubrick.debug') admin.sit...
fanshuai/kubrick
server/applibs/abasepp/admin.py
admin.py
py
2,353
python
en
code
0
github-code
90
8281573712
import prometheus_client as prom #import 'prometheus_client', this is important as the python Prometheus library is called that import time import requests import yaml import sys from bs4 import BeautifulSoup def config(): with open("config.yaml") as fileStream: try: config = yaml.safe_load(...
nobbich/etarestgw
pu15_gateway.py
pu15_gateway.py
py
1,337
python
en
code
0
github-code
90
18331671949
import bisect n = int(input()) l = list(map(int, input().split())) ans = 0 l.sort() for i in range(n-2): for j in range(i+1, n-1): c_i = bisect.bisect_left(l, l[i]+l[j]) if c_i > j: ans += c_i - j - 1 else: continue print(ans)
Aasthaengg/IBMdataset
Python_codes/p02888/s411204381.py
s411204381.py
py
280
python
en
code
0
github-code
90
18541104589
from collections import * from itertools import * N=int(input()) A=list(map(int,input().split())) s=[0]+list(accumulate(A)) s_cnt=Counter(s) ans=0 for x in s_cnt.values(): ans+=(x*(x-1))//2 print(ans)
Aasthaengg/IBMdataset
Python_codes/p03363/s923020523.py
s923020523.py
py
207
python
en
code
0
github-code
90
38204904980
#!/usr/bin/python def func(): list1=input("1st list :").split(',') list2=input("2nd list :").split(',') count=0 for i in list1: i=i.replace("[","").replace("]","").replace(" ","") k=int(i) list1[count]=k count+=1 count=0 for i in list2: i=i.replace("[","...
GyeongHyeonKim/py_lab2
my_pkg/UnandInter.py
UnandInter.py
py
758
python
en
code
0
github-code
90
23297021898
# -*- coding: UTF-8 -*- ''' 柱状图中最大的矩形 ''' class Solution: def largestRectangleArea(self, heights): ''' 单调栈 栈内元素对应的 heights 是从大到小(从栈顶到栈底) ''' stack = [0] result = heights[0] heights = [0] + heights + [0] for i in range(1, len(heights)): if ...
OhOHOh/LeetCodePractice
python/No84.py
No84.py
py
2,027
python
en
code
0
github-code
90
46371406033
import cv2 from os import listdir from os.path import isfile import numpy as np import sklearn.covariance import pickle def multi_norm_pdf(x,mean,covar): return def extract_data(image,mask): img = cv2.imread(image,cv2.IMREAD_COLOR) img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) msk = cv2.imread(mask,cv2.I...
liampulles/WITS_Repo
WITS_CV_Coin_Detect/training.py
training.py
py
5,453
python
en
code
0
github-code
90
20850786932
import itertools class Solution: def countAndSay(self, n: int): s = "1" for _ in range(n-1): s = ''.join(str(len(list(group))) + digit for digit, group in itertools.groupby(s)) print("s here",s) return s def countAndSay2(self, n: int): s = "1" fo...
Harishkumar18/data_structures
coding_challenges/strings/count_and_say.py
count_and_say.py
py
594
python
en
code
1
github-code
90
15755450727
#Program for the One Stop Insurance Company to enter and calculate policy information for customers. #Author: Tyler Stuckless Date: November 29, 2022 #Opens OSICDef.dat to read the constants. f = open("OSICDef.dat", "r") NEXT_POLICY_NUM = int(f.readline()) BASIC_PREM = float(f.readline()) AUTO_DISCOUNT ...
TylerSGFW/QAP-4-Files-TS
main.py
main.py
py
4,562
python
en
code
0
github-code
90
43057802170
import cv2 import torch import numpy as np import open3d as o3d from PIL import Image from copy import deepcopy import matplotlib.pyplot as plt from utils.utils import transform_points,make_open3d_point_cloud, dpt_3d_convert normR = 0.5 normN = 30 t = [3,0,0] cmap = plt.cm.plasma def visual_pcd(xyzs:list, normal = Fa...
WHU-USI3DV/FreeReg
utils/drawer.py
drawer.py
py
8,316
python
en
code
73
github-code
90
72267573416
def matriz(A,B): C=list() fila=len(A)+1 columna=len(B)+1 for i in range(fila): C.append([0]*(columna)) j=0 #Cargo primer fila con la palabra a convertir for i in range(len(A)): j=i+1 C[0][j]=A[i] z=0 #Cargo la primer columna con la palabra que queremos for i in range(len(A)): for j in...
CrlsAlejandro97/TP-Complejidad
matriz.py
matriz.py
py
389
python
es
code
0
github-code
90