language stringclasses 15
values | src_encoding stringclasses 34
values | length_bytes int64 6 7.85M | score float64 1.5 5.69 | int_score int64 2 5 | detected_licenses listlengths 0 160 | license_type stringclasses 2
values | text stringlengths 9 7.85M |
|---|---|---|---|---|---|---|---|
JavaScript | UTF-8 | 1,646 | 2.703125 | 3 | [] | no_license |
import * as ActionConstants from '../actiontypes/quotes'
const initialState = {
isLoading : true,
quotes: []
}
const reducer = (state = initialState , action) => {
switch (action.type) {
case ActionConstants.START_LOADING:
return {...state, isLoading: true}
case ActionC... |
Python | UTF-8 | 1,319 | 3.9375 | 4 | [] | no_license | import random
n = int(input("Вкажіть довжину списку \n "))
lst = random.sample(range(1, 100), n)
print("Input list: {}".format(lst))
def split(l, start, end):
"""
Splits list into two parts.
Splits list into two parts each element of first part
are not bigger then every element of last part.
"""
i = start -... |
C++ | UTF-8 | 3,725 | 3.171875 | 3 | [] | no_license | #ifndef __JJC__INFO__HPP__
#define __JJC__INFO__HPP__
#include <string>
#include <iostream>
#include "MathToolbox.hpp"
#define COUT std::cout
#define F_PTR(s) ((unsigned long)s)
const std::string std_ops[] = {"__Mean", "__Max", "__Min", "__Median", "__Range",
"__Magnitude", "__Sum", "__Product", "__Clamp",
... |
C++ | UTF-8 | 4,655 | 2.546875 | 3 | [] | no_license | #include <Console.h>
#include <Process.h>
#include <SPI.h>
#include <RH_RF95.h>
RH_RF95 rf95;
char DeviceID[20]="\0"; //Storage DeviceID or Device identifier
char lon[20]="\0"; //Storage longtitude
char lat[20]="\0"; //Storage latitude
char alt[20]="\0"; //Storage altitude
char tem[20]=... |
JavaScript | UTF-8 | 768 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | "use strict"
// api.openweathermap.org / data / 2.5 / weather ? q = { city name } & appid={ your api key }
let city = prompt("Enter City ")
const url = "http://api.openweathermap.org/data/2.5/weather?appid=20642b561dd890fd5884bff2116b23ec&q=" + city;
$.ajax({
url: url,
success: function (result) {
... |
PHP | UTF-8 | 2,750 | 2.75 | 3 | [] | no_license | <?php
require_once(__DIR__."/../core/ValidationException.php");
require_once(__DIR__."/../model/ActivitiesstatisticsMapper.php");
class Activitiesstatistics{
private $activityname;
private $activityid;
private $porcentajeMatriculados;
private $matriculados;
private $deportistas;
private $asistentes;
private $... |
Java | UTF-8 | 764 | 2.65625 | 3 | [] | no_license | package set;
import java.util.TreeSet;
import javax.swing.text.html.HTMLDocument.Iterator;
//import java.util.Iterator;
////import java.util.LinkedHashSet;
public class TreeSetDemo {
public static void main(String[] args) {
TreeSet ha=new TreeSet(new ComparetorByName());
ha.add(new Person("lili",2... |
C++ | UTF-8 | 1,365 | 2.84375 | 3 | [] | no_license | // --------------------------------------------------------------------------- MOTORES DC
// motor pins
int motorA0 = 6;
int motorA1 = 11;
int motorB0 = 3;
int motorB1 = 5;
int min_speed = 100;
// motorLeftSpeed, motorRightSpeed;
void MotorSetup()
{
//the motor control wires are outputs
pinMode(motorA0, OUT... |
TypeScript | UTF-8 | 1,419 | 2.8125 | 3 | [] | no_license | import IPackage from "../interfaces/IPackage";
import Package from "../Package";
import {Guid} from "guid-typescript";
import Person from "../Person";
export default class RecordProcessor {
public static processRecords(records: any[]): IPackage[] {
let pkgs: IPackage[] = [];
for (const record of r... |
Markdown | UTF-8 | 884 | 2.90625 | 3 | [] | no_license | # 11.虚拟环境和包
## 概述
- 不同的应用可以使用不同版本的python,我们可以创建虚拟环境,来隔开不同的应用,支持他们使用不同的版本
## 创建虚拟环境
- 运行`python3 -m venv tutorial-env`,这将创建 tutorial-env 目录,并在其中创建包含Python解释器,标准库和各种支持文件的副本的目录
- 创建虚拟环境之后,需要运行相对应的`activate`文件来激活该环境
```python
$ source ~/envs/tutorial-env/bin/activate
(tutorial-env) $ python
... |
Markdown | UTF-8 | 2,633 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # Fake News Detector
This project aims to be non-partisan and fair in it's access to data and methodology. It aims to judge an article on quality by looking at factors such as:
- Who wrote the article?
- Who published the article?
- What are the political leanings of the author/publisher?
- Are the sources for the art... |
Java | UTF-8 | 1,042 | 2.53125 | 3 | [] | no_license | package diexp.di20;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
import diexp.vo7.Mart;
import diexp.vo7.Product;
import diexp.vo7.exp.Bus;
//import diexp.vo7.exp.Driver;
import diexp.vo7.exp.Driver;
public class DI27 ... |
JavaScript | UTF-8 | 2,918 | 3.703125 | 4 | [] | no_license | // Copy to clipboard function
function copyToClipboard() {
var copyText = document.getElementById('textBox');
copyText.select();
document.execCommand("copy"); // copy to clipboard
if (window.getSelection) { // deselect text
window.getSelection().removeAllRanges();
} else if (document.selection) {
do... |
C++ | WINDOWS-1251 | 1,644 | 3.3125 | 3 | [] | no_license | // , , " -2", ++,
//
// sample_matrix.cpp - Copyright (c) .. 07.05.2001
// Microsoft Visual Studio 2008 .. (20.04.2015)
//
//
#include <iostream>
#include "utmatrix.h"
//---------------------------------------------------------------------------
void main()
{
int n;
TMatrix<int> a(n), b(n), c(n), d(n... |
Python | UTF-8 | 413 | 4.1875 | 4 | [] | no_license | highValue = 0
lowValue = 0
for person in range(1, 6):
weight = float(input('What is the weight of {}ª person: '.format(person)))
highValue = highValue if highValue != 0 and highValue > weight else weight
lowValue = lowValue if lowValue != 0 and lowValue < weight else weight
print('The person with high weigh... |
Go | UTF-8 | 470 | 2.609375 | 3 | [] | no_license | package main
import (
"bytes"
"code.google.com/p/go.net/html"
"fmt"
"io/ioutil"
"log"
"os"
"strings"
)
func main() {
fmt.Println(os.Args)
b, err := ioutil.ReadFile(os.Args[1])
if err != nil {
panic(err)
}
n, err := html.Parse(strings.NewReader(string(b)))
if err != nil {
log.Fatalf("Parse error: %s... |
Java | UTF-8 | 325 | 1.773438 | 2 | [] | no_license | package com.hiking.hkimgloader.loader;
import android.graphics.Bitmap;
import com.hiking.hkimgloader.request.BitmapRequest;
/**
* Created by Administrator on 2018/3/24.
*/
public class NullLoader extends AbstarctLoader {
@Override
protected Bitmap onLoad(BitmapRequest request) {
return null;
... |
C# | UTF-8 | 4,039 | 3.28125 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Lydia.MapGeneration {
/// <summary>
/// A Map's blueprints which we can build from.
/// Contains rooms and their locations
/// </summary>
public class Map {
/// <summary>
/// All rooms the map contains
/// </summary>... |
Python | UTF-8 | 628 | 2.765625 | 3 | [] | no_license | import ast
from unittest import TestCase
from printer import Printer
from printer import Paper
from drivers import MethodDefinitionPrinterDriver
class TestPrinter(TestCase):
def setUp(self):
self.paper = Paper()
self.printer = Printer()
self.printer.insert(self.paper)
def test_addInd... |
C# | UTF-8 | 779 | 3.125 | 3 | [] | no_license | [WebMethod]
public static List<string> GetPreviousSaltsAndHashes(string name)
{
List<string> prevSalts = new List<string>();
// Note: This totally sticks. It's unclear what this reader instance is but if it is a
// SqlReader, as it name suggests, it should probably be wrapped in a u... |
Python | UTF-8 | 913 | 3.4375 | 3 | [] | no_license | from threading import Lock
class Foo:
def __init__(self):
self.firstLock = Lock() #careful not to name variables same as method names
self.secondLock = Lock()
self.firstLock.acquire()
self.secondLock.acquire()
def first(self, printFirst: 'Callable[[], None]') -> None:
... |
C++ | UTF-8 | 5,705 | 2.984375 | 3 | [] | no_license | /*
시간제한 1초
문제
폭파 작전에 투입된 태경은 폭탄 설치를 모두 마쳤다.
이제 폭탄을 한꺼번에 터뜨리기 위해 폭탄을 모두 연결시키는 작업만 남았다.
폭탄을 서로 연결하는 방법은 폭탄이 서로 전선으로 연결되면 된다.
폭탄이 설치된 모습을 격자판에 옮겨 표현하면 다음과 같다.
install_bomb1
[그림 1]
현재 들고 있는 전선은 너무 빳빳해서 구부릴 수 없는 상황이다.
전선은 직선 형태로만 사용할 수 있다.
폭탄이 전선에 의해 연결되려면 전선의 양 끝에 폭탄이 붙어있어야한다.
[그림 2]에서 녹색칸에 해당하는 부분에 전선이 연결된다.
또한... |
JavaScript | UTF-8 | 597 | 3.421875 | 3 | [] | no_license | exports.giveNames = (name) => {
return {
camelToken: camelCase(name),
classToken: capitalise(name),
pluralToken: camelCase(name) + 's'
}
}
function camelCase(string) {
const processedStr = string
.split('_')
.map((word) => {
return word.charAt(0).toUpperCase() + word.slice(1)
})
... |
Java | UTF-8 | 400 | 2.34375 | 2 | [] | no_license | /*************************************************************************
> File Name: ByteDemo.java
> Author: alick
> Mail: alick97@outlook.com
> Created Time: 2016年11月28日 星期一 11时25分55秒
************************************************************************/
class ByteDemo {
public static void main(String[] a... |
Java | UTF-8 | 1,520 | 3.171875 | 3 | [] | no_license | //Jake Steckel CSC141-13
public class EmployeeListings
{
public static class Employee
{
private String name;
private int idNum;
private String department;
private String position;
public Employee(String n, int id, String dep, String pos)
{
name=n;
... |
C# | UTF-8 | 1,933 | 2.546875 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class select : MonoBehaviour
{
public static GameObject selected;
public LineRenderer line;
void Start()
{
}
void Update()
{
}
void OnMouseDown()
{
if(!selected)
{
... |
Markdown | UTF-8 | 2,101 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | # Pdfy #
Pdfy is a Python library for converting HTML (and anything Chrome can render) into PDF. It uses Chrome printing functionality, so the PDFs will be rendered exactly as printed in the browser.
## Installation ##
To install the library, you need to run.
pip install pdfy
Additionally, [you will need to in... |
C++ | UTF-8 | 441 | 2.640625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main ( void )
{
string s;
int n1 = 0, n2 = 0, h = 0, m = 0;
int hour = 0, minuts = 0;
cin >> s;
cin >> h >> m;
n1 = ( s[0] - 48 ) * 10 + ( s[1] - 48 );
n2 = ( s[3] - 48 ) * 10 + ( s[4] - 48 );
minuts = n2 + m;
if ( minuts > 59 ... |
C++ | UTF-8 | 1,255 | 3 | 3 | [] | no_license | //
// main.cpp
// integer_triangle_43105
//
// Created by 김윤상 on 29/04/2020.
// Copyright © 2020 김윤상. All rights reserved.
//
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int cash[500][500];
int a = 0, b = 0;
int solution(vector<vector<int>> triangle) {
int answer = 0;
for ... |
Markdown | UTF-8 | 2,299 | 2.609375 | 3 | [
"MIT"
] | permissive | ### Saving and loading
* FSM diagrams can be saved to (resp. read from) files with the 
(resp. ) button of the toolbar (or the by invoking the `Save`, `Save As` or
`Open` actions in the `File` menu)
* The  button (`New` action in the `File` menu) clears t... |
Java | UTF-8 | 5,180 | 1.84375 | 2 | [] | no_license | package com.yulu.zhaoxinpeng.myeasyshop_2017_4_13.User.Registe;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.MenuItem;
import android.widge... |
JavaScript | UTF-8 | 5,980 | 2.84375 | 3 | [] | no_license | function showItems() {
hide("edit-form-wrapper");
hide("select-movie-dialog");
show("page");
let xmlhttp;
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp = new ActiveXObj... |
Rust | UTF-8 | 1,232 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | mod helper;
use szimg::png::save_png;
use helper::diff_file;
#[test]
fn test_save_png_rgb() {
let mut png_array = [[[0_u8; 3]; 255]; 255];
for outer_index in 0..255 {
for inner_index in 0..255 {
png_array[outer_index][inner_index][0] = outer_index as u8;
png_array[outer_index][... |
Java | UTF-8 | 2,199 | 2.015625 | 2 | [
"Apache-2.0"
] | permissive | package net.sparkeek.piggybank.tests.mock;
import android.content.Context;
import android.support.annotation.NonNull;
import com.github.aurae.retrofit2.LoganSquareConverterFactory;
import com.squareup.picasso.Picasso;
import dagger.Module;
import net.sparkeek.piggybank.di.modules.ModuleRest;
import net.sparkeek.pigg... |
JavaScript | UTF-8 | 11,145 | 3 | 3 | [] | no_license | $(document).ready(function () {
let selectedLang = {}
selectedLang = sessionStorage.getItem("lang"); //Get selected language from session variable
if (selectedLang === "all")
selectedLang = {}
//If album category selected in library page
if (sessionStorage.getItem("section") === "categor... |
JavaScript | UTF-8 | 704 | 2.65625 | 3 | [] | no_license | let submitSubscription = document.getElementById('formSubscribe')
submitSubscription.addEventListener('submit', function (event) {
event.preventDefault();
if (submitSubscription.checkValidity()) {
let email = submitSubscription[0].value
let promise = changeSubscription('subscribe', email)
... |
Python | UTF-8 | 507 | 2.859375 | 3 | [] | no_license | import math
T=int(input())
len=0
br=0
sr=0
for i in range(0,T):
x1,y1,r1,x2,y2,r2=map(int,input().split())
len=math.sqrt((x2-x1)**2+(y2-y1)**2)
if r1>=r2:
br=r1
sr=r2
else:
br=r2
sr=r1
if len<r1+r2 and br-sr<len:
print(2)
if r1+r2==len or (br-sr==len and (... |
Markdown | UTF-8 | 8,026 | 2.859375 | 3 | [
"MIT"
] | permissive | # chef-dokku
[](http://travis-ci.org/fgrehm/chef-dokku)
[](https://community.opscode.com/cookbooks/dokku)
Manages a [dokku](https://github.com/progrium/dokku) installation, allowing
config... |
Rust | UTF-8 | 3,359 | 3.515625 | 4 | [] | no_license | use std::fmt::Debug;
use std::cmp::max;
pub struct CircularBuffer<T> {
buffer: Vec<T>,
tail: usize,
}
impl<T> CircularBuffer<T> {
pub fn with_capacity(capacity: usize) -> CircularBuffer<T> {
if capacity == 0 {
panic!("Zero-capacity buffer not supported")
}
CircularBuffer... |
JavaScript | UTF-8 | 1,477 | 2.625 | 3 | [] | no_license | export default class PwProjectLayout extends HTMLElement {
static get observedAttributes() {
return ['svg'];
}
createdCallback() {
// Setting the initial attributes
this._svg = this.getAttribute('svg') || '';
// Setting the Inner Dom and the styles
this.attachShadow({ mode: 'open' });
th... |
C# | UTF-8 | 3,287 | 2.78125 | 3 | [] | no_license | using BambiDataAccess;
using BambiIBusinessLogic;
using BambiModels;
using BambiSQLServerDataAccess;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BambiBusinessLogic
{
/// <summary>
/// Business logic class whose purpose is to han... |
C | UTF-8 | 1,815 | 2.640625 | 3 | [] | no_license | /* Black Rose Tavern in Qual'tor along the East Road.
If Homer is not present (someone kills him) then players
are not able to order drinks. See black bar for more
details. (/players/daranath/qualtor/obj/black_bar.c)
-Daranath
*/
#define tp this_player()->query_name()
#include <ansi.h>
inherit "room/ro... |
Markdown | UTF-8 | 6,773 | 2.796875 | 3 | [
"MIT"
] | permissive | ---
layout: post
title: "백준 3190 뱀"
subtitle: ""
categories: ps
tags: ps
comments: true
date: 2021-03-31 19:35:00 -0400
---
[백준 3190 뱀](boj.kr/3190)
문제를 풀면서 든 생각, 느낀점을 모두 기록해보려고 한다.
### 문제파악단계
- 보드의 상하좌우 끝에 벽이 있다.
0행, n-1행, 0열, n-1열은 모두 벽처리를 하려고 했는데, 테케 1번과 부딪혔다.
질문검색에서 찾음 (https://www.acmicpc.net/board/v... |
C++ | UTF-8 | 877 | 2.921875 | 3 | [] | no_license | #include <algorithm>
#include <iostream>
#include <list>
#include <numeric>
#include <random>
#include <vector>
using namespace std;
int main()
{
vector<int> data(20);
iota(begin(data), end(data), 1);
copy(cbegin(data), cend(data), ostream_iterator<int>(cout, " "));
cout << '\n';
random_device ... |
Shell | UTF-8 | 522 | 2.703125 | 3 | [] | no_license | pkgname=stlphallus-font
pkgver=1.0
pkgrel=1
pkgdesc="Merged the fonts stlarch, uushi and lemon (https://github.com/phallus/fonts). "
pkgurl="https://github.com/phallus/fonts, http://sourceforge.net/projects/stlarchfont/"
arch=('any')
depends=('fontconfig' 'xorg-font-utils')
source=('git+https://github.com/Ploppz/fonts'... |
Java | UTF-8 | 833 | 3.515625 | 4 | [] | no_license | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new Scann... |
Ruby | UTF-8 | 1,258 | 3.21875 | 3 | [] | no_license | # encoding : utf-8
# Will mark every specified directory for synchronization with specified target
# This will add the codename of the target in a .syncinfo file in the directory
# Usage :
# $ mark-for-sync ./dir1 [./dir2] sansa
require_relative "syncinfo"
class MarkForSync
class Error < StandardError; end
class Ar... |
Shell | UTF-8 | 354 | 2.6875 | 3 | [] | no_license | #!/bin/bash
echo "may need to wait a few minutes for container to create ... "
export -n QUAY_URL=`oc get route |grep ".com" | awk '{print $2}'`
echo $QUAY_URL
echo "consult: deploy_red_hat_quay_on_openshift_with_quay_operator manual"
echo "in section 5.11 for default username and password"
echo "also in section 5.11... |
C# | UTF-8 | 2,341 | 3.125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace ParallelApi
{
class ExeParallel
{
private static string batCmd = @"dir";
private static string[] paths = new string[] { @"C:\temp", @"C:\tmp" ... |
JavaScript | UTF-8 | 1,773 | 4.03125 | 4 | [] | no_license | /**
* Created by liguohua on 2016/10/14.
*/
/**
*对象的每个属性都有一个描述对象(Descriptor),用来控制该属性的行为。
* Object.getOwnPropertyDescriptor方法可以获取该属性的描述对象。
*/
{
let obj = {foo: 123};
let r = Object.getOwnPropertyDescriptor(obj, 'foo');
console.info(r);
// {
// value: 123,
// writable: true,
// ... |
Java | UTF-8 | 855 | 2.5 | 2 | [] | no_license | package com.epam.test_generator.dto;
import java.util.List;
/**
* This DTO is a list of {@link ValidationErrorDTO}. It's used for retrieving and sending validation errors' information
* respectively from and to API.
*/
public class ValidationErrorsDTO {
private Boolean isError = true;
private String type... |
JavaScript | UTF-8 | 2,619 | 3.078125 | 3 | [] | no_license | $(document).ready(function() {
$("form#info").submit(function(event) {
event.preventDefault();
//collect variables
var age = parseInt($("#age").val());
var gender = $("#gender").val();
var color = $("input:radio[name=color]:checked").val();
var cuisine = $("input:radio[name=cuisine]:checked").val();
... |
Python | UTF-8 | 642 | 2.984375 | 3 | [] | no_license |
class Person:
def __init__(self,id,immune_status,status):
self.id=id
self.immune_status=immune_status
self.status=status
self.cont=3
def get_id(self):
return self.id
def get_immune_status(self):
return str(self.immune_status)
de... |
C++ | WINDOWS-1251 | 3,872 | 3.625 | 4 | [] | no_license | #include<iostream>
#include <ctime>
#include <stdlib.h>
#include <string>
#include <vector>
#include <fstream>
using namespace std;
struct person
{
string surname;
string name;
string patronymic;
string position;
int age;
double wages;
};
vector <person> mas;
int razmer = 0;
void Read()
{
system("pause");
... |
Java | UTF-8 | 2,682 | 2.296875 | 2 | [] | no_license | package applusiana.apkvolume;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity /*implements View.OnClickListener*/... |
JavaScript | UTF-8 | 2,795 | 2.640625 | 3 | [] | no_license | import React, { Component } from 'react';
import api from '../../services/todoService';
import "./UpdateTodo.css";
class UpdateTodo extends Component {
constructor(props) {
super(props);
this.state = {
name: "",
description: "",
};
}
async componentDidUp... |
Ruby | UTF-8 | 745 | 2.59375 | 3 | [
"MIT"
] | permissive | module Sword
class Log < ActiveSupport::Logger
attr_reader :start_time, :datetime_format, :output_level
def initialize(*args)
@start_time = Time.now
@datetime_format = '%Y-%m-%d %H:%M:%S'
@output_level = args[0]
# reset the first argument to the log file for the super call
arg... |
Python | UTF-8 | 244 | 3.921875 | 4 | [] | no_license | color = input("Enter the color : ")
pronun_color = input("Enter the pronun_color : ")
celebrity = input("Enter the celebrity : ")
print("Roses are " + color)
print(pronun_color + " are grey")
print("My favourite celebrity is " + celebrity) |
C++ | UTF-8 | 305 | 2.65625 | 3 | [] | no_license | #ifndef RECTANGULO_H
#define RECTANGULO_H
#include "Figura.h"
class Rectangulo : public Figura
{
public:
Rectangulo(int x, int y, int base, int altura);
~Rectangulo();
double obtenerSuperficie() const;
private:
int x, y, base, altura;
};
#endif // RECTANGULO_H
|
C# | UTF-8 | 4,062 | 3.3125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
namespace Day25
{
internal class Program
{
public static void Main(string[] args)
{
int[] tape = new int[100000];
int currentPosition = 50000;
char state = 'A';
for(long i = 0; i... |
Python | UTF-8 | 1,781 | 3.078125 | 3 | [
"MIT"
] | permissive | import itertools
import re
import sys
def solve(data):
data = data.splitlines()
assert len(data) == 4
prop = []
for line in data:
p = line[line.find(':') + 2:]
prop.append(list(map(lambda s: int(s.split()[1]), p.split(', '))))
total_score1 = 0
total_score2 = 0
for i in rang... |
Java | UTF-8 | 11,354 | 3.390625 | 3 | [] | no_license | package pets_amok;
import java.util.ArrayList;
import java.util.Random;
public class VirtualPetShelter {
static Random rand = new Random();
public static ArrayList<VirtualPet> petArrayList = new ArrayList<VirtualPet>();
public static void generatePets() {
VirtualPet pet1 = new Cat(rand.nextInt(10... |
C++ | UTF-8 | 1,688 | 2.546875 | 3 | [] | no_license | #include <Arduino.h>
#include <ThingTime.h>
#include <WiFiManager.h>
void configModeCallback (WiFiManager *myWiFiManager) {
Serial.println("Entered config mode");
Serial.println(WiFi.softAPIP());
//if you used auto generated SSID, print it
Serial.println(myWiFiManager->getConfigPortalSSID());
//entered con... |
Markdown | UTF-8 | 855 | 3.640625 | 4 | [] | no_license | # Memory-Allocation-
I. Inputs :
======================
1- User inputs holes sizes and starting addresses.
2- User inputs number of processes.
3- User inputs processes’ size (Ex: p0 size =100, p1 size = 50… etc).
4- User inputs the method of allocation (first fit or best fit).
II. Scenario to be done:
======... |
Python | UTF-8 | 3,151 | 2.625 | 3 | [] | no_license | import requests
import json
import base64
import os
from dotenv import load_dotenv
load_dotenv()
clientid = os.getenv('Client_ID')
clientsecret = os.getenv('Client_Secret')
mePlaylistUrl = 'https://api.spotify.com/v1/me/playlists'
playlistTraksUrl = 'https://api.spotify.com/v1/playlists/{playlist_id}/tracks'
def ref... |
Shell | UTF-8 | 2,315 | 3.203125 | 3 | [
"MIT"
] | permissive | #!/bin/bash
echo "Starting ... " &> ./setup.log
echo -e "\e[32m#### Load environment file aka config...\e[0m" 2>&1 | tee ./setup.log
source /usr/local/share/team-development-server/.env >> ./setup.log
sudo systemctl start docker>> ./setup.log
echo -e "\e[32m#### Create backup and repo directories if not exit...\e[0m"... |
Java | UTF-8 | 3,112 | 2.265625 | 2 | [] | no_license | package dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
import enumerations.ContractType;
public class JobOffer {
public JobOffer() {
super();
}
public JobOffer(String jobTitle, String reference, String mission, String demanderProfile, String location... |
Ruby | UTF-8 | 1,748 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/ruby
# encoding: utf-8
module Text
class Table
class Column
include Utils
def initialize( table, index )
@table = table
@index = index
@filling = Segments.default_filling( @table.style )
@left_side = Segments.default_joints( @table.style )
@wrap = false
@flow = true
@align... |
Java | UTF-8 | 717 | 2.34375 | 2 | [
"Apache-2.0"
] | permissive | package io.rsocket.aeron.frames;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
public final class AeronPayloadFlyweight {
private static final short VERSION = 0;
private AeronPayloadFlyweight() {}
public static FrameType frameType(ByteBuf byteBuf) {
int anInt = byteBuf.getInt(Sh... |
C | GB18030 | 2,462 | 2.609375 | 3 | [] | no_license | #include "dma.h"
/*******************************************************************************
* : DMAx_Init
* : DMAʼ
* :
DMAy_Channelx:DMAͨѡ,@ref DMA_channel DMA_Channel_0~DMA_Channel_7
par:ַ
mar:洢ַ
... |
C | UTF-8 | 549 | 2.921875 | 3 | [] | no_license | #ifndef SORT_H
#define SORT_H
#include <stdio.h>
#include <stdlib.h>
#define MAXI 100
void countSort(int** nums, int row, int colNo, int* p){
int output[row];
int counter[MAXI] = {0};
for (int i = 0; i < row; i++)
counter[nums[p[i]][colNo]]++;
for (int i = 1; i < MAXI; i++)
counter[... |
Markdown | UTF-8 | 2,168 | 3.65625 | 4 | [] | no_license | ## 员工管理系统
### 项目介绍
模拟数据库操作,实现数据库的增删改查操作
```
1. 可进行模糊查询,语法至少支持下面3种:
(1). select name,age from staff_table where age > 22
(2). select * from staff_table where dept = "IT"
(3). select * from staff_table where enroll_date like "2013"
2. 查到的信息,打印后,最后面还要显示查到的条数
3. 可创建新员工纪录,以phone做唯一键,staff_id需自增,增加语法:
inse... |
C | GB18030 | 717 | 3.78125 | 4 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
typedef struct Stu
{
char name[20];
short age;
char tele[12];
char sex[5];
}Stu;
void Print1(Stu tmp)
{
printf("name:%s\n", tmp.name);
printf("age:%d\n", tmp.age);
printf("tele:%s\n", tmp.tele);
printf("sex:%s\n", tmp.sex);
}
void Print2(Stu* ps)
{
printf("n... |
PHP | UTF-8 | 393 | 2.984375 | 3 | [
"MIT"
] | permissive | <?php namespace Proweb21;
/**
* Interface for subscribers
*
* Event Subscribers recieve publications (dispatchable objects) from channels (Buses)
* @see https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern
*/
interface Subscriber
{
/**
* Subscribes itself to an Bus
*
* @param Bus $b... |
JavaScript | UTF-8 | 1,316 | 2.640625 | 3 | [] | no_license | function DataBinder(object_id) {
var pubSub = jQuery({})
var data_attr = "bind-"+object_id
var message = object_id + ":change"
jQuery(document).on("change", "[data-" + data_attr + "]", function(evt) {
var input = jQuery(this)
pubSub.trigger(message, [input.data(data_attr), input.val()]... |
Markdown | UTF-8 | 1,604 | 2.578125 | 3 | [] | no_license | # aimldl/python/courses/udemy/AutomateTheBoringStuffWithPythonProgramming
Al Sweigart made his book "Automate the Boring Stuff with Python Programming" publically available at https://automatetheboringstuff.com. I recommend to take his online course at Udemy (https://www.udemy.com/automate/learn/v4/content).
# To-dos
... |
JavaScript | UTF-8 | 2,059 | 2.734375 | 3 | [] | no_license | let log = console.log;
class ToobarElement{
constructor(){
}
//Main section
get howItWorksLink() {
return browser.element('a[aria-label="How it Works"]');
}
get createDocumentsLink(){
let selector = '//span[text()="create documents"]//parent::li/a';
browser.waitForVisibl... |
Python | UTF-8 | 632 | 2.71875 | 3 | [] | no_license | from django.shortcuts import render
from .models import destination
# Create your views here.
def index(request):
dest1 = destination()
dest1.name = 'Udaipur'
dest1.desc = 'The City Of Lakes'
dest1.img = 'udaipur.jpg'
dest1.price = 500
dest2 = destination()
dest2.name = 'Mumbai'
dest2... |
TypeScript | UTF-8 | 712 | 3.03125 | 3 | [] | no_license | export default class ScrollingSprite {
private image: any;
private x: number;
private y: number;
private width: number;
private height: number;
private speed: number;
constructor(image: any, x: number, y: number, width: number, height: number, speed: number) {
this.image = image;
... |
Java | UTF-8 | 4,066 | 2.40625 | 2 | [] | no_license | package spring5mvc.rest.services;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import spring5mvc.rest.api.v1.mapper.CustomerMapper;
import spring5mvc.rest.api.v1.model.CustomerDTO;
import spring5mvc.rest.domain.Customer;
imp... |
Markdown | UTF-8 | 3,781 | 3.328125 | 3 | [
"CC-BY-4.0",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ---
id: 145
state: approved
created: 2020-05-28
placement:
category: fields
order: 60
---
# Ranges
Services often need to represent ranges of discrete or continuous values. These
have wide differences in meaning, and come in many types: integers, floats, and
timestamps, just to name a few, and the expected meanin... |
Java | UTF-8 | 3,081 | 2.125 | 2 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package diu.edu.bd.controller;
import diu.edu.bd.Pimanpower;
import diu.edu.bd.impl.PimanpowerDao;
import java.util.ArrayList;
import ... |
Python | UTF-8 | 1,952 | 3 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
"""
Extract the full list of emoji and names from the Unicode Consortium and
apply as much formatting as possible so the codes can be dropped into the
emoji registry file.
Written and run with Python3. Not tested on Python2 and definitely not
intended for production use.
http://www.unicode.or... |
Java | UTF-8 | 535 | 2.265625 | 2 | [] | no_license | package com.example.ashishtiwari.navdraw_iaq;
import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.*;
/**
* Created by ashish.tiwari on 25-04-2016.
*/
/*
public class GraphViewData implements GraphViewInterface {
private double x,y;
public GraphViewData... |
TypeScript | UTF-8 | 370 | 3.015625 | 3 | [
"MIT"
] | permissive | export function once<T>(callback: (...args: any[]) => T): typeof callback {
let fn: ((...args: any[]) => T) | undefined = callback;
let value: T | undefined;
return (...args: any[]): T => {
if (value) {
return value;
}
value = fn?.(args);
fn = undefined;
if (value === undefined) {
... |
Java | UTF-8 | 21,174 | 1.84375 | 2 | [] | no_license | package org.spbu.pldoctoolkit.dialogs;
import java.util.ArrayList;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.ecli... |
Markdown | UTF-8 | 692 | 3.03125 | 3 | [] | no_license | # Nondeterministic Impressionism
Algorithm that uses .NET graphics library and pseudo-randomness to produce an image based on a reference that appears like a drawn version of the original. Comparisons are made after each stroke, and if the stroke has made the image more different from the reference than the previous st... |
Python | UTF-8 | 914 | 2.953125 | 3 | [] | no_license | import random
def gcdex(a, b):
if b == 0:
return a, 1, 0
d, y, x = gcdex(b, a % b)
return d, x, y - (a // b) * x
def encrypting(letter):
return str((int(letter) ** public_key_e) % public_key_n)
p, q = 11, 47
el = (p - 1) * (q - 1)
public_key_n = p * q
# public_key_n = 517
public_key_e = ra... |
Java | UTF-8 | 260 | 2.015625 | 2 | [] | no_license | // Use this enum to use as a flag type for what characteristic is in play
// Also for a field in the trump card class
public enum CardPlayType
{
NULL,
ECONOMIC_VALUE,
CRUSTAL_ABUNDANCE,
HARDNESS,
CLEAVAGE,
SPECIFIC_GRAVITY,
TRUMP
}
|
Python | UTF-8 | 1,149 | 2.984375 | 3 | [] | no_license |
# Import the relevent modules
from sense_hat import SenseHat
import time
# Set up the sense hat
sense = SenseHat()
sense.set_rotation(270)
sense.set_imu_config(False, True, False) # gyroscope only
# Loop around forever
#while(True):
# temp = round( sense.get_temperature_from_humidity(), 1 )
# sense.show_message( ... |
Java | UTF-8 | 3,398 | 2.265625 | 2 | [] | no_license | package org.community.controller;
import org.community.domain.Criteria;
import org.community.domain.ReplyPageDTO;
import org.community.domain.ReplyVO;
import org.community.service.ReplyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
impor... |
Python | UTF-8 | 1,372 | 3.953125 | 4 | [] | no_license | """
Solution for July LeetCoding Challenges Week 1 Day 6: Plus One
"""
class Solution1:
"""
Use carry boolean to check if one is carried over
- Number of digits: M, N
- Space Complexity: O(1)
- Time Complexity: O(max(M, N))
Runtime: 56 ms / 7.05%
Memory Usage: 13.7 MB / 78.16%
"""
... |
C# | UTF-8 | 2,719 | 2.6875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ParkMeter
{
public partial class ParkingTicketForm : Form
{
public ParkingTick... |
Swift | UTF-8 | 587 | 4.15625 | 4 | [
"MIT"
] | permissive | //: [Previous : Protocol in Swift](@previous)
/*:
# Error Handling in Swift
*/
enum GuessNumberGameError : Error {
case wrongNumber
}
class GuessNumberGame {
var targetNumber = 10
func guess(number: Int) throws {
guard number == targetNumber else {
th... |
Python | UTF-8 | 169 | 2.734375 | 3 | [] | no_license | import cv2
img = cv2.imread("bird.jfif")
img_cropped = img[0:200,0:200]
cv2.imshow("Original image", img)
cv2.imshow("Cropped image", img_cropped)
cv2.waitKey(2000) |
Java | UTF-8 | 543 | 2.578125 | 3 | [] | no_license | package com.practicalunittesting.chp06.threadsafe;
import org.junit.Test;
import static org.junit.Assert.assertNotEquals;
/**
* Practical Unit Testing with JUnit and Mockito - source code for examples.
* Visit http://practicalunittesting.com for more information.
*
* @author Tomek Kaczanowski
*/
public class At... |
C++ | UTF-8 | 5,685 | 2.78125 | 3 | [] | no_license | #include <fstream>
#include <iostream>
#include <istream>
#include <map>
#include <ostream>
#include <set>
#include <string>
#include <vector>
using field_t = std::vector<std::string>;
using point_t = std::array<int, 2>;
using portals_t = std::map<point_t, point_t>;
using data_t = std::tuple<field_t, porta... |
PHP | UTF-8 | 3,002 | 2.59375 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class Permission extends Model
{
use HasFactory;
/**
* The table associated with the model.
*
* @var string
*/
protected $table =... |
Python | UTF-8 | 586 | 2.5625 | 3 | [] | no_license | from collections import deque
from math import inf
def solution(N, road, K):
dic = {}
for n in road:
dic[n[0]] = dic.get(n[0], []) + [[n[1], n[2]]]
dic[n[1]] = dic.get(n[1], []) + [[n[0], n[2]]]
dist = {i: inf if i != 1 else 0 for i in range(1, N + 1)}
que = deque([1])
while que:
... |
Python | UTF-8 | 371 | 2.96875 | 3 | [] | no_license | char_list = ["a", "n", "t", "a", "a", "t", "n", "n", "a", "x", "u", "g", "a", "x", "a"]
i=0
l=[]
while i<len(char_list):
j=0
b=[]
count=0
while j<len(char_list):
if char_list[i]==char_list[j]:
count=count+1
j=j+1
b.append(char_list[i])
b.append(count)
if b not i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.