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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
34926938e44a1bdaf078fe55a2636d0380283455 | C++ | ishaofeng/LeetCode | /ConvertSortedListToBinarySearchTree/ConvertSortedListToBinarySearchTree.cpp | UTF-8 | 1,468 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct ListNode
{
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class ... | true |
4952a9d3595147048f4490a9c6d57c83c69fd1a3 | C++ | cbhramar/archives | /Code/C++ programs/Stanford/recursiveExp.cpp | UTF-8 | 485 | 2.859375 | 3 | [] | no_license | #include<simplecpp>
long recursiveExp(int n, int k){
// long r = 1;
if (k == 0){
return 1;
}
else {
if (k%2 == 1){
return n*recursiveExp(n, k-1);
}
else
return recursiveExp(n, k/2)*recursiveExp(n, k/2);
}
}
main_program{
int ... | true |
1ecdcfa931d548c37633ad8ab30558eb99867c04 | C++ | timlenertz/tff-rqueue | /_prelim/utility.h | UTF-8 | 1,141 | 2.953125 | 3 | [] | no_license | #ifndef UTILITY_H_
#define UTILITY_H_
#include <string>
void require(bool condition, const char* msg = "", ...);
const std::string& thread_name(const std::string& new_name = "");
void log(const char* fmt, ...);
void sleep_ms(unsigned ms);
using time_unit = std::ptrdiff_t;
struct time_span {
time_unit begin;
tim... | true |
7a637105e36be883c5b72e12762a00ac296bb342 | C++ | EmmMiranda/Data-Structures-and-Algorithms | /Recursirve_isSorted/main.cpp | UTF-8 | 456 | 3.546875 | 4 | [] | no_license | #include <iostream>
using namespace std;
int isArraySorted(int A[], int n);
int main()
{
int sz = 5;
int a[] = {1, 2, 3, 4, 5};
cout << "Is array sorted? " << isArraySorted(a, sz) << '\n';
sz = 5;
int b[] = {1, 3, 2, 4, 5};
cout << "Is array sorted? " << isArraySorted(b, sz) << '\n';
re... | true |
579415f7eed7f7d8680c7de1267573a40e0f3fa5 | C++ | edsaedi/TranspisitionCipher | /TranspisitionCipher/TranspisitionCipher/TranspisitionCipher.cpp | UTF-8 | 3,057 | 3.421875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <string>
#include <cmath>
std::string Encryption(std::string plaintext, size_t key)
{
std::string cyphertext = "";
std::vector<std::vector<char>> table;
int numrows = std::ceil(plaintext.size() / (double)key);
for (size_t row = 0; row < numrows; row++)
{
table.p... | true |
f3cbfeda0f3e79f58cb174b13339c40665d3e57f | C++ | Jiltseb/Leetcode-Solutions | /solutions/1157.online-majority-element-in-subarray.360755942.ac.cpp | UTF-8 | 1,026 | 3.359375 | 3 | [
"MIT"
] | permissive | class MajorityChecker {
unordered_map<int, vector<int>> indexMap;
vector<int> numbers;
public:
MajorityChecker(vector<int> &arr) : numbers(arr) {
for (int i = 0; i < arr.size(); i++) {
indexMap[arr[i]].push_back(i);
}
}
int query(int l, int r, int threshold) {
int temp = -1;
for (int i... | true |
edc761e6b03f528d9a959ac7300378458d3dc608 | C++ | Kpure1000/B_project | /B_project/Vector3.h | UTF-8 | 2,153 | 3.328125 | 3 | [] | no_license | #pragma once
#include<cmath>
namespace bf
{
template <typename T>
class Vector3
{
public:
Vector3() :x(0), y(0), z(0) {}
Vector3(T const& X, T const& Y, T const& Z) :x(X), y(Y), z(Z) {}
/****************/
template <typename T>
Vector3<T> operator+(Vector3<T> const& right)
{
return Vector3(this->x +... | true |
b64969cc13410f8bd0b6605658635c2082148a7a | C++ | EmlynLXR/Hust | /C/实验4/源程序修改替换.cpp | UTF-8 | 625 | 3.515625 | 4 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#define max(x,y,z) (x>y?(x>z?x:z):(y>z?y:z))
float sum(float x, float y);
int main()//void main(void)
{
int a, b, c;
float d, e;
printf("Enter three integers:");
scanf("%d,%d,%d", &a, &b, &c);
printf("\nthe maximum of them is %d\n", max(a, b, c));
printf("Enter t... | true |
caf342dc64f808f6a1957272df18244cd4143284 | C++ | scott-sommer/dll_wrapper_prototype | /include/DataTypes.hpp | UTF-8 | 1,187 | 2.640625 | 3 | [] | no_license | #pragma once
namespace ModelData {
struct Vec3D {
double x{ 0.0 };
double y{ 0.0 };
double z{ 0.0 };
friend bool operator==(const Vec3D& lhs, const Vec3D& rhs) {
return lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z;
}
};
struct Rot3D {
double pitch{ 0.0 };
double yaw{ 0.0 };
double roll{ 0... | true |
8a203a0479ce80fa1dd9889376363111068d0f66 | C++ | kunmukh/CS-475 | /CS-475/InClass-Assignment/CS215/lecture31/queue.h | UTF-8 | 1,647 | 3.53125 | 4 | [] | no_license | // File: queue.h
// Defines QueueType, a queue of items
// Array implementation
// Based on Dale, et al., C++ Plus Data Structures 6/e, Chapter 5
#ifndef QUEUE_H
#define QUEUE_H
#include "itemtype.h"
// The user of this file must provied a file "itemtype.h" that defines:
// ItemType : the class definition of ... | true |
e349b6c4cb1727ddf259e16dedc53ac678b21de5 | C++ | idkunal/SDE_SHEET_180 | /maximum length subarray with given XOR.cpp | UTF-8 | 508 | 2.828125 | 3 | [] | no_license | /*
INPUT - [4,2,2,6,4], XOR = 6
OUTPUT - 3
*/
#include <bits/stdc++.h>
#include<map>
using namespace std;
int main() {
int n,k;
cin >> n >> k;
int arr[n];
for(int i = 0; i < n; i++)
cin >> arr[i];
unordered_map<int,int> mp;
int xo = 0, len = 0;
for(int i = 0; i < n; i++){
xo ^= arr[i];
if(mp.f... | true |
1e440a62e0c17ed6e40e8bfbba2698c991229839 | C++ | wakira/mkalpha | /kernel/kernel.h | UTF-8 | 2,367 | 2.53125 | 3 | [] | no_license | #ifndef KERNEL_H_
#define KERNEL_H_
#include "app/base.h"
#include "oslib/io_events.h"
#include "oslib/io_devices.h"
#include "mbed.h"
#include <list>
#include <map>
#include <string>
// defines the singleton kernel
// we define no destructor since the kernel should run forever
class LcdFactory;
class Kernel {
priv... | true |
115de8666d34533d08edd03ec60ac752068c1336 | C++ | progg1992/School-Projects | /Coding-Projects/C++/Advanced-C++/Engine.cpp | UTF-8 | 780 | 3.3125 | 3 | [] | no_license | #include "Engine.h"
Engine::Engine()
{
numCylinders = 0;
horsePower = 0;
}
Engine::Engine(short numCylinders, short horsePower)
{
setNumCylinders(numCylinders);
setHorsePower(horsePower);
}
Engine::~Engine()
{
}
string Engine::toString()
{
return "numCylinders: " + to_string(numCylinders) + ", horsePower: " + ... | true |
3f000343edcb146c759d78cc3bdc6e2d567d6679 | C++ | ezhangle/node-mapbox-gl-native | /src/compress_png.cpp | UTF-8 | 3,094 | 2.625 | 3 | [] | no_license | #include <node.h>
#include <nan.h>
#include <mbgl/util/image.hpp>
namespace node_mbgl {
class CompressPNGWorker : public NanAsyncWorker {
public:
CompressPNGWorker(NanCallback *callback, v8::Local<v8::Object> buffer_, uint32_t width_,
uint32_t height_)
: NanAsyncWorker(callback),
... | true |
63fd6c6119b6e79524eb4201b21b2bd5a536e3a1 | C++ | TomekAtomek/MyTimber | /main.cpp | UTF-8 | 10,232 | 2.640625 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <cstdlib>
#include <ctime>
#include <sstream>
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
using namespace sf;
typedef struct mysprite
{
Sprite sprite;
bool isActive;
float moveSpeed;
} MySprite;
void updateBranches( int seed );
const int NUM_BRANCHES = 6;
Sprite bra... | true |
ae604f33fc4a4d3d3b6b619ec6cb1bf3acff28e7 | C++ | eatyourpotato/RobotDo | /Robot rRocks/src/ElementARepresenter.h | UTF-8 | 559 | 2.875 | 3 | [] | no_license |
#ifndef ELEMENTAREPRESENTER_H_
#define ELEMENTAREPRESENTER_H_
#include <vector>
#include "Afficheur.h"
using namespace std;
class Afficheur;
class ElementARepresenter{
private:
vector<Afficheur*> v;
public:
void attacherAfficheur(Afficheur* a){
v.push_back(a);
}
void detacherAfficheur(Afficheur* a){
vector... | true |
bca0c900dad5411d22edbdd77fa033cf8601c531 | C++ | erinsb/tetris | /tetris.ino | UTF-8 | 3,964 | 2.765625 | 3 | [] | no_license | #include <Adafruit_GFX.h> // Core graphics library
#include <RGBmatrixPanel.h> // Hardware-specific library
//#include "tetris.h"
#define CLK 11 // MUST be on PORTB! (Use pin 11 on Mega)
#define OE 9
#define LAT 10
#define A A0
#define B A1
#define C A2
#define D A3
#define STARTX 12
#define STARTY 10
... | true |
687199537bf849dfd8cad3a75e03cadfabf11dd8 | C++ | jjzhang166/angle | /vertexbuffer.hpp | UTF-8 | 4,293 | 3.125 | 3 | [] | no_license | //@ {"targets":[{"name":"vertexbuffer.hpp","type":"include"}]}
#ifndef ANGLE_VERTEXBUFFER_HPP
#define ANGLE_VERTEXBUFFER_HPP
#include "exceptionhandler.hpp"
#include <cassert>
#include <utility>
namespace Angle
{
enum class BufferUsage:GLenum
{
STREAM_DRAW=GL_STREAM_DRAW
,STREAM_READ=GL_STREAM_READ
,STREA... | true |
ac9747fb2e6031ac6cd0af1a149f9dd56b99d89e | C++ | F3LuxRay/LattePanda | /DIGITALTOUCH.ino | UTF-8 | 900 | 3.046875 | 3 | [] | no_license | /*
Arduino Touch Sensor
5V VCC
GND GND
D3 SIG
*/
int TouchSensor = 3; //connected to Digital pin D3
int onLed = 6; //connected to pin 6
int offLed = 13; //connected to pin 13
void setup(){
Serial.begin(9600); // Communication speed
pinMode(onLed, OUTPUT);
pinMode(off... | true |
12938a0e1f4ec47e087f94b0afde6ba6f172f074 | C++ | pushp360/CCC | /C++/Arrays/MinimizetheCellWastage.cpp | UTF-8 | 1,587 | 3.234375 | 3 | [] | no_license | /*
* Created Date: Saturday June 11th 2019
* Author: Rajeshwari Kalyani
* Email-ID: klhn.rajeshwari@gmail.com
* -----
* Copyright (c) 2019 Rajeshwari Kalyani
*/
/*
Question source: HackerRank
Description: Previously, it was important for every company to have a motto.
Now, it is important for every company to h... | true |
411448051a2dd4359efe195ed33c55dd829e919d | C++ | blighli/graphics2020 | /22051150李浩雨/编程作业/homework_2/light.cpp | UTF-8 | 1,356 | 3.109375 | 3 | [] | no_license | #include "light.h"
DirectionalLight::DirectionalLight(int _type, glm::vec3 _angleOrDir, glm::vec3 _color, float _intensity, glm::vec3 _position)
{
this->color = _color;
this->intensity = _intensity;
this->position = _position;
this->angle = _angleOrDir;
this->direction = _angleOrDir;
UpdateAngleOrDirection(_type... | true |
e4e3547be7bf99d357a30e1fd9be60a55b14567f | C++ | zheminggu/computer-graphics | /ComputerGraphics/Draw.cpp | UTF-8 | 2,086 | 2.859375 | 3 | [] | no_license | //#include "Utils.h"
#include "Vector3.h"
#include "Vector4.h"
#include "Draw.h"
#include <Windows.h>
#include <gl\GL.h>
#include <iostream>
#include <fstream>
//#include "Math.h"
//using namespace OpenGLUtils;
//using namespace Vector;
void Draw::DrawLine(Vector3 startPosition, Vector3 endPosition) {
//startPositi... | true |
934bb1f721538d0bfe4682b8d41a379aa229552c | C++ | WYuanisme/generateVectorAlgorithm | /Walk_1.cpp | GB18030 | 725 | 2.953125 | 3 | [] | no_license | #include "Walk_1.h"
#include <vector>
using namespace std;
Walk_1::Walk_1(int totalNetNum1)
{
totalNetNum = totalNetNum1;
for (int i=0;i!=totalNetNum;++i) // i
{
vector<int> STV_temp; // һʱiSTV
for (int j = 0; j != totalNetNum; ++j)
{
if (i... | true |
dfd900094a967316239d33429b8d976dcbfa68b8 | C++ | khalilmez/JIN4_quiz | /src/Text.h | ISO-8859-1 | 952 | 2.96875 | 3 | [] | no_license | #pragma once
#include "Element.h"
#include <SFML/Graphics/Font.hpp>
#include <SFML/Graphics/Text.hpp>
#include <pugixml.hpp>
/* Cette classe reprsente les lments textuels d'un cran.
*/
class Text : public Element {
public:
explicit Text(pugi::xml_node const &node);
explicit Text(const float x, const float y, std:... | true |
539d73f23823d18ef10c154a877279647a3a24c5 | C++ | chrishopp12/Palomar-CSCI-222 | /HoppChris CSCI 222 - Lab 3 Operator Overloading Lab (IntArray)/intarray.h | UTF-8 | 907 | 3.078125 | 3 | [] | no_license | /*
Lab 3 - Operator Overloading (IntArray)
Author: Chris Hopp - 010809627
Version: 04.13.2018
*/
#ifndef _INTARRAY_H
#define _INTARRAY_H
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdlib.h>
using namespace std;
class IntArray {
private:
string name;
int upper;
in... | true |
eda2a318049f5f2356a404b4cc0356ff711c1db5 | C++ | etrizzo/PersonalEngineGames | /Thesis/Thesis/Code/Game/StoryData.hpp | UTF-8 | 2,189 | 2.609375 | 3 | [] | no_license | #pragma once
#include "Game/GameCommon.hpp"
#include "Game/StoryRequirementSet.hpp"
#include "Game/CharacterRequirementSet.hpp"
#include "Game/EffectSet.hpp"
#include "Game/StoryDataDefinition.hpp"
class Character;
class StoryState;
class Action;
class StoryData{
public:
StoryData(){};
StoryData(StoryDataDefinition... | true |
02dad4b3c27174379ae9316864da7c9666a8e341 | C++ | PaniQue7/AlgorithmStudy | /0512/1005_MWK.cc | UTF-8 | 1,182 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
vector<int> times;
vector<vector<int> > depend;
vector<int> dp;
void dfs(int node)
{
if(depend[node].empty())
{
dp[node] = times[node];
}
else
{
for(int i = 0; i < depend[node].size(); i++)
{
... | true |
43eae219b47dcc368e3ceac3e88374c4f0482339 | C++ | shyaZhou/Design-Patterns | /06CommandPattern/02/CeilingFanMediumCommand.h | UTF-8 | 784 | 2.8125 | 3 | [] | no_license | #ifndef _CEILINGFANMediumCOMMAND_H_
#define _CEILINGFANMediumCOMMAND_H_
#include "Command.h"
#include "CeilingFan.h"
class CeilingFanMediumCommand : public Command {
public:
CeilingFanMediumCommand(CeilingFan *ceilingFan) :
Command("CeilingFanMeidumCommand"),
_ceilingFan(ceilingFan) {}
void execute() o... | true |
635f730468ab96353cd4a3d84696896a9b110617 | C++ | yuriykulikov/Abandoned-xmega_cpp_example | /drivers/Leds.h | UTF-8 | 1,411 | 2.578125 | 3 | [] | no_license | /* This file has been prepared for Doxygen automatic documentation generation.*/
/*
* Copyright (C) 2012 Yuriy Kulikov
* Universitaet Erlangen-Nuernberg
* LS Informationstechnik (Kommunikationselektronik)
* Support email: Yuriy.Kulikov.87@googlemail.com
*
* Licensed under the Apache License, Versio... | true |
c815e30f5c83b07853769b16b5ba8bb409610cee | C++ | wonkicho/algoStudy | /Algorithm/Algorithm/2.cpp | UTF-8 | 318 | 2.984375 | 3 | [] | no_license | //#include <iostream>
//using namespace std;
//
//int recur(int x)
//{
// if (x >= 2) {
// x *= recur(x - 1);
// return x;
// }
// else {
// return 1;
// }
//}
//
//int main()
//{
// int num;
// cin >> num;
// int result = recur(num);
// cout << result;
// return 0;
//} | true |
f1f942ec9f86daf4ed91329fc42c96daafa53581 | C++ | QingQiu0215/RiskGame | /StrategyBox.cpp | UTF-8 | 488 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include "Strategy.h"
#include "StrategyBox.h"
using namespace std;
StrategyBox::StrategyBox() {};
StrategyBox::StrategyBox(Strategy *initStrategy)
{
this->strategy = initStrategy;
}
void StrategyBox::setStrategyBox(Strategy *newStrategy)
{
this->strategy = newStrategy;
}
void StrategyBox::exec... | true |
754236d0ef1deba2f43c31e521dd39520af97b8a | C++ | Einstein10-Carson/Project-Einstein2 | /main--.cpp | UTF-8 | 303 | 2.796875 | 3 | [] | no_license | #include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int n; int m;
n = 5;
m =5;
for( int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
std::cout<<"a[i][j]";
}
}
return 0;
}
| true |
15f4e5a8dab93cdefbfe3443a7a0854883b48055 | C++ | kartikeysingh6/OpenCVProjects | /EqualSumParti.cpp | UTF-8 | 888 | 3.515625 | 4 | [] | no_license | //We're given an array and we've to tell if it's possible to equally divide it or not
#include <bits/stdc++.h>
using namespace std;
int static t[101][1001];
//Subsetsum memoized code
int subsetSum(int*arr,int n,int sum){
if(sum==0)
return 1;
if(n==0)
return 0;
if(t[n][sum]!=-1)
return t[n][s... | true |
ba1e7ff0f2a76228415f1fd44a3d5b482ed5315d | C++ | Siddu96/CPP_11 | /19_Tuple/02_tupleSwap.cpp | UTF-8 | 1,754 | 4.21875 | 4 | [] | no_license |
// C++ code to demonstrate tuple, get() and make_pair()
#include<iostream>
#include<tuple> // for tuple
int main()
{
// Declaring tuple
//std::tuple <data_type1, data_type2, data_type3> tuple_name = std::make_tuple(data1, data2, data3);
//std::tuple <char, int, float> geek = std::make_tuple('a', 10,... | true |
b4c631e45990387d2cf48d3df634c31fe05b51db | C++ | wei15987/CS335_HashTable | /Wei.Lian_CS335_Project3/separate_chaining.h | UTF-8 | 3,367 | 3.046875 | 3 | [] | no_license | /*******************************************************************************
Title : separate_chaining.h
Author : Wei Lian
Created on : April 7, 2018
Description : Implementation to the HashSeparateChaining class with interface
Purpose :
Usage :
Build with ... | true |
cbc41327d68f2cb5ab66ed1e3b82bd85fda8ab9d | C++ | slopezv2/CompetitiveProgramming | /subsum.cpp | UTF-8 | 849 | 2.984375 | 3 | [] | no_license | #include<sstream>
#include<iostream>
#include<string>
using namespace std;
#define D(x) cout<<#x<< " "<<x<<endl;
int main(){
string line;
string result ="";
while(getline(cin, line)){
stringstream ss;
ss<< line;
int size, target, i = 0;
ss>>size>>target;
int array [size] ;
getline(cin, line);
s... | true |
ab71428c54657d1f87851179eeceb446b8fb797f | C++ | Jacobsky98/OOP_WFIIS_2019 | /LATO19_GR5_WK6/Pojazd.h | UTF-8 | 371 | 2.546875 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <string>
#include "PredkoscMaksymalna.h"
class Pojazd : public PredkoscMaksymalna{
public:
friend std::ostream& operator<<(std::ostream& o, const Pojazd& p);
virtual std::string name() const = 0;
virtual ~Pojazd() = default;
};
std::ostream& operator<<(std::ostrea... | true |
232d71e1a9a79317c546b78804ee0ae8aba182df | C++ | Graphics-Physics-Libraries/Tiny3D | /Win32Project1/model/mtlloader.cpp | UTF-8 | 1,775 | 2.796875 | 3 | [] | no_license | #include "mtlloader.h"
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include "../assets/assetManager.h"
#include "../material/materialManager.h"
using namespace std;
MtlLoader::MtlLoader(const char* mtlPath) {
mtlFilePath=mtlPath;
mtlCount=0;
readMtlInfo();
readMtlFile();
}
MtlLoad... | true |
a31364a86611a7e3b56061c106946453a3951c4c | C++ | Mikalai/punk_project_a | /source/algorithm/incseq.cpp | UTF-8 | 1,006 | 3.015625 | 3 | [] | no_license | #include <utility>
#include <algorithm>
#include <vector>
#include <fstream>
std::ifstream input("incseq.in");
std::ofstream output("incseq.out");
int g_n;
std::vector<std::pair<int, int>> g_numbers;
int main() {
input >> g_n;
g_numbers.resize(g_n);
for (int i = 0; i < g_n; ++i) {
input >> g_numbers[i].first;... | true |
f8f0514e0f0bebf5f210b6bf8397130c05e3cddf | C++ | scylla-zpp-blas/linear-algebra | /tests/blas_level_1/vector_const_op.cc | UTF-8 | 9,156 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | #include <cmath>
#include <boost/test/unit_test.hpp>
#include "../test_utils.hh"
#include "../fixture.hh"
#include "../vector_utils.hh"
BOOST_FIXTURE_TEST_CASE(vector_dot_float, vector_fixture)
{
// Given two vector of five values.
std::vector<float> values1 = {4.234f, 3214.4243f, 290342.0f, 0.0f, -1.0f};
... | true |
854f46bcd65540d23418e969c8ad2c1cb51c2ad8 | C++ | DimitarYordanov17/Space_Challenges_2021_Ground_Station | /Arduino Sketches/serialRead/serialRead.ino | UTF-8 | 1,964 | 3.1875 | 3 | [] | no_license | /* 05.10.2020
* The stepper goes reverse and forward with different speed.
* The maximum speed of the current model is around 14 RPM.
* - 2 miliseconds delay means -> 2 * 2048 = 4096 ms for 1 rev.
* 60/(4096/1000) = 14.64 RPM with 2 ms delay; [measured ~=14.15 rpm forward ~= 14.38 rpm backwards]
* - 3 ms de... | true |
ea4e3d383f71523a0f7beb5d1b04f35c7d34cad3 | C++ | Haar-you/kyopro-lib | /Mylib/DataStructure/FenwickTree/fenwick_tree_2d.cpp | UTF-8 | 1,783 | 3.140625 | 3 | [] | no_license | #pragma once
#include <cassert>
#include <vector>
namespace haar_lib {
template <typename AbelianGroup>
class fenwick_tree_2d {
public:
using value_type = typename AbelianGroup::value_type;
private:
AbelianGroup G_;
int w_, h_;
std::vector<std::vector<value_type>> data_;
private:
value... | true |
ba14ef069488d5f2018f723519847ff8ab986251 | C++ | DingZhan/CCF_NOI | /1111 Blash数集(2).cpp | UTF-8 | 661 | 2.609375 | 3 | [] | no_license | #include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
int main()
{
long long a, n, last;
while(cin>>a>>n)
{
set<long long> nums;
set<long long>::iterator iter;
nums.insert(a);
iter = nums.begin();
while(num... | true |
cf6c1aae97fd662a8153039e5fb58ca99555eb48 | C++ | vimtaai/elte | /2017-18-1/pa-3/gyak06b/main.cpp | ISO-8859-2 | 1,676 | 2.734375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
const int MAXN = 32;
// Be
string mondat;
// Ki
int magasdb, melydb, vegyesdb;
// Beolvasas
getline(cin, mondat);
string szavak[MAXN];
int szoszam = 0;
for(int i = 0; i < mondat.length(); ++i)
{
if (mondat[i] =... | true |
7e728e722000b43450c714d355dd0866bfa5e4ac | C++ | Draketuroth/Lilla-Spelprojektet-Grupp-2 | /Window.cpp | IBM852 | 7,461 | 3.015625 | 3 | [] | no_license |
#include "Window.h"
#include <iostream>
bool WindowInitialize(HWND &windowHandle) {
// HINSTANCE is a handle to an instance. This is the base address of the module in memory and handles the instance of the module to be associated with the window.
HINSTANCE applicationHandle = GetModuleHandle(NULL);
if (... | true |
04040ab741f558cebbf567e12d4be0f7a3d78380 | C++ | superstylin04/Stacer | /stacer-core/Info/disk_info.cpp | UTF-8 | 690 | 2.671875 | 3 | [
"MIT"
] | permissive | #include "disk_info.h"
#include <QDebug>
DiskInfo::DiskInfo()
{
}
QList<Disk> DiskInfo::getDisks() const
{
return disks;
}
void DiskInfo::updateDiskInfo()
{
try {
QStringList result = CommandUtil::exec("df -Pl").split(QChar('\n'));
QRegExp sep("\\s+");
for (const QString &line : res... | true |
ad5684a5a7bc0b7c5f4bc5aa88792f2ea74c6df8 | C++ | wgbusch/laboalgo2num2 | /src/Diccionario.h | UTF-8 | 575 | 2.953125 | 3 | [] | no_license | #ifndef __DICCIONARIO_H__
#define __DICCIONARIO_H__
#include <vector>
using namespace std;
typedef int Clave;
typedef int Valor;
class Diccionario {
public:
Diccionario();
void definir(Clave k, Valor v);
bool def(Clave k) const;
Valor obtener(Clave k) const;
void borrar(Clave k);
bool operator==(Diccionario d)... | true |
58469a3e4d4b4a54df876e99ccb8dc1e4a1e84d5 | C++ | mdfarhansadiq/UVA-Online-Judge-Solutions | /UVA_10009.cpp | UTF-8 | 3,045 | 2.703125 | 3 | [] | no_license | /***
_______________________________
MD. SYMON HASAN SHOHAN
UNIVERSITY OF ASIA PACIFIC
isymonhs@gmail.com
_______________________________
*/
#include<bits/stdc++.h>
using namespace std;
map < string, vector < string> > G;
map < string, int> visited;
map <stri... | true |
75bd5f1f1bea862509fcf196935a8571312cd6b2 | C++ | gpeal/Arduino | /libraries/TextStream/TextStream.h | UTF-8 | 1,696 | 2.875 | 3 | [] | no_license | /*
* TextStream.h
*
* Created on: 2012/08/07
* Author: sin
*/
#ifndef TEXTSTREAM_H_
#define TEXTSTREAM_H_
#if ARDUINO >= 100
#include <Arduino.h>
#else
#include <Wiring.h>
#endif
#include <Stream.h>
// stdlib.h is included in Arduino.h
const char endl = '\n';
const char cr = '\r';
const char tab = '\t';
... | true |
bb09532bf72872ba0411f64a6a9b0b24dba2e398 | C++ | jab0079/COMP4300-P1 | /include/Scoreboard.hh | UTF-8 | 3,300 | 2.515625 | 3 | [] | no_license | #ifndef SCOREBOARD_HH
#define SCOREBOARD_HH
/*
*
* Scoreboard.hh
*
* Contributors: Adam Eichelkraut
* Jared Brown
* Contact: ake0005@tigermail.auburn.edu
* jab0079@tigermail.auburn.edu
*
* Description:
* This class defines the... | true |
9aad78fa70eb736065e8ba35723caf9500b6f8af | C++ | Kidd-Ye/program-list-06 | /Majority/Majority/main.cpp | UTF-8 | 893 | 3.5 | 4 | [] | no_license | //
// main.cpp
// Majority
//
// Created by kidd on 2018/9/8.
// Copyright © 2018年 Kidd. All rights reserved.
//
#include <iostream>
int Majority(int arr[], int length){
int i, temp, count = 1;
temp = arr[0];
for (i = 1; i < length; i++) {
if (arr[i] == temp) {
count++;
... | true |
308b87289b4f64156fa36bde44136c5935e33720 | C++ | bitmingw/LintcodeSolution | /420CountAndSay/main.cpp | UTF-8 | 1,359 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
class Solution {
public:
/**
* @param n the nth
* @return the nth sequence
*/
string countAndSay(int n) {
if (n == 0) return "";
if (n == 1) return "1";
string pre = "1";
string cur;
int round = 1... | true |
2934b5ad80f378ae4c8a0758b1c7f3eb89b7abf0 | C++ | meirfuces/ansector-tree-B | /FamilyTree.hpp | UTF-8 | 1,093 | 3.0625 | 3 | [] | no_license |
#ifndef _FamilyTree_
#define _FamilyTree_
#include <iostream>
#include <string>
using namespace std;
class node {
public:
string name;
string sex;
string relation;
int height;
node *father;
node *mother;
node(string _name)
{ // Constructor with parameters
this->name = _name;
... | true |
4304894f857a600d021e1334516540915723c997 | C++ | shailendra-singh-dev/ProgrammingChallenges | /Caribbean Online Judge COJ/1386 - Unearthing Treasures.cpp | UTF-8 | 578 | 2.90625 | 3 | [] | no_license | #include <cstdio>
#include <vector>
#define FOR1(i, a, b, c) for(i = a ; i <= b ; i += c)
#define FOR2(i, a, b, c) for(i = a ; i < b ; i += c)
#define PB(v, n) v.push_back(n)
using namespace std;
int P, Q, i, j;
int main()
{
scanf("%d %d", &P, &Q);
vector<int> factors1, factors2;
FOR1(i, 1, P, 1)
{... | true |
bc669beeca56e7c809f285ff7b7ab055d5f9a740 | C++ | marchenkoiv/lab3-1- | /3_2/Prog3_2.cpp | UTF-8 | 5,364 | 3.1875 | 3 | [] | no_license | #include "Hex_S_2.h"
using namespace Prog3_2;
int main()
{
int b = 1;
int k;
Hex st, sum;
bool n;
do
{
switch (b)
{
case 1:
std::cout << "Enter new hex number: ";
try
{
std::cin >> st;
}
catch (const std::exception &ex)
{
std::cout << ex.what() << std::endl;
}
std::cout <... | true |
fc1a2aabe6d40333294dff04f045a0f2524d9607 | C++ | ppatel56/parth-patel-OS-Course-Project | /CIS 3207 Project 4/fs.cpp | UTF-8 | 27,017 | 2.59375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <cstring>
#include <list>
#include <map>
#include <cstdio>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/m... | true |
ba9e6ca65931a3bda5bcaa0c0cf095a0f8593e4b | C++ | pnikic/Hacking-uva | /10684.cpp | UTF-8 | 470 | 2.90625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int n, a;
while (cin >> n, n)
{
int best = 0, cs = 0;
for (int i = 0; i < n; ++i)
{
cin >> a;
cs += a;
best = max(best, cs);
cs = max(cs, 0);
}
if (b... | true |
6f225934b1c2c3e89423c28c082d23b99732f04b | C++ | skgbanga/Sandbox | /cpp/concurrent_servers/utils.h | UTF-8 | 1,285 | 2.5625 | 3 | [] | no_license | #pragma once
#include <sys/socket.h>
#include <netinet/in.h>
#include <fmt/ostream.h> // fmt::print
#include <fmt/time.h> // time related formatting
#include <sys/time.h> // gettimeofday
// Directly from https://github.com/eliben/code-for-blog/blob/master/2017/async-socket-server/utils.h
// print the error mess... | true |
ab4e39a36ff5b2a014c2e2287477623e7181cc83 | C++ | Eae02/jamlib | /Src/Graphics/Sampler.cpp | UTF-8 | 4,175 | 2.625 | 3 | [
"Zlib"
] | permissive | #include "Sampler.hpp"
#include "OpenGL.hpp"
#include <exception>
namespace jm
{
TextureMinFilter MakeTextureMinFilter(Filter filter, std::optional<Filter> mipFilter)
{
switch (filter)
{
case Filter::Linear:
if (!mipFilter.has_value())
return TextureMinFilter::Linear;
if (mipFilter.value() == Filter... | true |
2f49ee40a7fdaf562c440f93c3bf304693943942 | C++ | ImadT/Resolution-de-l-equation-de-chaleur-en-c- | /materiau.cpp | UTF-8 | 401 | 2.59375 | 3 | [] | no_license | #include "materiau.h"
namespace ensiie{
Materiau::Materiau(double lambda, double rho, double c):lambda_(lambda), rho_(rho), c_(c){
}
Materiau::Materiau(const Materiau& m){
lambda_= m.lambda_;
rho_ = m.rho_;
c_ = m.c_;
}
double Materiau::get_lambda(){
return lambda_;
}
double Materiau::... | true |
7dcc37c149c37869b5617bb1d41a2f61d1518179 | C++ | kofyou/PersonalProject-C | /221801212/src/WordCount.cpp | UTF-8 | 5,300 | 3.1875 | 3 | [] | no_license | #include <vector>
#include <algorithm>
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
using namespace std;
string duan = "";
int wordcount = 0;
int line = 1;
int character = 0;
struct Record
{
string word;
int count;
};
static bool sortType(const Record& v1, const R... | true |
b22870767692f8b32aa0214c77e7247bb246feac | C++ | GCY/NTCU-CSIE-Project | /BookManager/try/ISBNCheck.cpp | UTF-8 | 1,661 | 4.09375 | 4 | [
"MIT"
] | permissive | #include <string>
int isbnDigitToInt(const char digit);
/**
* 檢查 ISBN-10 或 ISBN-13 碼是否有效。
* @return true 表示有效
* @param isbn ISBN 字串,無連字號'-'。
*/
bool isIsbnValid(std::string isbn)
{
if (isbn.length() < 10) {
return false;
} else if (isbn.length() < 13) {
// ISBN-10
... | true |
667bdac3986f906dbcd7516f74a49acc34c0eb17 | C++ | amasson42/GLSScene | /GLScene/includes/GLScene/GLSSkeleton.hpp | UTF-8 | 2,988 | 2.6875 | 3 | [] | no_license | //
// GLSShader.hpp
// GLScene
//
// Created by Arthur Masson on 12/04/2018.
// Copyright © 2018 Arthur Masson. All rights reserved.
//
#ifndef GLSSkeleton_h
#define GLSSkeleton_h
#include "GLSStructs.hpp"
#include "GLSIAnimatable.hpp"
#include "GLSInterpolator.hpp"
#include "GLSNode.hpp"
namespace GLS {
cl... | true |
4ad5fe50c5cd317611b56a2326b68d5ac2c943b1 | C++ | TANG-Kai/pyfx | /src/Union.cpp | UTF-8 | 518 | 2.53125 | 3 | [] | no_license | #include "Union.h"
using namespace vr;
const Box Union::getBBox() const
{
const Box
a = m_VolumeA->getBBox(),
b = m_VolumeB->getBBox();
return a.expand(b);
}
const Vector Union::grad(const Vector &p) const
{
const float
f1 = m_VolumeA->eval(p),
f2 = m_VolumeA->eval(p);
if(f1 > f2)
{
r... | true |
79eaa224a84bc457e075efb585e2583ffd23f912 | C++ | PriyanshuPatel02/Competitive-programming-everyday | /Phase - 1(60 questions)/Day-3/13. Non-decreasing Array.cpp | UTF-8 | 501 | 3 | 3 | [] | no_license | // Link - https://leetcode.com/problems/non-decreasing-array
// Author - Shumbul Arifa
class Solution {
public:
bool checkPossibility(vector<int>& nums) {
int dec = 0;
bool decrease = 0;
for (int i = 1; i < nums.size(); i++) {
decrease = 0;
if (nums[i - 1] > nums[i])
dec++, decrease = 1;
if (decrea... | true |
e94775d7598ad0e41a798568860cd19bbe249e02 | C++ | qooldeel/adonis | /sparse/sparsematrix.hh | UTF-8 | 14,382 | 2.6875 | 3 | [] | no_license | #ifndef SPARSE_MATRIX_CONTAINER_HH
#define SPARSE_MATRIX_CONTAINER_HH
#include <iostream>
#include <vector>
#include "umftypetraits.hh"
#include "sparseutilities.hh"
#include "../common/globalfunctions.hh"
#include "../common/error.hh"
#include "../common/typeadapter.hh"
#include "../common/adonisassert.hh"
#include ... | true |
dcad87175be0b642abf968b43f56983b5b1df1a1 | C++ | tomermy/iot_workshop | /Project2/EX2/EX2.ino | UTF-8 | 12,300 | 2.8125 | 3 | [] | no_license | /*
The Secret Knock Detecting Box
The knocking box embedded a piezo sensor for knocking detection.
The Idea behind it is to improve piezo sensitivity and create a more reliable sensor.
The Arduino uses the knocking box as a sensor to record a knocking pattern.
The user can set a recording kno... | true |
a6ac8889d7863015e17514c4ec18c36b9713a153 | C++ | zuev-stepan/MIPT | /MIPT-2SEM/mst/boruvka.cpp | UTF-8 | 2,393 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <ctime>
using namespace std;
typedef vector<vector<double> > Graph;
vector<int> go[100000];
struct edge
{
int x, y;
double l;
edge(){}
edge(int a, int b, double c) : x(a), y(b), l(c) {}
};
bool cmp(edge a, edge b){... | true |
d477daf705da3585c5618faf6c367a631f65a326 | C++ | KoiKomei/Sokoban | /Sokoban/FileManager.cpp | UTF-8 | 2,614 | 2.75 | 3 | [] | no_license | #include "FileManager.h"
FileManager::FileManager() {
found = false;
}
FileManager::~FileManager() {
}
void FileManager::LoadContent(const char *filename, vector<vector<string>> &attributes, vector<vector<string>> &contents) {
ifstream openfile(filename);
string line, newLine;
if (openfile.is_open()) {
whi... | true |
d14d29fa75f94e4468516fd0522e5d4a869165cd | C++ | secondtonone1/fingerserver | /GameMasterTool/LoginPanel.cpp | GB18030 | 3,854 | 2.5625 | 3 | [] | no_license | #include "LoginPanel.h"
#include "GameMasterTool.h"
using namespace Lynx;
IMPLEMENT_CLASS(LoginPanel, wxPanel)
BEGIN_EVENT_TABLE(LoginPanel, wxPanel)
EVT_BUTTON(myID_LOGIN_BTN, onLoginBtnClicked)
EVT_BUTTON(myID_LOGIN_QUIT, onQuitBtnClicked)
END_EVENT_TABLE()
LoginPanel::LoginPanel(wxWindow* parent, wxWindowID id, ... | true |
7ada185ea046efcc9c9e2a51e205e051eb9966b1 | C++ | BilhaqAD07/AlgoritmaPemrograman | /SEMESTER 1/ALPROM 1/.vscode/main.cpp | UTF-8 | 824 | 3.21875 | 3 | [] | no_license | #include <iostream>
using namespace std;
float KONVERSIKEL(float A){
float I;
I= A+273;
return I;
}
float KONVERSIFAR(float B){
float J;
J= B*1.8+32;
return J;
}
int main(){
system("cls");
float n,f,k,F,K;
char konversi;
cout << "Masukkan Nilai(Celcius) = "; cin >> n;
cout... | true |
6edd96f7808a842c350b35032fbd07ac910e95ca | C++ | gisilves/amsdaq-code | /DAQ/DAQ/SlowControl/testq.cxx | UTF-8 | 641 | 2.578125 | 3 | [] | no_license |
#include <stdio.h>
#include <iostream>
#include "QList.h"
using namespace std;
int main() {
QCommand *qcmd=0, *first=0;
for (unsigned short i=0; i<5; i++) {
if (i==0) {
qcmd=new QCommand(0,1,2,3,i);
cout << qcmd << endl;
first=qcmd;
}
else {
QCommand *dum=new QCommand(i,i,0... | true |
dbd4087c8efbbae9e3bb46c7c0501bce19c448cc | C++ | kdt3rd/gecko | /libs/base/size.h | UTF-8 | 6,267 | 3.453125 | 3 | [
"MIT"
] | permissive | // SPDX-License-Identifier: MIT
// Copyright contributors to the gecko project.
#pragma once
#include "type_util.h"
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <iostream>
namespace base
{
////////////////////////////////////////
/// @brief Width and height
template <typenam... | true |
d3004d8c0a87bb34871bbdecc461c7421b72a5d8 | C++ | Chewnonobelix/ArmyBuilder | /Src/Model/modif.cpp | UTF-8 | 994 | 2.90625 | 3 | [] | no_license | #include "Header/Model/modif.h"
Modif::Modif()
{
}
Modif::Modif(const Modif & mod)
{
m_nom = mod.m_nom;
m_cles = mod.m_cles;
m_depuis = mod.m_depuis;
m_vers = mod.m_vers;
}
modif Modif::getCles()
{
return m_cles;
}
QString Modif::getDepuis()
{
return m_depuis;
}
QString Modif::getVers()
{
... | true |
db4bce3cda712b758a0fea4601ce7b1b5bdf2780 | C++ | claimred/practice | /cpp/correct-the-time-string.cpp | UTF-8 | 2,253 | 3.390625 | 3 | [] | no_license | //Task codewars id: 57873ab5e55533a2890000c7
/* Task codewars description: A new task for you!
You have to create a method, that corrects a given time string.
There was a problem in addition, so many of the time strings are broken.
Time-Format is european. So from "00:00:00" to "23:59:59".
<br>
<br>
Some examples:
"0... | true |
40808da7778240bc923bd45475380a098048f25a | C++ | ZiqiuZhou/Linux_HPC | /chapter6_高级IO/sendfile_server.cpp | GB18030 | 1,765 | 2.625 | 3 | [] | no_license | #include <sys/socket.h>
#include <iostream>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <cassert>
#include <unistd.h>
#include <cstdlib>
#include <string.h>
#include <vector>
#include <string>
#include <cerrno>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <fcntl.h>
#include <sy... | true |
b9031bf50e6e7fef3849cda2e1638786dbc504ff | C++ | norbertzagozdzon/jimp2 | /lab6/lab6_zad1.cpp | UTF-8 | 1,744 | 3.3125 | 3 | [] | no_license |
#include<iostream>
using std::cout;
using namespace std;
class Complex {
private:
double re, im;
public:
Complex() {
}
Complex(double re, double im) {
this->re = re;
this->im = im;
... | true |
7bf5c2e33e764fd6619c10aec85bdc1dfa555fa4 | C++ | cswwp/myleetcoding | /movezero.cpp | UTF-8 | 257 | 3.15625 | 3 | [] | no_license | void moveZeroes(int* nums, int numsSize) {
int * p=nums;
int * q=nums;
for(int index=0;index<numsSize;++index)
{
if((*p)!=0)
*q++=*p;
++p;
}
while(p-q>0)
{
*q++=0;
}
}
//8ms
| true |
e302ac143a094211875f9a2b4c3e26a11f07d266 | C++ | kurufeenve/CPP_Pool2 | /day00/day00/ex01/src/Contact.class.cpp | UTF-8 | 4,372 | 3.078125 | 3 | [] | no_license | #include "./../includes/Contact.class.hpp"
Contact::Contact(void) : _firstName("NAN"),
_lastName("NAN"),
_nickName("NAN"),
_login("NAN"),
_postalAddress("NAN"),
_emailAddress("NAN"),
_phoneNumber("NAN"),
_birthdayDate("NAN"),
_favoriteMeal("NAN"),
_under... | true |
7806def0892e32ad0abd7e189d04a1bae4a16b25 | C++ | apdiazv/SantanderXVA | /source/Valorizador.cpp | ISO-8859-3 | 30,310 | 2.5625 | 3 | [] | no_license | #include "headerFiles.h"
#include "Valorizador.h"
bool Valorizador::instanceFlag = false;
Valorizador* Valorizador::valor = NULL;
clock_t clock_2, clock_3;
Valorizador* Valorizador::getInstance()
{
if (!instanceFlag)
{
valor = new Valorizador;
instanceFlag = true;
}
return valor;
}
Valor... | true |
290db42e6a6645a07373f7be57c096b49110a388 | C++ | maxzerrrrrr/ECEMON | /src/Deck.cpp | UTF-8 | 5,736 | 2.765625 | 3 | [] | no_license | #include "Deck.h"
Deck::Deck()
{
//ctor
}
Deck::~Deck()
{
//dtor
}
Deck::Deck(std::string _nom, int _nbre)
:nom_deck(_nom), nbre_cartes_max(_nbre)
{
}
void Deck::setNomDeck(std::string _nom)
{
nom_deck=_nom;
}
void Deck::setNbreCartes(int _exemplaire)
{
nbre_cartes_deck=_exemplaire;
}
std::st... | true |
3f20143d03a1e0c76a2c0052b364b8c7f805d38e | C++ | brettschalin/memes-with-friends | /Memes With Friends/Memes With Friends/main.cpp | UTF-8 | 3,298 | 2.59375 | 3 | [
"MIT"
] | permissive | #include <stdio.h>
#include <allegro5/allegro.h>
#include <allegro5/allegro_primitives.h>
#include <allegro5/allegro_image.h>
#include <allegro5/allegro_physfs.h>
#include <physfs.h>
#include "Card.h"
#include "GameManager.h"
const float FPS = 60;
const int SCREEN_W = 1920;
const int SCREEN_H = 1080;
ALLEG... | true |
4c7f8616dd0c9d79e65108c4e99a9bccebccaf51 | C++ | omniamahfouz21/atbash-cypher | /main.cpp | UTF-8 | 1,182 | 3.609375 | 4 | [] | no_license | #include <iostream>
using namespace std ;
int main (){
class AtbashTable ;
{
/// <summary>
/// Lookup table to shift characters.
/// </summary>
char[] _shift = new char[char.MaxValue];
/// <summary>
/// Generates the lookup table.
/// </summary>
public AtbashTable()
{
... | true |
68eb60284521dc87cd0ecffd328c1b50ff861c24 | C++ | grand87/timus | /Problems/leetcode/prime-number-of-set-bits-in-binary-representation/main.cpp | UTF-8 | 1,710 | 3.09375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
class Solution {
static const int bitsCount[16];
int bitsIn32(int val) {
int count = 0;
while (val > 0) {
count += bitsCount[val & 0b1111];
val >>= 4;
}
ret... | true |
6291290c3c4cc65a0d37f1b799399c8bfdcade38 | C++ | hieule22/truc | /test/scanner/scanner_all_test.cc | UTF-8 | 4,661 | 2.96875 | 3 | [] | no_license | // End-to-end tests for lexical analyzer.
// Copyright 2016 Hieu Le.
#include "src/scanner.h"
#include <iostream>
#include <string>
#include "gtest/gtest.h"
namespace {
// MockScanner reads tokens from expected output file.
class MockScanner : public Scanner {
public:
explicit MockScanner(char *filename) : Scan... | true |
6d1813b176bd6befbc5f3a0678e092d77f08a19b | C++ | Aleksandr-Kovalev/CourseworkCode | /C++/StoreSimulator/HardwareStore.h | UTF-8 | 1,596 | 3.46875 | 3 | [] | no_license | #ifndef HARDWARESTORE_H
#define HARDWARESTORE_H
#include<queue>
#include<vector>
#include "Shopper.h"
class HardwareStore{
private:
double storeRevenue; //total money from store
std::vector< std::queue<Shopper> > CheckOutArea; //creats a vector of queues with shoppers placed in the queues
public... | true |
9fd7a3d6967185a1966c0d45ef673bead83d42f9 | C++ | lantimilan/topcoder | /CODEFORCE/prob418C.cpp | UTF-8 | 2,132 | 3.578125 | 4 | [] | no_license | // prob418C.cpp
//
// the problem can be reduced to 1D
// suppose you have an array of numbers a[0..n-1] such that
// sum_{i=0}^{n-1} a[i]^2 = k^2
// and similarly an array b[0..m-1] such that sum of square is a square
// then you can use this array to build a table with permutation
// each entry = a[i] * b[j]
// now f... | true |
f9be13f8aceba70add6705b9b49afaffd69753c3 | C++ | RedwanPlague/cses_problems | /Sorting-and-Searching/Restaurant-Customers.cpp | UTF-8 | 939 | 2.546875 | 3 | [] | no_license | // https://cses.fi/problemset/task/1619/
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
using namespace std;
#define F first
#define S second
#define all(v) (v).begin(),(v).end()
typedef pair<int,int> pii;
int main () {
ios_base::sync_with_stdio(false); cin.tie(nullptr);
#ifndef ONLI... | true |
78aff793e4e87542df2fa8f5a0ecd6a8595c0167 | C++ | gkocevar1/Artos | /ArtosHWM1500Quattro/HWM1500Quattro_Prod/ValvePhase.cpp | UTF-8 | 8,362 | 2.671875 | 3 | [] | no_license | #include "ValvePhase.h"
/**
Constructor
*/
ValvePhase::ValvePhase()
{
ValvePhase::init();
}
// ------------------
// Public methods
/**
Switch valves to desired phase
*/
void ValvePhase::switchToPhase(Constants::Phase phase)
{
switch (phase)
{
case Constants::Phase::FlushingSFRusco:
{
Va... | true |
043b8171de4e749a8cc1147a8d0939943021b62f | C++ | chaarvii/Algorithm | /Graph/Dijkstra'sShortestPath.cpp | UTF-8 | 2,480 | 3.734375 | 4 | [] | no_license | #include<iostream>
#include<list>
#include<queue>
using namespace std;
class Graph
{
int V; // number of vertices
vector < pair<int,int> > *Adj_list; // stores the graph
public:
Graph(int V); ... | true |
571d2db2e71802503e8310139df611ada3d9c4dd | C++ | racocvr/dvbcam | /tvs-api/RatingProxy.h | UTF-8 | 1,581 | 2.640625 | 3 | [] | no_license | #ifndef _RATINGPROXY_H_
#define _RATINGPROXY_H_
#include <string>
#include <pthread.h>
#include <map>
#include "TVServiceDataType.h"
#include "MarshallingHelperProxy.h"
#include "IRating.h"
class TCRatingProxy : public IRating
{
public:
/**
* @brief Sets Dbus connection for communication with TVS.
* @param [in... | true |
b57e40686286ff20bea3670ce507003ce89190c3 | C++ | Chylix/ShaderTool | /triebWerk/src/CTWFData.cpp | UTF-8 | 456 | 2.515625 | 3 | [] | no_license | #include <CTWFData.h>
void triebWerk::CTWFData::AddConfigurationPair(std::string a_Key, std::string a_Value)
{
m_ConfigurationTable.insert(std::pair<std::string, std::string>(a_Key, a_Value));
}
std::string triebWerk::CTWFData::GetValue(std::string a_Key)
{
auto foundIterator = this->m_ConfigurationTable.find(a_Key... | true |
aee42461b3c11103780f9718496eb776c15c7ce9 | C++ | mmariaa12/task2 | /Particle.cpp | UTF-8 | 2,667 | 2.953125 | 3 | [] | no_license | #include "Particle.hpp"
#include <cassert>
#include <cmath>
#ifndef EPS
#define EPS 1e-9
#endif
#define KGRAVITATIONAL 6.6e-11
#define KCOULOMB 8.9e+9
Particle::Particle(void) : x(), v(), f(), m(0), q(0), t(0) {}
Particle::Particle(Vector3d x, Vector3d v, double m, double q, double t)
: x(x), v(v), f(Vector3d(... | true |
77f510621d62e2b11124bdf5197da18d38ce794e | C++ | strimuer213p/AtCoder_Beginner_Contest_003_B | /AtCoder_Beginner_Contest_003_B/Source.cpp | UTF-8 | 785 | 3.171875 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<array>
int main() {
std::array<char, 7> ar{ 'a','t','c','o','d','e','r' };
std::array<std::string,2> str;
std::cin >> str[0] >> str[1];
for (int i = 0; i < (int)str[0].size(); i++) {
for (int x = 0; x < str.size(); x++) {
if (str[x][i] == '@') {
bool flag = ... | true |
5161820f74f941e9757d4c856c493c4650c7f3d6 | C++ | GuessWh0o/SomeRandomCode_different_languages | /C/String.h | UTF-8 | 1,146 | 3.171875 | 3 | [] | no_license | #pragma once
#include <stddef.h>
#include <cstring>
#include <iostream>
namespace Program {
typedef unsigned int ui;
class String {
private:
char* str;
ui length;
static int number_Elem;
public:
String() {
str = NULL;
length = 0;
}
String(const char* s) {
length = strlen(s);
str = new cha... | true |
dfb7a21f68baa26c01e0d08f8ddc397ed23d41bd | C++ | paulAriri/cPlusPlusFunctions | /compareArrays.cpp | UTF-8 | 767 | 3.609375 | 4 | [] | no_license | #include <iostream>
using namespace std;
//function to compare two arrays and conclude if they have the same exact values for all elements
bool compare(int a[],int b[],int size)
{
int first = a[0];
int second = b[0];
for(int i = 0; i<size; i=i+1)
{
if (a[i] != b[i] )
{
... | true |
d5390c634865d4259d19b5f8195d63d07a9ec34b | C++ | pankdm/lang-perf | /cython/cpp_solver.cpp | UTF-8 | 1,347 | 3 | 3 | [
"MIT"
] | permissive | #include "cpp_solver.h"
const int NOT_PROCESSED = -1;
CppSolver::CppSolver(vvi* _graph)
: graph(_graph)
{
}
void CppSolver::run_bfs(int start, vi* _scores) {
vi& scores = *_scores;
auto num_cities = graph->size();
scores.assign(num_cities, NOT_PROCESSED);
scores[start] = 0;
deque<int> queue;
queue.p... | true |
142240b508be79cda83c62aa4d040f12deac8c1e | C++ | 44652499/embedded | /mycode/大杂烩/AA3.cpp | UTF-8 | 925 | 3.328125 | 3 | [] | no_license | #include <iostream>
using namespace std;
template<class T1,class T2>
class pair1
{
public:
pair1(T1 _first,T2 _second)
{
first=_first;
second=_second;
}
T1 first;
T2 second;
};
template<class T>
class A
{
template<class T1>
friend ostream& operator <<(ostream& out,A<T1> a);
public:
A()
{
}
A(T _data)... | true |
90ced8c50ce85960694bb43f9685e2c4f67bfcc4 | C++ | Kowsihan-sk/Codechef-submissions | /Challenges/CodeChef May 2021 div2 Long/Tic_Tac_Toe.cpp | UTF-8 | 2,448 | 2.578125 | 3 | [] | no_license | /** Author : S Kowsihan **/
#include <bits/stdc++.h>
using namespace std;
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL);
#define ll long long
#define endl "\n"
#define f(a, b, c) for (ll i = a; i < b; i += c)
typede... | true |
929697d67e56bec69c91212f22808353682e1f11 | C++ | lorenzomoulin/Programacao-Competitiva | /URI/matematica/jogo_do_maior_numero_1829.cpp | UTF-8 | 834 | 2.9375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main(){
int n ;
cin >> n;
int v[n];
int cont1 = 0, cont2 = 0;
for (int i = 0; i < n; i++){
int a, b, n;
char circ, exc;
cin >> a >> circ >> b >> n >> exc;
if (b*log(a) > (0.5*log(2*M_PI) + (n + 0.5)*log(n) - n)){
... | true |