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
81e18feb3dde1704d4d6784c5605f7e8e91c5dac
C++
lgbutad/p1
/practica_1/Drop.cpp
UTF-8
398
2.5625
3
[]
no_license
#include "stdafx.h" #include "constants.h" #include "Drop.h" CDrop::CDrop(int pos) { m_status = 0; m_pos = pos; } int CDrop::GetStatus() const { return m_status; } int CDrop::GetPos() const { return m_pos; } char CDrop::GetSymbol() const { return s_drop_status[m_status]; } void CDrop::NextStatus() { m_statu...
true
fb5e343e0b9b47927f396377a835674f63b26db5
C++
Bryandevx/basicAlgorithms
/insertionSort.cpp
UTF-8
679
3.78125
4
[]
no_license
#include<iostream> using namespace std; void insertionSort(int array[], int n){ for(int i=1; i < n; i++){ int possibleMin = array[i]; int j = i - 1; while(j >= 0 && array[j] > possibleMin){ array[j+1] = array[j]; j = j - 1; // switching pos while finding if some array pos contains less than possibleM...
true
4cfe4836eca90aebaf5666e44df1e354f4aba664
C++
sizzle0121/leetcode
/Top 100 Liked Questions/p41-first missing positive.cpp
UTF-8
2,769
3.859375
4
[]
no_license
/* * Brute-force: * Starting from i=1 and search for i in the array * Time complexity: O(n^2) * Space complexity: O(1) * * Sort: * Sort the array and search for 1, 2, ... * Time complexity: O(nlogn) * Space complexity: O(1) * * Using extra memory: * Scan the array once to mark all positive numbers existing ...
true
650f242281fc01b570ea14143afcabbd302b4043
C++
ElectrodeYT/AlphaServer
/AlphaServer/ChunkManager.cpp
UTF-8
1,073
2.953125
3
[]
no_license
#include "ChunkManager.h" Chunk& ChunkManager::GetChunk(int x, int y, bool mark) { // Try and find chunk for (int i = 0; i < chunks.size(); i++) { if (chunks[i].x == x && chunks[i].y == y) { if (mark) { chunks[i].chunk_is_loaded_by_players = true; } return chunks[i]; } } // Chunk not found, make new one...
true
8ec0b1a5c6a2e685a955024cab0fb209ac92888d
C++
jordandong/myITint5
/29_Multiply.cpp
UTF-8
1,031
3.734375
4
[]
no_license
/* 给定两个字符串表示的整数a和b,计算它们的乘积a*b,结果也用字符串表示。 注意:a和b有可能是负数。对于0,只有一种合法的表示"0","-0"是不合法的。 */ //返回a*b的结果 string multiply(const string& a, const string& b) { int n1=a.size(); int n2=b.size(); bool sign = false; if(a[0]=='-'){ sign=!sign; } if(b[0]=='-') sign=!sign; int n3=n...
true
0fd0f83f9d7697d512cd20d8af53074d6354577c
C++
cachefish/LeetCode
/动规/354_俄罗斯套娃.cpp
UTF-8
1,939
3.390625
3
[]
no_license
/* 354. 俄罗斯套娃信封问题 给定一些标记了宽度和高度的信封,宽度和高度以整数对形式 (w, h) 出现。当另一个信封的宽度和高度都比这个信封大的时候,这个信封就可以放进另一个信封里,如同俄罗斯套娃一样。 请计算最多能有多少个信封能组成一组“俄罗斯套娃”信封(即可以把一个信封放到另一个信封里面)。 说明: 不允许旋转信封。 示例: 输入: envelopes = [[5,4],[6,4],[6,7],[2,3]] 输出: 3 解释: 最多信封的个数为 3, 组合为: [2,3] => [5,4] => [6,7]。 */ #include<vector> #include<algorithm> using names...
true
baccfc6aee93eb0960ea1114f28d81b07d107c19
C++
kanhaiyatripathi/cplusplusKP2
/Mathematics/meanMedianMode.cpp
UTF-8
1,128
3.40625
3
[]
no_license
#include <bits/stdc++.h> using namespace std; double findMean(int a[], int n) { int sum = 0; for (int i = 0; i < n; i++) sum += a[i]; return (double)sum/(double)n; } double findMedian(int a[], int n) { sort(a, a+n); if (n % 2 != 0) return (double)a[n/2]; retu...
true
fc3fddb23bfef55307ffcb005707576930a0bfcd
C++
radiganm/cli
/src/packages/cli/Cli.cc
UTF-8
2,912
2.859375
3
[]
no_license
/// Cli.cc /// Copyright 2017 Mac Radigan /// All Rights Reserved #include "packages/cli/Cli.h" #include <iostream> #include <iomanip> #include <cstring> #include <atomic> #include <sstream> #include <cstdlib> #include <stdexcept> #ifdef CLI__ENABLE_STACKTRACE #include <boost/stacktrace.hpp> #endif ...
true
c0b9a3cc77a0911112393fb7bd296e7ba04422b6
C++
standard-software-ru/k-means
/Point.hpp
UTF-8
263
2.578125
3
[]
no_license
#pragma once class Point { private: float x; float y; int idCluster; public: Point(float x, float y, int idCluster = 0); float getX(); float getY(); void setX(float x); void setY(float y); int getIdCluster(); void setIdCluster(int idCluster); };
true
51bd99fe73b489408a7c4806ccf5e068df325648
C++
IgorBender/Works
/GLPolygonTest/GpcPolygon.cpp
UTF-8
6,573
2.8125
3
[]
no_license
#include <GpcPolygon.h> GpcPolygon::GpcPolygon() { m_PolygonPtr = new gpc_polygon; m_PolygonPtr->num_contours = 0; m_PolygonPtr->contour = NULL; m_PolygonPtr->hole = NULL; } GpcPolygon::GpcPolygon(uint32_t NumOfVertices, double* Vertices) { m_PolygonPtr = new gpc_polygon; m_PolygonPtr->num_con...
true
8ada96da83c6e7950ad869fd922ffa1b7f9d333c
C++
khabya/Common
/Network2/networknode.cpp
UTF-8
2,299
2.703125
3
[ "MIT" ]
permissive
#include "stdafx.h" #include "networknode.h" using namespace network2; cNetworkNode::cNetworkNode(const StrId &name //= "NetNode" , const bool isPacketLog //= false ) : cSession(common::GenerateId(), name, isPacketLog) , m_packetHeader(nullptr) { } cNetworkNode::~cNetworkNode() { Close(); SAFE_DELETE(m_packe...
true
bd7a5ef1a872a649a9350ba136c40e0343eada9b
C++
ducthanhtran/taocp
/volume_1/chapter_1/extended_euclid.cpp
UTF-8
993
3.625
4
[]
no_license
// Extended Euclid's algorithm: algorithm E in "The Art of Programming, volume 1 (3rd edition), chapter 1.2.1". #include <iostream> #include <string> struct Result { int gcd; int a; int b; }; // Algorithm E Result extended_euclid(int m, int n) { int a_ = 1; int b = 1; int a = 0; int b_ = ...
true
e4b0a21467ea6034e343b7516a3065bdb35234bc
C++
insieme/insieme
/test/seq/cpp/cpp11/cpp11enums/cpp11enums.cpp
UTF-8
474
3.296875
3
[]
no_license
#include <future> #include <iostream> namespace test { enum class A { A=1, B=2 }; } int main() { //test with an intercepted scoped enum type if(std::launch::async == std::launch::deferred) { std::cout << "enum elements match\n"; } else { std::cout << "enum elements do not match\n"; } //test with namespaced...
true
a2198e051ca492f1fd0bd5fc3da4463877eedb80
C++
sakibsadmanshajib/NSU-CSE225L
/Unsorted (Array Based)/StudentInfo.cpp
UTF-8
859
3.328125
3
[]
no_license
#include "StudentInfo.h" StudentInfo::StudentInfo() { ID = 0; Name = ""; CGPA = 0; } StudentInfo::StudentInfo(int id, string name, float cgpa) { ID = id; Name = name; CGPA = cgpa; } bool StudentInfo::operator!=(StudentInfo std1) { if(ID!=std1.ID || Name!=std1.Name || CGPA!=std1.CGPA) ...
true
64b50e3ca5414f51610615a9266090b03bc712d5
C++
braveheartwm/leetcode
/src/data_structure/kill_man/second_max.h
UTF-8
1,375
3.328125
3
[]
no_license
#include <iostream> using namespace std; template<class T> struct Node { T data; Node* next; Node() {} Node(T x) { data = x; next = NULL; } }; template<class T> T second_max(T a[],int n) { // if (n < 2) { // throw "error"; // } // T result = a[0]; // Node<...
true
121285f659a15aa03edd4d74573cbc0438e39a5d
C++
Shikhar-S/CodesSublime
/Google Drive/CodesSublime/CodeJam/b.cpp
UTF-8
498
2.671875
3
[]
no_license
#include <iostream> #include <string> using namespace std; int main() { int t; cin>>t; int j=0; while(t--) { j++; string x; cin>>x; int n=x.length(); int dp[n]; dp[0]=(x[0]=='-')?1:0; for(int i=1;i<n;i++) { if(x[i]=='+') { dp[i]=dp[i-1]; } else { int k; for(k=i-1;k>=0;k--...
true
7b961d3e5c44eaca3c3e04408b41daf598f8ae11
C++
vrichmon/6.179-Final-Project
/Ball.cpp
UTF-8
5,062
3
3
[]
no_license
#include <SDL.h> #include <SDL_image.h> #include <SDL2/SDL_mixer.h> #include <stdio.h> #include <string> #include <cmath> //good place to look for general help (how I got this far): http://lazyfoo.net/tutorials/SDL/index.php //Screen dimension constants (you can change) const int SCREEN_WIDTH = 600; const int SCREEN...
true
aa83a876baf8a775c8427dc41e4f6a2b2a1d7a59
C++
ztao-sd/robotics-prototype
/robot/demos/WatchDogInterrupt/WatchDogInterrupt.ino
UTF-8
1,378
2.78125
3
[]
no_license
int dogTimer = 0; unsigned long int previousMillis = 0; const int led = 13; bool ledState = LOW; void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); Serial.begin(9600); setDogTime(500); kickDog(); } void loop() { unsigned long int currentTime = millis(); while (true) { ...
true
4f915cb0ec4284556ad870e0183f858b3deb0912
C++
rahulgyawali/Algorithms
/Place/Graph/dijkstra.cpp
UTF-8
1,063
2.890625
3
[]
no_license
#include <bits/stdc++.h> using namespace std; int main() { int n; int e; int a; int b; int c; int i; int s; cin>>n; cin>>e; vector <pair<int,int> > g[n+1]; for(i = 0; i < e ; i++) { cin>>a>>b>>c; g[a].push_back(make_pair(c,b)); } s = 1; bool vis[n+1]; int dis[n+1]; int par[n+1]; for...
true
b65ebcd99c24d892a00ef85adae12958230233d5
C++
sahkashif/Sorting
/Assignment_4/BubbleSort.cpp
UTF-8
1,050
3.65625
4
[]
no_license
#include "BubbleSort.h" BubbleSort::BubbleSort() { } BubbleSort::~BubbleSort() { } void BubbleSort::swap(int & first, int & second) { int temp = first; first = second; second = temp; } void BubbleSort::bullble_sorter(int arr[], int size) { bool swaped = true; int tracker = 0; while (swaped) { swaped = f...
true
4e12e42e279d1e7673efa2ea94101a64a3bd02ef
C++
JakimPL/Roguelike
/src/item.hpp
UTF-8
3,030
2.8125
3
[]
no_license
#ifndef ITEM_HPP #define ITEM_HPP #include "structures.hpp" #include "color.hpp" #include "text.hpp" enum class Elementals : unsigned char { physical, magic, fire, ice, electricity, acid, missile, count }; enum class ItemType : unsigned char { miscellaneous, weapon, armor, helmet, gloves, cloak, boots...
true
4b99d81b98e8c3295562290b6b956fb4253bba62
C++
vbutzke/RaysManipulation
/HelloTriangle/Source.cpp
ISO-8859-1
6,716
2.703125
3
[]
no_license
#include <iostream> #include <string> #include <assert.h> #include <GL/glew.h> #include <GLFW/glfw3.h> #include <glm/glm.hpp> #include <vector> using namespace std; void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode); //ponto de interseco //sombra //interpolao const GLuint WIDTH = 80...
true
8e0a7436079c125d3f72b0fec910ea9c8c28acda
C++
breezy1812/MyCodes
/LeetCode/740-Delete and Earn/solution.cpp
UTF-8
516
2.640625
3
[]
no_license
class Solution { public: int deleteAndEarn(vector<int>& nums) { int gains[100002] = {0}; int max_num = 0; for(auto x: nums) { gains[x]++; max_num = max(max_num, x); } int ans = 0, dpm1 = 0, dpm2 = 0; for(int i = 1; i < 100001; i++) ...
true
ccb1b6177b1560d870bd8ad8ee0be3fd51f28998
C++
shoaibrain/cse1325--school-projects
/P08/Sprint4/section.cpp
UTF-8
624
2.9375
3
[ "MIT" ]
permissive
#include "section.h" #include "course.h" #include "semester.h" #include "subject.h" #include <iostream> Section::Section(Course course, Semester semester, int year ) : _course{course}, _semester{semester}, _year{year} {} /* Section::Section(std::istream& ist){ _course(ist); load_semester(i...
true
9f009f6fbd7b57396b5735274f19c21d8a9ebb24
C++
PaintPPJ/Programming-week-8
/Programming week 8/Source.cpp
UTF-8
1,085
2.578125
3
[]
no_license
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main() { int k, j; char x[10][5][5] = { { "xxxx", "x x", "x x", "x x", "xxxx" }, { " x", " x", " x", " x", " x" }, { "xxxx", " x", "xxxx", "x ", "xxxx" }, { "xxxx", " x", "xxxx...
true
8c8c38a36297ef81226000f3e3caf7f9c6c5eb02
C++
baatochan/FirstTryWithCpp
/gruz5/main.cpp
UTF-8
4,285
3.4375
3
[ "Unlicense" ]
permissive
#include <iostream> #include <string> #include <cstdlib> using namespace std; int ilosc_wierszy = 5; int ilosc_kolumn = 5; int tablica[5][5]; //ilosc elementow int zaladuj_tablice() { for (int i=0; i<ilosc_wierszy; i++) { for (int j=0; j<ilosc_kolumn; j++) { cout<<"Podaj "<<j+1<<" wyraz "<<i+...
true
e38e3bc3ea5eb44a11a9128ca2191d353f09b15d
C++
hdsmtiger/Solution4LeetCode
/Restore-IP-Addresses.cpp
UTF-8
1,500
2.96875
3
[]
no_license
class Solution { public: void findNextDigit(string s, int index, int numberPos, vector<string> &result, string oneSolution, int length) { if(index == length && numberPos == 4) { result.push_back(oneSolution); return; }else if(index == length || numberPos == 4) return; for(int i=1; i<=3 && i+ind...
true
b2b36b656ec8901ac2fbca025eebd5e7f70c3700
C++
JayParanjape/AI_Sem5
/A3/graph_solve2.cpp
UTF-8
5,001
2.953125
3
[]
no_license
#include <iostream> #include <fstream> #include <string> #include <unordered_map> #include <vector> #include<algorithm> using namespace std; int count_clauses=0; //number of clauses int count_vars=0; //number of variables vector<int> smaller_graph_nodes; //nodes in the smaller graph vector<int> bigger_graph_nodes; ...
true
198a48e7049297676479d5f9f891f10d577bc2a0
C++
Dragon9815/Ridge
/Engine/src/Ridge/Platform/OpenGL/GLVertexArray.cpp
UTF-8
835
2.59375
3
[]
no_license
#include "RidgePCH.h" #include "GLVertexArray.h" #include "GLUtil.h" namespace Ridge { namespace Graphics { GLVertexArray::GLVertexArray() { GLCall(glCreateVertexArrays(1, &m_id)); } GLVertexArray::~GLVertexArray() { GLCall(glDeleteVertexArrays(1, &m_id)); } Ridge::Graphics::VertexBuffer* GLVertexArray:...
true
5a8e13e9757cdd33b5cffd6ea27a94707eb4823f
C++
gnboorse/cpp-class-hmwk
/WA_5/WA5_exercise1.cpp
UTF-8
5,331
3.296875
3
[]
no_license
/* @author gabriel boorse Compiled using g++ on CentOS 7 Linux Use: g++ -std=c++0x WA5_exercise1.cpp -o WA5exercise1 ./WA5exercise1 ** Creates a list of random bank accounts (Savings or Checking) And then it iterates over those random accounts, performs operations based on which type they are And th...
true
c63a6051c937368a85daa343561fc7d63323f874
C++
KlgTurtle/TITM
/TcpClientSocket.cpp
UTF-8
1,506
2.984375
3
[]
no_license
#include "TcpClientSocket.h" #include <string> TcpClientSocket::TcpClientSocket(const std::string & TargetAddress, const std::string & TargetPort) : m_TargetAddress(TargetAddress), m_TargetPort(TargetPort) { } void TcpClientSocket::Connect() { struct addrinfo *result = NULL; struct addrinfo hints; Z...
true
9a542824fffeddc536657a76ea7097c44da3ca48
C++
WuyangPeng/Engine
/Engine/Code/Mathematics/Intersection/Intersection3D/DynamicTestIntersectorSegment3Triangle3Detail.h
GB18030
5,224
2.640625
3
[ "BSD-3-Clause" ]
permissive
/// Copyright (c) 2010-2023 /// Threading Core Render Engine /// /// ߣʶ /// ϵߣ94458936@qq.com /// /// ׼std:c++20 /// 汾0.9.0.12 (2023/06/09 09:23) #ifndef MATHEMATICS_INTERSECTION_DYNAMIC_TEST_INTERSECTOR_SEGMENT3_TRIANGLE3_DETAIL_H #define MATHEMATICS_INTERSECTION_DYNAMIC_TEST_INTERSECTOR_SEGMENT3_TRIANGLE3_DETAIL_H ...
true
adf8aa987ccfd713a466dea62582c1ec9e1518f4
C++
pkerspe/ESP-StepperMotor-Server
/src/ESPStepperMotorServer_PositionSwitch.h
UTF-8
2,725
2.6875
3
[ "MIT" ]
permissive
#ifndef ESPStepperMotorServer_PositionSwitch_h #define ESPStepperMotorServer_PositionSwitch_h #include <Arduino.h> #include <ArduinoJson.h> #include <ESPStepperMotorServer_Logger.h> #include <ESPStepperMotorServer_MacroAction.h> #define SWITCHTYPE_STATE_ACTIVE_HIGH_BIT 1 #define SWITCHTYPE_STATE_ACTIVE_LOW_BIT 2 #de...
true
b8891a4104141418a941bae46382d26d4c8eb9ea
C++
qcscine/swoose
/src/Swoose/Swoose/MolecularMechanics/Interactions/BondedTerm.h
UTF-8
1,639
2.640625
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
/** * @file * @copyright This code is licensed under the 3-clause BSD license.\n * Copyright ETH Zurich, Laboratory of Physical Chemistry, Reiher Group.\n * See LICENSE.txt for details. */ #ifndef MOLECULARMECHANICS_BONDEDTERM_H #define MOLECULARMECHANICS_BONDEDTERM_H #include "../Topology/...
true
5f1fd3bc64182f89dc92fc49edca2e9087534afa
C++
mh-cfd/ls_derivs
/leastsquaressolver.h
UTF-8
3,051
2.546875
3
[]
no_license
#ifndef LEASTSQUARESSOLVER_H #define LEASTSQUARESSOLVER_H #include <vector> //number of variables #define VAR_NUM 10 //maximum number of points #define MAX_EQNS 10000 typedef struct {double x ,y,z,f,ax,ay,az; int is_boundary; //if<0 than it's not the boundary oterwise it's boundary plane number double f_bound;//va...
true
f0fd6a182ebd893d9b84c468385beb0733a17eae
C++
Senth/bats
/BATS/code/BTHAIModule/Source/RefineryAgent.h
UTF-8
494
2.671875
3
[ "Apache-2.0" ]
permissive
#pragma once #include "StructureAgent.h" #include <vector> class WorkerAgent; /** The RefineryAgent handles Refinery buildings for all races. * * Implemented abilities: * - Makes sure each Refinery has 3 workers assigned to gather gas. * * @author Johan Hagelback (johan.hagelback@gmail.com) */ class RefineryAg...
true
ab0e30e3a8fd6244dce0dd7d3a1b1875342c8162
C++
Binyamin-Brion/L-System-Visualizer
/ModelLoading/Model.h
UTF-8
2,664
2.96875
3
[]
no_license
// // Created by BinyBrion on 11/21/2019. // #ifndef MINECRAFT_MODEL_H #define MINECRAFT_MODEL_H class aiNode; class aiScene; class aiMesh; #include <string> #include <vector> #include <QString> #include "Mesh.h" #include "Face.h" #include "mat4x4.hpp" namespace ModelLoading { /** * Loads a model from a ...
true
88d3cdf2c349da9df35469eef1510617b9ea279f
C++
Louis-tiany/Cpp_learn
/algorithm/data_struct/hash/longSANDiv.cpp
UTF-8
1,442
3.96875
4
[]
no_license
//Given an array of N non-negative integers, task is to find the maximum size of a subarray such that the pairwise sum of the elements of this subarray is not divisible by a given integer, K. Also, print this subarray as well. If there are two or more subarrays which follow the above stated condition, then print the fi...
true
789b4bbac105a1f3cedb2300c42f66c3d40cf761
C++
DesignPatternWorks/CSE-335-Qt
/Lectures/Lecture08 - Abstract Factory Pattern/C++AbstractFactorySorting/AbstractFactorySorting/main.cpp
UTF-8
941
2.96875
3
[ "MIT" ]
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. */ /* * File: main.cpp * Author: alexliu * * Created on January 26, 2017, 5:34 PM */ #include <cstdlib> #include <iostream> usin...
true
a1f38a7bd9c7b1224f677c6f8191451805ce6107
C++
keivanzavari/computer-science-basics
/graphs/graph_definitions.h
UTF-8
1,265
3.296875
3
[]
no_license
#pragma once #include <iostream> #include <map> #include <memory> #include <set> #include <string> #include <unordered_map> #include <vector> #include "../include/ostream_overload.h" #include "linked_list.h" template <typename T> using Edges = std::set<T>; template <typename T> using AdjList = std::unordered_map<T,...
true
f7f234b9cfbe97362d4cae7effab62c74c5f59a8
C++
bamboo-hust/icpc-trainings
/mipt-nus-19/day6/h.cpp
UTF-8
1,108
2.515625
3
[]
no_license
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; long long f2[N]; long long f3[N]; long long sz[N]; int n; vector<int> a[N]; void dfs1(int u, int p) { sz[u] = 1; for (int v : a[u]) if (v != p) { dfs1(v, u); sz[u] += sz[v]; } } void dfs2(int u, int p) { long long ...
true
8f9c02df0dd332ecb8a15a81438e4518b959d6c8
C++
nshokri/Movie-Rental-Project
/classics.cpp
UTF-8
1,417
3.484375
3
[]
no_license
#include "classics.h" Classics::Classics(char type, int stock, string director, string title, string majorActor, int releaseMonth, int releaseYear) : Movie(type, stock, director, title, releaseYear) { this->majorActor = majorActor; this->releaseMonth = releaseMonth; this->releaseYear = releaseYear; } Classics::~C...
true
010693f2bb9f423d1e2d26088230827bc37d98d3
C++
YBTayeb/Cpp
/CodesSource/exo141.cpp
UTF-8
520
3.171875
3
[]
no_license
#include <iostream> using namespace std ; main() { void f() ; try { f() ; } catch (int n) { cout << "except int dans main : " << n << "\n" ; } catch (...) { cout << "exception autre que int dans main \n" ; } cout << "fin main\n" ; } void f() { try { int n=1 ; throw n ; } catch (int n) { c...
true
a49bc834e6799a76e64c5efdd9b366350e31ab07
C++
InvincibleSarthak/Competitive-Programming
/STL/BinarySearch.cpp
UTF-8
756
3.703125
4
[]
no_license
//Binary Search (in-built function), Lower Bound, Upper Bound #include<iostream> #include<bits/stdc++.h> using namespace std; int main(){ int arr[]={10,20,30,40,40,40,50,70}; int n = sizeof(arr)/sizeof(int); int key; cin>>key; bool present = binary_search(arr,arr+n,key); if(present){ co...
true
2837bd51f0cfbd012d3f7af68d198e31fc8ec88f
C++
jayantsa/AlgorithmicCoding
/gfg/sortinstl.cpp
UTF-8
369
2.984375
3
[]
no_license
#include<iostream> #include<algorithm> #include<vector> using namespace std; int comp(int a,int b) { return a>b; } int main() { vector<int> arr={5,1,3,20,0,7,-1}; for(int i=0;i<arr.size();i++) cout<<arr[i]<<" "; cout<<"\n"; sort(arr.begin(),arr.end(),comp); for(int i=0;i<arr.size();i++...
true
10c243bb48481ac5919a55f7e20a2ee11557a12c
C++
bhsphd/cpplects-beamer
/codes/chap05/0XShapeClass/Point2D.h
UTF-8
953
3.09375
3
[]
no_license
#ifndef POINT2D_H_INCLUDED #define POINT2D_H_INCLUDED #include <iostream> #include <cmath> using namespace std; #if !defined(M_PI) #define M_PI 3.1415926535897932384626433832795 #endif class CPoint2D { float x, y; public: CPoint2D() { x = y = 0; } CPoint2D(float x,...
true
5e7fa7524199610d93c2d330ab3d0735fb55f761
C++
YueJi95/LeetCode
/339. Nested List Weight Sum.cpp
UTF-8
1,616
3.421875
3
[]
no_license
/** * // This is the interface that allows for creating nested lists. * // You should not implement it, or speculate about its implementation * class NestedInteger { * public: * // Return true if this NestedInteger holds a single integer, rather than a nested list. * bool isInteger() const; * * //...
true
c78029b97f3b329f822f35f21a7c590c54233f11
C++
songxiaopeng/Ray-Tracing-in-One-Weekend
/ch00&01/Main.cpp
GB18030
1,290
2.875
3
[]
no_license
//************************************* // book1(RT in 1 weekend) ch0&1 // ԭ飬¹ܣ // *(ch00&01)Ϊpngʽ // *(ch00&01)Ⱦ //************************************* // from https://github.com/nothings/stb.git #define STB_IMAGE_IMPLEMENTATION #include "stb_image.h" #define STB_IMAGE_WRITE_IMPLEMENTATION #include "stb_image_write...
true
d61e66365db06a766ed9e89307158b15981a0fe7
C++
vgromov/esfwx
/escore/EsSyncObjects.win.cxx
UTF-8
4,897
2.8125
3
[]
no_license
// Mutex // EsMutex::EsMutex(EsMutex::Type type /*= typeDefault*/) : m_type(type), m_owningThreadId(0), m_mx(0) { m_mx = ::CreateMutex( 0, // default secutiry attributes FALSE, // not initially locked 0 // no name ); if(...
true
e5170554d3777e058d40a18fc0b0022db6f2549d
C++
sdegtiarev/mtsp
/t7.cc
UTF-8
459
2.828125
3
[]
no_license
#include <iostream> #include <thread> #include "alt.h" auto data=alt::shared_ptr<int>(0); void read_data() { for(;;) auto sp=data; } int main() { alt::shared_ptr<int> p(1); std::cout<<*p<<std::endl; auto q=p; ++*q; std::cout<<*p<<std::endl; auto r=std::move(q); ++*r; std::cout<<*p<<std::endl; p=alt::s...
true
7db97a7ef371e0bc1e51ca4b8b82e02776642305
C++
PCBob/MPF
/src/MPF.Platform/Media/FontFamily.cpp
UTF-8
2,158
2.515625
3
[]
no_license
// // MPF Platform // Font Family // 作者:SunnyCase // 创建时间:2016-08-09 // #include "stdafx.h" #include "FontFamily.h" using namespace WRL; HRESULT __stdcall GetSystemFontFaceLocation(BSTR faceName, BSTR* location) noexcept { try { static const LPWSTR fontRegistryPath = L"Software\\Microsoft\\Windows NT\\CurrentVers...
true
63734a7e545979b2a7a927b13a4895046f6523be
C++
google-code/afti-2013-oop-nsu
/Kutlimetov/scrambler_1/scrambler_1/Scrambler.h
WINDOWS-1251
908
3.46875
3
[]
no_license
#pragma once #include <vector> template <class T> class Scrambler { public: Scrambler(const int onesNumber); void ScrambleData(const T & data, T & outdata) const; //const , " " - , , . int oneNumber; }; template <class T> Scrambler<T>::Scrambler(const int onesNumber) { oneNumber = one...
true
d58fbc5090a15252fa520b5166a0bbc48b46cd9e
C++
EvanSpeciale/cs162_battle_sim
/Menu.cpp
UTF-8
9,470
3.546875
4
[]
no_license
/****************************************************************************** ** Name: Evan Speciale ** Date: July 30, 2019 ** Description: Character class implementation ******************************************************************************/ #include "Menu.hpp" #include "Character.hpp" #include "Vam...
true
4c1cf39daa4a839809d7e7864523cfd1595c758e
C++
AltSysrq/Abendstern
/src/net/windows_firewall_opener.hxx
UTF-8
1,364
2.90625
3
[ "BSD-2-Clause" ]
permissive
#ifndef WINDOWS_FIREWALL_OPENER_HXX_ #define WINDOWS_FIREWALL_OPENER_HXX_ /** * @file * @author Jason Lingle * @date 2012.04.18 * @brief Provides the WindowsFirewallOpener class */ class Antenna; /** * Sends packets to open the Windows firewall. * * Normally, Abendstern would require a Windows firewall excep...
true
2e2943b1b31a975fa0ae148b4db60ddcadc9d251
C++
nicksya/XLFileSorter
/Indexer/Utils.cpp
UTF-8
1,003
2.8125
3
[]
no_license
// // indexer.cpp // Indexer // // Created by Mykyta on 29.04.17. // Copyright © 2017 Mykyta Khomenko. All rights reserved. // #include "Utils.hpp" using namespace std; void tryFile(std::fstream& stream, std::string& path, std::ios_base::openmode mode) { stream.open(path, mode); if (!stream.is_open()){ ...
true
676f308032a2b586fcb4275a18327adb276b53d4
C++
bsumirak/AoC
/AoC2022/day08.h
UTF-8
1,148
3.125
3
[]
no_license
/* * day08.h * * Created on: 2022-12-08 * Author: mbreit */ template <> void executeDay<8>(const std::string& fn) { // read input std::vector<char> v; { std::ifstream infile(fn.c_str()); char c; while (infile >> c) v.push_back(c); infile.close(); } const std::size_t sz = v.size(); unsign...
true
54523103655e41d676050fd39796956f754951b6
C++
JustBeYou/infoarena
/codeforces/agm20_computer_error.cpp
UTF-8
4,192
2.6875
3
[]
no_license
#include <bits/stdc++.h> using namespace std; typedef unsigned int uint; struct cond { char op; int num; bool real; bool operator< (const cond& rhs) const { return num < rhs.num; } bool operator== (const cond& rhs) const { return num == rhs.num; } }; vector<cond> normal...
true
47f98df3c052eb894e3a6e2bae44e05b26a4c46d
C++
CmdrFop/Practical2
/GroupsBuilder.hpp
UTF-8
481
2.59375
3
[]
no_license
#pragma once #include <iostream> #include <vector> #include <tuple> #include "Group.hpp" #include <map> using namespace std; class GroupsBuilder { public: void create_groups(int number_of_products, int number_of_dividers, vector<int> all_costs); int round(int cost); tuple<int, vector<string>, int, string, int, str...
true
d8c565342d81156328dbfcf21a7bcb61472f7e49
C++
Trinhnt3027/Utility
/Utility/src/Logger/Logger.cpp
UTF-8
6,285
2.625
3
[]
no_license
#include <iostream> #include <map> #include <sstream> #include <algorithm> #include <mutex> #include <fstream> #include <boost/filesystem.hpp> #ifdef _WIN32 #else #include <unistd.h> #include <sys/syscall.h> #endif #include "Logger/Logger.h" #include "TimeHelper/TimeHelper.h" using namespace Utility::Logger; using...
true
0403ff24e89a155a2941ab274c98abd32022edac
C++
96189/xteam
/算法/leetcode/989.数组形式的整数加法.cpp
UTF-8
1,702
3.328125
3
[]
no_license
/* * @lc app=leetcode.cn id=989 lang=cpp * * [989] 数组形式的整数加法 */ class Solution { public: vector<int> addToArrayForm(vector<int>& A, int K) { // 转换K为数组形式 vector<int> KA; while (K) { KA.push_back(K % 10); K /= 10; } int lenA = A.size(); ...
true
d5cad151b2a8ddb0a1ba1e899c2ab21dfc1de054
C++
aavegmit/Visual-Cryptography
/stream.cc
UTF-8
2,181
3.234375
3
[]
no_license
#include <stdio.h> #include <iostream> #include "stream.h" #include <sys/types.h> #include <openssl/md5.h> #include <stdlib.h> #include <string.h> using namespace std ; /* Constructor definition * Takes in pphrase and len as arguments. * The generated stream is saved in the private buffer */ Stream::Stream(char *p...
true
9990daa7d3cd631c4592a2855f19a2718664f562
C++
Gupta-Aniket/codeforces
/800/59A.cpp
UTF-8
764
3.15625
3
[]
no_license
// https://codeforces.com/problemset/problem/59/A #include <iostream> #include <vector> #include <algorithm> #include <string> #include <cmath> #include <iterator> #include <map> using namespace std; int main() { // your code goes here int upper = 0, lower = 0; string s; cin >> s; int n = s...
true
8cb501eb8ad4b03352e71a1e79c9448906e54314
C++
napylov/libeventloop
/test/src/test_fd_factory.cpp
UTF-8
1,292
3.015625
3
[]
no_license
#include <unistd.h> #include <sys/signalfd.h> #include "test_fd_factory.h" #include "eventloop/fd_factory.h" bool test_fd_factory::test_create_signal_fd() { std::array<int, 2> sig_arr{ SIGUSR1, SIGUSR2 }; int fd = eventloop::fd_factory::create_signal_fd( sig_arr ); if ( fd < 0 ) { std::cout <<...
true
9c4ae8bd9065b62b81ff142a8f38ea683b1ca548
C++
franciscoSoler/nebla
/distribuidos/EjGrupal_Robot5/src/IPC/SharedMemory/EstadoRobot11SharedMemory.cpp
UTF-8
543
2.578125
3
[]
no_license
#include "EstadoRobot11SharedMemory.h" //----------------------------------------------------------------------------- size_t EstadoRobot11SharedMemory::getMemorySize() { return sizeof(bool); } //----------------------------------------------------------------------------- bool *EstadoRobot11SharedMemory::readInfo (...
true
512cc4ab3e8d28fb40c252053c9c4ce5a3be1c6e
C++
King-01/AlgorithmsLab
/bstimplementation.cpp
UTF-8
5,071
3.703125
4
[]
no_license
#include<bits/stdc++.h> using namespace std; struct node{ int val; node *left, *right; node(int a) { val = a; left = NULL; right = NULL; } }; class BST{ private: node* head; public: BST() { head = NULL; } void assigner(int val, int i) { if(i == 1)insert(val); else if(i == 2){ int presence = ...
true
0922afd35c340b63f72bc11b8824cf9bcd441754
C++
Nillouise/Algorithm
/Algorithm/CF/Codeforces Round #435/C. Mahmoud and Ehab and the xor.cpp
UTF-8
1,707
2.78125
3
[]
no_license
//这是错的 #include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; int a[100000 + 5]; int one[100000 + 5]; int dfs(int b, int e, int curbit, vector<int> arr, int inverse) { if (curbit >= arr.size())return 0; if (b == e)return 0; //if (b == e - 1)return 0; 错的 if (inverse == 0) ...
true
c0a5fb6898e45cec9d1d44944b13fda75b286120
C++
Adityagithub24/data-structures
/heap sort.cpp
UTF-8
926
3.46875
3
[]
no_license
#include<iostream> using namespace std; int traverse(int a[],int n) { cout<<"resultant array"<<endl; for(int i=0;i<n;i++) { cout<<a[i]<<endl; } } int swap(int &x,int &y) { int t; t=x; x=y; y=t; } int heapify(int i,int a[],int n,int &hss) { int max,l,r; max=i; l=2*i+1; r=2*i+2; i...
true
de85dd0fb05d32c3d073a5bfcf4147e8f6dc9d21
C++
Entroyp/Option_Prices
/payoff.h
UTF-8
708
2.75
3
[]
no_license
#ifndef PAYOFF_H #define PAYOFF_H #include<string> class PayOff{ public: PayOff(); virtual ~PayOff(){}; virtual double operator() (const double& s ) const = 0; virtual std::string gettype() const = 0; }; class PayOffCall : public PayOff { private: double K; char Type; public: PayOffCa...
true
9c2d76f322814a7095ece79de2b1a35e0cf65a01
C++
Dvuglaf/cpp_labs
/lab-9-qt/application/Snake.h
WINDOWS-1251
4,699
2.609375
3
[]
no_license
#pragma once #include <QWidget> #include <QTimer> #include "Fruit.h" #include <QSize> #include <QVector> #include <QKeyEvent> #include "Settings.h" #include <random> #include <QPainter> /** * . */ class Snake : public QWidget { Q_OBJECT public: static const qint64 _DOT_SIZE = 24; /**< ....
true
a582b9a5bc721ea98b9d2910068b9b42dacdce8a
C++
akash-eth/CPP
/Advanced Functions/sumOfNNaturalNumbers.cpp
UTF-8
197
3.109375
3
[]
no_license
#include<iostream> using namespace std; int sum(int num) { int naturalSum = num*(num+1)/2; return naturalSum; } int main() { int n; cin >> n; cout << sum(n); return 0; }
true
a0299581b138e8d61ddc4b227aacca07ff3b2845
C++
kretzmoritz/syl_net
/src/syl_net/net/connection.cpp
UTF-8
358
2.828125
3
[]
no_license
#include "connection.h" namespace SylNet { Connection::Connection() { } Connection::Connection(sf::IpAddress _address, unsigned short _port) : address(_address), port(_port) { } bool Connection::operator<(Connection const& _other) const { if (port == _other.port) { return address < _other.address; ...
true
70cb7893c77f486b424334b2b700f5adabb60b56
C++
yechang1897/algorithm
/Array/leetcode_867.cpp
UTF-8
644
3.53125
4
[]
no_license
#include<iostream> #include<algorithm> #include<vector> using namespace std; vector<vector<int>> transpose(vector<vector<int>>& A) { vector<vector<int>> res; int x = A[0].size(); int y = A.size(); for (int i = 0; i < x; i++) { vector<int> temp; for (int j = 0; j < y; j++) { ...
true
498e895df247557e05bf088ad712611b71dc1f5f
C++
hasibulhasan763/Advance-C-Programming
/C/Printing Fibonaci Series.cpp
UTF-8
219
2.703125
3
[]
no_license
#include<stdio.h> int main () { int i,n,a=0,b=1,next; printf("Enter a number: "); scanf("%d",&n); for(i=0; i<=n; i++) { printf("%d\n",a); next=a+b; a=b; b=next; } return 0; }
true
830b7aa2702da9ae825461887fd4cdad89e4fe4f
C++
martiansideofthemoon/CS-213
/Assignment 2/Q2/helper.cpp
UTF-8
738
2.953125
3
[]
no_license
#include <iostream> #include "queue_list.cpp" using namespace std; int main() { queue_list<float> ab; float abc = 0; ab.push_back(6); ab.front(&abc); cout << abc << " "; ab.push_back(4); ab.front(&abc); cout << abc << " "; ab.push_back(7); ab.front(&abc); cout << abc << " "; ab.push_back(8.4); ab.front(&a...
true
c2b4a6a599ce37177b30154854adad4cc4338a48
C++
iandownie07/Air-Conditioning-Control
/Commented Air-Conditioning Control/Embedded system/Main.cpp
UTF-8
2,911
2.734375
3
[]
no_license
// // Main.cpp // main for air-conditioning control implemented in Raspberry Pi Pico with Arm M0+ processor // // Created by Ian Downie on 13/03/21. // #include "AirCon.cpp" #include "States.cpp" #include "AirConState.cpp" #include <iostream> #include "pico/stdlib.h" #include "hardware/uart.h" #include "hardware/ir...
true
656b5fd3c0aeb0144304480e1bb48693d8aaf8a9
C++
herbstluftwm/herbstluftwm
/src/namedhook.h
UTF-8
2,047
2.75
3
[ "BSD-2-Clause" ]
permissive
#ifndef __HLWM_NAMED_HOOK_H_ #define __HLWM_NAMED_HOOK_H_ #ifdef ENABLE_NAMED_HOOK #include "attribute_.h" #include "hook.h" #include "object.h" class NamedHook : public Object, public Hook { public: NamedHook(const std::string &path); void hook_into(Object* root); Type type() { return Type::HOOK; } ...
true
2225140175f11b98deec0e0f3889b2df0db6120b
C++
marcogmaia/radl
/radl/fov.hpp
UTF-8
632
2.84375
3
[]
no_license
#pragma once #include "permissive-fov/permissive-fov.hpp" namespace radl { class IFov { public: virtual ~IFov() = default; /** * @brief check if @p location is blocked * * @param x in the map * @param y in the map * * @return true if can't see through, false otherwise */ ...
true
6c8cd22d8418d5d23b56dfcb20bac3f8c5aa9094
C++
abdulrcs/CP
/TLX/courses/Pemrograman Dasar/05 Percabangan/If_Then_Case.cpp
UTF-8
278
2.671875
3
[]
no_license
#include <cstdio> int x; int main(void) { scanf("%i", &x); if(x/10000 > 0) printf("puluhribuan\n"); else if(x/1000 > 0) printf("ribuan\n"); else if(x/100 > 0) printf("ratusan\n"); else if(x/10 > 0) printf("puluhan\n"); else printf("satuan\n"); }
true
f306bb8d0d2988e022ccb66c627bbdb4f6b2a847
C++
denizumuteser/CS_300
/HW 1/denizumut_eser_denizumut_hw1_Stack.h
UTF-8
1,005
3.5
4
[]
no_license
#pragma once #include <iostream> using namespace std; struct Underflow : public exception { const char* what () const throw () { return "Exception: trying to access element of empty Stack."; } }; template<class Object> class Stack { public: Stack(); Stack(const Stack & rhs); ~Stack(); //utility functions b...
true
26873840fe9d71e452bd703e77cad89715c0b66d
C++
JHEBentley/FYP
/RobotArduino/ParseDelimitedMessage/ParseDelimitedMessage.ino
UTF-8
1,992
3.15625
3
[]
no_license
/* * Reads the serial feed and parses ints, then writes this in as the servo motor position. * Does this for a string of values with "," delimiters. * Can be used in conjunction with the Arduino comms script in Unity. */ #include <Servo.h>; //Servo stuff Servo servos[6]; int data[] = {90,90,90,90,90,90}; int oldD...
true
34b8353c4fa3fb5c1ae5d887f6498c381bbb269f
C++
TartanLlama/cpp-con
/cpp-con/cpp-con.cpp
UTF-8
1,059
2.671875
3
[]
no_license
// cpp-con.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include <iostream> #include <ranges> #include <tl/generator.hpp> #include "xorshift.hpp" int main() { auto random_numbers = cppcon::xorshift(4) | std::views::take(4) | std::views::transform([](aut...
true
3825a7068fd0ab0a3886af9f79acb241a73a0107
C++
gitqwerty777/Online-Judge-Code
/categorized/[Not Solved] 11149.cpp
UTF-8
998
2.65625
3
[]
no_license
#include <stdio.h> #include <string.h> #include "matrix.h" /* hint: A+A^2+...+A^(2n) = (A+A^2+...+A^n) + A^n (A+A^2+...+A^n) */ int main(){ int N, P; while(scanf("%d %d", &N, &P) == 2 && N + P){ matrix arr(N, N); matrix sum(N, N); for(int r = 0; r < N; r++) for(int c = 0; c < N; c++){ scanf...
true
fa996461afdc8f7c14340f3f96ec3473cecae4f4
C++
onww1/Problem-Solving
/LeetCode/Medium/lc986.cpp
UTF-8
4,822
3.6875
4
[]
no_license
#include <algorithm> #include <functional> #include <vector> #include <cstdio> #include <string> #include <cassert> #include <queue> #include <unordered_map> #include <unordered_set> using namespace std; struct ListNode { int val; ListNode* next; ListNode() : val(0), next(nullptr) {} ListNode(int x) : ...
true
483a544071c9f4876eaa88cc32e1ea3569f6c190
C++
PugnaHAN/C-Primer
/DesignPatterns/Structor/Structor/TimeImp.h
UTF-8
1,075
3.390625
3
[]
no_license
#pragma once #ifndef __TIMEIMP_H__ #define __TIMEIMP_H__ #include "common.h" class TimeImp { public: TimeImp() = default; TimeImp(int hr, int min) : hour(hr), minute(min) {} virtual void tell() { std::cout << "time is " << std::setw(2) << std::setfill('0') << hour << ":" << minute << std::endl; } prote...
true
e6b45c768b98b9ebc83d39fab15a23a4d06701e9
C++
hughzeng/llrbt
/test_llrbt.cpp
UTF-8
2,253
2.75
3
[ "MIT" ]
permissive
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <ctime> #include <map> #include <random> #include <functional> #include "llrbt.hpp" int main() { std::default_random_engine rand_engine; std::uniform_int_distribution<int> rand_range(0, 1e9); auto rand_gen ...
true
bd512ae7e6d06599d805b3c9df3dd03da8649deb
C++
fraser-campbell/CS106B
/Assignment_4/Fill a Region/Fillregion.cpp
UTF-8
2,617
3.734375
4
[]
no_license
/* * File: Fillregion.cpp * -------------------------- * Name: Fraser Campbell * Section: Write a function to fill a region in C++ */ // #include <map> #include <string> #include <vector> #include <iostream> // #include "grid.h" // #include <set> using namespace std; enum pixelStateT { White, Black }; struct poi...
true
aab6d4e5aec197d4954361fff1ce3796aeed97e1
C++
ChimesZ/THU-PUMC-Courses-Project
/Grade 1 Spring/程序设计基础(hwt)/3.2/2020040043_2020.3.2_1.cpp
GB18030
494
2.796875
3
[]
no_license
#include "stdio.h" int main() {float a,b,c,d,result1,result2,result; printf("ĸͬʵÿո\n"); scanf("%f%f%f%f",&a,&b,&c,&d); if((a==0)&&(b==0)&&(c==0)&&(d==0)) {} else {if((a>=-1e6)&&(a<=1e6)&&(b>=-1e6)&&(b<=1e6)&&(c>=-1e6)&&(c<=1e6)&&(d>=-1e6)&&(d<=1e6)) {result1=a>=b? a:b; result2=c>=d? c:d; result...
true
ce47388a0ce2f688827dd31929d3dbe578cfaf94
C++
dclcs/AutoSittingPoseGenerate
/SourceCode/ReshapeCode/Reshape/HumanSegmentation/HumanSegmentation/Voxel.cpp
UTF-8
10,945
2.765625
3
[]
no_license
// Voxel #include "Voxel.h" #include "Mesh.h" namespace ManSeg { // constructor VoxelHandler::VoxelHandler(Mesh* in_mesh, float voxel_size) : mesh(in_mesh) { voxels_init(voxel_size); find_boundary_voxel(); find_outside_voxel(); find_inside_voxel(); } VoxelHandler::VoxelHandler(Mesh* in_mesh, float voxel_s...
true
2620fd6e8892cf1838bdbe5a3fd6e9198680a8ca
C++
annavedenin/Crime-Prediction-Using-Hidden-Markov-Model
/HmmDll code/hmm.h
UTF-8
1,369
2.828125
3
[]
no_license
/*********************************************************************************************/ // Name: hmm.h // // class of the Hidden Markov Model structur // /*********************************************************************************************/ #pragma once #include <iostream> #include <fstream> ...
true
f5258751943bd6a87948d9d29143892c027ffa82
C++
WubiCookie/cdm
/tests/matrix3.cpp
UTF-8
22,081
2.90625
3
[]
no_license
#define CATCH_CONFIG_MAIN #include <catch2/catch.hpp> #include <common.hpp> TEST_CASE("matrix3::matrix3(std::array<float, 9>)", "[working][unittest][matrix3]") { const std::array<float, 9> a{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}; matrix3 m1 = matrix3(a); RE...
true
630b7f3ebc2187aeaea41316ef3680db347da5d1
C++
cdriveraus/OpenMx
/src/finiteDifferences.h
UTF-8
1,052
2.625
3
[ "Apache-2.0" ]
permissive
#ifndef _finiteDifferences_H_ #define _finiteDifferences_H_ template <typename T1, typename T2, typename T3> void fd_gradient(T1 ff, Eigen::MatrixBase<T2> &point, Eigen::MatrixBase<T3> &gradOut) { const double refFit = ff(point); // maybe could avoid this? TODO const double eps = 1e-5; Eigen::VectorXd p2;...
true
f7fdcfca8feeff4270707e8d78734c2d7459f115
C++
ColinShaw/cpp-pid-controller-driving-project
/src/PID.cpp
UTF-8
650
2.828125
3
[]
no_license
#include "PID.h" PID::PID(double Kp_in, double Ki_in, double Kd_in) { // Initial coefficients Kp = Kp_in; Ki = Ki_in; Kd = Kd_in; // PID Error terms p_error = 0.0; i_error = 0.0; d_error = 0.0; // Last sample error and total error last_error = 0.0; total_error = 0.0; } PID::~PID() {} double...
true
06466c78a5db9d771658f46ac2af79422a22bd46
C++
RENHaowen/Vanet
/geologic-core/include/geologic-core/objects/geo/untemporal/MeshGrid.h
UTF-8
1,330
2.9375
3
[]
no_license
/** * \file MeshGrid.h */ #ifndef MeshGrid_H #define MeshGrid_H #include "ogr_geometry.h" #include <unordered_map> template <typename T> class MeshGrid { public: //*/ ------------------------------------------------- using Position = std::pair<int, int>; std::unordered_map<Position, T...
true
7db01d7cf9795339698a3f565213ed1c84cab5da
C++
luni64/TeensyStep
/examples/Applications/Winder/Winder.h
UTF-8
1,188
2.84375
3
[ "MIT" ]
permissive
#pragma once #include "TeensyStep.h" class Winder { public: Winder(Stepper &spindle, Stepper &feeder); void begin(); Winder &setSpindleParams(unsigned stpPerRev, unsigned acceleration); // steps per spindle revolution & acceleration in stp/s^2 Winder &setFeederParams(unsigned stpPerMM, unsigned ac...
true
006d97a01da9a73d8794b015e4d0f6d9400f0df5
C++
Mohit21/Questions
/AmazonNumberofoccurrences.cpp
UTF-8
1,286
3.03125
3
[]
no_license
#include<bits/stdc++.h> using namespace std; int start(int A[],int beg,int end1,int x,int N){ if(end1>=beg){ int mid=(beg+end1)/2; if((mid==0 || A[mid]==x) && A[mid-1]<x){ //cout<<"h1"<<mid<<endl; return mid; } else if(A[mid]<x){ //cout<<"h2"; ...
true
6165429f303a45289b1d8b825bd54feda3335d21
C++
jinsenglin/cplusplus
/10.bst/main.cpp
UTF-8
7,345
3.953125
4
[]
no_license
#include<iostream> #include<cstring> using namespace std; class Pair { friend class Tree; friend class BST; public: Pair(int key, int element) { first = key; second = element; } ~Pair() {} string ToString() { return to_strin...
true
8516759edbafa0d827a3a2c32d0fa0cfc1e5ce61
C++
harshvasoya008/Cpp_Templates
/splitString.cpp
UTF-8
263
3.125
3
[]
no_license
vector<string> split(const string& s, const char& c){ string buff(""); vector<string> v; for(auto ch: s){ if(ch != c) buff += ch; else if(ch == c && buff != "") { v.push_back(buff); buff = ""; } } if(buff != "") v.push_back(buff); return v; }
true
fd1213b55023f4113f39517e542aa969df4af4bf
C++
95ankitmishra/Program-data_structure
/C-my-code-master/52.cpp
UTF-8
1,131
3.484375
3
[]
no_license
#include<process.h> #include<malloc.h> #include<stdio.h> #include<stdlib.h> int start,no,choice,item; struct stack { //int no; struct stack *next; } *top=NULL; typedef struct stack st; void push(); void pop(); void display(); int main() { char ch; //int choice,item; do { printf("\n1: push");...
true
b782af90200aacade61f8e1fbf6d1e1130a81e9a
C++
zhangj1024/QtWebrtc
/WebrtcLogic/HttpAPI/ServerHelper.cpp
UTF-8
1,269
2.515625
3
[]
no_license
#include "StdAfx.h" #include "ServerHelper.h" QString ServerHelper::s_serverUrl = ""; ServerHelper::ServerHelper(const QString& url, const QByteArray& content, http_callback const& receiver, QString &contenttype) { m_url = url; m_content = content; m_receiver = receiver; m_contenttype = contenttype; } ...
true
8d191b33cf164e5b829b0c1aa63813ef9bfed55c
C++
TTLIUJJ/acker_redis
/sds.cpp
UTF-8
2,216
2.765625
3
[]
no_license
#pragma once #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <assert.h> #include "sds.h" #include "zmalloc.h" sds sdsNewlen(const void *init, size_t len) { struct sdshdr *sh; if (init) { sh = (struct sdshdr *)zmalloc(sizeof(struct sdshdr) + len + 1); } else...
true