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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
42017065307 | from ScalarFieldPlotter import ScalarFieldPlotter
import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
if __name__ == '__main__':
sfp = ScalarFieldPlotter(['TEMP', 'SALT'])
depths = range(5, 235, 10)
latitudes = sfp.getLatitudes()
longitudes = sfp.getLongitudes()
dates = sfp.getD... | VigneshBondugula/DataVisualization | A2/SlicingYT.py | SlicingYT.py | py | 980 | python | en | code | 0 | github-code | 90 |
5618737172 | from random import randint, choice
count = 0
while True:
a = randint(0,10)
b = randint(0,10)
op = choice(["+", "-", "*", "/"])
res = 0
if op == "+":
res = a + b
elif op == "-":
res = a - b
elif op == "*":
res = a * b
else:
res = a / b
err = randint(-... | kev158/NguyenTrongDuc-c4t | mmini4/f_game.py | f_game.py | py | 828 | python | en | code | 0 | github-code | 90 |
74626622376 | import matplotlib.pyplot as plt
import numpy as np
import time
from itertools import product
from numba import jit
def UniformDistribution(n,seed=int(time.time())%100000):
#linear congruential generator
m=244944
a=1597
c=51749
for i in range(n):
seed=(a*seed+c)%m
#extremely low prob... | TonyWang23/Simulation_Quant_Finance | generator.py | generator.py | py | 7,576 | python | en | code | 3 | github-code | 90 |
31872077309 | #Знайти суму елементів масиву цілих чисел, які діляться на 5 і на 8
#одночасно. Розмірність масиву - 30. Заповнення масиву здійснити випадковими
#числами від 500 до 1000.
#Дудук Вадим
import numpy as np
import random
while True:
b=np.zeros(30,dtype=int)
count=0
for i in range(30):
b[i] = random.randin... | MiraDevelYing/colloquium | 24.py | 24.py | py | 841 | python | uk | code | 0 | github-code | 90 |
10886217322 | def monthy_finances(balance, annualInterestRate, monthlyPaymentRate):
'''Return balance after one month with min payment rate made'''
monthly_interest_rate = annualInterestRate/12.0
min_month_payment = balance * monthlyPaymentRate
unpaid_balance = balance - min_month_payment
new_balance = unpai... | HollisHolmes/MIT_60001 | PS2/ps2.py | ps2.py | py | 2,773 | python | en | code | 0 | github-code | 90 |
24607885715 | import hashlib
import _io
import json
import os
from functools import partial
class FileStatter:
@staticmethod
def sha1(data):
block_size = 2 ** 14
if type(data) is _io.BufferedReader:
d = hashlib.sha1()
for buf in iter(partial(data.read, block_size), b''):
... | reinvantveer/edna-ld | etl/lib/FileStatter.py | FileStatter.py | py | 986 | python | en | code | 0 | github-code | 90 |
25576659551 | def calc_tax(name, income=0):
names = ["Javad", "Navid", "Tannaz", "Taraneh", "Parsa"]
families = ["Ezzati", "Mohammadzadeh", "Tabatabaei", "Alidousti", "Pirouzfar"]
incomes = [23_000_000, 45_000_000, 32_000_000, 37_000_000, 47_000_000]
name_split = name.split()
names.app... | ivias2000/calculate-tax-person | tax.py | tax.py | py | 1,028 | python | en | code | 0 | github-code | 90 |
12187292306 | from PyQt5.QtCore import QSettings
settings = QSettings("config.ini", QSettings.IniFormat)
dir_path = settings.value("SETUP/DIR_PATH")
apart = settings.value("SETUP/APART")
floor_index = eval(settings.value("SETUP/FLOOR_INDEX"))
auto_pack = settings.value("SETUP/AUTO_PACK")
is_changed = False
has_printed = False
def... | HuijieYao/ApexCollector | globalValue.py | globalValue.py | py | 1,174 | python | en | code | 1 | github-code | 90 |
10400588848 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 21 19:18:34 2019
@author: admin
"""
'''
现在你总共有 n 门课需要选,记为 0 到 n-1。
在选修某些课程之前需要一些先修课程。 例如,想要学习课程 0 ,你需要先完成课程 1 ,我们用一个匹配来表示他们: [0,1]
给定课程总量以及它们的先决条件,判断是否可能完成所有课程的学习?
示例 1:
输入: 2, [[1,0]]
输出: true
解释: 总共有 2 门课程。学习课程 1 之前,你需要完成课程 0。所以这是可能的。
示例 2:
输入: 2, [[1,0],[0,1]]
输... | k8godzilla/-Leetcode | 1-100/L207.py | L207.py | py | 3,087 | python | zh | code | 0 | github-code | 90 |
18420162189 | n, k = map(int, input().split())
s = input()
counts = []
tmp = []
for i in range(len(s)):
if tmp == []:
tmp = [s[i], 1]
else:
if tmp[0] == s[i]:
tmp[1] += 1
else:
counts.append(tmp)
tmp = [s[i], 1]
if tmp:
counts.append(tmp)
zero_ints = 0
for cha... | Aasthaengg/IBMdataset | Python_codes/p03074/s053596728.py | s053596728.py | py | 973 | python | en | code | 0 | github-code | 90 |
44243067357 | import numpy as np
import pandas as pd
import math
import matplotlib.pyplot as plt
from sklearn import metrics
import statsmodels.api as sm
import pickle
from collections import defaultdict
import seaborn as sns
# get parameters
# calculation prediction of Bayesian sampling
# apply OLS to adjust parameters
# ca... | yanchundave/yanchunprojects | mmm_pystan_oct/other_functions.py | other_functions.py | py | 5,700 | python | en | code | 0 | github-code | 90 |
36127100636 | from datetime import datetime
from argon2 import PasswordHasher
from freezegun import freeze_time
from app.helpers.oauth.models import OAuth2Client, ThirdPartyClientEmployment
from app.helpers.time import to_timestamp, LOCAL_TIMEZONE
from app.models.activity import ActivityType
from app.seed.factories import CompanyF... | MTES-MCT/mobilic-api | app/tests/test_api_employee_queries.py | test_api_employee_queries.py | py | 27,863 | python | en | code | 1 | github-code | 90 |
27093663608 | from spack import *
class PyCryptography(PythonPackage):
"""cryptography is a package which provides cryptographic recipes
and primitives to Python developers"""
homepage = "https://pypi.python.org/pypi/cryptography"
url = "https://pypi.io/packages/source/c/cryptography/cryptography-1.8.1.tar... | matzke1/spack | var/spack/repos/builtin/packages/py-cryptography/package.py | package.py | py | 972 | python | en | code | 2 | github-code | 90 |
39908621780 | from elements import List, Integer, Compound, Integers, String
from language import code
# Build pattern
pattern = code()
a = Integers(3)
b = Integer()
n = a[1]
pattern.add(a)
pattern.add(List(n, b))
prog = pattern.compile()
# Build testcases
# ['\n2 1 4\n8\n', '3 2 5\n1\n4\n']
testcases = """
2 1 4
8
-
3 2 5
1
4
""... | mfornet/tcgen | tcgen/arena.py | arena.py | py | 638 | python | en | code | 6 | github-code | 90 |
18098276789 | import sys
for s in sys.stdin:
a = list(map(int, s.split()))
b = a[0]
c = a[1]
while c != 0:
b, c = c, b%c
d = a[0] * a[1] / b
print(int(b), int(d)) | Aasthaengg/IBMdataset | Python_codes/p00005/s205750271.py | s205750271.py | py | 183 | python | en | code | 0 | github-code | 90 |
36398287531 | """
3. Dict-Ref-Advanced
Remember the Dict-Ref Problem from the previous exercise? Well this one is an Advanced Version.
You will begin receiving input lines containing information in one of the following formats:
{key} -> {value 1, value 2, …, value n}
{key} -> {otherKey}
The keys will always be strings, and... | stefanv877/PythonFundamentals_SoftUni | DictionariesExercises/DictRefAdvanced.py | DictRefAdvanced.py | py | 1,547 | python | en | code | 0 | github-code | 90 |
24616875623 | # -*- coding: utf-8 -*-
from argparse import ArgumentParser
import datetime
import io
import requests
import time
import RPi.GPIO as GPIO
import picamera
# 画像のアップロード先 URL
UPLOAD_URL = 'http://192.168.1.7:8080/upload'
# 最大試行回数
TRY_COUNT = 100
# サーボ(SG90)を制御する
class Servo:
def __init__(self):
self.pin =... | tknpow22/coin_toss | raspberry_pi/toss_and_capture.py | toss_and_capture.py | py | 4,133 | python | en | code | 0 | github-code | 90 |
32304102069 | #this one is checking from a million tickets a lucky tickets only
#Есть 10 рулонов билетов по 100000 штук в каждом (000000-099999, …, 900000-999999),
# номера которых состоят из 6-ти цифр.
#Надо вычислить у каждого рулона число счастливых билетов.
#Счастливым считается билет, у номера которого среднее 1-2 цифр рав... | Aleksandrengineer/python_practice | luckytickets.py | luckytickets.py | py | 2,629 | python | ru | code | 0 | github-code | 90 |
43334156556 | #!/usr/bin/env python3
from itertools import combinations, islice
from math import gcd
def cmp(a, b):
return (a > b) - (a < b)
def abssum(i):
return sum(map(abs, i))
def lcm(a, b):
return abs(a * b) // gcd(a, b)
def sim(axis):
pos = list(axis)
vel = [0] * len(pos)
index_pairs = tuple(combina... | taddeus/advent-of-code | 2019/12_jupiter.py | 12_jupiter.py | py | 1,221 | python | en | code | 2 | github-code | 90 |
10846773694 | from flask import Flask, request
from minmax_alg import MinMax
import re
app = Flask(__name__)
TOKEN = "Bearer 1"
sessions = {}
@app.route("/")
def index():
return "B4-SuperTicTacBot"
@app.route('/tictactoe/<int:session_id>', methods=["POST"])
def tictactoe(session_id):
if not request.headers.get("Authorization"... | ananasness/pai | tic-tac-toe/server.py | server.py | py | 506 | python | en | code | 0 | github-code | 90 |
11986117818 | from django.db import models
from django.core.validators import MinValueValidator
# Create your models here.
class NatureImage(models.Model):
link = models.CharField(max_length=500,
verbose_name="Link",
help_text="Input image link",
... | AlexandrSech/Z63-TMS | students/shloma/024_homework_24/task_24/hw_24/models.py | models.py | py | 1,171 | python | en | code | 0 | github-code | 90 |
34616159837 | # coding=utf-8
class MaxHeap:
size = 0
@staticmethod
def __pai(i):
return (i - 1)/2
@staticmethod
def __esquerdo(i):
return 2*i + 1
@staticmethod
def __direito(i):
return 2*i + 2
@staticmethod
def __trocar(lista, i, j):
temp = lista[i]
list... | Tarik-INC/GCC218_AlgoritmosEmGrafos | max_heap.py | max_heap.py | py | 1,651 | python | pt | code | 0 | github-code | 90 |
25091222151 | import os
from PIL import Image
from termcolor import cprint
def print_enumerated_list(lst):
counter = 0
cprint("Directories:", "cyan")
for item in lst:
print(str(item[0]) + ". \"" + str(item[1] + "\""))
counter += 1
print()
def create_enum_directories(cwd):
dir_list = []
for... | Roy-Gal-Git/WorkingWithImages | JPEGtoPNGconverter.py | JPEGtoPNGconverter.py | py | 4,432 | python | en | code | 0 | github-code | 90 |
18310267619 | n = int(input())
S = input()
ans = 0
for i in range(1000):
t = str(i).zfill(3)
for s in S:
if s == t[0]:
t = t[1:]
if t == '':
ans += 1
break
print(ans) | Aasthaengg/IBMdataset | Python_codes/p02844/s909352100.py | s909352100.py | py | 212 | python | en | code | 0 | github-code | 90 |
18348360709 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n=int(input())
A=[list(map(int,input().split())) for i in range(n)]
now=[0]*n
rest=n*(n-1)//2
for i in r... | Aasthaengg/IBMdataset | Python_codes/p02925/s086874163.py | s086874163.py | py | 929 | python | en | code | 0 | github-code | 90 |
6607909428 | from django import forms
from django.core.validators import FileExtensionValidator
from .models import Formality
class FormalityForm(forms.ModelForm):
file = forms.FileField(
widget=forms.ClearableFileInput(
attrs={'multiple': True}
),
required=False,
validators=[
FileExtensionValidator(
allowed_e... | oscles/formalities-app | apps/formality/forms.py | forms.py | py | 1,487 | python | en | code | 1 | github-code | 90 |
9081975053 | #!/usr/bin/python3
"""
Write the class Rectangle that inherits from Base:
In the file models/rectangle.py
Class Rectangle inherits from Base
Private instance attributes, each with its own public getter and setter:
__width -> width
__height -> height
__x -> x
__y -> y
Class constructor: def __init__(self, width, heigh... | Ambitiousdude/alx_python | python-almost_a_circle/models/rectangle.py | rectangle.py | py | 4,479 | python | en | code | 0 | github-code | 90 |
39736321903 | import sys
n = int(sys.stdin.readline())
if n == 0 :
print(0)
elif n == 1:
print(1)
else:
a = 0
b = 1
c = a + b
for i in range(2,n+1):
c = a + b
a = b
b = c
print(c)
| lyong4432/BOJ.practice | #2747.py | #2747.py | py | 222 | python | en | code | 0 | github-code | 90 |
22150446907 | import pyautogui
import time
import tkinter as tk
from tkinter.ttk import Style
class App(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.scroll_speed = 0.65
self.scroll_distance = 120
self.scroll_on = False
... | egg883/EggsAutoScroller | EggsAutoScroller.py | EggsAutoScroller.py | py | 2,153 | python | en | code | 1 | github-code | 90 |
18311870859 | #!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string, copy
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7
ans = count = 0; pro = 1
t1,t2=map(int,input().split())
a1,a2=map(int,input().split())
b1,b2=ma... | Aasthaengg/IBMdataset | Python_codes/p02846/s834657880.py | s834657880.py | py | 634 | python | en | code | 0 | github-code | 90 |
64296051 | """
You are given a secret message you need to decipher.
Here are the things you need to know to decipher it:
For each word:
the second and the last letter is switched (e.g. Hello becomes Holle)
the first letter is replaced by its character code (e.g. H becomes 72)
Note: there are no special characters used, only let... | koskin17/MyEducation | CodeWars/Decipher this.py | Decipher this.py | py | 1,471 | python | en | code | 0 | github-code | 90 |
18420662529 | from itertools import*
n, k = map(int, input().split())
s = input()
d = [len(list(t)) for _, t in groupby(s)]
if s[0] == "0":
d = [0] + d
a = [0] + list(accumulate(d))
m = l = 0
while True:
try:
m = max(m, a[l+2*k+1] - a[l])
l += 2
except IndexError:
m = max(m, a[-1] - a[l])
break
print(m) | Aasthaengg/IBMdataset | Python_codes/p03074/s709943829.py | s709943829.py | py | 314 | python | en | code | 0 | github-code | 90 |
17125467793 | import win32api, win32con
import pyautogui
import time
import sys
import pyscreenshot as ImageGrab
import pytesseract
import argparse
def click(x,y):
win32api.SetCursorPos((x,y))
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)... | SweetTownConqueror/bgs_tests_exterminisher | v3.0/main.py | main.py | py | 3,308 | python | en | code | 0 | github-code | 90 |
39923301265 | import pymongo
import xlrd
DB = pymongo.MongoClient().inter_market
COL_DATE = 0
COL_HOUR = 1
COL_SECTION = 2
COL_PMAX = 3
COL_PMIN = 4
COL_COUNTRY_FROM = 2
COL_COUNTRY_TO = 3
COL_MGP_PRICE = 4
def load_section_limits(file_name):
wb = xlrd.open_workbook(file_name)
data = wb.sheet_by_index(0)... | konstantinov90/oer | server/loaders.py | loaders.py | py | 1,613 | python | en | code | 0 | github-code | 90 |
3793443054 | from pymongo import MongoClient
client = MongoClient("mongodb: // localhost:27017")
db = client.examples
def most_tweets():
result = db.tweet.aggregate([
{"$group" : {"_id" : "$user.screen_name",
"count": {"$sum" : 1}}},
{"$sort" : {"count" : -1}}])
return result
| tanglan2009/Data_wrangling | week5/who_tweeted_most.py | who_tweeted_most.py | py | 311 | python | en | code | 0 | github-code | 90 |
10922117902 | import torch
from utils.datautil import *
from models.backbone import *
from models.attention_operator import *
import torch.nn.functional as tnf
class MLP(nn.Module):
def __init__(self,input_dim,output_dim,dropout=0.5):
super(MLP,self).__init__()
hidden_dim=input_dim//2
self.linear... | lbq8942/TGACN | models/model.py | model.py | py | 7,301 | python | en | code | 0 | github-code | 90 |
44102977539 | from urllib.request import urlopen
import time
from os import system
def internet_on():
try:
urlopen('https://www.google.com', timeout=1)
return True
except:
return False
while True:
time.sleep(1)
data = ''
if internet_on() == False:
data = 'true'
else:
data = ''
if data == 'true':
system('play -q ... | strongpapazola/internetAlert | internetWarning.py | internetWarning.py | py | 332 | python | en | code | 0 | github-code | 90 |
14434025961 | from setuptools import find_packages
from setuptools import setup
package_name = 'ament_flake8'
setup(
name=package_name,
version='0.16.1',
packages=find_packages(exclude=['test']),
data_files=[
('share/' + package_name, ['package.xml']),
('share/ament_index/resource_index/packages',
... | ament/ament_lint | ament_flake8/setup.py | setup.py | py | 1,449 | python | en | code | 34 | github-code | 90 |
341855634 | # --------------------------------------
# -*- coding: utf-8 -*-
# @Time : 2022/9/3 10:19
# @Author : wzy
# @File : MobileViTBlock.py
# ---------------------------------------
import numpy as np
import torch
import torch.nn as nn
from einops import rearrange
from torchsummary import summary
class MLPBlock(nn.Seque... | Berry-Wu/Vision_Transformer | models/MobileViTBlock.py | MobileViTBlock.py | py | 4,201 | python | en | code | 1 | github-code | 90 |
44324657748 | #!/usr/bin/python3
"""Defines a base model class."""
from datetime import datetime
import models
import uuid
time = "%Y-%m-%dT%H:%M:%S.%f"
class BaseModel:
"""
Represent the "base" for all other classes in the AirBnB clone
project.
Attributes:
id: string,assigned a unique 'uuid'when an instan... | HeseltineBTutu/AirBnB_clone | models/base_model.py | base_model.py | py | 2,802 | python | en | code | 0 | github-code | 90 |
38640017780 | from django.shortcuts import render
# from django.httteap import HttpResponse
from .models import Post
# Create your views here.
posts = [
{
'team1': 'Manu',
'team1odds': '2.4',
'team2': 'Chelsea',
'team2odds': '1.6',
'placed_bet': 'Manu',
'odds_value': '2.4',
'game_day': 'date',
... | BRUNOCHERUIYOT/sureearntips | betting/views.py | views.py | py | 560 | python | en | code | 0 | github-code | 90 |
30761470539 |
def utest_add_item_to_basket(app):
item_name = 'Doom'
main_page = app.main_page
search_results_page = main_page.search_item(item_name)
item = search_results_page.get_item(1)
item_page = item.go_to_item_page()
item_page.add_to_basket()
print('URL:', item_page.get_URL())
| AntonAntonA/WB_autotest | WB_UnitTests.py | WB_UnitTests.py | py | 305 | python | en | code | 0 | github-code | 90 |
37751992298 | class Employee:
def set_emp(self,e_id,e_name,desig,salary):
self.e_id=e_id
self.e_name=e_name
self.desig=desig
self.salary=salary
def print_emp(self):
print(self.e_id,",",self.e_name,",",self.desig,",",self.salary)
emp1=Employee()
emp2=Employee()
emp3=Employee()
emp1.... | hanv698/PythonDjangoLuminar | object_oriented_programming/class/emp_class.py | emp_class.py | py | 499 | python | en | code | 0 | github-code | 90 |
16150649453 | import collections;
def readGenome(filename):
genome = ''
with open(filename, 'r') as f:
for line in f:
if not line[0] == '>':
genome += line.rstrip()
return genome
genome = readGenome('lambda_virus.fa')
print(len(genome))
# Base count
counts = {'A': 0, 'C': 0, 'G': 0, ... | nezlicodes/algorithms_for_DNA_sequencing | week_01/reading_fasta_file.py | reading_fasta_file.py | py | 528 | python | en | code | 1 | github-code | 90 |
21211392115 | import os
from kitti.data import data_dir
def load_image(index, test=False, right=False, future=False):
import scipy.ndimage
path = os.path.join(
data_dir,
'data_stereo_flow',
'testing' if test else 'training',
'image_1' if right else 'image_0',
"%06d_%2d.png" % (index... | hunse/kitti | kitti/stereo.py | stereo.py | py | 964 | python | en | code | 99 | github-code | 90 |
22450094230 | import os, PIL
from PIL import ExifTags
import numpy as np
import tensorflow as tf
import keras
from keras.models import Sequential, Model
from keras.models import load_model
from keras.layers import Conv2D, Dropout, Concatenate, Reshape
from keras.layers import BatchNormalization, Activation
from keras.layers import ... | kechan/KerasVision | model/convnet/localization.py | localization.py | py | 21,621 | python | en | code | 0 | github-code | 90 |
6510203175 | class inclusive_range:
def __init__(self, *args):
numargs = len(args)
self._start = 0
self._step = 1
#counting number of args
if numargs < 1:
raise TypeError('expected at least 1 argument, got {}'.format(numargs))
elif numargs == 1:
se... | berkercaner/pythonTraining | Chap09/iterator.py | iterator.py | py | 1,159 | python | en | code | 0 | github-code | 90 |
10111319627 | '''
@Author: your name
@Date: 2020-06-18 15:17:21
@LastEditTime: 2020-07-01 23:36:47
@LastEditors: Please set LastEditors
@Description: 处理字符串的应用库
@FilePath: \docommit\lib\StringLib.py
'''
def findSubStrs(vString,subStr):
'''
@description:查找字符串中中所有子字符串的位置 \n
@param vString {type string} 整个字符串 \n
@pa... | dongryliu/docomment | lib/StringLib.py | StringLib.py | py | 2,980 | python | zh | code | 1 | github-code | 90 |
11976092340 | ### Implementation of an M/M/1 queue using the discret-event advance strategy
#
# CMS 380
from math import log
from random import random
# Priority queue operations
from heapq import heappush, heappop, heapify
def rand_exp(rate):
""" Generate an exponential random variate
input: rate, the para... | dansmyers/Simulation | Sprint-5-Discrete_Event_Simulation/Examples/discrete_event_queue.py | discrete_event_queue.py | py | 4,155 | python | en | code | 1 | github-code | 90 |
74049301417 | from tkinter import *
from math import floor
import onitama as oni
from ai import create_ai
from collections import defaultdict
import random
class GUI:
rows = 5
columns = 5
square_size = 100
inset = 5
dark = '#f5deb3'
light = '#ffffe0'
blue = '#33adff'
red = '#ff4d4d'
green = '#80f... | arduy/onitama | gui.py | gui.py | py | 18,227 | python | en | code | 4 | github-code | 90 |
18435976699 | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
a, b, c = map(int, input().split())
if c * a <= b:
print(c)
else:
print(b // a)
if __name__ == '__main__':
resolve()
| Aasthaengg/IBMdataset | Python_codes/p03105/s655108650.py | s655108650.py | py | 251 | python | en | code | 0 | github-code | 90 |
30142442438 | import socket
import threading
import sys
import json
import os
import string
from queue import Queue
from hashlib import sha256
from secrets import choice
CONNECTED = False
IP = socket.gethostname()
PROCESS_ID = sys.argv[1]
# get port numbers from config file
with open('config.json', 'r') as port_file:
file_data... | mlroller/cs171final | server.py | server.py | py | 5,559 | python | en | code | 0 | github-code | 90 |
23254439195 | import time
import logging
from wdaAuto import *
from mqsendUtil import send_inter_topic as send
from loadUtil import *
from reportUtil import *
topic_name='/topic/interTopic'
first=False #只有在第一次互动交互的时候进行验证,其他时间不需要
error=[] #保存用例步骤执行失败的用例名
fail=[] #保存用例验证失败的用例名
success=[]#保存用例执行成功的用例名(步骤执行成功,验证通过)
skip=[]#保存没有被执行的用例... | wuchf/wda-automation | main_queue.py | main_queue.py | py | 5,935 | python | en | code | 0 | github-code | 90 |
43487696443 | import psycopg2
import pytest
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.test import Client, TestCase, override_settings
from dataworkspace.apps.core.utils import database_dsn
from dataworkspace.tests import factories
from ... | uktrade/data-workspace | dataworkspace/dataworkspace/tests/conftest.py | conftest.py | py | 11,951 | python | en | code | 42 | github-code | 90 |
30005766070 | from rest_framework import serializers
from product.models import ProductModel, ReviewModel
from datetime import datetime, timezone
from dateutil.tz import gettz
from django.db.models import Avg
TODAY = datetime.now(gettz('Asia/Seoul'))
class ReviewSerializer(serializers.ModelSerializer):
class Meta:
mode... | mingoodjob/Task2 | product/serializers.py | serializers.py | py | 3,792 | python | ko | code | 0 | github-code | 90 |
18576260199 | MOD = 10 **9 + 7
INF = 10 ** 10
def main():
K = int(input())
A = list(map(int,input().split()))
m = 2
M = 2
flag = True
for i in range(K - 1,-1,-1):
x = (m + A[i] - 1)//A[i]
y = M//A[i]
if x > y:
flag = False
break
M = y*A[i] + A[i] - 1
... | Aasthaengg/IBMdataset | Python_codes/p03464/s466328223.py | s466328223.py | py | 443 | python | en | code | 0 | github-code | 90 |
41327906210 | import os
import shutil
import json
import math
from collections import OrderedDict
import numpy as np
import jax
import jax.numpy as jnp
from jax import tree_util
from flax import jax_utils
from flax.training import checkpoints
def save_code_and_augments(args):
"""
Save source code and... | sseung0703/Lightweighting_Cookbook | utils.py | utils.py | py | 4,151 | python | en | code | 21 | github-code | 90 |
38873466740 | import tensorflow as tf
node1 = tf.constant(3.0,dtype=tf.float32)
node2 = tf.constant(4.0)
# values are valuated in Sessions
sess = tf.Session()
# placeholders and lambda function definition
# the values of Variables are not initialized when declared, even if you specify the initial value
W = tf.Variable([.3],dtype=... | XTANG16/TensorFlowLearn1 | main.py | main.py | py | 1,718 | python | en | code | 0 | github-code | 90 |
18306256829 | n = int(input())
g = [[-1 for _ in range(15)] for _ in range(15)]
for i in range(n) :
m = int(input())
for j in range(m) :
x,y = map(int, input().split())
#人iが「人xはyである」と証言している
g[i][x-1] = y
ans = 0
for i in range(1<<n) :
honests = [0] * n
for j in range(n) :
if (i>>j) & ... | Aasthaengg/IBMdataset | Python_codes/p02837/s911481556.py | s911481556.py | py | 718 | python | en | code | 0 | github-code | 90 |
4899616860 | # for문
arr = [1, 2, 3, 4, 5]
sum = 0
for item in arr:
print(f'{item:2.2f}')
sum += item
print('합계는',sum)
# 홀짝
vals = [i for i in range(1, 11)] # 리스트를 편하게 만드는 방법
print(vals)
#continue / break # 반복문에만 사용 if문에는 사용 불가능
num = 0
for item in vals:
num += 1
if num % 2 == 0:
#continue # 이후의 것을 수행하지 ... | yeseoz/basic-python2023 | Day03/code09_for.py | code09_for.py | py | 563 | python | ko | code | 0 | github-code | 90 |
18368567989 | N = int(input())
A = list(map(int, input().split()))
B = [0] * N
for i in range(N - 1, -1, -1):
tmp_sum = 0
for j in range((i + 1) * 2 - 1, N, i + 1):
tmp_sum += B[j]
tmp_sum %= 2
B[i] = tmp_sum ^ A[i]
print(sum(B))
print(*[i + 1 for i, b in enumerate(B) if b == 1]) | Aasthaengg/IBMdataset | Python_codes/p02972/s103029464.py | s103029464.py | py | 296 | python | en | code | 0 | github-code | 90 |
11858060365 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 1 16:51:52 2022
last edit Sun Jul 7/3/2022
This program convert the temperature to celcius and,
convert the speed in miles to meter
@author: Ellie Nia
"""
def farenheid_to_celsius(temp): #Function to convert the temperature
result = int((temp - 32) ... | Elliemnia/Conv_temp_spee | Convert _ Tepm _Speed.py | Convert _ Tepm _Speed.py | py | 1,275 | python | en | code | 0 | github-code | 90 |
42642329057 | from detection.core.detector import AbstractDetector
from tensorpack import *
from detection.tensorpacks.coco import COCODetection
from detection.config.tensorpack_config import finalize_configs, config as cfg
from detection.tensorpacks.eval import (
detect_one_image)
from detection.tensorpacks.train import ResNet... | houweidong/models | detection/core/tensorpack_detector.py | tensorpack_detector.py | py | 1,240 | python | en | code | 0 | github-code | 90 |
30282720476 | import sys
#sys.path.append("/home/adrian/Software/blender-2.75a-linux-glibc211-x86_64/2.75/python/lib/python3.4/site-packages/")
import bpy
import os
from mathutils import *
from math import *
def scale_mesh(obj):
#Centre the obj
obj.matrix_world = Matrix()
bb = obj.bound_box
bx = bb[7][0]
by = bb... | AdrianJohnston/ShapeNetRender | blender_utils.py | blender_utils.py | py | 1,105 | python | en | code | 2 | github-code | 90 |
15597647406 |
'''
Experimenting on Audio2Vec
'''
import torch
from Classes_and_Functions.Class_Audio2Vec import Audio2Vec
from Classes_and_Functions.Helper_Functions import \
log_CNN_layers,compute_size,complexity
from Classes_and_Functions.Class_Custome_Pytorch_Dataset import Dataset_SpecSense
from Classes_and_Functions.... | Ranim-94/Stage_Cense_2020 | Code/Code_Testing_Debuggin/Testing_Audio2Vec.py | Testing_Audio2Vec.py | py | 5,989 | python | en | code | 1 | github-code | 90 |
45746965573 | def strStr(haystack, needle):
n = len(needle)
count = 0
if not needle:
return 0
while n + count <= len(haystack):
if haystack[count:count+n] == needle:
return count
count += 1
return -1
x = strStr("mississippi","issi")
print(x)
| amr8644/Leet-Code-Solutions | Leet-Code/Python/Array-Hashing/strStr.py | strStr.py | py | 289 | python | en | code | 0 | github-code | 90 |
40113594561 | from inspect import signature
import numpy as np
from sklearn.base import BaseEstimator, RegressorMixin
from sklearn.utils.validation import check_array, check_X_y, check_is_fitted
from sklearn.metrics import mean_squared_error
from scipy import stats
from .base import BetterModel
from .kde import BetterKernelDensi... | matteosox/statcast | statcast/better/kdr.py | kdr.py | py | 3,724 | python | en | code | 13 | github-code | 90 |
26039148565 |
from electric_charge_reconstructed.mesh_data import mesh_data
air_mesh, air_boundary=mesh_data.read()
from electric_charge_reconstructed.outward_normal.outward_normal import outward_normal
def surface_normal(mesh, boundary, marker):
triangles, points, _, table_l2g, _ = markered_surface.markered_surface(mesh, bou... | mapengfei-nwpu/outward_normal | test_out_normal.py | test_out_normal.py | py | 966 | python | en | code | 0 | github-code | 90 |
18491452489 | from django.contrib.auth.models import User
def profileData(request):
# Retrieve the data you want to send to the base.html template
# You can perform any necessary calculations or queries here
if request.user.is_authenticated:
userId = User.objects.get(id=request.user.id)
if user... | kabbas942/Food-Ordering-System-In-django | foodOrdingSystem/account/context_processors.py | context_processors.py | py | 797 | python | en | code | 1 | github-code | 90 |
4190145422 | # source: https://github.com/kurokourou/vnese_preprocessing
# được sửa lại cho phù hợp với project
class NumberProcessing:
''' Đọc số
'''
def __init__(self):
self.digits = ['0','1','2','3','4','5','6','7','8','9']
self.reads = ['không','một','hai','ba','bốn','năm','sáu','bảy','tám','chín']... | tranvien98/clear_text | number.py | number.py | py | 4,964 | python | vi | code | 0 | github-code | 90 |
18348328429 | from collections import deque
n=int(input())
x=lambda i:int(i)-1
a=[deque(list(map(x,input().split()))+[-1]) for _ in range(n)]
tcnt,ans=n*(n-1),0
chk=set(range(n))
while tcnt>0:
chk_next=set()
for i in chk:
if a[a[i][0]][0]==i:
chk_next.add(i)
if len(chk_next)==0:
ans=-1
... | Aasthaengg/IBMdataset | Python_codes/p02925/s037841280.py | s037841280.py | py | 506 | python | en | code | 0 | github-code | 90 |
72824838057 | import sqlalchemy
from sqlalchemy import create_engine, Column, Integer, String, Float
from sqlalchemy.dialects.postgresql import ARRAY
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import psycopg2 as pg
import create_monthly_stations_df as cdf
import secrets
from io i... | cqlanus/weather_parsing | src/insert_monthly_stations_df.py | insert_monthly_stations_df.py | py | 1,419 | python | en | code | 0 | github-code | 90 |
28483479087 | import pygame
from constantes import *
from auxiliar import Auxiliar
import random
class Plataform:
def __init__(self,path, x, y,width, height, type=1,move_rate_ms=20, change_direction= True):
self.path = path
self.image_list= Auxiliar.getSurfaceFromSeparateFiles(path+r"\{0}.png\\",23,... | NahuelBarneto3/REPO_PROG1 | plataforma.py | plataforma.py | py | 6,636 | python | en | code | 0 | github-code | 90 |
70038469417 | from functools import wraps
__version__ = "0.1"
class Multimple(object):
_IMPL_ATTR_NAME = "_multimple_current"
def __init__(self, func, default):
super(Multimple, self).__init__()
self._impls = {
default: func
}
self._default = default
self._name = func... | bagrat/multimple | multimple/__init__.py | __init__.py | py | 1,886 | python | en | code | 0 | github-code | 90 |
18149260359 | word = input()
num = int(input())
for index in range(num):
code = input().split()
instruction = code[0]
start, end = int(code[1]), int(code[2])
if instruction == "replace":
word = word[:start] + code[3] + word[end+1:]
elif instruction == "reverse":
reversed_ch = "".join(rever... | Aasthaengg/IBMdataset | Python_codes/p02422/s294865379.py | s294865379.py | py | 444 | python | en | code | 0 | github-code | 90 |
22437015369 | class TicTacToe:
def __init__(self):
self.board = [["-" for x in range(3)] for y in range(3)]
def display_board(self):
for row in self.board:
print(" ".join(row))
def check_win(self, char):
# check rows
for row in self.board:
if row == [char, char, c... | GuillaumeBataille/M1S2 | Algoexplomove/TicTacToe/tictactoe.py | tictactoe.py | py | 1,501 | python | en | code | 0 | github-code | 90 |
17127452944 | import mysql.connector
from datetime import date
table_name = "topers_test"
def add_to_db(stock_list):
for stock in stock_list:
connection = mysql.connector.connect(user='root', password='xxxxxxxx', host='127.0.0.1',
database='stockRecoDB')
cursor = co... | surajar994/Top_Gainer_Loser_Update | addTopers.py | addTopers.py | py | 1,370 | python | en | code | 0 | github-code | 90 |
41463651674 | #Author guo
import re
def hasNumbers(inputString):
return any(char.isdigit() for char in (inputString))
f = open('1.txt','r')
result = list()
for line in open('1.txt'):
line = f.readline()
print(line)
# pattern = re.compile(r'.*\d+')
# print(pattern.match(line))
#print(type(line))
if hasNum... | guojia60180/guo.github-io | 找字符串.py | 找字符串.py | py | 644 | python | en | code | 0 | github-code | 90 |
18025754389 | n = int(input())
a = sorted(list(map(int, input().split())))
eat = 0
l = 0
r = n-1
while l < r:
while l < n - 1 and a[l+1] != a[l]:
l += 1
while r > 0 and a[r-1] != a[r]:
r -= 1
if r <= l:
break
eat += 1
l += 1
r -= 1
print(n-eat*2) | Aasthaengg/IBMdataset | Python_codes/p03816/s472692535.py | s472692535.py | py | 281 | python | en | code | 0 | github-code | 90 |
34871048020 | import itertools
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.api.extensions import ExtensionArray
from pandas.core.internals.blocks import EABackedBlock
class BaseReshapingTests:
"""Tests for reshaping and concatenation."""
@pytest.mark.parametrize("in_fram... | pandas-dev/pandas | pandas/tests/extension/base/reshaping.py | reshaping.py | py | 13,931 | python | en | code | 40,398 | github-code | 90 |
30684512409 | from collections import deque
N, M, K = map(int, input().split())
graph = [[0] * M for _ in range(N)]
for _ in range(K):
y, x = map(int, input().split())
graph[y - 1][x - 1] = 1
#print(graph)
dx = [-1, 1, 0, 0]
dy = [0, 0, -1, 1]
def bfs(y, x):
queue = deque()
queue.append((y, x))
graph[y][x... | Hajin74/Problem_Solving | 백준/Silver/1743. 음식물 피하기/음식물 피하기.py | 음식물 피하기.py | py | 770 | python | en | code | 0 | github-code | 90 |
32804573957 | """
tools used to process ramps
"""
import numpy as np
import wifisGetSatInfo as satInfo
import wifisNLCor as NLCor
import wifisRefCor as refCor
import wifisIO
import wifisCombineData as combData
import wifisUncertainties
import wifisBadPixels as badPixels
import wifisHeaders as headers
import os
import time
import... | WIFIS-Team/pipeline | core/wifisProcessRamp.py | wifisProcessRamp.py | py | 19,929 | python | en | code | 1 | github-code | 90 |
1210975802 | import subprocess
command = "11\n"
i = "1\n"*11
payload = ""
command += i + payload
proc = subprocess.Popen(['./a.out'], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
proc.stdin.write(bytes(command, 'utf-8'))
stdout, stderr = proc.communicate()
print(stderr)
| 1nf3rn0-H/CTF | Buffer Overflow/app.py | app.py | py | 291 | python | en | code | 0 | github-code | 90 |
73303940456 | from rest_framework import serializers
from .models import Review
from users.models import User
class ReviewSerializer(serializers.ModelSerializer):
critic = serializers.SerializerMethodField()
def get_critic(self, obj: User):
return {
"id": obj.critic.id,
"first_name": obj.cr... | LuccaHaddadSerejo/django-python-kmdb | reviews/serializers.py | serializers.py | py | 511 | python | en | code | 0 | github-code | 90 |
18394305909 | from collections import deque
N = int(input())
G = [[] for i in range(N)]
for _ in range(N - 1):
a, b = map(int, input().split())
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
C = sorted([int(i) for i in input().split()])
print(sum(C) - max(C))
Q = deque()
Q.append(N - 1)
order = []
visited = [... | Aasthaengg/IBMdataset | Python_codes/p03026/s006814786.py | s006814786.py | py | 639 | python | en | code | 0 | github-code | 90 |
10057794002 | from .data import Database
import requests
import json
from io import BytesIO
import http.client
import urllib.request, urllib.parse, urllib.error
class WriteStream(object):
def __init__(self, uri, content_type, token, refresh):
self.content_type = content_type
self.refresh = refresh
self.... | JohnVinyard/featureflow | featureflow/objectstore.py | objectstore.py | py | 6,058 | python | en | code | 6 | github-code | 90 |
31818344564 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def get_non_constrains(all_cows, constraints):
no_contraints = []
for cow in all_cows:
no_in_contraints = True
for constraint in constraints:
if cow in constraint:
no_in_contraints = False
if no_in_contraints:
... | encgoo/USACO | 2019_Brown_Feb/milk_cows.py | milk_cows.py | py | 2,336 | python | en | code | 0 | github-code | 90 |
12172072212 | from flask import (Blueprint, render_template, redirect, url_for, flash,
request)
from flask_login import current_user, login_required
from FlaskApp.models import Users, Expenses, Tasks
from FlaskApp.admin.forms import (AddGuestForm, EditGuestForm, AddExpensesForm,
Ed... | kirkkenney/Wedding-App | FlaskApp/admin/routes.py | routes.py | py | 16,379 | python | en | code | 1 | github-code | 90 |
18169685529 | n, k = map(int, input().split())
p = [int(i) - 1 for i in input().split()]
c = list(map(int, input().split()))
def mymax(max_variable, candidate):
if max_variable is None:
return candidate
else:
return max(max_variable, candidate)
max_cost = None
for start in range(n):
seen = []
next_ ... | Aasthaengg/IBMdataset | Python_codes/p02585/s702269869.py | s702269869.py | py | 879 | python | en | code | 0 | github-code | 90 |
13778413776 | import os
from dotenv import load_dotenv
from flask import Flask, render_template
from blueprints.art import art_blueprint
from blueprints.blog import blog_blueprint
from api import get_endpoint
import markdown
app = Flask(__name__)
app.register_blueprint(art_blueprint)
app.register_blueprint(blog_blueprint)
lo... | miketheartguy/miwil | backend/app.py | app.py | py | 1,782 | python | en | code | 0 | github-code | 90 |
18241734489 | a,b,c = map(int,(input().split()))
mb = input()
rl = list()
ll = list()
for i in range(a):
if mb[i] == "x":continue
if len(rl) == 0:
rl.append(i + 1)
else:
if rl[-1] + c + 1 <= i + 1:
rl.append(i + 1)
if len(rl) == b:break
for i in range(a-1,-1,-1):
if mb[i]... | Aasthaengg/IBMdataset | Python_codes/p02721/s950207484.py | s950207484.py | py | 678 | python | en | code | 0 | github-code | 90 |
21459706084 | #roots of QE with all three cases
from math import sqrt
#taking coeff a ,b and c
a,b,c= map(int,input("Enter coefficients a,b & c in ax^2 + bx +c = 0 ~~~ " ).split())
determinant = (b**2 - (4*a*c))
#real and equal roots
if determinant == 0:
r = (-b)/(2*a)
print("roots are = ", r," and ", r)
else:
... | Shr11/python_assignments | Q9.py | Q9.py | py | 598 | python | en | code | 0 | github-code | 90 |
29504780474 | import json
# сериализация
# dump(), dumps()
# dict -> object
# list, tuple -> array
# str -> string
# int, float -> number
# True, False -> true, false
# None -> null
data = {
"data1": {
"data2": 1,
"data3": 2
}
}
# with open("json_example.json", "w") as json_file:
# json.dump(data, jso... | elenalb/geekbrains_python | lesson5/json_module.py | json_module.py | py | 599 | python | en | code | 1 | github-code | 90 |
26751544031 | import hashlib
import math
import numpy as np
import random
import matplotlib.pyplot as plt
def get_hash(mode, value, a, b, out_bits):
if (mode == "md5"):
return int(hashlib.md5(np.uint64(value)).hexdigest(), 16) % 2**out_bits
if (mode == "linear"):
return ((a * value + b) % 2**out_bits)
i... | dane8373/MCS425HashFunctions | hash_collision.py | hash_collision.py | py | 2,627 | python | en | code | 0 | github-code | 90 |
17594932060 | import os
import shutil
from .common import *
# Use Django Nose test runner.
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = ['--verbosity=2', '--with-id']
# South's test runner integration will make the test database be created using
# syncdb, rather than via migrations.
SOUTH_TESTS_MIGRATE = True
DEBUG... | satyrius/mtgforge | backend/topdeck/settings/test.py | test.py | py | 1,027 | python | en | code | 0 | github-code | 90 |
20693489257 | #!/usr/bin/env python
"""Friend pairs.
For a group of n friends, let f(n) be the number of ways how they can be paired up or remain single.
Then either the n-th person remains single, or paired up.
If the n-th person is single, then we recur for (n - 1) friends.
If the n-th person is paired up with any of the remaining... | holdamax/362_project1 | Dynamic_Programming/code/friend_pairs.py | friend_pairs.py | py | 1,945 | python | en | code | 2 | github-code | 90 |
41378782257 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse_lazy
from django.db import models
from django.conf import settings
fro... | digris/openbroadcast.org | website/apps/collection/models.py | models.py | py | 3,293 | python | en | code | 9 | github-code | 90 |
38030886189 | # -*- coding: utf-8 -*-
from os import listdir, path
import config
def get_bot_list():
if config.BOTS_TO_RUN:
bots = config.BOTS_TO_RUN.__iter__()
else:
bots = [module[:-3] for module in listdir(path.abspath('bots/'))
if module != '__init__.py' and module[-3:].startswith('.py')... | opplieam/Oppomus | core/botlist.py | botlist.py | py | 350 | python | en | code | 7 | github-code | 90 |
70591651497 | #!/usr/bin/python
from messenger import Messenger
from os import getpid
from sys import argv
acceptorName = argv[1]
messenger = Messenger('http://127.0.0.1:24192/a/dt-py-' + str(getpid()).zfill(5) + '-' + acceptorName)
promisedToAcceptNoEarlierThan = 0
lastAccepted = -1
while True:
currMessage = messe... | DaveCTurner/paxos-dojo | src/python/acceptor.py | acceptor.py | py | 1,208 | python | en | code | 3 | github-code | 90 |
27091075828 | from spack import *
class IntelMklDnn(CMakePackage):
"""Intel(R) Math Kernel Library for Deep Neural Networks
(Intel(R) MKL-DNN)."""
homepage = "https://01.org/mkl-dnn"
url = "https://github.com/01org/mkl-dnn/archive/v0.11.tar.gz"
version('0.11', 'a060a42753f633a146c3db699eeee666')
vers... | matzke1/spack | var/spack/repos/builtin/packages/intel-mkl-dnn/package.py | package.py | py | 453 | python | en | code | 2 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.