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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b21bad33411ba1a55ca5e24cdca8df06401ade07 | C++ | iceseyes/mlogo | /src/interpreter.hpp | UTF-8 | 4,793 | 3 | 3 | [] | no_license | /**
* @file: interpreter.hpp
*
* created on: 1 settembre 2017
* author: Massimo Bianchi <bianchi.massimo@gmail.com>
*/
#ifndef __INTERPRETER_HPP__
#define __INTERPRETER_HPP__
#include <boost/algorithm/string.hpp>
#include <iostream>
#include <stdexcept>
#include <string>
#include "defines.hpp"
#include "... | true |
19a91049383f4474da5c485a505cc5067526f66d | C++ | diverjoe/TasmotaSlave | /examples/SlaveRespondTele/SlaveRespondTele.ino | UTF-8 | 2,785 | 2.890625 | 3 | [] | no_license | /*
SlaveRespondTele.ino - Example for TasmotaSlave to respond to SlaveSend ON and
SlaveSend OFF commands via console or telemetry.
In this example the ON and OFF is case sensitive so needs
to be sent in capital letters from the Tasmota device.... | true |
7be66d18e843a3f34a1b7dd7ca85e789f87940e2 | C++ | Yen/LysOld | /Client/src/graphics/graphicsprofile.hpp | UTF-8 | 505 | 2.578125 | 3 | [] | no_license | #pragma once
#include <GL\glew.h>
#include <string>
namespace lys
{
class GraphicsProfile
{
private:
std::string _vendor;
std::string _renderer;
std::string _version;
unsigned short _maxTextureSlots;
unsigned short _maxSamples;
public:
GraphicsProfile();
const std::string &getVendor() const;
co... | true |
f240103dfca138eb61f76f1bccd5fa736137bb95 | C++ | ih8mylyf/Mergesort | /Mergesort.cpp | UTF-8 | 1,170 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <cassert>
using namespace std;
void msort(int a[], int x[], int s, int e) {
if(e-s > 1){
int m = (s+(e-1))/2;
msort(a, x, s, m+1);
msort(a, x, m+1, e);
int j = s;
int c = m+1;
int t = s;
while(j < m+1 && c < e){
if(a[j] >= a[c]) x[t++] = a[c++];
else x[t++] = a[j+... | true |
72a4a78e57dfdc892f02b0ed3fcb3a503aaceaa2 | C++ | LayicheS/algorithm_cpp | /[牛客] 反转链表.cpp | UTF-8 | 941 | 3.34375 | 3 | [] | no_license | #include <iostream>
#include<map>
#include<vector>
#include<string>
#include<regex>
#include<queue>
#include<stack>
using namespace std;
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {
}
};
ListNode* ReverseList(ListNode* pHead) {
if(!pHead)
... | true |
e84a7408c0e308db8c0430d27f5aae551f491554 | C++ | MarceloPaganini/exercicios_c | /exercicio23.cpp | ISO-8859-2 | 817 | 2.609375 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <math.h>
#include <conio.h>
#include <iostream>
int main()
{
float tempo, distancia, litros_usados;
int veloc;
setlocale(LC_ALL, "PORTUGUESE");
printf("\t\t\n * Exercicio 23 - Quantidade de litros de combus... | true |
816ade034d343575796349fcf6ef4345705c75ee | C++ | zhangchunbao515/leetcode | /leetcode-01/cpp/leetcode/168. excel-sheet-column-title.cpp | GB18030 | 395 | 2.921875 | 3 | [] | no_license | #include "public.h"
//simple solution 4ms, 87.86%
//ѧ
class Solution {
public:
string convertToTitle(int n) {
//ͣس26
//!
string res = "";
while (n > 0)
{
if (n % 26 == 0)
{
res.insert(res.begin(), 'Z');
n /= 26;
n--;
}
else
{
res.insert(res.begin(), n % 26 + 'A' - 1);
n /... | true |
65d9f40719fe1681953bf0c358ee1befe5809b06 | C++ | megrad79/Udacity_RoboSE_P5_HomeServiceRobot | /src/pick_objects/src/pick_objects.cpp | UTF-8 | 1,796 | 2.515625 | 3 | [] | no_license | #include <ros/ros.h>
#include <move_base_msgs/MoveBaseAction.h>
#include <actionlib/client/simple_action_client.h>
typedef actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction> MoveBaseClient;
int main(int argc, char** argv){
ros::init(argc, argv, "pick_objects");
//tell the action client that we want to... | true |
583ebc7f04dcde277ef2198b5193580b7a1b909a | C++ | slanden/basicAI | /Graph.cpp | UTF-8 | 3,371 | 2.578125 | 3 | [] | no_license | #include "Graph.h"
#include "Solver.h"
#include <iostream>
unsigned int Graph::addNode(const vec2 &pos)
{
if (m_nNodes == m_maxNodes) return -1;
m_positions[m_nNodes] = pos;
m_nNodes++;
return m_nNodes -1;
}
bool Graph::setEdge(unsigned int nid1, unsigned int nid2, float weight)
{
if (nid1 >= m_nNodes || nid2 ... | true |
5736d976e15729ffffca9cf30c861d2e87040b21 | C++ | MasterHoracio/Uva | /10062/10062.cpp | UTF-8 | 2,141 | 3.140625 | 3 | [] | no_license | #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
struct par{
int ASCII;
int frequency;
};
bool cmp(par x, par y){
if(x.frequency < y.frequency)
return true;
return false;
}
bool cmpf(par x, par y){
if(x.ASCII > y.ASCII)
... | true |
f35860eae633472461a2872f0529a4f42d1e214b | C++ | dh434/leetcode | /tree/572. 另一个树的子树.cpp | UTF-8 | 1,341 | 3.734375 | 4 | [] | no_license | /*
给定两个非空二叉树 s 和 t,检验 s 中是否包含和 t 具有相同结构和节点值的子树。s 的一个子树包括 s 的一个节点和这个节点的所有子孙。s 也可以看做它自身的一棵子树。
示例 1:
给定的树 s:
3
/ \
4 5
/ \
1 2
给定的树 t:
4
/ \
1 2
返回 true,因为 t 与 s 的一个子树拥有相同的结构和节点值。
示例 2:
给定的树 s:
3
/ \
4 5
/ \
1 2
/
0
给定的树 t:
4
/ \
1 2
返回 false。
*/
/**
*... | true |
8e4c51c185387cb0bbb5bef8e43d3768e62e4572 | C++ | NixSane/OpenGL-Renderer | /Graphics Engine/Mesh.cpp | UTF-8 | 2,871 | 2.921875 | 3 | [] | no_license | #include "Mesh.h"
Mesh::Mesh(Vertex a_vertices[], int a_index[])
{
/** Generate IDs to access the objects **/
glGenVertexArrays(1, &vao);
glGenBuffers(1, &vbo);
glGenBuffers(1, &ibo);
/** Bind the Objects and buffers that are going to be drawn **/
/** And allocate the geometry and construction data in the cu... | true |
6e744f77ee6dbdcf96f5e31756fff2aae2b3cd54 | C++ | wexpect/udacity_self_driving_car_nanodegree | /5_planning/1_behavior_plannng/16_implement_a_second_cost_functin_in_c++/cost.cpp | UTF-8 | 1,134 | 3.140625 | 3 | [] | no_license | #include "cost.h"
#include <stdlib.h>
#include <cmath>
#include <iostream>
double inefficiency_cost(int target_speed, int intended_lane, int final_lane,
const std::vector<int> &lane_speeds) {
// Cost becomes higher for trajectories with intended lane and final lane
// that have traffi... | true |
bac6b5ebb81fa7ab0183d99911f2b32df627c4c7 | C++ | SimoHayha/GLStuff | /Renderer/Graphics.h | UTF-8 | 2,805 | 2.59375 | 3 | [] | no_license | #pragma once
#include <future>
#include <string>
#include <map>
#include <list>
#include <condition_variable>
#include <mutex>
#include <glm\glm.hpp>
#include <GL/glew.h>
// Mesh are loaded in a parallel thread, but we can only generate buffers in the main thread.
// The loaded thread will wait for the Condition va... | true |
73adf98cb585d8b6f5f683c4a0a03aba05a5b50e | C++ | leonardoaraujosantos/NLPPytorch | /src/cpp14/vanilla_matcher/conceptmatcher.cpp | UTF-8 | 1,477 | 3.359375 | 3 | [] | no_license | #include "conceptmatcher.h"
ConceptMatcher::ConceptMatcher()
{
}
void ConceptMatcher::AddConcept(std::string concept)
{
std::transform(concept.begin(), concept.end(), concept.begin(), ::tolower);
m_set_concepts.insert(concept);
}
list<string> ConceptMatcher::GetTokens(std::string input)
{
... | true |
4f79c153e0fca1c93054e6971b3eb73f3b3db549 | C++ | hung4564/Cautrucdulieu | /C++/CTDL/CTDL/Source.cpp | UTF-8 | 2,437 | 3.40625 | 3 | [] | no_license | #include<iostream>
#include "Array.h"
#include"Queue.h"
#include"Stack.h"
#include "LinkedList.h"
#include "D_LinkedList.h"
#include "C_LinkedList.h"
#include "Node.h"
#include"BinaryTree.h"
using namespace std;
void main_BST()
{
BinaryTree tree;
tree.Add(50);
tree.Add(30);
tree.Add(20);
tree.Add(40);
tree.Add(35... | true |
54cc922dd85646993be26f7347dc68ab1280c8c7 | C++ | Stefan9283/Umbra2D | /Dependencies/Source/FrameBuffer.cpp | UTF-8 | 2,585 | 2.734375 | 3 | [] | no_license |
#include "FrameBuffer.h"
#include "Window.h"
#include "Texture.h"
#include "Engine.h"
extern Umbra2D::Engine* umbra;
namespace Umbra2D {
FrameBuffer::FrameBuffer(int type, glm::ivec2 resolution) {
// framebuffer configuration
// -------------------------
glGenFramebuffers(1, &fbo);
... | true |
a51f4766f8a260ce96ec3690c9945dd48697f4b6 | C++ | DV1537/assignment-a1-oson21 | /main1A.cpp | UTF-8 | 841 | 2.8125 | 3 | [] | no_license | #include "func1A.h"
int main(int argc, const char *argv[]){
const char *fileName = argv[1];
int n = 0,
a = 0;
double average = 0.0,
sum = 0.0;
CountInput(fileName,n);
double *array = new double[n];
std::ifstream myReadFile;
myReadFile.open(fileName);
... | true |
3c281c7879c97ec29d4e352e9ecf357786489739 | C++ | davishyer/Introduction_to_Programming | /Zipped Projects/Lab 10 RPG/Lab 10 RPG/Archer.cpp | UTF-8 | 412 | 2.828125 | 3 | [] | no_license | #include "Archer.h"
Archer::Archer(string name, int maxhp, int st, int sp, int mag) : Fighter(name, maxhp, st, sp, mag)//add rest
{
ASpeed = sp;
}
int Archer::getDamage()
{
int damage = Speed;
return damage;
}
void Archer::reset()
{
Fighter::reset();
Speed = ASpeed;
}
bool Archer::useAbil... | true |
32e9bbcc0233e07bb1660bce07657898ddda2666 | C++ | byu-mechatronics/motor_control | /stepper_motor_control/stepper_motor_control.ino | UTF-8 | 5,344 | 2.796875 | 3 | [] | no_license | #define toggle A0
#define dcMotor 3
#define dirPin A5
#define stepPin A4
#define stepNumber 50
#define stepSpeed .25
#define delay1 250
#define led 13
int motorSpeed; //Represents dc speed value bewteen 0 and 255
int toggleStatus;
int getOut = 0; //Used to control Stepper using EiBotBoard (EBB)
const int s... | true |
f3f016995b8a3153ba2c5b6b117821d8ef2a65ec | C++ | wld0595/Batch | /MyBatch/MyBatch/Texture.cpp | UTF-8 | 3,124 | 2.609375 | 3 | [] | no_license | #include <stdlib.h>
#include <stdio.h>
#define STB_IMAGE_IMPLEMENTATION
#include <stb_image.h>
#include "Texture.h"
/* Create an array of 10 Texture* */
std::vector<Texture*> Texture::vTextures(10);
Texture::Texture()
:uiTextureHandle(0)
,iTexWidth(0)
,iTexHeight(0)
{}
Texture::~Texture()
{}
... | true |
4ffbd8ba9997a0d25cdbba130333511fe2bbd4d1 | C++ | kai-v/RoundRobinSimulation | /rr_scheduler.cpp | UTF-8 | 8,654 | 3.125 | 3 | [] | no_license |
#include <iostream>
#include "process.h"
#include "rr_scheduler.h"
#include <queue>
RR_Scheduler::RR_Scheduler(std::queue<process> process_list, int quantum, int block_duration)
{
this->process_list = process_list;
this->quantum = quantum;
this->block_duration = block_duration;
}
RR_Scheduler::~RR_Schedul... | true |
f84dadaf21e10fc16ac956d30077b4efaa829e58 | C++ | shoeisha-books/dokushu-cpp | /ch03/list_3.23/main.cpp | UTF-8 | 1,033 | 3.921875 | 4 | [
"MIT"
] | permissive | #include <iostream>
class S
{
static int count; // インスタンスの数を数えるstaticメンバー変数
public:
S();
~S();
void show_count() const;
};
int S::count = 0; // staticメンバー変数の実体を定義して0で初期化する
S::S()
{
// インスタンスが作られたらインクリメントする
++count;
}
S::~S()
{
// 破棄されたらデクリメントする
--count;
}
... | true |
f65dd61fda32272e2aeaaa6afbb7c1aa6fdd710b | C++ | matyx44/GLNSModified | /geom.hpp | UTF-8 | 3,385 | 2.625 | 3 | [] | no_license | /**
* File: geom.hpp
*
* Date: 4.12.18
* Author: Jan Mikula
* E-mail: mikula.miki@gmail.com
*
*/
#ifndef POLY_MAPS_GEOM_HPP
#define POLY_MAPS_GEOM_HPP
#include <cmath>
#include <vector>
namespace pmap {
namespace geom {
typedef double geom_float;
struct FPoint {
geo... | true |
4aed508a9f92433921a5513d789698d494e59696 | C++ | abbymartin1/CreatureOfTheForestGame | /CreatureOfForestGame/Source/Game/GameBoard.h | UTF-8 | 1,081 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include "GameEngine/EntitySystem/Entity.h"
#include <SFML/System/Vector2.hpp>
#include <vector>
namespace Game
{
//Used for storing and controlling all game related entities, as well as providing an entry point for the "game" side of application
class PlayerEntity;
class GameBoard
{
public:
Ga... | true |
f5da7a27cb56de0df2bb9ae7d1c1be1de50225e7 | C++ | Rogi1246/programmiersprachen-aufgabenblatt-2 | /source/tests.cpp | UTF-8 | 6,463 | 2.875 | 3 | [
"MIT"
] | permissive | #define CATCH_CONFIG_RUNNER
#define _USE_MATH_DEFINES
#define NOGDI
#include <catch.hpp>
#include "vec2.hpp"
#include "mat2.hpp"
#include "color.hpp"
#include "rectangle.hpp"
#include "circle.hpp"
int main(int argc, char *argv[])
{
return Catch::Session().run(argc, argv);
std::cin.get();
return 0;
}
TEST_CASE("... | true |
8982b99f8b74f0260e293f34c151ff1fd6a13c48 | C++ | laprej/LORAIN | /Foo4/test/test-if-else-catch.cpp | UTF-8 | 693 | 2.84375 | 3 | [
"BSD-3-Clause-Clear"
] | permissive | #include "catch.hpp"
extern "C" {
int test_if_else_x;
int test_if_else_x_condition;
void undo_test_if_else(void);
void test_if_else(void);
}
TEST_CASE("simple/if-else true", "A simple test if true")
{
test_if_else_x = 3;
test_if_else_x_condition = 1;
int y = test_if_else_x;
test_i... | true |
5c53f8ca3eda27371087a1840c0cab0f5e6b7dc1 | C++ | lbellmann/ConsensLib | /src/Examples/Example.cpp | UTF-8 | 3,510 | 3.1875 | 3 | [
"BSD-3-Clause"
] | permissive | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include "ConsensLib/Consens.hpp"
class Graph {
public:
Graph(const std::vector<std::vector<size_t>>& adjacency)
: m_adjacency(adjacency)
{
std::vector<size_t> tempNodes(adjacency.size());
std::iota(tempNodes.begin(), temp... | true |
9be8afd44a5e819f0a05e5333bb1a03030be615b | C++ | higsyuhing/leetcode_easy | /1863.cpp | UTF-8 | 1,018 | 3.03125 | 3 | [] | no_license | class Solution {
public:
int subsetXORSum(vector<int>& nums) {
// nums.length < 13, then we can use a unsigned integer for the select mask
int res = 0;
for (auto i = 1; i < (1 << nums.size()); ++i) {
int total = 0;
for (auto j = 0; j < nums.size(); ++j)
... | true |
720e6bf18265044b9a8f6733e7467c3a48f7ad38 | C++ | i-kuzmin/hw | /Hiew.cpp | UTF-8 | 5,429 | 2.828125 | 3 | [] | no_license | #include "Hiew.h"
#include <iomanip>
#include <cstdint>
#include <vector>
const char * const Hiew::m_trans [] = {
u8" ", u8"☺", u8"☻", u8"♥", u8"♦", u8"♣", u8"♠", u8"•",
u8"◘", u8"○", u8"◙", u8"♂", u8"♀", u8"♪", u8"♫", u8"☼",
u8"►", u8"◄", u8"↕", u8"‼", u8"¶", u8"§", u8"▬", u8"↨",
... | true |
c812b9ca91d7e92af174a39caf16e4d7ec83b3d7 | C++ | Reinsborg/ComplexNumbers | /KomplekseTal/KomplekseTal.h | UTF-8 | 506 | 2.671875 | 3 | [] | no_license | #include <math.h>
class ComplexNumber
{
public:
ComplexNumber();
ComplexNumber(double Rez, double Imz);
void setSum(double rez, double imz);
void setPol(double mod, double arg);
double getRez();
double getImz();
double getMod();
double getArg();
private:
void setRez(double rez);
void setImz(double imz);... | true |
db387cd79e31dd92d125ac923257fec7f05eb0e8 | C++ | Itamarled/Streaming-service-system | /include/Action.h | UTF-8 | 2,754 | 2.890625 | 3 | [] | no_license | #ifndef ACTION_H_
#define ACTION_H_
#include <string>
#include <iostream>
#include "User.h"
class Session;
enum ActionStatus{
PENDING, COMPLETED, ERROR
};
class BaseAction{
public:
BaseAction();///Constructor
BaseAction(const BaseAction& other);///Copy Constructor
virtual BaseAction* clone()=0;
... | true |
6584ffec099ba472daf2f306dd5e207293815541 | C++ | fsps60312/old-C-code | /C++ code/HSNU Online Judge/15(6).cpp | UTF-8 | 935 | 2.546875 | 3 | [] | no_license | #include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
const int INF=2147483647;
int N,M,MAT[100][100];
void Expand(int s,int &ans)
{
for(int i=s+1;i<N;i++)
{
for(int j=i+1;j<N;j++)
{
int &a=MAT[s][i],&b=MAT[s][j];
if(a==INF||b==INF)continue;
int &l=MAT[i][j];
if(l!=INF&&a+b+l<ans)... | true |
2bf5afc628c3efb4c1380caaff63d21601b5d537 | C++ | Bhaskar-Dutt/Project-Euler | /src/Divisibility_Of_Factorials.cpp | UTF-8 | 3,562 | 3.4375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
// odd prime numbers are marked as "true" in a bitvector
std::vector<bool> sieve;
// return true, if x is a prime number
bool isPrime(unsigned int x)
{
// handle even numbers
if ((x & 1) == 0)
return x == 2;
// lookup for o... | true |
d391228aba80803894b7f550ca937183b5767f84 | C++ | shraddhanahar/FindingMaxMin | /StraightMaxMin0.cpp | UTF-8 | 590 | 2.859375 | 3 | [] | no_license | #include<iostream>
using namespace std;
/*BestAlgorithmToFindMaxMinInAccordanceToTimeComplexity*/
int main()
{
int a[100],i,n,min,max;
cout<<"Enter size of array :\t";
cin>>n;
/* #####AcceptArray##### */
for(i = 1 ;i<=n;i++)
{
cin>>a[i];
}
... | true |
9e0b180bd21e61e96a31b3d3bab0dcdfbadb6bbe | C++ | dexfire/ccode | /ACM/long_long_ago/cable_master_copy.cpp | UTF-8 | 723 | 2.609375 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
const int INF = 10005;
const int MAX_N = 10005;
int N, K;
double Len[MAX_N];
bool C(double x) {
int num = 0;
for (int i = 0; i < N; i++) {
num += (int)(Len[i] / x);
}
return num >= K;
}
void solve() {
double lb = 0... | true |
ef702d8a7d1c8ac956de60b63fe49add86c69d51 | C++ | cycasmi/proyectos-VS | /Segundo semestre orientada a objetos/Libreria/Libreria/Heroe.h | UTF-8 | 310 | 3.28125 | 3 | [] | no_license | #pragma once
#include "Personaje.h"
#include <string>
class Heroe : public Personaje
{
private:
Heroe(){}
public:
Heroe(string nombre, int popularidad) : Personaje(nombre, popularidad){}
void imprimir()
{
cout << "Soy el heroe " << nombre << " y mi popularidad es de: " << *popularidad << endl;
}
}; | true |
fb7ff23cd17a93234347a95723e06eeac8d0f942 | C++ | Bode2222/DeepQ | /DeepQ/main.cpp | UTF-8 | 1,916 | 2.5625 | 3 | [] | no_license | #include "QLearn.h"
#include "LizardGame.h"
#include "CarGame.h"
#include "NeuralNet.h"
//NOTE: MAKING THE NUMBER OF STEPS BEFORE TARGET NET UPDATE TOO SMALL OR TOO LARGE (RELATIVE TO THE GAME WERE PLAYING) CREATES \
INSTABILITY IN THE NETWORK!!!
//implement dynamic replay memory and compare performance
//Time taken... | true |
179cd23302f3745b41b654f0101cfe86ace8a745 | C++ | Sunakarus/SFMLParticleEngine | /SFMLParticleEngine/Controller.cpp | UTF-8 | 898 | 3.015625 | 3 | [] | no_license | #include "stdafx.h"
#include "Controller.h"
#include <random>
Controller::Controller(sf::RenderWindow* window)
{
font.loadFromFile("OpenSans-Regular.ttf");
this->window = window;
emitterList.push_back(new ParticleEmitter(this));
std::random_device rd;
std::mt19937 rng(rd());
text.setFont(font);
text.setColor(s... | true |
ac1608f8075c02e1887512c9ffe1bc58c4a0a231 | C++ | james47/acm | /oj/hdoj/hdoj_1285.cpp | UTF-8 | 886 | 2.625 | 3 | [] | no_license | #include<cstring>
#include<cstdio>
#include<queue>
using namespace std;
int en[510], in[510];
int n, m, x, y, esize;
struct edge{
int n, v;
} e[30000];
void insert(int u, int v)
{
esize ++;
e[esize].v = v;
e[esize].n = en[u];
en[u] = esize;
}
int main()
{
while(scanf("%d %d", &n, &m) != EOF)
{
memset(en, -1, ... | true |
6f6c9cbf70bd8edb1fab36e53cb4be2b5901d7e4 | C++ | baozhiyu0212/Leetcode | /842. Split Array into Fibonacci Sequence.cpp | UTF-8 | 932 | 3.15625 | 3 | [] | no_license | class Solution {
vector<vector<int>> res;
public:
vector<int> splitIntoFibonacci(string s) {
dfs(s,vector<int>(),0);
if(res.size()==0) return {};
return res[0];
}
void dfs(string s, vector<int> temp, int index){
if(temp.size()>=3 && !valid(temp)) return;
else... | true |
2c537c90fd0afa240a6beb4a3425f6fc39769fcd | C++ | teamneem/Cplusplusclass | /proj06/proj06.driver.cpp | UTF-8 | 4,510 | 3.125 | 3 | [] | no_license | /****************************************************************************
Tasneem Pierce
Section 8
Computer Project #6
****************************************************************************/
using namespace std;
#include <iostream>
#include "/user/cse232/Projects/project06.word.h"
int main()
... | true |
772c3ea4d44dab0a1af8a84e138a9cb4436c6e4b | C++ | alychuk/Image_Processing | /proj3/exp2/exp2.cpp | UTF-8 | 1,559 | 2.9375 | 3 | [] | no_license | // modified exp2 for exp3 this is the code for exp2 copied over in case needed later
for (int i = 0; i < rows; ++i)
{
//add a new col for each row
image_real[i + 1] = new float[cols + 1];
image_imag[i + 1] = new float[cols + 1];
for (int j = 0; j < cols; ++j)
{
//gets the value of the pixel from image
... | true |
0bcdb8003d0483fc02cbeee02e56a3206ae706c1 | C++ | BhuiyanMH/Uva | /11764 Jumping mario.cpp | UTF-8 | 577 | 2.890625 | 3 | [] | no_license | #include <stdio.h>
#include <math.h>
#include <string.h>
int main()
{
int tc, N;
scanf("%d", &tc);
for(int i =1; i<= tc; i++)
{
scanf("%d", &N);
int arr[N];
for(int j =0; j<N; j++)
{
scanf("%d", &arr[j]);
}
int highJump = 0, lowJump =0;
... | true |
4f320c884ddea623fe3abffd3a8f24666c2db2c4 | C++ | jshal001/R-Shell | /header/parser.hpp | UTF-8 | 1,018 | 3 | 3 | [] | no_license | #ifndef PARSER_H
#define PARSER_H
#include <string>
#include <iostream>
#include <stack>
#include <vector>
#include <queue>
#include "command.hpp"
#include "executable.hpp"
#include "or.hpp"
#include "and.hpp"
#include "semicolon.hpp"
using std::string;
using std::vector;
using std::queue;
class Parser {
private:
... | true |
03652103acf4580da09646a54282c42ba2556ce7 | C++ | jloxfo2/gb-emu | /cpu.h | UTF-8 | 5,462 | 3.0625 | 3 | [] | no_license | #ifndef CPU_H_
#define CPU_H_
#include "mmu.h"
#include <stdint.h>
#include <iostream>
#include <string>
#define MAX_INT_4BIT 0x000F
#define MAX_INT_8BIT 0x00FF
#define MAX_INT_12BIT 0x0FFF
#define MAX_INT_16BIT 0xFFFF
#define C_FLAG 0x10 // carry flag
#define H_FLAG 0x20 // half carry flag
#define N_FLAG 0x40 ... | true |
9f9b35625480c14ea66ce2592d14638007d79453 | C++ | dskuang/Randomized-Search-Tree | /PA2/benchtree.cpp | UTF-8 | 4,413 | 3.28125 | 3 | [] | no_license | /****************************************************************************
Dominic Kuang
CSE 100, Winter 2015
cs100wdy
2/5/15
... | true |
c10b7984cfca4c92ed4eb81289279474e5657f06 | C++ | freesamael/wolf | /include/CTcpConnectionListener.h | UTF-8 | 1,409 | 2.96875 | 3 | [] | no_license | /**
* \file CTcpConnectionListener.h
* \date Apr 27, 2010
* \author samael
*/
#ifndef CTCPCONNECTIONLISENTER_H_
#define CTCPCONNECTIONLISENTER_H_
#include "AObservable.h"
#include "IRunnable.h"
#include "CTcpSocket.h"
#include "CTcpServer.h"
#include "CMutex.h"
#include "HelperMacros.h"
namespace wolf
{
/**
* ... | true |
5b1e13c8135132994e81f72e93c718f5219e5e30 | C++ | DanielBatesJ/Problem-Solving-Code | /Three Algorithmic Assignments/sticks.cpp | UTF-8 | 2,813 | 3.859375 | 4 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
void findLargest(int stickNum)
{
int i = 0;
cout << "Largest Number:";
// The pattern for largest is just ones and sevens based on odd and even number of sticks
while(stickNum > 0)
{
if((stickNum%2 == 1) && (stickNum >= 3))
{
... | true |
088dcc25faad8644046cda28fe2e7f2e415b0ab8 | C++ | AkiraHero/OpenRoadEd | /src/Osg/OSGCameraControls.cpp | UTF-8 | 6,653 | 2.625 | 3 | [] | no_license | #include "OSGCameraControls.h"
//// Constructor and Destructor
//OSGCameraControls::OSGCameraControls()
//{
// mSpaceIsPressed=false;
//}
//OSGCameraControls::~OSGCameraControls()
//{}
//
///**
//* Sets the target node
//*/
//void OSGCameraControls::setNode(osg::Node* node)
//{
// mNode = node;
// if (mNode.get())
// ... | true |
63e4c79124b9a6cd72b7bdb226252d2eb0cb6ebe | C++ | liulin2012/myLeetcode | /NextPermutation.cpp | UTF-8 | 398 | 2.765625 | 3 | [] | no_license | class Solution {
public:
void nextPermutation(vector<int>& nums) {
int n = nums.size() - 1;
while (n != 0 && nums[n] <= nums[n - 1]) n--;
if (n != 0) {
int val = nums[n - 1];
int m = nums.size() - 1;
while (nums[m] <= val) m--;
swap(nums[n - 1... | true |
c946a3915363890b7df65aad6bae00e59a62c781 | C++ | elphastori/pca | /test.cpp | UTF-8 | 1,353 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <fstream>
#include <sstream>
#define CATCH_CONFIG_MAIN //So that catch will define a main method
#include "catch.hpp"
#include "pca_math.h"
using namespace std;
using namespace TRNELP001;
TEST_CASE("dimension mean") {
vecto... | true |
f3da710d3b65ca76e93267a4e91130c73c0e841f | C++ | meshell/KataTournamentRunner | /src/kataround_scores.cpp | UTF-8 | 1,381 | 2.859375 | 3 | [
"MIT"
] | permissive | #include "tournament_runner/kataround_scores.h"
#include <algorithm>
#include <numeric>
#include <cmath>
namespace TournamentRunner
{
void KataRoundScores::add_kata_score (float score)
{
if (current_score_ < number_of_kata_scores_per_round)
{
kata_scores_[current_score_++] = score;
}
else
... | true |
6328756622827203b84cda55ac26df4ffc6775e3 | C++ | 15831944/TMS | /GetRouteQuery.cpp | UTF-8 | 16,389 | 2.90625 | 3 | [] | no_license |
#include "CIS.h"
#include <set>
void getPathifyConnections( PathifyConnections &pc, CISlocationMapSet &fromTo )
{
pc.clear();
register size_t cTotal = 0;
register CISlocationMapSet::iterator from, fromEnd;
for( from = fromTo.begin(), fromEnd = fromTo.end(); from != fromEnd; ++from )
cTotal += from->second.size... | true |
0633417b5deeca340185400d456f83e4ef6065f0 | C++ | SinghVikram97/DP-and-Trees | /DP/A_10. RodCutting.cpp | UTF-8 | 1,842 | 3.5625 | 4 | [] | no_license | // http://www.geeksforgeeks.org/dynamic-programming-set-13-cutting-a-rod/
// https://hack.codingblocks.com/contests/c/141/1090
// Basic recursion
#include <bits/stdc++.h>
using namespace std;
int maximum_cost(int length_of_rod, vector<int> prices)
{
if (length_of_rod == 0)
{
return 0;
}
int maximum = -1;
... | true |
7346e55dc060d3027ed29785aab55bfe78da797e | C++ | dolphingarlic/CompetitiveProgramming | /Baltic/Baltic 12-brackets.cpp | UTF-8 | 1,260 | 3.125 | 3 | [] | no_license | /*
Baltic 2012 Brackets
- Notice how we basically only care about changing '(' to ')'
- Let the "height" of a bracket sequence be the number of unpaired '('
- dp[i][j] = The number of ways to change several '(' in the first
i brackets such that the height is never negative and the
final height... | true |
b44b673449ad58c9acc408840d40031818fc902e | C++ | tangodown1934/Algorithm-judge | /20150802/4번_기타리스트.cpp | UHC | 912 | 2.546875 | 3 | [] | no_license | #pragma warning(disable:4996)
#include <stdio.h>
#define SIZE 111
int N, S, M;
int vol[SIZE];
int cache[SIZE][111111];
int ans;
int max(int a, int b)
{
if (a < b)
return b;
return a;
}
int sol(int idx, int sum)
{
int i;
//
if (sum<0 || sum>M) return -1111111; // ʰѴٸ
if (idx =... | true |
3a04db06ee88c016b491350f7d942278a4364973 | C++ | bryanlov/python_compiler | /src/ast.h | UTF-8 | 21,129 | 2.890625 | 3 | [] | no_license | /* -*- mode: C++; c-file-style: "stroustrup"; indent-tabs-mode: nil; -*- */
/* ast.h: Top-level definitions for abstract syntax trees. */
/* Authors: */
#ifndef _AST_H_
#define _AST_H_
#include <string>
#include <vector>
#include <unordered_set>
#include <unordered_map>
/** A type representing source locations. S... | true |
54271d6f6964ad69b3c1c95baf2d91656b90da47 | C++ | furkankaysudu/stack | /stack/main.cpp | UTF-8 | 1,221 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <cstdlib>
struct stackExmpl{
int sp;
unsigned capacity;
int *arr;
};
struct stackExmpl* createStack(unsigned capacity){
struct stackExmpl* stck = (struct stackExmpl*)malloc(sizeof(struct stackExmpl));
stck->capacity = capacity;
stck->s... | true |
5c491520ff0e3d2a259d5f78a09415fb994b9cbd | C++ | niamrouzwest/11_lab | /lab_11.cpp | UTF-8 | 3,283 | 3.265625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <conio.h>
#include "lab_11.h"
int Priority(char c) {
switch (c) {
case '+': case '-': return 1;
case '*': case '/': return 2;
}
return 100;
}
PNode_t MakeTree(char Expr[], int first, int last) {
... | true |
b340569d75885d04d19db1eac84b67bfdcf07b86 | C++ | drake200120xx/ConStorm | /ConStorm/src/input/input_function.cpp | UTF-8 | 602 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | /*
Code by Drake Johnson
*/
#include "../../include/cons/input/input_function.hpp"
namespace cons
{
template <>
std::string input<std::basic_string<char>>(
std::function<bool(std::string)> valid_func,
const std::string& invalid_msg)
{
std::string user_input;
bool first_loop = true;
do
{
if (first... | true |
e6fd43b7b2951159ea7b8cd8123941157fdd777f | C++ | crazycracker/Competitive-Programming-Codes | /change_the_signs2.cpp | UTF-8 | 2,195 | 3.03125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void changeTheSigns(long long int arr[], int n, map<int,bool> m){
long long int temp;
long long int prefixSum[n+2];
prefixSum[0] = prefixSum[n+1] = 0;
if(m[1])
prefixSum[1] = -arr[1];
else
prefixSum[1] = arr[1];
for(int i = 2; i ... | true |
4eb60a4db4d6405079ebcd2de8053c0ac4e58365 | C++ | jakebills1/cpp_practice | /chapter_4/questions/4.19/lib/question_4.19.cpp | UTF-8 | 877 | 4.09375 | 4 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int counter = 1; // keeps track of loop repeats
int largest; // stores largest inputted number
int second_largest; // stores second largest inputted number
int input; // stores user input each loop
while (counter < 11)
{
cout << "E... | true |
4ef0e51ddae458c4a1c3f09e2262602de1903f82 | C++ | natallem-ITMO/Algo-labs | /Semester2/Lab3/J_mine.cpp | UTF-8 | 3,068 | 2.640625 | 3 | [] | no_license | /*
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("section-anchors")
#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
#p... | true |
20a75df643e18834fcb177e7f4054b5a79352ce8 | C++ | farabiahmed/MachineLearningFramework | /src/Miscellaneous/SmartVector.cpp | UTF-8 | 5,336 | 3.5 | 4 | [] | no_license | /*
* Vector.cpp
*
* Created on: Mar 8, 2017
* Author: farabiahmed
*/
#include "Miscellaneous/SmartVector.hpp"
SmartVector::SmartVector(int N) {
// TODO Auto-generated constructor stub
dimension = N;
elements = new double[dimension];
index = -1; // initially undefined.
}
SmartVector::SmartVector() {
... | true |
40f8fb7753414cf28b460b479834fb94f2c9307c | C++ | haowenz/chromap | /src/index_utils.h | UTF-8 | 3,780 | 2.671875 | 3 | [
"MIT"
] | permissive | #ifndef INDEX_UTILS_H_
#define INDEX_UTILS_H_
#include "khash.h"
// Note that the max kmer size is 28 and its hash value is always saved in the
// lowest 56 bits of an unsigned 64-bit integer. When an element is inserted
// into the hash table, its hash value is left shifted by 1 bit and the lowest
// bit of the key ... | true |
bb6745374e05a76f29477106b56ef40a83464599 | C++ | atupal/oj | /poj/2409_Let_it_Bead_置换群_伯恩赛德定理.cpp | UTF-8 | 1,734 | 3.078125 | 3 | [
"MIT"
] | permissive | /*
对于旋转置换群,群内置换的总个数显而易见是n个(转n次就返回到自己了嘛),第i个置换中循环节的个数可以用dfs搜索出来,不过有直接的结论,循环节个数应该是gcd(n,i)个,这个结论所有博客都给出了,但是几乎都没给证明(大神都觉得太显而易见了吧)。
对于翻转置换,看上面的那个图,它已经给了你很大提示,找循环节的关键是找对称轴。这里n要分奇偶性。
当n为奇数,那么对称轴就是每个点和圆心的连线,共n条(观察第二个图),那么显然除了这个点没变,其他的点都跟对称的那个点置换了,所以循环节的个数是(n-1)/2+1。
当n为偶数,那么对称轴有每个点和对面的点的连线,共n/2条,显然除了对称轴上的两个点,其余... | true |
f45e7cc562be969d09a901dc172abe0a0b231197 | C++ | phhusson/STpp | /lib/RPC.cpp | UTF-8 | 1,728 | 2.65625 | 3 | [] | no_license | #include "RPC.h"
#include <Tasks.h>
#include <Log.h>
RPC::RPC(): in(NULL), out(NULL) {
}
RPC& RPC::setStream(IStream* in, OStream* out) {
this->in = in;
this->out = out;
return *this;
}
void RPC::waitIngoing() {
log << "Ingoing thread started" << endl;
while(true) {
do {
in->wait();
log << "Received som... | true |
3af092e2a0c9d34c2fd172c935dcf2318ecc3416 | C++ | wagulu/cocos2dx_sanguo_heroes | /SanguoClient/frameworks/runtime-src/Classes/battle/system/hero/States/StateHeroDizzy.h | UTF-8 | 2,837 | 2.609375 | 3 | [] | no_license | //
// StateHeroDizzy.h
// Game
//
// Created by fu.chenhao on 3/16/15.
//
//
#ifndef __STATE_HERO_DIZZY_H__
#define __STATE_HERO_DIZZY_H__
#include "IState.h"
#include "BattleConfig.h"
#include "BattleComponent.h"
#include "DizzyAction.h"
#include "DizzyCondition.h"
class DizzyActionBuilderBase;
class DizzyCondit... | true |
f23d6ff5f02185817d3209a91ef9d86b154f51da | C++ | mwharris/Accelerated-C-Exercises | /Chapter14/Chap14/Chap14/Str.h | UTF-8 | 2,453 | 3.8125 | 4 | [] | no_license | #ifndef STR_H
#define STR_H
#include <iterator>
#include "Vec.h"
#include "Ptr.h"
class Str {
//Input operator overload
friend std::istream& operator>> (std::istream& is, Str& str);
public:
typedef Vec<char>::size_type size_type;
//Default empty constructor
Str() : data(new Vec<char>) {}
//Constructor: Ini... | true |
f131768203eeba6d63a3d25d2f73ed1596bda46b | C++ | pmannil/my-arduino-codes | /sketch_jan26d.ino | UTF-8 | 479 | 2.875 | 3 | [] | no_license |
unsigned long previousMillis[3];
int led1=3;
int led2=5;
int led3=9;
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
}
void loop() {
BlinkLed(led1, 10, 0);
BlinkLed(led2, 100, 1);
BlinkLed(led3, 1000, 2);
}
void BlinkLed (int led, int interval, int array){
... | true |
5c8f81134b2c7afbfee2957458d82898b511b36f | C++ | useyourfeelings/POJ | /1543/1245003_AC_327MS_260K.cc | UTF-8 | 872 | 3.171875 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<cmath>
using namespace std;
struct ct
{
ct(float aa, float bb, float cc, float dd):a(aa),b(bb),c(cc),d(dd){}
float a;
float b;
float c;
float d;
};
int main()
{
float a, b, c, d, n;
vector<ct> vct;
for(a = 1; a <= 100; a++)
{
fo... | true |
646cc91dfc4780f60e60dadd72dd07bf16e4bde7 | C++ | 96Asch/CG_OpenGL_Engine | /src/component/Motion.h | UTF-8 | 2,231 | 3.0625 | 3 | [] | no_license | #ifndef MOTION_H_
#define MOTION_H_
#include "Component.h"
#include <sstream>
#include <glm/vec3.hpp>
struct Motion : public IComponent<Motion> {
Motion()
: direction(glm::vec3(0.0f)),
rotation(glm::vec3(0.0f)),
movSpeed(1.0f),
rotSpeed(0.5f)
{}... | true |
f99e31eade3d744deec01249f12118cc0379ea65 | C++ | yuangu/project | /Classes/commonData/dictData/DictHeroQuality/DictHeroQualityManager.cpp | UTF-8 | 1,997 | 2.640625 | 3 | [] | no_license | #include "DictHeroQualityManager.h"
#include "../../../common/PublicShowUI.h"
DictHeroQualityManager* DictHeroQualityManager::_instance = NULL;
void DictHeroQualityManager::setConfigData(Json* json)
{
Json* node = json->child;
node = node->next;
while (node)
{
if(node->type == Json_Array)
{
Json* item = nod... | true |
a7287137e537fbdde528c1032d3b210bafe5bb84 | C++ | chenshuyuhhh/acm | /9.14/Test3.cpp | UTF-8 | 3,314 | 2.625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <cstring>
#include <algorithm>
using namespace std;
//
// Created by 陈姝宇 on 2020/9/13.
//
class Test3 {
int nn;
int mm;
int **hen;
int **shu;
int **moneys;
int **visit;
int sum = 0;
set<pai... | true |
9934a786da3fcacfb65488e63cf173029243cc83 | C++ | tianyaochou/antlr-generator | /include/Pass/ResolveRef.h | UTF-8 | 1,565 | 2.765625 | 3 | [] | no_license | #include <map>
#include "Rules/Rule.h"
struct ResolveRef : public RuleVisitor
{
std::map<std::string, std::shared_ptr<Rule>> &parserRules;
std::map<std::string, std::shared_ptr<Rule>> &lexerRules;
ResolveRef(std::map<std::string, std::shared_ptr<Rule>> &parserRules, std::map<std::string, std::shared_ptr<R... | true |
9d4e443bdafaabbeb7a3f603028bc582c0fb43ce | C++ | pcannon67/pocketkaldi | /test/list_test.cc | UTF-8 | 1,064 | 2.890625 | 3 | [] | no_license | // Created at 2016-11-22
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include "util.h"
#include "list.h"
PKLIST_DEFINE(int, int_list)
void TestIntList() {
int_list_t pklist_int;
int_list_init(&pklist_int);
assert(int_list_empty(&pklist_int));
std::vector<... | true |
840331b9675839329c849fd6ae901bf1ec79e037 | C++ | B2SIC/cpp_training | /Solution/Baekjoon/5101.cpp | UTF-8 | 791 | 3.125 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v;
int start = -1, sequence = -1, target = -1;
while(true)
{
int count = 1;
cin >> start >> sequence >> target;
if (start == 0 && sequence == 0 && target == 0)
break;
... | true |
2775a6175cd52a162791fcb96bca797ad7ed6d3b | C++ | aplesss/CrossingRoad | /Source/CPeople.cpp | UTF-8 | 2,938 | 2.8125 | 3 | [] | no_license | #pragma once
#include "CPeople.h"
Character People::cha("Character\\People.txt");
People::People() {}
People::~People() {}
People::People(int x, int y)
{
X = x;
Y = y;
COORD temp = { -1,-1 };
oldPos.push_back(temp);
oldPos.resize(3);
}
void People::Up()
{
int width = this->Width();
int height = t... | true |
f0e38ab9e93c5a8c9d10b5ed178bdacfc815fd35 | C++ | vpadi/ACAP | /P3/src/convolucion_2.0.cpp | UTF-8 | 3,147 | 3.109375 | 3 | [] | no_license | #include <png.h>
#include <chrono>
#include "pngio.h"
int main(int argc, char *argv[]) {
if(argc != 3) abort();
const int conv[3][3] = {{-2,-1,0},{-1,1,1},{0,1,2}};
const int DIVISOR = 1;
/* Lectura de la imagen en una matriz bytep */
dimension dim = read_png_file(argv[1]);
/*
Paso de la mat... | true |
791a8d8596e5f8cf57fa21d31becb863451448ca | C++ | erik/blocks | /src/scene.cpp | UTF-8 | 6,349 | 2.59375 | 3 | [] | no_license | #include "scene.hpp"
#include <SFML/Graphics.hpp>
#include <sstream>
void MenuScene::Init(Context *c) {
context = c;
floor = world.CreateBox(200, 700, 400, 10, true);
floor.SetColor(sf::Color(0x44, 0x44, 0x44, 255));
}
void MenuScene::Step() {
if(sf::Randomizer::Random(1, 20) == 5) {
int w = sf::Ran... | true |
9d39012ec5dcc2daeb20efe14905ab67b9bfc100 | C++ | abhishekk781/matrix-session | /intro to programming/session 4/assignment_pattern4.cpp | UTF-8 | 296 | 2.984375 | 3 | [] | no_license | #include <iostream>
using namespace std;
void print_c(int x,int& start){
for (int i = 0; i < x; ++i)
{
cout<<start<<" ";
start++;
}
// return start;
}
int main(){
int n = 5,counter = 1;
for (int i = 1; i <= n; ++i)
{
print_c(i,counter);
// counter = counter+i;
cout<<endl;
}
} | true |
6aa51498c2be72561e0b87f96f96fa2e3acfaa2a | C++ | UniversaBlockchain/U8 | /crypto/HashId.cpp | UTF-8 | 3,310 | 2.84375 | 3 | [] | no_license | /*
* Copyright (c) 2018-present Sergey Chernov, iCodici S.n.C, All Rights Reserved.
*/
#include <tomcrypt.h>
#include "HashId.h"
#include "gost3411-2012.h"
#include "base64.h"
#include "../tools/tools.h"
namespace crypto {
HashId::HashId(const std::vector<unsigned char> &packedData) : HashId((void *) &packedDa... | true |
379fe5e62fd7e9a0562b3b047847f3ec76291710 | C++ | Divyanshnigam/DS-ALGO | /QUEUES/QUEUES Linked List based implementation.cpp | UTF-8 | 658 | 3.421875 | 3 | [] | no_license | #include<iostream>
#include<list>
using namespace std;
class queue
{
int cs;
list<int>qu;
public:
queue()
{
this->cs=0;
}
bool isempty()
{
return this->cs==0;
}
void enqueue(int data)
{
this->qu.push_back(data);
this->cs+=1;
}
void deque()
{
if(!isempty())
{... | true |
e25be7684ca1d40db9b1f87e4f0221f2350c5fc2 | C++ | bhushan23/competitive-programming | /LeetCode/algorithm/Medium_MinSizeSubArraySum_209.cpp | UTF-8 | 788 | 2.71875 | 3 | [] | no_license | class Solution {
public:
int minSubArrayLen(int s, vector<int>& nums) {
if (nums.size() <= 0)
return 0;
int low = 0;
int hi = 0;
int minD = nums.size()+2;
int sum = nums[0];
while (low <= hi && hi < nums.size()) {
// cout << sum << " " << hi <<... | true |
c1dad4cb150c194c50beb7854671e7bb5fe3df4f | C++ | monarchshield/ProcedGenFinale | /Source/WindowStartup/WindowStartup/src/ObjLoader.cpp | UTF-8 | 6,728 | 2.671875 | 3 | [] | no_license | #include "ObjLoader.h"
ObjLoader::ObjLoader() {}
ObjLoader::ObjLoader(const char *path, const char *textureloc, float Faces)
{
Facenum = Faces;
m_vertexCount = 0;
m_ModelIndexCount = 0;
Initialise(path, textureloc);
CreateBuffers();
}
ObjLoader::~ObjLoader()
{
}
void ObjLoader::Draw(unsigned int sha... | true |
57fbb683e73859213440c35dddb63c477e5db8b6 | C++ | loganharbour/meen644 | /hwk5/Problem_coefficients.cpp | UTF-8 | 5,291 | 2.59375 | 3 | [] | no_license | #include "Problem.h"
namespace Flow2D
{
void
Problem::fillCoefficients(const Variable & var)
{
if (var.name == Variables::pc)
pcCoefficients();
else if (var.name == Variables::T)
TCoefficients();
else if (var.name == Variables::u)
uCoefficients();
else if (var.name == Variables::v)
vCoefficien... | true |
3978ce0fea055baf98fadff393f823f2d0f32829 | C++ | Kingcom/armips | /Core/Allocations.h | UTF-8 | 1,969 | 3.03125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <cstdint>
#include <map>
struct AllocationStats
{
int64_t largestPosition;
int64_t largestSize;
int64_t largestUsage;
int64_t largestFreePosition;
int64_t largestFreeSize;
int64_t largestFreeUsage;
int64_t sharedFreePosition;
int64_t sharedFreeSize;
int64_t sharedFreeUsage;
int64_t ... | true |
16cbba561bc05742ebce08bc6e89ba721e6a52f7 | C++ | bhavinnirmal29/C_CPP_Programs | /TOKEN2.CPP | UTF-8 | 893 | 2.703125 | 3 | [] | no_license | #include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[50];
int i,n,token=1,beg=0,end,loc;
int y;
clrscr();
printf("enter the string\n");
gets(a);
n=strlen(a);
printf("string lenght is %d\n",n);
printf("token=1\n");
for(i=0;i<n;i++)
{
loc=i;
if(a[i]!=' ')
{
printf("%c",a[... | true |
c6162ae81d750992a42fddfaae301f5f8d0ac589 | C++ | free5fall5/uni | /sum_and_avg.cpp | UTF-8 | 648 | 3.484375 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include <math.h>
using namespace std;
int main () {
cout << "This program will calculate the sum and avg of the negative numbers entered by you. " << endl;
cout << "The program will termiante if you end if you fail to enter a negative number." << endl<<endl;
int input = 0;
double... | true |
6e70d269b36c15ab70a2b485a00833b330a2ed8b | C++ | evelio521/Books | /cplusplus/More Effective c++/貳/7.cpp | GB18030 | 2,012 | 3.84375 | 4 | [] | no_license | /*ItemM7Ҫء&&,||, ,*/
//˲&&˵ģ
if (expression1 && expression2) ...
//ڱ˵֮ͬһ
if (expression1.operator&&(expression2)) ...
// when operator&& is a
// member function
if (operator&&(expression1, expression2)) ...
// when operator&& is a
// global function
/*
* ϵÿԵµĽ:
* ... | true |
f52431ff4067aaa1f304f849b413fca8fee1aa51 | C++ | Hirosvk/sdf_3d | /open_gl/shader.cpp | UTF-8 | 1,706 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include "shader.h"
using namespace OpenGL;
Shader::Shader(std::string vertexSource, std::string fragmentSource) {
GLuint vertexShader = initShader(GL_VERTEX_SHADER, vertexSource);
GLuint fragmentShader = initShader(GL_FRAGMENT_SHADER, fragmentSource);
id = glCreateProgram();
glAttachSha... | true |
5c8f4bd0a58993b5f6a8ce037d6555b5f9c16764 | C++ | astephens4/bide | /common/test/TestAssert.hpp | UTF-8 | 3,258 | 3.546875 | 4 | [] | no_license | #ifndef TEST_ASSERT_H
#define TEST_ASSERT_H 1
#include <iostream>
#include <cinttypes>
#include <cmath>
#define MAX_ULP_DIFFERENCE 5
#include <cassert>
// Macro to assert that two values relate to each other in the manner specified by the operation parameter
// This macro should not be used directly, instead, use t... | true |
067e2d1b75cd52b147bc82b3fc813c0c5498706f | C++ | denaas/msup_online_audio | /registr.cpp | WINDOWS-1251 | 1,415 | 3.078125 | 3 | [] | no_license | #pragma once
#include <initializer_list>
#include <algorithm>
#include <tuple>
#include <memory>
#include <iostream>
#include <string>
#include <type_traits>
class identification
{
public:
string login;
//
string password;
//
bool registration()
{
bool flag;
// ,
... | true |
7f088d05482f3271a052572c0606d986d78e9165 | C++ | khleexv/kmucs | /2019-spring/cpp/algolab/22_유리수.cpp | UTF-8 | 7,123 | 3.5 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
if (b == 0) return a;
return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
return a * b / gcd(a,b);
}
class myRational {
public:
// Member Field
ll _num;
ll _den;
// Constructor
myRational(ll n... | true |
cd51c762b79d181b4670d337cd2764ad55199a6e | C++ | yanqiniu/CowByte | /src/CowByteEngine 0.2/Utils/CBVector.h | UTF-8 | 6,073 | 3.5 | 4 | [] | no_license | #ifndef _CBVECTOR_H
#define _CBVECTOR_H
#include <cstring>
#include "../Memory/CBMemory.h"
// Unlike CBQueue who implement a block based linked list,
// CBVector implement a contiguous array in a single block.
template <typename T>
class CBVector
{
public:
CBMEM_OVERLOAD_NEW_DELETE(CBVector)
CBVector();
... | true |
253d845f2d4a2714583f7354115123455e3c3933 | C++ | osama-afifi/Online-Judges-Solutions | /UVA Problems/UVA/UVA/Above Average.cpp | UTF-8 | 569 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include<iomanip>
using namespace std;
int main ()
{
freopen("input.in", "r", stdin);
double t,n,x[1500],avg;
cin>>t;
while (t>0)
{
cin>>n;
if (n==0)
{cout << setprecision(3) << fixed << n <<"%"<< endl;
continue;}
int i=0;
for(i=0;i<n;i++)
cin>>x[i];
int sum=0;
for(i=0... | true |
8b6bcbaf736fc559f654fd1480a113543d7ca9d0 | C++ | AparnaChinya/100DaysOfCode | /BinarySearchTreeIterator.cpp | UTF-8 | 1,611 | 4.0625 | 4 | [] | no_license | /*
Binary Search Tree Iterator
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.
Calling next() will return the next smallest number in the BST.
Note: next() and hasNext() should run in average O(1) time and uses O(h) memory, where h is the height of ... | true |
6b88ae4263eebed928020cc251bf56499b160324 | C++ | donaldrshade/Columbot2017 | /serialcommander/serialcommander.ino | UTF-8 | 1,081 | 2.90625 | 3 | [] | no_license | #include "Servo.h"
Servo lshoulder;
Servo lelbow;
Servo lclaw;
Servo rshoulder;
Servo relbow;
Servo rclaw;
int toDigit(int character) {
return character - 48;
}
void setup() {
lshoulder.attach(6);
lelbow.attach(9);
lclaw.attach(10);
//
//
// rshoulder.attach(6);
// relbow.attach(9);
// rclaw.attach(10)... | true |
b3719f3570d629048d44312306a2461ce674f8a3 | C++ | asyzruffz/ProjectPhronesis | /Phronesis/Sources/Phronesis/FileIO/BinaryFile.cpp | UTF-8 | 709 | 3.046875 | 3 | [] | no_license |
#include "StdAfx.hpp"
#include "BinaryFile.hpp"
using namespace Phronesis;
std::vector<char> BinaryFile::read(const std::string& filename)
{
// std::ios::ate is for reading at the end of the file
std::ifstream file(filename, std::ios::ate | std::ios::binary);
if(!file.is_open())
{
throw std::runtime_error("[E... | true |