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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d0b644aa5df6988880463cd679d747f4846bf195 | C++ | phillipthomasjamessteiner/MPU-6050-Library | /MPU_6050_Wire.h | UTF-8 | 1,125 | 2.6875 | 3 | [
"MIT"
] | permissive | // Library for MPU-6050 6 axis Accel/Gryo/Temp
#ifndef MPU_6050_Wire_h
#define MPU_6050_Wire_h
#define ACCELX_REG 59
#define ACCELY_REG 61
#define ACCELZ_REG 63
#define GYROX_REG 67
#define GYROY_REG 69
#define GYROZ_REG 71
#define TEMP_REG 65
#define ACCEL_CONFIG_REG 28
#define GYRO_CONFIG_REG 27
class MPU_6050_W... | true |
fe43b7a18e539a35bbd866572371a99a7f7959a7 | C++ | uspgamedev/ugdk | /modules/ugdk-core/src/math/integer2D.cc | UTF-8 | 5,058 | 3.0625 | 3 | [
"Zlib"
] | permissive |
#include <ugdk/math/integer2D.h>
#include <cmath>
#include <algorithm>
#include <assert.h>
#include <ugdk/math/vector2D.h>
#define SWAPVARS(temp,var1,var2) temp = var1; var1 = var2; var2 = temp
using namespace ugdk::enums;
using mirroraxis::MirrorAxis;
namespace ugdk {
namespace math {
static int absolute_value(i... | true |
053176fdd81a8e2945361934ec3030e5cf9ec5d3 | C++ | Maruf089/Competitive-Programming | /Greedy_Algorithm.cpp | UTF-8 | 1,831 | 3.328125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
/// input number of Task
int Total_task = 5 ;
int Total_robot_number = 5 ;
/// create cost matrix for every task
int cost_for_task_1[] = {10,7,12,15,8};
int cost_for_task_2[] = {9,7,5,2,8};
int cost_for_task_3[] = {5,7... | true |
faf90bd92ad68321351d452c9b68ebe13e3725b6 | C++ | c3e/GLaDOS_Receiver | /GLaDOSServoControl.cpp | UTF-8 | 6,273 | 2.609375 | 3 | [] | no_license | #if defined(ARDUINO) && ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#endif
#include <Servo.h>
#include "GLaDOSServoControl.h"
GLaDOSServoControl::GLaDOSServoControl(Servo newServo, uint16_t startPos, uint16_t rangeMin, uint16_t rangeMax)
{
_thisServo = newServo;
_rangeMin = 650;
_rangeMax = 2400... | true |
51a734391106a4ead20340878269eb985fd56935 | C++ | shelmets/unix_tasks | /unix_task6/app.cpp | UTF-8 | 1,562 | 2.703125 | 3 | [] | no_license | #include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <pthread.h>
#include <unistd.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <math.h>
bool file_exist(char *filename){
struct stat buffer;
return (stat (file... | true |
637707aa0e461d5ea3afb058ac741ddf965e1d33 | C++ | tainzhi/acm | /leetcode-cn/566.cc | UTF-8 | 628 | 2.6875 | 3 | [] | no_license | class Solution {
public:
vector<vector<int>> matrixReshape(vector<vector<int>>& nums, int r, int c) {
if (nums.size() == 0 && r * c != 0) return nums;
if (nums.size() * nums[0].size() != r * c) return nums;
vector<vector<int>> result(r, vector<int>(c));
int oi = 0, oj = 0;
fo... | true |
50a23ddd0664be4df6273942c6b548622a72ecb4 | C++ | gorobot/symmath | /test/numerics/test_complex.cc | UTF-8 | 2,281 | 3.265625 | 3 | [] | no_license | #include <catch2/catch.hpp>
#include <complex>
#include <symmath/numerics/complex.hpp>
#include <symmath/type_traits/is_element_of.hpp>
#include <symmath/type_traits/is_field.hpp>
#include <symmath/type_traits/is_scalar.hpp>
using namespace std::complex_literals;
TEST_CASE("Complex: properties", "[numerics]") {
... | true |
448f9187fff8d6750be7562db6917c83f0adcedc | C++ | acerNZ/HAL | /HAL/IMU/Drivers/Phidgets/PhidgetsDriver.cpp | UTF-8 | 5,792 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | #include "PhidgetsDriver.h"
#include <sys/time.h>
#include <HAL/Utils/TicToc.h>
namespace hal {
//callback that will run if the Spatial is attached to the computer
int CCONV AttachHandler(CPhidgetHandle spatial, void *userptr)
{
((PhidgetsDriver *)userptr)->_AttachHandler(spatial);
return 0;
}
//callback that ... | true |
4f82c42979f81e0d5ffc57f942ebf206f33e84c8 | C++ | ArturKnopik/Game | /Learn_Game/Arkanoid_Level.cpp | UTF-8 | 706 | 2.640625 | 3 | [] | no_license | #include "Arkanoid_Level.h"
void Arkanoid::Level::addBlock(std::shared_ptr<Arkanoid::Block> block)
{
blockList.push_back(block);
}
Arkanoid::Level::Level()
{
blockList.clear();
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 9; j++)
{
addBlock(std::shared_ptr<Block>(new Block(sf::Vector2f(40+j*100, 50... | true |
5b202b84e11b29b8c092619b59f2eab7e76114d6 | C++ | mseefelder/mbv | /mbv-utils.h | UTF-8 | 8,348 | 3.4375 | 3 | [] | no_license | #include <limits>
#include <iostream>
#include <forward_list>
#include <utility>
#include <algorithm>
#include <chrono>
using namespace std;
struct UnionOperation{
int parent;
int child;
bool increasedParentRank;
UnionOperation(): parent(0), child(0), increasedParentRank(false){}
UnionOperation(int p, int c, bo... | true |
bbe87f18d66f89086b63cad1477e933a8f98cd3e | C++ | chanchoi829/simulation | /include/Model.h | UTF-8 | 5,504 | 3.390625 | 3 | [] | no_license | /*
Model is part of a simplified Model-View-Controller pattern.
Model keeps track of the Sim_objects in our little world. It is the only
component that knows how many Islands and Ships there are, but it does not
know about any of their derived classes, nor which Ships are of what kind of Ship.
It has facilities for loo... | true |
99ca1a151422002cefaf3aa16da83390c206d8c8 | C++ | Neum9/LearnOpenGL | /TextureTest/Shader.cpp | UTF-8 | 2,677 | 3.0625 | 3 | [] | no_license | #include "Shader.h"
Shader::Shader(const GLchar * vertexPath, const GLchar * fragmentPath)
{
//read shader from file path
string vertexCode;
string fragmentCode;
ifstream vShaderFile;
ifstream fShaderFile;
//assure ifstream can catch exception
vShaderFile.exceptions(ifstream::failbit | ifstream::badbit);
fShad... | true |
9aafef4f94243f2bea6da6b301443e37d140c80e | C++ | ParticularJ/interview | /leetcode148.cpp | GB18030 | 1,871 | 4.09375 | 4 | [] | no_license | /*
merge_sort : 鲢
top_downݹ鷨: time complexity: O(nlogn) space complexicity O(logn)
1 ռ䣬ʹСΪѾ֮ͣÿռźϲ
2 趨ָ룬 λ÷ֱΪѾеʼλ
3 ȽָָԪأѡСԪط뵽ϲռ䣬ƶָ뵽һλ
4 ظ3β
5 һʣµԪֱӸƵϲβ
bottom up: time : O(nlogn) space O(1)
1 ÿֽй鲢 γɣn/2У
2 вΪ1ٴι鲢
3 ظ2 ֪
*/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* List... | true |
7bf4831c858255bc43afb10763e6f1f6b89a1c39 | C++ | mkrivos/astlib | /astlib/AsterixItemCode.h | UTF-8 | 1,250 | 2.71875 | 3 | [
"MIT"
] | permissive | ///
/// \package astlib
/// \file AsterixItemCode.h
///
/// \author Marian Krivos <nezmar@tutok.sk>
/// \date 13. 2. 2017 - 19:49:36
///
/// (C) Copyright 2017 R-SYS,s.r.o
/// All rights reserved.
///
#pragma once
#include "GeneratedTypes.h"
#include "Astlib.h"
namespace astlib
{
/**
* Class that encapsulate uniq... | true |
8e05f53bfc34ebeb4d6df527b4ee7249d50a9659 | C++ | prprprpony/oj | /uva/122.cpp | UTF-8 | 2,253 | 3.375 | 3 | [] | no_license | #include <cstdio>
#include <cstdlib>
#include <queue>
using namespace std;
bool error;
struct Node
{
int val;
Node *child[2];
Node()
{
val = -1;
for (int i = 0 ; i < 2; ++i)
child[i] = NULL;
}
int index(char c)
{
switch (c) {
case 'L':
... | true |
55553bef95e6bf701c24c2adda5a33d39acd0ba8 | C++ | texaszn/CS-2315 | /lab45.cpp | UTF-8 | 2,769 | 3.296875 | 3 | [] | no_license | // Zach Nadeau
// CS 2315
// Lab 45
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <lab45.h>
using namespace std;
const bool DEBUG = false;
void printDebug(const BigInt&);
BigInt::BigInt() { // constructor digits = 0
this->sign = ZERO;
this->digits.push_back('0... | true |
dcbc271ecffe8f23de6caab1b85869877658c492 | C++ | kapil8882001/Coding-Practice-1 | /C++ Solutions/Design/LC716_MaxStack.cpp | UTF-8 | 1,813 | 4.09375 | 4 | [] | no_license | // 716. Max Stack
/*
Design a max stack that supports push, pop, top, peekMax and popMax.
push(x) -- Push element x onto stack.
pop() -- Remove the element on top of the stack and return it.
top() -- Get the element on the top.
peekMax() -- Retrieve the maximum element in the stack.
popMax() -- Retrieve the maximum el... | true |
fe1c7af5ba73c3c2e727aa4e13c016a6187c8cac | C++ | CuzzImBatman/CS162-19APCS2-DEADLINE-POWER-1 | /Project/functionAllRoles.cpp | UTF-8 | 11,482 | 3.46875 | 3 | [] | no_license | #include "function.h"
int login(AcademicYears* year, Accounts*& acc, string pwd) {
if (acc->uName[0] <= 57) {
//student
SHA256_CTX check;
sha256_init(&check);
sha256_update(&check, pwd, pwd.length());
Classes* tempClass = year->classes;
while (tempClass) {
Students* tempSt = tempClass->students;
whil... | true |
96f7ea11685991bda30fdfcf5ddbd3161d2205b5 | C++ | LeadingIsmi/FA | /Alimov FA8.1/memory.h | UTF-8 | 1,489 | 3.125 | 3 | [] | no_license | #pragma once
#include <list>
#include "memblock.h"
using namespace std;
class Memory
{
protected:
void* s;
size_t size;
list<Memblock> memblocks;
list<Memblock> available;
list<Memblock> unavailable;
void sort_list();
virtual void heap_compact() = 0;
virtual void deallocate_algorithm(Membl... | true |
69b14a24bb07c0bd961da101ff53b00a4a315dd3 | C++ | yashart/seminarsded | /binary_translation/binary_file.cpp | UTF-8 | 3,959 | 2.984375 | 3 | [] | no_license | //
// Created by yashart on 29.03.15.
//
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "binary_file.h"
errors binary_buffer_constructor(binary_buffer* buffer)
{
buffer->buffer = NULL;
buffer->buffer = (char*) calloc (0, sizeof(*buffer->buffer));
buffer->length = 0;
if(binary_buf... | true |
a03bbb1edbe7f21abe3a9f824723d9f071169bac | C++ | pinkmoon-io/AERO-21D | /catkin_diff_gps/src/diff_gps/include/diff_gps/linuxserial.h | UTF-8 | 1,346 | 2.625 | 3 | [] | no_license | //
// Created by liqiangwei on 18-8-28.
//
#ifndef IO_LINUXSERIAL_H
#define IO_LINUXSERIAL_H
#endif //IO_LINUXSERIAL_H
#include<stdio.h> /*标准输入输出定义*/
#include<stdlib.h> /*标准函数库定义*/
#include<unistd.h> /*Unix 标准函数定义*/
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h> /*文件控制定义*/
#include<te... | true |
c661905522e5330163898329fbd672508ab812a9 | C++ | Adam-Huang/competition | /C/effectivecpp/item_03.cpp | UTF-8 | 1,841 | 3.609375 | 4 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
class CTextBase{
int* size;
char* p;
public:
CTextBase(const char* other);
int& getsize() const;
char& operator[](int pos) const;
};
CTextBase::CTextBase(const char* other){
// printf("[line %d]: value of size: %d \n", __LINE__, size)... | true |
1ded8c06efde5420167ccd88d0ca0f4777dfbeef | C++ | nangege/robotCute | /robotCute/colorFinder.cpp | UTF-8 | 2,087 | 2.921875 | 3 | [
"MIT"
] | permissive | #include "ColorFinder.h"
void colorFinder::getPosition()
{
int count = 0; //找到的小球颜色像素数目
int countX = 0; //找到的小球y坐标和
int countY = 0; //找到的小球x坐标和
for(int i = 0; i < grayImg.cols ; i++)
{
for(int j = 0;j < grayImg.rows; j++)
{
uchar data = grayImg.at<uchar>(j,i);... | true |
e912a555dea57049b1f11be1dd71c6a646ebd1c4 | C++ | LenaShengzhen/eVTOL_Simulation | /src/MultiThread/Simulation.h | UTF-8 | 881 | 2.578125 | 3 | [] | no_license | #ifndef SIMULATION_H
#define SIMULATION_H
#include <chrono>
#include <iostream>
#include <fstream>
#include <ctime>
#include <vector>
#include <queue>
#include <thread>
#include <iomanip> // keep decimals
#include <string>
#include <time.h>
#include <cassert>
#include <cstdint>
#include <unistd.h>
#include <conditio... | true |
550d141bc42007020535f3e36129cbc3cd267ba7 | C++ | MoeAl-khalkhali/Azul | /9/Player.h | UTF-8 | 698 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include "Mosaic.h"
#ifndef PLAYER_H
#define PLAYER_H
class Player {
public:
Player(std::string name, int id);
Player(std::string name, int id, int points);
~Player();
int getPoints();
void resetPoints();
std::string getName();
Mosaic* getBoard();
void addPoints(int ... | true |
cb12d0fcd7190d25b3a3b08a1e66b635218d182c | C++ | shehryarnaeem/SamplePrograms | /MWDS/employee.h | UTF-8 | 827 | 3.109375 | 3 | [] | no_license | #ifndef EMPLOYEE_H
#define EMPLOYEE_H
#include "person.h"
#include "employeeexpenserecord.h"
#include <QString>
#include <vector>
class Employee : public Person
{
private:
int emp_id;
int emp_age;
QString emp_role;
double salary;
static int count;
std::vector<EmployeeExpenseRecord> records;
... | true |
e83cab902fe180606bf8e333f46246df0be7450a | C++ | vaithak/NandToTetris | /projects/08/VMTranslator/CodeWriter.cpp | UTF-8 | 11,390 | 2.625 | 3 | [] | no_license | #include "CodeWriter.h"
using namespace Hack::VMTranslator;
CodeWriter::CodeWriter(const std::string &file, bool is_dir){
this->filename = file;
int index = 0;
for(int i=this->filename.length()-1; i>=0; i--){
if(this->filename[i] == '/'){
index = i;
break;
}
}
... | true |
cbad7ba76cbdd1720d59d93ddc4d14fdc1925c8e | C++ | ChloeVallet/TP_catalogueTrajets | /Application/Application.cpp | UTF-8 | 6,382 | 2.953125 | 3 | [] | no_license | /*************************************************************************
Application - description
-------------------
début : $DATE$
copyright : (C) $ANNEE$ par $AUTEUR$
e-mail : $EMAIL$
********************... | true |
46a47e57d7a24d03202d813bf87561e2c9d9212e | C++ | ltaoj/LeetCodeCPP | /single-number-ii.cpp | UTF-8 | 346 | 3.046875 | 3 | [] | no_license | class Solution {
public:
int singleNumber(int A[], int n) {
int ones = 0;
int twos = 0;
int three;
for (int i = 0;i < n;i++) {
twos |= ones&A[i];
ones ^= A[i];
three = ones&twos;
ones &= ~three;
twos &= ~three;
}
... | true |
70b7762d6b74c0a85fb042c41bd496ff4697773e | C++ | TorstenRobitzki/bluetoe | /tests/test_characteristics.hpp | UTF-8 | 1,666 | 2.53125 | 3 | [
"MIT"
] | permissive | #ifndef BLUETOE_TESTS_CHARACTERISTICS_HPP
#define BLUETOE_TESTS_CHARACTERISTICS_HPP
#include <bluetoe/characteristic_value.hpp>
namespace {
std::uint32_t simple_value = 0xaabbccdd;
const std::uint32_t simple_const_value = 0xaabbccdd;
typedef bluetoe::characteristic<
bluetoe::character... | true |
3873821ec591be39c8804eec5e9595524a79dc45 | C++ | cenariusxz/ACM-Coding | /newstu/2015/草爷要的榜shujuceshi.cpp | UTF-8 | 689 | 2.546875 | 3 | [] | no_license | #include<stdio.h>
#include<string.h>
typedef long long ll;
ll ans[105];
int main(){
int n,k;
int count=0;
while(scanf("%d%d",&n,&k)!=EOF){
memset(ans,0,sizeof(ans));
count++;
if(n>100||n<1)printf("%d:n:%d\n",count,n);
if(k>10||k<1)printf("%d:k:%d\n",count,k);
for(int i=1;i<=n;++i){
for(int j=1;j<=k;++... | true |
57e8e2d0bf39b57e999fdf26f21dcc6e61f17337 | C++ | KillenX/WayWatch | /WW Exit/Ticket.h | UTF-8 | 273 | 2.5625 | 3 | [] | no_license | #pragma once
#include <string>
#include <iostream>
class Ticket
{
public:
Ticket(std::string, std::string, double);
void printTicketHeader(std::ostream &);
void printTicket(std::ostream &);
private:
std::string licensePlate;
std::string dateTime;
double price;
};
| true |
70b448c668fba29e26c885e3ae8d5d2b1b7e9488 | C++ | nicholsonjohnc/laso-old | /LASO/HS006.cpp | UTF-8 | 778 | 3.15625 | 3 | [
"Apache-2.0"
] | permissive | #include "HS006.h"
bool LASO::HS006::objFun(double *x, double *fObj)
{
fObj[0] = pow((1.0 - x[0]), 2.0);
return true;
}
bool LASO::HS006::objGrad(double *x, double *gObj)
{
gObj[0] = 2.0 * (1.0 - x[0]) * (-1.0);
gObj[1] = 0.0;
return true;
}
bool LASO::HS006::conFun(double *x, double *fCon)
{
fCon[0] = ... | true |
d2e851ea0e34629052836740c0f098cfea434bc2 | C++ | silencelee/leetcode | /algorithm/714.best-time-to-buy-and-sell-stock-with-transaction-fee.cpp | UTF-8 | 2,182 | 3.328125 | 3 | [] | no_license | /*
* @lc app=leetcode id=714 lang=cpp
*
* [714] Best Time to Buy and Sell Stock with Transaction Fee
*
* https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/description/
*
* algorithms
* Medium (53.10%)
* Likes: 1513
* Dislikes: 46
* Total Accepted: 67.8K
* Total Submiss... | true |
fccf80e7fe9e422aaec35ada6bcedd3733dfa301 | C++ | KIMGEONUNG/poly-merger | /code/test/src/core/PolygonMergerTest.cpp | UTF-8 | 782 | 2.5625 | 3 | [] | no_license | #include <cppunit/extensions/HelperMacros.h>
#include "PolygonMergerTest.h"
#include "PolygonMerger.h"
#include "Point.h"
#include "Polygon.h"
void PolygonMergerTest::mergeTest()
{
using namespace PolyMerger;
int morphRecSize = 3;
PolygonMerger merger;
Point pts1[4];
pts1[0] = Point(1,1);
pts1[1] = Point(5... | true |
e357343358697a05bcafa7aaf9c7d60ad0a05166 | C++ | jinsenglin/cplusplus | /11.max-heap/code.cpp | UTF-8 | 4,020 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include "function.h"
#include <cstring>
using namespace std;
void Implement::Insert(int value) {
int currentNode = ++size;
while(currentNode !=1 && heap[currentNode/2] < value) {
// Swap with parent node
heap[currentNode]=heap[currentNode/2];
currentNode /= 2; // ... | true |
9714c04209108d8a2622c138c557a96935ad837a | C++ | bartekpacia/cpp-training | /algo-and-ds/ads/stack/main.cpp | UTF-8 | 309 | 3.21875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include "stack.hpp"
using namespace std;
template class Stack<int>;
int main() {
Stack<int>* stack = new Stack<int>();
stack->Push(1);
stack->Push(2);
stack->Push(3);
while (!stack->isEmpty()) {
int popped = stack->Pop();
cout << popped << endl;
}
return 0;
} | true |
c28ed111fbf96edd39a5d4682c6d2722e957033f | C++ | chm994483868/AlgorithmExample | /Algorithm_C/OfferReview/01_38/31_StackPushPopOrder/StackPushPopOrder_1.hpp | UTF-8 | 1,096 | 2.90625 | 3 | [] | no_license | //
// StackPushPopOrder_1.hpp
// OfferReview
//
// Created by CHM on 2020/11/5.
// Copyright © 2020 CHM. All rights reserved.
//
#ifndef StackPushPopOrder_1_hpp
#define StackPushPopOrder_1_hpp
#include <stdio.h>
#include <stack>
using namespace std;
namespace StackPushPopOrder_1 {
// 31:栈的压入、弹出序列
// 题目:输入两个整数序... | true |
88fed6a33d69b6e7aea26991df20b5713bd2c24f | C++ | tornadoblot/acmicpc_project | /acmicpc_project/7568.cpp | UTF-8 | 400 | 3 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main() {
pair<int, int> arr[50];
int N, i, grade;
cin >> N;
for (i = 0; i < N; i++) {
cin >> arr[i].first >> arr[i].second;
}
for (i = 0; i < N; i++) {
grade = 0;
for (int j = 0; j < N; j++) {
if (arr[i].first < arr[j].first && arr[i].s... | true |
dce618f9ca4c1a78be37b590e5d744fc4f020467 | C++ | ASHISH-GITHUB2495/Math-algorithms-for-competitive-programmings | /Linear Diophantine equations/Linear diophantine equation solutions between intervals.cpp | WINDOWS-1250 | 1,911 | 2.96875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define mod 100000
#define rep(i,k,n) for(ll i=k;i<n;i++)
#define E cout<<endl
#define MAX 1000002
#define u_m unordered_map //hashing container
void linearDiophantineSolutions(ll a, ll b, ll c, ll xmin, ll xmax, ll ymi... | true |
7d27e8bdc848f462894120d5bb6c0f39995be348 | C++ | tyq-1112/leetcode_note | /1-100/1. Two Sum.cpp | UTF-8 | 1,298 | 3.578125 | 4 | [] | no_license |
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
unordered_map<int, int> mp;
vector<int> ans(2,0);
for(int i = 0 ; i < nums.size() ; ++i){
int x = target - nums[i];
if(mp.find(x) != mp.end()... | true |
86930eca96ceb01bd1cfe19b22241df14009a487 | C++ | NCAR/lrose-core | /codebase/libs/forayRal/src/Foray/ForayLibs/trunk/Libraries/Dorade/source/DoradeBlockCelv.cpp | UTF-8 | 4,559 | 2.703125 | 3 | [
"BSD-3-Clause"
] | permissive | //
//
//
//
#include <stdio.h>
#include "DoradeBlockCelv.h"
using namespace std;
using namespace ForayUtility;
// Static values
string DoradeBlockCelv::id_("CELV");
//////////////////////////////////////////////////////////////////////
//
//
//
/////////////////////////////////////////////////////////////////////... | true |
16d2aeec08818a13d681c1f5842e5364c0100580 | C++ | manohar45/Leetcode_solutions | /1_Two_Sum.cpp | UTF-8 | 463 | 2.75 | 3 | [] | no_license | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
unordered_map<int,int>mp;
int temp=0;
unordered_map<int,int>:: iterator it;
for (int i=0;i<nums.size();i++)
{
temp=target-nums[i];
it=mp.find(temp);
if(it... | true |
0696a84b3edfb1fde5f499bcd18a141c53ca4c1e | C++ | montreal91/workshop | /forgery/magic_genes_cpp/src/mage.h | UTF-8 | 682 | 3.21875 | 3 | [] | no_license |
#pragma once
#include <iostream>
#include <vector>
#include <random>
class MMage {
public:
MMage( bool female = true );
MMage( MMage& mother, MMage& father );
int GetCurrentAge() const;
int GetEstimatedAge() const; // TODO: remove in release
// int GetCurrentChildren() const;
i... | true |
c151f545bf8de33e4d03cb8ccd7c8ed21e789dea | C++ | Somrat-Hossen/Algorithm- | /Number Theory/Euler totient for single n.cpp | UTF-8 | 400 | 2.9375 | 3 | [] | no_license | #include<bits/stdc++.h>
#define mx 100000000
using namespace std;
int Euler_totient(int n)
{
int i,j;
int tmp=n;
for(i=2;i*i<=n;i++)
{
if(n%i==0)
{
while(n%i==0)
{
n/=i;
}
tmp=(tmp/i)*(i-1);
}
}
if(n>2) tmp=(tmp/n)*(n-1);
return tmp;
}
int main()
{
... | true |
9393b92325fecb7bfcf2f7db2466283bfa85e8ba | C++ | bayareamediagroup/Control-Structures | /ch13/projects/ex1/inc/date.h | UTF-8 | 887 | 3.8125 | 4 | [
"MIT"
] | permissive | #ifndef DATE_H
#define DATE_H
class CDate
{
/* member variables */
private:
int day;
int month;
int year;
/* member functions */
public:
void setDay(int);
void setMonth(int);
void setYear(int);
int getDay() const;
int getMonth() const;
int getYear() const;
};
/* mutators... | true |
06fcc739bab0cf8529558d085b67746a1758449a | C++ | martinpiper/ReplicaNetPublic | /ReplicaNetPublic/Includes/RNPlatform/Inc/Encryption.h | UTF-8 | 3,196 | 2.78125 | 3 | [] | no_license | /* START_LICENSE_HEADER
Copyright (C) 2000 Martin Piper, original design and program code
Copyright (C) 2001 Replica Software
This program file is copyright (C) Replica Software and can only be used under license.
For more information visit: http://www.replicanet.com/
Or email: info@replicanet.com
END_LICENSE_HEADER... | true |
668ea23a77e47626ca572b5ef119409e0781a461 | C++ | HustCoderHu/CodingPractice | /bishi/360-2018autumn/main.cpp | UTF-8 | 1,363 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void q1()
{
vector<int> inp;
int n;
cin >> n;
inp.resize(n);
for (int i = 0; i < n ; ++i)
cin >> inp[i];
if (n <= 2) {
cout << -1 << endl;
return;
}
int maxe = -1;
int cnt = ... | true |
4dfa074f9915ab220d3e1ee7ed6ea300c9d8e3a3 | C++ | Kurangceret/Decoupling | /decoupling_proj/RayCast.cpp | UTF-8 | 18,889 | 2.65625 | 3 | [] | no_license | #include "RayCast.h"
#include "Utility.h"
#include "PathFinder.h"
#include <algorithm>
extern "C" {
# include "lua.h"
# include "lauxlib.h"
# include "lualib.h"
};
#include <LuaBridge.h>
/*if (!designatedNode)
falseFlag = true;
if (std::find(toBeAvoidedNodes.begin(), toBeAvoidedNodes.end(),
designatedNode) != toBeAvo... | true |
0530454c016677b3c70d94db58ad9d97d70edd90 | C++ | TeamLaw/SFML-V1.0 | /EntityBuilder.cpp | UTF-8 | 638 | 2.9375 | 3 | [] | no_license | #include "Environment.h"
void buildPlayer(std::shared_ptr<Room> room)
{
player.setMaxHealth(100);
player.setHealth(100);
player.setDamage(10);
player.setCurrentRoom(room);
player.setFillColor(sf::Color::Green);
player.center();
}
Enemy buildEnemy(std::shared_ptr<Room> room)
{
int x = room->getPos... | true |
d1ff404e19e8749aa5f783945b2b6c719ee494a1 | C++ | Noppesj/Temere | /Temere/Graphic/graphicobject.cpp | UTF-8 | 2,528 | 2.734375 | 3 | [] | no_license | #include "graphicobject.h"
using namespace Temere::Graphic;
GraphicObject::GraphicObject() : SceneObject()
{
mpShader = nullptr;
mpTexture = nullptr;
}
GraphicObject::GraphicObject(const std::vector<Vertex*> &vertices,const std::vector<GLuint>& indices, const std::string& fileName) : SceneObject()
{
mpShader = nu... | true |
033337947f096d25478c3d861f5ff28536bfd81f | C++ | ethanmcmike/LUNAR | /libraries/SmartBuffer.cpp | UTF-8 | 778 | 3.203125 | 3 | [] | no_license | #include "SmartBuffer.h"
SmartBuffer::SmartBuffer(){
}
SmartBuffer::SmartBuffer(String key){
this->key = key;
}
SmartBuffer::~SmartBuffer(){}
void SmartBuffer::setKey(String key){
this->key = key;
}
void SmartBuffer::put(char c){
//Already full
if(index == key.length()){
return;
}
//Middle of key
els... | true |
538531be0339803a56a56b106285d381fefbde9b | C++ | Hikai/Map | /Main.cpp | UTF-8 | 805 | 3.09375 | 3 | [] | no_license | #include "Map.h"
int main()
{
Node * node1, * node2, * node3, * node4, * node5, * node6;
Store * store_node;
Store * store_node2;
node1 = store_node->create_node(123);
node2 = store_node->create_node(321);
node3 = store_node->create_node(132);
node4 = store_node2->create_node('a');
node5 = store_node2->create_... | true |
f94694c5a21990b1629b38fddb915eead790f35d | C++ | RenShuhuai-Andy/code-for-book-BeginningAlgorithmContests2nd | /第3章/习题/习题3-2 分子量.cpp | UTF-8 | 2,417 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
using namespace std;
const char name[] = "CHON";
double weight[] = {12.01, 1.008, 16.00, 14.01};
int main(void)
{
int t;
char s[81];
cin >> t;
while (t--) {
scanf("%s", s);
int num;
double sum = 0;
int i = 0;
while (s[i])
... | true |
f7b0cd6695d8e263573138de2b6a27aed494cb3a | C++ | Acka1357/ProblemSolving | /BeakjoonOJ/3000/3079_입국심사.cpp | UTF-8 | 515 | 2.515625 | 3 | [] | no_license | //
// Created by Acka on 2017. 8. 1..
//
#include <stdio.h>
int t[100000];
int main()
{
int N, M; scanf("%d %d", &N, &M);
for(int i = 0; i < N; i++)
scanf("%d", &t[i]);
long long l = 0, r = (long long)M * t[0], m, ans, sum;
while(l <= r){
m = (l + r) / 2;
for(int i = sum = 0... | true |
ece7f5ae4972570261f1fc16221bd5cb824f1c95 | C++ | drjnmrh/udppipes | /sources/sockets/udpdgram.cpp | UTF-8 | 1,922 | 2.84375 | 3 | [
"MIT"
] | permissive | #include "sockets/udpdgram.hpp"
using namespace udp::sockets;
UdpDgram::UdpDgram() noexcept
: _pData(nullptr), _szData(0)
{}
UdpDgram::~UdpDgram() noexcept {
if (_pData)
delete[] _pData;
}
UdpDgram::UdpDgram(std::initializer_list<uint8_t> data) noexcept
: _source()
, _pData(0), _szData(... | true |
6ac91a53b71706f46ce1ae879ce0899cbb9d133e | C++ | ciniak/algorithms | /UVa/Biorhytms/biorhytms.cpp | UTF-8 | 1,109 | 2.578125 | 3 | [] | no_license | //============================================================================
// Name : biorhytms.cpp
// Author : Michal Marcinkowski
// Description : http://uva.onlinejudge.org - problem 756 - Biorhytms
//============================================================================
#include <cstdio>
#incl... | true |
64c76007d6948939ca218f8ec4cc48cde027caca | C++ | hhirsch/glPortal | /source/assets/map/XmlHelper.cpp | UTF-8 | 2,170 | 2.890625 | 3 | [
"Zlib"
] | permissive | #include "XmlHelper.hpp"
#include <stdexcept>
#include <vector>
#include <engine/core/math/Math.hpp>
using namespace std;
using namespace tinyxml2;
namespace glPortal {
std::string XmlHelper::mandatoryAttributeMessage("Mandatory attribute has not been defined.");
std::string XmlHelper::invalidElementMessage(
"push... | true |
dddfbbb2c6723ff02953400b0162ee6fddface2e | C++ | rezikun/BigInt | /BigInt/main.cpp | UTF-8 | 252 | 2.84375 | 3 | [] | no_license | #include "big_int.h"
#include <iostream>
int main() {
while (true) {
std::string first_s, second_s;
std::cin >> first_s >> second_s;
big_int::BigInt first(first_s);
big_int::BigInt second(second_s);
std::cout << first / second << "\n";
}
} | true |
a1e6ecadd6e4bec611c9bcce45cfa991b02b4865 | C++ | sandereto/AED | /Aula01/Exercicio2.cpp | UTF-8 | 213 | 2.59375 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
float calcula (float x, float y, float z){
return (sqrtl(x+y+z));
}
main(){
printf("Resultado: %3.2f\n",calcula(2,3,4));
}
| true |
6957573724e87510ea3d10bd39c003b16f846c92 | C++ | alanscottthomas/StudentPrograms | /CSI-230/lab4/AlanAssignment4Chap6Prob14.cpp | UTF-8 | 1,630 | 3.46875 | 3 | [] | no_license | //Alan Thomas
//Assignment#4 2/19/2015
//Chapter6 Problem 14
#include <iostream>
using namespace std;
//in-patient function
double Patient(int days,double rate,double charges,double medication){
double total;
total=(days*rate)+charges+medication;
return total;
}
//out patient function
double Pat... | true |
c6e44344cd75cd72c4db1c13842ff4252f0323b4 | C++ | htr751/MyWindowsDebugger | /MyWindowsDebugger/DebugEventController.cpp | UTF-8 | 926 | 2.578125 | 3 | [] | no_license | #include"DebugEventController.h"
#include"windowsUtillities.h"
#include"Utillities.h"
#include<stdexcept>
void DebugEventController::WaitForDebugEvent(){
DEBUG_EVENT event = { 0 };
bool err = WaitForDebugEventEx(&event, INFINITE);
if (!err)
CreateRunTimeError(GetLastErrorMessage());
this->event = event;
}
voi... | true |
e4829390e5a8ba506773d004878c533b8e2fe208 | C++ | arrebole/Leisure | /src/OJ/1246【循环嵌套】【数组】求非素数(质数/main.cc | UTF-8 | 639 | 2.96875 | 3 | [] | no_license | #include <stdio.h>
#include <vector>
using namespace std;
int main()
{
vector<int> vec;
int *a = new int[20];
for (int i = 0; i < 20; i++)
{
scanf("%d", a + i);
}
for (int i = 0; i < 20; i++)
{
for (int j = i+1; j < 20; j++)
{
if (a[j] % a[i] == 0)
... | true |
11a733573b3faff1386f2b663f5bf05b933152fe | C++ | trustee-wallet/djinni-react-native | /support-lib/cpp/JobQueueImpl.hpp | UTF-8 | 515 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | #include "JobQueue.hpp"
#include "Job.hpp"
#include <functional>
#include <list>
#include <memory>
#include <mutex>
class JobQueueImpl : public JobQueue {
public:
static std::shared_ptr<JobQueueImpl> create();
JobQueueImpl();
virtual ~JobQueueImpl();
std::shared_ptr<Job> poll() override;
void int... | true |
776d114f649ce3f2dc2e7484559d92330d887214 | C++ | kaushal-banthia/Library-Management-System | /LMS.cpp | UTF-8 | 19,319 | 3.171875 | 3 | [] | no_license | #include <bits/stdc++.h>
#include <dirent.h>
#include <sys/types.h>
using namespace std;
//Note: All the books are inside a directory, whose name is taken as input from the user
//function that checks if a string ends with another string
bool hasEnding (string fullString, string ending);
//function that is used to r... | true |
223e0128d6adffdf0f6bdbd919d792cec9b2f635 | C++ | TheCell/Sudoku | /sudokugenerator.cpp | UTF-8 | 37,558 | 2.84375 | 3 | [] | no_license | #include <QCoreApplication>
#include "sudokugenerator.h"
#include <iostream>
#include <algorithm> // for std::find
#include <iterator> // for std::begin, std::end
#include <string>
Sudokugenerator::Sudokugenerator()
{
}
void Sudokugenerator::init(int seed)
{
//Sudokugenerator::generateSudoku(seed);
Sudokugene... | true |
70fdd97d5dd8b646157ede55d18e894d03a3ec9c | C++ | centuryglass/KeyChord | /Source/MainWindow.h | UTF-8 | 1,368 | 2.703125 | 3 | [] | no_license | #pragma once
/**
* @file MainWindow.h
*
* @brief Creates the main application window, and makes sure the application
* is closed if the window is blocked.
*/
#include "JuceHeader.h"
/**
* @brief The sole application window object and the root component in the
* component display tree.
*/
cl... | true |
7714b71b0dc111ad4cb53c533b8a1ebaf7272cd1 | C++ | finallyly/ThaiSyllableHMM | /HMM.h | UTF-8 | 1,319 | 2.546875 | 3 | [] | no_license | /*===============================================================
* Copyright (C) 2017 All rights reserved.
*
* FileName:HMM.h
* creator:yuliu1@microsoft.com
* Time:12/03/2017
* Description:
* Notice:
* Updates:
*
================================================================*/
#ifndef _HMM_H
#def... | true |
f686a541944131e686ffa738bcc33e91ee7238fc | C++ | konnase/algorithm | /剑指offer/剑指offer_15_反转链表.cpp | UTF-8 | 1,179 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | //
// Created by 李青坪 on 2019/2/26.
//
#include <cstdio>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {
}
};
class Solution {
public:
ListNode* ReverseList(ListNo... | true |
3c59f1c43d89d088a1ae4ad0ab0ffe72f5c656fc | C++ | sponeil/VKSandbox | /Code/VKContext/VKMath.h | UTF-8 | 5,530 | 3.140625 | 3 | [
"Unlicense",
"LicenseRef-scancode-public-domain",
"Libpng"
] | permissive | // VKMath.h
// This code is part of the VKContext library, an object-oriented class
// library designed to make Vulkan API easier to use with object-oriented
// languages. It was designed and written by Sean O'Neil, who disclaims
// any copyright to release it in the public domain.
//
#ifndef __VKMath_h__
#define __VK... | true |
eedb35dac587f82b31e54c8f9ff9095f7cd2cf6c | C++ | pklim101/codelib | /algorithm/lc/moveZeros.cpp | UTF-8 | 1,063 | 3.5 | 4 | [] | no_license | /*************************************************************************
> File Name: moveZeros.cpp
> Author: tony
> Mail: tony@z.com
> Created Time: 2020年04月17日 星期五 11时39分21秒
************************************************************************/
#include<iostream>
#include<vector>
using namespa... | true |
6d7f846219c6d6bf78bdda415cd29899e8608aac | C++ | varkey98/Leetcode-Solutions | /concatenatedwords.cpp | UTF-8 | 3,878 | 3.046875 | 3 | [] | no_license | int dfs_visit(string s,vector<string>& words)// wrong answer
{
if(!s.length())
return 0;
int flag=true;
int q=-1;
for(auto x:words)
{
if(!x.length()||x.length()>s.length())
continue;
else if(s.substr(0,x.length()).compare(x)==0)
{
flag=false;
q=max(q,dfs_visit(s.substr(x.length()),words));
... | true |
bc3a9413fa97087ac6e5aca4e563afcbc13af3dc | C++ | johnk-/rencpp | /tests/block-test.cpp | UTF-8 | 1,221 | 2.765625 | 3 | [
"BSL-1.0"
] | permissive | #include <iostream>
#include "rencpp/ren.hpp"
using namespace ren;
#include "catch.hpp"
TEST_CASE("block test", "[rebol] [block]")
{
SECTION("empty")
{
Block block {};
CHECK(block.length() == 0);
Block explicitEmpties {Block {}, Block {}, Block {}};
Block implicitEmpties {{}... | true |
82b9e29403a89799885e6cd7a7857dc1999291e9 | C++ | kuqadk3/CTF-and-Learning | /codeforces/contest_round_579_div3/A/hack/test02.cpp | UTF-8 | 1,914 | 2.78125 | 3 | [] | no_license | #include<iostream>
#include<algorithm>
using namespace std;
int gcd(int x,int y)
{
return y?gcd(y,x%y):x;
}
int main()
{
ios::sync_with_stdio(false);
int q;
cin>>q;
while(q--)
{
int n,a[1000];
cin>>n;
for(int i=1;i<=n;i++)
cin>>a[i];
if(n==1)cout<<"YES"<<endl;
else
{
int flag=0;
if(a[1]==1)
... | true |
c2644e1f711be7e08d2e481a61ee069068a844ed | C++ | linw/Workplace-in-Linux | /for_findingjob/something_useful/test_init_list.cpp | UTF-8 | 926 | 2.65625 | 3 | [] | no_license | /*
* =====================================================================================
*
* Filename: test_init_list.cpp
* Author: linwei
* E-mail: kinglw8729@gmail.com
* Created: 2012-09-12 23:01:37
* Last Edit:
* Compiler: gcc
* Description:... | true |
777b801e907341455f5e0cb0d7f5d35ac1c2e2cf | C++ | rathoresrikant/HacktoberFestContribute | /Algorithms/Search/Ternary_search.cpp | UTF-8 | 1,140 | 3.484375 | 3 | [
"MIT"
] | permissive | #include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
int i, n, val, low, high, mid1, mid2, a[50];
printf("Enter the size of an array : ");
scanf("%d", &n);
printf("Enter the elements : ");
for(i=0; i<n; i++)
{
scanf("%d", &a[i]);
... | true |
8ba280cd07bb6c4c54e8741213033434a3dc1ba3 | C++ | cycasmi/proyectos-VS | /Tercer semestre Data structures/Recursive Hanoi/Recursive Hanoi/Hanoi.cpp | WINDOWS-1250 | 637 | 3.625 | 4 | [] | no_license | // Name: Cynthia Berenice Castillo Milln.
// Student no. A01374530
// Homework 1 Hanoi Towers
#include <cstdio>
using namespace std;
#pragma warning (disable: 4996)
void hanoi(int &counter, int n, int p1, int p2, int p3)
{
counter++;
if (n > 1)
{
hanoi(counter, n - 1, p1, p3, p2);
hanoi(counter, n - 1, p3, p2... | true |
a6b179730344eea10db453b56be3310e0c052eb3 | C++ | BobDeng1974/finemedia | /include/ffw/media/ddsloader.h | UTF-8 | 1,251 | 2.515625 | 3 | [
"MIT"
] | permissive | /* This file is part of FineFramework project */
#ifndef FFW_MEDIA_DDS_LOADER
#define FFW_MEDIA_DDS_LOADER
#include "imageloader.h"
#include <fstream>
namespace ffw {
/**
* @ingroup media
*/
class FFW_API DdsLoader: public ImageReader {
public:
DdsLoader(const std::string& path);
... | true |
bc91eb06a5bdf494061d97978d05be4977a6e0fd | C++ | BackupTheBerlios/netpanzer-svn | /branches/start/netpanzerutils/src/Lib/Math.cpp | UTF-8 | 4,058 | 2.765625 | 3 | [] | no_license | /*
Copyright (C) 1998 Pyrosoft Inc. (www.pyrosoftgames.com), Matthew Bogue
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
T... | true |
1d43abbfe8284c1e4c297971bbe2d2433c58e601 | C++ | ejuarezg/NM4P | /Cpp/bess.cpp | UTF-8 | 1,067 | 3.171875 | 3 | [] | no_license | #include "NumMeth.h"
void bess( int m_max, double x, Matrix& jj ) {
// Bessel function
// Inputs
// m_max Largest desired order
// x = Value at which Bessel function J(x) is evaluated
// Output
// jj = Vector of J(x) for order m = 0, 1, ..., m_max
//* Perform downward recursion from initial guess
int ma... | true |
8c1fdd434e5ded12af85930a50aa59726b722554 | C++ | aashutoshtaikar/cppProjects | /Concurrency/important points/2.1.dataraces_Mutex.cpp | UTF-8 | 1,194 | 3.5 | 4 | [] | no_license | #include <iostream>
#include <fstream>
#include <thread>
#include <chrono>
#include <string>
#include <mutex>
//more realistic example to protect file write
class LogFile{
std::mutex m_mutex;
std::ofstream m_file;
public:
LogFile(){
m_file.open("3.log.txt");
}
void shared_print(std::string msg... | true |
d12d068d40d3258a8cf6350561a4701f36155420 | C++ | testTemtProj/OLD_PROJECT | /sud/TrieLib/TrieBuilder_impl.cpp | UTF-8 | 10,298 | 2.953125 | 3 | [] | no_license | #include <QDataStream>
#include <QVector>
#include <QMap>
#include <QSet>
#include "TrieBuilder.h"
class TrieBuilderImpl {
public:
TrieBuilderImpl()
: m_root(new BuilderNode(0,0)), m_nodeCount(0)
{
}
BuilderNode *addNode(char_t value, BuilderNode *parent)
{
if (!parent)
... | true |
1e781ff5f41276619db5e62ae2378ca42da432d5 | C++ | Jaiss123/Myserver-mini | /mini-server v1.8/TimerQueue.cpp | UTF-8 | 4,920 | 2.921875 | 3 | [] | no_license |
#include <sys/timerfd.h>
#include <inttypes.h>
#include <stdio.h>
#include <strings.h>
#include <unistd.h>
#include "TimerQueue.h"
#include "Channel.h"
#include "EventLoop.h"
#include "Timestamp.h"
#include <iostream>
TimerQueue::TimerQueue(EventLoop *pLoop)
:_timerfd(createTimerfd())
,_pLoop(pLoop)
,_t... | true |
154e0ffbb81d82757aa1488c4939f83297ad6e2f | C++ | svofski/vector06sdl | /src/fd1793.h | UTF-8 | 24,793 | 2.640625 | 3 | [] | no_license | // fd1793.h for vector06sdl by Viacheslav Slavinsky, ported from vector06js
//
// Originally based upon:
// fd1793.js from Videoton TV-Computer project by Bela Babik
// https://github.com/teki/jstvc
#pragma once
#include <string>
#include <vector>
#include <iostream>
#include "options.h"
#include "util.h"
#include "... | true |
8c62d1a94a1e50a5fb06639276d312a22920c95d | C++ | jawiezhu/Exercise | /leetcode/C++/RemoveLinkedListElements.cpp | UTF-8 | 5,008 | 3.953125 | 4 | [] | no_license | // Remove all elements from a linked list of integers that have value val.
// Example
// Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6
// Return: 1 --> 2 --> 3 --> 4 --> 5
//MY ERROR
// class Solution {
// public:
// ListNode* removeElements(ListNode* head, int val) {
// if(head==NULL) return NULL... | true |
0ebfca96fad18c5b71d0e04363b1c191014843c7 | C++ | optimisticninja/machine-learning | /include/training_data.h | UTF-8 | 861 | 2.6875 | 3 | [] | no_license | #pragma once
#include <vector>
#include <string>
using namespace std;
class TrainingData
{
private:
vector<vector<double>> data;
vector<vector<double>> inputs;
vector<vector<double>> expected;
unsigned num_inputs;
unsigned num_outputs;
public:
TrainingDat... | true |
fbff0a71513126e72ebb4ec6095dd2a4248d576f | C++ | hncj811/kdTree | /MegaTree.cpp | UTF-8 | 6,033 | 3.125 | 3 | [] | no_license | #include "MegaTree.h"
#include <fstream>
#include <vector>
#include <string>
#include<cstring>
#include<cmath>
int partition(std::vector<MegaNode> &arr, int depth, int top, int bottom){
MegaNode pivot= arr[top];
std::vector<MegaNode> left;
std::vector<MegaNode> right;
for( int i= top+1; i <= bottom; ... | true |
f41fc302342f7dedfde7410837669ec7709ffc78 | C++ | saimisosa/CS2124-SPRING | /rec07_sepComp_2020/Student.h | UTF-8 | 680 | 2.6875 | 3 | [] | no_license | //
// Created by Saimanasa Juluru on 3/13/20.
//
#ifndef REC07_SEPCOMP_STUDENT_H
#define REC07_SEPCOMP_STUDENT_H
#include <vector>
#include <string>
#include <iostream>
using namespace std;
namespace BrooklynPoly {
class Course;
class Student {
friend ostream& operator<<(ostream& os, const Student& rh... | true |
74950cc04a5d71cd8eeee1b9c4339f25f19bffcc | C++ | AltropInc/alt | /src/util/net/SocketAddress.h | UTF-8 | 3,562 | 2.515625 | 3 | [] | no_license | #pragma once
#include "IPAddress.h"
#include <sys/socket.h> // for sockaddr_storage
namespace alt {
using PortId = uint16_t;
constexpr PortId WILDCARD_PORT_ID = 0;
class ALT_UTIL_PUBLIC SocketAddress
{
public:
//-----------------------------------------------------------------------------
... | true |
0d0a7326cf53118e7513bea91f6172f472accd7a | C++ | godnoTA/acm.bsu.by | /1. Деревья поиска/0.0 #3295/[OK]185823.cpp | UTF-8 | 742 | 3.09375 | 3 | [
"Unlicense"
] | permissive | #include <fstream>
#include <vector>
#include <algorithm>
int main()
{
std::ifstream fin("input.txt");
std::ofstream fout("output.txt");
long n = 0;
long long sum = 0;
std::vector<long> listBT;
while (!fin.eof()) { // считали значения из файла и занесли их в список
fin >> n;
listBT.push_bac... | true |
dfe67e1c2dde0b26db98b9a88757432b9c022ee7 | C++ | rencheckyoself/turtlebot3-navigation | /nuslam/src/landmarks.cpp | UTF-8 | 6,845 | 2.59375 | 3 | [] | no_license | /// \file
/// \brief This node clusters laser scan data points and fits each cluster to a circular landmark
///
/// PARAMETERS:
/// distance_threshold: (double) Threshold to determine if a point is in a cluster
/// radius_threshold: (double) Threshold to determine if a cirlce fit is valid for an obstacle
/// fram... | true |
d335aa141cf801b68c21ff7b7956924b5399ceb1 | C++ | igoingdown/leetcode | /130_bfs_mle.cpp | UTF-8 | 1,320 | 2.796875 | 3 | [] | no_license | class Solution {
private:
int m, n;
int bias[5] = {1, 0, -1, 0, 1};
void bfs(vector<vector<char>>& board, int i, int j) {
if (i < 0 || i >= m || j < 0 || j >= n || board[i][j] != 'O') return;
queue<pair<int, int>> q;
q.push(make_pair(i, j));
while (!q.empty()) {
a... | true |
b63c6a223a711728a1de79e04093c2180b260688 | C++ | rparrot/CPP-Learning | /basics/exception.cpp | UTF-8 | 669 | 3.265625 | 3 | [
"MIT"
] | permissive | #include<iostream>
using namespace std;
int main(){
// Uncomment one of the following line
//int call_api = 2;
//float call_api = 2.2;
//char call_api = 'R';
try
{
cout<<"trying to use API value\n";
cout<<"Did some testing with api value\n";
throw call_api;
cou... | true |
5e5b92d0818de015c0f1dc9d6626df4f373cbf4f | C++ | jwebb68/nel | /src/nel/heaped/test_box.cc | UTF-8 | 3,160 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | // -*- mode: c++; indent-tabs-mode: nil; tab-width: 4 -*-
#include <nel/heaped/box.hh>
#include <catch2/catch.hpp>
namespace nel
{
namespace test
{
namespace heaped
{
namespace box
{
TEST_CASE("heaped::Box", "[heaped][box]")
{
// must be able to create a boxed value
auto a1 = nel::heaped::Box<int>::try_from(... | true |
e0a7128be7247bba34cd092f30c9c2d7fcf565ed | C++ | sanghoon23/Algorithm | /Programmers_1001_Matching&Removing/ConsoleApplication1_Test/ConsoleApplication1_Test.cpp | UTF-8 | 1,034 | 3.21875 | 3 | [] | no_license | #include "pch.h"
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <algorithm>
using namespace std;
string Merge(string S)
{
string Str = S;
for (int i = 0; i < Str.size() - 1; ++i)
{
if (Str[i] == Str[i + 1])
{
Str.erase(i, 2);
if (Str == "") break;
}
... | true |
ed6c05fec768204ac8147e35d9ddf02f264e0f2c | C++ | multitudinous/mapgen | /src/platform.cpp | UTF-8 | 3,078 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | #include "platform.h"
//============================================================================
//============================================================================
#ifndef WIN32
int _vscprintf(const char * format, va_list pargs)
{
int retval;
va_list argcopy;
va_copy(argcopy, pargs);
r... | true |
ea41053815e8959334b9fda7ded609e3ffa4e51e | C++ | PeterLinkSchultz/Automat-UI | /Binder/LambdaBinder.cpp | UTF-8 | 1,030 | 2.828125 | 3 | [] | no_license | #include "pch.h"
#include "LambdaBinder.h"
void LambdaBinder::bindNodes(StateList &state)
{
Nodes* nodes = state.getNodes();
for (auto& it : *nodes) {
bindGroup(it);
}
}
pGroupCondition LambdaBinder::getCondition(int index)
{
return data[index-1]->condition;
}
void LambdaBinder::bindGroup(St... | true |
bb4638335fd5242e297715a728a5c3876f7a6bea | C++ | masa-k0101/Self-Study_Cpp | /Cp3/3-2-2_trainning.cpp | UTF-8 | 826 | 3.828125 | 4 | [] | no_license | //vオブジェクトは、ほかのパラメータ同様、値で渡される
//そのために、関数内でのパラメータ変更はコールに使われたオブジェクトに影響しない
#include<iostream>
namespace A
{
class samp
{
int i;
public:
samp(int n) { i = n; }
void set_i(int n) { i = n; }
int get_i() { return i; }
};
//o.iの平方にセット、しかし... | true |
64e902b6ec4942bd409c5016c080048019279128 | C++ | jw3/example-pdal-plugin | /writer/MyWriter.cpp | UTF-8 | 2,661 | 2.78125 | 3 | [] | no_license | #include "MyWriter.h"
#include <pdal/pdal_macros.hpp>
#include <pdal/util/FileUtils.hpp>
#include <pdal/util/ProgramArgs.hpp>
namespace pdal
{
static PluginInfo const s_info = PluginInfo(
"writers.mywriter",
"My awesome Writer",
"http://path/to/documentation" );
CREATE_SHAR... | true |
1eed4c5ec2a91a4d5c74234ca796b44097ef35bb | C++ | wjxzju/leetcode_cpp | /leetcode_cpp/leetcode_76.h | UTF-8 | 1,072 | 2.921875 | 3 | [] | no_license | #ifndef __LEETCODE_76
#define __LEETCODE_76
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;
class Solution {
public:
static string minWindow(string s, string t) {
unordered_map<char, int> tMap;
for (size_t i = 0; i < t.size(); i++)
{
if (tMap.find(t[... | true |