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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d8b6f8194ef004a006a9d8bccb0ecb52b07a81b9 | C++ | caomw/CLUE | /tests/test_misc.cpp | UTF-8 | 735 | 3.4375 | 3 | [
"BSD-3-Clause"
] | permissive | #include <clue/misc.hpp>
#include <string>
#include <gtest/gtest.h>
TEST(Misc, MakeUnique) {
using clue::make_unique;
auto p = make_unique<std::string>("abc");
static_assert(std::is_same<decltype(p), std::unique_ptr<std::string>>::value,
"clue::make_unique yields wrong type.");
ASSERT_TRU... | true |
ac8c836a6508fd1f23c8d018dde6da8a59f9c557 | C++ | djl70/cs5346-project2-checkers | /cs5346-project2-checkers/checker_square.h | UTF-8 | 1,038 | 2.734375 | 3 | [] | no_license | #pragma once
#include "checker_piece.h"
#include <SFML/Graphics.hpp>
enum CheckerSquareType
{
kBlackSquare,
kRedSquare,
kCapturedBlack,
kCapturedRed
};
class CheckerSquare
{
public:
CheckerSquare(CheckerSquareType type);
void setPromotionColor(CheckerColor color);
void setPositionOnBoard(const sf::Vector2i&... | true |
74035c0b9a921222e17878a972b97e114e11f3ff | C++ | bvpcsiofficial/BVPCSI-HACKTOBERFEST | /C++/caseSwapper.cpp | UTF-8 | 531 | 4.21875 | 4 | [] | no_license | #include<iostream>
using namespace std;
/*
Program to convert characters
of a string to opposite case
*/
void convertOpposite(string &str) {
int n = str.length();
for (int i=0; i<n; i++){
if (str[i]>='a' && str[i]<='z'){
str[i] = str[i] - 32;
}else if(str[i]>='... | true |
60cdc491461f09ff3b586bf2b66bc5cae84ea262 | C++ | GiuliaLanzillotta/My-ML-exercises | /dijkstraSP.cpp | UTF-8 | 7,296 | 3.75 | 4 | [] | no_license | // Implement a Monte Carlo simulation that calculates the average shortest path in a graph.
// The shortest path algorithm will be Dijkstra’s.
// The application to keep in mind is the representation of a geographical map.
// Author: Giulia Lanzillotta
#include <iostream>
#include <ctime>
#include <forward_list... | true |
372130566359735bea59843f3c3a0e5f524f289a | C++ | ymarcov/Chili | /include/ExitTrap.h | UTF-8 | 465 | 3.03125 | 3 | [] | no_license | #pragma once
namespace Chili {
template <class Callable>
class ExitTrap {
public:
ExitTrap(Callable c) :
_c(std::move(c)) {}
~ExitTrap() {
if (!_cancelled)
_c();
}
void Cancel() {
_cancelled = true;
}
private:
bool _cancelled = false;
Callable _c;
};
... | true |
614bdb0dcc0d0eddc999a4a596411bb77d83fc54 | C++ | ahaddabeh/Linked-List-Calculator | /CalcList.cpp | UTF-8 | 7,092 | 3.21875 | 3 | [] | no_license | #include "CalcListInterface.hpp"
#include "CalcList.hpp"
#include "catch.hpp"
#include <string>
#include <iostream>
#include <iomanip>
#include <sstream>
using namespace std; /*I'm using namespace std because i find it very annoying to type "std::" in front of everything.*/
/*Alaa Haddabeh
USF ID#:... | true |
f40f2c50dc26be255e2022835a5babf42ccf62e6 | C++ | springremember/labReports | /操作系统/实验三:内存页表结构/addProcess.h | UTF-8 | 2,019 | 3.328125 | 3 | [
"Apache-2.0"
] | permissive | #include<iostream>
#include <cmath>
#include<vector>
#include <ctime>
using namespace std;
//用于随机寻找一个物理块保存信息,并返回找到的物理块号。
int setMemoryBlock(int* memoryBlock,int memoryCounter)
{
// for (int i = 0; i < memoryCounter; ++i)
// {
// if (memoryBlock[i]==-1)
// {
// memoryBlock[i]=1;
// return i;
// }
// }
... | true |
cf14aa2e48cf027e41bcfd3c4ef036870eb005fb | C++ | alok760/code | /hackerank/Data Structures/Arrays/arrays-c++.cpp | UTF-8 | 200 | 2.734375 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main() {
int size;
cin>>size;
int arr[size];
for(int i=0;i<size;i++)
cin>>arr[i];
for(int j=size-1;j>=0;j--)
cout<<arr[j]<<" ";
return 0;
}
| true |
0ff31deb3078a4d60afd996fafcfc33247de3c30 | C++ | linardsee/sams_book | /exercises/stl_list_class/ex_4/main.cpp | UTF-8 | 1,212 | 3.921875 | 4 | [] | no_license | /*
*
* Author: Linards Smeiksts
* Last modified: 03.02.2021.
*
* Write a program that sorts and reverses a list of string.
*
*/
#include<iostream>
#include<list>
#include<cstdlib>
#include<ctime>
using namespace std;
void printList(list <int>& theList);
bool comp(const int& first, const int& second);
int... | true |
a3124358fbb34e257dbd7677eac22240cf073dce | C++ | zhangyangru/zyr | /从大到小输出m个选手n个评委最终得分.cpp | GB18030 | 1,332 | 3.1875 | 3 | [] | no_license | #include<stdio.h>
#define M 5
#define N 5
//#define M 5 N 5//дһвԣǰд
int main()
{
float sort_aver(float arr[][N],int x);//һάԲдάдС
float score[M][N],r[M];//rÿλѡֵյ÷,ÿλѡ1ճɼ
int i,j;//nίһѡnɼٶM NͷѾ
float t; //עtӦöΪ
for(i=0;i<M;i++)//mѡ
{
for(j=0;j<N;j++)//nɼ
scanf("%f",&score[i][j]);
r[i]=sort_aver(sc... | true |
f5d436d36e42231a6084fbaf6397b5e988f85f63 | C++ | Mohammed-Shoaib/Coding-Problems | /LeetCode/Solutions/LC0124.cpp | UTF-8 | 668 | 3.296875 | 3 | [
"MIT"
] | permissive | /*
Problem Statement: https://leetcode.com/problems/binary-tree-maximum-path-sum/
Time: O(n)
Space: O(h)
Author: Mohammed Shoaib, github.com/Mohammed-Shoaib
*/
class Solution {
public:
int maxPathSum(TreeNode* root) {
return path_sum(root).second;
}
pair<int, int> path_sum(TreeNode* node) {
// [sum going up, ... | true |
2d2151c288cd364f48882ba0850a02a261aa5642 | C++ | rayaman/DMS | /DMS/value.h | UTF-8 | 3,080 | 2.609375 | 3 | [] | no_license | #pragma once
#include "pch.h"
namespace dms {
struct dms_list;
struct value;
struct dms_args;
struct dms_state;
extern const std::string datatype[];
enum datatypes { escape, nil, number, int64, boolean, env, string, custom, variable, block, error };
// Custom data that you can work with by overriding this code
... | true |
02f4a46ef877ffb04c1f188ce30206f203a27cae | C++ | TheFamousRat/Game-Of-Pen-And-Paper | /src/Classes.h | UTF-8 | 2,760 | 2.6875 | 3 | [] | no_license | #ifndef CLASSES_H_INCLUDED
#define CLASSES_H_INCLUDED
#include "OpenGLRenderer.hpp"
#include "Camera.hpp"
#include <SFML/Graphics.hpp>
#include <queue>
#include <memory>
#include "Nodes.hpp"
#include <TGUI/TGUI.hpp>
#include "NodeSetup.hpp"
#include "Input.hpp"
#define ID_TYPE unsigned int
class S... | true |
05c270fe0a0e752cf517448fa250f5c3e5150ae2 | C++ | greencodespace/code_data | /c_cpp/명품cpp_프로그래밍/chap10/ex10-5-printOverloading.cpp | UHC | 733 | 3.890625 | 4 | [] | no_license | #include <iostream>
using namespace std;
template <class T>
void print(T array [], int n) {
for(int i=0; i<n; i++)
cout << array[i] << '\t';
cout << endl;
}
void print(char array [], int n) { // ø Լ ̸ Լ ߺ
for(int i=0; i<n; i++)
cout << (int)array[i] << '\t'; // array[i] int Ÿ ȯϿ
cout << end... | true |
5a5f6e52ce9d6fd239a2ca61a27245e27ce6ae8b | C++ | grayasm/git-main | /tutorial/andrew_krause_gtk+/07_text_view_widget/iterators.cpp | UTF-8 | 2,536 | 3.078125 | 3 | [] | no_license | #include <gtk/gtk.h>
typedef struct
{
GtkWidget* entry;
GtkWidget* textview;
} Widgets;
void insert_text (GtkButton*, Widgets*);
void retrieve_text (GtkButton*, Widgets*);
int main(int argc, char** argv)
{
gtk_init (&argc, &argv);
GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title ... | true |
cf80f29336bd9ab24cd76bd00b5658ad5954c275 | C++ | RodrigoEstay/Proyecto-IS2 | /Sprint 1_v2_final/Evaluacion.cpp | UTF-8 | 2,767 | 3.25 | 3 | [] | no_license | #include <iostream>
#include "Evaluacion.h"
#include <vector>
#include <set>
#include "ResAp.h"
using namespace std;
Evaluacion::Evaluacion(int nevaluacion){
num_evaluacion = nevaluacion;
int cantidad;
while(1){
if(cin >> cantidad && cantidad > 0){
break;
}
else{
cout << "Por favor ingrese un valor po... | true |
72de130f6061f606ec4cd8e28ea9c520d96a79bf | C++ | kounen/MyGKrellM | /plot/PieChart.cpp | UTF-8 | 3,819 | 2.765625 | 3 | [] | no_license | /*
** EPITECH PROJECT, 2021
** B-CPP-300-LYN-3-1-CPPrush3-lucas.guichard
** File description:
** PieChart
*/
#include "PieChart.hpp"
#include <cmath>
namespace
{
inline float radiansFromDegrees(float degrees)
{
return degrees * 0.0174532925f; // pi/180
}
} // namespace
namespace selbaward
{
PieChart::Slice::Sli... | true |
64a684bb3a34705d8dfd56174cef90e4d9a72832 | C++ | niteshkumardubey/TronBox | /Sim_test2/Sim_test2/Sim_test2.ino | UTF-8 | 1,974 | 2.53125 | 3 | [] | no_license | #include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 3; //four columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
int start=0;
int x;
byte rowPins[ROWS] = {50,51,52,53}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {49,48,47}; ... | true |
d2096ad9c6ed6886f68281489e522eda5ebb0669 | C++ | danleechina/Leetcode | /archive4/153.cpp | UTF-8 | 1,254 | 3.03125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <map>
#include <algorithm>
#include <queue>
using namespace std;
bool myfunction(int i, int j) { return (i < j); }
class Solution
{
public:
int findMin(vector<int> &nums)
{
if (nums.size() == 1)
... | true |
ceb9a6b2d0e200c28e554494bc5f06f919d53601 | C++ | psymonj/MetaSequencer | /SwitchInput.cpp | UTF-8 | 431 | 2.875 | 3 | [] | no_license | #include "Arduino.h"
#include "SwitchInput.h"
SwitchInput::SwitchInput(uint8_t pin1, uint8_t pin2)
{
this->pin1 = pin1;
this->pin2 = pin2;
pinMode(pin1, INPUT_PULLUP);
pinMode(pin2, INPUT_PULLUP);
}
void SwitchInput::poll()
{
uint8_t p1 = ! digitalRead(this->pin1);
uint8_t p2 = ! digitalRead(this->pin2);
... | true |
02ac09667e019007938dba0ade72df23122a9c04 | C++ | DaiYuSs/PAT-Basic-Level-Practice- | /1048 数字加密.cpp | GB18030 | 1,758 | 2.90625 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int main()
{
string s, ss,sum;
int ssize, sssize, j=1;
cin >> s >> ss;
ssize = s.size() - 1; sssize = ss.size() - 1;
if (ssize < sssize)
for (; ssize != sssize; ssize++)s = '0' + s;
else if (ssize > sssize)
for (; ssize != sssize;sssize++)... | true |
cfaf895b041576212a08f2310511a9a708b134dc | C++ | tatiandu/MARP | /Semana Examen - FULL/53.Amazonas/Amazonas.cpp | UTF-8 | 1,952 | 2.90625 | 3 | [] | no_license |
// Tatiana Duarte Balvís
#include <iostream>
#include <fstream>
#include "DigrafoValorado.h"
#include "IndexPQ.h"
class CaminosMin
{
public:
CaminosMin(DigrafoValorado<int> const& g, int orig) :
origen(orig), dist(g.V(), INF), pq(g.V()) {
dist[origen] = 0;
pq.push(origen, 0);
whi... | true |
9f0cca436c8be52562a79bf6b2b0c3b17e9c8b97 | C++ | 1998factorial/leetcode | /virtual contest/contest8/q4/sol.cpp | UTF-8 | 1,370 | 3.203125 | 3 | [] | no_license | /*
Input: dict = ["cat", "bat", "rat"]
sentence = "the cattle was rattled by the battery"
Output: "the cat was rat by the bat"
*/
class Solution {
public:
bool ispre(string& a, string& b){ //T iff a is prefix of b
if(a.size()>b.size())return false;
for(int i = 0; i < a.size(); i++){
if(a[i] != b[i])return fals... | true |
87ed87edd58a3ed30d62be8a1cf7943d2b71714a | C++ | codebysumit/Cpp-Playground | /09-Recursion/05-Print String in Reverse.cpp | UTF-8 | 266 | 3 | 3 | [] | no_license | #include "iostream"
#include "string"
using namespace std;
void reverse (string s){
if(s.length()==0)
return;
string restOfString=s.substr(1);
reverse(restOfString);
cout<<s[0];
}
int main(){
//string str="sumit";
reverse("sumit");
return 0;
} | true |
131aef62cca9ab44de97f4ca49703cad1ab79ba3 | C++ | ClarkMcGrew/edep-sim | /src/kinem/EDepSimSpillTimeGenerator.hh | UTF-8 | 1,996 | 2.703125 | 3 | [
"MIT"
] | permissive | #ifndef EDepSim_SpillTimeGenerator_hh_seen
#define EDepSim_SpillTimeGenerator_hh_seen
#include <vector>
#include "kinem/EDepSimVTimeGenerator.hh"
/// Generate an interaction time according to the spill parameters. This
/// object is created using the EDepSim::SpillTimeFactory where the spill
/// parameters can be s... | true |
9c860f9bc1ca5598293f11f0c4d167fa2846c369 | C++ | ringosimonchen0820/How-to-CPlusPlus | /04-Loops_and_Files/Program_5-4.cpp | UTF-8 | 928 | 3.890625 | 4 | [
"MIT"
] | permissive | // This program assists a technician in the process
// of checking a substance's temperature.
#include <iostream>
using namespace std;
int main()
{
const double MAX_TEMP = 102.5; // Maximum temperature
double temperature; // To hold the temperature
// Get the current temperature.
cout <<... | true |
7483644b084d7fdf576433591af315fd75f7bdcf | C++ | iampkuhz/OnlineJudge_cpp | /src/problems/275-h-index-ii.cpp | UTF-8 | 541 | 3.234375 | 3 | [] | no_license | /*
* 275-h-index-ii.cpp
*
* Created on: Oct 4, 2015
* Author: hanzhe
*/
#include <vector>
using namespace std;
class Solution {
public:
int hIndex(vector<int>& citations) {
int size = citations.size();
if(size <1)
return 0;
int l = 0, r = size - 1;
while(l <= r){
... | true |
fadb4b9970a00b6f2e9cc025a5895b9d66c5c257 | C++ | joka921/QLever | /src/util/Parameters.h | UTF-8 | 9,425 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2021, University of Freiburg,
// Chair of Algorithms and Data Structures.
// Author: Johannes Kalmbach<joka921> (johannes.kalmbach@gmail.com)
#ifndef QLEVER_PARAMETERS_H
#define QLEVER_PARAMETERS_H
#include <atomic>
#include <optional>
#include <tuple>
#include "./ConstexprMap.h"
#include "./ConstexprSm... | true |
7f6667493aa6219209879ad2cec3adaadbe4dc29 | C++ | guyongpu/LeetCode | /src/P0206_ReverseLinkedList.cpp | UTF-8 | 1,381 | 3.671875 | 4 | [] | no_license | //
// Created by yongpu on 2019/10/25 10:40.
//
#include "P0206_ReverseLinkedList.h"
/**
* 题目:反转链表
* 描述:反转一个单链表.
* 思路:定义nodePrev,nodeCurr,nodeNext,每次将nodeCurr->nodePrev,遍历链表,nodePrev为新头节点.
* 备注:重要的题目.
*/
ListNode *P0206_ReverseLinkedList::reverseList(ListNode *head) {
if (head == nullptr || head->next == nu... | true |
8fe7e0a4ff73dde591cec53294527bcd9486ab4c | C++ | amakerclub/LEDPanel | /Arduino/sketch_feb29a/sketch_feb29a.ino | UTF-8 | 2,190 | 2.65625 | 3 | [
"CC0-1.0"
] | permissive | #include <ESP8266WiFi.h>
#define pixelCount 64
const char WiFiAPPSK[] = "aMakerESP8266";
WiFiServer server(80);
bool debug = true;
void setupWiFi()
{
WiFi.mode(WIFI_AP);
// Do a little work to get a unique-ish name. Append the
// last two bytes of the MAC (HEX'd) to "Thing-":
uint8_t mac[WL_MAC_ADDR_LENGT... | true |
b46553aa57e762c0e8cbe9dd760a9d47f355e3a3 | C++ | saich/cpp-practice | /Library/src/utilities.h | UTF-8 | 2,302 | 3.125 | 3 | [] | no_license | #ifndef UTILITIES_H_
#define UTILITIES_H_
#include <string>
#include <sstream>
#include <algorithm>
#include <tr1/memory> // TODO: Remove tr1 and use C++11
/** A macro to disallow the copy constructor and operator= functions.
This should be used in the private: declarations for a class
*/
#define DISALLOW... | true |
7f3c88fbb05aab17547e044ff98405416b9f3240 | C++ | niuxu18/logTracker-old | /second/download/curl/gumtree/curl_old_log_6959.cpp | UTF-8 | 528 | 2.5625 | 3 | [] | no_license | fputs(
" if you can tunnel through the proxy, as one with the -p, --prox-\n"
" ytunnel option.\n"
"\n"
" The proxy host can be specified the exact same way as the proxy\n"
" environment variables, including the protocol prefix (http://)\n"
" and the em... | true |
22d8366a5ff5a1954e995d0a2bb2da5a60e6615f | C++ | MelikEfekan/Image-Processing | /LAB4/edge_detection.cpp | UTF-8 | 9,303 | 2.90625 | 3 | [] | no_license | // header inclusion
#include <stdio.h>
#include <opencv/cv.h> //you may need to
#include <opencv/highgui.h> //adjust import locations
#include <opencv/cxcore.h> //depending on your machine setup
using namespace cv;
#define MAXRADIUS 100
#define MINRADIUS 20
void Sobel(
cv::Mat &input,
int... | true |
36e4baf34dd03324ee6ad65c3f6845a485eb055b | C++ | cu8Fsuz/Kurumi | /client/frameworks/runtime-src/Classes/foundation/GLog.cpp | UTF-8 | 5,414 | 2.59375 | 3 | [] | no_license | #include "GLog.h"
#include "GameMacro.h"
namespace flog
{
#if G_TARGET_SERVER
static const int MAX_LOG_LENGTH = 16 * 1024;
void log_i(const char * format, ...)
{
int bufferSize = MAX_LOG_LENGTH;
char* buf = nullptr;
int nret = 0;
va_list args;
do
{
buf = new (std::nothrow) char[bufferSize];
if (... | true |
b3de472241d627461ecd945b59e299c7d9d1ab9d | C++ | toperkov/WiSe-2018-19 | /instructions/labs/lab-6/receiver/SimpleRX.ino | UTF-8 | 1,346 | 2.671875 | 3 | [] | no_license | // SimpleRx - the slave or the receiver
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define CE_PIN 9
#define CSN_PIN 10
const byte address[][6] = {"1node", "2node", "3node", "4node", "5node"};
RF24 radio(CE_PIN, CSN_PIN);
struct SensorData {
float temp;
float hum;
uint16_... | true |
57ce237bf5f1f5aaea74e89269443c212ee3209a | C++ | heremaps/gluecodium | /gluecodium/src/test/resources/smoke/basic_types/output/cpp/include/smoke/BasicTypes.h | UTF-8 | 1,130 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | // -------------------------------------------------------------------------------------------------
//
//
// -------------------------------------------------------------------------------------------------
#pragma once
#include "gluecodium/ExportGluecodiumCpp.h"
#include <cstdint>
#include <string>
namespace smoke {
... | true |
f83f8d76ea979004f8bcaa1c520f5d5a396cb33e | C++ | PedroFariaa/CGRA | /Projeto/src/ExampleObject.cpp | UTF-8 | 1,952 | 2.71875 | 3 | [] | no_license | #include "ExampleObject.h"
void ExampleObject::draw()
{
glPushMatrix();
glNormal3f(0.0,0.0, 1.0);
glBegin(GL_QUADS);
glTexCoord2d(-0.5, -0.5);
glVertex3d(-0.5, -0.5, 0.5);
glTexCoord2d(0.5, -0.5);
glVertex3d(0.5, -0.5, 0.5);
glTexCoord2d(0.5, 0.5);
glVertex3d(0.5, 0.5, 0.5);
glTexCoord2d(-0.5, 0.5);
glVert... | true |
1fd712fb93be1cfe6bc8eed2249e4bf2ec38b92b | C++ | Shedward/acm | /1327.Fuses.cpp | UTF-8 | 384 | 2.5625 | 3 | [] | no_license |
// Problem: 1327. Fuses
// Url: http://acm.timus.ru/problem.aspx?space=1&num=1327
// Author: Shed (86286AA)
// Language: g++11 (G++ 4.7.2 with C++11)
// Tests: 1327.Fuses.tests
#include <iostream>
int main()
{
int a, b;
std::cin >> a >> b;
int res = (b - a +1)/ 2;
if(a % 2 == 1 and b % 2 == 1) ... | true |
9a9942970b3a9a2e073a607c60c8a1de3f7ec92c | C++ | pyal/eos_cpp | /cpp/EXT/wave++/demos/demoWav.cpp | UTF-8 | 2,460 | 2.53125 | 3 | [] | no_license | //file: demoWav.cc
//Shows some of the functionality of the Wavelet Library, namely:
//we denoise a noisy signal using the nonlinear thresholding algorithm
//of Donoho and Johnstone (D&J). This is done in the context
//of a single wavelet basis (contrast this with what is
//done in demoWavPack.cc)
//math. backgr... | true |
9ee096374b16cde78f7cddb6984a488646f6cf2b | C++ | wondervictor/LeetCode-Solutions | /151-Reverse Words in a String /main.cpp | UTF-8 | 688 | 3.6875 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <stack>
using namespace std;
class Solution {
public:
void reverseWords(string &s) {
string tmp;
stack<string> words;
for(auto ch: s) {
if(ch == ' ') {
if (!tmp.empty())
words.push(tmp);
tmp = "";
} else {
tmp.p... | true |
2d4956a421a8271fd2a537af8c2e421e4b517157 | C++ | chaitanchun/person | /leetcode/LeetCode/148.cpp | UTF-8 | 1,760 | 4.1875 | 4 | [] | no_license |
class Solution {
public:
ListNode *sortList(ListNode *head) {
ListNode *head2;
if (!head || !head->next)
{// if the list is empty or only has one node, just return
return head;
}
else
{// split the list by half, sort each of them and merge the two half l... | true |
7c81a6990ca4a49d26fb22937d5b49906bfa34ec | C++ | YuPeize/LeetCode- | /Array/54. Spiral Matrix.cpp | UTF-8 | 1,386 | 3.1875 | 3 | [
"MIT"
] | permissive | /*
按顺序遍历即可。
author: ypz
*/
class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
vector<int> ans;
if(matrix.size() == 0) return ans;
int row = matrix[0].size();
int col = matrix.size();
int length = col * row;
int i = 0;
int j = 0;
... | true |
59cc548e184a7f11611fb6d11c1389e5b5e33f9c | C++ | DavyVan/PhDStillNeedLeetCode | /problems/506-Relative-Ranks/test.cpp | UTF-8 | 534 | 2.75 | 3 | [] | no_license | #include "kernel.h"
#include <gtest/gtest.h>
TEST(_506, _1)
{
auto expect = vector<string>({"Gold Medal","Silver Medal","Bronze Medal","4","5"});
vector<int> score = {5,4,3,2,1};
Solution S;
auto result = S.findRelativeRanks(score);
EXPECT_TRUE(result == expect);
}
TEST(_506, _2)
{
auto expe... | true |
436e2bda28368091a25dbe8702da555d8ad77121 | C++ | JoanesL/SegmenAnalysis | /SettingsFile.hpp | UTF-8 | 5,981 | 2.890625 | 3 | [] | no_license | //Class definition - SettingsFile
//
//Modified by Joanes Lizarraga (2013/06/21)
//LoopAnalysis
//
//A class desinged to make reading in runtime settings
//easier. Settings are read / written to a file in the
//form: SettingName=SettingValue.
//
//When opening files, or using a constructor to do so,
//a mode should be ... | true |
3309f0ae443026e9da16fd6a1bc224a9786384f8 | C++ | xuweiqiang/LibVRPresent | /Others/subtitile/trunk/build/iOS/LibSubtitle/src/libSUBDecoder/SUBSync.cpp | UTF-8 | 5,774 | 2.53125 | 3 | [] | no_license | #include "SUBSync.h"
#include <stdio.h>
#include <math.h>
#include <assert.h>
#define PCR_VALID_BLUR_TIME 200 //(ms)This value is invalid, come from my mind.
#define INFINITE_SCHEDULE 0xffffffff
#ifdef DEBUG_INFO
//#define _DP_FILE
static void __cdecl DP(LPCSTR szFormat, ...)
{
char szBuffer[256];
... | true |
5d6d9e0759e1f3def5ec84b905dc304c53a2a41b | C++ | AryamanLadha/MiniRogue | /Game.h | UTF-8 | 499 | 2.515625 | 3 | [] | no_license | // Game.h
#ifndef GAME_INCLUDED
#define GAME_INCLUDED
// You may add data members and other member functions to this class.
#include "Actor.h"
#include "Dungeon.h"
class Game
{
public:
Game(int goblinSmellDistance);
~Game();
void play();
void takePlayerTurn(const char x, string& whatHappened);
voi... | true |
dde9288ed121a3fa8f35b3f2845e2bfed640b1bb | C++ | Martin1994/pp9k | /pp9k/PlayerAI4.cpp | UTF-8 | 3,202 | 2.765625 | 3 | [] | no_license | //
// PlayerAI4.cpp
// pp9k
//
// Created by Martin Wang on 2015-07-25.
// Copyright (c) 2015 Martin Chloride. All rights reserved.
//
#include <cstdlib>
#include <ctime>
#include "PlayerAI4.h"
#include "Move.h"
#include "Board.h"
using namespace pp9k;
PlayerAI4::PlayerAI4(pp9k::Game* game, pp9k::Color side) : P... | true |
ea2f527923adf5d6c29f50d67bb35e9b57787542 | C++ | egor-lobashev/moodle_jump | /main.cpp | UTF-8 | 6,791 | 2.90625 | 3 | [] | no_license | #include <SFML/Graphics.hpp>
#include <string>
#include <fstream>
#include "List_of_platforms.h"
#include "Person.h"
#include "Graphics_manager.h"
class Background: public Drawable
{
public:
sf::Texture texture;
sf::Sprite sprite;
Background(const std::string& filename)
{
texture.loadFromFile(filename);
spri... | true |
236a177bf4e2a10ca2a10398ed942c404f532026 | C++ | thecppzoo/zoo | /src/visit.cpp | UTF-8 | 3,384 | 3.015625 | 3 | [
"MIT"
] | permissive | #include "TightPolicy.h"
using Visit = void(*)();
struct TightVisitable;
struct TightVisitPolicy: TightPolicy {
using MemoryLayout = TightVisitable;
using Visit = ::Visit;
};
using VisitableAnyTight = zoo::AnyContainer<TightVisitPolicy>;
std::string to_string(VisitableAnyTight &v);
struct TightVisitable;
... | true |
867d86c16bbd7e289ecbb18a2289c47e3ff14caf | C++ | SYJINTW/EECS2040_Data_structures | /hw3/part1/hw_3_3_queue.cpp | UTF-8 | 1,202 | 3.6875 | 4 | [] | no_license | // Queue
template <class T>
class Queue:public List<T>
{
public:
Queue();
~Queue();
bool IsEmpty();
T& Front();
T& Rear();
void Push(const T& item);
void Pop();
protected:
Node *rear;
};
template <class T>
Queue<T>::Queue():List<T>()
{
Queue<T>::first = rear = 0;
}
template <class ... | true |
85dbd88367d1ca74a6c405324f9c89c94249728e | C++ | bunshue/vcs | /_8.linux/_ctest_linux/YCCSample-source/15/Sample3.cpp | BIG5 | 1,275 | 3.9375 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
//CarOŧi
class Car{
private:
int num;
double gas;
char* pName;
public:
Car::Car(char* pN ,int n, double g);
~Car();
Car::Car(const Car& c);
Car& Car::operator=(const Car& c);
};
//CarO禡wq
Car::Car(char* pN ,int ... | true |
6fbe28e7761150f36892deedd8a2697abe73ed54 | C++ | gorden5566/code-for-gorden | /leetcode/array/singleNumber2.cpp | UTF-8 | 1,449 | 3.390625 | 3 | [] | no_license | /*
* =====================================================================================
*
* Filename: singleNumber2.cpp
*
* Description: single number II
*
* Version: 1.0
* Created: 2014年10月02日 16时39分25秒
* Revision: none
* Compiler: gcc
*
* Author: gorden... | true |
be7cfb98816576ab1cf5f1b13a01b34db8784415 | C++ | nerld/nerld_arduino | /slaves/switch_slave/switch_slave.ino | UTF-8 | 1,097 | 2.828125 | 3 | [] | no_license | // Wire Slave Receiver
#include "NerldProtocol.h"
#include <Wire.h>
NerldProtocol nerldProtocol = NerldProtocol();
int DEFAULT_ADDR = 99;
int ADDR = NULL;
int status = 0;
int LED = 10;
void setup()
{
Serial.println("INFO::setup: Initialising Switch Slave.");
Serial.begin(9600);
pinMode(10, OUTPUT);
digitalW... | true |
902f33812f3aec121af77c8d1a8767277d6d3611 | C++ | linzai1992/websearch | /util/prefix_tree/prefix_tree_unittest.cc | UTF-8 | 2,484 | 2.53125 | 3 | [] | no_license | // Copyright 2014. All Rights Reserved.
// Author: shunpingye@gmail.com (Shunping Ye)
#include <string>
#include <vector>
#include <utility>
#include "util/prefix_tree/prefix_tree.h"
#include "base/flags.h"
#include "base/logging.h"
#include "base/es.h"
#include "thirdparty/gtest/gtest.h"
TEST(PrefixTreeUnittest, te... | true |
09739bc79735a80adf4012df4f5cbb2fe0f52120 | C++ | lulu4747/cpp_piscine | /d04/ex01/Brain.cpp | UTF-8 | 759 | 3.34375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include "Brain.hpp"
Brain::Brain(void){
std::cout << "Brain default constructor called" << std::endl;
for (size_t i = 0; i < 100; i++)
this->_ideas[i] = "";
return ;
}
Brain::Brain(Brain const & src){
std::cout << "Brain copy constructor called" << std::endl;
*this = sr... | true |
d30285ebedae9ac060fe6d32382af52dc24d25f8 | C++ | CMOxygen/cpp_programming | /pract3_2/pract3_2/main.cpp | WINDOWS-1251 | 338 | 3.359375 | 3 | [] | no_license | #include <iostream>
using namespace std;
class A
{
private:
int x;
public:
int y;
};
int main()
{
A ob1, ob2;
ob1.y = 3;
ob2.y = 7;
// ob1.x = 2; . - private
// ob2.x = 5; . - private
cout << ob1.y << " " << ob2.y << endl;
return 0;
}
| true |
984157ad960945f72c4d6d3437bbf8278ae9e3d8 | C++ | Im-Rudra/LightOJ-Solutions | /1025-The-Specials-Menu.cpp | UTF-8 | 620 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
char str[100];
long long dp[100][100];
long long wow(int i, int j)
{
if(j < i) {
return 0;
}
if(i == j ) {
return 1;
}
if(dp[i][j] != -1) {
return dp[i][j];
}
if(str[i] == str[j]) {
return dp[i][j] = 1 + wow(i+1, j) + w... | true |
6779feb2191152c0e693950368f414b674b08f03 | C++ | Chickenbumps/winningCode | /2309.cpp | UTF-8 | 712 | 2.90625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
vector<int> answer;
int flag = 0;
void solve(vector<int> &vv,int index,int sum){
if(index > 9||sum > 100 || answer.size() > 7){
return ;
}
if(sum == 100){
if(answer.size() == 7 && flag == 0){
cout << '\n';
sort(answer.begin(),answer.end());
... | true |
72bafdba2a0bd0edba8366385c2a2857c504f6e4 | C++ | ComputerArchitectureAS/FinishProject | /energia/_2.ino | UTF-8 | 1,997 | 3.171875 | 3 | [
"MIT"
] | permissive | /**
* @version 8 july 2017
* @author Alexey Titov & Shir Bentabou
*/
const int pushButton1 = PUSH1; //button SW1
const int pushButton2 = PUSH2; //button SW2
#define LEDR RED_LED //macro of RED_LED
#define LEDG GREEN_LED //macro of Green_LED
#define LEDB BLUE_LED ... | true |
5d63b45c5a32c7d922b9028faf94b2d51b5a6730 | C++ | zahid26/programs | /reverse of list.cpp | UTF-8 | 1,047 | 3.328125 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include<conio.h>
struct node
{
int data;
node *next;
};
struct node *head=NULL;
void create()
{
char o;
struct node * tail=NULL,*ptr;
do{
ptr=(node*)malloc(sizeof(node));
if(head==NULL)
{
head=ptr;tail=ptr;
}
else
{
tail->next=ptr;
ta... | true |
ff10c3ec5cd07a63d8b77ed7539b048e187f6504 | C++ | x7536110/coding-interviews | /027.cpp | UTF-8 | 703 | 3.375 | 3 | [
"Apache-2.0"
] | permissive | #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
using namespace std;
//输入一个字符串,按字典序打印出该字符串中字符的所有排列。例如输入字符串abc,则打印出由字符a,b,c所能排列出来的所有字符串abc,acb,bac,bca,cab和cba。
class Solution
{
public:
vector<string> Permutation(string str)
{
vector<string> a... | true |
c5a9429ff6f7e2b67a489f1bf9a7e17e61a7a7ca | C++ | delvingdeep/super-spork | /1_basic_programs/2_variables.cpp | UTF-8 | 824 | 4.03125 | 4 | [] | no_license | /* Program specific README
**GOAL
** Writing to the console
** Printing the variables types available in C++
** Printing the sizes of each variable to the console.
** Printing them in the following order:
** int, short, long, char, float, double, bool
**
** Use of the command sizeof(variable type) ie: sizeof(int)
*/
... | true |
74e09b6be61bb45475d241c959153a043d9a0891 | C++ | gyani91/Robotics | /Motion Planning with OMPL/code/launch.cpp | UTF-8 | 5,192 | 2.65625 | 3 | [
"MIT"
] | permissive | #include <ompl/control/ODESolver.h>
#include <ompl/control/Control.h>
#include <ompl/control/spaces/RealVectorControlSpace.h>
#include <ompl/base/spaces/SE2StateSpace.h>
#include "robotplanner.h"
namespace ob = ompl::base;
namespace oc = ompl::control;
#define TIMESTEP 10.0
double rad(double deg)
{
return deg * 3.... | true |
1daade044504b4343d1380b4f0429d34e55e9f72 | C++ | RockyWalls16/YetAnotherMinecraftClone | /src/client/render/light/Light.cpp | UTF-8 | 317 | 2.53125 | 3 | [] | no_license | #include <client/render/light/Light.h>
Light::Light(Color color, float ambiantAmount) : dirty(true), lightColor(color), ambiantAmount(ambiantAmount)
{
}
void Light::setColor(Color color)
{
lightColor = color;
dirty = true;
}
void Light::setAmbientAmount(float amount)
{
ambiantAmount = amount;
dirty = true;
}
| true |
e43aca8eecf766cef3e4682186158534a4ae78a3 | C++ | I-Venkatesh/Data-structures-and-algorithms | /Miscellaneous/MonotonicStack.cpp | UTF-8 | 505 | 2.8125 | 3 | [] | no_license | class Solution {
public:
vector<int> canSeePersonsCount(vector<int>& heights) {
int n=heights.size();
vector<int> ans(n);
stack<int> st;
for(int i=n-1;i>=0;i--){
ans[i]=0;
while(!st.empty()&&st.top()<heights[i])
{
ans[i]++;
... | true |
392a3fd2930e2fabdf41a549a5ee1e6e48a90ea4 | C++ | baines/libNRG | /include/nrg_bit_io.h | UTF-8 | 3,004 | 2.734375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Zlib"
] | permissive | /*
LibNRG - Networking for Real-time Games
Copyright (C) 2012-2014 Alex Baines <alex@abaines.me.uk>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyo... | true |
58d0a41e2dc8116d5fe3050221054f6d088405a4 | C++ | KimSeonBin/algo_practice | /acmicpc/10816.cpp | UTF-8 | 1,263 | 2.59375 | 3 | [] | no_license | #include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> card;
vector<int> rr;
int main() {
int n = 0;
scanf("%d", &n);
int temp = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &temp);
card.push_back(temp);
}
sort(card.begin(), card.end());
int t = 0;
scanf("%d", &t);
in... | true |
4bf56650254dea2c71371b0ebb6b92fe30fd8a1e | C++ | ay2306/Competitive-Programming | /SPOJ/TRICOUNT.cpp | UTF-8 | 204 | 2.828125 | 3 | [] | no_license | #include<iostream>
int main(){
int t;
std::cin >> t;
while(t--){
long long int n;
std::cin >> n;
std::cout << (n*(n+2)*(2*n+1) - (n%2))/8 << "\n";
}
return 0;
} | true |
b203b1866728e85df02133791d03712bee6e2bc3 | C++ | lsqypro/PAT_Advanced | /1094 The Largest Generation (25分).cpp | UTF-8 | 1,830 | 3.5 | 4 | [] | no_license | /* 1094 The Largest Generation (25分)
* 1. 单词
* largest population 人数最多的
* pedigree tree 谱系树
* presented 表示 提出(present的过去分词);呈递,提供
* hierarchy n. 层级;等级制度
* A family hierarchy is usually presented by a pedigree tree where
* representing 表示
* For the sake of simplicity 为了简单起见
* corresponding 相应的
* 2. 题意理... | true |
6ae45702aec8227931e69a9bfda036f82cb73fba | C++ | Genocidicbunny/TimewhaleEngine | /include/BinaryFileResource.h | UTF-8 | 948 | 2.546875 | 3 | [
"MIT"
] | permissive | // Binary File Resource Header
#pragma once
#ifndef __BINARYFILE_H
#define __BINARYFILE_H
#include "IResource.h"
namespace Timewhale
{
//enum FILE_POS {WHALE_BEGIN = SEEK_SET, WHALE_CURR = SEEK_CUR, WHALE_END = SEEK_END};
class twFile : public twResource
{
friend class WhaleFile;
private:
uint32_t _file_si... | true |
49236e2860b6942782e3a55e2c9de3288baca89b | C++ | TalkingPanda0/100-days-of-code | /Month-4/Week-14/day-98/c++/main.cpp | UTF-8 | 1,695 | 2.703125 | 3 | [] | no_license | /**
* DAY-98 C++ version
*
* Just run 'make' to compile and run all the tests
*/
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "../../../../dependencies/c++/doctest.h" //https://github.com/onqtam/doctest
#define CPPHTTPLIB_OPENSSL_SUPPORT //SSL support is available with CPPHTTPLIB_OPENSSL_SUPPORT. libssl a... | true |
fa572c1d25ba0b238d45f2e82da707f48ab499a9 | C++ | adamransom/barely_engine | /src/gfx/textured_quad.cpp | UTF-8 | 5,341 | 2.765625 | 3 | [
"MIT"
] | permissive | //
// gfx/textured_quad.cpp
// Copyright (c) 2015 Adam Ransom
//
#include "textured_quad.h"
#include "texture.h"
namespace BarelyEngine {
const BarelyGL::VertexAttributeArray TexturedQuad::kAttributes_(
{
BarelyGL::VertexAttribute::Position, BarelyGL::VertexAttribute::UV,
BarelyGL::VertexAttribute::Color
});
Tex... | true |
23229e87402ab7800eb4360b5f22ce4390ab8f6f | C++ | Acedyn/ComputeShader | /src/game/Scene_024_TerrainErosion.h | UTF-8 | 1,802 | 2.5625 | 3 | [
"MIT"
] | permissive | //
// Created by simon on 15/04/2021.
//
#ifndef Scene_024_TerrainErosion_H
#define Scene_024_TerrainErosion_H
#include "../engine/Scene.h"
#include "../engine/Assets.h"
#include <vector>
constexpr int TEXTURE_SIZE = 2048;
constexpr int ITERATION = 30000;
class Scene_024_TerrainErosion : public Scene {
public:
... | true |
3fcc63a44c3dbd36b1f8265c63d35cb5a6939f65 | C++ | hilleri123/UIR | /main_task/program/space/functions/sources/combinator.cpp | UTF-8 | 2,693 | 2.53125 | 3 | [] | no_license |
#include "combinator.h"
std::vector<PartOfFunction>* combine(const std::vector<std::pair<Point, Velocity>>& points)
{
using PF = PartOfFunction;
auto& result = *new std::vector<PF>();
PF* part;
//std::cout << "Combine" << std::endl;
my_log::log_it(my_log::level::info, __FUNCTION_NAME__, "Combine");
for (auto... | true |
dc6d5a645558e6be4923094e4c633367960b8901 | C++ | oliverjakobs/Frost | /Frost/src/Ignis/Core/Texture.cpp | UTF-8 | 2,493 | 2.734375 | 3 | [
"MIT"
] | permissive | #include "Texture.h"
#define STB_IMAGE_IMPLEMENTATION
#include "Ignis/Packages/stb_image.h"
namespace ignis
{
Texture::Texture(int width, int height, TextureConfig config)
: m_width(width), m_height(height), m_rows(1), m_columns(1), m_activeSlot(0), m_config(config)
{
m_name = CreateTexture2D(width, height, nul... | true |
210a248fbf751888212bf6988347e83a516fe844 | C++ | lowkey42/mirrage | /src/mirrage/gui/include/mirrage/gui/debug_ui.hpp | UTF-8 | 2,548 | 2.640625 | 3 | [
"MIT"
] | permissive | /** Console and UI elements for debugging ************************************
* *
* Copyright (c) 2018 Florian Oetke *
* This file is distributed under the MIT License *
* ... | true |
323d548f9bdc4afb103c39539538e66ce8071de8 | C++ | Vuean/ThinkingInCPlusPlus | /3. The C in C++/43_PointerIncrement.cpp | UTF-8 | 361 | 2.875 | 3 | [] | no_license | // C03:43_PointerIncrement.cpp
#include <iostream>
using namespace std;
int main()
{
int i[10];
double d[10];
int *ip = i;
double *dp = d;
cout << "ip = " << (long*)ip << endl;
ip++;
cout << "ip = " << (long*)ip << endl;
cout << "dp = " << (long*)dp << endl;
dp++;
cout << "dp =... | true |
5c77f1106a69d4278973cf5ab1a95d6a63d17198 | C++ | ShadowsGtt/IM-Server | /server/src/Types.h | UTF-8 | 549 | 2.84375 | 3 | [] | no_license | #ifndef _TYPES_H
#define _TYPES_H
#include <stdint.h>
#include <cstring>
#include <string>
#include <assert.h>
using namespace std;
inline void memZero(void* p, size_t n)
{
memset(p, 0, n);
}
template<typename To, typename From>
inline To implicit_cast(From const &f)
{
return f;
}
template<typename To, type... | true |
1246b3e11213732e84e55eae087832bae8496bc6 | C++ | nomadeel/cryptopals-challenge | /set2/challenge_10.cpp | UTF-8 | 4,240 | 2.890625 | 3 | [] | no_license | #include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include "cryptopp/cryptlib.h"
#include "cryptopp/base64.h"
#include "cryptopp/hex.h"
#include "cryptopp/filters.h"
#include "cryptopp/aes.h"
#include "cryptopp/modes.h"
#define TEST_CBC 0
std::string xor_strings(std::string &a, std::string &... | true |
ea1aa81dc35a374d49585a05552c54ac0188f65e | C++ | ZeroXCn/sLib | /sCore/SBigInteger.cpp | GB18030 | 9,074 | 3.34375 | 3 | [] | no_license | #include "SBigInteger.h"
using namespace std;
const SBigInteger SBigInteger::ZERO = SBigInteger(0);
const SBigInteger SBigInteger::ONE = SBigInteger(1);
const SBigInteger SBigInteger::TEN = SBigInteger(10);
SBigInteger::SBigInteger()
{
sign = true;
}
SBigInteger::SBigInteger(int val){// construct with a int integ... | true |
e311622bca69d624842e38653ea793fff99c3621 | C++ | alepeculio/Obligatorio6 | /DtFecha.cpp | UTF-8 | 456 | 2.90625 | 3 | [] | no_license | #include "DtFecha.h"
DtFecha::DtFecha(int dia, int mes, int anio) {
this->dia = dia;
this->mes = mes;
this->anio = anio;
}
int DtFecha::getDia() {
return dia;
}
int DtFecha::getMes() {
return mes;
}
int DtFecha::getAnio() {
return anio;
}
ostream& operator<<(ostream& o... | true |
a376697d647afeb5ea3b847102ffabdad5476d63 | C++ | stlcours/asteria | /asteria/src/runtime/variable.hpp | UTF-8 | 1,799 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | // This file is part of Asteria.
// Copyleft 2018 - 2021, LH_Mouse. All wrongs reserved.
#ifndef ASTERIA_RUNTIME_VARIABLE_HPP_
#define ASTERIA_RUNTIME_VARIABLE_HPP_
#include "../fwd.hpp"
#include "../value.hpp"
namespace asteria {
class Variable final
: public Rcfwd<Variable>
{
public:
enum State : uint8_... | true |
36d65669db097ae297ff0cff1cc9f4ec83cddeff | C++ | Turanic/HNStat | /src/tools/logger.hh | UTF-8 | 1,197 | 2.59375 | 3 | [] | no_license | #pragma once
/* Custom logging library.
*
* Remark: LOG macro is disabled on release builds. */
#ifndef NDEBUG
#define LOG(...) \
do \
{ ... | true |
d15f4463d284df55e87d8e50645f87b91575fdb4 | C++ | renzov/Red_Crown | /Live Archive/6651.cpp | UTF-8 | 1,709 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <map>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <numeric>
#define repn( i , a , b ) for( int i = ( int ) a ... | true |
2edb3a1557d3c0b1320c25a7f12363486b844ee6 | C++ | smsutherland/Totris | /Totris/src/Tetris/BagQueue.h | UTF-8 | 578 | 2.890625 | 3 | [] | no_license | #pragma once
#include <algorithm>
#include "FixedSizeQueue.h"
#define TetraminoO 0
#define TetraminoI 1
#define TetraminoT 2
#define TetraminoL 3
#define TetraminoJ 4
#define TetraminoS 5
#define TetraminoZ 6
#define TetraminoNone 7
typedef unsigned char Tetramino;
class BagQueue {
private:
FixedSizeQueue<Tetrami... | true |
f19ecfa6869d631de85ebd77162a45e7508b5468 | C++ | Shashank1816/CP | /B_Partial_Replacement.cpp | UTF-8 | 1,217 | 3.0625 | 3 | [] | no_license | #include<iostream>
#include<map>
#include<string>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n,k;
cin>>n>>k;
string s;
cin>>s;//. & *
//distance b/w any 2 neighboring * characters does not exceed k
//out put the minimum number of * c... | true |
51106ccc7081260e8b2583ef23d1367841642ad0 | C++ | BrandtRobert/OnionRouter | /~connection.h | UTF-8 | 1,008 | 2.828125 | 3 | [] | no_license | #ifndef CONNECTION_H
#define CONNECTION_H
#include <string>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <ifaddrs.h>
using namespace std;
#define VERSION_NUM 1
class Connection {
public:
string wait_... | true |
29c48e5c507df8eda79ce226edbc9cc151a1b42c | C++ | rischimart/part | /Part/GDsl/GBTree.cpp | UTF-8 | 2,507 | 3.171875 | 3 | [] | no_license | #include <cassert>
template <class TNode>
GDList<TNode>* GBTree<TNode>::infixOrder()
{
GDList<TNode>* L = new GDList<TNode>;
traverseInfix(*_root, L);
_root = 0;
return L;
}
// Recusive version. Too slow?
template <class TNode>
void GBTree<TNode>::traverseInfix(TNode& node, GDList<TNode>* L)
{
GDList<TNode>... | true |
6fd614c59230a884d8e878103587f06803efc205 | C++ | zhanghongyang0927/swcloudtv | /src/porting_layer/src/mac/Semaphore.cpp | UTF-8 | 2,568 | 2.6875 | 3 | [] | no_license | ///
/// \copyright Copyright © 2017 ActiveVideo, Inc. and/or its affiliates.
/// Reproduction in whole or in part without written permission is prohibited.
/// All rights reserved. U.S. Patents listed at http://www.activevideo.com/patents
///
#include <porting_layer/Semaphore.h>
#include <porting_layer/Log.h>
#include... | true |
ae32dfb227e2fff4a98bb0830b4b7d9ea4c4732c | C++ | johnbarton/ACE | /src/qGenTest.h | UTF-8 | 4,153 | 2.65625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #ifndef QGENTEST_H
#define QGENTEST_H
#include <iostream>
#include <string>
#include "tools.h" // Numerical tools
// This class holds the parameters needed for running the model validation routine
class RunParameters {
public:
std::string directory; // Path to the directory where the inut file is ... | true |
614db101a79d91657b636735f5f69a8d33d4b1d0 | C++ | appendix19/Conway-s-Game-of-Life | /Conway's Game of Life/Conway's Game of Life/Field.cpp | WINDOWS-1250 | 6,764 | 2.796875 | 3 | [] | no_license | #include "Field.h"
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <windows.h>
#include "heap_monitor.h"
#include <windows.h>
#include <thread>
#include <mutex>
#ifdef _WIN32
#define CLEAR "cls"
#else //In any other OS
#define CLEAR "clear"
#endif
Field::Field ... | true |
e93e950e53f27e20d5841cd6935c5b65dd89e593 | C++ | ternovandarius/Object-Oriented-Programming | /Lab Test 2/UI.cpp | UTF-8 | 1,557 | 3.546875 | 4 | [] | no_license | #include "UI.h"
UI::UI(Controller c) {
this->c=c;
}
void UI::run() {
bool ok=true;
while(ok==true)
{
std::cout<<"1.Add car.\n2.Display all cars.\n3.Save to file all cars cheaper than a given price.\n4.Exit.\n";
int x;
std::cin>>x;
if(x==4)
ok=false;
... | true |
5518bccc4d2876ead334e9827302c536f2b48ded | C++ | franjon11/sisop-tp2 | /source/includes/Queue.h | UTF-8 | 1,183 | 3.59375 | 4 | [] | no_license | #ifndef _QUEUE_H
#define _QUEUE_H
#include "includes.h"
#define QUEUE_NOT_READY 0
#define FULL_OF_NERDS 1
#define FULL_OF_SERFS 2
#define NERDS_AND_SERFS 3
class Queue{
private:
int nerds = 0;
int serfs = 0;
public:
int getNerds();
int getSerfs();
void addNerd();
void addSerf();
void re... | true |
1e144fc36860e43ab5f59af2af6cf2e0b0e97113 | C++ | Yashverma7089/Important-Questions-of-Array | /Linear_search_in_array.cpp | UTF-8 | 635 | 4.15625 | 4 | [] | no_license | // write a C++ program to perform the linear search in 1-D array
#include<iostream>
using namespace std;
int linearSearch(int array[],int n, int key)
{
for(int i=0; i<n; i++)
{
if(array[i]==key)
{
return i;
}
}
return -1;
}
int main()
{
int n;
cout<<"Enter the size of an array:... | true |
f539ba921a0d45afac06c15b2b7fdbe7032e1f28 | C++ | BackupTheBerlios/breeze-svn | /trunk/libs/breeze/test/instrumented_pass_1.cpp | UTF-8 | 1,892 | 2.625 | 3 | [
"BSL-1.0"
] | permissive | //
// Copyright (c) 2005 João Abecasis
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
////////////////////////////////////////////////////////////////////////////////
//
// Type: run-pass
//
// Veri... | true |
bfa519234ce39e564971369e1803a548a57500fa | C++ | MorgesHAB/ThunderLoon | /main.cpp | UTF-8 | 4,526 | 2.796875 | 3 | [] | no_license | /*
Original code by : https://github.com/Snootlab/lora_chisterapi
Edited by : Philippe Rochat & Lionel Isoz
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <RH_RF95.h>
RH_RF95 rf95;
#define GPSTIME 0
#define SPEED 1
#define LONGITUDE 2... | true |
c2b75fc70ef89a981619006f68c9fafd90554e5b | C++ | yanqili/leetcode | /56.merge-intervals.cpp | UTF-8 | 2,579 | 3.203125 | 3 | [] | no_license | /*
* @lc app=leetcode id=56 lang=cpp
*
* [56] Merge Intervals
*
* https://leetcode.com/problems/merge-intervals/description/
*
* algorithms
* Medium (35.62%)
* Total Accepted: 347.1K
* Total Submissions: 974.6K
* Testcase Example: '[[1,3],[2,6],[8,10],[15,18]]'
*
* Given a collection of intervals, merg... | true |
8943f0fa593e0717f9181df7da83addeefe08c3b | C++ | agazibaric/GP-Image-Processing | /cartesian/Ramp.h | UTF-8 | 939 | 3.25 | 3 | [] | no_license | #ifndef CARTESIAN_RAMP_H
#define CARTESIAN_RAMP_H
#include "Function.h"
namespace cartesian {
template <typename Container, typename Result>
class Ramp : public Function<Container, Result> {
public:
Ramp();
~Ramp() = default;
void evaluate(const Container& container, Result& result) ... | true |
61ce6a585d1029a4c1de9d62ff022a7041088e56 | C++ | willfong/Gardening_demo_Arduino | /class/Ex5/Ex5.ino | UTF-8 | 1,388 | 2.5625 | 3 | [] | no_license | // Example 5
// Temperature Sensor
#include <Wire.h>
#include <SeeedOLED.h>
#include "Arduino.h"
#include "SI114X.h"
#include "DHT.h"
#define ButtonPin 2
int ButtonFlag = 0;
SI114X SI1145 = SI114X();
#define DHTPIN A0
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
// put your setup c... | true |
079db2bcb7026700d249b42634bb6ad4e04e5065 | C++ | sophicstudios/aegis | /src/agt/agta/agta_mesh.cpp | UTF-8 | 9,418 | 2.78125 | 3 | [] | no_license | #include <agta_mesh.h>
#include <aftl_logger.h>
namespace agta {
namespace {
char const* const translateGLenum(GLenum value)
{
switch (value) {
case GL_NO_ERROR: return "GL_NO_ERROR";
case GL_INVALID_VALUE: return "GL_INVALID_VALUE";
case GL_INVALID_ENUM: return "GL_INVALID_VALUE";
case GL_INVALI... | true |