blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 117 | path stringlengths 3 268 | src_encoding stringclasses 34
values | length_bytes int64 6 4.23M | score float64 2.52 5.19 | int_score int64 3 5 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | text stringlengths 13 4.23M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
eca9d817d12ed4d3014ae6a100303a6c0b6583d3 | C++ | NicolaDes/ariadneExample | /lock_system/analysis.hh | UTF-8 | 3,877 | 2.796875 | 3 | [] | no_license | #pragma once
#include "ariadne.h"
using namespace Ariadne;
/// Forward declarations, used only to properly organize the source file
void finite_time_upper_evolution(HybridAutomatonInterface &system, HybridBoundedConstraintSet &initial_set, int verbosity, bool plot_results);
void finite_time_lower_evolution(HybridAut... | true |
36c59e2b423c8f00067bf9168cfddc31cfb29b3a | C++ | SiliconSloth/Metro | /include/metro/credentials.h | UTF-8 | 5,899 | 3.265625 | 3 | [
"MIT"
] | permissive | /*
* This file contains code regarding credential handling.
*/
#pragma once
// A version of memset that won't be optimized away by the compiler.
// Used for overwriting sensitive memory for security reasons.
typedef void* (*memset_t)(void*, int, size_t);
static volatile memset_t memset_volatile = memset;
namespace... | true |
2df32547ed24ddc59e8b8f96070bc38ef87d9c19 | C++ | sdonte980/MileStone2 | /Split.h | UTF-8 | 629 | 2.953125 | 3 | [] | no_license | #ifndef MILESTONE2_SPLIT_H
#define MILESTONE2_SPLIT_H
#include <string>
#include <vector>
using namespace std;
class Split{
public:
static vector<string> split(string line, string delimiter) {
vector<string> data;
size_t position = 0;
while ((position = line.find(delimiter)) != string::np... | true |
6aaf4da30c469a22f012dbf0f5db4fa076add41a | C++ | balos1/opengl_skybox_game | /src/ViewController.h | UTF-8 | 1,039 | 2.71875 | 3 | [
"MIT"
] | permissive | //FileName: viewcontroller.h
//Programmer: Dan Cliburn, Cody Balos
//Date: 11/15/2016
//Purpose: This file defines the header for the Viewcontroller class
//This class is responsible for setting up SDL and handing user input.
#pragma once
#include <SDL.h> //Include SDL.h before glm.hpp
#include <glm.hpp>
#includ... | true |
602d6be1ed70501a53e6cd3dd096a23f196969fe | C++ | artugal28373/CompetitveProgramming | /Online-Judge-Solutions/SPOJ/FISHES - Finding Fishes.cpp | UTF-8 | 6,925 | 2.609375 | 3 | [] | no_license | /*
SPOJ FISHES
Author: Tanmoy Datta
Idea:
- The first simplification is in the summation formula as follows
SUM { Xi * (V . Vi) }
= SUM {V . Xi Vi}
= V . SUM {Xi Vi}
- As you can observe, Xi Vi is constant, so we can precalculate this vector by multiplying each vector by its Xi and adding them all,
let... | true |
084d30de9ddc438c5a8f2584c99580384487aadc | C++ | lip23/growing | /hdu/1175_连连看.cpp | UTF-8 | 4,187 | 3.0625 | 3 | [] | no_license | #include <iostream>
using namespace std;
struct node
{
int pos1;
int pos2;
int count;
int direct;
};
class stack
{
public:
stack();
~stack(){};
void push(int,int,int,int);
void pop(int&,int&,int&,int&);
bool isempty();
private:
int top;
node data[2002];
};
int main()
{
int m,... | true |
dddacef602be5175ce2636b17af988d1c474f4fb | C++ | jacobkim5021/FirstYearProgramming | /assignment3/snake.cpp | UTF-8 | 846 | 3.078125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
int xposition = 1;
int yposition = 1;
int x = 10;
int y = 10;
char input;
while(input != 'x'){
for(int h=1 ; h <= y ; h++){
for(int i=1 ; i <= x ; i++){
if(i == xposition && h == yposition){
cout << "O ";
}
else{
cout << "- ";
... | true |
b1f1b52e727210055ca48d6a06214c41cae81055 | C++ | doraneko94/AtCoder | /ABC/ABC060/b.cpp | UTF-8 | 321 | 3.015625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int A, B, C;
cin >> A >> B >> C;
bool can = false;
for (int i=1; i<=B; ++i) {
if (A*i % B == C) {
can = true;
break;
}
}
if (can) cout << "YES" << endl;
else cout << "NO" << endl;
return 0;
... | true |
36ce3310400535c13fa8c1d2b3b00fae79913af9 | C++ | damiche97/GDVdev | /ex2/SceneTask.h | UTF-8 | 1,682 | 3.171875 | 3 | [] | no_license | #ifndef SCENE_TASK_H
#define SCENE_TASK_H
#include "Task.h"
#include "TriangleMesh.h"
#include <chrono>
enum class AnimationPhase {
Drive,
CrashUp,
CrashDown,
Done
};
/**
* Dynamic scene: A car crashes against a tree
*/
class SceneTask: public Task {
private:
TriangleMesh tree_leaves {MeshType::Stati... | true |
a082ee304720fc53792629db76eebc08dab2bfa9 | C++ | ric2b/Vivaldi-browser | /chromium/chrome/browser/lacros/browser_launcher.h | UTF-8 | 1,425 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | // Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_LACROS_BROWSER_LAUNCHER_H_
#define CHROME_BROWSER_LACROS_BROWSER_LAUNCHER_H_
#include "base/memory/raw_ptr.h"
#include "base/supports_user_data.h"
clas... | true |
d8f497790b1dd64d35e7d6ee5ddcd24848771734 | C++ | TsFotini/Neural_Networks-Clustering_Techniques | /Clustering Techniques/vectors/Cluster.h | UTF-8 | 722 | 2.9375 | 3 | [] | no_license | #ifndef CLUSTER_H
#define CLUSTER_H
#include <vector>
#include "VectorNode.h"
using namespace std;
class Cluster{
VectorNode centroid;
vector<VectorNode> inClusterPoints;
public:
VectorNode getCentroid(){ return centroid;}
void setCentroid(VectorNode v){ centroid = v;}
vector<VectorNode> getPoints(){ return ... | true |
c8497d03facd20a74ed1ab068623e6a1b7287e37 | C++ | EmbeddedSystemGroupNJU/LineTrackingCar | /abandonCarControl/class/Speeds.cpp | UTF-8 | 308 | 3 | 3 | [] | no_license | //
// Created by leich on 2018/10/19.
//
#include "Speeds.h"
Speeds::Speeds(double l, double r)
{
this->left = l;
this->right = r;
}
std::ostream & operator<<(std::ostream & os, const Speeds & speeds)
{
os << "left speed: " << speeds.left << " right speed: " << speeds.right;
return os;
} | true |
af39170a4cd4d636b302dcc215a2ad54a61754d7 | C++ | ReginaLaurentino/Primer-Cuatrimestre-for | /prueba 2.cpp | UTF-8 | 632 | 2.6875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(){
int total,cp,cn,tn,Maxi,Maxp;
int n,x;
total=0;
cout<<"Ingrese un numero: ";
cin>>n;
cout<<endl;
cp=0;
cn=0;
tn=0;
Maxi=0;
Maxp=0;
while(n!=0){
if(n%2==0){
if (Maxp!=0){
if(n>Maxp){Maxp=n;}
}el... | true |
4cdf16b9ba8dd27b12d452505751a3006be0230a | C++ | Diksha65/Programs | /C++/selectionSort.cpp | UTF-8 | 917 | 3.765625 | 4 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
int smallestElement(int index, vector<int> vec){
int small = vec[index], pos = index;
for(int i=index+1; i<vec.size(); i++){
if(vec[i] < small){
small = vec[i];
pos = i;
}
}
return pos;
}
void displayVecto... | true |
3b57ac2fda072394cf8f18f84635cba3db4a0c53 | C++ | Zhang-Tianxu/Algorithms | /ClassicalProblems/Maze/Maze.h | UTF-8 | 589 | 2.765625 | 3 | [] | no_license | #ifndef _MAZE_H_
#define _MAZE_H_
#include <vector>
class MazePos {
public:
int x;
int y;
MazePos();
MazePos(int px, int py);
MazePos up(int d);
MazePos down(int d);
MazePos left(int d);
MazePos right(int d);
bool operator==(const MazePos& b);
void print();
};
class Maze {
public:
std::vector<std::vector<... | true |
028a5ee684aac61f8918cafc8391c32b9b831382 | C++ | mpsitech/idec_public | /ideccmbd/VecIdec/VecVJobIdecQcdacqFan.cpp | UTF-8 | 1,486 | 2.53125 | 3 | [
"BSD-2-Clause"
] | permissive | /**
* \file VecVJobIdecQcdacqFan.cpp
* vector VecVJobIdecQcdacqFan (implementation)
* \author Alexander Wirthmueller
* \date created: 30 Dec 2017
* \date modified: 30 Dec 2017
*/
#include "VecVJobIdecQcdacqFan.h"
/******************************************************************************
namespace Ve... | true |
f07de2661f6b00bb632242ad5c8f0eae82772ccd | C++ | JasmineHJM/leetcode | /01_21.cpp | GB18030 | 1,133 | 3.359375 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
//жһǷǻָң͵һ
class Solution{
public:
bool isPalindrome(int x){
if (x<0)
return false;
if (x % 10 == 0 && x != 0)
return false;
if (x >= 0 && x <= 9) // Ϊ
return true;
int idx = 1;
while (x / (int)pow(10.0, idx)>0)... | true |
3a6ade7301a5e6873e7631881bcc8fcaa9b707a9 | C++ | amov-lab/Prometheus | /Modules/simulator_utils/map_generator/map_generator_node.cpp | UTF-8 | 2,282 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #include <ros/ros.h>
#include "map_generator.h"
// 主函数
int main(int argc, char **argv)
{
ros::init(argc, argv, "map_generator_node");
ros::NodeHandle nh("~");
string map_name;
// 【参数】地图名称
nh.param<string>("map_name", map_name, "planning_test");
cout << GREEN << "map_name: [ " << map_name << ... | true |
2df2081cf8be6a461d1bbb8b4e606f2ad80a0b72 | C++ | yottaawesome/win32-experiments | /src/ProcessClient/ProcessClient.cpp | UTF-8 | 777 | 2.546875 | 3 | [
"MIT"
] | permissive | #include <Windows.h>
#include <iostream>
#include "ClientServerLib/include/ClientServerLib.hpp"
#define BUF_SIZE 256
int main()
{
//ClientServerLib::IntArray mmf(L"MyFileMappingObject", 512 * sizeof(wchar_t), false);
ClientServerLib::TypedArray<ClientServerLib::Message> mmf(L"MyFileMappingObject", false);
std::wcou... | true |
51c3444f1c33e6f460a64cd49cf6981b68bed2c9 | C++ | Nerisson/laughing-bimbo-shame | /Kata/KATA1/main.cpp | UTF-8 | 1,424 | 3.015625 | 3 | [] | no_license | #include <windows.h>
#include <GL/glut.h>
#include <iostream>
using namespace std;
void reshape (int w, int h);
GLfloat RED[] = {1., 0., 0., 1.};
GLfloat GREEN[] = {0., 1., 0., 1.};
GLfloat BLUE[] = {0., 0., 1., 1.};
GLfloat BLACK[] = {0., 0., 0., 1.};
GLfloat WHITE[] = {1., 1., 1., 1.};
int main(int argc, char *... | true |
47005aaf258c9f0c34095d1c43af1123cd9546b7 | C++ | lee-jeong-geun/ps | /boj/1017.cpp | UTF-8 | 4,243 | 3.171875 | 3 | [] | no_license | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
using namespace std;
struct Edge
{
int v, capa, rev;
Edge(int v, int capa, int rev) : v(v), capa(capa), rev(rev) {}
};
vector<vector<Edge>> vec;
vector<int> Num[5], result;
int N, arr[55], level[55],... | true |
0aca442fd0257b0ef9ca1e64914b88cce8ce9716 | C++ | inder128/cppCodes | /op.cpp | UTF-8 | 790 | 2.75 | 3 | [] | no_license | #include <iostream>
#include <stack>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int a[n+1], b[n+1];
stack <pair<int, int> > st;
for (int i = 1; i < n+1; ++i)
cin>>a[i];
a[0] = 0; b[0] = 0; b[1] = 0;
b[2]= ((a[2]-a[1]>0) ? a[2]-a[1] : 0);
for (int i = 3; i < n+1; ... | true |
f4df0a80e08e96b7322cf097ee21113b36b5c647 | C++ | Ben-Hi/fantasy-tournament | /project4_Fantasy_Tournament/Menu.cpp | UTF-8 | 18,981 | 3.4375 | 3 | [] | no_license | /***********************************************************************************************
* * Program name: Menu.cpp
* * Author: Benjamin Hillen
* * Date: 23 November 2019
* * Description: Menu class definition for the fantasy tournament simulator, members
* * describe the team lineups/graveyards, ... | true |
4569e01b360aa034de2a4fe5f66c727fd5ab6b54 | C++ | KillgoreAlpha/CSCI40 | /checkletter.cpp | UTF-8 | 1,508 | 4.28125 | 4 | [] | no_license | //Jeffrey Winters
//This program takes an eight digit number as input and adds a check letter to the end of the number
#include <iostream>
using namespace std;
int assignLetter(int);
int main()
{
int inputNum;
char checkLetter;
//These lines prompt the user to give an input to ass... | true |
60dc0207523a3eff0a8548745002ff85b7f94aef | C++ | hussain7/Algorithms-Problems | /MoveSpacestoFront.cpp | UTF-8 | 616 | 3.421875 | 3 | [] | no_license | // Example program
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <climits>
//2 X 7 X X 10 X
// 5 8 12 14
const int NA=-1;
void movetoEnd(std::vector<int>& v )
{
int j=v.size()-1;
for(int i=v.size()-1; i>=0;--i )
{
if(v[i] != NA)
{
v[j] = ... | true |
782a8ad7194c62d3fd0bb1b1870352d55ebd3f1c | C++ | mmussomele/sip_skeleton | /tasks/using_objects/rooms_test.cpp | UTF-8 | 12,339 | 3.359375 | 3 | [] | no_license | /*
* rooms_test.cpp
*
* Created On: July 1, 2015
* Author: Matthew Mussomele
*/
#include <unordered_set>
#include <stdlib.h>
#include <time.h>
#include <queue>
#include "gtest/gtest.h"
#include "rooms.h"
#include "Robot.h"
namespace {
class rooms_test : public ::testing::Test {
protected:
... | true |
1a63a26400d121f1d841b2dfb99319ce94dcd96a | C++ | shivanshu1086/DSA | /Linked List/Doubly Linked List/print_sum.cpp | UTF-8 | 628 | 3.125 | 3 | [] | no_license | #include <iostream>
#include "dll.h"
using namespace std;
void print_sum(node *head, int x){
node *temp=head;
while(temp->data<x){
temp=temp->next;
}
while(temp->prev!=NULL){
node *temp2=head;
while(temp2->next!=temp){
if(temp->data+temp2->data==x){
... | true |
c67cbb4809c413ffbb071f89cfefea0dfbbd0b7d | C++ | vgc/vgc | /libs/vgc/core/array.h | UTF-8 | 109,166 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2021 The VGC Developers
// See the COPYRIGHT file at the top-level directory of this distribution
// and at https://github.com/vgc/vgc/blob/master/COPYRIGHT
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may o... | true |
069971591caa74926ee027dfa63ef07ff695a834 | C++ | fuad7161/Basic-Algorithm- | /Segment tree/Update_array_segment_tree.cpp | UTF-8 | 1,535 | 2.609375 | 3 | [] | no_license | //Author: Fuadul Hasan(fuadul202@gmail.com)
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define vi vector<int>
#define all(n) n.begin(),n.end()
const int Inf = (int)2e9 + 5;
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;
const int N = 4e5 + 5;... | true |
41b7702eb4eb7d4a99f47a875bb4671fab5b5bcf | C++ | Oelderoth/LightWeaver-Module | /lib/lightweaver-core/LightWeaver/util/StringListBuilder.h | UTF-8 | 1,005 | 3.078125 | 3 | [] | no_license | #pragma once
#include <Arduino.h>
namespace LightWeaver {
struct StringListBuilder {
private:
const String separator;
public:
String value;
StringListBuilder(const String& separator) : separator(separator), value("") {}
StringListBuilder(const String& separator, cons... | true |
1f4f6b63ec7610baf9c4e08f141d92b0574b5c6d | C++ | dvdouden/planetgenerator | /geom/PlanetGeometry.h | UTF-8 | 2,418 | 2.53125 | 3 | [] | no_license | #pragma once
#include "DrawElementsGeometry.h"
#include "../Planet.h"
class Planet;
class PlanetGeometry : public DrawElementsGeometry {
public:
explicit PlanetGeometry( Planet& sphere ) :
DrawElementsGeometry( "Planet", vl::PT_TRIANGLE_FAN ),
m_planet( sphere ) {}
void createGeomet... | true |
9c3ecc5a1e55673c0f9afa6ab32a42250409d6d0 | C++ | nosyliam/CPPCourse | /zuul/room.h | UTF-8 | 1,883 | 3.390625 | 3 | [] | no_license | #pragma once
#include <vector>
#include <string>
#include <map>
#include <functional>
// Preprocessors for medatadata definition
#define ROOM_START(ID, NAME, STATE) Room* ROOM##ID = new Room(NAME, STATE)
#define NEIGHBOR(ID, DIR, OTHER) ROOM##ID->SetNeighbor(Direction::DIR, ROOM##OTHER)
#define ITEM(ID, NAME, CALLBACK... | true |
a784b88abeca85760c2e55cdd96f9fb85d94c943 | C++ | CaptFrank/GHID | /BLUNO_Project/BLUNO_BASE_STATION/Receiver_Callback/Src/aaMain/USBDeviceImplementation.cpp | UTF-8 | 1,678 | 2.796875 | 3 | [] | no_license | /*
* USB_Device_Implementation.cpp
*
* Created on: Jul 17, 2013
* Author: francispapineau
*/
#include "USBDeviceImplementation.h"
//! Default Constructor
USBDevice::USBDevice(void* report){
//! Initializing the environment variables
#ifdef JOYSTICK_REPORT
this->_report = (joystick_report_t*)report;
#... | true |
b1c9162b5e84fd7d8b922bdf3a8c7d40c1abce7c | C++ | jonknoll/TaskScheduler | /example/arduino_sched_example.ino | UTF-8 | 2,140 | 3.125 | 3 | [
"MIT"
] | permissive | /***************************************************************************//**
Example program using the task_scheduler library.
This example was targeted for the Arduino UNO or NANO. It simultaneously blinks
the onboard LED and prints to the serial monitor, both at different rates. It
is a simple demonstration... | true |
44e24b0ac61d60aa1b01336143aa1fb65a859e1d | C++ | iseki-masaya/ChallengeBook | /Chapter2/2-5/01BipartiteGraph.cpp | UTF-8 | 813 | 2.96875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <map>
#include <string>
#include <bitset>
#include <queue>
#include <algorithm>
#include <functional>
#include <cstdio>
using namespace std;
#define MAX_V 50
vector<vector<int> > G;
vector<int> color(MAX_V,0);
bool dfs(int v,int c)
{
color[v] = c;
for (int i=0; i<G[v... | true |
6ac8f45a79d4407e7f3359afdf9e5af449a9d7c7 | C++ | Lrs121/winds | /arm9/include/_dialog/dialog.folder.choose.h | UTF-8 | 1,243 | 2.578125 | 3 | [
"MIT"
] | permissive | #ifndef _WIN_D_FOLDERCHOOSE_
#define _WIN_D_FOLDERCHOOSE_
#include <_type/type.dialog.h>
#include <_gadget/gadget.button.h>
#include <_gadget/gadget.label.h>
#include <_gadget/gadget.window.dialog.h>
#include <_gadget/gadget.filetree.h>
class _folderChooseDialog : public _dialog
{
private:
_button*... | true |
e17f7663b33ac321508ffad3ac9a92c3949db646 | C++ | ygorshenin/trees | /src/typelist/typelist.h | UTF-8 | 568 | 2.703125 | 3 | [] | no_license | #ifndef TYPELIST_TYPELIST_H_
#define TYPELIST_TYPELIST_H_
#include <cstddef>
namespace typelist {
struct NullType {
}; // struct NullType
template<class T, class U>
struct TypeList {
typedef T Head;
typedef U Tail;
}; // struct TypeList
template<class> struct Length;
template<>
struct Length<NullType> {
s... | true |
4f86ac35848b8e9851c1dcade56a218c4ca80f45 | C++ | Golden-Eagle/gecom | /src/gecom/Terminal.hpp | UTF-8 | 2,322 | 2.84375 | 3 | [] | no_license |
/*
* GECOM Terminal Utilities Header
*
* Allows use of ANSI terminal escape sequences to manipulate color in
* a portable manner. Redirects stdio to a thread and then forwards or
* interprets escape sequences if connected to a terminal, suppressing
* them otherwise. If no redirection mechanism is availabl... | true |
823be23142b8b1bca859174e70be8a3fb80449af | C++ | davisking/dlib | /dlib/matrix/symmetric_matrix_cache_abstract.h | UTF-8 | 3,154 | 2.828125 | 3 | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Copyright (C) 2010 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#define DLIB_SYMMETRIC_MATRIX_CAcHE_ABSTRACT_Hh_
#ifndef DLIB_SYMMETRIC_MATRIX_CAcHE_ABSTRACT_Hh_
#include "matrix_abstract.h"
namespace dlib
{
// ----------------------------------------... | true |
28fa83c705bb3ef9d982fc90a29066810ef93c56 | C++ | pikec/portfolio | /CS162_final/Room.cpp | UTF-8 | 4,816 | 3.65625 | 4 | [] | no_license | /***************************************************
* * filename: Room.cpp
* * author: Candis Pike
* * description: class implemneation file Room class
* * input: none
* * output: specified by funtion
* *************************************************/
#include "Room.hpp"
#include <string>
#include <cstdlib>
#... | true |
3a759bb87787a9f2a77411c99b6dc0a71f27f8ef | C++ | ashishnagpal2498/CPP_Concepts_and_Codes | /HackerEarth/Epoch- Competition/colouring_grid2x2.cpp | UTF-8 | 1,663 | 3.546875 | 4 | [] | no_license | //Colouring the Grid
#include<iostream>
using namespace std;
bool Cancolor(char grid[][100],int i,int j,int n,int m)
{
if(i+1==n||j+1==m)
{
return false;
}
for(int a=i;a<2;a++)
{
for(int b=j;b<2;b++)
{
if(grid[a][b]=='#')
{
return fals... | true |
c7b6518a5dece6a1f8a3c686f8c454f3763723c0 | C++ | Syhawk/LeetCode | /maximum_product_subarray.cpp | UTF-8 | 1,750 | 3.0625 | 3 | [] | no_license | //uri: https://leetcode.com/problems/maximum-product-subarray/
/*
* 对于0需要特判,对于负数,每次取偶数个负数。
* 空间复杂度:O(1).
* 时间复杂度:O(n).
* */
class Solution {
public:
int maxProduct(vector<int>& nums) {
int len = nums.size();
if(len < 1) return 0;
long long result = nums[0];
long long tmp = 1;
... | true |
55689f12fcd777a0d403148cec43c50404966010 | C++ | Mikalai/punk_project_a | /source/entities/ibag.cpp | UTF-8 | 3,004 | 2.53125 | 3 | [] | no_license | #include <attributes/transform/module.h>
#include <system/logger/module.h>
#include "ibag.h"
#include "icollection_impl.h"
#include "ishape.h"
PUNK_ENGINE_BEGIN
namespace Entities {
class Bag : public IBag, public ICollection, public Core::ISerializable, public IShape {
public:
// IObject
void QueryInterface(co... | true |
09ee80466b4f20554b254268fe267cf46cc8e41c | C++ | parasrawat007/C-Plus-Plus | /14_LimitsOfType.Cpp | UTF-8 | 230 | 2.859375 | 3 | [] | no_license | #include<iostream>
#include<limits>
using namespace std;
int main()
{
numeric_limits<int> n;
cout<<"Min = "<<n.min()<<endl
<<"Max = "<<n.max()<<endl
<<"Digits = "<<n.digits<<endl;
return 0;
} | true |
b0831684b4637110311b147ced6f0d4eca1a6ecf | C++ | lirui311012/C_study | /C++高级/C++11/05_function函数对象的实现原理.cpp | UTF-8 | 2,314 | 3.953125 | 4 | [] | no_license | #include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <typeinfo>
using namespace std;
/*
function函数对象的实现原理
C++11提供的可变参的类型参数A...
*/
void hello(string str) { cout << str << endl; }
int sum(int a, int b) { return a + b; }
template <typename Fty>
class myfunction {};
//////////////////... | true |
a5a3baa41198a7ae28faf0d8dbd29937e9f2b507 | C++ | DuyetVu2001/Study-CPlusPlus-Language | /BaiTapTrenLop/B1TinhTongGTLNT.cpp | UTF-8 | 1,629 | 2.828125 | 3 | [] | no_license | #include<iostream>
#include<math.h>
#define N 100
using namespace std;
void input(int a[N][N], int n, int m);
void output(int a[N][N], int n, int m);
void ham_chan(int a[N][N], int n, int m);
int find_sum(int a[N][N], int n, int m);
int find_max(int a[N][N], int n, int m);
int main(){
int a[N][N];
int n, m;
cout ... | true |
612e0c26fac3ecb1c918c458b8f908b354f2f147 | C++ | SGrebenkin/HackerRank | /HackerRank.PrimitiveProlem.cpp | UTF-8 | 2,152 | 3.015625 | 3 | [] | no_license | #include <bits/stdc++.h>
#include <numeric>
using namespace std;
template <class F>
void factors(long long int n, F f) {
// Print the number of 2s that divide n
while (n%2 == 0) {
f(2);
n = n/2;
}
for (int i = 3; i <= sqrt(n); i = i+2) {
// While i divides n, print i and divid... | true |
e5b1dee92a01443d600008801d87e8bb01d91271 | C++ | advancevillage/trace | /core/objectarray.h | UTF-8 | 737 | 2.515625 | 3 | [] | no_license | #ifndef __OBJECT__ARRAY__
#define __OBJECT__ARRAY__
#ifndef __OBJECT__
#include "object.h"
#endif // __OBJECT__
#ifndef __USED__VECTOR__
#define __USED__VECTOR__
#include <vector>
using namespace std;
#endif // __USED__VECTOR__
class ObjectArray{
protected:
vector<Object> _objAry;
public:
ObjectArray();
... | true |
6e9aa2a6925b08e414519c3a6325564fb951a7f9 | C++ | seanmoreton/ppp_cpp_stroustrup | /chapter04/13. SieveOfEratosthenes (14).cpp | WINDOWS-1250 | 933 | 4.3125 | 4 | [] | no_license | #include <iostream>
#include <vector>
//Create a program to find all the prime numbers between 1 and 100.
//There is a classic method for doing this, called the Sieve of Eratosthenes.
//If you dont know that method, get on the web and look it up.
//Write your program using this method.
void SieveOfEratosthenes(int ... | true |
258e06d0d131c938783ca53ea4b3cfa69501deb0 | C++ | Zethian/proto-cubes-obc | /obcsim/RTC.hpp | UTF-8 | 1,213 | 2.53125 | 3 | [
"MIT"
] | permissive | #include "RTClib.h"
#define REQUEST_TIME 60
/*
* RTC_init
* Initializes the RTC clock
*/
void RTC_init();
/*
* RTC_get
* Returns a datetime variable with the current time of request
*
*/
DateTime RTC_get(void);
/* RTC_time_since_last
* Returns a boolean if the time has passed the threshold of delaytime sinc... | true |
79128f51013e49ec2bd5046e568ad23145d97b66 | C++ | rongminjin/assignment18 | /main.cpp | UTF-8 | 8,008 | 2.875 | 3 | [] | no_license | //
// main.cpp
// a16w
//
// Created by Rongmin Jin on 3/28/19.
// Copyright © 2019 Rongmin Jin. All rights reserved.
//
#include <iostream>
#include "Header.h"
#include "customer.hpp"
string customerArrivalRate, serviceTime, randomSeed;
size_t lengthOfDecimalPart;
int randomSeedInt;
double randomDecimalGenerato... | true |
8fdd0816d688406baaf928a0950ad81678c3a320 | C++ | Noah171/Cpp | /LevelMaker.h | WINDOWS-1252 | 2,304 | 3.125 | 3 | [] | no_license | #pragma once
#ifndef _LEVEL_MAKER_H
#define _LEVEL_MAKER_H
#define _GREEN 0x02
#define _BLUE 0x05
#define _RED 0x04
#define _BLACK 0x00
#define _WHITE 0x0f
#define _YEN
#include "stdafx.h"
#include <vector>
#include "Room.h"
#include <random>
#include "windows.h"
using namespace std;
class Le... | true |
adda200eef0282aab6d382a43920bfaf4ca04ec0 | C++ | pollo/graph-partitioning | /partition.cpp | UTF-8 | 738 | 3.078125 | 3 | [] | no_license | #include"partition.h"
using namespace std;
void Partition::set_size(int nodes_number, int partitions_number)
{
this->nodes_number = nodes_number;
this->partitions_number = partitions_number;
//-1 means not yet assigned
partitions.resize(nodes_number, -1);
partition_sizes.resize(partitions_number, 0);
}
voi... | true |
72599ae2b2ff465c2d1422215af4120c69b34918 | C++ | langyastudio/sentinel-crypto | /SentinelRuntime/Cpp/hasplegacy.cpp | UTF-8 | 7,208 | 2.515625 | 3 | [] | no_license | ////////////////////////////////////////////////////////////////////
// Copyright (C) 2011, SafeNet, Inc. All rights reserved.
//
// HASP(R) is a registered trademark of SafeNet, Inc.
//
//
// $Id: hasplegacy.cpp,v 1.19 2011-05-02 03:12:07 nsingh1 Exp $
/////////////////////////////////////////////////////////////////... | true |
dc991ad915bb5c5858364736bd521aa737c24a01 | C++ | jjuiddong/Common | /Network/packetqueue.h | UHC | 3,735 | 2.765625 | 3 | [
"MIT"
] | permissive | //
// 2015-11-29, jjuiddong
//
// - Ŷ Ѵ. Thread Safe, ִ ϰ .
// - Ʈ Ÿ Ŷ ũ⸸ŭ Ѵ.
// - ť , Ŷ ϰ, ߰Ѵ.
// - ϸ packetSize ũ⸸ŭ ä Ѿ ʴ´.
// - Ŷ ť , (sHeader) ߰ȴ.
// - ϸ ϳ ̻ ť ִ.
//
// 2016-06-29, jjuiddong
// - sHeader Ŷ ְ
// - Init(), isIgnoreHeader ÷ ߰
//
// 2016-05-26, jjuiddong
// - ū Ŷ sHeader , Ŷ ״´.... | true |
652062aaa5f775e83759cf48b799780eccc5c15d | C++ | adrs0049/FastVector | /utils/type_info.cpp | UTF-8 | 1,007 | 2.546875 | 3 | [
"MIT"
] | permissive | ////////////////////////////////////////////////////////////////////////////////
// //
// File Name: type_info.cpp //
// ... | true |
54907c613aeca84ed7eec8ca657bffa39b6a58d2 | C++ | BakaErii/ACM_Collection | /HDU/1849/13174081_AC_15ms_1700kB.cpp | UTF-8 | 624 | 2.625 | 3 | [
"WTFPL"
] | permissive | /**
* @author Moe_Sakiya sakiya@tun.moe
* @date 2018-03-24 19:15:02
*
*/
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace st... | true |
4203818dd45327b83448abd25ee2d477191fc871 | C++ | sneumann/Rdisop | /src/imslib/src/ims/masspeak.h | UTF-8 | 1,410 | 3.546875 | 4 | [] | no_license | #ifndef IMS_MASSPEAK_H
#define IMS_MASSPEAK_H
#include <ostream>
namespace ims {
/**
* Represents a peak that contains only a mass.
*
* @param MassType the mass type
*
* @ingroup peaks
*/
template <typename MassType = double>
class MassPeak {
public:
typedef MassType mass_type;
/** Identifier for mass pro... | true |
f157ee03a211ccf62ec5e603306424249f0d2352 | C++ | nasa/gunns | /ms-utils/math/approximation/ProductFit.cpp | UTF-8 | 3,199 | 2.625 | 3 | [
"LicenseRef-scancode-us-govt-public-domain",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /************************** TRICK HEADER **********************************************************
LIBRARY DEPENDENCY:
((TsApproximation.o))
***************************************************************************************************/
#include "ProductFit.hh"
/////////////////////////////////////////////... | true |
62264bb2020b9a8e1fa8408733f778ca4d81df1b | C++ | aschor/somfy_esp8266_remote_arduino | /config.h | UTF-8 | 1,865 | 2.671875 | 3 | [] | no_license | // You can add as many remote control emulators as you want by adding elements to the "remotes" vector
// The id and mqtt_topic can have any value but must be unique
// default_rolling_code can be any unsigned int, usually leave it at 1
// eeprom_address must be incremented by 4 for each remote
// Once the progra... | true |
23464ebd007c1c4ac68553310ab2ab2eae7f0d5a | C++ | mgoongaBabangida/engine | /Mgoonga/math/SceletalAnimation.h | UTF-8 | 2,337 | 2.859375 | 3 | [] | no_license | #ifndef SCELETAL_ANIMATION_H
#define SCELETAL_ANIMATION_H
#include "stdafx.h"
#include <base/interfaces.h>
#include "Transform.h"
#include "Clock.h"
#include <map>
//-------------------------------------------------------------------
struct Frame
{
int64_t timeStamp;
std::map<std::string, Transform... | true |
2c2d7f8d449abf5f73c9959c46071674b97cd0b8 | C++ | Chenromeo/DBMS | /数据结构/list5/main.cpp | GB18030 | 7,344 | 2.953125 | 3 | [] | no_license | // list5
#include "Slist.h"
#include <bits/stdc++.h>
using namespace std;
typedef struct
{
char sFieldName[10]; //ֶ
char sType[8]; //ֶ
int iSize; //ֳ
char bKey; //ֶǷΪKEY
char bNullFlag; //ֶǷΪ
char bValidFlag; //ֶǷЧԺԱиֶεɾ
} TableMode, *PTableMode;
typ... | true |
b30b3637b167e47479a4f128d3740d013da555e4 | C++ | peterhuene/puppetcpp | /lib/include/puppet/utility/filesystem/helpers.hpp | UTF-8 | 1,325 | 3.25 | 3 | [
"Apache-2.0"
] | permissive | /**
* @file
* Declares the filesystem helper functions.
*/
#pragma once
#include <string>
#include <boost/filesystem.hpp>
namespace puppet { namespace utility { namespace filesystem {
/**
* Gets the default path separator.
* This will be ':' on POSIX systems and ';' on Windows.
* @return Return... | true |
2d3ca71ab28adce03579302860dd7aa6985f00f7 | C++ | lpanian/lptoolkit | /tests/unit/utf8_test.cpp | UTF-8 | 2,044 | 2.828125 | 3 | [] | no_license | #include "toolkit/utf8str.hh"
#include <gtest/gtest.h>
using namespace lptk;
////////////////////////////////////////////////////////////////////////////////
TEST(UTF8, Decode8)
{
const auto utf8 = u8"$";
auto pair = utf8_decode(utf8);
EXPECT_EQ(lptk::CharPoint('$'), pair.first);
EXPECT_EQ(utf8 + 1, ... | true |
e62b373d52d63c39b36a4fbe9745ccc704e05513 | C++ | Icemore/homework | /fall_2013/cpp/hw/huffman/src/BinaryWriter.h | UTF-8 | 529 | 2.828125 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <vector>
#include "BitChain.h"
#include "Constants.h"
class BinaryWriter
{
public:
BinaryWriter(std::ostream &ofs);
~BinaryWriter();
void writeByte(uint8_t byte, int bitsUsed = BITS_IN_BYTE);
void writeVector(std::vector<uint8_t> &vec);
void writeNumber... | true |
463430fdfdd78d82cb51272733f734a1103d719c | C++ | scarletea/SDUT | /4202.cpp | UTF-8 | 512 | 2.65625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
int w1[5010],w2[5010],w3[5010];
double sum[5010];
int max = -1;
int f = 0;
for(int i = 0;i<n;i++)
{
cin>>w1[i]>>w2[i]>>w3[i];
sum[i] = (double)w1... | true |
a5928eeb03e43be142b440a18bdfe2ff494022fc | C++ | badstyle319/UVA | /1st Edition's Exercises/4. Graph/00469 - Wetlands of Florida.cpp | UTF-8 | 1,855 | 2.828125 | 3 | [] | no_license | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#define LL long long
#define ULL unsigned long long
using namespace std;
vector<string> arr;
int... | true |
b0df22ee12f198b12bde120971e354b6c6b00b73 | C++ | huihui571/leetcode-daily | /每日一题/2021年2月/448-找到所有数组中消失的数字.cpp | UTF-8 | 1,243 | 3.328125 | 3 | [] | no_license | /*<FH+>************************************************************************
* Editor : Vim
* File name : 448-找到所有数组中消失的数字.cpp
* Author : huihui571
* Created date: 2021-02-13
* Description : 给定一个范围在 1 ≤ a[i] ≤ n ( n = 数组大小 ) 的 整型数组,数组中的元素一些出现了两次,另一些只出现一次。
* 找到所有在 [1, n] 范围之间没有出现在数组中的数字。
* ... | true |
0bfcbdafe046879aee1d819d2955da72ddf38e47 | C++ | Mansterteddy/Cracking-the-Coding-Interview | /algorithm/leetcode/Q18/main.cc | UTF-8 | 3,003 | 3.375 | 3 | [] | no_license | #include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
class Solution {
public:
vector<vector<int>> fourSum(vector<int>& nums, int target){
vector<vector<int>> res;
if(nums.size() < 4){
return res;
}
sort(nums.begin... | true |
541708f4b4a0fb065a4af606c606593bf5fa3f93 | C++ | a-ovch/oop | /lab1/flipbyte/flipbyte.cpp | UTF-8 | 1,278 | 3.40625 | 3 | [] | no_license | // flipbyte.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <sstream>
#define BITS_IN_BYTE 8
#define MIN_INPUT_VALUE 0
#define MAX_INPUT_VALUE 255
using namespace std;
unsigned char ReversBits(unsigned char num);
int main(int argc, char *argv[])
{
if... | true |
9784c40d7e63cc0ac93f4307091cdbeed1432291 | C++ | Stiffstream/sobjectizer | /doxygen/dox/so_5/so_5_5_3__subscr_storage_selection.dox | UTF-8 | 4,515 | 3.296875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /*!
\page so_5_5_3__subscr_storage_selection so-5.5.3: Subscription storage type selection
There are some places in the SObjectizer where there is no "one right
implementation" which will give the best possible results for all scenarios.
Version 5.5.3 introduces an approach for tuning agents and underlying data
struc... | true |
7373a976ceff42e79c6f216589cf8bc259947b82 | C++ | Daniil-Osokin/projects | /unn/ConnectedComponentsComputation/ConnectedComponentsComputation/separated_set_collection.hpp | UTF-8 | 327 | 2.515625 | 3 | [] | no_license | #ifndef __SEPARATED_SET_COLLECTION_HPP__
#define __SEPARATED_SET_COLLECTION_HPP__
class SeparatedSetCollection
{
public:
SeparatedSetCollection(int size);
~SeparatedSetCollection();
void combine(int x, int y);
int find(int x) const;
private:
void create(int x);
int* nodes;
int* ranks;
};
... | true |
c650ec29e0ea40cad93fd8e468b5a753c703810c | C++ | sunjiyuansjy/MyProject_httpweb | /MyHttpWeb1.4/ThreadPool.hpp | UTF-8 | 2,417 | 3.40625 | 3 | [] | no_license | #ifndef __THREADPOOL_HPP__
#define __THREADPOOL_HPP__
#include <iostream>
#include <queue>
#include <pthread.h>
typedef void (*handler_t)(int);
class Task{
private:
int sock;
handler_t handler;
public:
Task(int sock_,handler_t handler_):sock(sock_),handler(handler_)
{}
void Run()
{
han... | true |
01787d8a6b146bca0ff6fc6dfa68d41885c1fa72 | C++ | AugustoCalaca/competitive-programming | /spoj/yodaness.cpp | UTF-8 | 1,282 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#define f first
#define s second
#define MAX 30010
#define pb push_back
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<s... | true |
25009f8ea64f46a7aa72d866f360347e34fd69f6 | C++ | georgerapeanu/c-sources | /acm2021-2/simulari/16oct/D.cpp | UTF-8 | 646 | 2.515625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
if(b == 0){
return (a < 0 ? -a:a);
}
return gcd(b,a % b);
}
int main(){
int t;
int n;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
vector<pair<int,int> > v(n);
map<pair<int,int>,int > stuff;
long long ans = 0;... | true |
2b8c9e93232dd2dd416407dc70bfce4bd6162761 | C++ | rajnishgeek/DSandAlgorithmPracticeSolution | /Binary Tree/binary tree tilt.cpp | UTF-8 | 461 | 3.265625 | 3 | [] | no_license | void solve(TreeNode* root, int &res)
{
if (root == NULL)
return;
solve(root->left, res);
solve(root->right, res);
if (root->left == NULL && root->right == NULL)
return;
int l = 0, r = 0;
if (root->left)
l = root->left->val;
if (root->right)
r = root->right->va... | true |
a66932df392590ae28c322f74a99e999458d53b5 | C++ | lulufa390/ElfGE | /GameEngine/UI/Font/FontFace.cpp | UTF-8 | 3,378 | 2.84375 | 3 | [
"MIT"
] | permissive | //
// Created by 张程易 on 16/11/2017.
//
#include "FontFace.h"
GLuint FontFace::VAO, FontFace::VBO;
bool FontFace::isInit = false;
void FontFace::renderText(const std::string &text) {
glActiveTexture(GL_TEXTURE0);
glBindVertexArray(VAO);
float x = 0;
std::string::const_iterator c;
for (c = text.be... | true |
1d0f841011c8451d26ebc60d64bd2e096774c3ee | C++ | Hong-SY/JellySimulation | /JellyDemo/Source/JellyDemo/JellyLogger.h | UHC | 1,583 | 2.71875 | 3 | [] | no_license | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include <string>
#include <iostream>
#include <list>
#include <fstream>
#include "JellyActor.h"
#include "CoreMinimal.h"
/**
*
*/
#define BUFFER_NUMBER 2
#define BUFFER_SIZE 1000
// Ŀ ٸ Ϸ ̵
// ൿ ID enumerate ü
enum Beh... | true |
f09d7088bdc4f53e4f218c07fde9551a31796d27 | C++ | CodevilWang/code_snippet | /C++/stdlib/test_alignas.cpp | UTF-8 | 5,858 | 2.953125 | 3 | [] | no_license | // Copyright 2019 All Rights Reserved.
// some code port from facebook Folly
#include <iostream>
#include <vector>
#include <assert.h>
struct Foo {
alignas(0x40) float array[1];
Foo() {
std::cout << "ctor " << array << "\n";
}
};
template<typename T>
class Poo {
public:
template<typename U, std::enable... | true |
5f040838742c1b1560b7f6ecdae4b03f0c008585 | C++ | univmajalengka/191410018 | /Tugas Struktur Data/Multidimensi.cpp | UTF-8 | 419 | 2.765625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main ()
{
int p[4][4][2] = { {2,3,4,5}, {7,6,9,8}, {1,10} };
int q[4][4][2] = { {5,4,3,2}, {8,9,6,7}, {10,1} };
int r[4][4][2];
for(int i=0;i<4;i++){
for(int j=0;j<4;j++)
for(int k=0;k<2;k++){
r[i][j][k]=p[i][j][k]+q[i][j][k];
}
}
for(int i=0;i<4;i++){
f... | true |
953164eebc7b2f8f0371e7f81d662c8ad34251b9 | C++ | onedata/helpers | /src/glusterfsHelper.h | UTF-8 | 10,192 | 2.65625 | 3 | [
"MIT"
] | permissive | /**
* @file glusterfsHelper.h
* @author Bartek Kryza
* @copyright (C) 2017 ACK CYFRONET AGH
* @copyright This software is released under the MIT license cited in
* 'LICENSE.txt'
*/
#ifndef HELPERS_GLUSTERFS_HELPER_H
#define HELPERS_GLUSTERFS_HELPER_H
#include "helpers/storageHelper.h"
#include <folly/executors... | true |
50064951c4aff1e29c11e232f6d121ba1a406a1a | C++ | utsavmajhi/CP | /Algorithms/q1.cpp | UTF-8 | 540 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int main(int argc, char *argv[]) {
// このコードは標準入力と標準出力を用いたサンプルコードです。
// このコードは好きなように編集・削除してもらって構いません。
// ---
// This is a sample code to use stdin and stdout.
// Edit and remove this code as you like.
string line;
int index = 1;
while (!cin.eof... | true |
60e143096ab9255b8f5c11d153114bb68560413f | C++ | kirwinia/ares-emu-v121 | /nall/encode/huffman.hpp | UTF-8 | 2,355 | 2.8125 | 3 | [
"ISC"
] | permissive | #pragma once
namespace nall::Encode {
inline auto Huffman(array_view<u8> input) -> vector<u8> {
vector<u8> output;
for(u32 byte : range(8)) output.append(input.size() >> byte * 8);
struct Node {
u32 frequency = 0;
u32 parent = 0;
u32 lhs = 0;
u32 rhs = 0;
};
array<Node[512]> nodes;
for(u3... | true |
3039f37173aabae371077ae476ac9990338e03e3 | C++ | dipal/simple-csv-reader | /csv_reader_test.cpp | UTF-8 | 1,744 | 3.203125 | 3 | [] | no_license |
#include "csv_reader.hpp"
#define Log(X) std::cout << X << std::endl;
template<typename T>
void printVector(std::vector<T> v) {
for (int i=0; i<v.size(); i++) {
if (i) {
std::cout << ", ";
}
std::cout << v[i];
}
std::cout << std::endl;
}
template<typename T>
void printVector2d(std::vector<T> v) {
for... | true |
c6157f9a6dc1b3f0ce9623e0eb3cd09bb937fd7c | C++ | XA-IT/JianZhi_Offer | /WZT/before/loopInLinkedlist.cpp | UTF-8 | 1,704 | 3.78125 | 4 | [] | no_license | // 链表中环的入口结点
// 题目描述
// 给一个链表,若其中包含环,请找出该链表的环的入口结点,否则,输出null。
/*
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {
}
};
*/
class Solution {
public:
ListNode* whetherlooped(ListNode * pHead){
if(pHead == nullptr)
ret... | true |
d160fbd2b184fe3c5497b44bbd185b1b2f12c3e8 | C++ | sxin-h/PlainRenderer | /Plain/src/Runtime/Rendering/Backend/VulkanRenderPass.cpp | UTF-8 | 793 | 2.53125 | 3 | [
"MIT"
] | permissive | #include "pch.h"
#include "VulkanRenderPass.h"
VkRenderPassBeginInfo createRenderPassBeginInfo(const uint32_t width, const uint32_t height, const VkRenderPass pass,
const VkFramebuffer framebuffer, const std::vector<VkClearValue>& clearValues) {
VkExtent2D extent = {};
extent.width = width;
extent.hei... | true |
04a75f2845382c50ac2aa4bae7439880f4f14c78 | C++ | chneau/oops | /Google/oneforth.cpp | UTF-8 | 1,644 | 3 | 3 | [] | no_license | /*************************************************************************
> File Name: oneforth.cpp
> Author: Louis1992
> Mail: zhenchaogan@gmail.com
> Blog: http://gzc.github.io
> Link: http://www.1point3acres.com/bbs/forum.php?mod=viewthread&tid=145654&extra=page%3D1%26filter%3Dauthor%26orderby%3Ddateline%26sor... | true |
9a3a1452b4a71a780d95be0c9b3d1c2a97a7c0fc | C++ | JiahongHe/LeetCode | /Cpp/239. Sliding Window Maximum O(nk).cpp | UTF-8 | 552 | 3.109375 | 3 | [] | no_license | class Solution {
int maxNumber(vector<int>& nums, int start, int k) {
int maxNum = INT_MIN;
for (int i = 0; i < k; i++) {
maxNum = max(maxNum, nums[start + i]);
}
return maxNum;
}
public:
vector<int> maxSlidingWindow(vector<int>& nums, int k) {
vector<int>... | true |
477cb525e600669d80acd247f9ea61b96d87bfbb | C++ | piotrekjanisz/ppr | /src/c++/data/Step.cpp | UTF-8 | 4,522 | 3.234375 | 3 | [] | no_license | /*
* Step.cpp
*
* Created on: 10-01-2011
* Author: Dariusz Galysa
*/
#include "Step.h"
#include <iostream>
#include <cstring>
#include <map>
const int MAX_PRINTED_POINTS = 8;
using namespace std;
Step::Step() :
_coordinates(NULL) {
}
Step::Step(string name, int pointsNumber, float *coordinates) :
_nam... | true |
53e1bbb4e0291f3a5bb21ba2afaaf18e77b35e4a | C++ | wandeln/MolDynSim | /main.cpp | UTF-8 | 2,480 | 2.890625 | 3 | [] | no_license | #include "test.cpp"
#include <conio.h>
std::string to_string(double a){
std::ostringstream sstream;
sstream << a;
return sstream.str();
}
void original(){
printf("=========== original ===========\n");
Argon argon(6,6,6,1.7048);
VelocityVerletIntegrator VVI(&argon,0.003);
VVI.equilibrate(10... | true |
29b5bd1213fdeff237e6a7cdfd33227ccb21cf39 | C++ | cms-sw/cmssw | /MagneticField/Interpolation/src/CylinderFromSectorMFGrid.cc | UTF-8 | 2,252 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | #include "CylinderFromSectorMFGrid.h"
#include "MagneticField/VolumeGeometry/interface/MagExceptions.h"
#include <iostream>
CylinderFromSectorMFGrid::CylinderFromSectorMFGrid(const GloballyPositioned<float>& vol,
double phiMin,
... | true |
1297613b47ca62e3663c4dd523e0d96590a3807b | C++ | edyrol/Hearthstone-DeckFinder | /MatchCollector.cpp | UTF-8 | 3,192 | 2.71875 | 3 | [] | no_license | #include "CollectOBot.hpp"
#include "HSReplay.hpp"
int main(int argc, char *argv[])
{
//default parameters
// minimum ratio of matches to be considered (for cards)
double MIN_MATCH_VALID_RATIO = .02;
int MAX_NUM_CARDS = 65;
std::string STATS_RESOURCE("HSReplay");
//reads parameters
//checks the number of pa... | true |
6402e20f515ac3d91073738b022e1cb5b282da62 | C++ | Adityasharma15/Data-Structures | /Hash Maps/relative_sorting.cpp | UTF-8 | 531 | 2.546875 | 3 | [] | no_license | #include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll t;
cin >> t;
while(t--)
{
ll n, m;
cin >> n >> m;
ll temp, arr[n];
unordered_map<ll,ll> um;
for(ll i = 0; i<n; i++)
{
cin >> arr[i];
um[arr[i]]++;
}
for(ll i = 0; i<m; i++)
{
cin >> temp;
... | true |
63761b8565eeb13c96b7ccbe9d76f7a46849f18e | C++ | Hespike/osszefuz | /osszefuz.cpp | UTF-8 | 435 | 2.5625 | 3 | [] | no_license | #include <iostream>
using namespace std;
string osszefuzes(string szovegek[], int darab) {
string ujszoveg = "";
for(int i = 0; i < darab; i++){
ujszoveg = ujszoveg + szovegek[i];
}
return ujszoveg;
}
/*
#include <iostream>
using namespace std;
string osszefuzes(string szovegek[], int dara... | true |
e3a51de6366b4d776a1d819d48cfdbe7c08b5b20 | C++ | Arkozak/New-Repo | /Homework 1/Homework 1/greatest.cpp | UTF-8 | 599 | 4.40625 | 4 | [] | no_license | /**
* greatest.cpp
* Andrew Kozak
* 09/11/2019
* This program asks the user a number until they enter a number less than or equal to 0 then outputs the greatest
*/
#include <iostream>
using std::cout;
using std::endl;
using std::cin;
int greatest()
{
int x = 1; //Initializing my variables
int y = 0;
while (x > 0)... | true |
9a63158eda23160863cd7de4584216257c454491 | C++ | leisheyoufu/study_exercise | /CXX/explicit/explicit.cpp | UTF-8 | 993 | 3.21875 | 3 | [] | no_license | #ifndef FBC_MESSY_TEST_EXPLICIT_HPP
#define FBC_MESSY_TEST_EXPLICIT_HPP
// reference Bjarne Stroustrup sample
class String{
public:
explicit String(int n) {};
String(const char *p) {};
};
void test_explicit();
#endif // FBC_MESSY_TEST_EXPLICIT_HPP
static void test1()
{
//String s1 = 'a'; // 错误:不能做隐式char->Stri... | true |
1252bf9e9e7ebcc74975750421861a7650fd57ad | C++ | GuanyiLi-Craig/interview | /Array/q148.cpp | UTF-8 | 2,052 | 3.46875 | 3 | [] | no_license | /****************************************************************************************************
148. Sort List
-----------------------------------------------------------------------------------------------------
Sort a linked list in O(n log n) time using constant spa... | true |
8b50f9667025dd7cb7135d383d4bf4f0649ee3b5 | C++ | jpan127/argparse | /test/test_variant.cpp | UTF-8 | 3,750 | 3.203125 | 3 | [] | no_license | #include "catch.hpp"
#include "variant.h"
using namespace argparse;
/// Tests conversions to / from [Variant]
TEST_CASE("variant", "Parsing") {
Variant var;
struct Visitor {
std::string operator()(std::string) { return "std::string"; };
std::string operator()(double) { return "double"; };
... | true |
6536dad394a933956b8d7a71271a8c7bdb57ba52 | C++ | aleqsio/Studies | /Algorytmy_I_Struktury_Danych/cwiczenia_kurdziel_2/cwiczenia_kurdziel_2/cwiczenia_kurdziel_2.cpp | WINDOWS-1250 | 2,212 | 2.9375 | 3 | [] | no_license | // cwiczenia_kurdziel_2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
using namespace std;
#include <stdlib.h>
#include <string>
const int maxh = 64;
struct SLNode {
string key;
int val;
SLNode** next;
};
struct SkipList {
SLNode* first, last;
int height;
};
struct mdata {
str... | true |
209040ee13f049e1c3b8e9bf7db363fc02276c7c | C++ | PeterZhouSZ/CaveSegmentation | /CaveSegmentationLib/src/ChamberAnalyzation/CurvatureBasedAStar.cpp | UTF-8 | 19,854 | 2.828125 | 3 | [] | no_license | #include "ChamberAnalyzation/CurvatureBasedAStar.h"
#include "ChamberAnalyzation/energies.h"
#include "SignedUnionFind.h"
#include "GraphProc.h"
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <queue>
#include "CaveDataAccessors.h"
struct NeighborViaEdge
{
int patchIndex;
int edgeIndex;... | true |