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 |
|---|---|---|---|---|---|---|---|
Java | UTF-8 | 3,594 | 2.453125 | 2 | [
"MIT"
] | permissive | /*
* MIT LICENSE
* Copyright 2000-2023 Simplified Logic, Inc
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, co... |
Go | UTF-8 | 4,954 | 3.109375 | 3 | [
"MIT"
] | permissive | package trade
import (
"trading-bot/pkg/domain/model"
)
func MaxRate(rates []float64) (float64, int) {
max := rates[0]
maxIndex := 0
for i := 0; i < len(rates); i++ {
rate := rates[i]
if rate > max {
max = rate
maxIndex = i
}
}
return max, maxIndex
}
func MinRate(rates []float64) (float64, int) {
... |
C++ | UTF-8 | 931 | 2.515625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Particle.h"
#include <vector>
#include <SFML/Graphics.hpp>
#include <thread>
#include "Algorithms.h"
class ParticleSystem
{
public:
ParticleSystem(sf::Vector2f pos,sf::Vector2f systemS, std::string texturePath);
~ParticleSystem();
void addParticle();
//void draw(sf::RenderWindow& window);
v... |
JavaScript | UTF-8 | 5,145 | 3.71875 | 4 | [] | no_license |
import Card from '../UI/Card';
import React, { useState } from 'react';
import classes from './AddUser.module.css';
import Button from '../UI/Button';
import ErrorModal from '../UI/ErrorModal';
const AddUser = (props) => {
// this can be also done using useRef()
// const nameInputRef = useRef();
// c... |
Go | UTF-8 | 2,119 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | package verifier
import (
"archive/zip"
"io/ioutil"
"os/exec"
"path"
"path/filepath"
"strings"
"github.com/rocketsoftware/open-web-launch/settings"
"github.com/rocketsoftware/open-web-launch/utils"
"github.com/rocketsoftware/open-web-launch/utils/log"
"github.com/pkg/errors"
)
const (
verboseMessage = "Re... |
C | UTF-8 | 502 | 3.578125 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include "binary_trees.h"
/**
* binary_tree_node - insert node in binary tree
* @parent: pointer to head tree
* @value: value of node
* Return: tree with node new
*/
binary_tree_t *binary_tree_node(binary_tree_t *parent, int value)
{
binary_tree_t *newNode;
newNode = mallo... |
Java | UTF-8 | 1,630 | 3.25 | 3 | [] | no_license | package interview.amazon;
import java.util.*;
class CriticalConnections {
List<List<Integer>> bridges;
ArrayList<Integer>[] graph;
int[] ids, low;
int id;
public List<List<Integer>> criticalConnections(int n, List<List<Integer>> connections) {
//1. initialize global variables;
... |
C++ | UTF-8 | 948 | 2.734375 | 3 | [] | no_license | #include "../include/scheduler.h"
#include <unistd.h>
Scheduler::Scheduler( int num_threads ): num_threads( num_threads ) {
cout << "Scheduler: \t\tStarted!" << std::endl;
done_ = false;
pool_ = new ThreadPool( num_threads );
pool_ -> init();
quit_token = std::bind(&Scheduler::doDone, this);
th... |
C++ | UTF-8 | 2,146 | 2.90625 | 3 | [] | no_license | /**
* @file SunStation.h
*
* Helper class that stores the state and
* functions used to interact with the SunStation.
*/
#ifndef SunStation_h
#define SunStation_h
#include "Arduino.h"
/** Interface for SunStation helper class */
class SunStation
{
public:
void begin();
bool isButtonPressed();
bool isUsbOn... |
Java | UTF-8 | 1,619 | 2.0625 | 2 | [] | no_license | package homeSwitchHome;
import java.time.LocalDate;
public final class HomeSwitchHome {
private static Usuario usuarioActual;
private static Propiedad propiedadActual;
private static LocalDate fechaInicioBuscada;
private static LocalDate fechaFinBuscada;
private static Reserva reservaActual;
// ... |
C# | UTF-8 | 332 | 2.90625 | 3 | [] | no_license | using System.Collections.Generic;
using JetBrains.Annotations;
namespace RepetitionDetection.Commons
{
public class CharGreaterComparer : IComparer<char>
{
public int Compare(char x, char y) => comparer.Compare(y, x);
[NotNull] private readonly IComparer<char> comparer = Comparer<char>.Defaul... |
Java | UTF-8 | 712 | 2.421875 | 2 | [] | no_license | package com.dale.net.exception;
/**
* create by Dale
* create on 2019/7/12
* description:
*/
public class ErrorMessage {
/**
* 错误状态码,http状态码 或者 服务器返回的状态码
*/
private int code;
/**
* 错误的信息 可能为空
*/
private String message;
public ErrorMessage(int code, String message) {
... |
Markdown | UTF-8 | 1,084 | 3.328125 | 3 | [] | no_license | # ajv-validator-keywords
Demonstration repository on how to add Keywords to AJV which map to validator functions.
```typescript
import Ajv from "ajv";
import validator from "validator"
export const addValidatorKeywords = (ajv: Ajv) => {
ajv.addKeyword({
keyword: "isPort",
validate: ((schema, data... |
Markdown | UTF-8 | 1,538 | 3.921875 | 4 | [] | no_license | # 42-H2S-OOP_Introduction
Ex00: Make your first class with a constructor that says "Hello World". You must instanciate your first class only in a main
Ex01: Make your second class that will inherit from the first class and call the first class constructor that says "Hello World". You must instanciate the second class... |
Python | UTF-8 | 3,035 | 4.15625 | 4 | [] | no_license | # ------------------------------
# 457. Circular Array Loop
#
# Description:
# You are given a circular array nums of positive and negative integers. If a number k at an
# index is positive, then move forward k steps. Conversely, if it's negative (-k), move
# backward k steps. Since the array is circular, you may as... |
Python | UTF-8 | 1,026 | 4.5625 | 5 | [
"Unlicense"
] | permissive | """
Chooses a random integer in [0, 100]. Asks user to enter a guess,
terminates only when user guesses correctly
"""
import random
def guessing_game():
number = random.randint(1, 5)
while True:
guess = int(
input("Please enter a number between 1 and 5 (inclusive) "))
if guess == n... |
Shell | UTF-8 | 1,172 | 3.71875 | 4 | [] | no_license | #!bin/bash
#Global variable declaration
difficulty=" "
numfloors=" "
numcoins=12
#Functionfor the menu interface
menu_interface(){
clear
echo "======================"
echo "New Game"
echo "Quit"
read -p "Selection: " select
if [[ $select == "Quit" ]] || [[ $select == "quit" ]]
then
exit 1... |
C++ | UTF-8 | 824 | 2.796875 | 3 | [] | no_license | /**
* \file LeftDistrict.h
* \author RPGteam
* \date 23.06.2016
* \version 1.0
* \brief File contains the definition of LeftDistrict class
*/
// -------------------------------------------------------------------------
#ifndef LEFTDISTRICT_H
#define LEFTDISTRICT_H
// --------------------------------------------------... |
JavaScript | UTF-8 | 902 | 3.3125 | 3 | [] | no_license | function solve(arguments) {
var result = new Array();
let headers = arguments[0].split("|").map(item => item.trim()).filter(i => i != "");
let town = headers[0];
let latitude = headers[1];
let longitude = headers[2];
for (let i = 1; i < arguments.length; i++) {
let values = argument... |
C++ | UTF-8 | 283 | 2.734375 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int i,j,n,m;
cout<<"Enter two numbers";
cin>>n>>m;
while(m!=n)
{
if(m>n)
m=m-n;
else
{
n=n-m;
}
}
cout<<m;
return 0;
} |
Python | UTF-8 | 772 | 2.703125 | 3 | [] | no_license | '''
Created on Sep 11, 2013
@author: johannes
@review: johannes, benjamin
'''
from MouseInput import MouseInput
from CalculateAngle import Calculations
import thread
class Pid(object):
'''
classdocs
'''
def __init__(self):
self.calculator=Calculations()
self.mice = MouseInput(self.c... |
Java | UTF-8 | 1,397 | 2.21875 | 2 | [] | no_license | package org.aliu.springboot.model.four.domain.dto;
import lombok.Data;
import org.aliu.springboot.model.four.utils.InsertValidationGroup;
import javax.validation.constraints.Email;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import ja... |
TypeScript | UTF-8 | 3,322 | 2.921875 | 3 | [] | no_license | class Yoshi {
private game: Game;
private vehicleCloud : VehicleCloud;
private _behavior : Behavior
public speed: number;
public div: HTMLElement;
public x: number;
public y: number;
public height : number;
public width : number;
public jumpDirection: number;
public get behavi... |
Java | UTF-8 | 2,413 | 1.78125 | 2 | [] | no_license | package com.appCore.personnel.Core.Controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMa... |
Java | UTF-8 | 1,032 | 1.796875 | 2 | [] | no_license | package cn.mooc.app.module.cms.model;
import java.io.Serializable;
public class DiscoverServerItem implements Serializable {
/**
*
*/
private static final long serialVersionUID = -7465117607734383942L;
private String name;
private Integer linkType;
private String image;
private String url;
private Strin... |
Markdown | UTF-8 | 5,418 | 3.3125 | 3 | [
"MIT"
] | permissive | #co-stream
[Streams](http://nodejs.org/api/stream.html "Stream") are node's best and most misunderstood idea, and _<em>co-stream</em>_ is a toolkit to make creating and working with streams <em>easy</em>.
This package is very similar to [event-stream](https://github.com/dominictarr/event-stream), the difference is th... |
Markdown | UTF-8 | 2,064 | 3.234375 | 3 | [] | no_license | # Data-Mining-CW2
PowerShell scripts for performing some of the steps in Coursework 2.
In order to run these scripts, the file paths must be changed, as they were the directories on my personal machine. These file paths are
often denoted by "input_path" or "output_path" or something similar. Also, the destinations of ... |
Java | UTF-8 | 1,672 | 3.03125 | 3 | [] | no_license | package main;
import org.junit.Test;
import org.junit.Assert;
import java.util.concurrent.ThreadLocalRandom;
import static org.junit.Assert.*;
public class MainTest {
public static int rnd(int min, int max) {
return ThreadLocalRandom.current().nextInt(min, max);
}
@Test
public void getLet... |
Python | UTF-8 | 1,564 | 2.671875 | 3 | [] | no_license |
from airflow.hooks.postgres_hook import PostgresHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class LoadDimensionOperator(BaseOperator):
ui_color = '#80BD9E'
truncate_sql_stmt = """
TRUNCATE TABLE {}
"""
insert_into_stmt = """
IN... |
Java | UTF-8 | 2,906 | 2.09375 | 2 | [] | no_license | package com.skynet.spms.action.supplierSupport.consignment;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.skynet.spms.client.gui.supplierSupport.common.DSKey;
import com.skynet.spms.data... |
Shell | UTF-8 | 1,950 | 3.796875 | 4 | [
"CC0-1.0"
] | permissive | #!/bin/bash
BRIDGE="${1}"
SCRIPT=$(readlink -f $0)
SCRIPTPATH=$(dirname ${SCRIPT})
CFG_FILE="${SCRIPTPATH}/../etc/of-flows.txt"
cd ${SCRIPTPATH}/../etc
if [[ ! -d .git ]]; then
echo "Initializing the Openflow configuration repository"
[ -f /tmp/openflow.lastcommitted ] && rm /tmp/openflow.lastcommitted
git init
... |
Java | UTF-8 | 7,958 | 2.46875 | 2 | [] | no_license | package de.ees.group1.cs.controller;
import java.util.ListIterator;
import de.ees.group1.bt.BT_manager;
import de.ees.group1.com.IControlStation;
import de.ees.group1.cs.gui.IConnectionController;
import de.ees.group1.cs.gui.IOrderController;
import de.ees.group1.cs.gui.MainWindow;
import de.ees.group1.mod... |
Markdown | UTF-8 | 592 | 2.671875 | 3 | [] | no_license | # Web programming:
__Team Members:__
* Shawn
* Tiya
* Vaibhav
* Madiha
* Yousuf
__Game:__
* 2D
* MMOG ver. of pac-man called PacRace
__Game plan (inspired by OG Pac-Man):__
* General overview (see attached img)
* On entry to the game, the players will spawn on one corner of the map.
* ***The AIM*** of the game ... |
SQL | UTF-8 | 2,444 | 2.859375 | 3 | [] | no_license | insert into Authors (name) select 'Author 1'
insert into Authors (name) select 'Author 2'
insert into Genres (name) select 'Genre 1'
insert into Genres (name) select 'Genre 2'
insert into Books (name, author_id) select 'Book 1', a.id from Authors a where a.name = 'Author 1'
insert into Books (name, author_id) ... |
Ruby | UTF-8 | 281 | 3.4375 | 3 | [] | no_license | require 'pry'
class Human
attr_accessor :name, :game_symbol, :go_first
def initialize(game_symbol)
@name = name
@game_symbol = game_symbol
# The instance variable below is used in the coin_toss method to check for who goes first.
@go_first = false
end
end |
Java | UTF-8 | 644 | 2.21875 | 2 | [] | no_license | package com.hami.sys.jdbc.record;
import java.io.Serializable;
import java.util.List;
/**
* <pre>
* <li>Program Name : RecordSet
* <li>Description :
* <li>History : 2018. 2. 17.
* </pre>
*
* @author HHG
*/
public interface RecordSet extends Serializable, List {
public abstract RecordMetadata getMeta... |
Java | UTF-8 | 5,046 | 2.484375 | 2 | [] | no_license | package il.ac.technion.cs.sd.app.mail;
import org.apache.commons.io.FileUtils;
import com.google.gson.stream.JsonWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Ou... |
Java | UTF-8 | 1,245 | 3.109375 | 3 | [] | 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 problema1;
import java.util.Locale;
import java.util.Scanner;
/**
*
* @author Usuario iTC
*/
public class Problema1 {
/*... |
JavaScript | UTF-8 | 915 | 2.640625 | 3 | [
"MIT"
] | permissive | import DataLoader from 'dataloader';
export async function getMultipleMongoDocuments({ documentIds, collectionName, mongo }) {
const documents = await mongo
.collection(collectionName)
.find({ _id: { $in: documentIds } })
.toArray();
// return documents in order they were queried becau... |
TypeScript | UTF-8 | 2,865 | 3.40625 | 3 | [] | no_license | "use strict";
(function(): void{
let color: string = "green";
let color2: string = "black";
let squareSizeNum: number = 100;
let squareSize: string = squareSizeNum + 'px';
let changeColorB: boolean = true;
let button: Element = document.createElement('button');
let div: Element = document.... |
Go | UTF-8 | 762 | 4.40625 | 4 | [] | no_license | package main
import "fmt"
/*
1.关于 channel,下面语法正确的是()
A. var ch chan int
B. ch := make(chan int)
C. <- ch
D. ch <-
答案:ABC
A、B都是声明channel
C 读取channel
写 channel必须带上值,所以D错误
*/
/*
2.下面这段代码输出什么?
A. 0
B. 1
C. Compilation error
type person struct {
name string
}
func main() {
var m map[person] int
p := person{"mike"... |
PHP | UTF-8 | 2,079 | 2.734375 | 3 | [] | no_license | <?php
/*
** Definit une option.
**
** @package Ninaca
** @author Nivl <nivl@free.fr>
** @started 09/02/2009, 04:57 PM
** @last Nivl <nivl@free.fr> 03/28/2010, 04:23 PM
** @link http://nivl.free.fr
** @copyright Copyright (C) 2009 Laplanche Melvin
**
** This program is free software: you can redistribute it a... |
C# | UTF-8 | 2,572 | 2.65625 | 3 | [] | no_license | //FILE : BattleUnit.cs
//PROJECT : Will of the Woods
//PROGRAMMER : Gavin McGuire
//FIRST VERSION : 06/12/2019
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//NAME : BattleUnit
//PURPOSE : interact with other units for the final battle
[System.Serializable]
p... |
Python | UTF-8 | 3,249 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import datetime
import json
import os
import time
import pandas as pd
from config import *
def encode_text(word_map, c):
return [word_map.get(word, word_map['<unk>']) for word in c] + [word_map['<end>']]
class Lang:
def __init__(self, filename):
word_map = json.load(open(filename, 'r'))
se... |
Java | UTF-8 | 1,467 | 3.171875 | 3 | [] | no_license | package org.alien8.client;
import java.io.IOException;
import java.io.ObjectInputStream;
import org.alien8.core.ServerMessage;
public class ClientTCP extends Thread {
private ObjectInputStream fromServer;
private volatile boolean run = true;
/**
* Constructor
*
* @param fromServer Input Stream for r... |
Shell | UTF-8 | 247 | 2.6875 | 3 | [] | no_license | #!/bin/bash
HOST=$1
destination_ingresses="server frontend image-server"
for ing in $destination_ingresses; do
kubectl patch ingress $ing --type='json' -p "[{\"op\": \"replace\", \"path\": \"/spec/rules/0/host\", \"value\": \"$HOST\"}]"
done
|
TypeScript | UTF-8 | 1,412 | 2.515625 | 3 | [] | no_license | import { Injectable } from '@angular/core';
import {PicketReport} from "../tachymetry/models/tachymetry-report/picket-report.model";
import {LatLngLiteral} from "@agm/core";
@Injectable()
export class UtilsService {
createErrorMessage(errors) {
let errorMessage = '';
errors.forEach(error => {
if (err... |
Java | UTF-8 | 5,209 | 3.203125 | 3 | [] | no_license | import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.*;
import java.util.concurrent.TimeUnit;
import javax.swing.*;
import javax.swing.event.MouseInpu... |
Python | UTF-8 | 1,602 | 3.671875 | 4 | [] | no_license | # 爬取最好大学网上的大学排名信息 (定向爬虫)
# 1. 从网络上获取大学排名网页内容 getHTMLText()
# 2. 提取网页内容中信息到合适的数据结构 fillUnivList()
# 3. 利用数据结构展示并输出结果 printUnivList()
# BeautifulSoup只是bs4库中的一个类
import bs4
container = "html.parser"
import requests
from bs4 import BeautifulSoup
def getHTMLText(url):
try:
r = requests.get(url)
... |
Ruby | UTF-8 | 527 | 2.75 | 3 | [] | no_license | require "net/http"
require "uri"
def to_log(output, result)
File.open("./result.txt", "a") do |f|
f.puts "Test case: Update user #{output} , #{result} "
end
end
uri = URI('http://localhost:3000/api/users/30')
req = Net::HTTP::Put.new(uri)
req.set_form_data({
"email": "test@update.com",
"first_name": "lana",
"las... |
Java | UTF-8 | 1,956 | 2.46875 | 2 | [
"Apache-2.0"
] | permissive | /*
* 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 USAirlines.Q3;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.apache.hadoop.io.IntWrit... |
PHP | UTF-8 | 559 | 2.703125 | 3 | [] | no_license | <?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Message extends Model
{
use SoftDeletes;
/**
* 資料表可輸入的屬性。
*
* @var array
*/
protected $fillable = [
'name', 'title', 'content', 'avatar'
];
/**
* Mes... |
TypeScript | UTF-8 | 2,596 | 3.359375 | 3 | [] | no_license | import * as expr from 'expression-eval';
import {
AST,
VariableValues,
Expression,
Identifier
} from './';
/**
* returns true if the expression can be evaluated in this context.
* NOTE: Does not perform type checking, so no guarantee is made
* that an expression will evaluate to a reasonable valu... |
JavaScript | UTF-8 | 1,197 | 2.640625 | 3 | [] | no_license | const fs = require('fs').promises;
const express = require('express');
const app = express();
app.use(express.json());
app.use(express.static('../client/build'));
const path = './data.json';
app.get('/api/tickets', async (req, res) => {
const tickets = await fs.readFile(path);
const ticketsJson = JSON.parse(tickets... |
Java | UTF-8 | 452 | 2.875 | 3 | [] | no_license | //셀프넘버
package algo;
public class Boj4673 {
public static void main(String[] args) {
boolean[] chk = new boolean[10001];
for (int i = 1; i <= 10000; i++) {
int a = i / 1000;
int b = (i / 100) % 10;
int c = (i / 10) % 10;
int d = i % 10;
int next = a + b + c + d + i;
if (next > 10000)
cont... |
Markdown | UTF-8 | 9,457 | 2.625 | 3 | [] | no_license | # BUILD YOUR DREAM ROSTER
[LIVE][roster]
- Author: Zidian Lyu
- Apr-2017
- Credit to: Nick Gassmann && The Harker School
## Overviews
### Introduction
- Page View

### BuildForm
- Page View
](https://hub.docker.com/r/vovimayhem/google-pubsub-emulator)
[](https://hub.docker.com/r... |
Java | UTF-8 | 520 | 2.234375 | 2 | [] | no_license | /*
* Efecto sonido para cuando se rompe la barrera
*/
package codigo;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
/**
*
* @author Javier
*/
public class Crash {
Clip sonidoCrash = null;
public void ruido(){
try {
sonidoCrash= AudioSys... |
Java | UTF-8 | 827 | 2.4375 | 2 | [] | no_license | /*
* Created on Dec 10, 2004
*/
package com.jds.architecture.exceptions;
/**
* This class represents nonfatal exceptions that occur within HRS
*
* @author Eugene Lozada
*
*
*/
public class HRSLogicalException extends HRSException {
private static final long serialVersionUID = 1L;
/**
* Creates a new H... |
C# | UTF-8 | 768 | 2.609375 | 3 | [] | no_license | using System;
using System.Windows.Forms;
namespace BatteryMonitor.Forms
{
public partial class FormPcName : Form
{
public string PcName { get; private set; }
public bool HasChange { get; private set; }
public FormPcName(string pcName)
{
InitializeComponent();
... |
Java | UTF-8 | 2,112 | 2.203125 | 2 | [
"Apache-2.0"
] | permissive | package com.mhuang.module.index.controller;
import java.util.HashMap;
import java.util.Map;
import org.bson.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annot... |
PHP | UTF-8 | 260 | 2.75 | 3 | [] | no_license | <?php
class language {
public function set($key, $value) {
helper::setMember ( 'lang', $key, $value );
}
public function show($obj, $key) {
$obj = ( array ) $obj;
if (isset ( $obj [$key] ))
echo $obj [$key];
else
echo '';
}
} |
Python | UTF-8 | 232 | 3.6875 | 4 | [] | no_license | def diferencia():
x=int(input("introduce el primer número: "))
y=int(input("introduce el segundo número: "))
if x>y:
return x-y
else:
return y-x
print("La diferencia es ",diferencia())
|
C++ | UTF-8 | 819 | 2.703125 | 3 | [] | no_license | class Solution {
public:
vector<int> fullBloomFlowers(vector<vector<int>>& flowers, vector<int>& persons) {
vector<pair<int, int>> fs;
for (int i = 0; i < (int)flowers.size(); ++i) {
fs.emplace_back(flowers[i][0], flowers[i][1]);
}
sort(fs.rbegin(), fs.rend());
vector<pair<int, int>> qs;
... |
JavaScript | UTF-8 | 23,323 | 2.625 | 3 | [
"BSD-2-Clause"
] | permissive | /* jshint asi: true */
'use strict';
var RESOURCE_WARNING_FRACTION = 0.80
var RESOURCE_ERROR_FRACTION = 0.95
// using jQuery
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie !== '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cook... |
Java | UTF-8 | 743 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | package pattern.observer;
import java.util.ArrayList;
import java.util.List;
public abstract class AllyControlCenter {
protected String allyName;
protected List<Observer> playerList = new ArrayList<>();
public void join(Observer observer) {
System.out.println(observer.getName() + "加入战队" + allyN... |
Java | UTF-8 | 170 | 1.742188 | 2 | [] | no_license | package com.ruanko.hwm.service;
import com.ruanko.hwm.bean.SingerType;
public interface ISingerTypeService {
public SingerType getSingerTypeById(Integer id);
}
|
Swift | UTF-8 | 423 | 3.0625 | 3 | [] | no_license | import Foundation
final class Atomic<T> {
private var _value: T
private let lock = NSLock()
init(_ value: T) {
self._value = value
}
var value: T {
get {
lock.lock()
let result = _value
lock.unlock()
return result
}
s... |
Python | UTF-8 | 3,488 | 3.96875 | 4 | [
"MIT"
] | permissive | '''
Question:
Given an array A of size N, there are two types of queries on this array.
1. q l r: In this query you need to print the minimum in the sub-array .
2. u l r v In this query you need to update the range from l to r by v.
Time Complexity:
update query: log(n)
min in range query: log(n)
'''
import math as m... |
C | UTF-8 | 8,845 | 2.8125 | 3 | [] | no_license | #include "unistd.h"
#include "limits.h"
#include "string.h"
#include "stdio.h"
#include "stdlib.h"
#include "sys/mman.h"
const int BUFFER_SIZE = 1024;
const int WRITE_ZERO_TRY_COUNT = 10;
const int MMAP_BUFFERS_SIZE = 32;
const int MAX_BUFF_SIZE = INT_MAX/2;
void nop(void * data){}
void* raw_allocate(size_t size) {... |
TypeScript | UTF-8 | 4,119 | 2.8125 | 3 | [] | no_license | import {
Account,
BpfLoader,
BPF_LOADER_PROGRAM_ID,
Connection,
PublicKey,
} from '@solana/web3.js';
import fs from 'mz/fs';
/**
* This script should be run before the jest suite starts running tests on the contracts.
* 1) establish a connection to localnet
* 2) create an array of accounts with a balance... |
C++ | UTF-8 | 428 | 2.671875 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int N,T,c=1,b,ans,i;
cin>>T;
while(T--)
{
vector <int> t;
cin>>N;
for(i=0;i<N;i++)
{
cin>>b;
t.push_back(b);
}
sort(t.begin(),t.end());
... |
Markdown | UTF-8 | 2,789 | 2.625 | 3 | [
"MIT"
] | permissive | # koa-swapi
[](https://github.com/haowen737/koa-swapi)
[](https://github.com/haowen737/koa-swapi)
[) && ($mem_port = config('cache1.port')) ) {
$mem = new Memcached;
$mem->addServer(config('cache1.host'), config('cache1.port'));
}
function memset($key, $value, $timeout = 0) {
global $mem;
if (is_null($mem)) {
return false;
}
return $mem->set(... |
Java | UTF-8 | 666 | 3.234375 | 3 | [] | no_license | package MartinHongLab7;
public class Lab7Driver {
public static void main(String[] args) {
System.out.println("Lab7 Martin Hong");
Lab7MethodClass lab7MethodClass = new Lab7MethodClass();
// flower exception
try {
lab7MethodClass.flowerMethod();
} catch (FlowerException e) {
System.e... |
SQL | UTF-8 | 1,705 | 2.890625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.0.2
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1:3306
-- Tiempo de generación: 20-05-2021 a las 22:35:02
-- Versión del servidor: 5.7.31
-- Versión de PHP: 7.2.33
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHA... |
C++ | UTF-8 | 758 | 2.703125 | 3 | [] | no_license | #include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main()
{
int n,i,ans,cnt;
while(scanf("%d",&n)!=EOF)
{
if(n==1)
{
printf("0\n");
continue;
}
ans=n;
for(i=2;i*i<=n;i++)
{
if(n%i==0)//æ¯æ¬... |
Ruby | UTF-8 | 3,262 | 2.875 | 3 | [] | no_license | #!/usr/bin/env ruby
################################################################
require 'digest'
require 'zlib'
################################################################
module Digest
class CRC32 < Digest::Class
def initialize
reset
end
def reset
@crc = 0
end
def update(... |
Java | UTF-8 | 261 | 2.109375 | 2 | [
"MIT"
] | permissive | package com.hcl.myhotel.exception;
public class HotelDetailsNotFoundException extends Exception{
/**
* @author Sridhar reddy
*/
private static final long serialVersionUID = 1L;
public HotelDetailsNotFoundException(String message)
{
super(message);
}
}
|
Java | UTF-8 | 471 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | package net.sf.javagimmicks.util;
/**
* An interface for objects that can filter other objects.
*
* @param <E>
* the type of objects to filter
*/
public interface Predicate<E>
{
/**
* Determines of a given element is accepted by this {@link Predicate}.
*
* @param element
* ... |
Python | UTF-8 | 395 | 3.5625 | 4 | [] | no_license | from random import randint
def getRandomCharacters(ch1, ch2):
return chr(randint(ord(ch1), ord(ch2)))
def getRandomLowerCharacter():
return getRandomCharacters('a', 'z')
def getRandomUpperCharacter():
return getRandomCharacters('A', 'Z')
def getRandomDigitCharacter():
return getRandomCharacters(... |
C# | UTF-8 | 399 | 2.875 | 3 | [] | no_license | public class CustomList<T>
{
private List<T> internalList = new List<T>();
public T this[int index] {
get{ return internalList[index]; }
set{ internalList[index] = value;}
} //Error
public void Add(T item)
{
// Method logic goes here.
}
public void R... |
JavaScript | UTF-8 | 1,096 | 2.78125 | 3 | [
"Unlicense"
] | permissive | // share code executing a command and returning its output
import when from 'when';
import spawn from 'cross-spawn-async';
export default function get_command_output(
executable,
options
) {
options = options || {};
options.params = options.params || [];
options.timeout = options.timeout || 3000;
options.env = ... |
Markdown | UTF-8 | 764 | 2.53125 | 3 | [
"MIT"
] | permissive | #event capture
event captureは収集した情報をGoogleカレンダーに登録するツールです。
***
###アカウント情報の設定
config/gcal.sample.ymlをgcal.ymlに、config/twitter.sample.ymlをtwitter.ymlにリネームします。
そこにGoogleカレンダー、Twitterのアカウント情報を記述します。
###Heroku環境変数に登録
$> rake heroku_env
###実行時間または時刻を設定
config/clock.ymlに実行する時間または時刻を設定します。
####全てのモジュール共通
defa... |
Java | UTF-8 | 1,452 | 3.109375 | 3 | [] | no_license | package nbody.moving;
import nbody.Coordinates;
import nbody.bodies.Body;
import nbody.main.Simulation;
import java.util.List;
public class BouncingMovement implements MovingAbility {
private double px, py; // momentums
private double maxMomentum = 300.0;
private double mass;
public BouncingMovement(double mass)... |
C++ | UTF-8 | 2,233 | 2.640625 | 3 | [] | no_license | //#define BOOST_SPIRIT_DEBUG
#include <boost/fusion/adapted/struct.hpp>
#include <boost/spirit/include/qi.hpp>
#include <iomanip>
namespace qi = boost::spirit::qi;
namespace ascii = qi::ascii;
namespace ast {
struct JEDEC {
std::string caption;
struct field {
char id;
std:... |
C# | UTF-8 | 1,620 | 2.90625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
namespace RelevesMeteo
{
public class BoolToVisibilityConverte... |
Python | UTF-8 | 2,000 | 4.03125 | 4 | [] | no_license | import string
#1A
def is_word_guessed(secret_word,letters_guessed):
''' This Function is used to check if all the letters guessed are in the secret word, str1 is a blank string used to convert the set of characters in
letters_guessed into a string to compare it with the secret word'''
S1 = set(secret_wor... |
C++ | UTF-8 | 2,181 | 3.640625 | 4 | [] | no_license | inline Color::Color()
: red_(0.0f)
, green_(0.0f)
, blue_(0.0f)
{}
inline Color::Color(float red, float green, float blue)
: red_(red)
, green_(green)
, blue_(blue)
{}
inline void Color::set_red(float red) {
red_ = red;
}
inline void Color::set_green(float green) {
green_ = green;
}
... |
Shell | UTF-8 | 929 | 2.859375 | 3 | [] | no_license | #!/bin/sh
host=192.168.10.100
app=FocusEyeSelector
echo getting latest executable
tftp -g -r $app $host
#tftp -g -r $app.ini $host
chmod a+x ./$app
skip_setup=
skip_data=
if [ $skip_setup ]
then
echo skipping setup
else
cd /usr/lib
tftp -g -r libcxcore.so.2 $host
tftp -g -r libcv.so.2 $host
tftp -g -r libhighgui.so.2... |
PHP | UTF-8 | 373 | 2.578125 | 3 | [] | no_license | <?php
// Set the location to redirect the page
header ('Location: Main_Tool.php');
// Open the text file in writing mode
$file = fopen("form-save.txt", "a");
foreach($_POST as $name => $value) {
fwrite($file, $name);
fwrite($file, "=");
fwrite($file, $value);
fwrite($file, "\r\n");
}
... |
Python | UTF-8 | 9,385 | 2.578125 | 3 | [] | no_license | # Dependencies:
from pymprog import * # pip install pymprog
from icalendar import * # pip install icalendar
from datetime import *
from swiglpk import * # pip install swiglpk
import pytz # pip install pytz
from tzlocal import get_localzone
############################################################################... |
Python | UTF-8 | 1,585 | 2.9375 | 3 | [] | no_license | import pandas as pd
import numpy as np
seattle_zipcodes = [98101, 98102, 98103, 98104, 98105, 98106, 98107, 98108, 98109, 98112, 98115, 98116, 98117, 98118, 98119, 98121, 98122, 98125, 98126, 98133, 98136, 98144, 98177, 98199]
neighborhoods = {98101: 'Downtown', 98102: 'Captiol Hill', 98103: 'Wallingford', 98104: 'P... |
Swift | UTF-8 | 702 | 2.65625 | 3 | [] | no_license | //
// ModalOverlayNode.swift
// SpaceUp
//
// Created by David Chin on 22/06/2015.
// Copyright (c) 2015 David Chin. All rights reserved.
//
import SpriteKit
class ModalOverlayNode: SKShapeNode {
init(rectOfSize size: CGSize) {
super.init()
let rect = CGRect(origin: CGPoint(x: size.width / -2, y: s... |
Java | UTF-8 | 2,028 | 3.234375 | 3 | [] | no_license | package array;
import java.util.Random;
public class main {
public static void main(String[] args) {
Random gerador = new Random();
int time1,time2;
int batalhas =1500,contc=0,contt=0,mortost=0,mortosc=0;
while(batalhas>0) {
time1 = gerador.nextInt(5)+1;
time2 = gerador.nextInt(5)+1;
Totodile[] totot... |
Java | UTF-8 | 2,021 | 2.1875 | 2 | [] | no_license | package com.ciazhar.qrbarcodescanner;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyErro... |
Go | UTF-8 | 4,794 | 2.8125 | 3 | [
"MIT"
] | permissive | /**********************************************************\
| |
| hprose |
| |
| Official WebSite: http://www.hprose.com/ |
| ... |
Java | UTF-8 | 3,161 | 2.296875 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2003 - 2014 The eFaps Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ... |
JavaScript | UTF-8 | 2,209 | 2.9375 | 3 | [] | no_license | import React, {Component} from 'react';
import Plaintext from './components/Plaintext';
import Ciphertext from './components/Ciphertext';
import Shift from './components/Shift';
import Paper from '@material-ui/core/Paper';
class Main extends Component {
constructor() {
super();
this.state = {
indexTa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.