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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5e475c209e8d7610c6dffdcda301dcae3cefaf72 | C++ | YangYang/LibraryManager | /LibraryManager/TransformPlus.cpp | UTF-8 | 1,744 | 2.65625 | 3 | [] | no_license | #include "StdAfx.h"
#include "TransformPlus.h"
TransformPlus::TransformPlus(void)
{
}
TransformPlus::~TransformPlus(void)
{
}
//CString
CString TransformPlus::toCString(string str){
CString cstr(str.c_str());
return cstr;
}
CString TransformPlus::toCString(double dbl){
CString t;
t.Format(L"%f",dbl);
return ... | true |
485ceb655eb89ec4240c14297037f23c4bfd6fe0 | C++ | blue-yonder/turbodbc | /cpp/turbodbc/Library/turbodbc/description.h | UTF-8 | 1,640 | 2.96875 | 3 | [
"MIT",
"LicenseRef-scancode-free-unknown"
] | permissive | #pragma once
#include <turbodbc/field.h>
#include <turbodbc/type_code.h>
#include <cpp_odbc/multi_value_buffer.h>
#ifdef _WIN32
#include <windows.h>
#endif
#include <sqltypes.h>
namespace turbodbc {
/**
* @brief Represents all information to bind a buffer to a column or parameter and
* how to store/load val... | true |
727e64e0b6533ea2f9ba6e1f35d1d8965a87c215 | C++ | lederle-david/work-examples | /OOP244-Final-Project/Date.cpp | UTF-8 | 2,350 | 3.09375 | 3 | [] | no_license | // OOP244 Final Project - MS6
// File: Date.cpp
// Date: 2016/04/04
// David Lederle
// 104026158 dlederle@myseneca.ca
#include <iomanip>
#include <iostream>
using namespace std;
#include "Date.h"
#include "general.h"
namespace sict{
Date::Date(){
year_ = 0;
mon_ = 0;
day_ = 0;
readErrorCode_ ... | true |
441ddc0444d251a16e91708f6a8b46364ba09cad | C++ | Terry-Ma/Leetcode | /面试题05-替换空格-a.cpp | UTF-8 | 265 | 2.609375 | 3 | [] | no_license | class Solution {
public:
string replaceSpace(string s) {
string result;
for(auto i : s){
if(i == ' ')
result += "%20";
else
result += i;
}
return result;
}
};
| true |
f25ea226068356f25a28535159a3502fdabf30b8 | C++ | zaeval/data-structure-example | /data-structure-lab/data-structure-lab/adt_queue.hpp | UTF-8 | 861 | 2.96875 | 3 | [
"MIT"
] | permissive | //
// adt_queue.hpp
// data-structure-lab
//
// Created by 홍승의 on 2018. 3. 26..
// Copyright © 2018년 홍승의. All rights reserved.
//
#ifndef adt_queue_hpp
#define adt_queue_hpp
#include <iostream>
using namespace std;
template<typename T>
class Queue{
private:
int top;
int size;
int bottom;
T *arr;... | true |
19ce7ec314658964b00e71342c99344acd5bd79a | C++ | rehassachdeva/coding-practice | /leet/trees/complete-binary-tree-inserter.cpp | UTF-8 | 1,291 | 3.609375 | 4 | [] | no_license | // Linearising / Linear complete binary tree
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x... | true |
b92b09a51194afaa7962bebafa6acb4fc3b1eef2 | C++ | LQNL/Design-Mode | /C++设计模式/Template method/code/template1_app.cpp | UTF-8 | 358 | 2.734375 | 3 | [] | no_license | // 应用程序开发人员
class Appplication
{
public:
bool Step2(){
//....
}
bool Step4(){
//...
}
};
// 应用程序使用库 template1_lib.cpp
int main()
{
Library lib();
Application app();
lib.Step1();
if (app.Step2()){
lib.Step3();
}
for (int i = 0; i < 4; i++){
app.Step4();
}
lib.Step5()... | true |
1d19d0882485b10ab5abfe56e9151279c7c471f6 | C++ | CJBussey/zug | /zug/detail/tuple_utils.hpp | UTF-8 | 1,434 | 2.828125 | 3 | [
"BSL-1.0"
] | permissive | //
// zug: transducers for C++
// Copyright (C) 2019 Juan Pedro Bolivar Puente
//
// This software is distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt
//
#pragma once
#include <tuple>
#include <type_traits>
namespace zug {
namespa... | true |
94b7c7824f1368064978fc7b44815fecf9930034 | C++ | Ares7/efficientAlgorithms | /hw1/t3/main.cpp | UTF-8 | 873 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include "regex"
using namespace std;
int main() {
std::ios::sync_with_stdio(false);
int t = 1;
int n = 3;
cin>>t;
cin>>n;
cin.ignore();
vector<string> results;
string line;
for (int i = 0; i < n; ++i)
{
getline(cin, line);
... | true |
2b94b36bfe6eebb1e0b2c8eb7a80a6183e5d97df | C++ | CyJay96/Lab-cpp | /lab_9/lab_9.1/functions.cpp | UTF-8 | 1,206 | 3.390625 | 3 | [] | no_license | #include "functions.h"
bool search_char(string str, char ch) {
for (int i = 0; i < str.length(); ++i) {
if (ch == str[i]) {
return true;
}
}
return false;
}
bool search_str(string s1, string s2) {
for (int i = 0; i < s2.length(); ++i) {
if (!search_char(s1, s2[i])) {
return false;
}
}
return tru... | true |
60f45453eb14cd9f9f7f37ef54554797010bb912 | C++ | xiaoguangcong/WebServer | /base/include/noncopyable.h | UTF-8 | 442 | 3.09375 | 3 | [] | no_license | #pragma once
// 如果不想让外面的用户直接构造一个类的对象,而希望用户只能构造这个类的子类,
// 那你就可以将类的构造函数/析构函数声明为protected,而将类的子类的构造函数/析构函数声明为public
class NonCopyable
{
protected:
NonCopyable() {}
~NonCopyable() {}
private:
NonCopyable(const NonCopyable&);
const NonCopyable& operator=(const NonCopyable&);
};
| true |
8979429fc3aebe9532485d68fb6d28820057ecf6 | C++ | timkwist/CS479 | /PA1-Bayes_Classifier/main.cpp | UTF-8 | 8,853 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <Eigen/Dense>
#include <vector>
#include "BayesClassifier.h"
#include <iostream>
#include <fstream>
using namespace Eigen;
using namespace std;
void writeSamplesToFile(const char* fileName, vector<Vector2f> sampleOne, vector<Vector2f> sampleTwo);
int main()
{
srand(time(NULL));
ofstr... | true |
405529a8c320f9a681d1a76771fd9571b2dadcc4 | C++ | hwangJi-dev/Algorithm_Practice | /algorithm_2178.cpp | UTF-8 | 921 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int maze[100][100] = { 0 };
bool check[100][100];
int squareCnt[100][100] = { 0 };
int N, M;
int dx[] = { 0, 1, 0, -1 };
int dy[] = { -1, 0, 1, 0 };
void bfs(int x, int y) {
check[x][y] = true;
squareCnt[x][y]++;
que... | true |
3dbf76c40cb12f57ca6875ee9dd3b218cdcae5c6 | C++ | DenisCarriere/flashloans | /borrower.cpp | UTF-8 | 951 | 2.578125 | 3 | [] | no_license | #include <eosio/eosio.hpp>
#include <eosio/asset.hpp>
#include <flashloans.hpp>
#include <eosio.token.hpp>
using namespace eosio;
using namespace std;
class [[eosio::contract]] borrower : public contract {
public:
using contract::contract;
[[eosio::action]]
void execute( const extended_asset ext_quantity ) {
... | true |
0d7c82032c1174e391f578b5e4cec21097dad6b4 | C++ | BewareMyPower/Algorithm-Learning | /FindArticul/FindArticul.cpp | GB18030 | 2,498 | 3.109375 | 3 | [] | no_license | // FindArticul.cpp: Ѱͼĸ㣬ǿ֧ͨ
#include <string>
#include <map>
#include <list>
#include <stack>
#include <algorithm>
#include <cstdio>
typedef std::string Vertex; // õַڵ
typedef std::map<Vertex, std::list<Vertex>> AdjList; // ڽӱΪÿ㵽ڽӵӳ
typedef AdjList Graph; // ʹڽӱΪͼıʾ
typedef std::map<Vertex, int> VexIntMap; // ɽڵ㵽i... | true |
2f1a57b76faf482c1b525c921e763e1a272b82be | C++ | ComiteMexicanoDeInformatica/OMI-Archive | /2022/OMI-presencial/OMI-2022-feliz-encuentro/solutions/sol_sub3.cpp | UTF-8 | 975 | 2.796875 | 3 | [] | no_license | #include <iostream>
#include <set>
using namespace std;
#define debugsl(x) std::cout << #x << " = " << x << ", "
#define debug(x) debugsl(x) << "\n";
#define MAX 100000
int t, q, l, r, res, acumulado[MAX + 2];
string st;
int main() {
std::cin >> t >> q >> st;
// HAZ UNA CUENTA ACUMULADA DE LOS ENCUENTROS QUE ... | true |
fef2bf9d0740a44e3af9710f27e82e14778810bb | C++ | Game-Made-with-OpenGL/OpenGL-Game | /vs/Lesson07/Demo.cpp | UTF-8 | 5,777 | 2.53125 | 3 | [] | no_license | #include "Demo.h"
Demo::Demo()
{
}
Demo::~Demo()
{
if (Mix_Playing(sfx_channel) == 0) {
Mix_FreeChunk(sound);
}
if (music != NULL) {
Mix_FreeMusic(music);
}
Mix_CloseAudio();
}
void Demo::Init()
{
BuildInfoSprite();
InitAudio();
AddInputs();
}
void Demo::Update(float deltaTime)
{
if (IsKeyDown("Quit"... | true |
fe8926ef436892aa7f6bff89a828b00733ff316b | C++ | mingchengzack/Phong-Model-with-Gouraud-Shading | /main.cpp | UTF-8 | 13,465 | 2.578125 | 3 | [] | no_license | #include <GL/glut.h>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <algorithm>
#include "glm/glm.hpp"
#include "object.h"
#include "utility.h"
#include "slider.h"
using namespace std;
GLvoid *font_style = GLU... | true |
efa18dfadf4054358a54f5785f06ed1444df9073 | C++ | skwee357/math-lib | /quaternion.cpp | UTF-8 | 5,193 | 3.53125 | 4 | [
"MIT"
] | permissive | /**
* @file quaternion.cpp
* @author skwo
* @brief Realization of quaternion class.
*/
#include <cmath>
#include "quaternion.hpp"
#include "matrix.hpp"
namespace skmath{
//Constructor
Quaternion::Quaternion()
{
//Multiplicaiton identity quaternion
_w = 1.0f;
_v[0] = 0.0f;
_v... | true |
9dfcd6b69bdec95c5108dee12829ef49e33c0ac6 | C++ | bagobor/Beetle | /src/materials/blurmaterial.cpp | UTF-8 | 1,954 | 2.5625 | 3 | [] | no_license | #include "blurmaterial.h"
#include <math.h>
#include "utils/math.h"
BlurMaterial::BlurMaterial(QGLShaderProgram *shader): QuadMaterial(shader) {
adrOffsetSize = shader->uniformLocation("offsetSize");
adrOffsets = shader->uniformLocation("offsets");
adrLowTexture = shader->uniformLocation("lowTexture");
adrSeed = s... | true |
4af78e15ce0d4d4f3431356eaedfc92680b6da82 | C++ | dangfugui/note-C | /oj题目/其他人/李春阳/P1056(S10908).cpp | UTF-8 | 312 | 2.8125 | 3 | [] | no_license | #include<iostream>
using namespace std;
long long pow(long long a,long long b,long long c)
{
if(a==1||b==0)
return 1;
if(b==1)
return a%c;
long long t=pow(a,b/2,c);
if(b%2)
return t*t*a%c;
return t*t%c;
}
int main()
{
long long x,y,z;
cin>>x>>y>>z;
cout<<pow(x,y,z);
return 0;
} | true |
c2ea8a99a609cdebf5f4b17daa886d75655f79ba | C++ | wi1k1n/simulation-dynamic-systems | /CPPSFNetworksTest/main.cpp | UTF-8 | 1,443 | 2.78125 | 3 | [] | no_license | #include "SFNetwork.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <ctime>
#include <functional>
#include <random>
#include <fstream>
#include <thread>
#include <Windows.h>
#include <string>
#define PI 3.1415926535897932384626433832795
using namespace std;
using namespace Diploma2;
doubl... | true |
3edf2ac6a5df0c2d976cae703c86e2cc95a69d50 | C++ | freesinger/Algorithm_DS | /Binary Search Tree/btreeDelete.cpp | UTF-8 | 2,843 | 3.78125 | 4 | [] | no_license | /* 二叉搜索树删除操作 */
#include <iostream>
#include <string>
using namespace std;
struct Node {
int key;
Node *right, *left, *parent;
};
static Node *root = NULL;
Node *treeMinimum(Node *x)
{
while (x->left != NULL)
x = x->left;
return x;
}
Node *getSuccessor(Node *x)
{
if (x->right != NULL)
... | true |
3d52fce4811dedbc3f487bd8da014600461578d6 | C++ | semeyon/getratebot | /src/types/Country.cpp | UTF-8 | 449 | 2.546875 | 3 | [] | no_license | //
// Created by Semeyon Svetliy on 07/10/2018.
//
#include <string>
#include <fmt/format.h>
#include "Country.hpp"
using namespace std;
string Country::msg() {
return fmt::format("{0}({1}) – {2}, {3}", this->currencyId, this->currencySymbol, this->currencyName, this->name);
}
string Country::forSearch() {
... | true |
972e2f631f42b79cefe0e7c618782495a6aa274b | C++ | andikan/GaussMesh | /GaussMesh/main.cpp | UTF-8 | 75,432 | 2.671875 | 3 | [] | no_license | //
// main.cpp
// GaussMesh
//
// Created by Andikan on 13/8/2.
// Copyright (c) 2013 Andikan. All rights reserved.
//
#include "IncludeLib.h"
int main( void )
{
// Initialise GLFW
if( !glfwInit() )
{
fprintf( stderr, "Failed to initialize GLFW\n" );
return -1;
}
glfwOpen... | true |
c8298cdf8108fe91f64d46b4e52de86b1fbdbbb6 | C++ | Chris443/GeKo | /GeKo/Math/vec4.cpp | UTF-8 | 667 | 3.140625 | 3 | [] | no_license | #include "vec4.h"
namespace gkm {
vec4::vec4(float x, float y, float z, float w) :e{x,y,z,w} {}
vec4::vec4(const vec4& other) : e{ other.e[0] ,other.e[1],other.e[2], other.e[3] } {}
vec4::vec4(vec4&& other) {
std::swap(e[0], other.e[0]);
std::swap(e[1], other.e[1]);
std::swap(e[2], other.e[2]);
std::swa... | true |
ea089e3460de5a2ac3fdab675e6fec8ef68b27d5 | C++ | KkyuCone/DirectX3D_MSJ_PO | /MSJ_DirectX_3D/Engine/Include/Component/TPCamera.h | UHC | 1,410 | 2.546875 | 3 | [] | no_license | #pragma once
#include "Component.h"
ENGINE_BEGIN
// 3Ī ī Ʈ
// 1Ī ó ϴ. (Ÿ 0 ϸ )
class ENGINE_DLL TPCamera : public Component
{
private:
friend class GameObject;
protected:
TPCamera();
TPCamera(const TPCamera& _Com);
virtual ~TPCamera();
private:
class GameObject* m_pTargetObj;
class Transform* m_pTarget; ... | true |
ac8aa63f9208ffcce9ca3697efab85663f312fce | C++ | makisto/prog | /1/6/6.3.cpp | WINDOWS-1251 | 476 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main(int argc, char *argv[])
{
srand(time(NULL));
double arr[20];
double a = 0;
double b = 10;
for(int i = 0; i < 20; i++)
{
arr[i] = rand() * (b - a) / RAND_MAX + a;
cout << arr[i] << " ";
}
cout << endl << " :" << endl;
... | true |
7578a7aaea30fa0ff679c2171e3b8ab384e9e8fe | C++ | scylla-zpp-blas/scylla_matrix_test | /float_value_factory.hh | UTF-8 | 332 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <random>
#include "matrix_value_factory.hh"
class float_value_factory: public matrix_value_factory<float> {
private:
std::mt19937 _rng;
float _min, _max;
std::uniform_real_distribution<float> _dist;
public:
float_value_factory(float min, float max, int seed);
float next() o... | true |
d9773c523323714dcb8a937178e69bf33a208807 | C++ | raidoxin/PA9-Repository | /paperclone/visa.cpp | UTF-8 | 1,678 | 2.953125 | 3 | [] | no_license | #include "visa.h"
string & visa::getDestCountry()
{
return destinationCountry;
}
string & visa::getDestCity()
{
return destinationCity;
}
string & visa::getVisatype()
{
return visatype;
}
void visa::setDestCountry(string & newnation)
{
destinationCountry = newnation;
}
void visa::setDestCity(string & newcity)
... | true |
8f8b2e2983b730f7c4fe129dd9a37395a1c9d27d | C++ | zeagle01/graphics_play_ground | /examples/shellet/shellet/src/FEM_Simulator.h | UTF-8 | 1,011 | 2.578125 | 3 | [] | no_license |
#ifndef FEM_SIMULATOR_H
#define FEM_SIMULATOR_H
#include "Simulator.h"
#include "Topology_Computer.h"
#include "predef_types.h"
#include <vector>
#include <memory>
class FEM_Simulator :public Simulator {
public:
FEM_Simulator() : topology_computer(std::make_shared<Topology_Computer>())
{}
virtual void update(... | true |
329bec38cbc173b8eca6916eb0c7e2b72faf4615 | C++ | VictorEijkhout/EduDL-public | /src/vector.cpp | UTF-8 | 2,722 | 3.046875 | 3 | [] | no_license | /****************************************************************
****************************************************************
****
**** This text file is part of the source of
**** `Introduction to High-Performance Scientific Computing'
**** by Victor Eijkhout, copyright 2012-2021
****
**** Deep Learning N... | true |
08ee1ef901b22e79819fb07d8ba65d834915baea | C++ | rustam-azimov/homeWork | /thirdSemester/hw3/roboGraph/roboGraph.h | UTF-8 | 854 | 3.265625 | 3 | [] | no_license | #ifndef ROBOGRAPH_H
#define ROBOGRAPH_H
/**
* @file RoboGraph.h
*
* Implementation of RoboGraph class.
* Determine, whether there is a sequence of teleportations,
* in which all robots self-destruct.
*/
#include <QVector>
class RoboGraph
{
public:
RoboGraph(const int& size);
/// Adds one robot. If vertex > ... | true |
bfbdcebba94f795f19f322e58fa1dbf859a2bcc3 | C++ | tan2/DynEarthSol | /libadaptivity/load_balance/include/ElementVector.h | UTF-8 | 3,334 | 2.6875 | 3 | [
"LGPL-2.1-only",
"LGPL-2.1-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"GPL-2.0-only",
"LicenseRef-scancode-other-copyleft",
"MIT"
] | permissive | /* Copyright (C) 2006 Imperial College London and others.
Please see the AUTHORS file in the main source directory for a full list
of copyright holders.
Dr Gerard J Gorman
Applied Modelling and Computation Group
Department of Earth Science and Engineering
Imperial College London
g.gorman@imperial.ac.uk
This... | true |
c3a39d09fbee22e6aa2eced956cf7da5e1913c99 | C++ | jamesshao8/udoo_neo_flight_controller | /A9/observer.hpp | UTF-8 | 704 | 3.1875 | 3 | [
"MIT"
] | permissive | #ifndef OBSERVERPATTERN_H
#define OBSERVERPATTERN_H
#include <iostream>
#include <vector>
class Observer
{
public:
Observer(){};
virtual void update() = 0;
};
class Observable
{
private:
std::vector<Observer*> observers;
bool ch;
public:
Observable(){ch = false;};
void notifyObservers()
{
for (s... | true |
8540e620649e9b808ebca251d1edb9f093213125 | C++ | Onederflow/CYBER-KNU-OOP_and_LABS | /Part2/laboratory/lab5/main.cpp | UTF-8 | 3,422 | 3.34375 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
struct Node
{
int data_1;
int data_2;
Node *Last;
Node *left;
Node *center;
Node *right;
};
void add_new_node(int data, Node *&NowTr, Node *Last);
void write_node(Node *NowTr);
int main()
{
srand ( time(NULL) );
Node *head ;// = new Node... | true |
f90a90fcc963cc3ccf95c8091ac74a48e54bd48f | C++ | Mu-Ahmad/OOP-CMP-244-241 | /Lecture Codes/Lecture 14/File Handling OOP/File08.cpp | UTF-8 | 395 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <fstream>
using namespace std;
int main(){
int val;
ofstream out("numbers.txt");
for (int i=1; i<=50 ; i++)
out << i << ' ';
out << '\n';
out.close();
ifstream in("numbers.txt");
while (true){
in >> val;
if (in.fail()) break;
co... | true |
d3885a9fbc681556911e59110ee97921b8e1dba7 | C++ | tmichi/mibase | /src/Parse.cpp | UTF-8 | 1,507 | 2.640625 | 3 | [
"MIT"
] | permissive | #include <mi/Parse.hpp>
#include <string>
#include <cstdlib>
namespace mi
{
template<> char parse ( const std::string& value )
{
return static_cast<char> ( std::atoi ( value.c_str() ) );
}
template<> unsigned char parse ( const std::string& value )
{
... | true |
bde29f3646c46a3b811c767acb76bb4d537e082e | C++ | baender/The_Coding_Den_Share | /main.cpp | UTF-8 | 986 | 2.640625 | 3 | [] | no_license | #include <Arduino.h>
#include "mySensorInterface.h"
#include "mySensorAnalog.h"
#include "mySensorCTD.h"
char lineBuffer[255];
SensorAnalog a("SensorA", 8, 1.4142);
SensorAnalog b("Sensor321", 6, 3.1415);
SensorCTD c("CTD1", 'H');
SensorCTD d("CTD2", 'Q');
SensorInterface *sensors[] = {&a, &b, &c... | true |
d4fc1d421a35e81e095b7b6b6d5c10ec3fdc456d | C++ | Grzego/agh-miss-project | /MISS Project/simulation/map.h | UTF-8 | 2,400 | 3.046875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <vector>
#include <string>
#include <memory>
#include <unordered_map>
#include <unordered_set>
#include <SFML\Graphics.hpp>
#include "utils.h"
#include "knowledge.h"
class Agent;
/**
* Enum opisujacy pola dostepne na mapie.
*/
enum class Field
{
Empty,
Food,
Water,
Danger,
... | true |
aaa3a4818ac5feb24bb0a597e1210c07a38a4448 | C++ | mamysa/ShaderPreviewer | /src/Logger.cpp | UTF-8 | 327 | 2.8125 | 3 | [] | no_license | #include <list>
#include "Logger.h"
#define MAX_LOG_ENTRIES 32
std::list<LogEntry> Logger::m_buf;
void Logger::add(const std::string& str, LogType type) {
if (m_buf.size() == MAX_LOG_ENTRIES)
m_buf.pop_front();
m_buf.push_back(LogEntry(str, type));
}
const std::list<LogEntry>& Logger::getBuf(void) {
return m... | true |
781897480570c002b4f1ff75b1b4d9725c49abc8 | C++ | asutton/beaker-akron | /beaker/sys.int/expr.hpp | UTF-8 | 5,190 | 2.640625 | 3 | [
"MIT"
] | permissive | // Copyright (c) 2015-2017 Andrew Sutton
// All rights reserved
#ifndef BEAKER_SYS_INT_EXPRESSION_HPP
#define BEAKER_SYS_INT_EXPRESSION_HPP
#include <beaker/base/expr.hpp>
namespace beaker {
namespace sys_int {
enum {
first_expr_kind = sys_int_lang_block,
#define def_expr(NS, E) E ## _expr_kind,
#include "expr.d... | true |
87674a31222203607edb8cd8cd4dc3f3f2a4ee9f | C++ | MjVlad/Strassen | /Strassen/Main.cpp | UTF-8 | 453 | 2.78125 | 3 | [] | no_license | #include "Matrix.h"
#include<iostream>
#include<vector>
#include <ctime>
using namespace std;
int main() {
int size = 0;
cin >> size;
Matrix mat1 = Matrix(size);
mat1.set();
Matrix mat2(size);
mat2.set();
Matrix mat3(size);
int beg = clock();
mat3 = multiStrassen(mat1, mat2);
int end = clock();
cout << e... | true |
787b4a8a0cc1c20f8f918c45362039f3383d7702 | C++ | lvdou2518/YBT | /1192:放苹果.cpp | GB18030 | 865 | 2.875 | 3 | [] | no_license | #include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int t,m,n,i,j;
int f[100][100];//һάŵƻάӸ ,ֵΪŵķ
scanf("%d",&t);
//Сߴ
//ʼ ߽
for(i=1;i<=20;i++) f[0][i]=1;//0ƻ
for(i=1;i<=20;i++) f[i][1]=1;//1
for(i=1;i<=20;i++)
for(j=2;j<=20;j++)
{
if(i<j) f[i][j]=... | true |
287fc4a1048bc2a7bf9aa001efa2f4ca41d89778 | C++ | Arotte/matura-exercises | /13-may_valasztas.cc | UTF-8 | 3,497 | 3.109375 | 3 | [] | no_license | /* Solution for the <2013 May> Hungarian IT matura exam's 4th task */
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
bool bigger (int a, int b) { return (a<b); }
struct Jelolt {
int valasztoKer, szavazatok;
string nev[2], part;
}... | true |
9ed82b847a2337b67d17ebeb85cc6af897244258 | C++ | bryik/experiments-in-cpp | /experiments/12-functor.cpp | UTF-8 | 334 | 3.5625 | 4 | [] | no_license | #include <iostream>
using namespace std;
// I'm not sure how well C++ handles closures, but it does have functors
// (functions with state).
struct Counter {
int count = 0;
int operator()() { return count++; }
};
int main() {
Counter c;
cout << c() << endl; // 0
cout << c() << endl; // 1
cout << c() <<... | true |
afcd6e28f4e78d01320bacb1d73383c6445b85c4 | C++ | wizleysw/backjoon | /6588/solve.cpp | UTF-8 | 1,130 | 2.953125 | 3 | [] | no_license | // https://www.acmicpc.net/problem/6588
// 골드바흐의 추측
// Written in C++ langs
// 2020. 02. 04.
// Wizley
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
long long NUMBER[1000001]={0,};
vector<int> PRIME;
void eratosthenes(int until){
for(auto i=2... | true |
c26180d831b737acae624328c8b257e78bafc015 | C++ | drlongle/leetcode | /algorithms/problem_0941/solution2.cpp | UTF-8 | 482 | 3.078125 | 3 | [] | no_license | class Solution {
public:
bool validMountainArray(vector<int>& arr) {
int sz = arr.size();
if (sz < 3 || arr[0] >= arr[1])
return false;
bool up = true;
for (int i = 1; i < sz; ++i) {
if (arr[i] == arr[i-1])
return false;
if (up && a... | true |
e40e870b8d9b82dc57018aab645c8358706debe2 | C++ | BetaOrbiter/CPP_PRIMER | /Chapter_10/10_22.cpp | UTF-8 | 443 | 3 | 3 | [] | no_license | #include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std::placeholders;
bool lessOrEqualThanN(const std::string &s, std::string::size_type n){
return s.size()<=n;
}
int main(void){
std::vector<std::string> words{"12345","123456","1234567","12345678"... | true |
3538d6430854fcde924fd160b142ab8d2541234a | C++ | acamargosonosa/imart | /src/affine.h | UTF-8 | 3,291 | 2.734375 | 3 | [] | no_license | /*
* @Author: jose
* @Date: 2019-11-15 13:55:00
* @Last Modified by: jose
* @Last Modified time: 2019-11-05 13:55:00
*/
#ifndef __AFFINE_H__
#define __AFFINE_H__
// local libs
#include "global.h"
namespace imart
{
// Class affine
template <typename type, typename container=vector_cpu<type>>
class affine: public... | true |
eeb4aeba5861b1025fd3706feb03cb1d053c00c4 | C++ | m4scosta/contests-training | /URI/1478.cpp | UTF-8 | 863 | 2.890625 | 3 | [] | no_license | #include <cstdlib>
#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;
void imp_mat_quad(int n){
int m[n][n];
int i, j, k;
for(i = 0; i < n; i++){
k = i+2;
for(j = 0; j < n; j++){
if(i == j)
k = 1;
... | true |
1557acf5c7df8d174701d8ff826f5faece8dfd58 | C++ | WhiZTiM/coliru | /Archive2/21/ab8ed2c97cc879/main.cpp | UTF-8 | 1,383 | 3.34375 | 3 | [] | no_license | #include <utility>
template<typename F>
struct ScopeGuard
{
ScopeGuard(F&& f) : mFunction(std::forward<F>(f)) { }
// disable copy
ScopeGuard(const ScopeGuard&) = delete;
ScopeGuard& operator=(const ScopeGuard&) = delete;
// enable move
ScopeGuard(ScopeGuard&&) noexcept = default;
ScopeG... | true |
070acfd562871dde82415d3b67df2ae7187aa17a | C++ | agangavaram/rcj-2018-soccer-lightweight | /motorTests/motorMovement.ino | UTF-8 | 826 | 2.609375 | 3 | [] | no_license | #include <SoftwareSerial.h>
#include <PololuQik.h>
PololuQik2s9v1 qikF(2, 3, 4);
PololuQik2s9v1 qikB(10,11,12);
void go(float degree)
{
float pi = 3.1415;
float rad = degree/(180/pi);
int FLSpeed = (-(sin(rad)*127)*(sqrt(3)/2)) - ((cos(rad)*127)/2); // front-left
int FRSpeed = (sin(rad)*127)*sqrt(3)/2 -... | true |
7251165957ee157cb9b242f2679a1498669980c3 | C++ | jokerpwn/heuristic-algorithm-learning | /tabu.cpp | UTF-8 | 12,843 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include <ctime>
#include <string>
#include <cstdlib>
#include <vector>
#include <fstream>
#include <ostream>
using namespace std;
const int MaxIter=100000;
void string2arc(const string &a,vector<int> &b,const string &delim){
string::size_type pos1=a.find(delim),pos2=a.find(delim,pos1+1);
... | true |
cdb0d27992b8de388fb0ad60af8ab17cb00bb5e6 | C++ | raginghawk/smash-up | /Smash Up PreDesign/Model/ActionCards/Pirates/PowderKegAction.cpp | UTF-8 | 809 | 2.625 | 3 | [] | no_license | #include "PowderKegAction.h"
#include <Board.h>
#include <Player.h>
#include <Base.h>
#include <MinionCard.h>
PowderKegAction::PowderKegAction(Player *owner) : ActionCard(owner)
{
this->_name = "Powderkeg";
_cardType = INSTANT_CARD;
}
void PowderKegAction::play()
{
std::vector<MinionCard *> minionOptions = vBoard-... | true |
6327a4dcb93b328aecb9a4c7930e14c54ba3c986 | C++ | Leslie-Fang/C-Solution2Leetcode | /605CanPlaceFlowers/main.cpp | UTF-8 | 1,382 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
bool canPlaceFlowers(vector<int>& flowerbed, int n) {
int res = 0;
int index = 0;
while(index < flowerbed.size())
{
if(flowerbed[index] == 0)
{
if(index+1<flowerbed.size() && index-1>=0)
... | true |
055a3b91685f1117570dbcdbfbe142eca35abb59 | C++ | tomer-shinar/advanced1-ex4 | /solvers/SearcherAdapter.cpp | UTF-8 | 1,088 | 2.890625 | 3 | [] | no_license | //
// Created by tomer on 01/02/2020.
//
#include "SearcherAdapter.h"
#include "../search/SearchableMatrix.h"
#include <sstream>
#include "../search/a_star.h"
vector<int> to_vector(string s) {
/**
* takes string and split it to vector of ints
*/
stringstream ss(s);
string token;
vector<int> values;
wh... | true |
14e03b7652006838701cf5d2fbb8f1352dd9b020 | C++ | stefanRuffler/JUCE-Drum-Sequencer | /Source Code/SequencerRow.cpp | UTF-8 | 1,804 | 2.703125 | 3 | [] | no_license | //
// SequencerRow.cpp
// JuceBasicAudio
//
// Created by Stefan Ruffler on 22/12/2016.
//
//
#include "SequencerRow.hpp"
SequencerRow::SequencerRow()
{
}
SequencerRow::~SequencerRow()
{
audioTransportSource.setSource(0);//unload the current file
deleteAndZero(currentAudioFileSource);//delete the cur... | true |
94bc1608974dcd7a8b04b10b671f269155fd06d0 | C++ | tonymontaro/leetcode-submissions | /01-July-2021/sorting-the-sentence/Accepted/5-30-2021, 6:10:43 AM/Solution.cpp | UTF-8 | 629 | 3.28125 | 3 | [] | no_license | // https://leetcode.com/problems/sorting-the-sentence
vector<string> splitWord(string &text) {
istringstream iss(text);
vector<string> results((istream_iterator<string>(iss)), istream_iterator<string>());
return results;
}
class Solution {
public:
string sortSentence(string s) {
map<int, strin... | true |
201ccda33fb97f7247ee7df41849b59eca3750cf | C++ | JesseKrepelka/CSCI-21-FALL-2015 | /pp1.cpp | UTF-8 | 10,339 | 3.484375 | 3 | [] | no_license | /*
* Programming Project 1
* Written by: Jesse Krepelka
* Unittest taken from provided file.
*
* completed on: 9/18/15
*/
#include <iostream>
#include <sstream>
#include <string>
#include <cctype>
#include <cassert>
#include <climits>
using namespace std;
/*
* counts the number of both alphabetic characters a... | true |
65e971cd227302b1687e97a7b3024c8ed2e37fe2 | C++ | babamore/olymp | /coruption.cpp | UTF-8 | 548 | 2.59375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n , i , a;
double proc , tmpa , tmpb;
vector<double> v;
cin >> n >> proc;
for (i=0; i<n; i++){
cin >> a;
v.push_back(a);
}
while (v.size()!=0){
sort(v.begin() , v.... | true |
d58b1165d1ac90ed6df9df29f170780cb66bb42f | C++ | isaveu/OpenGLRenderFramework | /Vector2.h | UTF-8 | 1,080 | 3.03125 | 3 | [
"Zlib"
] | permissive | #pragma once
#include "Helpers.h"
struct Vector2
{
public:
Vector2();
Vector2(float x, float y);
virtual ~Vector2();
bool operator==(const Vector2& v1)
{
if (x == v1.x && y == v1.y)
return true;
return false;
}
bool operator!=(const Vector2& v1)
{
if (x == v1.x && y == v1.y)
return false;
retu... | true |
adff6ba15024ee3d96c4167c5351501da923c261 | C++ | parakram10/CP_CipherSchool | /Recursion and Backtracking/SubsetSum.cpp | UTF-8 | 712 | 3.21875 | 3 | [] | no_license | // https://www.geeksforgeeks.org/subset-sum-backtracking-4/
#include<bits/stdc++.h>
using namespace std;
void subsetSum(vector<int> v, vector<string>& res, int n, int k, int i, int sum, string currVal){
if(sum == k){
res.push_back(currVal);
return;
}
if(i==n) {
return;
... | true |
b039e3331e779bc27c95cd728b969fb7c2aa2997 | C++ | Swaransh2903/Open-DSA | /Algorithms/arrays/frequency of occurence/freq.cpp | UTF-8 | 825 | 3.484375 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
//NAIVE O(n*n)
void frequency1(int arr[], int n){
for(int i=0; i<n; i++){
cout<<arr[i]<<" : ";
int count = 1;
for(int j=i+1; j<n;j++){
if(arr[j] == arr[i]){
count++;
}
}
i+=(count-1);
co... | true |
80fae29412d2dc977a091f58b034656b6d63b353 | C++ | dim49v/polarCodes | /PolarCodes/SCDecoderMinsum.cpp | UTF-8 | 2,662 | 2.71875 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <fstream>
#include <random>
#include <vector>
#include <thread>
#include <mutex>
#include <string>
#include <time.h>
#include "Resources.cpp"
namespace SCDecoderMinsum {
inline double Decodef(double r1, double r2) {
return std::min(abs(r1), abs(r2)) * (r1 * r2 < ... | true |
0ad9cb4bac0f69c3d6db8b91457d296adf30f69d | C++ | Howaner/NBTEditor | /src/NBT/NBTHelper.cpp | UTF-8 | 2,714 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | #include "NBTHelper.h"
#include "NBTTag.h"
#include <algorithm>
namespace NBT {
const NBTTag** NBTHelper::tagsByType = [] {
const NBTTag** tags = new const NBTTag*[MAX_TAG + 1];
std::fill(tags, tags + MAX_TAG, (const NBTTag*)NULL);
tags[NbtByte] = new NBTTagByte();
tags[NbtShort] = new NBTTagShort();
tags[... | true |
6e8ec0207d9f73c06601c58f86c5e7b6368c5062 | C++ | mapu/toolchains | /llvm-3.8.0-r267675/lib/Target/UCPM/MCTargetDesc/UCPMInsnLine.h | UTF-8 | 1,148 | 2.875 | 3 | [
"NCSA"
] | permissive | /* This file defines data structures for encoding/decoding UCPM instruction lines. */
#ifndef UCPM_INSN_LINE_H
#define UCPM_INSN_LINE_H
#include "llvm/Support/raw_ostream.h"
#include <stdint.h>
namespace llvm
{
namespace UCPM
{
struct EncodingLayout
{
unsigned startBit; // start bit in current byte
unsi... | true |
f19eff8de694d1797cc5ab9af4b2b05dbc2f1329 | C++ | Yanglv-rookie/paragraph | /src/c++/include/statistics/Basics.hh | UTF-8 | 5,641 | 3 | 3 | [
"Apache-2.0"
] | permissive | // -*- mode: c++; indent-tabs-mode: nil; -*-
//
// Paragraph
// Copyright (c) 2016-2019 Illumina, Inc.
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http:... | true |
62d7e80261e684640cda69207a80324e0a4e227e | C++ | danielkulakouski/watan | /subject.h | UTF-8 | 576 | 3.15625 | 3 | [] | no_license | #ifndef SUBJECT_H
#define SUBJECT_H
#include <vector>
#include <iostream>
template <typename StateType> class Observer;
template <typename StateType> class Subject {
private:
std::vector<Observer<StateType>*> observers;
public:
void attach(Observer<StateType> *o);
void notify(StateType state);
};
template... | true |
c8ee15ff1658b55d0f60097ecae0f6988e072eff | C++ | kannavue/ChartPatternRecognitionLib | /src/patternMatch/DoubleBottomPatternMatch.h | UTF-8 | 487 | 2.59375 | 3 | [
"MIT"
] | permissive | #ifndef DOUBLEBOTTOMPATTERNMATCH_H
#define DOUBLEBOTTOMPATTERNMATCH_H
#include "PatternMatch.h"
class DoubleBottomPatternMatch : public PatternMatch
{
private:
PatternMatchPtr lhsV_;
PatternMatchPtr rhsV_;
public:
DoubleBottomPatternMatch(const PatternMatchPtr &lhsV, const PatternMatchPtr &rhsV);
virt... | true |
179dd0d227c861f98ac4e1c5b9d8850d2a1805c8 | C++ | ANLAB-KAIST/NBA | /elements/standards/RandomWeightedBranch.cc | UTF-8 | 879 | 2.625 | 3 | [
"MIT"
] | permissive | #include "RandomWeightedBranch.hh"
#include <cassert>
#include <nba/core/enumerate.hh>
using namespace std;
using namespace nba;
int RandomWeightedBranch::initialize()
{
return 0;
}
int RandomWeightedBranch::configure(comp_thread_context *ctx, std::vector<std::string> &args)
{
Element::configure(ctx, args);
... | true |
93cfa9e3e65b616d77691fea4dabb5db180cd73e | C++ | qinjiajuny/preparePAT | /1032 挖掘机技术哪家强.cpp | GB18030 | 569 | 2.765625 | 3 | [] | no_license | #include<cstdio>
int main()
{
//
int N;
//ѧУ
int schID, schScore;
//洢ѧУܷͬ
int scoreSum[100000] = {0};//Ϊ10000ʾδ
scanf("%d", &N);
while (N)
{
scanf("%d%d", &schID,&schScore);
scoreSum[schID] += schScore;//ܷ
N--;
}
int k=1;
int MAX = -1;
for (int i = 0; i <= schID; i++)
{
if (scoreSum[i]>MAX){//... | true |
e9c8bb22427a6ccb8e6d73cfea66796ef31b334c | C++ | Flargy/SDL_Asteroids_Submission | /src/HighscoreSystem.h | UTF-8 | 437 | 2.625 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
class HighscoreSystem
{
public:
HighscoreSystem();
void SetScore();
void IncreaseCurrentScore(int value);
std::vector<std::string> GetHighscores();
void Reset();
int currentScore = 0;
private:
std::... | true |
b59c78fa2f119f58f39172eec0ae812e4f7ae658 | C++ | WattanaixKU/204214-problemsolving-lab | /elab2/week1/normalization.cpp | UTF-8 | 236 | 2.9375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int gcd(int a,int b)
{
if (a%b!=0)
return gcd(b,a%b);
return b;
}
int main()
{
int a,b;
cin >> a >> b;
cout << a/gcd(a,b) << "/" << b/gcd(a,b) << endl;
return 0;
} | true |
aa75ca98be3c7b10ae62d48bd0d3fc0edc5e82f5 | C++ | aurantst/windows-XP-SP1 | /XPSP1/NT/ds/ese98/src/inc/view.hxx | UTF-8 | 14,910 | 2.546875 | 3 | [] | no_license | #define JET_cbtypMax 16
/* imported dispatch-function definitions */
extern CODECONST(VTFNDEF) vtfndefVC;
extern CODECONST(VTFNDEF) vtfndefVCCallback;
extern CODECONST(VTFNDEF) vtfndefVC2;
extern CODECONST(VTFNDEF) vtfndefVC2Callback;
extern CODECONST(VTFNDEF) vtfndefVI;
extern CODECONST(VTFNDEF) vtfndefVICa... | true |
8d6e43c03b951cafda373b9fb87a5ecdfd78166b | C++ | Br0kensword/shapes-project | /RectangleJustinU.h | UTF-8 | 1,232 | 2.703125 | 3 | [] | no_license | /*
* Program Name: RectangleJustinU.h
* Written By: Justin Unverricht
* Date: 11/26/13
* Part of Project: Lab 7 Ex 1
*/
#ifndef FINALRECTANGLEJUSTINU_H
#define FINALRECTANGLEJUSTINU_H
#include "FinalFractionJustinU.h"
#include "PointJustinU.h"
#include "shapeJustinU.h"
#include <iostream>
class FinalRectangleJus... | true |
2443500b57df7d5fa03fe1b3090f541a4b60d086 | C++ | nontraditional-tech/GoFishCpp | /GameSetup.cpp | UTF-8 | 2,439 | 3.234375 | 3 | [] | no_license | #include "GameSetup.h"
GameSetup::GameSetup() {
int playerNum;
std::cout << "How many players?" << std::endl;
std::cin >> playerNum;
bool isPlayerNumValid = is_player_num_valid(playerNum);
if (isPlayerNumValid) {
std::cout << playerNum << " players selected" << '\n' << std::endl;
} else {
std::cout << "you e... | true |
bba7616534098c41b78cd1ca491cd3fdbb760531 | C++ | azureitstepkharkov/33pr11gitserver | /Exam/Работы_для_проверки/Pavlyuchenko Sergey/pavlyuchenko.exam_13_09_19/Pavlyuchenko.Exam/Department.cpp | WINDOWS-1251 | 1,967 | 3.6875 | 4 | [] | no_license | // Department
#include "Department.h"
//
Department::Department() {
this->departmentName = "";
this->bossName = "";
}
//
Department::Department(string departmentName, std::list<Employee> employees, string bossName) :
departmentName(departmentName), employees(employees), bossName(bossName) {
}
//
De... | true |
35ee7a0ad1050d8833dc3da74de1994174054bf8 | C++ | aladine/awesome-leetcode | /cpp/algoexpert/10-jul.cpp | UTF-8 | 3,764 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<string> vs;
#define len(container) int((container).size())
#define all(c) (c).begin(), (c).end()
const int M = 1e9 + 7;
template <typename ITER>
void show(ITER begin, ITER end) ... | true |
10b31248d629d42020bb7d47654184e0e6c5f068 | C++ | dldlowndes/LD_QuarcTracker | /src/LD_Camera.cpp | UTF-8 | 14,338 | 2.5625 | 3 | [] | no_license | #include <fstream>
#include <iostream>
#include "LD_Camera.h"
namespace LD_Camera{
int FindCameras(){
int num_Cameras = 0;
is_GetNumberOfCameras(&num_Cameras);
std::cout << num_Cameras << " cameras found" << "\n";
// From the API manual docs for function is_GetCameraList()
... | true |
a954d693e4ea1f6c2411b3b6d6075ebc5b8a7be9 | C++ | adnammit/sandbox | /bst/main.cpp | UTF-8 | 874 | 3 | 3 | [] | no_license | #include "table.h"
using namespace std;
int main() {
table BST;
// BUILD OUR TABLE:
BST.insert(52);
BST.insert(26);
BST.insert(78);
BST.insert(12);
BST.insert(47);
BST.insert(68);
BST.insert(84);
BST.insert(8);
BST.insert(20);
BST.insert(56);
BST.insert(70);
BST.insert(81);
BST.insert(99... | true |
e9bd274f34aa32d7be6872d71ab681d08b52d541 | C++ | shamiul94/Problem-Solving-Online-Judges | /LeetCode/1. Two Sum.cpp | UTF-8 | 633 | 2.890625 | 3 | [
"MIT"
] | permissive | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> twoSum(vector<int> &nums, int target) {
unordered_map<int, int> um;
vector<int> v;
for (int i = 0; i < nums.size(); i++) {
um[nums[i]] = i;
}
for (int i = 0; i < nums.size(); i++)... | true |
02cb11961ba1679b7272bd0e58be57309b5d8b92 | C++ | wannaBpark/BOJ | /10845.cpp | UTF-8 | 658 | 2.546875 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <queue>
#include <string>
using namespace std;
queue<int> q;
int N, input;
string s;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> N;
while (N--) {
cin >> s;
if (s=="push") {
cin>>input;
q.push(input);
}
else if (s=="front") printf(... | true |
5878891f280c521eb8069157083b5008021411a9 | C++ | dheerajsharma0401/GeeksForGeeks-Solutions | /Greedy/Minimum Platforms.cpp | UTF-8 | 520 | 2.75 | 3 | [] | no_license | class Solution{
public:
//Function to find the minimum number of platforms required at the
//railway station such that no train waits.
int findPlatform(int arr[], int dep[], int n)
{
// Your code here
sort(arr,arr+n);
sort(dep,dep+n);
int count=0;
int j=0;
fo... | true |
bc56f39a561ed521757cf503cbf4866083315e07 | C++ | liubincodelife/opencv3_sketchs | /chapter6_imgproc_imageprocess/src/imgproc_functionality_imageprocess.cpp | UTF-8 | 16,361 | 2.75 | 3 | [] | no_license | #include "imgproc_functionality_imageprocess.h"
Mat g_filterSrcImage, g_morphologySrcImage;
int g_nBoxFilterKernelSize = 6;
int g_nMeanBlurFilterKernelSize = 6;
int g_nGaussianBlurFilterKernelSize = 6;
int g_nMedianBlurFilterKernelSize = 6;
int g_nBilateralFilterKernelSize = 6;
int g_nDilateKernelSize = 1;
int g_nEro... | true |
7e683dee146ddc316098436de91d0d17435fe599 | C++ | FFFFFUNKYMUZIK/alg_practice | /Leetcode/91/91/91.cpp | UTF-8 | 795 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
using namespace std;
//fibonacci w/ special case('1' & '2')
class Solution {
public:
int numDecodings(string s) {
int n = s.length();
vector<int> noc(n+1, 0);
noc[0] = noc[1] = 1;
if (s[0] == '0') return 0;
for (i... | true |
31cd24ad40713d1d0a6e168c549a6b8640767297 | C++ | Kbzinho-66/Analise-Covid | /Trabalho_I_CPP/Registry.hpp | UTF-8 | 1,650 | 3.40625 | 3 | [] | no_license | #include <string>
#include <iostream>
class Registry
{
private:
char patient_sex;
int patient_code;
int patient_age;
int category_code;
std::string patient_b_day;
std::string vaccination_city;
std::string category_name;
public:
Registry(int patient_code,
int patient_age,
... | true |
f529ad0b2059e5b6c54f977195dcef4c9bfa992f | C++ | rajul/UVa | /11933/splitting.cpp | UTF-8 | 678 | 3.4375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int one_positions[40];
int t, index;
int calculate_a()
{
int res = 0, i;
for(i=0; i<index; i=i+2)
{
res = res | (1 << one_positions[i]);
}
return res;
}
int calculate_b()
{
int res = 0, i;
for(i=1; i<index; i=i+2)
{
res = res | (1 << one_positions[i]);
}
r... | true |
669501aa1f3a0fa131acd2eb1cabed5193efbe89 | C++ | JiangSir857/C-Plus-Plus-1 | /Object Oriented Programming(C++)/模仿练习参考代码/chapter5/ex3.cpp | GB18030 | 790 | 3.671875 | 4 | [] | no_license | /*
1. һƽɼĺNѧijɼú
2. ʹַΪβΣдַƺ
*/
#include "iostream.h"
float fnAve(int *arry,int n);
void MyCopy(char *object,char *source);
void main()
{
int a[]={13,56,66,90,65,78};
char b[80];
float fAve;
fAve = fnAve(a,6);
cout<<"ƽɼ="<<fAve<<endl;
MyCopy(b,"how are you");
cout<<b<<endl;
}
//ƽɼĺ
float fnAve... | true |
18bdc971b11490f79d7f4eb0ca7074403a211b6c | C++ | angelgomezsa/Cplusplus | /Examens/Entrenament Control 3/ex4.cc | UTF-8 | 521 | 3.171875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
using namespace std;
bool found(int x, const vector<int>& v, int left, int right) {
while (left <= right) {
int i = (left+right)/2;
if (x > v[i]) left = left+1;
else if ( x < v[i]) right = right-1;
else return true;
}
return false;
}
int main() {
int n;
cin >> n;
ve... | true |
0589786b50869f079bb0e7129756ce4c8c150244 | C++ | flylofty/coding_test | /programmers200721-02.cpp | UTF-8 | 430 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
using namespace std;
//프로그래머스 연습문제 가운데 글자 가져오기.
string solution(string s) {
string answer = "";
int size = s.size();
if (s.size() % 2 == 0) {
answer += s[s.size() / 2 - 1];
}
answer += s[s.size() / 2];
return answer;
}
int main() {
/*string s = "abc... | true |
d4594bab13e5fbdf35e06f76d5520b450c43ac07 | C++ | Twisterok/NovaCardTestTask | /MyDate.cpp | UTF-8 | 1,023 | 3.5 | 4 | [] | no_license | #include "MyDate.h"
//CONSTRUCTORS
MyDate::MyDate()
{
this->year = 0;
this->month = 0;
this->day = 1;
}
MyDate::MyDate(int _year,int _month,int _day)
{
this->year = _year;
this->month = _month;
this->day = _day;
}
MyDate::MyDate(tm _time)
{
this->year = _time.tm_year;
this->month = _time.tm_mon;
this->day =... | true |
442c570a487e65cb99afdc541a1cb13351fb2327 | C++ | dikshajain228/ADA-Lab | /randomnobinary search.cpp | UTF-8 | 345 | 2.703125 | 3 | [] | no_license | #include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
int i,j,max,n;
cout<<"Enter the size:";
cin>>n;
int a[n];
for(i=0;i<n;i++)
a[i]=rand();
for(i=0;i<n;i++)
{
for(j=0;j<n-i-1;j++)
{
if(a[j]>a[j+1])
{
int temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
for(i=0;i<n... | true |
fa0d409341ea5677c73c9e298d528f6edba3ba8d | C++ | feixuedudu/network | /protocol/contentprotocol.h | UTF-8 | 1,704 | 2.65625 | 3 | [] | no_license | /************************************************************************/
/*
具有一个完整package的protocol
此成会维护对应的contentpackage.同提供给上层应用层的接口;
主要是上层协议XXXXProtocol利用Protocol.Send()写入到CContentProtocol层。
CContentProtocol.Push()会写入到CChannelProtocol
进行缓存,或者直接发送。
见contentprotocol的send与push的描述
/*******************************... | true |
73b2ee871f5573d80e9153e6cb4789a9a85258a1 | C++ | cyssure/miniRSA | /encryptiontest.cpp | UTF-8 | 2,217 | 3.1875 | 3 | [] | no_license | /**
*This program test the process of encryption
*/
#include "miniRSA.h"
#include "Encryption.h"
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char** argv) {
cout << "Enter the nth prime and the mth prime to compute" << endl;
... | true |
033fae4923953c654500cb5f329f8ea956eec799 | C++ | yoyonel/holyspirit-softshadow2d | /src/Light.h | UTF-8 | 2,943 | 3.125 | 3 | [] | no_license | #ifndef LIGHTH
#define LIGHTH
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
struct Wall
{
Wall (sf::Vector2f p1,sf::Vector2f p2)
{
pt1=p1;
pt2=p2;
}
// Pt1 et Pt2 sont les deux extremites du mur
sf::Vector2f pt1;
sf::Vector... | true |
2f1191ceb1e27c653f860b0fb796075a6d0cac60 | C++ | HrishikeshP-01/Beginning-Cpp-Game-Programming | /GameOver2.cpp | UTF-8 | 134 | 2.828125 | 3 | [] | no_license | #include <iostream>
// Employing a using directive
using namespace std;
int main() {
cout << "Game Over!" << endl;
return 0;
} | true |
b44a44611eca47f9c36960154b3f6f81bcb5849c | C++ | nobled/clang | /test/CodeGenCXX/const-init-cxx11.cpp | UTF-8 | 7,718 | 2.59375 | 3 | [
"NCSA"
] | permissive | // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin -emit-llvm -o - %s -std=c++11 | FileCheck %s
// FIXME: The padding in all these objects should be zero-initialized.
namespace StructUnion {
struct A {
int n;
double d;
union U {
constexpr U(int x) : x(x) {}
constexpr U(const char *y) : y(... | true |
0e03cb9c555d6a734e01be3acecfc801c51ffee6 | C++ | DataYI/cplusplus | /CppSTL/algorithm/nth_element.cpp | UTF-8 | 355 | 3.0625 | 3 | [
"AFL-2.0"
] | permissive | #include<bits/stdc++.h>
using namespace std;
int main() {
vector<int> v{1, 3, 4, 5, 2, 6, 8, 7, 9};
for_each(v.begin(), v.end(), [](int x) {
cout << x << " ";
});
cout << endl;
nth_element(v.begin(), v.begin() + 5, v.end());
copy(v.begin(), v.end(), ostream_iterator<int>(cout, " "));... | true |
3bf5790cd943cd0f8e2e44bc5587dc9e2c26588c | C++ | garyuppal/OldMicrobeSimulator | /common/bacteria/fitness.h | UTF-8 | 909 | 2.625 | 3 | [] | no_license | #ifndef MICROBE_SIMULATOR_FITNESS_H
#define MICROBE_SIMULATOR_FITNESS_H
#include <deal.II/base/point.h>
using dealii::Point;
#include <array>
// #include "../utility/argparser.h"
// #include "../chemicals/chemicals.h"
namespace MicrobeSimulator{
template<int dim, int NumberChemicals>
class FitnessBase{
public:... | true |