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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d724bf1a4383ce9eef7e9619e19facbc248c4716 | C++ | KhronosGroup/SYCL-CTS | /tests/common/once_per_unit.h | UTF-8 | 1,323 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | /*******************************************************************************
//
// SYCL 2020 Conformance Test Suite
//
// Factory methods for objects created once per translation unit
//
*******************************************************************************/
#ifndef __SYCLCTS_TESTS_COMMON_ONCE_PER_UNIT_... | true |
13b7bcda0f644676416593e0fe6e7fcc176827f8 | C++ | jeonghyeon-kwon/algorithm | /problem13547.cpp | UTF-8 | 3,023 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <cmath>
#include <cstdio>
#include <cstring>
using namespace std;
#define MOD 1000000007
#define MAX_INT 2147483647
#define MAX_LLONG... | true |
f661358b5eb4112e0cb679a42d63bacfc4a1bdea | C++ | joeychun/usaco | /training/ride.cpp | UTF-8 | 574 | 2.953125 | 3 | [] | no_license | /*
ID: joey.s.1
LANG: C++
TASK: ride
*/
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
ifstream fin ("ride.in");
ofstream fout ("ride.out");
string first, second;
int first_multi=1, second_multi=1;
fin >> first >> second;
for (int i=0; i<first.length(); ++i) ... | true |
2dcb9739866d8af8de9c82b2e5a1d9195cf9e562 | C++ | woodsking2/mbed-os | /targets/TARGET_Dialog/TARGET_DA1469x/configurable_MAC/configurable_MAC.h | UTF-8 | 794 | 2.53125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | permissive | #pragma once
#include <memory>
#include "gsl/gsl"
#include "Nondestructive.h"
class Configurable_MAC final : virtual public Nondestructive
{
public:
enum class Result
{
success,
uninitialized,
initialized,
};
Configurable_MAC();
~Configurable_MAC();
/**
* @brief on... | true |
a82d5b5e342d4c575ab7dfd4a9a96ae6f61b224b | C++ | jeff431/Antix | /antix2/gptest.cc | UTF-8 | 2,465 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include "antix.pb.h"
using namespace std;
string master_host = "localhost";
string master_publish_port = "7773";
string master_node_port = "7770";
int main(int argc, char* argv[]) {
// Verify that the version of the library that we linked against is
// com... | true |
23b4f75bc1c5f35f9783f80ee76832b90fe81f82 | C++ | Peterskhan/TDL | /task.cpp | UTF-8 | 1,871 | 3.0625 | 3 | [
"MIT"
] | permissive | #include "task.h"
#include "tdl.h"
namespace tdl {
std::atomic_uint Task::s_task_id_counter {0};
Task::Task()
: m_task_id(++s_task_id_counter),
m_refcount(1),
m_parent(nullptr),
m_continuation(nullptr),
m_affinity(thread_affinity::none)
{}
void Task::p... | true |
f2acfd99b03a84f31bd64300ff9e50272020453c | C++ | stz91/wangdaoC- | /20190812/Factory/test.cc | UTF-8 | 211 | 2.859375 | 3 | [] | no_license | #include <iostream>
using namespace std;
class Test
{
public:
void Print()
{
cout << "Print()" << endl;
}
};
int main(void)
{
Test * tp = new Test();
tp->Print();
return 0;
} | true |
d5196a2ae242a6feeb9953c8248621021baf0f23 | C++ | NekoSilverFox/CPP | /512 - тех. пр. B3/B3-1/task1.cpp | UTF-8 | 3,582 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | #include <iostream>
#include <sstream>
#include "phoneBook.hpp"
#include "bookmarks.hpp"
#include "info.hpp"
#include "taskFunctions.hpp"
void task1()
{
std::string line;
jianing::PhoneBook book_phone;
jianing::Bookmarks marks(&book_phone);
while (getline(std::cin, line))
{
if (std::cin.fail())
{
... | true |
0997bbf78bf7096a8c2b27cdbd497fe0cc2119b7 | C++ | Computer-Kids-Club/screenshare-pro-backend | /utils.cpp | UTF-8 | 288 | 2.6875 | 3 | [] | no_license | #include "utils.h"
std::string get_file_contents(const char *filename) {
std::ifstream in(filename, std::ios::in | std::ios::binary);
if (in) {
return (std::string((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>()));
}
throw(errno);
} | true |
2abf087e78bfdac673412cf1063c926c356bfb51 | C++ | ArchieGoodwin/OnTimeMed | /cvlibbase/Src/Timer.cpp | WINDOWS-1252 | 2,918 | 2.75 | 3 | [] | no_license | /*!
* \file Timer.cpp
* \ingroup base
* \brief ˾ ױ ̡ е ̩ٳ.
* \author ˧
*/
#include "cvlibmacros.h"
#if CVLIB_OS == CVLIB_OS_WIN32
#include <windows.h>
#undef GetRValue
#undef GetGValue
#undef GetBValue
#endif
#include "Timer.h"
#ifndef _MSC_VER
#include <sys/times.h>
#include <unistd.h>
#end... | true |
5252c26d75ea5f01542b34d1eee6255367c6ce77 | C++ | ganeshvjy/DatastructuresDemo | /RecordsSearch.cpp | UTF-8 | 3,664 | 3.421875 | 3 | [] | no_license | #include"RecordsSearch.h"
RecordsSearch::RecordsSearch(){
}
RecordsSearch::~RecordsSearch(){
}
void RecordsSearch::bulkInsert(std::vector<Employee> records){
for (int i = 0; i<records.size(); i++)
{
RecordsFName.push_back(records[i]);
RecordsLName.push_back(records[i]);
RecordsPWord.push_back(records[i]);
... | true |
a1482e3a06a9e5e2fce061c6bff91f383402e70c | C++ | parthabb/cplusplus | /sortlib/heap.h | UTF-8 | 278 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | // Header file for heap.
class Heap {
protected:
int size, *heap;
public:
Heap(int *, int);
void MaxHeapify(int);
void BuildMaxHeap();
void MinHeapify(int);
void BuildMinHeap();
void HeapSort();
void RevHeapSort();
void PrintHeap();
};
| true |
74dd589b0cdda4b35a5edd810e1a45456a5d0dc9 | C++ | Kitware/vtk-examples | /src/Cxx/DataStructures/BuildLocatorFromKClosestPoints.cxx | UTF-8 | 1,035 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | #include <vtkIdList.h>
#include <vtkKdTree.h>
#include <vtkNew.h>
#include <vtkPoints.h>
int main(int, char*[])
{
// Create some points
double origin[3] = {0.0, 0.0, 0.0};
double x[3] = {1.0, 0.0, 0.0};
double y[3] = {0.0, 1.0, 0.0};
double z[3] = {0.0, 0.0, 1.0};
vtkNew<vtkPoints> points;
points->Inser... | true |
817801077eb9a93c2f632ed6e520b6b239adf6b3 | C++ | madsend/Media-Database-Project | /Book.h | UTF-8 | 717 | 2.828125 | 3 | [] | no_license | #pragma once
#include "item.h"
class Book :
public Item
{
public:
static string getMediaTypeName();
Book(void);
Book(const string& newTitle);
Book(const string& newTitle, const string& newCreator, const int& newDivisions);
Book(const string& newTitle, const string& newCreator, const int& newDivisions, const i... | true |
a0f3583a0640fed400b9247e3953774c28072576 | C++ | SilasA/CIS-HW | /CIS-263/Assignment 1/agnew.cpp | UTF-8 | 843 | 3.59375 | 4 | [] | no_license | #include "house.h"
#include <iostream>
house::house()
{
this->color = "unknown";
this->price = -1;
this->num_rooms = -1;
}
house::house(const string &ColorValue, int PriceValue, int Num_roomsValue)
{
this->color = ColorValue;
this->price = PriceValue;
this->num_rooms = Num_roomsValue;
}
void... | true |
ce81b55d6d157fe59edd17be3c7524988c60fd75 | C++ | AdirthaBorgohain/Seam-Carving | /SeamCarving.cpp | UTF-8 | 1,703 | 2.765625 | 3 | [] | no_license | #include<iostream>
#include<fstream>
#include<string>
//#include"dijkstra.h"
using namespace std;
class pixel
{
public:
int vertex_no, pixel_value;
};
int main()
{
char id1,id2;
int h, w, maxvalue,i;
pixel **t1;
ifstream fp;
fp.open("test.pgm", ios::in);
fp >> id1 >>... | true |
b0f3771c04683a2d9e9032e204cb2b09de64138c | C++ | walker0643/testxhotkeys | /xhotkeys.h | UTF-8 | 698 | 2.5625 | 3 | [] | no_license | #pragma once
#include "xkeygrab.h"
#include <map>
class XHotkeys
{
public:
typedef unsigned int keyid_t;
explicit XHotkeys(Display * display, Window window) :
_display(display),
_window(window)
{ }
keyid_t grab(KeySym keysym, unsigned int modifiers);
void ungrab(KeySym keysym, uns... | true |
01914921887a5684d42028ff390f7764f50bf0c7 | C++ | piotrpopiolek/Code | /Szkoła Programowania/Rozdział 2 Listing 2.5 ourfunc/Rozdział 1 Listing 2.5 ourfunc/ourfunc.cpp | UTF-8 | 341 | 3.171875 | 3 | [] | no_license | #include<iostream>
void simon(int);
int main()
{
using namespace std;
simon(3);
cout << "Podaj liczbe calkowita: ";
int count;
cin >> count;
simon(count);
cout << "Gotowe!" << endl;
system("pause");
return 0;
}
void simon(int n)
{
using namespace std;
cout << "Simon prosi, abys dotknal palcow u stop " << n <... | true |
61e7a20138f59bb07c18506b341cb8c2242c7fab | C++ | ericlivergood/dataluge | /Spiral.h | UTF-8 | 652 | 2.609375 | 3 | [] | no_license | #include <objbase.h>
#pragma once
//The "spiral" is the track on which one luges. Kinda looks like a pipe.
//This class is intended to facilitate to transfer between two of our VDISockets, or a pipe.
//Super simple implementation for now:
// No buffering, no name resolution; just connect to both sides call recv then ... | true |
c58cbe2cb75a4ccf1740137c08039cbc8c08e1ce | C++ | DennyLindberg/Tree-Generator | /source/generation/turtle3d.h | UTF-8 | 5,354 | 2.71875 | 3 | [
"MIT"
] | permissive | #pragma once
#include "../opengl/mesh.h"
#include "../core/math.h"
#include <map>
#include <stack>
#include <functional>
template<class OptionalState = int>
struct TurtleTransform
{
glm::fvec3 position = glm::fvec3{ 0.0f };
glm::fvec3 forward = glm::fvec3{ 0.0f, 1.0f, 0.0f }; // the direction the turtle is travellin... | true |
44b7826573dfade0c3c442991e02b29a6e7a4733 | C++ | Kracav4ik/saturn | /src/lab1/Frame.cpp | UTF-8 | 1,488 | 2.53125 | 3 | [] | no_license | #include "Frame.h"
#include <QDebug>
#include <QDragMoveEvent>
Frame::Frame(QWidget* parent)
: QGraphicsView(parent)
, fb(320, 240)
{
reset();
}
void Frame::drawFrame(ll::Matrix4x4 projection, ll::Matrix4x4 world, float angle) {
drawAPi.reset();
drawAPi.clear(fb, ll::Color(0.5, 0.5, 0.5));
d... | true |
0401382e15bc9fb1f27560b33bfd5b783bd4717f | C++ | neeraj2296/programming-contest | /URI/Solved/C++/1174.cpp | UTF-8 | 302 | 2.703125 | 3 | [] | no_license | /*
Author: Auro Mota <auro@blueorc.com>
*/
#include <stdio.h>
#include <iostream>
using namespace std;
int main() {
int i;
float b[100];
for(i=0;i<100;i++) {
scanf("%f", &b[i]);
if(b[i]<=10) {
cout << "A[" << i << "] = " << b[i] << endl;
}
}
return 0;
}
| true |
846e273a9c6dd3ee14624d3f072efef689ddc0e0 | C++ | TeodorLys/VGA-Utillity | /VGAPlayer/src/Events/Animation.cpp | UTF-8 | 2,689 | 3.21875 | 3 | [] | no_license | #include "Animation.h"
using namespace std;
const double Animation::PI = 3.14159265;
sf::Uint8 Animation::Lerp_Opacity(sf::Uint8 value, const sf::Uint8 speed) {
if (value != 0 && speed < value) {
value -= (speed + 1);
return value;
}
else if (value < speed) {
return 0;
}
return 0;
}
sf::Uint8 Animation::... | true |
e1ed5c9ed257e140f6f4eac7b769f1e94208bc33 | C++ | dylsmith/ITS-MTCDataParser | /ConsoleApplication2/VGroup.cpp | UTF-8 | 2,853 | 3.015625 | 3 | [] | no_license | #include "stdafx.h"
#include "VGroup.h"
#include "DataClasses.h"
using namespace std;
VGroup::VGroup(Trip& t)
{
leader = &t;
trips.push_back(&t);
}
VGroup::~VGroup()
{
for (Trip* t : trips)
{
t->group = NULL;
}
}
bool VGroup::canAddTrip(Trip& t2)
{
if (!t2.shared || (t2.group && t2.group->trips.size() > 1) ... | true |
d6acfee1a110df76b137b5ae676fc403d9a0a02a | C++ | csimstu/OI | /hdu/bzoj/p1588.cpp | UTF-8 | 2,219 | 2.734375 | 3 | [] | no_license | #include <cstdlib>
#include <cstdio>
#include <algorithm>
using namespace std;
#define MAXN 100000 * 2
#define INF 1 << 30
#define UNDEF INF
struct node
{
node *pre, *ch[2];
int value, size;
} tree[MAXN], *root, *Null;
int top1 = 0;
int n;
long long ans = 0;
node *New_Node(int v)
{
node *x;
x = &tree[top1 ++];
... | true |
e19923b0fa62424e659ffcd847f1fc385cf1892b | C++ | the-iron-ryan/RyanDougherty-CS-3505 | /Assignment2/huge_integer.cpp | UTF-8 | 6,667 | 3.953125 | 4 | [] | no_license | #include "huge_integer.h"
#include <iostream>
using namespace std;
huge_integer::huge_integer(const string & s)
{
//check to see if the string contains ONLY non-negative integers
if(!(s.find_first_not_of("0123456789") == string::npos))
val = "0"; //assign default value of 0 if the passed string is not a non-negativ... | true |
f9869a2cb2dcbf2b4fe532728937d1a62e6f427a | C++ | KitKatCake/DaiyCoder | /ProjectCppTest/a.cpp | UTF-8 | 1,526 | 3.265625 | 3 | [] | no_license | //#include <iostream>
//using namespace std;
//class Date;
//class Time {
//public:
// Time(int h, int m, int s);
// //friend void display(Time&);
// void display(Date &);
//private:
// int hour;
// int minute;
// int sec;
//};
//int sum(int a, int b) {
// return a + b;
//}
//Time::Time(int h,int m,int s):hour(h),minu... | true |
12d33edf273438d92bf485e7b5a30a077bf764c1 | C++ | otifik/algorithm | /1037.cpp | UTF-8 | 912 | 2.84375 | 3 | [] | no_license | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int nc,np;
vector<int> coupon;
vector<int> product;
int totalValue;
int main(){
cin>>nc;
coupon.resize(nc);
for(int i=0;i<nc;i++){
cin>>coupon[i];
}
cin>>np;
product.resize(np);
for(int i=0;i<np;i++){
... | true |
09499e08672b4b53b525c180d7fd9fdf828e8815 | C++ | kmhk/SparkD | /SparkD/Engine/cvlibbase/Inc/Template.h | UTF-8 | 28,208 | 2.515625 | 3 | [] | no_license |
/*!
* \file Template.h
* \ingroup base
* \brief
* \author
*/
#pragma once
#include "cvlibbaseDef.h"
#include "Object.h"
#include "String.hpp"
#include "Plex.h"
#include <new>
namespace cvlib
{
struct _CVLIB_POSITION { };
typedef _CVLIB_POSITION* CVLIB_POSITION;
#define CVLIB_BEFORE_START_POSITION ((CVLIB_... | true |
265f9ebb2197f30fa14528591a82eae8fd6d4243 | C++ | tony-montemuro/aoc-2020 | /day-5/day5.cpp | UTF-8 | 1,498 | 3.515625 | 4 | [] | no_license | //Programmer: Anthony Montemuro
//Date: 12/5/2020
//Description: Solution to Day 5 in Advent of Code 2020
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
int getID(string s);
int getYourID(const vector<int>& v);
int main()
{
//Declare variables
int maxSeatID = 0;... | true |
54f33ef0e913ba6ab007fd09271f7a34cf9a9f3c | C++ | Arinjbj/startcpp | /vsProject/vsProject/e_maxmin.cpp | UTF-8 | 347 | 3.296875 | 3 | [] | no_license | #include "e_maxmin.h"
int E_max(int* num, int size)
{
int max = *num;
size /= sizeof(int);
for (int i = 0; i < size; i++)
{
if (*(num + i) > max) max = *(num + i);
}
return max;
}
int E_min(int* num, int size)
{
int min = *num;
size /= sizeof(int);
for (int i = 0; i < size; i++)
{
if (num[i] < min) min ... | true |
4d664520077f5c11200cc489cb3b27cb55f1da17 | C++ | SaipraveenB/super-duper-octo-lamp | /tests/test_Q_agent.cpp | UTF-8 | 3,203 | 2.59375 | 3 | [] | no_license | #include "planning/agents.h"
#include "environment/env.h"
#include <utility>
#include <vector>
class QAgentExperiment {
public:
QAgentExperiment(const std::vector<std::vector<float>> &rewards, std::pair<int, int> start_state, std::pair<int, int> end_state);
std::vector<std::pair<float, float>> RunMultipleExperime... | true |
82e80ba909a690e3a7acaa043571bf3991e8ca15 | C++ | meriadec/Nibbler | /srcs/Kasparov.cpp | UTF-8 | 1,999 | 2.671875 | 3 | [] | no_license | #include <Kasparov.hpp>
std::vector<std::vector<int> > Kasparov::getMap(void) const {
return _map;
}
void Kasparov::addPlayer (std::string name, eKeys left, eKeys right, ePos pos, eColor color) {
_players.push_back(new Hiddleston(name, left, right, pos, this, color));
}
Kasparov::~Kasparov (void) {
for (... | true |
dad4c46892c1d79d6590fd92c170e90037bf4b45 | C++ | whutwutao/BiTree | /BiTree.h | UTF-8 | 24,635 | 3.109375 | 3 | [] | no_license | //
// BiTree.h
// 二叉树
//
// Created by WuTao on 2020/2/6.
// Copyright © 2020 WuTao. All rights reserved.
//
#ifndef BiTree_h
#define BiTree_h
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <iostream>
#include <queue>
using namespace std;
typedef char ElemType;
typedef struct BiTNode
{
... | true |
6293b39b442a3bc2a16cb266eea1eaecd0e2d7c7 | C++ | null-char/dsa | /src/leetcode/L1493/Solution.cpp | UTF-8 | 1,057 | 3.53125 | 4 | [] | no_license | // Link:
// https://leetcode.com/problems/longest-subarray-of-1s-after-deleting-one-element/
#include <bits/stdc++.h>
using namespace std;
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
class Solution {
public:
int longestSubarray(vector<int>& nums) {
int res = 0;
int i = 0;
int j = 0;
int ... | true |
117baff328ec0ecd83dca39b79be7044a099f1a4 | C++ | Gitem2001/Complex_numbers | /main.cpp | UTF-8 | 3,758 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include "rational.h"
#include "complex.h"
#include "catch_amalgamated.hpp"
#include <fstream>
TEST_CASE("Tests for complex_numbers") {
SECTION("Contructors for complex_numbers","[constuctors]"){
rational_num a(5,1);
rational_num b(6,1);
complex_num c(a,b);
comple... | true |
86ab106caf7b89513dd93845f65fe37bd987977b | C++ | Allen-xuhw/Socket | /EasyTcpServer/CELLTimestamp.hpp | UTF-8 | 621 | 2.9375 | 3 | [] | no_license | #ifndef _CELLTimestamp_hpp_
#define _CELLTimestamp_hpp_
#include<chrono>
using namespace std::chrono;
class CELLTimestamp
{
public:
CELLTimestamp()
{
update();
}
~CELLTimestamp()
{
}
void update()
{
_begin = high_resolution_clock::now();
}
double getElapsedSecond()
{
return getElapsedTimeInMicro... | true |
215d72c6b6bd3430f5ab8bc533949560122ce4ca | C++ | MrFICAX/StrukturePodataka | /Tudji labovi/LabPraktikum/Lab1LancaneListe/StruktureStackQueueDeque/StruktureStackQueueDeque/Glavni.cpp | UTF-8 | 727 | 3.0625 | 3 | [] | no_license | #include"StackJedan.h"
#include"StackAsArray.h"
#include<iostream>
#include"Queue.h"
using namespace std;
void main() {
try {
cout << "<<<<<< STACK >>>>>>>"<<endl;
StackAsArray PrviStek(5);
PrviStek.push(10);
PrviStek.push(6);
PrviStek.push(9);
PrviStek.push(20);
PrviStek.push(67);
cout << "Popovan: "... | true |
73dbc058f7ec112602d90a3caa6f32b9168d17ac | C++ | sweethoneybee/AlgorithmStudy | /AlgorithmStudy/개인/월간코드챌린지시즌3_1.cpp | UTF-8 | 507 | 2.765625 | 3 | [] | no_license | //
// 월간코드챌린지시즌3_1.cpp
// AlgorithmStudy
//
// Created by 정성훈 on 2021/09/09.
//
#include <string>
#include <vector>
#include <set>
using namespace std;
int solution(vector<int> numbers) {
set<int> s;
for (int i = 0; i < 10; i++) {
s.insert(i);
}
for (const auto n: numbers... | true |
c8f944379cb0f52080303b2411cc604c921e3ee6 | C++ | jj97181818/zj | /b965.cpp | BIG5 | 1,484 | 3.4375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int rotation (int matrix[][100], int &r, int &c) { //
int a[100][100] = {0};
int temp = 0;
for (int i = 1;i < r + 1;i++) {
for (int j = 1; j < c + 1;j++) {
a[i][j] = matrix[(c - j) + 1][i];
}
}
for (int i = 1;i < r + 1;i++) {
for (int j = 1; j < c + 1;j++) {
... | true |
2686e32c4f7610a474574e5134ee2315fee0b05c | C++ | YALAMA/4nationwar | /_ref/engine/game.cpp | UTF-8 | 5,428 | 2.640625 | 3 | [] | no_license | #include <iostream>
#include "player.h"
#include "piece.h"
#include "boardcontext.h"
#include "firetable.h"
#include "game.h"
Game::Game() {
for ( int i = 0; i < 4; i++) {
players[i] = NULL;
}
initFireTable();
}
Game::~Game() {
}
void Game::setPlayer( Player *player ) {
players[pl... | true |
fb2fab5bdc68f5385e55cd29db845a4f164dddfe | C++ | DaDaMrX/ACM | /Templates/Dijkstra.cpp | UTF-8 | 3,238 | 3.46875 | 3 | [] | no_license | /*
1.堆优化的Dijkstra O(nlogn)
1.用邻接表adj[]存储图
2.存储结构中不需要节点数n和边数m变量,在main函数中临时定义即可
3.调用时只需给出起点start,因为采用邻接表,编号从1到n或者从0到n-1均可
4.输出start到每个点的最短距离,放在dis[]数组中
*/
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
const int INF = 0x7f7f7f7f;
const int N = 1e3 + ... | true |
932b5213b68bae1c81737d1cbcc5e46f8cc7b4c7 | C++ | IHR57/Competitive-Programming | /UVA/315 (Network).cpp | UTF-8 | 2,261 | 2.703125 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string.h>
#include <algorithm>
#include <sstream>
#define MAX 105
using namespace std;
typedef vector<int> vi;
vi adjList[MAX], dfs_num, dfs_low, articulation_vertex, dfs_parent;
int visited[MAX], dfsRoot, rootChildren, dfsNumberCounte... | true |
ad8753448cfb7b2f1a3f81f2984f2f3478784435 | C++ | slab14/IoT_Sec_Gateway | /SEI/alt2temp.cpp | UTF-8 | 509 | 2.921875 | 3 | [
"MIT"
] | permissive | #include <stdio.h>
/*
* From P&FQ Toolbox
* Calculate temperature in R
* (accurate up to 60,000 feet)
* Input:
* h : Pressure alt (ft)
* Output:
... | true |
47a134ad8ec84b422a398d2a78dbfadf3ea79dc0 | C++ | jonaseck2/node-gpio | /src/GPIO.cpp | UTF-8 | 8,889 | 3.09375 | 3 | [] | no_license | #include <node.h>
#include "GPIO.h"
#include <fstream>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
v8::Persistent<v8::FunctionTemplate> GPIO::constructor;
std::string GPIO::IN = "in";
std::string GPIO::OUT = "out";
int GPIO::HIGH = 1;
int GPIO::LOW = 0;
bool GPIO::debug = false;
GPIO... | true |
9e4d165820e43517dcb3468d4c506e620f6bb8f5 | C++ | TimBunk/tb2d | /tb2d/simplerenderer.cpp | UTF-8 | 5,659 | 2.6875 | 3 | [
"MIT"
] | permissive | #include "simplerenderer.h"
#include "sprite.h"
SimpleRenderer::SimpleRenderer(Shader* shader, bool hud) : Renderer::Renderer(shader)
{
// Initialize variables
this->hud = hud;
drawCount = 0;
// Generate and bind the VAO
glGenVertexArrays(1, &VAO);
glBindVertexArray(VAO);
// Generate and bind the positions
g... | true |
85d57269410f27a9bd6d0d14b587da311be437bd | C++ | ydk1104/PS | /boj/2000~2999/2618.cpp | UHC | 1,612 | 2.78125 | 3 | [] | no_license | #include<stdio.h>
#define abs(x) (((x)>0) ? (x) : -(x))
#define min(a,b) (((a)<(b) && (a)!=0) ? (a) : (b))
typedef struct xy{
int x;
int y;
int sum;
int d;
}xy;
int distance(xy a, xy b){
int d = abs(a.x-b.x) + abs(a.y-b.y);
return d;
}
xy work[1003];
xy dp[2][1003][1003];
int main(void){
int N, W;
int d0, d... | true |
19d991663a5269d3b76c3cd60620eec58e276af3 | C++ | gpichot/cpp-formula-printer | /tests/beside.cpp | UTF-8 | 1,691 | 2.875 | 3 | [] | no_license | #include <gtest/gtest.h>
#include <blk.hpp>
#include "utils.hpp"
TEST(Beside, PaddingOnDiagNE_SW) {
std::ostringstream output;
blk::Expr e1 = blk::debug('a', 1, 2, 0, 1);
blk::Expr e2 = blk::debug('b', 1, 2, 0, 0);
blk::Expr o = blk::beside(e1, e2);
ASSERT_EQ(3, o->height());
{
S... | true |
6963b9b2f48f1f572ab7f2a12e9bd412b167a119 | C++ | DarcySail/Leetcode_Solution | /567.cpp | UTF-8 | 1,214 | 2.921875 | 3 | [] | no_license | #include <algorithm>
#include <climits>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
class Solution
{
public:
bool checkInclusion(string s1, string s2)
{
vector<int> dict(2... | true |
6d91b1b01ff94f9b580fe05006dbdcf9a86b466c | C++ | hardcoregandhi/AI-Rainbow-Islands-Neural-Network | /GameAI/ChessClosings.cpp | UTF-8 | 1,458 | 3.15625 | 3 | [] | no_license | #include "ChessClosings.h"
ChessClosings* ChessClosings::mInstance = NULL;
ChessClosings::ChessClosings()
{
isActive = false;
}
ChessClosings::~ChessClosings()
{
mInstance = NULL;
}
ChessClosings* ChessClosings::Instance()
{
if (!mInstance)
mInstance = new ChessClosings();
return mInstance;
}
bool ChessCl... | true |
0ee2db73689c6664279382068adbf2a9f3da6c07 | C++ | ChrisCummins/msc-thesis | /exercises/templates/dac/skel-max-subarray.h | UTF-8 | 2,909 | 3.0625 | 3 | [] | no_license | #ifndef EXERCISES_TEMPLATES_DAC_SKEL_MAX_SUBARRAY_H_ // NOLINT(legal/copyright)
#define EXERCISES_TEMPLATES_DAC_SKEL_MAX_SUBARRAY_H_
#include <algorithm>
#include <vector>
#include "./skel.h"
#include "./range.h"
namespace skel {
template<typename ArrayType>
class Problem {
public:
const Range<ArrayType> left;
... | true |
03a70dabb6e0b11aaf8b65b6c3a7b659914910d2 | C++ | ajberchek/FinalProectCSE165 | /LevelBuilderAlgorithmText.cpp | UTF-8 | 3,426 | 2.828125 | 3 | [] | no_license | #include "LevelBuilderAlgorithmText.h"
#include <iostream>
#include <fstream>
#include "CollisionShapeRect.h"
#include "Wall.h"
#include "Mole.h"
#include "Coin.h"
#include "Player.h"
#include "Door.h"
using namespace std;
LevelBuilderAlgorithmText::LevelBuilderAlgorithmText(string mazeFile)
{
fileForLvl = mazeFile;... | true |
8190bbfa4d87650d6376208023f3b47dbc96c2ef | C++ | MannySchneck/L2_Compiler | /src/binop.cpp | UTF-8 | 2,256 | 2.578125 | 3 | [] | no_license | #include <binop.h>
#include <labels.h>
#include <ostream>
#include <regs.h>
#include <exception>
#include <iostream>
using namespace L2;
Binop::Binop(Binop_Op op, compiler_ptr<Binop_Lhs> lhs, compiler_ptr<Binop_Rhs> rhs):
lhs(std::move(lhs)),
op(op),
rhs(std::move(rhs)) {}
std::string Binop::... | true |
5ab13948f6bde4c3dc00c8f5ac40f829c17fb833 | C++ | RusAl84/CaesarEncryptionCourseWork | /CaesarEncryptionСourseWork.cpp | UTF-8 | 824 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include "ClassCaesarEncryption.h"
#include <windows.h>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
SetConsoleCP(1251); // Ввод с консоли в кодировке 1251
SetConsoleOutputCP(1251);
cout << "CaesarEncryptionCourseWork!"<<endl
<< "Введит... | true |
786bdd8dbe88def94b9cd4765e0e6ccad010ed1a | C++ | vanhoaile95/OOAD-SVN | /BattleTankOnline/BattleCity/BattleCity/UIDigit.cpp | UTF-8 | 854 | 2.765625 | 3 | [] | no_license | #include "UIDigit.h"
UIDigit::UIDigit(P pos, int maxLength, bool visible) :UIObject(pos, BObjectName::UI_DIGIT, visible)
{
InitSprite();
Length = maxLength;
Value = new int[Length];
CurrentColor = Color::White;
}
void UIDigit::UpdateValue(int value)
{
int temp = value;
if (value == -20 || val... | true |
4966881055133d35a55a77c64195a62c509f0b20 | C++ | MaximumEndurance/Algo-17 | /HackerBlocksTesting/structurally_idetnical_generic.cpp | UTF-8 | 2,290 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
class Node {
public:
int data;
std::vector<Node*> vec;
Node(int val) {
data = val;
}
};
bool isInOrder = 1;
void InOrder(Node* root1, Node* root2) {
if((root1 == NULL) && (root2== NULL)) return;
// if(!root1 && !r... | true |
93d04601416a0562628832cb5eabcf04fb903ee4 | C++ | rishabh-997/cpp_codes | /Heaps/max_k_elements.cpp | UTF-8 | 591 | 3.5625 | 4 | [] | no_license | void heapify(int arr[], int n, int i) {
int par = i;
int left = 2*i + 1;
int right = 2*i + 2;
if(left<n && arr[left] > arr[par])
par = left;
if(right<n && arr[right] > arr[par])
par = right;
if(par!=i) {
swap(arr[par], arr[i]);
heapify(arr, n, par);
}
}
vector<int> kLarges... | true |
ede959e30d91218b63b1c91ef2961ac8706817ba | C++ | h2ssh/Vulcan | /src/math/gamma_distribution.h | UTF-8 | 1,832 | 2.78125 | 3 | [
"MIT"
] | permissive | /* Copyright (C) 2010-2019, The Regents of The University of Michigan.
All rights reserved.
This software was developed as part of the The Vulcan project in the Intelligent Robotics Lab
under the direction of Benjamin Kuipers, kuipers@umich.edu. Use of this code is governed by an
MIT-style License that can be foun... | true |
28096cbb094d2dad5ff79fa602bc0ed274a8f821 | C++ | yanjunp-cmu/LeetCode | /221. Maximal Square.cpp | UTF-8 | 1,733 | 3.609375 | 4 | [] | no_license | /*
* 2D dynamic programming
* dp matrix is (nR+1) x (nC+1)
* dp[i][j] represents the longest sqr_len cornered at (i-1,j-1)
* the new corner is the right corner of the square with length min(left, up, left_up) + 1
*/
class Solution {
public:
int maximalSquare(vector<vector<char>>& matrix) {
if (matrix.e... | true |
d19e127b6fdbc49c6680e3c3c734c286658143e6 | C++ | haitomns4173/c_practice | /login_system.cpp | UTF-8 | 3,418 | 3.65625 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <fstream>
#include <windows.h>
#include <conio.h>
using namespace std;
// Function for printing the top Part of Program
void topPrint()
{
system("cls");
cout << " Haitomns System!" << endl
<< endl;
}
//Function for setting the pointer location
void set... | true |
165464d5fa48f3fb54595db3d343d9d3489ecf3c | C++ | kdoda/Efficient-Algorithms | /Data Structures and Algorithm Analysis Book/U 2.28 a.cpp | UTF-8 | 641 | 3.453125 | 3 | [] | no_license | //Design efficient algorithms that take an array of positive numbers a, and determine:
//a. the maximum value of a[j]+a[i], with j≥i
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
int main()
{
vector<int> v(7);
for(int i=0;i<7;i++)
cin>>v[i];
int max1,max2,min=v[0];
if(v[0... | true |
5176247c7542a9fec501943610423690011daa59 | C++ | alr0cks/CollegeStuff | /HPC/Vector_Addition.cpp | UTF-8 | 640 | 3.296875 | 3 | [] | no_license | #include<iostream>
//#include<omp.h>
# define MAX 10000
using namespace std;
void populate(int arr[],int n){
for(int i=0;i<n;i++)
{
arr[i]=i;
}
}
int *sum(int arr1[], int arr2[],int n)
{
int * temp;
for(int i =0;i<n;i++)
{
temp[i] = arr1[i]+arr2[i];
}
return temp;
}
int main()
{
int n,arr1[MA... | true |
63ecfd0ca75598b99cce0ac06953eaf04a954b85 | C++ | zgpio/OJ | /lc_main/83_删除排序链表中的重复元素.cc | UTF-8 | 863 | 3.296875 | 3 | [] | no_license | #include <algorithm>
#include <iostream>
#include <lc/list.h>
#include <vector>
using namespace std;
// 使用相邻双指针解决有序重复元素问题
ListNode *deleteDuplicates(ListNode *head)
{
if (head == nullptr) return nullptr;
ListNode *i = head, *j = head->next;
while (j) {
if (i->val == j->val) {
i->next = ... | true |
47e07f2d3439c7607c996e4ed057f282da47f240 | C++ | krishnashah921/Stack | /infix to postfix done.....cpp | UTF-8 | 2,296 | 3.40625 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#define SIZE 100
char stack[SIZE];
int top=-1;
void push(char item)
{
if (top==SIZE-1)
{
printf("overflow\n");
}
else
{
top++;
stack[top]=item;
}
}
char pop()
{
char item;
if (top==-1)
{
printf("underflow... | true |
c5b361e840c4d4c6ced15c41cdc293ab24e9144b | C++ | JosiahCraw/OpenGL-Ray-Tracer | /Cone.cpp | UTF-8 | 1,462 | 2.9375 | 3 | [] | no_license | //
// Created by joscraw on 5/31/19.
//
#include "Cone.h"
#include <math.h>
float Cone::intersect(glm::vec3 posn, glm::vec3 dir)
{
float an = posn.x - centre.x;
float bn = posn.z - centre.z;
float dn = height - posn.y + centre.y;
float tan = (radius / height) * (radius / height);
float a = (dir.... | true |
e78fcf082d51f2d20f0dddea261d7a7fb279f1b4 | C++ | mortenoj/mathematics | /mathforgamedev/movement/Point.h | UTF-8 | 624 | 3.546875 | 4 | [] | no_license | class Point {
public:
// Values
float x;
float y;
float z;
// Constructors
Point(float x, float y, float z);
Point();
// Operators
Vector operator-(Point a);
// Methods
Point addVector(Vector v);
};
Point::Point() {
}
Point::Point(float x, float y, float z) {
this->... | true |
4f134eced7fd3d2177dd2d275a4f12a63bb73a76 | C++ | brian-stack/Database | /stokenizer.h | UTF-8 | 1,142 | 2.9375 | 3 | [] | no_license | #ifndef STOKENIZER_H
#define STOKENIZER_H
#include <cstring>
#include <cassert>
#include <iostream>
#include "table_util.h"
#include "token.h"
#include "map.h"
class STokenizer
{
//extract one token (very similar to the way cin >> works)
friend STokenizer& operator >> (STokenizer& s, Token& t);
public:
S... | true |
077d6fb5643ba32408d1e22a8dcd9a5be67c10c0 | C++ | realdubb/OS-Project-2 | /Wachira_P2/Wachira_P2/main.cpp | UTF-8 | 2,350 | 3.203125 | 3 | [] | no_license | #include "header.h"
#include <string>
void main(void)
{
link ptr, firstptr, lastptr;
firstptr = NULL;
HANDLE file;
char sel;
firstptr = readdb();
//if no file exists create one, otherwise read it in
if (!firstptr)
file = createdb(firstptr);
else
firstptr = readdb();
while(true)
{
printf("\nSelect O... | true |
28a79b7eb22d45477a71fd64dc8f91f44aad7586 | C++ | ivysnow/virtuanes | /NES/Mapper/Mapper244.cpp | UTF-8 | 510 | 2.53125 | 3 | [] | no_license | //////////////////////////////////////////////////////////////////////////
// Mapper244 //
//////////////////////////////////////////////////////////////////////////
void Mapper244::Reset()
{
SetPROM_32K_Bank( 0 );
}
void Mapper244::Write( WORD addr, ... | true |
629feb5d242e00c1ac0e037c2508df498a766b79 | C++ | bulacu-magda/Alemia | /data/raw/train/student_48/2083/2081/InputProcesser.h | UTF-8 | 2,283 | 2.859375 | 3 | [] | no_license | #pragma once
#include "Transform.h"
#include "Sprite.h"
#include "MouseHandler.h"
#define MOUSE_CLICK 0
#define MOUSE_MOVE 1
#define MOUSE_DOUBLE_CLICK 2
template <class Interactable>
class InputProcesser :
public Component
{
MouseHandler& localMouseHandler;
Interactable& parent;
const Transform& parentTransform;... | true |
5fa951819d19982345c95f89a8301699c8430aee | C++ | JoseManuelAlcaldeLlergo/Algoritmica | /Reinas/ClaseTiempo.cpp | UTF-8 | 1,138 | 3 | 3 | [] | no_license | #include "ClaseTiempo.hpp"
Clock::Clock ()
{
memset(&_start,0,sizeof(timespec));
memset(&_stop,0,sizeof(timespec));
_isStarted=false;
}
/*!\brief Starts the clock.
* \pre not isStarted()
* \post isStarted()
*/
void Clock::start ()
{
assert (!isStarted());
clock_gettime (CLOCK_REALTIME, &_start); ... | true |
1f0d97915597fe35da5387983d41b81fe9765913 | C++ | countryhu/algorithm | /now_coder/cracking_the_code_interview/9_recursion/7_floodFill.cc | UTF-8 | 5,011 | 3.578125 | 4 | [] | no_license | #include <algorithm>
#include <iostream>
#include <list>
#include <vector>
#include <map>
/**
题目描述
在一个nxm矩阵形状的城市里爆发了洪水,洪水从(0,0)的格子流到这个城市,
在这个矩阵中有的格子有一些建筑,洪水只能在没有建筑的格子流动。
请返回洪水流到(n - 1,m - 1)的最早时间(洪水只能从一个格子流到其相邻的格子且洪水单位时间能从一个格子流到相邻格子)。
给定一个矩阵map表示城市,其中map[i][j]表示坐标为(i,j)的格子,值为1代表该格子有建筑,0代表没有建筑。
同时给定矩阵的大小n和m... | true |
d6a0848024683d36cee3d64a9ad5511ac198535b | C++ | superweaver/leetcode | /p1383.cc | UTF-8 | 2,685 | 3.203125 | 3 | [] | no_license | #include "common.h"
class Solution {
// https://zxi.mytechroad.com/blog/greedy/leetcode-1383-maximum-performance-of-a-team/
public:
int maxPerformance(int n, vector<int> &speed, vector<int> &efficiency, int k) {
const int Mod = 1e9 + 7;
// !!!
// sort them according to desceding efficiency
... | true |
26188edbff79abd17682a32a4ccbf207c06811ad | C++ | XiayangJin/GoAndDoIt | /CSearch.cpp | UTF-8 | 765 | 2.59375 | 3 | [] | no_license | #include "stdafx.h"
#include "CSearch.h"
CSearch::CSearch()
{
}
CSearch::~CSearch()
{
}
vector<int> CSearch::GetWordsTimes(vector<string> &m_vsCaughtWords, vector<string> &m_vsWords){
vector<int> vnWordsTimes;
int nCounter = 0;
for (int i = 0; i < m_vsWords.size(); i++){
nCounter = 0;
for (int j = 0; j < m_... | true |
cda6ddd7a4f132c62a98a3168d2d566bbdfe8c5f | C++ | AlexPax/AfelBot | /MotorDriver/MotorDriver.ino | UTF-8 | 4,588 | 2.875 | 3 | [] | no_license | // Прошивка драйвера двигателей. Версия 4.0.
#include <Servo.h>
const int LEFT_MOTOR_DIR_PIN = 7;
const int LEFT_MOTOR_PWM_PIN = 9;
const int RIGHT_MOTOR_DIR_PIN = 8;
const int RIGHT_MOTOR_PWM_PIN = 10;
// Этими константами можно выравнять движение вперед, если робот сремится завернуть вправо или влево из-за того,... | true |
77b72a09602f9a1394c111ef1a26407a5ab8017e | C++ | AdamVerner/BI-PA2 | /semwork/vernead2/src/Interface/Selector.h | UTF-8 | 1,424 | 3.390625 | 3 | [] | no_license | //
// Created by vernead2 on 19.06.20.
//
#pragma once
#include <map>
#include <functional>
#include <climits>
/**
* Utility to prompt user for multiple selection.
*
* Input is sanitized. Upon invalid selection the user is re-prompted until viable option is selected.
* */
class Selector{
public:
Selector(st... | true |
45118a648a1497dfb6d2218c5e2d4bfcdac71e67 | C++ | blackPantherOS/FTXUI | /src/ftxui/component/event.cpp | UTF-8 | 2,414 | 2.53125 | 3 | [
"MIT"
] | permissive | #include "ftxui/component/event.hpp"
#include <iostream>
#include "ftxui/screen/string.hpp"
namespace ftxui {
// static
Event Event::Character(const std::string& input) {
Event event;
event.input_ = input;
event.is_character_ = true;
event.character_ = to_wstring(input)[0];
return event;
}
// static
Event... | true |
abe8412e58f1e4a07509d6ac74a3cd3533c24633 | C++ | liushengxi13689209566/Data-structures-algorithm | /tree/ 重建二叉树.cpp | UTF-8 | 1,836 | 3.859375 | 4 | [] | no_license | /*************************************************************************
> File Name: 重建二叉树.cpp
> Author: Liu Shengxi
> Mail: 13689209566@163.com
> Created Time: Thu 13 Dec 2018 12:25:39 PM CST
************************************************************************/
#include <stream>
#include <vector>
// str... | true |
8e55f8a45355fb8b6aec33d96f6dd8a697defe43 | C++ | dmriser/analysis-main | /include/database/Parameters.h | UTF-8 | 916 | 2.8125 | 3 | [] | no_license | #ifndef PARAMETERS_H
#define PARAMETERS_H
#include <string>
#include <map>
#include "ParameterMetaData.h"
#include "ParameterSet.h"
class Parameters{
public:
Parameters();
~Parameters();
protected:
ParameterMetaData metaData;
std::map<std::string, ParameterSet> parameters;
public:
ParameterSet getPa... | true |
f06880ca48ef515654fe0ed64a55fa363229a782 | C++ | prasko/parallel-adwt | /src/sysutil.cpp | UTF-8 | 2,654 | 2.921875 | 3 | [] | no_license | /*
Copyright: (c) 2011 Matija Osrecki <matija.osrecki@fer.hr>
*/
#include <vector>
#include "sysutil.h"
void Decimator::decimate(const Signal &s, Signal &re, Signal &ro) {
for(int i = 0; i < (int)s.size(); ++i) {
if(i % 2 == 0)
re.push_back(s[i] * constant_);
else
ro.push_back(s[... | true |
4a82b5a00b10f29b1c6ca936af4c8387910ba75c | C++ | junjiek/OJcoding | /leetcode/stack/valid-parentheses.cpp | UTF-8 | 738 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <unordered_map>
using namespace std;
class Solution {
unordered_map<char, char> m;
public:
Solution() {
m[']'] = '[';
m[')'] = '(';
m['}'] = '{';
}
bool isValid(string s) {
... | true |
bb1393db49f0a6a35015ea8a97a39eab3115b069 | C++ | mdiazXV/CPP | /Project 4/Project 4/jobStack.h | UTF-8 | 505 | 2.875 | 3 | [] | no_license | #pragma once
#include <iostream>
struct job {
char jobType;
int processingTime;
int typeNumber;
int jobNumber;
int arrivalTime;
int waitTime = 0;
};
class jobStack
{
private:
job jobSet[5000];
int jobCount = 0;
public:
jobStack();
void push(job inputJob);
job pop();
bool isEmpty();
bool isFull();
void p... | true |
66ac6ab17e01d2ae8488d34840e0b4bb9b23760d | C++ | machadoprx/soq_sec | /socket_common.cpp | UTF-8 | 2,255 | 2.53125 | 3 | [] | no_license | #include "socket_common.h"
int make_soqueto(soqueto *res, enum socket_type type, const char* address, const uint16_t port) {
strcpy((char*)res->address, address);
res->type = type;
res->port = port;
res->socket_desc = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (res->socket_desc < 0) {
... | true |
824bd8d6bfee29667ba6bc96fc85fde962ebdd49 | C++ | shubarinv/3_Course_AR_CourseWork | /window.hpp | UTF-8 | 3,675 | 2.90625 | 3 | [] | no_license |
#ifndef CGLABS__WINDOW_HPP_
#define CGLABS__WINDOW_HPP_
#include "functions.hpp"
class Window {
private:
GLFWwindow *window= nullptr; ///< reference to glfw window
glm::vec2 windowSize{};
public:
/**
* @brief returns window size
* @return vec2<int>
*/
[[maybe_unused]] [[nodiscard]] const glm::vec2 ... | true |
2b0f58c8e9ccd78c1f3e1357f23e9e9c88fd5eea | C++ | changsongzhu/leetcode | /C++/seq_num/407_h.cpp | UTF-8 | 1,953 | 3.53125 | 4 | [] | no_license | /**
407[H]. Trapping Water II
Given an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of water it is able to trap after raining.
Note:
Both m and n are less than 110. The height of each unit cell is greater than 0 and is less than 20,000.
Example:
G... | true |
3219b5dc84708a42a675b37b8a67b7082747ac01 | C++ | RobertBendun/egzamin-algebra | /polynomials_modulo.cc | UTF-8 | 5,199 | 3.28125 | 3 | [] | no_license | #include <algorithm>
#include <charconv>
#include <cstring>
#include <deque>
#include <iostream>
#include <iterator>
#include <memory_resource>
#include <memory>
#include <sstream>
#include <tuple>
#include <utility>
#include <vector>
auto modulo_inverse(int a, int n)
{
int t = 0, nt = 1;
int r = n, nr = a;
while ... | true |
ce65fa82359814cb5750329ff7a7f72f96773767 | C++ | Chaitanya-git/waymo-open-dataset | /waymo_open_dataset/math/polygon2d.h | UTF-8 | 5,825 | 2.90625 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-generic-cla"
] | permissive | /* Copyright 2019 The Waymo Open Dataset Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable ... | true |
89cce25822aa075a02b1f68767249393a9d711bd | C++ | robercano/cornerstone | /Source/Framework/Core/GameObjectOwner.hpp | UTF-8 | 892 | 2.8125 | 3 | [
"MIT"
] | permissive | //
// GameObjectOwner.hpp
//
// @author Roberto Cano
//
#pragma once
#include "Types.hpp"
namespace Framework
{
using namespace Types;
namespace Core
{
class GameObjectOwner
{
public:
GameObjectOwner() = default;
virtual ~GameObjectOwner() = default;
bool hasOwner() const;
const GameObject& ge... | true |
2c6da590a6fcf6a5440942b945dc32db34645a86 | C++ | afeinland/fuzzy-adventure | /polymorph.cpp | UTF-8 | 887 | 2.890625 | 3 | [] | no_license | // Course: CS 100 <Winter 2014>
//
// First Name: Alex
// Last Name: Feinland
// CS Login: afein001
// UCR email: afein001@ucr.edu
// SID: 861056485
//
// Lecture Section: <001>
// Lab Section: <021>
// TA: Bryan Marsh
//
// Assignment <HW5>
//
// I hereby certify that the code in this file
// is ENTIRELY my own orig... | true |
c74a2dfc59381cb8fe69290331a52d72ae9f0d81 | C++ | Hongbaekson/OOP345_Object-oriented-programming | /OOP_Project-master/Aid Management Application/Error.cpp | UTF-8 | 1,557 | 3.0625 | 3 | [] | no_license | // Name Hongback Son Date 19/09/22 Reason
/////////////////////////////////////////////////////////////////
#include "Error.h"
#include <iostream>
#include <string>
#include <cstring>
using namespace aid;
namespace aid {
Error::Error(const char* errorMessage) {
if (errorMe... | true |
0df431f87eccba7bcc205c444b64f70956d9dbc0 | C++ | ashrwin/Spoj-Solutions | /solutions/MusicalChairs.cpp | UTF-8 | 344 | 2.65625 | 3 | [] | no_license | /**/
#include<iostream>
using namespace std;
inline int musicdp( int n , int d )
{
int ret = 0;
for ( int i = 2; i <= n; ++i )
ret= ( ret + d ) % i;
return ret+1 ;
}
int main()
{
int n , d;
while ( true )
{
scanf( "%d%d" , &n , &d );
if ( !n && !d ) return 0;
printf( "\n%d %d %d" , n , d , musicdp( n , d... | true |
a568ac53ae32fa46354e9521bd6c30df730b3ce2 | C++ | bcbro2021/consoleEdit | /main.cpp | UTF-8 | 724 | 2.671875 | 3 | [] | no_license | #include "lib.h"
using namespace std;
int main(){
//variables
bool run = true;
string result;
string text;
print(" ______ _______ _______ _______");
print("| ____|| _ | |__ __||__ __|");
print("| |____ | | | | | | | |");
print("| ____|| | | | | | | |");
print("| |____ | |_| ... | true |
8003086f8f1e17014c2bb5b7eb7bf79dd2d35969 | C++ | dlareau/cluster-counter | /Microcontroller/Microcontroller.ino | UTF-8 | 5,463 | 2.5625 | 3 | [] | no_license | /* code for max 7219 from maxim,
reduced and optimised for using more than one 7219 in a row,
______________________________________
Code History:
--------------
The original code was written for the Wiring board by:
* Nicholas Zambetti and Dave Mellis /Interaction Design Institute Ivrea /Dec 2004
* http://www.p... | true |
36c54b46fef4ca634ff8e800fd9f767d8e6859f1 | C++ | roba1234/hsm | /HSM/Action.cpp | UTF-8 | 2,446 | 2.984375 | 3 | [] | no_license | #include "pch.h"
#include "Action.h"
Action* Action::GetLast()
{
if (m_pNext == nullptr)
return this;
// Find the end iteratively
Action* pCurr = this;
Action* pNext = m_pNext;
while (pNext)
{
pCurr = pNext;
pNext = pNext->m_pNext;
}
return pCurr;
}
void Action::DeleteList()
{
if (m_pNext == nu... | true |
8472e70b742bdbf64e5673bc278d77e07df3b724 | C++ | bMorgan01/Javatocpp | /D2_power.cpp | UTF-8 | 547 | 3.984375 | 4 | [] | no_license | #include <iostream>
int power(int n, int e) {
if (n < 0 || e < 0) return -1;
else if (e > 0) return n * power(n, e - 1);
else return 1;
}
int main() {
int n, e;
std::cout << "Enter number: ";
std::cin >> n;
std::cout << "Enter exponent: ";
std::cin >> e;
std::cout << "Ans: " << p... | true |
d9b1f5fdf2cc00d085518421d0e936d97e6206c4 | C++ | shiv-jetwal90/Coding-Practice | /Arrays/sign_of_the_product.cpp | UTF-8 | 716 | 3.140625 | 3 | [] | no_license | ## https://www.geeksforgeeks.org/array-product-c-using-stl/
class Solution {
public:
int arraySign(vector<int>& v) {
int c=0;
for(int i=0;i<v.size();i++)
{
if(v[i]==0)
return 0;
if(v[i]<0)
c++;
}
if(c%2==0)
... | true |
86cb002ea15f22386345f3e562867dc56213f3e2 | C++ | giranath/epic-tv-fighting | /src/gamestates/VictoryState.h | UTF-8 | 1,342 | 2.90625 | 3 | [] | no_license | /**
* FICHIER: VictoryState.h
* PROJET: TP3
* AUTHEUR: Nathan Giraldeau
*
* DESCRIPTION;
* État dans lequel on dévoile le vainqueur du combat
*/
#ifndef __TP3__VictoryState__
#define __TP3__VictoryState__
#include "GameState.h"
#include "Player.h"
#include "Scene.h"
#include "Game.h"
namespace beat {
... | true |
af04a2f70b31fd16bbe708e3f1d9644c772940d0 | C++ | amorilio/TestSources | /LRUCache.h | UTF-8 | 1,289 | 2.984375 | 3 | [] | no_license | #pragma once
class LRUCache
{
public:
LRUCache(void);
~LRUCache(void);
// A Queue Node (Queue is implemented using Doubly Linked List)
typedef struct QNode
{
struct QNode *prev, *next;
unsigned pageNumber; // the page number stored in this QNode
} QNode;
// A... | true |
5798d0ddc18dc5596dcbbffa7031c4b499d4e59c | C++ | PA2FA17/pa2fa17-helloojj | /assignments/3/todo_item.cpp | UTF-8 | 1,796 | 3.875 | 4 | [] | no_license | /*
* Name : todo_item.cpp
* Author : Luke Sathrum
* Description : Implementation file for TodoItem class
*/
#include "todo_item.h"
TodoItem::TodoItem(string description, int priority, bool completed)
: description_(description),
priority_(priority),
completed_(completed) {
}
TodoItem::... | true |
ae6a7202003e0fc0682809a6e1552d8b4a013d09 | C++ | lvshq/Image-Stitching | /Image-Stitching/image-stitching.cpp | UTF-8 | 10,183 | 2.765625 | 3 | [] | no_license | #include <opencv2/opencv.hpp>
#include <opencv2/nonfree/nonfree.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/stitching/detail/blenders.hpp>
#include <algorithm>
using namespace cv;
using namespace std;
// Functions prototypes
void Homography(const vector<Mat> &Images, vector<Mat> &transforms);
void Fi... | true |