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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
22770300983 | # -*- coding:utf-8 -*-
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# 返回ListNode
def ReverseList(self, pHead):
# write code here
stack = []
temp = pHead
while temp is not None:
stack.append(temp)
... | amisyy/leetcode | reverseList.py | reverseList.py | py | 828 | python | en | code | 0 | github-code | 90 |
36127471856 | """fix_activity_different_successive_types_constraint
Revision ID: a1b289f48774
Revises: 65ce09d89bca
Create Date: 2020-10-27 13:21:51.891561
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "a1b289f48774"
down_revision = "65ce09d89bca"
branch_labels = None
depe... | MTES-MCT/mobilic-api | migrations/versions/a1b289f48774_fix_activity_different_successive_types_.py | a1b289f48774_fix_activity_different_successive_types_.py | py | 791 | python | en | code | 1 | github-code | 90 |
18230530636 | """removed old_flags column
Revision ID: 1034996130ac
Revises: 33ef5ceb8902
Create Date: 2018-08-04 15:07:35.466782
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1034996130ac'
down_revision = '33ef5ceb8902'
branch_labels = None
depends_on = None
def upgrad... | lahwaacz/wiki-scripts | ws/db/migrations/versions/1034996130ac_removed_old_flags_column.py | 1034996130ac_removed_old_flags_column.py | py | 684 | python | en | code | 27 | github-code | 90 |
8219111908 | from xml.dom import pulldom
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.core.serializers import base
from django.db import transaction
from django.utils.translation import ugettext as _
from wagtail.core.models import Locale, ParentNotTranslatedError
from ..constants import (
... | fourdigits/wagtail-xliff-translation | wagtail_xliff_translation/serializers/xliff_wagtail.py | xliff_wagtail.py | py | 4,988 | python | en | code | 11 | github-code | 90 |
71874231978 | from flask import Flask
from flask_socketio import SocketIO
from client import client
socketio = SocketIO()
def create_app():
app = Flask(__name__)
app.config["DEBUG"] = True
app.config["SECRET_KEY"] = "secret"
app.register_blueprint(client)
socketio.init_app(app)
return app
| Criss-Wang/Deployable_AI | src/FasterAI/server/setup.py | setup.py | py | 308 | python | en | code | 0 | github-code | 90 |
18553327949 | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
a, b = map(int, input().split())
res = [["."] * 100 for _ in range(100)]
for h in range(50, 100):
for w in range(100):
res[h][w] = "#"
for h in range(0, 100, 2):
for w in rang... | Aasthaengg/IBMdataset | Python_codes/p03402/s074128612.py | s074128612.py | py | 801 | python | en | code | 0 | github-code | 90 |
5007380945 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import math
import unittest
from measurement_stats import value
class TestValue(unittest.TestCase):
def test_simple_arithmetic(self):
"""
A very s... | sernst/Measurement_Statistics | measurement_stats/test/test_value.py | test_value.py | py | 1,857 | python | en | code | 0 | github-code | 90 |
18184025833 | from io import StringIO
import register_crypto_plugin
from bec2format.bf3file import Bf3Component, Bf3File
bf3_file = Bf3File(
{"FirmwareId": "1053", "FirmwareVersion": "1.02.03", "LegicFwVersion": "123.43"},
[
Bf3Component(
{0xC1: bytes([0x11, 0x22, 0x33]), 0xC3: bytes([0x12, 0x33])},
... | baltech-ag/bec2format | appnotes/create_bf3file.py | create_bf3file.py | py | 1,095 | python | en | code | 0 | github-code | 90 |
31972005431 | numlist = '4556737586899855'
card = []
for i in numlist:
card.append(int(i))
check = card.pop()
card.reverse()
print(card)
for i in range(len(card)):
if i % 2 == 0:
card[i] *= 2
print(card)
for i in range(len(card)):
if card[i] > 9:
card[i] -= 9
print(card)
addedca... | davidl0673/pythonstuff | lab20.py | lab20.py | py | 450 | python | en | code | 0 | github-code | 90 |
42938298843 | import re
import time
from datetime import timedelta
from collections import Counter
from collections import OrderedDict
def solution():
student_cnt = 3
room_per_student = 2
needed_room_cnt= 0
student_map = {n:[[],[]] for n in range(1,7)}
for i in range(student_cnt):
sex, grade = map(int,... | sungjinseo/codingtest | boj/13300.py | 13300.py | py | 789 | python | en | code | 0 | github-code | 90 |
32020818173 | import os
os.environ['THEANO_FLAGS']='device=cpu'
os.environ['SIDEKIT']='libsvm=false,theano=false'
import sys
import sidekit
import h5py
import logging
import numpy as np
print('Load task definition')
with open('/home/adit/Desktop/DCASE2017-baseline-system-master/Text_DCASE/fold1_train_names.txt') as inputFile:
... | khac/DCASE-Mandi | 2.py | 2.py | py | 1,919 | python | en | code | 0 | github-code | 90 |
39898012500 | # -*- coding: utf-8 -*-
""" For Parse """
import requests
import lxml.html
from os import remove, system as os_system
""" For make message box """
from tkinter.messagebox import showinfo, askyesno
from Scripts.elements import *
from Scripts.parse_music import parse_data
class UpdateProgram:
de... | D0Nater/BounceBit | Scripts/update_program.py | update_program.py | py | 5,258 | python | en | code | 1 | github-code | 90 |
8876063555 | from wpimath.geometry import Rotation2d
from wpimath.kinematics import SwerveModuleState
def optimize(desired_state: SwerveModuleState, current_angle: Rotation2d):
target_angle = in_0_to_360_scope(
current_angle.degrees(), desired_state.angle.degrees() # type: ignore
)
target_speed: float = desired... | CtrlZ-FRC4096/Robot-2023-Public | robot/swerve/ctre_module_state.py | ctre_module_state.py | py | 1,359 | python | en | code | 6 | github-code | 90 |
20456607704 | __author__ = 'y'
from datetime import *
from dateutil import tz
def todatetime(a_numberOr_datetime):
a = a_numberOr_datetime
if type(a) is int:
t = datetime(a//10000, a%10000//100, a%100)
elif type(a) is datetime:
t = a
else:
raise "无法将对象{0}转化为一个dateimte".format(a)
return t... | norsd/PythonProjects | norlib/DateTime.py | DateTime.py | py | 722 | python | en | code | 0 | github-code | 90 |
4401689869 | import os
import platform
import psutil
import pytest
import urllib3
from _pytest.logging import LogCaptureHandler
urllib3.disable_warnings()
# Disable pytest log capture
def emit(*args, **kwargs) -> None: # pylint: disable=unused-argument
pass
LogCaptureHandler.emit = emit
@pytest.hookimpl()
def pytest_configur... | opsi-org/opsiclientd | tests/conftest.py | conftest.py | py | 2,185 | python | en | code | 0 | github-code | 90 |
12474051536 | from aiogram import Dispatcher
from aiogram.dispatcher import FSMContext
from aiogram.dispatcher.filters import Text
from aiogram.types import CallbackQuery, Message
from tgbot.config import Config
from tgbot.keyboards.inline.itools import ToolsInlineMarkup
from tgbot.keyboards.inline.iusers import UsersInlineMarkup
f... | mandico21/bot_course_task | tgbot/handlers/users/buy_product.py | buy_product.py | py | 8,362 | python | en | code | 1 | github-code | 90 |
3044813436 | import os
from maya import cmds
from functools import partial
import versionMaker.ux.vm_ui.applications.maya.vm_maya_ui
version_maker_path = os.path.dirname(os.path.abspath(__file__)).partition("versionMaker")[0]
if os.name == "nt":
version_maker_path.replace("\\", "/")
logo_quarter_path = "{0}versionMaker/lib_v... | Djangotron/versionMaker | application/maya/ui/maya_menu.py | maya_menu.py | py | 1,279 | python | en | code | 0 | github-code | 90 |
18393477389 | import sys
readline = sys.stdin.readline
S = readline().rstrip().replace("BC","X")
# AAXXX のようにAとXだけで構成されている部分は、
# Xを全て左に移動する
# BとCが残っている部分で切れる
parts = S.replace("B",",").replace("C",",").split(",")
ans = 0
for part in parts:
# Xを探し、Xにあったら、そのときのインデックス - それまでにXを見つけた数する
cnt = 0
for i in range(len(part)):
if... | Aasthaengg/IBMdataset | Python_codes/p03018/s982210516.py | s982210516.py | py | 536 | python | ja | code | 0 | github-code | 90 |
14546177522 | from flask import request, Response
import dbh
import json
import traceback
# ! Less comments here since this is basically a copy of tweets.py
# ? maybe refactor later!
def list_comments():
try:
tweet_id = int(request.args['tweetId'])
if(tweet_id <= 0):
return Response("Invalid tweetId", mimetype="te... | Shawnwood97/HotTakesBackend | comments.py | comments.py | py | 6,838 | python | en | code | 0 | github-code | 90 |
4239372428 | #
# @lc app=leetcode id=70 lang=python3
#
# [70] Climbing Stairs
#
# @lc code=start
class Solution:
def climbStairs(self, n: int) -> int:
if n <= 3:
return n
res = [-1] * (n + 1)
res[1] = 1
res[2] = 2
res[3] = 3
for i in range(4, n+1):
res[i] ... | wangyerdfz/python_lc | 70.climbing-stairs.py | 70.climbing-stairs.py | py | 389 | python | en | code | 0 | github-code | 90 |
41335849860 | import tkinter as tk
import pyscreenrec
scr=tk.Tk()
scr.geometry("400x600")
scr.title("Screen Recorder")
scr.config(bg="#fff")
scr.resizable(False, False)
status=""
def startRec():
status='Recording started'
file=Filename.get()
rec.start_recording(str(file+".mp4"),5)
def pauseRec():
status='Paused... | Robino0aashu/Py-Screen-Recorder | screenRec.py | screenRec.py | py | 1,706 | python | en | code | 0 | github-code | 90 |
5291563308 | import functools
import textwrap
import warnings
from typing import Dict, Optional, Sequence
import torch
import torch.distributed as torch_dist
import torch.nn.functional as F
import torchvision
from packaging import version
from torchmetrics import MetricCollection
from torchvision.models import _utils, resnet
from... | mosaicml/composer | composer/models/deeplabv3/model.py | model.py | py | 11,725 | python | en | code | 4,712 | github-code | 90 |
18236483609 | # E - Sum of gcd of Tuples (Hard)
n, k = map(int, input().split())
X = [0]*(k+1)
mod = 10**9+7
for x in range(k, 0, -1):
#X[x] = ((k//x)**n)%mod
X[x] = pow(k//x, n, mod)
for x_multi in range(x*2, k+1, x):
X[x] -= X[x_multi]
print(sum((i*x)for i, x in enumerate(X))%mod) | Aasthaengg/IBMdataset | Python_codes/p02715/s414437879.py | s414437879.py | py | 292 | python | en | code | 0 | github-code | 90 |
18349832139 | M, D = map(int, input().split())
c = 0
for m in range(1, M+1):
for d in range(1, D+1):
d10 = d//10
d1 = d - (d//10 * 10)
# print(m, d10, d1)
if d10 * d1 == m:
if d1 >= 2 and d10 >= 2:
c += 1
# print(m, d)
print(c) | Aasthaengg/IBMdataset | Python_codes/p02927/s894386883.py | s894386883.py | py | 255 | python | ko | code | 0 | github-code | 90 |
32356215445 | #!/usr/env/python
# -*- coding: utf-8 -*-
'''
Test the XML-RPC-based co-edit recommender.
'''
import logging
from suggestbot import config
from suggestbot.profilers import EditProfiler
import xmlrpc.client
def main():
test_lang = 'en'
test_user = 'Nettrom'
test_n = 500
# Get my edits
profiler =... | nettrom/suggestbot | tests/test_coedits.py | test_coedits.py | py | 1,150 | python | en | code | 20 | github-code | 90 |
38080820657 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from http.server import BaseHTTPRequestHandler, HTTPServer
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == '/':
self.send_response(200)
self.send_header('Content-type', 'text/html')
... | xransum/arsenal | scripts/serve.py | serve.py | py | 1,745 | python | en | code | 1 | github-code | 90 |
45822175369 | #!/usr/bin/env python2.6
from cogent.core.tree import PhyloNode
from cogent import LoadTree
from cogent.parse.tree import DndParser
from optparse import OptionParser
import os, sys
import cProfile
from datetime import date
import time
import numpy
def get_breadth_first_visit_order(tree):
breadth_first_visit_order =... | berkeleyphylogenomics/BPG_utilities | bpg/tools/midpoint_reroot.py | midpoint_reroot.py | py | 8,535 | python | en | code | 1 | github-code | 90 |
10196237547 | def get_status_of_bulk_read_job():
import requests
url = 'https://www.zohoapis.in/crm/bulk/v2/read/143890000017902151'
headers = {
'Authorization': 'Zoho-oauthtoken 1000.7047f44965121222661e780c5357101a.7c3831bf3cf473e4cc3156861d7d8f67',
}
response = requests.get(url=url, headers=headers)... | CorporateIntern/ZOHO_Widgets | python_testing/bulk_api/bulk_api_get_status_part2.py | bulk_api_get_status_part2.py | py | 479 | python | en | code | 0 | github-code | 90 |
11172990150 | import csv
from django.shortcuts import render
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required, permission_required
from survey.forms.filters import SurveyBatchFilterForm
from survey.models import Survey, Investigator
from survey.models.batch import Batch
from survey.ser... | unicefuganda/mics | survey/views/excel.py | excel.py | py | 2,613 | python | en | code | 2 | github-code | 90 |
11440682653 | # -*- coding: utf-8 -*-
import os
import torch
import json
import codecs
import numpy as np
from PIL import Image
from collections import OrderedDict
from mmdet.apis import init_detector, inference_detector
from model_service.pytorch_model_service import PTServingBaseService
import time
from metric.met... | luztxp/luzt-mmdet | customize_service.py | customize_service.py | py | 5,769 | python | en | code | 1 | github-code | 90 |
4717138017 | import sys
t = int(input())
min_lst = []
for i in range(t):
n = int(input())
lst = list(map(int, input().split()))
distance = (max(lst) - min(lst)) * 2
min_lst.append(distance)
for i in min_lst:
print(i)
| ambosing/PlayGround | Python/Problem Solving/BOJ/boj5054.py | boj5054.py | py | 227 | python | en | code | 0 | github-code | 90 |
34541999229 | '''
while True:
user=input("enter the string:")
if "e" in user and "l" in user and "f" in user:
if user.index("e") < user.index("l") < user.index("f"):
print("string is elfish")
else:
print("string is not elfish")
else:
print("str... | shubham04021995/xyz | Task1.py | Task1.py | py | 1,279 | python | en | code | 0 | github-code | 90 |
8008732304 | from django.shortcuts import render, redirect
from .models import Producto
from .forms import ProductoForm, DeleteProductForm
def index(request):
productos = Producto.objects.all()
return render(request, 'App/index.html', {'productos': productos})
def updateproduct(request, producto_id):
producto = Prod... | SaytoonSummer/InventarioExpress | App/views.py | views.py | py | 1,509 | python | es | code | 0 | github-code | 90 |
18171600726 | import os
import sys
import numpy as np
import math
from tqdm import tqdm
import torch
from torch import nn
from torch.utils.data import DataLoader
import torch.backends.cudnn as cudnn
from models.complex_transformer import ComplexTransformer
from models.FNNLinear import FNNLinear
from models.FNNSeparated import FNNSep... | stevenliu000/time-series-domain-adaptation | baseline.py | baseline.py | py | 7,763 | python | en | code | 5 | github-code | 90 |
10425993211 | import pymongo
from geniusrise import BatchOutput, Spout, State
class MongoDB(Spout):
def __init__(self, output: BatchOutput, state: State, **kwargs):
r"""
Initialize the MongoDB class.
Args:
output (BatchOutput): An instance of the BatchOutput class for saving the data.
... | geniusrise/geniusrise-databases | geniusrise_databases/mongodb.py | mongodb.py | py | 4,379 | python | en | code | 1 | github-code | 90 |
40167566561 | '''
Characterizing editing communities
You're now going to combine what you've learned about the BFS algorithm and concept of maximal cliques to visualize the network with an ArcPlot.
The largest maximal clique in the Github user collaboration network has been assigned to the subgraph G_lmc.
INSTRUCTIONS
100XP
Go ou... | kvmakk/Data-Science-Python | 21-network-analysis-in-python-(part-1)/04-bringing-it-all-together/08-characterizing-editing-communities.py | 08-characterizing-editing-communities.py | py | 2,018 | python | en | code | 6 | github-code | 90 |
5802623037 | from __future__ import absolute_import, division, print_function
from six.moves import (filter, input, map, range, zip) # noqa
import unittest
from biggus.experimental.key_grouper import (
dimension_group_to_lowest_common, normalize_slice, group_keys)
class Test_normalize_slice(unittest.TestCase):
def ... | SciTools/biggus | biggus/tests/unit/experimental/test_key_grouper.py | test_key_grouper.py | py | 6,980 | python | en | code | 54 | github-code | 90 |
15607966091 | # Check if two words are anagrams
# Example:
# find_anagrams("hello", "check") --> False
# find_anagrams("below", "elbow") --> True
word = input("Enter your word choice: ")
anagram = input("Enter your anagram answer: ")
def find_anagram(word, anagram):
# [assignment] Add your code here
# Removing of spaces
... | Opetimistic/Finding-Anagrams | main.py | main.py | py | 1,287 | python | en | code | 0 | github-code | 90 |
17437787560 | import collections
import tensorflow as tf
from tensorflow_model_remediation.min_diff.keras.utils import structure_utils
# Convenience class to help with packing and unpacking.
class MinDiffPackedInputs(
collections.namedtuple("MinDiffPackedInputs",
["original_inputs", "min_diff_data"... | tensorflow/model-remediation | tensorflow_model_remediation/min_diff/keras/utils/input_utils.py | input_utils.py | py | 17,436 | python | en | code | 42 | github-code | 90 |
33662622167 | """
Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:
Only one letter can be changed at a time.
Each transformed word must exist in the word list. Note that beginWord is not a transformed word.
Note:
Return 0 ... | algorithm004-04/algorithm004-04 | Week 06/id_014/Leetcode_127_014.py | Leetcode_127_014.py | py | 1,692 | python | en | code | 66 | github-code | 90 |
18430669329 | n = int(input())
s = input()
import collections
c = collections.Counter(s)
res = 1
m = 10 ** 9 + 7
for k in c:
res *= (c[k] + 1)
res %= m
res -= 1
res %= m
print(res)
| Aasthaengg/IBMdataset | Python_codes/p03095/s081198104.py | s081198104.py | py | 175 | python | en | code | 0 | github-code | 90 |
4669941895 | import shutil
import os
from benchmarks.simulparam_and_tolerances import *
from mesh import CartesianMesh
from properties import MaterialProperties, FluidProperties, InjectionProperties, SimulationProperties
from fracture import Fracture
from controller import Controller
from fracture_initialization import Geometry, In... | GeoEnergyLab-EPFL/PyFrac | benchmarks/test_simulations.py | test_simulations.py | py | 20,212 | python | en | code | 27 | github-code | 90 |
18344479039 | n,k = list(map(int,input().split()))
s = str(input())
ans = 0
for i in range(1,len(s)):
if s[i] == s[i-1]:
ans += 1
if (n-1) >= (ans + 2*k):
ans += 2*k
else:
ans = n - 1
print(ans) | Aasthaengg/IBMdataset | Python_codes/p02918/s278530712.py | s278530712.py | py | 192 | python | en | code | 0 | github-code | 90 |
72138812138 | from pandas import read_csv
import matplotlib.pyplot as plt
from AI.AI_UI import AI_UI
from AI.DataFrameFileTranslator import get_weights_and_biases
from AI.NeuralNetwork import NeuralNetwork
from AI.ThreadAI import ThreadAI
from SnakeGame.Board import Board
from SnakeGame.Snake import Snake
def to_str_arr(arr):
... | StanislawMalinski/SnakeAI | AI/ManagerAI.py | ManagerAI.py | py | 2,408 | python | en | code | 0 | github-code | 90 |
20404168844 | from Queue import Queue
from collections import defaultdict, deque
import time
import config
from isolation.indexes.GlobalLockIndex import GlobalLockIndex
from isolation.indexes.SidetrackQueryIndex import SidetrackQueryIndex
from policies.AbstractPolicy import AbstractPolicy
from queries.PredicateLock import NotSchedu... | robertclaus/python-database-concurrency-control | policies/PhasedPolicy.py | PhasedPolicy.py | py | 8,266 | python | en | code | 0 | github-code | 90 |
40990098621 | # -*- coding: utf-8 -*-
'''
Author : Huseyin BIYIK <husenbiyik at hotmail>
Year : 2016
License : GPL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either v... | boogieeeee/repository.boogie | plugin.program.boogie-players/lib/players.py | players.py | py | 1,915 | python | en | code | 1 | github-code | 90 |
71996759016 | ################################################################################
## Eyeball Segmentation Evaluation ##
## Compute the performance metrics (dice coefficient, intersection over ##
## union, Matthew's correlation coefficient, and accuracy, Hausdorff ... | kapikantzari/segmentation-evaluation | drafts/eyeball-segmentation-evaluation_draft2.py | eyeball-segmentation-evaluation_draft2.py | py | 9,412 | python | en | code | 6 | github-code | 90 |
42598438936 | s = input()
one, two, three, four, five = "False", "False", "False", "False", "False"
for i in range(len(s)):
if (s[i].isalnum()):
one = "True"
if (s[i].isalpha()):
two = "True"
if (s[i].isdigit()):
three = "True"
if (s[i].islower()):
four = "True"
if (s[i].isupper())... | praneeth14/Hackerrank | Python/Strings/String Validators.py | String Validators.py | py | 403 | python | en | code | 1 | github-code | 90 |
17950254159 | import sys
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
H, W = map(int, input().split())
count = Counter()
for _ in range(H):
count += Counter(input())
four = (H // 2... | Aasthaengg/IBMdataset | Python_codes/p03593/s911987741.py | s911987741.py | py | 817 | python | en | code | 0 | github-code | 90 |
21018764061 | import Tkinter as tk
import pygame as pg
import math as m
import random as r
from operator import add
import os
# Global variables
width, height, center = 1280, 720, (640, 360)
first_iteration = True
xref_point = (50, 0, 0)
yref_point = (0, -50, 0)
zref_point = (0, 0, 50)
# OBJ class definition from reading file
clas... | JakeVidal/OLD-Model-viewer-project | modelviewer.py | modelviewer.py | py | 5,554 | python | en | code | 1 | github-code | 90 |
32552908239 | import sys
def convert(t):
return (81 * (t[0] - 1) + 9 * (t[1] - 1) + t[2])
def get_singletons(numbers, clauses):
for i in range(len(numbers)):
if numbers[i] > 0:
clauses.append(' '.join([str(convert((int(i / 9) + 1, i % 9 + 1, numbers[i]))), '0']))
def existence(clauses):
for i in range(1, 9 + 1)... | RoxanneDewing/SAT-Project | FinalProject/sud2sat_hard.py | sud2sat_hard.py | py | 2,406 | python | en | code | 1 | github-code | 90 |
27917201810 | import math
import random
non_relational = {
"shape": ["Object with <color> have the <shape> shape."],
"pos" : ["Object with <color> is on the <pos>."],
"count": ["There are <count> <shape> shape objects."]
}
relational = {
"closet": ["Object with <color> is closet to the <shape> object.",
... | nmhkahn/sort-sort-of-clevr | source/captions.py | captions.py | py | 5,017 | python | en | code | 0 | github-code | 90 |
22315101802 | """
문제 설명
매운 것을 좋아하는 Leo는 모든 음식의 스코빌 지수를 K 이상으로 만들고 싶습니다. 모든 음식의 스코빌 지수를 K 이상으로 만들기 위해 Leo는 스코빌 지수가 가장 낮은 두 개의 음식을 아래와 같이 특별한 방법으로 섞어 새로운 음식을 만듭니다.
섞은 음식의 스코빌 지수 = 가장 맵지 않은 음식의 스코빌 지수 + (두 번째로 맵지 않은 음식의 스코빌 지수 * 2)
Leo는 모든 음식의 스코빌 지수가 K 이상이 될 때까지 반복하여 섞습니다.
Leo가 가진 음식의 스코빌 지수를 담은 배열 scoville과 원하는 스코빌 지수 K가 주어질 때, 모든 음... | polkmn222/programmers | python/연습문제/level2/더 맵게.py | 더 맵게.py | py | 1,672 | python | ko | code | 1 | github-code | 90 |
72207901098 | # -*- coding: utf-8 -*-
# @Time : 2019/8/19 0019 15:43
# @Author : 没有蜡笔的小新
# @E-mail : sqw123az@sina.com
# @FileName: Climbing Stairs.py
# @Software: PyCharm
# @Blog :https://blog.csdn.net/Asunqingwen
# @GitHub :https://github.com/Asunqingwen
"""
You are climbing a stair case. It takes n steps to reach to the... | Asunqingwen/LeetCode | easy/Climbing Stairs.py | Climbing Stairs.py | py | 1,000 | python | en | code | 0 | github-code | 90 |
6066541552 | from .serializers import RegistrantSerializer
from registrant.models import Registrant
from rest_framework.response import Response
from rest_framework import status
from rest_framework.decorators import api_view
# In this class we will decalre a bunch of function based views that are gonna handle
# the different API... | master-8702/mezgeba_app | registrant/api/views.py | views.py | py | 7,759 | python | en | code | 0 | github-code | 90 |
18389393969 | n = int(input())
l = list(map(int, input().split()))
res = float('inf')
total = sum(l)
w = 0
for i in range(n):
w += l[i]
res = min(abs(w - (total - w)), res)
print(res) | Aasthaengg/IBMdataset | Python_codes/p03012/s944332271.py | s944332271.py | py | 178 | python | en | code | 0 | github-code | 90 |
17168456766 | import sys, os, time
def part1(data):
bit_length = len(data[0])
gamma_rate = [0] * bit_length
mask = 0xFF if bit_length < 8 else 0xFFFF
for binary in data:
bits = tuple(map(int, binary))
for i in range(bit_length):
gamma_rate[i] += 1 if bits[i] else -1
gamma_rate = ""... | PROxZIMA/Advent-of-Code | 2021/Day_03/day-3.py | day-3.py | py | 2,305 | python | en | code | 0 | github-code | 90 |
18315219909 | n,m=map(int,input().split())
s=input()
x=n
a=[]
while x!=0:
for i in range(min(m,x),0,-1):
if s[x-i]=="0":a.append(i);break
if i==1:print(-1);exit()
x-=i
print(*a[::-1]) | Aasthaengg/IBMdataset | Python_codes/p02852/s015439109.py | s015439109.py | py | 181 | python | en | code | 0 | github-code | 90 |
29153722021 | # Example
class Course:
def __init__(self, title, teacher):
self.title = title
self.teacher = teacher
self.meetings = []
self.students = []
def add_meeting(self, new_meeting):
self.meetings.append(new_meeting)
def add_student(self, new_student):
self.studen... | jagman014/PythonProjects | Courses/ObjectOrientedCourse/Section5/more_inheritance.py | more_inheritance.py | py | 1,376 | python | en | code | 0 | github-code | 90 |
5218029392 | import requests
from tmdb import TMDBHelper
from pprint import pprint
tmdb_helper = TMDBHelper('45fe12dfc780769c529bfbcba00bf611')
url = tmdb_helper.get_request_url(region='KR', language='ko')
data = requests.get(url).json()
def credits(title):
movie_id = tmdb_helper.get_movie_id(title)
url2 = f'https://a... | icehoneypark/homework | pjt02(21-07-30)/problem_e.py | problem_e.py | py | 1,245 | python | ko | code | 0 | github-code | 90 |
70297695658 | # 타잔 알고리즘
# 그래프 상의 강한 결합 요소를 찾는 알고리즘
# 백준 2150
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
def scc(graph, V):
finished = [False] * (V+1)
label = [0] # 누적 라벨 : 노드를 한 번 방문할 때마다 1씩 증가
labels = [0] * (V+1)
result, s = [], []
def _scc(u):
label[0] += 1
pare... | JKbin/Study-of-Coding-with-Python | BaekJoon/Platinum_V/2150.py | 2150.py | py | 1,700 | python | ko | code | 0 | github-code | 90 |
21053752738 | import pygame as pg
import Object
import Ask_Question
import Search_Question
import Auto_Tag
pg.init()
win_x, win_y = 1280, 720
screen = pg.display.set_mode((win_x, win_y))
font_path = './font/FC Minimal Regular.ttf'
# font_path = '/Users/Peace/Desktop/Studio4-main/project/font/FCMinimalRegular.otf'
font_size = 30
... | RyuuseiX/Studio4 | project/replica.py | replica.py | py | 12,617 | python | en | code | 0 | github-code | 90 |
25254429992 | import sys
N, M = map(int, sys.stdin.readline().split())
dna_list = []
for _ in range(N):
dna_list.append(input())
answer = ''
hamming_distance = 0
for i in range(M):
count = [0, 0, 0, 0]
for j in range(N):
if dna_list[j][i] == 'A':
count[0] += 1
elif dna_list[j][i] == 'C':
... | choinara0/Algorithm | Baekjoon/BruteForce Algorithm/1969번 - DNA/1969번 - DNA.py | 1969번 - DNA.py | py | 782 | python | en | code | 0 | github-code | 90 |
37169279271 | import os
# make folders
if not os.path.isdir("proxies/"):
os.mkdir("proxies/")
if not os.path.isdir("proxies/scraped/"):
os.mkdir("proxies/scraped/")
if not os.path.isdir("proxies/checked/"):
os.mkdir("proxies/checked/")
# version shit
__version_info__ = (1, 1, 1)
__version__ = '.'.join(map(str, __versio... | kapsikkum/hide | hide/__init__.py | __init__.py | py | 332 | python | en | code | 0 | github-code | 90 |
18320661779 | # coding: utf-8
# Your code here!
import sys
import itertools
import math
n=int(input())
point=[]
for i in range(n):
arr=list(map(int,input().split()))
point.append(arr)
ans=[]
l = [i for i in range(n)]
for v in itertools.permutations(l, n):
dist=0
for j in range(len(v)-1):
dist+=math.sqrt(ma... | Aasthaengg/IBMdataset | Python_codes/p02861/s717085939.py | s717085939.py | py | 456 | python | en | code | 0 | github-code | 90 |
20778697614 | from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.utils.timezone import now
# Create your models here
class Buyer(models.Model):
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
related_name='buyer',
on_delete=m... | pachecolv/DRF-Market-Place | django_api/market_place/mp_app/models.py | models.py | py | 2,039 | python | en | code | 0 | github-code | 90 |
32114489354 | class MyGraph:
def __init__ (self, filename):
file = open(filename, "r")
self.ad_list = []
line = file.readlines()
pair = (1,[])
self.vert = int(line[0])
self.edge = int(line[1])
for x in range(self.vert):
pair = (i + 1 ,[])
self.ad_list.append(pair)
for x in range... | Jasonsitu/CSC-202 | assignment5/my_graph.py | my_graph.py | py | 1,080 | python | en | code | 0 | github-code | 90 |
18215942769 | n,k=map(int,input().split())
A=list(map(int,input().split()))
A=[i-1 for i in A]
seen=[-1]*n;seen[0]=0
cnt=0
now=0
roop=[0]
while 1:
if seen[A[now]]!=-1:
roopnum=cnt-seen[A[now]]+1
mae=seen[A[now]]
trueroop=roop[seen[A[now]]: cnt+1]
#print(trueroop,roopnum,mae)
break
now... | Aasthaengg/IBMdataset | Python_codes/p02684/s988825697.py | s988825697.py | py | 456 | python | en | code | 0 | github-code | 90 |
41327688400 | #!/home/bastelbot/anaconda3/bin/python
from openai import OpenAI
import dotenv
import os
import requests
import json
from datetime import date
import shutil # save img locally
from time import time
import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument("-lon", help="longitude for weather fore... | sbultmann/climate-picture-AI-zer | main.py | main.py | py | 4,125 | python | en | code | 0 | github-code | 90 |
39750831837 | import pytest
from products.factory import ProductFactory
# @pytest.mark.django_db
# def test_create_product(tokenized_client, product_factory):
# product = product_factory()
# assert product.name == "test_product"
# assert product.price == 10
# assert product.description == "test_description"
# a... | levin-mutai/kiosk | tests/api/test_products.py | test_products.py | py | 1,973 | python | en | code | 0 | github-code | 90 |
9517631316 | import os
import streamlit.components.v1 as components
from dataclasses import dataclass, asdict, field
from typing import List
_DEVELOP_MODE = os.getenv('STREAMLIT_ANTD_DEVELOP_MODE') == 'true'
if _DEVELOP_MODE:
_component_func = components.declare_component(
"streamlit_antd_result",
url="http:/... | pragmatic-streamlit/streamlit-antd | streamlit_antd/result/__init__.py | __init__.py | py | 1,852 | python | en | code | 5 | github-code | 90 |
10889146572 | from sqlalchemy.orm import Session
from pydantic import parse_obj_as
from typing import List
import csv
from models import UserCreate, ProductCreate, OrderCreate, OrderItemCreate
def fill_table_from_csv(file_path: str, model: BaseModel, db: Session) -> None:
with open(file_path) as f:
csv_reader = csv.Dict... | PavelApanas/HomeWork | function_csv.py | function_csv.py | py | 1,029 | python | en | code | 0 | github-code | 90 |
36271002037 | from __future__ import annotations
import typing as t
import itertools
from enum import Enum
from abc import ABC, abstractmethod
from collections import defaultdict
from yeetlong.counters import FrozenCounter
from yeetlong.multiset import FrozenMultiset, Multiset
from mtgorp.models.persistent.cardboard import Cardbo... | guldfisk/magiccube | magiccube/update/report.py | report.py | py | 15,091 | python | en | code | 0 | github-code | 90 |
18293831719 | from math import ceil
def gcd(a,b):
while b:
a,b = b,a%b
return a
def lcm(a,b):
return a*b//gcd(a,b)
n,m = map(int,input().split())
A = list(map(int,input().split()))
A = [a//2 for a in A]
pre = None
for a in A:
c = 0
while a % 2 ==0:
a //= 2
c += 1
if pre is None:
pre = c... | Aasthaengg/IBMdataset | Python_codes/p02814/s538197050.py | s538197050.py | py | 541 | python | en | code | 0 | github-code | 90 |
39396975717 | from django.contrib import admin
# from .models.bienImmobilier import BienImmobilier
from .models.proprietaire import Proprietaire
from .models.zone import Zone
from .models.appartement import Appartement
from .models.immeuble import Immeuble
from .models.maison import Maison
# Register your models here.
class Propri... | abdoulayeboki/gestion_immobiliere | projet/moduleAdministrative/admin.py | admin.py | py | 2,493 | python | en | code | 0 | github-code | 90 |
29369212547 |
from database import sync_session_maker
from models import Object
from sqlalchemy import insert
def insert_object() -> None:
with sync_session_maker() as session:
object_1 = Object(name="object_1")
session.add(object_1)
object_2 = Object(name="object_2")
session.add_all([object_1... | orionmike/cheatsheet_sqlalchemy | src/orm/insert.py | insert.py | py | 999 | python | en | code | 0 | github-code | 90 |
18314041689 | def getN():
return int(input())
def getNM():
return map(int, input().split())
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(input()) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
return random.randint(ran1,... | Aasthaengg/IBMdataset | Python_codes/p02850/s486767993.py | s486767993.py | py | 1,878 | python | en | code | 0 | github-code | 90 |
34871542980 | from datetime import datetime
import numpy as np
import pytest
from pandas import (
DataFrame,
Index,
Series,
)
import pandas._testing as tm
from pandas.tests.groupby import get_groupby_method_args
pytestmark = pytest.mark.filterwarnings(
"ignore:Passing a BlockManager|Passing a SingleBlockManager:De... | pandas-dev/pandas | pandas/tests/groupby/test_groupby_subclass.py | test_groupby_subclass.py | py | 4,143 | python | en | code | 40,398 | github-code | 90 |
34407499152 | """Model refueling at several gas stations.
Each gas station has several fuel pumps and a single, shared reservoir. Each
arrving car pumps gas from the reservoir via a fuel pump.
As the gas station's reservoir empties, a request is made to a tanker truck
company to send a truck to refill the reservoir. The tanker com... | westerndigitalcorporation/desmod | docs/examples/gas_station/gas_station.py | gas_station.py | py | 10,540 | python | en | code | 58 | github-code | 90 |
2588610957 | from itertools import cycle
import codecs
def crack_single_charracter_XOR(message):
for i ,key in enumerate('abcdefghijklmopqrstuvwxyz'):
cyphered = b''.join(chr(ord(a)^ord(b)) for a,b in zip(message, cycle(key)))
dMessage = b''.join(chr(ord(c)^ord(k)) for c,k in zip(cyphered, cycle(key)))
... | ThomasAlakopsa/encryption_programs | old/crypt3.py | crypt3.py | py | 715 | python | en | code | 0 | github-code | 90 |
19760971017 | class Solution:
def equalPairs(self, grid) -> int:
n = len(grid)
count = 0
for i in range(n):
k, flag = 0, True
while k < n:
if grid[i][k] != grid[k][i]:
flag = False
break
k += 1
... | Akshay-Savad/data-strutures-practise | LeetCode_75/LT_2352.PY | LT_2352.PY | py | 528 | python | en | code | 1 | github-code | 90 |
19231869610 | from random import choice
lista = ['pedra', 'papel', 'tesoura']
a = choice (lista)
b = str (input ('Jokenpô: ')).strip ().lower ()
if a == b:
print ('\033[33mEu escolhi o mesmo que você\033[m')
elif a == 'pedra' and b == 'tesoura':
print ('\033[31mPedra quebra tesoura\033[m')
elif a == 'tesoura' and b == 'pape... | cauamarcos/cursoemvideo | python/ex045.py | ex045.py | py | 713 | python | en | code | 0 | github-code | 90 |
17663123557 | # Day 5: Hydrothermal Venture
# Author: Nathan Bloom
import argparse
def print_board(board):
for line in board:
for ch in line:
if ch != 0:
print(ch, end=" ")
else:
print(". ", end="")
print()
def part1(input_file):
lines = set()
wi... | nxb4951/AdventOfCode2021 | day5.py | day5.py | py | 4,526 | python | en | code | 0 | github-code | 90 |
72092790697 | # /* cSpell:disable */
import json
import logging
import requests
import sys
import click
from datetime import datetime
import os
import pandas as pd
from prophet import Prophet
from pandas.tseries.offsets import DateOffset
import numpy as np
class suppress_stdout_stderr(object):
'''
A context manager for doin... | flexera-public/optima-tools | forecasting/total_cloud_costs.py | total_cloud_costs.py | py | 5,318 | python | en | code | 0 | github-code | 90 |
70747843816 | #to insure that network state class is working
#test_network_state.py located in test folder
# test_network_state.py located in test folder
import sys
import os
# Add the parent directory to the sys.path to allow imports from the parent directory
current_dir = os.path.dirname(os.path.abspath(__file__))
parent_dir = os... | natanzi/RAN-Fusion | test/test_network_state.py | test_network_state.py | py | 985 | python | en | code | 0 | github-code | 90 |
1435806079 | ## first, import the socket library to be used in communication ##
import socket
from rsa import *
## After importing, you need to create a socket object ##
sender = socket.socket()
print("Sender socket is created successfully and ready to send messages")
# Choose the port to start communicating on ( the ip i... | MohamedElhadidy0019/Break-RSA | sender.py | sender.py | py | 1,344 | python | en | code | 2 | github-code | 90 |
72211378858 | n = int(input())
number = []
for i in range(n):
number.append(list(map(int, input().split(' '))))
# DP 테이블
dp = []
j = 0
# DP 테이블 또한 피라미드 형태로
for i in range(n):
j += 1
dp.append([0] * j)
# DP 테이블 초기값
dp[0] = number[0]
# DP 진행, 피라미드 꼭대기부터 시작
# 피라미드 형태의 dp 값을 하나씩 보기 위해 1씩 증가하는 j를 생성
j = 1
... | khyup0629/Algorithm | 다이나믹 프로그래밍/정수 삼각형.py | 정수 삼각형.py | py | 1,904 | python | ko | code | 3 | github-code | 90 |
19253992164 | #%%
import pandas as pd
import numpy as np
#%%
from sklearn import preprocessing
names = ['age', 'workclass', 'fnlwgt', 'education', 'education-num',
'marital-status', 'occupation', 'relationship', 'race', 'sex',
'capital-gain', 'capital-loss', 'hours-per-week', 'native-country', 'class']
data =... | ranggarmaste/ML-UnsupervisedGraphTheoritic | create_important_dataset.py | create_important_dataset.py | py | 1,668 | python | en | code | null | github-code | 90 |
18302711409 | n = int(input())
if n%2:
print(0)
else:
#2と5があれば10ができる→5の方が少ない→素因数5の数を数える
ans = (n//5)//2
tmp = 5
while True:
tmp *= 5
if tmp > n:
break
ans += (n//tmp)//2
print(ans) | Aasthaengg/IBMdataset | Python_codes/p02833/s482140476.py | s482140476.py | py | 278 | python | ja | code | 0 | github-code | 90 |
43033255917 | __author__ = "Kaustav Bhattacharya"
__credits__ = "Kaustav Bhattacharya"
__maintainer__ = "Kaustav Bhattacharya"
__email__ = "kaustavofficial1808@gmail.com"
# Given two sorted arrays, X[] and Y[] of size m and n each,
# merge elements of X[] with elements of array Y[] by maintaining the sorted order,
# i.e., fill X[... | kaustav1808/competitive-programming | Striver SDE Sheet/MergetwoSortedArray.py | MergetwoSortedArray.py | py | 1,718 | python | en | code | 0 | github-code | 90 |
70303840618 | #general imports
import numpy as np
import time
import pickle
#data set import
from keras.datasets import cifar100
#model imports
from keras.layers import Conv2D, MaxPooling2D
from keras.layers import Dropout, Flatten, Dense
from keras.models import Sequential
from keras import backend as K
#training
from keras.call... | brandons209/cifar-100-cnn | cnn.py | cnn.py | py | 5,701 | python | en | code | 0 | github-code | 90 |
33117507119 | import random
# функция для записи результата игры в файл
def result(name, attempts):
with open("game.txt", "a") as file:
file.write(f"{name}: {attempts} attempts\n")
# загадываем число
number = random.randint(1, 100)
attempts = 0
name = input("Введите свое имя: ")
# игровой цикл
while True:
guess = ... | NicolaySorokin/127_sorokin_nicolay | hw14.py | hw14.py | py | 832 | python | ru | code | 0 | github-code | 90 |
25023089908 | #!/usr/bin/env python3
import sys
from sodacomm.tools import testwrapper
def less_sum_1(arr):
n = len(arr)
s = 0
for i in range(1, n):
t = 0
for j in range(0, i):
if arr[j] <= arr[i]:
t += arr[j]
s += t
return s
def less_sum_2(arr):
n = len(arr)... | missingjs/soda | works/zcy2/c8/q13.py | q13.py | py | 1,366 | python | en | code | 0 | github-code | 90 |
12191163216 | # -*-coding:utf-8-*-
# @time :2019/5/5 13:40
# Author :lemon_youran
# @Email :1063699580@qq.com
# @File :learn_unittest.PY
# @Software :PyCharm
import unittest
class TestAdd(unittest.TestCase):
def setUp(self):
print('----开始测试了----')
def tearDown(self):
print('----测试结束了----')
... | huididihappay/api | pg_api_master/learn_python/learn_unittest/uitest/l_nuittest/learn_unittest.py | learn_unittest.py | py | 1,438 | python | en | code | 0 | github-code | 90 |
73620459177 | """
倒过来想,一个数 * 2 就是把它的二进制全部左移一位,也就是说 1的个数是相等的。
那么我们可以利用这个结论来做。res[i /2] 然后看看最低位是否为1即可(上面*2一定是偶数,
这边比如15和14除以2都是7,但是15时通过7左移一位并且+1得到,14则是直接左移)
所以res[i] = res[i >>1] + (i&1).
"""
class Solution(object):
def countBits(self, num):
"""
:type num: int
:rtype: List[int]
"""
ans = ... | xiangzuo2022/leetcode_python | python/338.counting_bits.py | 338.counting_bits.py | py | 1,771 | python | zh | code | 0 | github-code | 90 |
40428122653 | import numpy as np
import sys
import tensorflow as tf
from nn import layer
from ops.learning_rate import learning_rate
# from tf_collection.collection import *
from nn.amc.memory import SequentialMemory
"""
https://github.com/MorvanZhou/Reinforcement-learning-with-tensorflow/blob/master/contents/9_Deep_Deterministic_... | mehravehj/heracles | nn/amc/ddpg.py | ddpg.py | py | 20,167 | python | en | code | 0 | github-code | 90 |
14864205301 | from django.db import models
from django.db.models.base import Model
from django.db.models.fields import DateTimeField, DecimalField, TextField, PositiveIntegerField, CharField
from django.db.models.fields.related import ForeignKey
from django.utils.translation import ugettext as _
from .choices import LONGITUDE_DIREC... | rafaelgontijo/Tracker_GT06_Connection | models/TrackerPosition.py | TrackerPosition.py | py | 1,642 | python | en | code | 0 | github-code | 90 |
1250233662 | import re
import string
import dateparser
from tpdb.BaseSceneScraper import BaseSceneScraper
from tpdb.items import SceneItem
class SiteLoveWettingSpider(BaseSceneScraper):
name = 'LoveWetting'
start_urls = [
'https://www.lovewetting.com',
]
selector_map = {
'title': '',
'de... | SFTEAM/scrapers | scenes/siteLoveWetting.py | siteLoveWetting.py | py | 2,857 | python | en | code | null | github-code | 90 |
17944992519 | N, K = (int(x) for x in input().split())
Plot = [tuple(int(x) for x in input().split()) for _ in range(N)]
X = [p[0] for p in Plot]
Y = [p[1] for p in Plot]
X.sort()
Y.sort()
#全2点間で長方形の辺を作り、その内内部点がK個のものだけ面積を比較する。
ans = 10e20
from itertools import combinations
for x1, x2 in combinations(X, 2):
for y1 in Y:
y... | Aasthaengg/IBMdataset | Python_codes/p03576/s393640051.py | s393640051.py | py | 571 | python | en | code | 0 | github-code | 90 |
24445974540 | import eyed3
import csv
import pandas as pd
import os
##os.getcwd()
def main():
# args = sys.argv[1:]
# folder = str(args[0])
folder = str(67)
path_out = 'c:/Users/halatm/Desktop/git/cuentame_preprocess/datos/mp3/' + folder + '/out/'
resumen = pd.read_csv(path_out + 'resumen_libro.csv', sep=';').... | sorrento/cuentame_preprocess | tag_mp3s.py | tag_mp3s.py | py | 1,051 | python | en | code | 0 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.