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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4afa83094dac36ef0d5349bb99426bf90bcd0357 | C++ | swagatn22/GFG_mustdo | /LL/Delete keys in a Linked list.cpp | UTF-8 | 398 | 2.703125 | 3 | [] | no_license | Node* deleteAllOccurances(Node *head,int x)
{
while(head->data == x){
head = head->next;
}
Node *temp = head;
Node *prv = head;
while(temp != NULL){
if(temp->data == x){
prv->next = temp->next;
temp = prv->next;
}else{
prv = temp;
... | true |
197f20f750d3bfe83d2c12347a3bc7bd01bd3aa6 | C++ | Calit2-UCI/EMMA-FINAL | /libs/vscore/header/List.h | UTF-8 | 2,845 | 3.5 | 4 | [] | no_license | #ifndef _LIST_H
#define _LIST_H
#ifndef NULL
#define NULL 0L
#endif
template<class T>
class List {
public:
class Iterator
{
friend class List<T>;
public:
Iterator(const T &t) : _value(t)
{ _prev = _next = NULL; }
Iterator *prev() { return _prev; }
const Iterator *pre... | true |
58d884a8133898d7238f5d1ed3b34c20dddf61ed | C++ | gazzenger/lora-node-test | /lora-arduino-testsend/lora-arduino-testsend.ino | UTF-8 | 3,544 | 2.71875 | 3 | [] | no_license | #include <SPI.h>
#include <LoRa.h>
#include <SoftwareSerial.h>
#include <TinyGPS.h>
float lat = 28.5458,lon = 77.1703, elv = 0; // create variable for latitude and longitude object
SoftwareSerial gpsSerial(A0,A1);//rx,tx
TinyGPS gps; // create gps object
int counter = 0;
static void smartdelay(unsigned long m... | true |
aad2e9b948589d44798f85d6cf74a03ef0209cf6 | C++ | kuenane/N-puzzle | /srcs/isSolvable.cpp | UTF-8 | 2,276 | 3.109375 | 3 | [] | no_license | // ************************************************************************** //
// //
// ::: :::::::: //
// isSolvable.cpp :+: :+: :+: ... | true |
19f5f2591f153b16e017597cb25f9a59a3cc12ca | C++ | Stephenalexngo/Java-Cpp-Programs | /KattisC++/FreeFood.cpp | UTF-8 | 537 | 2.734375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main()
{
// freopen("out.txt","wt",stdout);
int tester, s, t, freefooddays;
bool numofdays[366];
while(cin >> tester)
{
freefooddays = 0;
for(int z=0; z<366;z++)
{
numofdays[z] = false;
}
for(int x=0; x<tester; x++)
{
cin ... | true |
b0bdb0f951cf6f9c532303dcfb118ba54f1387b2 | C++ | fatmaashraframadan/Biological_Program | /Protien.cpp | UTF-8 | 8,458 | 3.375 | 3 | [] | no_license | #include "Protien.h"
#include "CodonsTable.h"
Protien::Protien()
{
//ctor
}
Protien::Protien(Protien &protein2){
int counter = 0;
while(protein2.seq[counter] != '\0')
{
counter +=1;
}
seq = new char[counter+1];
for(int i=0; i<counter; i++)
{
seq[i] = pr... | true |
77f87c09a68fbbc9bbe0d52dd3ac2e03ec0a66af | C++ | mizraith/mizraith_DigitalClock_forgithub | /DigitalClock_StateTypedefs.h | UTF-8 | 912 | 2.765625 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | /**
* PART OF mizraith_DigitalClock package
*
* base definition of a "state"
*
*/
#ifndef _mizraith_DigitalClockStateTypedefs_H_
#define _mizraith_DigitalClockStateTypedefs_H_
#include <Arduino.h>
namespace mizraith_DigitalClock {
/* Forward declaration of state structure */
struct state;
/* Stat... | true |
366b872690adc9944e1d828e28389d8df26aa109 | C++ | tmyksj/atcoder | /AtCoder Beginner Contest 170/C - Forbidden List/main.cpp | UTF-8 | 484 | 2.90625 | 3 | [] | no_license | #include <iostream>
#include <set>
using namespace std;
int main() {
int x, n;
cin >> x >> n;
set<int> p;
for (int i = 0; i < n; i++) {
int pi;
cin >> pi;
p.insert(pi);
}
int res = 0;
for (int i = 0; ; i++) {
if (p.find(x - i) == p.end()) {
res... | true |
db0e5ea18abb6fd7bda4618fdd06121850aae9cc | C++ | MaxCarlson/Allocators | /Allocators/Linear.h | UTF-8 | 2,090 | 3.6875 | 4 | [] | no_license | #pragma once
#include "AllocHelpers.h"
namespace alloc
{
template<size_t bytes> // TODO: Remove from alloc:: namespace
struct LStorage
{
inline static bool init = 1;
inline static byte* MyBegin;
inline static size_t MyLast;
LStorage()
{
if (init)
{
MyBegin = reinterpret_cast<byte*>(operator new... | true |
f49ab5d0d2a4a0169d5f5f81d60065fe6c6a8cc1 | C++ | Telefragged/rndlevelsource | /rndlevelsource/Matrix.cpp | UTF-8 | 5,947 | 2.859375 | 3 | [
"MIT"
] | permissive | #include "Matrix.h"
#include <math.h>
#include <limits>
#include <sstream>
#include "Vertex.h"
#define M_PI 3.14159265358979323846
//Matrix Matrix::rotmatxPassive(double deg)
//{
// double rad = deg * (M_PI / 180.0);
// double sinth = sin(rad), costh = cos(rad);
// double rotarr[3][3] = {
// {1.0, 0.0, 0.0},
// {... | true |
216f69cb059dd4b2e53b25975563caf264114154 | C++ | mfaisalghozi/competitive-programming-stuff | /lab/95556_Untitled7.cpp | UTF-8 | 211 | 2.75 | 3 | [] | no_license | #include<stdio.h>
int jumlah;
int fibo(int n, int m){
if(n==m) jumlah++;
if(n<=2) return 1;
return fibo(n-1, m)+fibo(n-2, m);
}
int main(){
jumlah=0;
fibo(10,2);
printf("%d", jumlah);
return 0;
}
| true |
0f9a6884656256aae02ecbf383f16d37415eaf11 | C++ | hugetto/2DGame | /src/GameEngineLib/src/managers/CGameObjectManager.cpp | UTF-8 | 3,158 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | #include "pch.h"
#include <managers/CGameObjectManager.h>
#include <CGameObject.h>
#include <algorithm>
#include <CCamera.h>
namespace hugGameEngine
{
CGameObjectManager CGameObjectManager::sInstance;
CGameObjectManager::CGameObjectManager()
{
}
CGameObjectManager::~CGameObjectManager()
{
... | true |
c464e5e727f3dc2407741af13810914bf802deef | C++ | heimiaosd/C_Study | /c语言/循环的演示/源.cpp | UTF-8 | 1,143 | 2.921875 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <string.h>
#include <time.h>
//-------------------定义数据部分----------------//
//---------------函数声明部分-------------------//
//计数循环
void sweetiel();
//打印字符三角形
void printCh();
int main()
{
printf("---------for循环-------... | true |
8d126c13986a3a4a1d8eec0ce11e7ec5c1ff31f3 | C++ | MeredithCL/Algorithms-Basic-Exercises | /set_intersection.cpp | UTF-8 | 1,200 | 2.953125 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
set<int> x1;
set<int> x2;
int size1 = nums1.size();
int size2 = nums2.size();
vector<int> result;
for (int i = 0; i < size1; ++ i)... | true |
b3f04df045ebca148a2bb84dea5dbf40a1ae51ad | C++ | jedh/bloodred | /Core/Include/Sprites/SpriteAnimation.h | UTF-8 | 641 | 2.859375 | 3 | [] | no_license | #pragma once
#include <string>
#include <SDL.h>
#include <vector>
namespace BRCore
{
struct SpriteAnimation
{
public:
SpriteAnimation(SDL_Texture* inTexture, std::string inName, int inNumFrames);
~SpriteAnimation();
SDL_Texture* texture;
std::string name;
int numFrames;
int speed;
bool isLooping;
... | true |
c4dc51468963689627d339859a84bf7303dc68fb | C++ | liwei1024/WC- | /DXF Console Exe/Game.cpp | GB18030 | 3,584 | 2.59375 | 3 | [] | no_license | #include "pch.h"
#include "Game.h"
#include "utils.h"
using namespace std;
Game::Game()
{
}
Game::~Game()
{
}
//
int Game::decrypt(int address)
{
VMProtectBeginUltra("decrypt");
int eax, esi, edx, i;
eax = _Process.ReadInteger(address);
esi = _Process.ReadInteger(__ַܻ);
edx = eax >> 16;
edx = _Process.ReadI... | true |
b19e33a781d1dd3aa3a7dd82ead3922142fdf1fc | C++ | cpaille/Assembleur | /AbstractVM/src/Parser/Parser/SyntaxAnalyzer.cpp | UTF-8 | 1,659 | 2.921875 | 3 | [] | no_license |
#include "SyntaxAnalyzer.hh"
#include <AbstractVM>
#include <Exception>
#include <VMDef>
SyntaxAnalyzer::SyntaxAnalyzer() {
}
SyntaxAnalyzer::~SyntaxAnalyzer() {
}
void SyntaxAnalyzer::addTokenType(TokenTypeInterface* type) {
sort.push_back(type);
}
bool SyntaxAnalyzer::match(std::list<Token *>::iterator begin... | true |
dee3d5e277cfa7a2fe17fac52878b6c90e726682 | C++ | Kittnz/OculusRiftInAction | /source/Example_5_2_3_MeshDistort.cpp | UTF-8 | 5,907 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | #include "Common.h"
std::map<StereoEye, Resource> SCENE_IMAGES = {
{ LEFT, Resource::IMAGES_TUSCANY_UNDISTORTED_LEFT_PNG},
{ RIGHT, Resource::IMAGES_TUSCANY_UNDISTORTED_RIGHT_PNG }
};
class DistortionHelper {
protected:
glm::dvec4 K;
double lensOffset;
double eyeAspect;
double getLensOffset(StereoEye ey... | true |
940ddfa4f4844c1b55b1a7d0197a64836cb03af4 | C++ | jingma-git/numeric | /chp2/lu.h | UTF-8 | 3,687 | 3.125 | 3 | [] | no_license | #pragma once
#include <eigen3/Eigen/Eigen>
void lu(const Eigen::MatrixXd &A, Eigen::MatrixXd &L, Eigen::MatrixXd &U)
{
using namespace Eigen;
int n = A.rows();
assert(A.rows() == A.cols() && "Input matrix A must be square!");
L = MatrixXd::Identity(n, n);
U = A;
for (int j = 0; j < n - 1; ++j... | true |
e7b4b943cb9a47b71c84e0a9c58988c018fc0a72 | C++ | kszytko/object-oriented-programming | /shm/Ship.hpp | UTF-8 | 1,108 | 3.15625 | 3 | [] | no_license | #pragma once
#include <memory>
#include <string>
#include <vector>
#include "Cargo.hpp"
class Ship {
public:
Ship();
Ship(int id,
const std::string& name,
size_t speed,
size_t maxCrew,
size_t capacity);
Ship(int id,
size_t speed,
siz... | true |
e3712174b3b84e3d024f4c45737bc4ee55e10d1d | C++ | Dvmenasalvas/EDA | /Juez/2ndo cuatri/14.cpp | ISO-8859-1 | 1,190 | 3.171875 | 3 | [] | no_license | // Grupo XYZ, Fulano y Mengano
// Comentario general sobre la solucin,
// explicando cmo se resuelve el problema
#include <iostream>
#include <vector>
#include <fstream>
#include <stdexcept>
#include <algorithm>
#include <string>
#include "bintree_eda.h"
using namespace std;
// funcin que resuelve el problema
// comen... | true |
a9da0da912bf77730520643ab47d65fd2db1fae4 | C++ | arora-ansh/CP-Repository | /algos/heaps/heaps.cpp | UTF-8 | 2,623 | 4.03125 | 4 | [] | no_license | /*
In heaps,
Insertion - O(logn)
Deletion - O(logn)
Min/Max Element - O(1)
Useful where the min/max element needs to be found out multiple times
It is basically a tree like data structure where value stored in a node < value stored in each of its children
Operations -
• CreateHeap(H) : Create an empty heap H.
• Inser... | true |
a93d39be6a861e6f3fe0b93baa9da487e440fdb9 | C++ | kg810/KGTrading | /kglib/mmap/mmaputil.h | UTF-8 | 1,829 | 2.859375 | 3 | [] | no_license | /*
* Provide memory map functionality
*/
#include <vector>
#include <mutex>
#include <exception>
#include <atomic>
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/mapped_region.hpp>
namespace kg
{
using namespace boost::interprocess;
struct MetaEntry
{
uint16_t kgId; ... | true |
bcee7ea6a66ce0996064f413ea6376aacb8731e3 | C++ | ZihengChen/CLUEAlgo | /include/CLUEAlgo.h | UTF-8 | 3,477 | 2.8125 | 3 | [] | no_license | #ifndef CLUEAlgo_h
#define CLUEAlgo_h
// C/C++ headers
#include <set>
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <chrono>
#include "LayerTiles.h"
#include "Points.h"
class CLUEAlgo{
public:
// constructor
CLUEAlgo(float dc, float deltao, float deltac, float rhoc,... | true |
d78b35d4ed0e95931866a4a6254c0975b203ffdb | C++ | Leumash/ProjectEuler | /43/43.cc | UTF-8 | 1,621 | 3.875 | 4 | [] | no_license | /*
The number, 1406357289, is a 0 to 9 pandigital number because it is made up of each of the digits 0 to 9 in some order, but it also has a rather interesting sub-string divisibility property.
Let d1 be the 1st digit, d2 be the 2nd digit, and so on. In this way, we note the following:
d2d3d4=406 is divisible by 2
d3... | true |
6933bd055072a46d65e193138001848a9f2677e0 | C++ | FrancoisGDrouin/IFT-2008-TP1 | /Labyrinthe.cpp | UTF-8 | 19,909 | 2.96875 | 3 | [] | no_license | /**
* \file Labyrinthe.cpp
* \brief Le code des méthodes membres et privés de la classe Labyrinthe.
* \author IFT-2008, Étudiant(e)
* \version 0.1
* \date février 2021
*
*/
//Fichiers à compléter par les autres méthodes de la classe Labyrinthes demandées
#include "Labyrinthe.h"
namespace TP1
{
... | true |
7378b84e566eec69f1b31d29771ee8c1de0ed3ce | C++ | gigatexal/languagestudy | /cs162/project1/project1.cpp | UTF-8 | 2,935 | 3.421875 | 3 | [] | no_license | #include <iostream>
#include <climits>
#include <cstring>
#include <iomanip>
using namespace std;
struct Item {
char name[CHAR_MAX];
unsigned int qty;
double price;
};
template <class T> void get(T &var);
void get(char str[], const unsigned int size);
void UI();
void greeting();
double total(Item items[]);
... | true |
eeef3494893db60c79137dbe2bcdce7299bd1b53 | C++ | bakkot/FIter | /src/FIter.h | UTF-8 | 6,383 | 3.234375 | 3 | [] | no_license | #ifndef FITER_FITER_H
#define FITER_FITER_H
#include <functional>
#include <iterator>
namespace FIter {
// Used to determine which functions a pair of iterator types have in common.
template <class, class>
struct least_iterator_type;
template <> struct least_iterator_type<std::input_iterator_tag, std::input_itera... | true |
0c97ad4d6187c3ce293f95e5d83d6ff4368d5797 | C++ | vaderaparth22/OpenGL | /OpenGL3DTextureSkyBoxCity/src/main.cpp | UTF-8 | 12,266 | 2.796875 | 3 | [] | no_license | #include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "Utils.h"
#include "utils/sdlglutils.h"
#include <vector>
#include <time.h>
#include <iostream>
class Player
{
private:
float posX;
float posY;
float posZ;
public:
void draw()
{
glPushMatrix()... | true |
62f94329a094c9c111be91039d8bd822767239e8 | C++ | lyapple2008/CPlusPlusConcurrencyInAction | /Chapter03/example01/main.cc | UTF-8 | 668 | 3.671875 | 4 | [] | no_license | #include <list>
#include <mutex>
#include <algorithm>
#include <thread>
#include <iostream>
std::list<int> some_list; // 1
std::mutex some_mutex; // 2
void add_to_list(int new_value)
{
std::lock_guard<std::mutex> guard(some_mutex); // 3
some_list.push_back(new_value);
}
bool list_contains(int value_to_f... | true |
6b99b2c85ddf5542ed7b71f5eb0bce1727bda0eb | C++ | CSEKU160212/C_Programming_And_Data_Structure | /Data Structure/OneDimensionalArray/main.cpp | UTF-8 | 1,618 | 3.4375 | 3 | [] | no_license | #include <bits/stdc++.h>
#define n 10
#define m 5
using namespace std;
int main()
{
// data Storing.....
int A[n];
cout<<"Enter the value:"<<endl;
for(int i=0; i<n; i++)
{
cin>>A[i];
}
// print the Array
for(int i=0; i<n; i++)
{
cout<<A[i]<<" ";
}
cout<<... | true |
ccde4bdec4da830133db06bb24377ae66fd94f9b | C++ | filipecn/helios | /helios/core/filter.h | UTF-8 | 6,996 | 2.609375 | 3 | [
"MIT"
] | permissive | /// Copyright (c) 2021, FilipeCN.
///
/// The MIT License (MIT)
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to
/// deal in the Software without restriction, including without limitation the
/// rights to u... | true |
57e8a1b0916fb41a8fce06c3dcc759446adde8d3 | C++ | EliasFloresPerez/Proyectos-C | /recurso.cpp | UTF-8 | 212 | 3.109375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int funcion(int x){
if(x==0){
cout<<x+1<<"+";
return 1;
}
cout<<x<<"+";
return x + funcion(x-1);
}
int main(){
cout<<endl;
cout<<funcion(5);
return 0;
}
| true |
5cbc6705e3630530e5249c502b10566600b4afff | C++ | mleonardallen/CarND-Unscented-Kalman-Filter-Project | /src/main.cpp | UTF-8 | 3,848 | 2.578125 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <vector>
#include <stdlib.h>
#include "Eigen/Dense"
#include "ukf.h"
#include "tools.h"
#include "measurement_package.h"
using namespace std;
using Eigen::VectorXd;
void check_arguments(int argc, char* argv[]) {
string usage_instructions = "Usage instructions: ";
... | true |
6324a6e512df8df26b76ee83893e09430750df6f | C++ | WDMdanila/sgg-os | /src/Ports/Port8Bit.cpp | UTF-8 | 581 | 2.671875 | 3 | [] | no_license | #include "Ports/Port8Bit.h"
Port8Bit::Port8Bit(uint16_t number) : Port(number) {}
Port8Bit::~Port8Bit() {}
void Port8Bit::write(uint8_t data) {
__asm__ volatile("outb %0, %1": :"a"(data), "Nd" (number));
}
uint8_t Port8Bit::read() {
uint8_t result;
__asm__ volatile("inb %1, %0": "=a" (result) : "Nd" (nu... | true |
88650b4c69b7d4e73591b603ee542be2ce459413 | C++ | forceframe/c- | /Over-grade.cpp | UTF-8 | 1,408 | 3.375 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
template<typename T>
void swap(T d[], int x, int y){
T temp = d[x];
d[x] = d[y];
d[y] = temp;
}
template<typename T1, typename T2>
void moveMax2End(T1 d[], T2 v[], int e){
for(int i = 0; i < e-1; i++){
if(d[i] > d[i+1]){
swap(d,i,i+1);... | true |
3612d61a979c94cf9d2468751db7ef205e60cf9b | C++ | LuhJunior/ody-unplugged-framework | /src/Modelo/Menu.hpp | UTF-8 | 544 | 2.625 | 3 | [] | no_license | #ifndef MENU_H
#define MENU_H
#include "../Interface/Console.hpp"
#include "Facede.hpp"
class Menu {
public:
Menu () {}
Menu (string nickname) {
this->console = Console();
this->facede = Facede(nickname);
}
Menu (Facede facede) {
this->console = Console();
this->facede = f... | true |
8fac8c384cce3d7493c53fdc8fda9cfe0cec26b2 | C++ | OriaTori/PizzaOrders | /src/OrderSystem.h | UTF-8 | 1,006 | 2.953125 | 3 | [] | no_license | #pragma once
#include "Pizzeria.h"
#include "Pizza.h"
#include "Margherita.h"
#include "Funghi.h"
enum Pizzerias
{
VENEZIA = 0,
BRAVO,
GRINDTORP
};
enum PaymentMethod
{
PAY_PAL,
CREDIT_CARD,
DOTPAY,
CASH
};
class OrderSystem
{
public:
static OrderSystem& instance();
OrderSystem(O... | true |
44b45bf263d753c06f7505fc3f594452e561d0f6 | C++ | 15831944/CNCMachinSimulator | /src/parserXML/exceptionParserXML.h | UTF-8 | 1,128 | 2.65625 | 3 | [] | no_license | #ifndef EXCEPTIONPARSERXML_H_
#define EXCEPTIONPARSERXML_H_
#include <stdexcept>
#include <exception>
#include <string>
namespace parserXML {
class ExceptionParserXML : public std::exception {
private:
std::string m_Msg;
public:
ExceptionParserXML(const std::string &msg) : m_Msg("ExceptionParserXML::" + msg)... | true |
82e4d820c38699f313b1d14b94fcc708252c8d2e | C++ | abnermneves/alg1 | /tp1/program/main.cpp | UTF-8 | 1,197 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include "vertice.h"
#include "grafo.h"
int main(int argc, char* argv[]){
unsigned int n, m, k, a, b;
char c;
Vertice* v;
Grafo* g = new Grafo();
//se foi executado com um parâmetro, lê do arquivo
if (argc == 2){
std::string line, ... | true |
bc99814da2c581c9f4f75578950c1a2ca616cd86 | C++ | yssource/cli | /cli/name-processor.cxx | UTF-8 | 4,018 | 2.75 | 3 | [
"MIT"
] | permissive | // file : cli/name-processor.cxx
// author : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
#include <set>
#include <sstream>
#include "context.hxx"
#include "name-processor.hxx"
using namespace std;
... | true |
2708e02db03fa8af52d76748e565d23c9536d283 | C++ | nzaouesgi/DonkeyKong-SFML | /Camera.cpp | UTF-8 | 571 | 2.765625 | 3 | [] | no_license | #include "pch.h"
#include "Camera.h"
Camera::Camera(sf::View view){
this->view = view;
}
Camera::~Camera(){}
sf::View Camera::updatePosition(sf::Vector2f mapBorders, float playerXPosition){
this->view.setCenter(playerXPosition, this->view.getCenter().y);
sf::Vector2f size = this->view.getSize();
if ((playerXP... | true |
36c7d82281cf0981c1adbaef66274c737034df72 | C++ | ChoiHeon/algorithm | /02_백준/[15988] 1, 2, 3 더하기.cpp | UTF-8 | 641 | 2.625 | 3 | [] | no_license | // https://www.acmicpc.net/problem/9095
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
using namespace std;
int cache[11];
int solution(int n) {
memset(cache, 0, sizeof(cache));
cache[0] = 1;
for (int i = 1; i <= n; i++) {
for (int k = 1; k <= 3; k++) {
if (i < k)
bre... | true |
def89d9fee2ad5a134f263ab599005f22a26a5e2 | C++ | ajitesh22/Coding-Problems | /climbing-stairs.cpp | UTF-8 | 545 | 3.1875 | 3 | [] | no_license | //https://leetcode.com/problems/climbing-stairs/submissions/
class Solution {
public int climbStairs(int n) {
Integer oneStepBack = 2;
Integer twoStepBack = 1;
Integer currSteps = 0;
if(n==1)
return twoStepBack;
if(n==2)
return oneStepBack;
... | true |
f52bdeaac399417e6a3cd9d1c8b30695ecb003f7 | C++ | KSXGitHub/school-practices | /algorithm-and-data-structures/1.17.hpp | UTF-8 | 1,082 | 3.5 | 4 | [] | no_license |
// Lưu ý:
// * Đây là một file *.hpp, không phải *.cpp nên không thể dịch tạo file *.exe để chạy được
#include <iostream>
using namespace std;
/* TYPES AND CLASSES */
typedef int Data;
struct Node;
struct Stack;
struct Node {
Data data;
Node *next;
};
struct Stack {
Node *head;
};
/* FUNCTION PROTO... | true |
41bee90665d1feec4e1a091538c261386c31c75c | C++ | fromasmtodisasm/parasol | /prslc/Lexer.cpp | UTF-8 | 2,287 | 2.765625 | 3 | [
"BSD-2-Clause"
] | permissive | //
// Created by ARJ on 9/5/15.
//
#include "Lexer.h"
namespace prsl {
using std::get;
SymbolToken _symbolTokens[] = {
SymbolToken(',', COMMA),
SymbolToken('{', L_CURLY),
SymbolToken('}', R_CURLY),
SymbolToken(']', R_BRACKET),
SymbolToken('(', L_PAREN),
SymbolToken(')', R_PAREN),
SymbolToken(':', COLON),
Sy... | true |
99c25772ce2731782fd559073235f3be70a27a57 | C++ | nguyenhoangvannha/01_Study_CPlusPlus | /TongHopCcode/so hoan thien.cpp | UTF-8 | 367 | 2.578125 | 3 | [] | no_license | #include "stdio.h"
#include "conio.h"
#include "math.h"
#include "stdlib.h"
int KT_SHT(int n)
{
int s=0, i=1;
for (i = 1; i < n;i++)
if (n%i == 0) s += i;
if (s <= n) return 1; else return 0;
}
void main()
{
int n;
printf("\n Nhap n: ");
scanf_s("%d", &n);
for (int i = 1; i <= n; i++)
if (KT_SHT(i) == 1) pri... | true |
cb7e3fb92316c43600f806dce9501b025a6a3211 | C++ | wovo/2017-berlin | /blink-templates/pin.hpp | UTF-8 | 280 | 2.625 | 3 | [] | no_license | #include "stm32f103x6.h"
GPIO_TypeDef * port_registers[] = { GPIOA, GPIOB, GPIOC, GPIOD };
template< int port, int pin >
class gpio {
public:
static void set( bool value ){
port_registers[ port ]->BSRR =
0x01 << ( ( pin % 16 ) + ( value ? 0 : 16 ) );
}
}; | true |
8e154f77b779cf49a41db05da1205cc1625e4fcf | C++ | akavasis/ray-tracing-from-the-ground-up | /source/Light/PointLight.hpp | UTF-8 | 559 | 2.515625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Ambient.hpp"
class PointLight: public Ambient{
public:
PointLight(Vector3D location = Vector3D(0), float ls_ = 1.0, RGBColor color_ = 1.0, bool shadows_ = false);
PointLight(PointLight& point);
Vector3D get_location() const;
void set_location(const Vector3D location_);
void... | true |
b0965767af449542174a39e304c065aa895afa07 | C++ | LeonardoPalchetti/LSN_LeonardoPalchetti | /Exercises_01/Es01/main.cpp | UTF-8 | 3,907 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include "random.h"
#include <fstream>
#include <cmath>
using namespace std;
double error(double, double, int); //funzione calcolo errore
int main(){
int M = 10000; //numero totale di tiri
int N = 100; //numero di blocchi
int L = M/N; // numero di tiri in ogni blocco
double n[M]; //def n :=... | true |
d65d37eb1afa312a6e83a24d33d925696bcd20dc | C++ | Jianbo-Huang/Product-search | /pagerank.h | UTF-8 | 9,058 | 2.546875 | 3 | [] | no_license | #ifndef __PAGE_RANK_H
#define __PAGE_RANK_H
#include <sstream>
#include <iostream>
#include <vector>
#include <stdlib.h>
#include <fstream>
#include <map>
#include <set>
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <math.h>
#include <random>
#include <algorithm>
#include... | true |
3fbea5d4c7cddea9ac23216911f365c78002d7d2 | C++ | colormotor/sandbox | /sandbox/lib/tracer.cpp | UTF-8 | 4,838 | 2.59375 | 3 | [
"MIT"
] | permissive | /*
* Tracer.cpp
*
* Created by Daniel Berio on 4/29/13.
* http://www.enist.org
* Copyright 2013. All rights reserved.
*
*/
#include "tracer.h"
namespace cm
{
V2 closestPoint(const V2& a, const V2& b, const V2& p)
{
V2 ap = p - a;
V2 ab = b - a;
float ab2 = ab.x*ab.x + ab.y*ab.y;
floa... | true |
a47a4a479a34fb8aa25a5fce98703681e6e25cf2 | C++ | farzingkh/Occupancy-Grid-Mapping | /src/utility.cpp | UTF-8 | 1,016 | 3.046875 | 3 | [
"MIT"
] | permissive | #include "../include/utility.h"
#include "../include/map.h"
#include <iostream>
#include <math.h>
#include <random>
double utility::get_gaussian_random_number(double mean, double var)
{
// Random Generators
std::random_device rd;
std::mt19937 gen(rd());
// get rangom number from normal distribution
... | true |
522f05414c226eb47790da3e717dcad5bae6403c | C++ | leeseungjoo98/c-plus-plus | /static.cpp | UTF-8 | 510 | 3.53125 | 4 | [] | no_license | //static 멤버 사용
#include <iostream>
using namespace std;
class Person {
public :
int money;
void addMoney(int money) {
this->money += money;
}
static int sharedMoney;
static void addShared(int money) {
sharedMoney += money;
}
};
int Person::sharedMoney = 10;
int main() {
Person::addShared(50); //60
cout <<... | true |
63193b8ec93447b03f59bbcfcbaaea54299aee59 | C++ | amruthr7/Navigation_System | /Navigation_System/src/CPersistentStorage.h | UTF-8 | 1,853 | 2.796875 | 3 | [] | no_license | /***************************************************************************
*============= Copyright by Darmstadt University of Applied Sciences =======
****************************************************************************
* Filename : CPERSISTENTSTORAGE.H
* Author :
* Description :
*
... | true |
79c0f78cab6b4444726e16b11a9c646e2085a25a | C++ | ElisaNgLi/OOP345 | /W2/Text.h | UTF-8 | 708 | 2.921875 | 3 | [] | no_license | /**********************************************************
* Name: Elisa Ng
* Student ID: 136265170
* Seneca email: eng-li@myseneca.ca
**********************************************************/
#ifndef W2_TEXT_H
#define W2_TEXT_H
#include <string>
#include <memory>
using namespace std;
namespace w2 {
class Text ... | true |
e284a01e28e288812e506a1667bd34ef767724e7 | C++ | fourseaLee/algolearn | /redblacktree/redblacktree.hpp | UTF-8 | 11,165 | 3.40625 | 3 | [] | no_license | #ifndef RED_BLACK_TREE_H
#define RED_BLAKC_TREE_H
enum TreeColor
{
RED = 0,
BLACK = 1
};
template<class N>
struct NodeRbt
{
TreeColor color;
N key;
NodeRbt* right;
NodeRbt* left;
NodeRbt* parent;
NodeRbt(TreeColor c, N k, NodeRbt* r, NodeRbt* l, NodeRbt* p):
color(c),key(k),right(r... | true |
9c396022b9caad11e8a3a67c934b8aef98ffe10d | C++ | abhishektrip/SliceBasedVolumeRendering | /Common/UI/atUserInterface.cpp | UTF-8 | 2,659 | 2.796875 | 3 | [] | no_license | #include "atUserInterface.h"
atRenderEngine::atUserInterface::atUserInterface(int width, int height)
{
TwDefine(" GLOBAL fontscaling=5 "); // double the size of all fonts
// Initialize AntTweakBar
if (!TwInit(TW_OPENGL_CORE, NULL))
{
std::cout << "Ant Tweak Bar init failed" << std::endl;
return;
}
// Tell ... | true |
14ded235556fa4d4360b9a7f21b933721d6a7be3 | C++ | witold-gawlowski/octet | /octet/src/examples/example_geometry/example_geometry.h | UTF-8 | 4,254 | 2.90625 | 3 | [] | no_license | ////////////////////////////////////////////////////////////////////////////////
//
// (C) Andy Thomason 2012-2014
//
// Modular Framework for OpenGLES2 rendering on multiple platforms.
//
namespace octet {
/// Scene containing a helix with octet.
class example_geometry : public app {
// scene for drawing helix... | true |
81cd8e140bd403111cae9925465b7fc75a0ce5da | C++ | HhTtLllL/algorithm | /luogu/p1443.cpp | UTF-8 | 1,060 | 2.859375 | 3 | [] | no_license | #include<cstdio>
#include<queue>
#include<cstring>
using namespace std;
struct node
{
int x;
int y;
int step;
};
int a[405][405];
int book[405][405];
queue<node> s;
int next1[8][2] = {{1,2},{2,1},{2,-1},{1,-2},{-1,-2},{-2,-1},{-2,1},{-1,2}};
int main( )
{
int n,m,x,y;
struct node strat;
scanf( "%d%d%d%d",&n,&m,&x... | true |
4cdc5a041c12a818e6ebe5ed58a8dec533516156 | C++ | developer0hye/Algo-0hye | /problems/1003/boj_1003.cpp | UTF-8 | 1,098 | 3.6875 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
vector<pair<int, int>> memo(41);
pair<int, int> zero_one_called(int n)
{
if(memo[n].first != -1 && memo[n].second != -1) return memo[n];
else if(n == 0) return memo[0];
else if(n == 1) return memo[1];
pair<int, int> small_n1 = zero_one_calle... | true |
bae2555de4af4363b8ded2ed0541750ba23cdae9 | C++ | goyeer/complete-cpp-developer-course | /course-source-files/section 12/ArrayStackApp/main.cpp | UTF-8 | 451 | 3.65625 | 4 | [] | no_license | #include <iostream>
#include "ArrayStack.h"
using namespace std;
int main()
{
ArrayStack stack;
ArrayStack stack2;
for (int i = 0; i < 17; i++) //make it get to the limit on last element
{
stack.push(i);
}
while (!stack.isEmpty())
{
stack2.push(stack.pop());
}
cout << "Same orde... | true |
025c05a1cc890cd9b277611f8160ec6cc698eb3f | C++ | taqu/lime | /lframework/resource/ResourceTexture2D.h | UTF-8 | 1,909 | 2.546875 | 3 | [] | no_license | #ifndef INC_LFRAMEWORK_RESOURCETEXTURE2D_H_
#define INC_LFRAMEWORK_RESOURCETEXTURE2D_H_
/**
@file ResourceTexture2D.h
@author t-sakai
@date 2016/11/21 create
*/
#include "Resource.h"
#include <lgraphics/TextureRef.h>
namespace lfw
{
class ResourceTexture2D : public Resource
{
public:
typedef lcore:... | true |
6a28dcdb397fede3c3fc0b035f529a47d285ccd7 | C++ | captainmoha/data_structure_course | /3_arrays/quadraticEquationArr.cpp | UTF-8 | 1,078 | 3.8125 | 4 | [] | no_license | #include <iostream>
#include <math.h>
// getting the roots of a quadratic equation
using namespace std;
double* quadEqn(double a, double b, double c) {
double* values = new double[2];
double x1, x2;
if ((b*b - 4 * a * c) >= 0) {
x1 = (-b + sqrt(b*b - 4 * a * c)) / 2 * a;
x2 = (-b - sqrt(b*b - 4 * a * c)... | true |
fd3ffa4816c36b1d4a07fdae88206a9d33cb4fd5 | C++ | LarsFL/Themaopdracht_Gaming | /MarsRunner/Code/Game engine/Tile systems/Tile.hpp | UTF-8 | 1,218 | 2.921875 | 3 | [] | no_license | #ifndef _TILE_HPP
#define _TILE_HPP
#include <SFML/Graphics.hpp>
#include <memory>
#include "TextureManager.hpp"
#include "Texture.hpp"
class Tile {
private:
std::shared_ptr<Texture> texture;
int textureId;
sf::Sprite sprite;
sf::Vector2f position;
sf::Vector2f size;
TextureManager& manager;
public:
Tile(Text... | true |
c284650a4017a2267ebc97808b10d0cf11baac5c | C++ | xhochy/duckdb | /src/include/storage/column_statistics.hpp | UTF-8 | 1,311 | 2.90625 | 3 | [
"MIT"
] | permissive | //===----------------------------------------------------------------------===//
// DuckDB
//
// storage/column_statistics.hpp
//
//
//===----------------------------------------------------------------------===//
#pragma once
#include "common/common.hpp"
#include "common/types/statistics.hpp"... | true |
f452885c5f4f5da74f632cab7b4053de75b6050f | C++ | avinash625/CodingProblems | /LeetCode/find_bottom_left_tree_value.cpp | UTF-8 | 857 | 3.265625 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
void findLeftValue(TreeNode *root, int *leftValue, int *levelValue,int level){
if(!root... | true |
a2e1f17a78b3a859a336c3fc759d6b14c570f50f | C++ | section14/openframeworks-misc-classes | /trimesh.cpp | UTF-8 | 3,042 | 2.875 | 3 | [] | no_license | #include "trimesh.h"
trimesh::trimesh(int _rows, int _cols, float _width, float _height, int _color)
{
rows = _rows + 1;
cols = _cols + 1;
width = _width;
height = _height;
color = _color;
//calculate height and width
float rowWidth = width / rows;
float colHeight = height / cols;
... | true |
9024dd26c846310e1d474a2708f323cd8160b941 | C++ | FabianKlimpel/AdaptiveProfessor2.2.2 | /include/Professor/ConfigHandler.h | UTF-8 | 1,895 | 2.984375 | 3 | [] | no_license | #ifndef __CONFIGHANDLER__H
#define __CONFIGHANDLER__H
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
/**
* This class handles a config file provided by the user.
* It handles the reading of the file and stores all necessary information in the object.
*/
class ConfigHandler
{
public:
/... | true |
23f1360a2b510f9c363ee7d13ff2491c4a6ae087 | C++ | luas13/Leetcode_New | /src/Median-2-Sorted-Array/Median 2 Sorted Array.cpp | UTF-8 | 3,270 | 3.625 | 4 | [] | no_license | /*
Analysis:
Note that the definition of the Median:
(1) If the size of the sequence N is odd: N/2+1th element is median.
(1) If the size of the sequence N is even: average of the N/2th and N/2+1th element is median.
So in this problem, median of the two sorted arrays is the (m+n)/2+1 th element (if m+n is odd),
the ... | true |
172917fdc76118c385664f0a9aaf1070d39d3da3 | C++ | jaswantcoder/CodingNotes | /MasteringCompetitiveProgrammingQuestions/HOLI.cpp | UTF-8 | 975 | 2.5625 | 3 | [] | no_license | //Holiday Accomodation - Page 46
//https://www.spoj.com/problems/HOLI/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector< pair<ll, ll> > adj[100005];
ll ret = 0;
ll n;
ll dfs (ll par, ll u)
{
ll ans = 1;
for(ll i = 0; i < adj[u].size(); ++i)
{
ll v = adj[u][i].first;
... | true |
7c9831fec6e61314c2dece5900d626107c5155d4 | C++ | CalebeBastos/FontClassifier | /untitled/main.cpp | UTF-8 | 3,650 | 2.609375 | 3 | [] | no_license | ////////////////////////////////////////////////////////////////////
// Constants for Backprop Font Data //
////////////////////////////////////////////////////////////////////
#define FV_IN "norm.sep"
#define NORMALIZE false
#define FONT_DATA true
#define ALPHA 0... | true |
c6d178926f5341d09b1fa003318a0857660770a4 | C++ | rezarastak/CppConstitutive | /test/elastic.cc | UTF-8 | 1,132 | 2.75 | 3 | [
"MIT"
] | permissive | #include "catch.hpp"
#include "constitutive/mech/elastic.h"
using namespace constitutive;
TEST_CASE("Elastic params (lambda, mu)", "[mech]") {
LambdaMu lambda_mu{100., 50.};
REQUIRE(lambda_mu.get_lambda() == 100.);
REQUIRE(lambda_mu.get_mu() == 50.);
REQUIRE(lambda_mu.get_E() == Approx(133.3).epsilon(0.01));... | true |
1a8095da7a1b92f53ee57abadd37e4b289deadc3 | C++ | sayantikag98/Current_Data_Structures_and_Algorithms | /DSA_codes_in_cpp/Interview Prep CC/Pepcoding/online cpp foundation/1. Basics of programming/getting_started/is_a_number_prime.cpp | UTF-8 | 525 | 2.828125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
bool func(int n){
for(int i = 2; i*i<=n; i++){
if(n%i==0) return 0;
}
return 1;
}
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
ios::sync_with_stdio(0);
cin.... | true |
a7c08afbeed47558eac5bf1bc331702996971421 | C++ | StiffLiu/codes | /new/my_binary_search_tree.h | UTF-8 | 61,397 | 3 | 3 | [] | no_license | #ifndef MY_BINARY_SEARCH_TREE_H
#define MY_BINARY_SEARCH_TREE_H
#include "my_ordered_symbol_table.h"
#include <utility>
#include <vector>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <memory>
#include <exception>
namespace my_lib{
template<class K, class V, class BSTNodeTraitsParam, class C = s... | true |
91d38d1c384633c37defaf1ad84aa8ce2869e617 | C++ | beltransen/arduino | /serial_comm/serial_comm.ino | UTF-8 | 358 | 2.953125 | 3 | [] | no_license | /**
Comunicacion por puerto de serie
**/
void setup() {
// Iniciamos conexion con puerto de serie
Serial.begin(19200); // Baudrate correspondiente
}
void loop() {
// Si hay datos para leer, los guardamos y mostramos
if(Serial.available()>0){
char comando = Serial.read();
Serial.print("Recibido: "... | true |
38d5afd5173de4cbd502c34df7c38fc4e8956785 | C++ | 15831944/barry_dev | /src/export_lib/router/Tester/main.cpp | UTF-8 | 9,834 | 2.53125 | 3 | [] | no_license | /*generated by gencode.py
*author: bill xia
*modify history: Ricky Chen 2007.4.3
*/
#include "aosApi.h"
#include <stdio.h>
#include <iostream.h>
int main(int argc,char ** argv)
{
char result[10240];
int ret = 0;
int len = 10240;
int total_case = 0;
int fail_case = 0;
int index=1;
int count=0;
int maxruntim... | true |
58e1851a88ee7e73d533421d4f342d7ef0890762 | C++ | emilianbold/netbeans-releases | /cnd.completion/test/unit/data/org/netbeans/modules/cnd/completion/DotArrowSubstitutionTestCase/bug230101.cpp | UTF-8 | 741 | 3.09375 | 3 | [] | no_license | namespace {
struct MyClass {
void Test() {}
};
template <class T>
struct my_vector {
typedef T* iterator;
};
template <class T>
struct my_foreach_iterator {
typedef typename T::iterator type;
};
template <class Iterator>
struct my_iterator_reference
... | true |
48fde4eb452acb06aeb63400e8b84184ac6bc5db | C++ | emisario/code-block | /matriz.cpp | UTF-8 | 479 | 2.703125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
int i, j, matriz [4][4];
float v[4];
for (i=0;i<=4;i++) {
for (j=0;j<=4;j++) {
cin >> matriz[i][j];
v[i] >= matriz[i][j];
}
}
for (i=0; i<4;i++) {
for (j=0; j<4;j++) {
... | true |
73c1ce10c5863a7be3190a138088a31c487511fe | C++ | Python-aryan/Hacktoberfest2020 | /C++/task_scheduling_problem.cpp | UTF-8 | 845 | 3.53125 | 4 | [] | permissive | #include<iostream>
#include<algorithm>
using namespace std;
struct Task{
char id;
int deadline;
int profit;
};
bool comparison(Task a, Task b){
return (a.profit > b.profit);
}
void printTaskScheduling(Task arr[], int n){
sort(arr, arr+n, comparison);
int result[n];
bool gap[n];
for (int i=0;... | true |
fa3d60060f73c55054880fe1d935653a8a8482ab | C++ | kpyrkosz/visualisation | /inc/graph.hpp | UTF-8 | 756 | 2.90625 | 3 | [] | no_license | #pragma once
#include <vertex.hpp>
#include <edge.hpp>
#include <set>
#include <number_pool.hpp>
namespace model
{
class graph
{
public:
using vertex_collection = std::set<vertex, vertex::less>;
using edge_collection = std::set<edge, edge::less>;
private:
vertex_collection vertices_;
edge_coll... | true |
40fc825555511c50cbf58f528786f059914b0cd0 | C++ | josemonsalve2/SCM | /SCMUlate/include/modules/executor.hpp | UTF-8 | 1,466 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | #ifndef __EXECUTOR_MODULE__
#define __EXECUTOR_MODULE__
#include "SCMUlate_tools.hpp"
#include "control_store.hpp"
#include "timers_counters.hpp"
#include "memory_interface.hpp"
namespace scm {
/** brief: Executors
*
* The cu_executor performs the execution of instructions, usually in
* the form of cod... | true |
af95aa434ed471ba2e8b8b8617cba63a91585ee2 | C++ | yurisantamarina/LeetCode-Solutions | /Solutions/Distinct Subsequences.cpp | UTF-8 | 764 | 2.78125 | 3 | [] | no_license | class Solution {
public:
int countDp(int i, int j, string &s, string &t, vector<vector<int> >& dp){
if(j == (int)t.size()) return 1;
if(i == (int)s.size()) return 0;
if(dp[i][j] != -1) return dp[i][j];
int ans = 0;
if(s[i] == t[j]){
ans = countDp... | true |
69521b13f5aecdee368223b7f22efbfa0ef5a1c0 | C++ | Kodiey/CS2A | /assignment_7/a7_1.cpp | UTF-8 | 7,261 | 3.5 | 4 | [] | no_license | /*
a7_1.cpp
Professor Harden
CS 2A
*/
#include <iostream>
#include <iomanip>
using namespace std;
void getProbsPerSet(int &probsPerSet);
void doOneSet(char operand, int probsPerSet, int &result);
void doOneProblem(char operand, int &score, int maxNum);
void generateOperands(char optr, int &firstNum, int &secondNum,... | true |
a3c7d3380654639cc9e0bb846dbb5542e651c2d9 | C++ | talatynnikA/OS-Labs | /Новая папка (2)/какие-то процессы/Проект2/Проект2/Исходный код2.cpp.txt | WINDOWS-1251 | 5,292 | 3 | 3 | [] | no_license |
#include <iostream>
#include <thread>
int chpb = 0;
using namespace std;
#include <mutex>
#include <condition_variable>
// binary semaphore Pb = ( )
class binsem {
public:
explicit binsem(int init_count = count_max)
: count_(init_count) {}
// P-operation / acquire \, \
void wait()
{
std::unique_lock<... | true |
fad9564d2fc8ef191540ebe0a4ac0f4c647e5b65 | C++ | esantoul/data-management | /include/poly_fun.hpp | UTF-8 | 2,419 | 3.4375 | 3 | [
"BSD-2-Clause"
] | permissive | /**
* Copyright (C) 2020 Etienne Santoul - All Rights Reserved
* You may use, distribute and modify this code under the
* terms of the BSD 2-Clause License
*
* You should have received a copy of the BSD 2-Clause License
* with this file. If not, please visit:
* https://github.com/esantoul/data-management
*/
#... | true |
a7055ef5e131ab97a98cb6170743283dd8a2127b | C++ | AJOO7/ds-gui | /DataStrPro/adminnonveg.cpp | UTF-8 | 3,970 | 2.796875 | 3 | [] | no_license | #include "adminnonveg.h"
#include "ui_adminnonveg.h"
#include<QString>
#include <cstddef>
#include<QMessageBox>
#include<QFile>
#include<QTextStream>
class node_non
{
QString food;
int price;
int no_of_order;
node_non *next;
public:
node_non(QString f,int p)
{
food=f;
... | true |
198fcdc1a0f89e46a3bc6e24db2e108cc7b70e8e | C++ | mirellameelo/opencv_exercises | /Atividade_1/Main.cpp | UTF-8 | 1,036 | 2.625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <stdint.h>
#include <opencv2\opencv.hpp>
#include <opencv2\imgproc.hpp>
using namespace cv;
using namespace std;
const int fps = 20;
int main(int argv, char** argc) {
Mat frame;
Mat frame1, frame2, frame3;
VideoCapture vid(0);
frame = vid.read(frame);
if (!vid.isOpened())
retu... | true |
d70ed8b5aed252961e45f164d49a2510c359759e | C++ | TenFifteen/SummerCamp | /spw_lintcode/099-recoder-list/solve.cc | UTF-8 | 1,941 | 3.90625 | 4 | [] | no_license | /**
* Problem: Given a singly linked list L: L0 → L1 → … → Ln-1 → Ln
* reorder it to: L0 → Ln → L1 → Ln-1 → L2 → Ln-2 → …
* Solve: split, reverse, merge
* Tips: split the in the position half = (n+1)/2; merge two nodes every time
* in order.
*/
/**
* Definition of ListNode
* class ListNode {
* p... | true |
4cbb2915b7ccecdb00646f2303f212bda2ce6d29 | C++ | ICCup02/Programmer | /programm/25/25/25.cpp | UTF-8 | 1,307 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
struct student {
std::string name;
int group;
int sec[5];
};
int main()
{
setlocale(LC_ALL, "RUS");
const int k = 10;
student stud[k] = {};
stud[0] = { "Иванов А.В." , 6, 5,5,5,5,5 };
stud[1] = { "Смирнов Г.Д.", 1, 5,5,5,1,5 };//7
stud[2] = { "... | true |
a3f095210a779f0e5be81071d39612ddd707d1ec | C++ | Cicciodev/esp-telegram-bot | /LED_0_1.ino | UTF-8 | 872 | 3.125 | 3 | [] | no_license | #include<SoftwareSerial.h>
// In order to debug I define a differente serial port for the esp
SoftwareSerial esp(2,3);
String command = "";
void setup()
{
Serial.begin(115200);
esp.begin(115200);
Serial.println("System Ready..");
pinMode(13, OUTPUT);
}
void loop() {
if (esp.available())
{
// Receivi... | true |
7f59448b04166cdc15a1f1a625d7fcd803cb4e80 | C++ | ssdemajia/LeetCode | /IntegerBreak.cpp | UTF-8 | 973 | 3.625 | 4 | [] | no_license | #include "inc.h"
// 343. Integer Break
class Solution {
public:
int integerBreak2(int n) {//使用dp来保存中间状态,即n可以由几个数组合构成
vector<int> dp(n+1, 1);
for (int i = 3; i <= n; i++) {
for (int j =1; j < i; j++) {
dp[i] = max({dp[i], dp[j] * (i-j), j*(i-j)});
}
}
... | true |
348a5ebfde75582025088e4e4de771b961b6d22c | C++ | dendibakh/Misc | /Archivator/src/FolderSnapshotLib/StoreFile.cpp | UTF-8 | 2,935 | 2.921875 | 3 | [] | no_license | #include "StoreFile.h"
#include <fstream>
#include "util.h"
#include <sys/stat.h>
using namespace boost::filesystem;
using namespace std;
StoreFile::StoreFile(const path& fileName, const path& binaryName) : fileName(removeLastSlash(fileName)), binaryName(removeLastSlash(binaryName))
{
try
{
checkExistFi... | true |
d1fcd7c7886a365977de8f74a935a1562761facb | C++ | Kushagra788/algorithms | /merge_sorted_array.cpp | UTF-8 | 958 | 3.8125 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
int merge_two_sorted_arrays(int arr1[], int arr2[], int arr3[], int m, int n) {
int i,j,k;
i = j = k = 0;
for(i=0;i < m && j < n;) {
if(arr1[i] < arr2[j]) {
arr3[k] = arr1[i];
k++;
i++;
} else {
arr3[k] = arr2[j];
k++;
j++;
}
}
while(i < m) {
arr3[k... | true |
61e653f03f0e1b73f993e20ce1b6a05bae9c8003 | C++ | Yorkzhang19961122/CPP_Examples_Tsinghua | /例6-3使用数组名作为函数参数.cpp | UTF-8 | 1,079 | 4.09375 | 4 | [] | no_license | // 例6-3使用数组名作为函数参数.cpp :
//主函数中初始化一个二维数组,表示一个矩阵,并将每个元素都输出,然后调用子函数,分别计算每一行的元素之和,
//将和直接存放在每行的第一个元素中,返回主函数之后输出各行元素的和
#include <iostream>
using namespace std;
void rowSum(int a[][4], int nRow) { //计算二维数组每行元素的和
for (int i = 0; i < nRow; i++) {
for (int j = 1; j < 4; j++)
a[i][0] += a[i][j];
... | true |
51b2f094291227ffb2dda446f98a3b5098d16b5c | C++ | katheroine/languagium | /c++/pointers/operations_on_multidimensional_arrays.cpp | UTF-8 | 309 | 3.40625 | 3 | [] | no_license | #include <iostream>
int main() {
int numbers[][3] = {{1, 2, 3}, {4, 5, 6}};
int (*pi)[3];
pi = numbers;
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 3; j++) {
std::cout << "numbers[" << i << "][" << j << "]: " << *(*(pi + i) + j) << std::endl;
}
}
std::cout << std::endl;
}
| true |
2a7c495046feaf72632e1a5be254b52a7af99d5b | C++ | csugulo/leetcode-solutions | /128_Longest_Consecutive_Sequence/Longest_Consecutive_Sequence.cpp | UTF-8 | 725 | 3.21875 | 3 | [] | no_license | #include "leetcode_solutions.h"
class Solution {
public:
int longestConsecutive(vector<int>& nums) {
if(nums.size() == 0 || nums.size() == 1) return nums.size();
int res = 0;
unordered_set<int> set(nums.begin(), nums.end());
for(int val : nums){
if(!set.count(val)) conti... | true |
fe0d028f7d229755889f315b2f49fa1b8a78e2ed | C++ | wangchenwc/leetcode_cpp | /300_399/362_hit_counter.h | UTF-8 | 815 | 3.046875 | 3 | [] | no_license | //
// 362_hit_counter.h
// cpp_code
//
// Created by zhongyingli on 2018/8/13.
// Copyright © 2018 zhongyingli. All rights reserved.
//
#ifndef _62_hit_counter_h
#define _62_hit_counter_h
class HitCounter {
public:
/** Initialize your data structure here. */
HitCounter() {}
/** Record a hit.
... | true |
61918f2c046c218c25e050707e9882ab0f07fe90 | C++ | shashishailaj/USACO | /Implementations/content/numerical/Polynomials/PolyInv.h | UTF-8 | 659 | 2.625 | 3 | [
"CC0-1.0"
] | permissive | /**
* Description: computes $v^{-1}$ such that
* $vv^{-1}\equiv 1\pmod{x^p}$
* Time: O(N\log N)
* Source: CF, http://people.csail.mit.edu/madhu/ST12/scribe/lect06.pdf
* Verification: https://codeforces.com/contest/438/problem/E
*/
#include "FFT.h"
template<class T> vector<T> inv(vector<T> v, int p) {
v.rsz(... | true |
d37a126cd601dbac45cc03756e5ce5e4ee3ae3fb | C++ | wubin28/KataDocumentEditor | /test/DocumentEditor/DocumentEditorFacade.cpp | UTF-8 | 1,384 | 3.09375 | 3 | [] | no_license | #include "DocumentEditorFacade.h"
DocumentEditorFacade::DocumentEditorFacade(string contents = "") {
for (size_t i = 0; i != ROW_COUNT; ++i) {
for (size_t j = 0; j != COL_COUNT; ++j) {
if ((i * COL_COUNT + j) < contents.size()) {
screenChars[i][j] = contents[i * COL_COUNT + j];
... | true |