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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
673d26d409abd2186325457b61f346df8180ed20 | C++ | Mingrui-Yu/slambook2 | /my_implementation_2/ch6/ceresCurveFitting/ceresCurveFitting.cpp | UTF-8 | 2,395 | 2.65625 | 3 | [] | permissive | #include <iostream>
#include <chrono>
#include <Eigen/Core> // Eigen 核心部分
#include <Eigen/Dense> // 稠密矩阵的代数运算(逆,特征值等)
#include <Eigen/Geometry> // Eigen/Geometry 模块提供了各种旋转和平移的表示
#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <ceres/ceres.h>
struct CURVE_FITTING_COST{
CURVE_FITTING... | true |
8f546bbd14120c2d55f49ca54a53e2a68e0b3dad | C++ | benreid24/BLIB | /include/BLIB/Events/SubscribeHelpers.hpp | UTF-8 | 1,324 | 2.625 | 3 | [] | no_license | #ifndef BLIB_EVENTS_SUBSCRIBEHELPERS_HPP
#define BLIB_EVENTS_SUBSCRIBEHELPERS_HPP
#include <BLIB/Events/SingleDispatcher.hpp>
namespace bl
{
namespace event
{
namespace priv
{
template<typename T>
struct SubscriberBase {
SubscriberBase(SingleDispatcher<T>& bus, ListenerBase<T>* l, bool defer) {
bus.addLis... | true |
c12cdd35fd8e0beade5a0b18f75f5b8a6da44f3d | C++ | jiadaizhao/LeetCode | /1101-1200/1180-Count Substrings with Only One Distinct Letter/1180-Count Substrings with Only One Distinct Letter.cpp | UTF-8 | 342 | 3.109375 | 3 | [
"MIT"
] | permissive | class Solution {
public:
int countLetters(string S) {
int total = 0, start = 0;
for (int i = 0; i <= S.size(); ++i) {
if (i == S.size() || S[i] != S[start]) {
total += (i - start) * (i - start + 1) / 2;
start = i;
}
}
r... | true |
092004983ca595e609d78ec7da4ffe80beb082a1 | C++ | shultays/ingenue | /lexer_cpp/Tools.cpp | UTF-8 | 2,948 | 2.6875 | 3 | [] | no_license | #include "Tools.h"
#include<assert.h>
const char* operatorStrings[] = {
"err",
"+",
"-",
"*",
"/",
"%",
"==",
"!=",
">",
">=",
"<",
"<=",
"++",
"--",
"-",
"+",
"!",
};
const char* tokenNames[Tt_count];
const char* defaultFuncNames[Df_count];
void buildTools() {
assert(sizeof(float) == 4);
defa... | true |
57be17bf3bd74da65a3c33f09343ce3329f7c1de | C++ | svineet/competitive_programming | /codeforces/alyoni_copybooks.cpp | UTF-8 | 471 | 2.796875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a, b, c;
cin >> n >> a >> b >> c;
if (n%4 == 0) {
cout << 0 << endl;
return 0;
}
long long left = ((n - n%4)/4 + 1)*4 - n;
if (left == 3) {
cout << min({c, 3*a, a+b}) << endl;
} else if (left =... | true |
0cfa4fab6cb4f7efa5aad2f9ff7cdac9fbc3e228 | C++ | rkwagner/dp176easyCPP | /pivot.cpp | UTF-8 | 1,299 | 3.46875 | 3 | [] | no_license | //-------------------------------------------------------------
//Author: Ryan Wagner
//Date: August 22, 2014
//Description:Pivot Table (Dailyprogrammer Challenge #176 Easy)
//Input: Text file windfarm.dat
//Output: Pivot utilizing the three input fields.
//-------------------------------------------... | true |
d53990b4450ea97af1eec7b6b31a5a90d6404226 | C++ | sepidehsaran/appfs | /Sanny/ex8/src/c/ex8.cpp | UTF-8 | 4,800 | 3.125 | 3 | [
"MIT"
] | permissive | /**
* Exercise 8 : Read in a gph-file, interpretes it as a Steiner-problem and solves it.
*
* @author FirstSanny
*/
#include <iostream>
#include <iomanip>
#include <fstream>
#include <utility>
#include <boost/program_options.hpp>
#include <boost/timer/timer.hpp>
#include "Steiner.h"
#include "GraphChecker.h"
// C... | true |
b01609951382707054653763a6198b81cfed110e | C++ | jaya6400/Coding | /RangeSumQuerySolution.cpp | UTF-8 | 590 | 3.328125 | 3 | [] | no_license | class NumArray {
public:
vector<int> vec;
NumArray(vector<int>& nums) {
vec = nums;
// if(nums.size() > 0){
// vec[0] = nums[0];
// for(int i = 1; i < nums.size(); i++){
// vec[i] = vec[i-1] + vec[i];
// }
// }
}
int su... | true |
aad36f89b5505773e52b0117709b0761101eeadf | C++ | grvx24/KsiazkaKucharskaDemo | /KsiazkaKucharskaDemo/main.cpp | WINDOWS-1250 | 10,126 | 3.109375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <list>
#include <conio.h>
#include <windows.h>
#include <fstream>
using namespace std;
enum class Typ_potrawy { owoc, warzywo, mieso, nabial, zbozowe, inne };
class Produkt
{
private:
string nazwa, ilosc;
Typ_potrawy typ;
void n... | true |
82a50e5f9b97515cab19f61fabbf5b1707533444 | C++ | xiangruipuzhao/c_plus_primer_3 | /c_primer_plus_3/class_21.3/main.cpp | GB18030 | 1,271 | 3.890625 | 4 | [] | no_license | #include<iostream>
#include<set>
#include<string>
#include<algorithm>
using namespace std;
class CCompareStringNoCase
{
public://ԪνݲַַСдʽȻбȽ
bool operator()(const string& str1, const string& str2) const
{
string str1LowerCase;
str1LowerCase.resize(str1.size());
transform(str1.begin(), str1.end(), str1LowerCase... | true |
18bbf698435a4264d9171580e46c10c0bcee2376 | C++ | soulsystem00/bj_2798 | /bj_2798/bj_11723.cpp | UTF-8 | 1,053 | 2.5625 | 3 | [] | no_license | //#include <iostream>
//#include <set>
//#include <string>
//using namespace std;
//
//int arr[21];
//
//int main()
//{
// cin.tie(NULL);
// ios_base::sync_with_stdio(false);
// int n;
// cin >> n;
// cin.ignore();
// for (int t = 0; t < n; t++)
// {
//
// string str;
// getline(cin, str);
//
// if (str.substr(0, ... | true |
da2fb59936cd9a121d82428d0855b98ba8ec742c | C++ | kyduke/Coding | /AlgoSpot/WITHDRAWAL.cpp | UTF-8 | 1,100 | 2.984375 | 3 | [] | no_license | // https://algospot.com/judge/problem/read/WITHDRAWAL
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
const int SIZE = 1000;
int ranks[SIZE];
int classes[SIZE];
int n, k;
bool decision(double rank) {
vector<double> arr;
int i;
double v;
for (i = 0; i < n; i++... | true |
e58540faf91eeed20712f36030e96bc3c9c33c72 | C++ | sogapalag/problems | /atcoder/dwango6d.cpp | UTF-8 | 3,290 | 2.625 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
using namespace std;
void __solve() {
int n; cin >> n;
vector<int> a(n), indeg(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
a[i]--;
indeg[a[i]]++;
}
if (n == 2) {
cout << -1; return;
}
set<int> bucket;
set<pair<int,int>> looku... | true |
06a724bad2c8872fafc175222d5b2db0cc081974 | C++ | apolukhin/Boost-Cookbook | /Chapter06/01_tasks_processor_base/main.cpp | UTF-8 | 1,314 | 2.890625 | 3 | [
"BSL-1.0"
] | permissive | // Amost all the code for this example is in this header
#include "tasks_processor_base.hpp"
using namespace tp_base;
int func_test() {
static int counter = 0;
++ counter;
boost::this_thread::interruption_point();
switch (counter) {
case 3:
throw std::logic_error("Just checking");
cas... | true |
a1fe43fad24468472d5b535a4a87613f6ea20d05 | C++ | MFA8CL/OOP-Text-based-adventure-game-in-c-for-PHYS30672 | /Characters/NPCs/alchemist.cpp | UTF-8 | 3,923 | 3.28125 | 3 | [] | no_license | #include "alchemist.h"
alchemist::alchemist() {
type = "alchemist";
health = 100;
}
int alchemist::converse(player& p) {
bool still_talking(true);
cout << "\n" << "Alchemist: 'Alright? I'm the alchemist, got an assortment of funky fresh potions here'\n" << endl;
cout << '1' << " = " << "Purchase a heal... | true |
ccc52e5f2aeeaa5fd997639ce8cf92c99670e84c | C++ | einkat/Micromouse_fin | /micromouse/czujnik.h | UTF-8 | 1,328 | 3.15625 | 3 | [] | no_license | #ifndef CZUJNIK_H
#define CZUJNIK_H
#include <mwalls.h>
/// \brief Klasa czujnika wykrywającego ściany
class Czujnik
{
public:
/**
* @brief Czujnik Czujnik ścian
* @param x Położenie robota w osi X
* @param y Położenie robota w osi Y
* @param direction Kierunek wykrywania
... | true |
214561d3bd877dc9edb0d831420eb82d73b8c51f | C++ | StephaneBranly/LO21-RPN-Calculator | /src/engine/expression/operator/operatorsdefinition.h | UTF-8 | 2,528 | 2.703125 | 3 | [] | no_license | #ifndef OPERATORSDEFINITION_H
#define OPERATORSDEFINITION_H
#include "operator.h"
namespace Engine {
// Definition des differents operateurs affectant la pile, atoms, ...
class OperatorCLEAR : public Operator {
public:
OperatorCLEAR(): Operator("OperatorCLEAR",0){}
void executeOpe(vector<Expression*> e) ove... | true |
bd2f04cdbb6a3d38b9311bb8210dc478c1c43971 | C++ | rushioda/PIXELVALID_athena | /athena/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerUtils/MuonSegmentMakerUtils/MuonSegmentKey.h | UTF-8 | 1,829 | 2.84375 | 3 | [] | no_license | /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MUON_MUONSEGMENTKEY_H
#define MUON_MUONSEGMENTKEY_H
#include <set>
#include <vector>
namespace Trk {
class MeasurementBase;
}
namespace Muon{
class MuonSegment;
/**
Class to cache the identifiers on a segment in s... | true |
6a8ec2006d91b92098d3eaeeff4382656635e6ca | C++ | a1h2med/Arduino | /Push_Button/sketch_feb08a.ino | UTF-8 | 137 | 2.609375 | 3 | [] | no_license | int val ;
void setup()
{
pinMode(13,OUTPUT);
pinMode(7,INPUT);
}
void loop()
{
val=digitalRead(7);
digitalWrite(13,val);
}
| true |
66e56bd404eda10f829bd63d669e9837ba6a7a93 | C++ | nicknick1945/melonoma | /semion/SLib/Features/steacher.cpp | UTF-8 | 4,708 | 3.171875 | 3 | [] | no_license | #include "steacher.h"
/*!
* \brief Конструктор по умолчанию.
* \details Задает правило интерпретации цветов:
* - красный (255,0,0) - код 1
* - зеленый (0,255,0 )- код 2
* - синий (0,0,255) - код 3
* - желтый (255,255,0) - код 4
* - голубой (0,255,255) - код 5
* - пурпурный (255,0,255) - код 6
* И... | true |
a142f83288c5a6c99c26ff368707e1c8463c91f4 | C++ | jingaz/LeeCode | /罗马数字转整数.cpp | UTF-8 | 1,745 | 3.640625 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int romanToInt(string s) {
int ret = 0;
while (!s.empty()) {
char ch = s.back();
s.pop_back();
switch (ch) {
case 'I':
ret += 1;
break;
case 'V':
if (!s.empty() && s.back() ==... | true |
9b6a00890fdf7f35bbb17644803b0eaeb2bab100 | C++ | LeverImmy/Codes | /比赛/学校/2019-9-13测试/熊泽恩/noon/std.cpp | UTF-8 | 2,058 | 2.65625 | 3 | [] | no_license | #include <cstdio>
#include <algorithm>
#include <iostream>
#include <cctype>
#include <cstring>
#define rgi register int
#define il inline
#define ll long long
using namespace std;
const int oo = 0x3f3f3f3f;
const int N = 1e5 + 10;
const int M = 1e5 + 10;
int n, m;
int gcd(int a, int b){return !b ? a : gcd(b, a % b... | true |
e6383055dcec1f4278e15d032de441f4995a5e33 | C++ | joedanpar/Academic-Projects | /CSCI 241/assign0.cc | UTF-8 | 498 | 2.921875 | 3 | [
"MIT"
] | permissive | /************************************************************
* CSCI 241 Autumn, 2008
* Name: Joe Daniel Parker
* Assignment 0
* Due Date: 09/02/2008
* Purpose: This is a basic practice program.
*
************************************************************/
#include <iostream>
u... | true |
d56743b4ec14f687206d6d86723bdaab3a5667cd | C++ | traherom/hasher | /hashdatabase.h | UTF-8 | 1,198 | 2.734375 | 3 | [] | no_license | #ifndef HASHDATABASE_H
#define HASHDATABASE_H
#include <string>
#include <list>
using std::string;
#include <sqlite3.h>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
using boost::shared_ptr;
#include "scan.h"
#include "scanfile.h"
class HashDatabase : public boost::enable_shared_from_... | true |
0e56a297768fa633a370ed91be49b5183c36d074 | C++ | DoRightt/Lippman-CPP-Primier-exercises | /Chapter_13/exercise13.14/main.cpp | UTF-8 | 363 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <string>
using std::string;
using std::cout;
using std::endl;
class numbered {
public:
numbered() : mysn(++n) { };
int mysn;
private:
static int n;
};
int numbered::n = 0;
void f(numbered n) {
cout << n.mysn << endl;
}
int main() {
numbered a, b = a, c = b;
f(a... | true |
ab222f1fcbec5089f0233688f8f4242808c99122 | C++ | caster99yzw/Y3DGameEngine | /common/Math/Y3DMathFunc.h | UTF-8 | 4,260 | 3.3125 | 3 | [] | no_license | #pragma once
#include "Y3DPI.h"
#include <cmath>
#include <limits>
// Provide the interface to cover the type of data
// Function of c-math can not be non-constexpr
namespace Y3D
{
//////////////////////////////////////////////////////////////////////////
//
// Basic Function
//
//////////////////////////////... | true |
75b960fe2bcc99adcc3c01f326a4f2d124ab322a | C++ | devloop0/dharma-vm | /src/builtins.cpp | UTF-8 | 34,985 | 2.8125 | 3 | [] | no_license | #include "includes/runtime.hpp"
namespace dharma_vm {
shared_ptr<runtime_variable> runtime::print(shared_ptr<runtime_variable> rvar) {
if (rvar == nullptr)
report_error_and_terminate_program(runtime_diagnostic_messages::fatal_error, nullptr);
if (rvar->get_runtime_type_information() == runtime_type_informatio... | true |
2f9e2e7c1b857bacc1dcc097f7c30b59aafafc35 | C++ | NorinStark/OOP_Labs | /Lab 2/StatisticMultiset.cpp | UTF-8 | 2,180 | 3.265625 | 3 | [] | no_license | #include <cstdlib>
#include <iostream>
#include <set>
#include <vector>
#include <list>
#include <fstream>
#include <string>
#include "StatisticMultiset.h"
template <class T> StatisticMultiset<T>::StatisticMultiset() : sum(0) {}
template <class T> void StatisticMultiset<T>::AddNum(T const &num) {
data.in... | true |
4a07acae5fa733a8cb6b4256c6d4fe436f3533e8 | C++ | CDK6182CHR/PlantVsZombie | /plants/Plant.cpp | GB18030 | 843 | 2.796875 | 3 | [] | no_license | #include "Plant.h"
#include "../Block.h"
#include "../System.h"
#include "../Position.h"
#include <string>
using namespace std;
Plant::Plant(System& sys):Placeable(sys),hp(0)
{
}
/*
precondition: positionʾλûֲ
*/
void Plant::place()
{
Block* pBlock = position.target();
if (pBlock->currentPlant() == nullptr) {
pBlo... | true |
d1ae67cc733fc816849c9933e4dbc0d4a89fd215 | C++ | BankZKuma/Project11 | /Project13/Source.cpp | UTF-8 | 847 | 3.15625 | 3 | [] | no_license | #include<stdio.h>
float usd(float);
float jpy(float);
float convert(float baht, float (*p)(float));
int main() {
int count = 0;
float collecTusd[10],collecTjpy[10];
float baht;
for (int i = 0; i < 5; i++) {
printf("Enter baht : ");
scanf_s("%f", &baht);
collecTusd[i] = convert(baht, usd);
collec... | true |
8dc3ab38eb4fd883934b191f42c42a48c6146d1d | C++ | ksajan/Pancake_topological_sorting | /main.cpp | UTF-8 | 2,605 | 3.734375 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Edge {
int src, dest;
};
class Graph{
public:
vector<vector<int> > adjacentList;
Graph(vector<Edge> const &edgeList, int N){
adjacentList.resize(N);
for (auto &edge: edgeList) {
adjacentL... | true |
dbf202ac869c6998bd3c1072b01fdd4e27a4e1e9 | C++ | Oepeling/Introduction-to-Robotics | /Lab Work/Lab 8/motorWithoutDriver/motorWithoutDriver.ino | UTF-8 | 382 | 2.796875 | 3 | [] | no_license | const int motorPin = 3;
int givenSpeed = 0;
void setup() {
// put your setup code here, to run once:
pinMode(motorPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
// if (Serial.available() > 0){
// givenSpeed = Serial.read();
// analogWrite(motorPin, giv... | true |
2a0fd19295902e3a6c123d6608c218d117271357 | C++ | duri26/cc26 | /20181102/singleton/autorelesesingleton3.cc | UTF-8 | 916 | 2.84375 | 3 | [] | no_license | ///
/// @file autorelesesingleton.cc
/// @author duri(1197010670@qq.com)
/// @date 2018-11-04 22:26:40
///
#include <stdlib.h>
#include <iostream>
using std::cout;
using std::endl;
class Singleton
{
public:
static Singleton * getInstance()
{
pthread_once(&_once,init);
return _pInstance;
}
static vo... | true |
9f75d4b085167997fce409859424aa6cf8c7697e | C++ | Hoshoyo/PhysicsEngine | /HoEngine/src/WindowApi/Primitive.cpp | UTF-8 | 3,128 | 2.78125 | 3 | [] | no_license | #include "Primitive.h"
#include <hmath.h>
Primitive::Primitive()
{
}
Primitive::~Primitive()
{
}
using namespace hm;
Quad::Quad(vec3 center, float sizeX, float sizeY) : Quad(center, sizeX, sizeY, 1, 0){}
Quad::Quad(vec3 center, float sizeX, float sizeY, int textureNumRows, int textureIndex)
{
model = new Indexed... | true |
2a3090ddd2687d63e990052c76e5c8ab9fd3fa75 | C++ | Petapetilon/Foxygine | /Foxygine/src/Graphics/Lights/Lighting.h | UTF-8 | 908 | 2.578125 | 3 | [] | no_license | #pragma once
#include <list>
#include <vector>
#include "../../Math/Color.h"
#include "../../Math/Vector3.h"
class Light;
class Lighting
{
private:
static const int maxLights = 128;
public:
enum class LightType {
Directional = 0,
Ambient = 1,
Point = 2,
};
struct LightPass {
public:
LightType type;
... | true |
cadeb83809022b72dcdae7791dae4b7aa028b0ef | C++ | VanishRan/leetcode | /RanLeetCode/RanLeetCode/回溯算法/经典/37解数独.cpp | UTF-8 | 2,048 | 3.46875 | 3 | [] | no_license | //
// 37解数独.cpp
// RanLeetCode
//
// Created by mahuanran on 2020/7/12.
// Copyright © 2020 mahuanran. All rights reserved.
//
#include "common.h"
class Solution {
public:
void solveSudoku(vector<vector<char>>& board) {
backTrack(board, 0, 0);
}
bool backTrack(vector<vector<char... | true |
1d133fde523cc3c72fa0d8f56517d337062ce920 | C++ | RS-codes/CppQuickRef | /LEVEL_1_NOVICE/21_Default_Function_Parameters.cpp | UTF-8 | 480 | 3.46875 | 3 | [] | no_license | //#21. C++ Default Function Parameters :
#include<iostream>
using namespace std;
void display(int x,int y ,int z=10){ //start initializing frm RIGHTMOST variable
//void display(int x=10,int y,int z){ //generates ERROR,since u initialized the LEFTMOST var
cout<<x<<endl;
cout<<y<<endl;
cout<<z<<endl;
}
... | true |
9a37ef4543972ce236869df70d6683569bcebd4d | C++ | jamesmagnus/light_of_paladin | /Light_of_Paladin/ClassContenaire.h | UTF-8 | 2,187 | 2.875 | 3 | [] | no_license | #pragma once
#include "ClassInventaire.h"
#include "Affichable.h"
/* Classe finale, non héritable */
/* Permet de créer des objets affichable avec un inventaire tel des coffres, ... */
/* Sémantique d'entité */
class Contenaire: public Inventaire, Affichable
{
private:
std::string mProprietaire, mNom;
/* Surchar... | true |
4ae54440a2ef57bc409cbd30821cb7c68a59d4f4 | C++ | harshitagarwal2/CS122 | /NEW/L2/L8-L10 Classes and Objects Contd/Chapter02/L2P24.cpp | WINDOWS-1250 | 795 | 3.875 | 4 | [] | no_license | /*Beginning of friendClass.cpp*/
class B; //forward declaration necessary because
//definition of class B is after the statement
//that declares class B a friend of class A.
class A
{
int x;
public:
void setx(const int=0);
int getx()const;
friend class B; //declaring B as a friend of A
};
class B
{
A * A... | true |
169cf59189f2419af7382e15c6c9ce5914b33acc | C++ | fud200/Algorithm | /p2875.cpp | UTF-8 | 311 | 3 | 3 | [] | no_license | #include <iostream>
using namespace std;
int max(int a, int b) {
return a > b ? a : b;
}
int min(int a, int b) {
return a < b ? a : b;
}
int main(void) {
int N,M, K;
int res=0;
cin >> N >> M >> K;
for (int i = 0; i <= K; i++) {
res = max(res, min((N - i) / 2, (M - K + i)));
}
cout << res << endl;
} | true |
3aade6db02a8af9cbc88c599414f2f3db6bda18d | C++ | eariunerdene/C-course | /Day#3/RGB7012-2.cpp | UTF-8 | 156 | 2.8125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main ()
{
int a,b,c,d;
cin>>a;
b=a/3600;
c=a%3600/60;
d=a%3600%60;
cout<<b<<" "<<c<<" "<<d;
}
| true |
f7e712401b402a6e9ab6919211398f42610a98cc | C++ | SourangshuGhosh/v3 | /languages/cpp/exercises/concept/strings/.meta/example.cpp | UTF-8 | 403 | 2.765625 | 3 | [
"MIT"
] | permissive | #include "strings.h"
namespace log_line {
std::string message(const std::string& line) {
return line.substr(line.find(':') + 2);
}
std::string log_level(const std::string& line) {
return line.substr(1, line.find(']') - 1);
}
std::string reformat(const std::string& line) {
... | true |
ec6227730e74ca1b1d04279a915bd81f5282af5f | C++ | przemyslawgesieniec/MetodyNumeryczne | /Zadanie4/newtoncotes.cpp | UTF-8 | 628 | 2.546875 | 3 | [] | no_license | #include "newtoncotes.h"
#include <iostream>
#include <math.h>
using namespace std;
NewtonCotes::NewtonCotes() : Calkowanie()
{
}
double NewtonCotes::calkuj(vector<double> x,double h,Funkcja * wsk,bool waga)
{
double Y=0;
vector<double>y;
for(int i=0;i<x.size();i++)
{
y.push_back(wsk->oblicz(x... | true |
659f02e698aac562103cb3c8017a4a6355ac2f7c | C++ | sylph01/cea21 | /0411/stream_iterator.cpp | UTF-8 | 533 | 2.953125 | 3 | [] | no_license | #include <vector>
#include <algorithm>
#include <iostream>
#include <fstream> // has ifstream and ofstream
#include <iterator> // has istream_iterator and ostream_iterator
using namespace std;
int main(){
string from, to;
cin >> from >> to;
ifstream is {from};
istream_iterator<string> ii {is};
istream_iter... | true |
f493e6f45af1184dcd9c9d929c95688a4fb72e7e | C++ | HeRaNO/OI-ICPC-Codes | /NOI[OpenJudge]/1.13/1.13.34.cpp | UTF-8 | 780 | 3.109375 | 3 | [
"MIT"
] | permissive | //Code By HeRaNO
#include <stdio.h>
char p[32], q[32], r[32];
int MinRadix()
{
int i, minRadix;
minRadix = 1;
for (i = 0; p[i]; i++)
if (minRadix < p[i] - '0') minRadix = p[i] - '0';
for (i = 0; q[i]; i++)
if (minRadix < q[i] - '0') minRadix = q[i] - '0';
for (i = 0; r[i]; i++)
if (minRadix < r[i] - '0') mi... | true |
85342324aa6b2840989ad904c45bf6c58d806dd1 | C++ | seth1002/antivirus-1 | /klava/kernel/klavsyslib/os_vm.cpp | UTF-8 | 2,043 | 2.65625 | 3 | [] | no_license | // os_vm.cpp
//
#include <klava/klavsys_os.h>
#include <klava/kl_sys_vmem.h>
////////////////////////////////////////////////////////////////
// Generic virtual memory wrapper
class KLAVSYS_Virtual_Memory : public KLAV_IFACE_IMPL(KLAV_Virtual_Memory)
{
public:
KLAVSYS_Virtual_Memory ();
virtual ~KLAVS... | true |
22acb6ee566ab2a40aab9d9a3f014c6e9c7abb4e | C++ | donmayun/Algorithm-learning-through-Problems | /cpp/The Stable Marriage Problem/TheStableMarriageProblem.cpp | UTF-8 | 2,856 | 2.984375 | 3 | [
"MIT"
] | permissive | //
// TheStableMarriageProblem.cpp
// laboratory
//
// Created by 徐子珊 on 14/12/31.
// Copyright (c) 2014年 xu_zishan. All rights reserved.
//
#include <iostream>
#include <fstream>
#include <queue>
#include <string>
#include <set>
#include <hash_map>
#include <iterator>
using namespace std;
struct Male{
string ... | true |
2aae238b389cbe6921767bdfa2b1ceb63c9128aa | C++ | mitmehta/myCcode | /Reorder_index.cpp | UTF-8 | 781 | 4.3125 | 4 | [] | no_license | /* Arrange Array according to given indexex */
#include<iostream>
using namespace std;
void Reorder_Array(int arr[], int index[], int n)
{
int oldI, newI;
for(int i = 0; i < n; i++) {
while(index[i] != i) {
oldI = index[index[i]];
newI = arr[index[i]];
arr[index[i]] = arr[i];
index[index[i]] = index[... | true |
fe424025cf52784de57f567249932cdf727142b2 | C++ | angieshu/Space_Shooter | /src/Star.class.cpp | UTF-8 | 387 | 2.59375 | 3 | [] | no_license | /**
* @Author: Anhelina Shulha <angieshu>
* @Date: Jul-25-2017
* @Email: anhelina.shulha@gmail.com
* @Filename: Star.class.cpp
* @Last modified by: angieshu
* @Last modified time: Jul-25-2017
*/
#include "Star.class.hpp"
Star::Star(int x) {
setWidth(STAR_WIDTH);
setHeight(STAR_HEIGHT);
setX(x);
setY(... | true |
ad13f9d3d0769c777ef7d28305631a7ddae56db1 | C++ | TadeuszNorek/lab2 | /main.cpp | UTF-8 | 986 | 3.53125 | 4 | [] | no_license | #include <stdio.h>
#include <assert.h>
#include <time.h>
#include <stdlib.h>
int gcd (int a, int b);
struct fraction
{
int nominator;
int denominator;
bool is_correct()
{
return((abs(denominator)>abs(nominator)) && (denominator!=0)?true:false);
};
void shorten()
{
int a = gcd(abs(nominator), abs(denominat... | true |
acd12c6d8325c5715df5a8cd31e5fbb4a6a590de | C++ | YorkeWei/DataStuctureHomework | /heap.hpp | UTF-8 | 3,235 | 3.125 | 3 | [] | no_license | #define Parent(i) ((i - 1) >> 1) //i的父亲
#define LChild(i) (1 + (( i ) << 1))//i的左儿子
#define RChild(i) ((1 + ( i )) << 1)//i的右儿子
#define InHeap(n, i) (((-1) < ( i )) && (( i ) < ( n )))
#define LChildValid(n, i) InHeap(n, LChild( i ))
#define RChildValid(n, i) InHeap(n, RChild( i ))
#define Smaller(HC, i, j) (cmp(... | true |
98d2e2c054baa7165b7424f1a50dc20cfabd1959 | C++ | mviseu/Cpp_primer | /Chapter9/9_16_alternative.cc | UTF-8 | 547 | 3.5 | 4 | [] | no_license | #include <vector>
#include <iostream>
#include <list>
using std::vector;
using std::cout;
using std::endl;
using std::list;
int main() {
vector<int> v1 = {0, 1, 2, 3};
list<int> l1 = {0, 1, 2};
if(v1.size() != l1.size()) {
cout << "The vectors are not equal" << endl;
return 0;
}
auto iterV2 = l1.cbegin();... | true |
e70edbab0e06e69ff97ce8c6f9a2aebaf02ac466 | C++ | qixianbd/partition_wqm | /node.h | UTF-8 | 1,358 | 2.828125 | 3 | [] | no_license | /*
* node.h
*
* Created on: 2011-12-28
* Author: harry
*/
#ifndef NODE_H_
#define NODE_H_
#include <vector>
#include "common.h"
namespace util {
class node {
public:
enum node_group_status{
INIT,
BIG,
SMALL,
MIDDLE
};
enum node_kind{ LOOP, NODE_GROUP};
enum { EDGE_INF = 0x00FFFFFF};
priva... | true |
966a9bdbbed213e497ce71b3f9ce51afbafba4ae | C++ | Mioriarty/RhinoGameEngine | /rhino-core/src/modules/rendering/data/Texture.cpp | UTF-8 | 1,622 | 2.625 | 3 | [] | no_license | #include "Texture.h"
#define STB_IMAGE_IMPLEMENTATION
#define ABSOLUTE_PATH "C:/Users/Moritz/Desktop/Programmieren/C++/RhinoEngine/rhino-core/"
#include <stb_image.h>
#include <iostream>
namespace rhino {
const TextureSettings TextureSettings::DEFAULT = {TextureSettings::FilterMode::LINEAR, TextureSettings::WrapMod... | true |
7653442736747b11a193268bc14a3c1b0fb44823 | C++ | jaladhivyas/CPP-Basic-Programming | /CPP_Programming/memory_management_set_2.h | UTF-8 | 2,631 | 4.15625 | 4 | [] | no_license | #ifndef MEMORY_MANAGEMENT_SET_2_H
#define MEMORY_MANAGEMENT_SET_2_H
#include "iostream"
namespace std
{
namespace memSet2
{
// new and delete operator
/*
To allocate space dynamically, use the unary operator new, followed by the type being allocated.
new int; // dynamically allocates an int
ne... | true |
d0600b50146b5d24c09416a1b9dd0743134668f3 | C++ | TanavShah/SPOJ | /cpp_codes/fctrl.cpp | UTF-8 | 388 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int fun(int p)
{
int ans = 0;
for(int i=1;;i++)
{
ans += (p/(pow(5,i)));
if((p/(pow(5,i))) == 0)
{
break;
}
}
return ans;
}
int main()
{
int t;
cin >> t;
for(int aa = 0; aa < t ; aa++)
{
int n;
cin >> n;
... | true |
fcdd9976de8093a60dac1aec2e387685a2112abf | C++ | YangKian/MyPractice | /cpp/basic/new/main.cpp | UTF-8 | 1,054 | 3.6875 | 4 | [] | no_license | #include <iostream>
using string = std::string;
class Entity {
private:
string m_Name;
public:
// 构造函数的另一种写法:Constructor Initializer List
// 可以在 {} 中添加其他初始化逻辑
Entity() : m_Name("Unknown") {}
Entity(const string& name) : m_Name(name) {}
const string& GetName() const { return m_Name; }
};
int ... | true |
11106166218b148a689fbd7ef556aa92bf3fee33 | C++ | BAntDit/enttx | /src/systemManager.h | UTF-8 | 7,217 | 2.609375 | 3 | [] | no_license | //
// Created by bantdit on 12/31/18.
//
#ifndef ENTTX_SYSTEMMANAGER_H
#define ENTTX_SYSTEMMANAGER_H
#include "config.h"
#include <cstddef>
#include <tuple>
#include <type_traits>
#include <utility>
namespace enttx {
template<typename Config>
class SystemManager;
template<size_t UPDATE_STAGE_COUNT, typename... Syst... | true |
8e3ea84c9565c97160aa8dff355349cb8adf6140 | C++ | ZetaTwo/sa104x-kexjobb | /Verifier/KeyVerifier.cpp | UTF-8 | 3,663 | 2.984375 | 3 | [] | no_license | #include <vector>
#include <fstream>
#include <ios>
#include "KeyVerifier.h"
#include "Node.h"
#include "IntLeaf.h"
#include "FileNames.h"
bool keyVerifier(proofStruct &pfStr)
{
Node pk;
// Step 1 - Read public key from file and reject if not successful
try {
pk = Node(pfStr.directory + "/" + FU... | true |
94c70a1e59420d03a64cf1d7c741f770fa8ba12f | C++ | studiefredfredrik/thermominer | /ArduinoTemperatureSensor/I2C_functions.ino | UTF-8 | 747 | 3.328125 | 3 | [
"MIT"
] | permissive | // Read 16 bit int from I2C address addr and register reg
uint16_t read16(uint8_t addr, uint8_t reg) {
uint16_t data;
Wire.beginTransmission(addr);
Wire.write(reg); // send register address to read from
Wire.endTransmission();
Wire.beginTransmission(addr);
Wire.requestFrom((uint8_t)addr, (uint8_t)2); //... | true |
aa11ef39dce909601c9d132e1fc943acdecfa53a | C++ | dante72/sudoku | /sources/actions.cpp | UTF-8 | 3,284 | 2.84375 | 3 | [
"MIT"
] | permissive | #define _CRT_SECURE_NO_WARNINGS
#include <conio.h>
#include "header.h"
char **correct_sudoku(Sudoku item, const int nn, int point, bool game)
{
int i = point / nn;
int j = point % nn;
int x;
bool enter = false;
char** m1 = nullptr, **m = item.task;
if (game)
{
item.result = new_copy(m, nn);
m1 = item.resu... | true |
02721d96b6d5e003fd7cd171890f253fee2a2d54 | C++ | nguyenvandai61/DiscreteMath | /ChinhHopLapSinh.cpp | UTF-8 | 716 | 3.328125 | 3 | [] | no_license | #include <iostream>
using namespace std;
void init(int *a, int &n, int &k) {
cout << "Nhap n: ";
cin >> n;
cout << "Nhap k: ";
cin >> k;
for (int i = 1; i <= k; i++)
a[i] = 1;
}
void out(int *a, int k)
{
for (int i = 1; i <= k; i++)
{
cout << a[i] << " ";
}
cout << endl;
}
bool isLast(int *a, int n,... | true |
5b09c0e4b987b8c8ab9eaeb6feb252ad1df906b3 | C++ | catejaeger86/school | /computer_vision/assignment3/4_em/em.hpp | UTF-8 | 1,214 | 2.734375 | 3 | [] | no_license | #ifndef _EM_HPP
#define _EM_HPP
#include <cv.h>
#include <matrix_raii.hpp>
#include <vector>
// performs em algorithm
void em( CvMat * data, int nClusters, int nTries, IplImage * image );
// performs expectation step of the em algorithm
MatrixRAII expectation( CvMat * data, int nClusters, std::vector<CvMat *> &means,... | true |
654d53fdced5ef1f39b85ebe1b20d45558d243a5 | C++ | PrabhuSammandam/JaSmartObject | /code/stack/common/inc/InteractionStore.h | UTF-8 | 3,556 | 2.609375 | 3 | [] | no_license | #pragma once
#include <common/inc/BaseInteraction.h>
#include <Exchange.h>
#include <vector>
namespace ja_iot {
namespace stack {
class ServerInteraction;
class ClientInteraction;
class MulticastClientInteraction;
typedef std::vector<Exchange *> ExchangeList;
typedef std::vector<BaseInteraction *> Inter... | true |
1e7613b563f42862f8f886ec4c07e712677fba8b | C++ | LGHigh/Algorithm | /UVa437(The Tower of Babylon).cpp | UTF-8 | 1,169 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;
int tr[40][3];
int dp[40][3];
int G[100][100];
int n;
bool Less(int i, int j, int m, int n) {
int a = (j + 1) % 3, b = (j + 2) % 3;
int x = (n + 1) % 3, y = (n + 2) % 3;
if (tr[i][a] < tr[m][x] && tr[i][b] < tr[m][y])return true;
if... | true |
e4c534beebc72e1c5f52bbe80d2bba22026b5aaa | C++ | edadasko/aisd_bsuir_2019 | /avl_tree/avl_tree.hpp | UTF-8 | 1,934 | 3.25 | 3 | [] | no_license | //
// avl_tree.hpp
// avl_tree
//
// Created by Eduard Adasko on 5/6/19.
// Copyright © 2019 Eduard Adasko. All rights reserved.
//
#ifndef avl_tree_hpp
#define avl_tree_hpp
#include <stdio.h>
#include <vector>
template <typename T>
struct avl_node {
T key;
unsigned char height;
avl_node<T>* parent;
... | true |
0bdb555872b7e49bf7ebcdd8339bbecc1df7b826 | C++ | PaulPio/urbeproyectos | /programacion1/corte 2/Burbuja.cpp | UTF-8 | 1,137 | 3.5 | 4 | [] | no_license | #include<iostream>
using namespace std;
int main() {
int num, aux;
int comparaciones = 0;
int intercambios = 0;
cout << "Cuantos numeros seran: ";
cin >> num;
int arreglo[num];
cout << endl << "***CAPTURA DE NUMEROS***" << endl;
for(int x = 0; x < num; x++) {
cout << "Ingresa e... | true |
1dfe6eed54470e4edd57eee4d4fb3b470d8374fc | C++ | bksaiki/MathSolver | /lib/expr/expr.h | UTF-8 | 2,188 | 3.25 | 3 | [] | no_license | #ifndef _MATHSOLVER_EXPRESSION_H_
#define _MATHSOLVER_EXPRESSION_H_
#include "../common/base.h"
#include "../expr/node.h"
namespace MathSolver
{
//
// Expression operations
//
// Returns true if every node in the expression satisfies the given predicate.
template <typename Pred>
bool containsAll(ExprNode* expr, Pr... | true |
e3a850c969eb2939d363c1d5733b8fadaa6f220f | C++ | Chandanjk/Pick_Place_Arm | /main_structure/main_structure.ino | UTF-8 | 329 | 2.578125 | 3 | [] | no_license | #include<Servo.h>
Servo s;
void setup()
{
s.attach(6);
Serial.begin(57600);
for(int i=90;i<=180;i+=1)
{
s.write(i);
delay(20);
}
}
void loop()
{
for(int i=180;i>=0;i-=1)
{
s.write(i);
delay(20);
}
for(int i=0;i<=180;i+=1)
{
s.write(i);
delay(20);... | true |
7befd3a48d5def1dfe1aad45e37819f993636a23 | C++ | SergueiFedorov/SF_Sqlite | /SF_Sqlite_Helper.cpp | UTF-8 | 6,096 | 3.078125 | 3 | [] | no_license | #include "SF_Sqlite_Helper.h"
void sf_sqlite_buildColumnType(std::string& output, const std::string& column, const std::string& type)
{
output += column + " " + type;
}
void sf_sqlite_buildColumnDataPairStrings(std::string& nameOutput, std::string& columnOutput, const std::vector<SF_Sqlite_Column_Data_Pair>& values)... | true |
897c06d6a46a4bbf0fc3114a10423a9725ffc132 | C++ | a-ignatieva/sars-cov-2-recombination | /Code/Rcpp_funs.cpp | UTF-8 | 1,051 | 2.640625 | 3 | [
"MIT"
] | permissive | #include <RcppArmadilloExtensions/sample.h>
// [[Rcpp::depends(RcppArmadillo)]]
using namespace Rcpp;
using namespace arma;
using namespace std;
// [[Rcpp::export]]
int sim_null_realisation(int m, vec P) {
int M = P.size();
int ind = m;
vec S = regspace(1, M);
vec R(M, fill::zeros);
R.subvec(0, m-1) = Rc... | true |
221d266d5b63c2720f251da631babcd4f8994671 | C++ | plaguera/Modbus | /ModbusTCP.cpp | UTF-8 | 11,745 | 2.84375 | 3 | [] | no_license | /*
* ModbusTCP.cpp
*
* Created on: Apr 12, 2019
* Author: Pedro Lagüera Cabrera | alu0100891485
*/
#include "ModbusTCP.hpp"
namespace modbus {
// Inicializar el servidor
ModbusTCP::ModbusTCP(std::vector<int> ids) : devices(std::vector<ModbusServer*>()), sockfd(-1) {
for (int i = 0; i < ids.... | true |
ed2670eb1984ae9456298125d52d35303deee043 | C++ | ArpitSingla/LeetCode | /30 Day Leet Code Challenge/First Bad Version.cpp | UTF-8 | 533 | 3.21875 | 3 | [] | no_license | // The API isBadVersion is defined for you.
// bool isBadVersion(int version);
class Solution {
public:
int firstBadVersion(int n) {
int low=1;
int high=n;
while(low<=high){
int mid=low+(high-low)/2;
if(!(isBadVersion(mid))){
low=mid+1;
}
... | true |
3370447d083b287019334a243c7ab4f82cafb307 | C++ | theboi/competitive-programming | /solutions/HackerRank/C++/1-Introduction/5-forLoop.cpp | UTF-8 | 382 | 3.1875 | 3 | [] | no_license | #include <cstdio>
#include <iostream>
using namespace std;
int main() {
int low, high;
cin >> low >> high;
string nums[] = {"", "one", "two", "three", "four",
"five", "six", "seven", "eight", "nine"};
for (int i = low; i <= high; i++) {
cout << (i >= 1 && i <= 9 ? nums[i] : (i % ... | true |
326c0f6a5d1449a0759f5965e5a09e55330ca0d3 | C++ | tonyellis69/3DTest2 | /src/windows/nearWin.cpp | UTF-8 | 1,533 | 2.515625 | 3 | [] | no_license | #include "nearWin.h"
#include <glm/glm.hpp>
#include "../gameState.h"
#include "../gameGui.h"
void CNearWin::update(float dT)
{
return;
//scraping so scrap
if (gameWorld.player == nullptr)
return;
float nearDist = 1.0f;
bool nearItemsChanged = false;
glm::vec3 playerPos = gameWorld.player-... | true |
926774d0a18b587bd75ee3546e5224a9795899a6 | C++ | aajjbb/contest-files | /Codeforces/Combination.cpp | UTF-8 | 991 | 3.359375 | 3 | [
"Apache-2.0"
] | permissive | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
struct Card {
int a, b;
Card() {}
Card(int _a, int _b) {
a = _a;
b = _b;
}
bool operator<(const Card& c) const {
if(a > c.a && b > c.b) {
return tru... | true |
9bec97c96d4faa7368f54e9f816f03f282c0fc2b | C++ | Stupeflix/freetype-gl | /src/ft/Glyph.cpp | UTF-8 | 1,169 | 2.84375 | 3 | [] | no_license |
#include <iostream>
#include "utils/convert.hpp"
#include "ft/Glyph.hpp"
namespace ft {
Glyph::Glyph() :
width(0), height(0),
offset_x(0), offset_y(0),
advance_x(0), advance_y(0),
s0(0), t0(0), s1(0), t1(0) {
}
Glyph::~Glyph() {}
float Glyph::getKerning(const wchar_t charcode) const {
for (auto &k : kern... | true |
99ec3f6cc3de0c7ecb31e6e9fa7b7afeacc498d6 | C++ | Bit-W/Search_Engines | /sercher/searcher.cc | UTF-8 | 3,556 | 3.09375 | 3 | [] | no_license | #include"searcher.h"
#include<iostream>
#include"../common/util.hpp"
namespace sercher{
//查正排
DocInfo* Index::GetDocInfo(uint64_t doc_id){
if(doc_id >= forward_index.size()) //找到返回,没找到返回空
return NULL;
return &forward_index[doc_id];
}
//查倒排
std::vector<Weight>* Index:: GetInvertedList(std::str... | true |
808bb898538f29bbdee690ce52473878ff7b6c8e | C++ | Robert-Lu/QtGLDemo | /QtGLDemo/OpenGLCamera.cpp | UTF-8 | 4,006 | 3.015625 | 3 | [] | no_license | #include "stdafx.h"
#include "OpenGLCamera.h"
#define PI 3.14159f
OpenGLCamera::~OpenGLCamera()
{
}
OpenGLCamera::OpenGLCamera(const OpenGLCamera& rhs)
{
position_ = rhs.position_;
target_ = rhs.target_;
direction_ = rhs.direction_;
right_ = rhs.right_;
up_ = rhs.up_;
}
void OpenGLCamera::update... | true |
5ee2fc75a3a14538f6f5d0632144fe368985646d | C++ | sn0wyQ/MMMX | /GameObject/RigidBody/intersect_checker.cpp | UTF-8 | 4,403 | 3.078125 | 3 | [] | no_license | #include "intersect_checker.h"
std::vector<QPointF> IntersectChecker::GetIntersectPointsBodies(
const std::shared_ptr<RigidBody>& first,
const std::shared_ptr<RigidBody>& second,
QVector2D offset, float rotation) {
if (second->GetType() == RigidBodyType::kRectangle) {
return GetIntersectPoints(
... | true |
dcb40b759e12341cc59219f3bc8df3f7f8f6441a | C++ | rahul-nambiar/SPA4321-2016 | /Ex1.4/main.cpp | UTF-8 | 264 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
int main() {
float x;
cin >> x;
float y;
cin >> y;
float r = sqrt(pow(x,2)+pow(y,2));
cout << r << endl;
float theta = atan(y/x);
cout << theta << endl;
return 0;
} | true |
55d715cf23a22905a79b66d70c210a419492b7a2 | C++ | JoeKhoa/Source_I_must_learn | /Datat Structure/codeC/Matrix_/main.cpp | UTF-8 | 640 | 3.25 | 3 | [] | no_license | //http://www.cplusplus.com/doc/tutorial/arrays/
#include <iostream>
using namespace std;
int define_matrix();
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
define_matrix();
return 0;
}
int define_matrix(){
const size_t n =... | true |
5c2874f946e46e8bfc2ff0e76cbd4fe187e64b1a | C++ | Volverman/procon-archive | /atcoder.jp/abc103/abc103_b/Main.cpp | UTF-8 | 584 | 2.84375 | 3 | [] | no_license | #include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
string ROTATE(string S){
char b = S.at(S.size()-1);
S.pop... | true |
a9b31a47e507558b51477364c73f77e50802da82 | C++ | Enhex/GUI | /src/gui/double_clickable.cpp | UTF-8 | 753 | 3.046875 | 3 | [
"LLVM-exception",
"Apache-2.0"
] | permissive | #include "double_clickable.h"
double_clickable::double_clickable()
{
// initialize with a time point furthest away from now()
// as a way to tell if a time press was stored yet or not.
press_time[0] = press_time[1] = time_point_t(std::chrono::steady_clock::now() - time_point_t::max());
}
void double_clickable::on_... | true |
b855acb7ecaf4bebdef978410d5e825fc638b799 | C++ | Enrique720/KDTree | /main.cpp | UTF-8 | 2,871 | 2.75 | 3 | [] | no_license | #include <CGAL/Epick_d.h>
#include <CGAL/point_generators_d.h>
#include <CGAL/Manhattan_distance_iso_box_point.h>
#include <CGAL/K_neighbor_search.h>
#include <CGAL/Search_traits_d.h>
#include <CGAL/Search_traits.h>
#include <CGAL/Orthogonal_k_neighbor_search.h>
#include <bits/stdc++.h>
#include "CImg.h"
using namespa... | true |
ce578d74244fe43d87e85f3e528bc46df53b494b | C++ | 45deg/NiniroMosaic | /source/image_manager.cpp | UTF-8 | 3,638 | 2.75 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | #include "image_manager.hpp"
#include <iostream>
#include <memory>
#include <dirent.h>
#include <sys/types.h>
#include "opencv2/opencv.hpp"
#include <vector>
#include <climits>
#include <mutex>
Tile::Tile(std::string filename, int tileSize, int presicion){
image = cv::imread(filename, 1);
cv::resize(image, im... | true |
74461b7b81be7540937bf50c86372644b10094f1 | C++ | mitiguy/drake | /common/proto/test/call_python_test.cc | UTF-8 | 3,680 | 3.015625 | 3 | [
"BSD-3-Clause"
] | permissive | #include "drake/common/proto/call_python.h"
#include <cmath>
#include <gtest/gtest.h>
// TODO(eric.cousineau): Instrument client to verify output (and make this a
// unittest).
namespace drake {
namespace common {
GTEST_TEST(TestCallPython, DispStr) {
CallPython("print", "Hello");
CallPython("disp", "World");
... | true |
79c3f16c3ef472fdfeb75f0f740b3e03d4889090 | C++ | nyhu/PCPP | /D04/ex01/main.cpp | UTF-8 | 987 | 2.921875 | 3 | [] | no_license | #include "PlasmaRifle.hpp"
#include "PowerFist.hpp"
#include "SuperMutant.hpp"
#include "RadScorpion.hpp"
#include "Character.hpp"
int main()
{
std::cout << "42 tests" << std::endl;
Character *zaz = new Character("zaz");
std::cout << *zaz;
Enemy *b = new RadScorpion();
AWeapon *pr = new PlasmaRifle();
AWeapo... | true |
53e753f49f7b81d193f5304dd98f2cfb4c3486d4 | C++ | SuperUserNameMan/Larduino_HSP | /hardware/LGT/avr/libraries/Larduino_HSPExamples/examples/lgt8fx8p_pwm_d5d6_solo/lgt8fx8p_pwm_d5d6_solo.ino | UTF-8 | 484 | 2.546875 | 3 | [
"MIT"
] | permissive |
uint16_t dutyMax = 0xff;
uint8_t deadBand = 0x8;
void setup() {
// put your setup code here, to run once:
// usage: pwmMode(pin, pwm_mode, freq_mode)
pwmMode(D5, PWM_MODE_SOLO, PWM_FREQ_FAST|PWM_FREQ_BOOST);
// usage: pwmFrequency(pin, freq_in_hz)
// 250KHz PWM frequency
dutyMax = pwmFrequency(D5, 250000... | true |
46f6fea1bcaaf04a0fefbf0911752dfdbfa91e41 | C++ | taxagawa/MATES-for-EV-simulation | /ARouter.h | UTF-8 | 3,533 | 2.828125 | 3 | [] | no_license | /* **************************************************
* Copyright (C) 2014 ADVENTURE Project
* All Rights Reserved
**************************************************** */
#ifndef __AROUTER_H__
#define __AROUTER_H__
#include <string>
#include <vector>
class RoadMap;
class Intersection;
class Route;
class Section;
c... | true |
8cc17218f34ca2bb9279bece8fc0ece839796921 | C++ | crazyanimals/unlimited_racer | /GraphicObjects/Light.cpp | UTF-8 | 8,440 | 2.671875 | 3 | [] | no_license | #include "stdafx.h"
#include "Light.h"
using namespace graphic;
//////////////////////////////////////////////////////////////////////////////////////////////
//
// sets all colors at once
//
//////////////////////////////////////////////////////////////////////////////////////////////
void CLight::SetC... | true |
e82fda2ab555e52da4cbf59648bb45ce905ee93e | C++ | SamuelPavlik/MyGameEngine | /MyGameEngine/Quadtree.hpp | UTF-8 | 1,287 | 2.859375 | 3 | [] | no_license | #ifndef Quadtree_hpp
#define Quadtree_hpp
#include <SFML/Graphics.hpp>
#include <memory>
#include <vector>
#include <array>
class C_BoxCollider;
class Quadtree {
public:
Quadtree();
Quadtree(int maxObjects, int maxLevels, int level,
sf::FloatRect bounds, Quadtree* parent);
void Insert(std::share... | true |
568ed73aeac75f285cbc90115a95f7db980779cd | C++ | M3rs/ogle | /src/ogle/camera.cpp | UTF-8 | 2,262 | 2.703125 | 3 | [] | no_license | #include "ogle/camera.hpp"
#include "glm/gtc/matrix_transform.hpp"
#include <SDL2/SDL.h>
namespace ogle {
Camera::Camera(int width, int height)
: m_pos(glm::vec3(0.0f, 0.0f, 8.0f)), m_front(glm::vec3(0.0f, 0.0f, -1.0f)),
m_up(glm::vec3(0.0f, 1.0f, 0.0f)), m_yaw(-90.0f), m_pitch(0.0f),
m_width(width),... | true |
08f8ec77bc72d88805edb306ddb137d2ce558a47 | C++ | jancura/modular-server | /DLL/ping/spracuj_net_addr.cpp | UTF-8 | 4,422 | 2.71875 | 3 | [
"MIT"
] | permissive | //definuje funkcie pre spracovanie IP adries, konverziu integera na string
//a obratenie DWORDU
/*Pali Jancura - to jest ja :)
* 08.05.2005
* chng: inicializujGenerovanie() - osetrenie pre masku 0.0.0.0
* 07.05.2005
* rem: my_ping() - presunuty do ping.cpp
* checksum() - presunuty do ping.cpp
* 06.05.2005 - a ... | true |
3b544a5b71e35ca22d5ecd0b23bf5e18b45a2410 | C++ | iulianR/snippets | /bmp/bmp.cpp | UTF-8 | 1,917 | 3.109375 | 3 | [] | no_license | #include "bmp.h"
#include <cstring>
#include <fstream>
#include <iterator>
#include <iostream>
using namespace std;
namespace bmp {
Image::~Image()
{
::memset(&m_bfh, 0x00, sizeof m_bfh);
::memset(&m_bih, 0x00, sizeof m_bih);
::memset(&m_data, 0x00, sizeof m_data);
}
void Image::load()
{
ifstream s... | true |
a34737f01ce93de0f71eba85df23bb57c20cbcc0 | C++ | talsahar/HangmanOnline | /Game/src/Guest.cpp | UTF-8 | 2,091 | 2.78125 | 3 | [] | no_license | /*
* Guest.cpp
*
* Created on: Aug 15, 2017
* Author: user
*/
#include "Guest.h"
namespace npl {
Guest::Guest( string peerIP) :
Player(GUEST_PORT) {
this->peerIP = peerIP;
this->peerPort = HOST_PORT;
}
Guest::~Guest(){
}
int Guest::startGame() {
if(!sendCommand(GUEST_SAY_HELLO, NULL))
{
onErr... | true |
cab206f0466d9928ae5c4d3c8c37f91fffcbb62f | C++ | TereSolano15/lab02-oop-lions | /University.cpp | UTF-8 | 1,796 | 3.21875 | 3 | [] | no_license | //
// Created by Maikol Guzman on 8/2/20.
//
#include <sstream>
#include "University.h"
University::University(const string &name, Professor *professor, Administrative *administrative,
const vector<Professor> &professorList, const vector<Administrative> &administrativeList)
:name(name), professor(professor), admin... | true |
691c8f768d1b60c1992204202da50da8729be0c5 | C++ | irbisPro10/laba3 | /labaTPMlist/labaTPMlist/labaTPMlist.cpp | WINDOWS-1251 | 4,169 | 3.1875 | 3 | [] | no_license | // labaTPMlist.cpp: .
//
#include "stdafx.h"
class list{
list *l = 0x00, *first = 0x00;//
int i;//
public:
list *lN, *lP;
int inf;
list(){
lN = lP = 0x00;
}
list(list *prev, list *next){
lP = prev;
lN = next;
}
int addUp(int inf){//
l = first;
i = 0;
while (l != 0x00 && l->lN != 0x00){
... | true |
ee1807791fa0c1bd2864b6352bd7eb991c337163 | C++ | charlyzt/tarea-1 | /trabajos domingo/temporizador.cpp | UTF-8 | 541 | 2.921875 | 3 | [] | no_license | #include <iostream>
//temporizador
using namespace std;
int main(int argc, char *argv[])
{
int temporizador = 1;
int segundos=0;
int minutos;
while (true)
int s=1;
cout << temporizador << endl;
if (temporizador == segundos) cout << "***fin del tiempo ***" << endl;
if (temporizador > segundos) ... | true |
35eb3fd3700c519984b2d143af20fae339ad455e | C++ | GerdHirsch/Cpp-Basics | /BadCode/src/TrafficLight.cpp | UTF-8 | 2,196 | 2.875 | 3 | [] | no_license | ///////////////////////////////////////////////////////////
// Ampel.cpp
// Implementation of the Class Ampel
// Created on: 30-Sep-2008 14:54:02
///////////////////////////////////////////////////////////
#include <exception>
#include <iostream>
using namespace std;
#include "TrafficLight.h"
#includ... | true |