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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
492414f52b1f41783ff0bfd462cd79cd128cff0d | C++ | cde8eae8/ITMO-s5 | /machine-learning/codeforces/linear-regression/linear-regression.cpp | UTF-8 | 12,195 | 2.546875 | 3 | [] | no_license | //
// Created by nikita on 9/29/20.
//
#include <numeric>
#include <cmath>
#include <queue>
#include <cassert>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <iostream>
#include <algorithm>
#ifdef LOCAL
#include "../debug.h"
#endif
#define NORMALIZE
double sign(double v) {
return v < 0 ?... | true |
6b78170b1ea08ca25adf60a81c8e2fb608b0bd40 | C++ | rvthak/OOP_Assignments_3rd_Semester | /2_forum++/thread.cpp | UTF-8 | 2,178 | 3.234375 | 3 | [] | no_license | #include <iostream>
#include "namespace.h"
#include "thread.h"
#include "random.h"
using namespace std;
Thread::Thread(const string sb, const string cr, Date& dt)
:subject(sb), creator(cr), creation_date(dt){
postnum=0;
// basic setup done
// add some posts
Post tmp;
for(int i=0; i<Values::Numbe... | true |
63b7765ec2e8b5ea5b7e11672316cdcef2e551e0 | C++ | Cmdeew/r-type | /serveur/inc/UMonsterOne.h | UTF-8 | 314 | 2.5625 | 3 | [] | no_license | #ifndef _MONSTERONE_H_
# define _MONSTERONE_H_
#include "../Object.h"
class MonsterOne : public Object
{
public:
MonsterOne(char id, char x, char y, char type = 11);
void move();
~MonsterOne();
char getType();
};
typedef MonsterOne *(*maker_monster)(char id, char x, char y);
#endif // _MONSTERONE_H_
| true |
aeeae321cbb4546f7f041866a3c36bb971a8c403 | C++ | TeodorDimitrovGH/SmartApplication | /HashTable.cpp | UTF-8 | 2,890 | 3.765625 | 4 | [] | no_license | #include "HashTable.h"
HashTable::HashTable()
{
for(int i = 0; i < tableSize; i++){
hashTable[i] = new item;
hashTable[i]->name = "empty";
hashTable[i]->drink = "empty";
hashTable[i]->next = NULL;
}
}
int HashTable::hashFunction(string key){
int hashValue = 0;
... | true |
6477be6dd475af8bc889597989f2781206215f7e | C++ | erachelson/hanabi-ai | /simulator/hanabi_game.hpp | UTF-8 | 6,290 | 3.46875 | 3 | [] | no_license | #ifndef HANABI_GAME_HPP_
#define HANABI_GAME_HPP_
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <iostream>
enum color_t {red, green, blue, white, yellow, null};
struct card{
color_t color;
int value;
card() : color(null), value(0) {}
card(color_t c, int v)... | true |
9b98ef4c47ade0253fd3c2502e54c87d8553fa92 | C++ | kazma89/Arduino | /Angie/boton/boton.ino | UTF-8 | 290 | 2.6875 | 3 | [] | no_license |
void setup() {
// put your setup code here, to run once:
pinMode(12,OUTPUT);
pinMode(2,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int estado = digitalRead(2);
if(estado==LOW){
digitalWrite(12,HIGH);
}
else{
digitalWrite(12,LOW);
}
}
| true |
2beafef2d4b7fbd4b395de40b0dd6cbec62f2a68 | C++ | yujunsen/qt_study | /qt_create_03_03_5_0/widget.cpp | UTF-8 | 1,715 | 3.28125 | 3 | [] | no_license | #include "widget.h"
#include "ui_widget.h"
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
}
Widget::~Widget()
{
delete ui;
}
/*
* 先看两个Scroll Bar的属性:
* maximum属性用来设置最大值,minimum属性用来设置最小值;
* singleStep属性是每步的步长,默认是1,就是按下方向键后其数值增加或者减少1;
* pageStep是每页的步长,默... | true |
9dc335b5dd15e21f7516183b73e1e4d718052bbc | C++ | Fu-Qingchen/LearnCS | /LearnCPP/temp.cpp | UTF-8 | 1,323 | 3.53125 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=705 lang=cpp
*
* [705] 设计哈希集合
*/
// @lc code=start
#include<array>
using namespace std;
class MyHashSet {
public:
/** Initialize your data structure here. */
MyHashSet() { for (auto &i : datas) { i = -1; } }
void add(int key) { datas.at(search(key)) = key; }
vo... | true |
bad12dedcf3d3a6207008edc6a9662eb7af97ca3 | C++ | bitspill/node-multi-hashing | /axh.cc | UTF-8 | 2,027 | 2.578125 | 3 | [] | no_license | #include "axh.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <vector>
#include "uint256.h"
#include "sha3/sph_shabal.h"
void axh_hash(const char* input, char* output, uint32_t len)
{
// Axiom Proof of Work Hash
// based on RandMemoHash https://bitslog.files.wordpress... | true |
adf6f2bcc44981f017a286f1a78f872dd4741c8f | C++ | Sage-Bionetworks/bfrm | /src/bfrm21/util.cpp | UTF-8 | 6,684 | 2.71875 | 3 | [] | no_license | // util.cpp: implementation of the util class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "util.h"
#include <math.h>
#pragma warning(disable : 4996)
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
/... | true |
6b1f972537571e61736e3cf8cbdfb73589cf27e9 | C++ | feng1008/leetcode | /Plus one.cpp | UTF-8 | 427 | 3.21875 | 3 | [] | no_license | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
vector<int> plusOne(vector<int> &digits){
int one=1;
vector<int> temp;
for(int i=digits.size()-1;i>=0;i--){
int t=digits[i]+one;
temp.push_back(t%10);
one=t/10;
}
if(one!=0){
temp.push_back(one);
}
for(int i=0;i<temp.size()/2;... | true |
30e87127b2b2b36076558d2ae045f25e225df2f9 | C++ | null32/sem3prog2017 | /p.cpp | UTF-8 | 1,390 | 2.59375 | 3 | [] | no_license | #include <cstdio>
#include <algorithm>
#include <functional>
#include <climits>
#include <memory.h>
#include <malloc.h>
typedef long long ll;
using namespace std;
void solve()
{
int sz;
scanf("%d", &sz);
sz++;
auto dims = new ll[sz];
for (int i = 0; i < sz; i++)
scanf("%lld", &dims[i]);
auto seqCost = new l... | true |
ef5c14f4c3043c906e8907066b2e4007a3b4718c | C++ | samueldonner/CS32Project2 | /Map.cpp | UTF-8 | 7,174 | 3.671875 | 4 | [] | no_license |
#include <iostream>
#include "Map.h"
using namespace std;
void Map::dump() const
{
Node *p = head;
while(p != nullptr)
{
cerr << "Name: " << p->key << "| Value: " << p->value << endl;
p = p->next;
}
} //print Map
bool combine(const Map& m1, const Map& m2, Map& result)
{
Ke... | true |
8764a0c7c0e27cdde70598060c308ef4e50f6d5e | C++ | MorleyDev/UnitTest11 | /UnitTest11/Will/Throw.hpp | UTF-8 | 2,720 | 3.359375 | 3 | [
"MIT"
] | permissive | #ifndef UNITTEST11_WILL_THROW_HPP
#define UNITTEST11_WILL_THROW_HPP
#include "../detail/BaseOperand.hpp"
#include <exception>
#include <string>
#include <sstream>
#include <functional>
namespace ut11
{
namespace Operands
{
template<typename Exception> struct WillThrow : public detail::BaseOperand <... | true |
bb10796751f258d1c37e6c05c7e9f91b1909f8bd | C++ | Sukora-Stas/Cpp-task-for-the-university-study | /poiskk.cpp | WINDOWS-1251 | 7,700 | 2.875 | 3 | [] | no_license | #include "poiskk.h"
#include "kursach.cpp"
#include <string>
//;_CRT_SECURE_NO_WARNINGS
void poiskk()
{
string value;
cout << "|______________________________________________________________________________|\n" << endl;
printf("%-1c%-1c%-4s%-74s%-1c", '\n', '|', "", " ?", '|');
printf("%-1c%-1c%-4s%-74s%-1c",... | true |
2fbbe78a8c68748647fdc410c9370fd6b6ff333f | C++ | MrOctopus/misc-projects | /c++/vtablefun.cpp | UTF-8 | 1,322 | 3.71875 | 4 | [] | no_license | /*-------------------------------------------------------
@author NeverLost
Virtual table fun.
Let's call VirtualTableHack::Print() directly from the vtable.
---------------------------------------------------------*/
#include <iostream>
#include <cstdint>
using std::cout;
using std::endl;
using std::uintptr_t;
... | true |
d5decd96351998618180c3b8bf5daacb6b3b22fd | C++ | proxict/cpplibcrypto | /lib/include/cpplibcrypto/cipher/CbcMode.h | UTF-8 | 2,023 | 2.8125 | 3 | [
"BSD-3-Clause"
] | permissive | #ifndef CPPLIBCRYPTO_CIPHER_CBCMODE_H_
#define CPPLIBCRYPTO_CIPHER_CBCMODE_H_
#include "cpplibcrypto/buffer/BufferSlice.h"
#include "cpplibcrypto/buffer/DynamicBuffer.h"
#include "cpplibcrypto/cipher/CbcDecrypt.h"
#include "cpplibcrypto/cipher/CbcEncrypt.h"
#include "cpplibcrypto/common/Key.h"
namespace crypto {
///... | true |
6789bd0f85ddcf557227f9236299aac4dc47bfe5 | C++ | DivanshiGupta/DataStructuresAndAlgorithms | /strongly_connected_components.cpp | UTF-8 | 2,622 | 2.546875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int v, E, cur;
vector<vector<int>> g;
vector<vector<int>> h;
int no;
stack<int> s;
stack<int> s1;
vector<int> vis(300000, 0);
vector<int> ans(300000, 0);
int count1;
int dfs()
{
int p = cur;
if (no == 0)
{
for (int j = 0; j < g[cur].size(); j++)
... | true |
956f86ba27f1bd36c9153a4bee6b755d4241dbb3 | C++ | albertomila/continous-formation | /MoreIdioms/MoreIdioms/samples/MI27_EraseRemove.h | UTF-8 | 967 | 2.9375 | 3 | [] | no_license | #pragma once
#include "stdafx.h"
namespace nsEraseRemove
{
class CTest
{
public:
CTest()
: m_x( 10 )
{
}
~CTest()
{
m_x = 0;
}
int GetValue() const{ return m_x; }
private:
int m_x;
};
bool RemovePredicate ( const CTest& value )
{
return value.GetValue() == 10;
}
}
BEGIN_TEST(Erase... | true |
997679597ab275162741e42919af24fe1ec71cc1 | C++ | PulakMajumdar81/Daily-DSA-prep | /topKFreqWords.cpp | UTF-8 | 1,698 | 3.296875 | 3 | [] | no_license | #include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
class Solution
{
public:
struct Compare
{
bool operator()(pair<int, string> &p1, pair<int, string> &p2)
{
int p1Count = p1.first;
string p1Word = p1.second;
int p2Count = p2.first;
... | true |
4322a24ee9adad416f9cccd8e6d53d7637bed11c | C++ | hsmtknj/coding-interview | /5. Miscellaneous Coding Interview Questions/q5-1.cpp | UTF-8 | 1,409 | 3.9375 | 4 | [
"MIT"
] | permissive | /**
* [Question]
* - Bucket Sort (Bin sort) のアルゴリズムを実装するにはどうすればよいですか?
*
* [Solution]
* - バケット配列を用意する
* - データを対応するバケットに入れる
* - バケットから順に取り出す
*
* <計算量>
* - O(n + A)
* <特徴>
* - 小さい値までのソートならめちゃめちゃ速い
* - 重複に対応していない
*
* [Reference]
* - <https://www.codereading.com/algo_and_ds/algo/bucket_sort.html>
* - <ht... | true |
60ba086dca27cce34cba0db0219c91bba7e5b6f9 | C++ | git-vivek29/Data-Structure-And-Algorithm | /SourceCode/BitManipulation/Power2.cpp | UTF-8 | 230 | 3.09375 | 3 | [
"MIT"
] | permissive | /*
Problem Statement: Write a program to check if a given number is power of 2
*/
#include<iostream>
using namespace std;
bool isPower2(int n)
{
return (n && !(n & n-1));
}
int main()
{
cout<<isPower2(128);
return 0;
} | true |
ae74b891d3fe8519d1c4f8c73a7d144956be9e82 | C++ | kch1285/Algorithms | /SWEA/D3/SWEA10200.cpp | UTF-8 | 360 | 2.578125 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(int argc, char** argv)
{
int test_case;
int T, n, a, b;
cin>>T;
for(test_case = 1; test_case <= T; ++test_case)
{
cin >> n >> a >> b;
cout << "#" << test_case << ' ' << min(a, b) << ' ';
if(a + b - n > 0) cout << a + b - n << '\n';
... | true |
80c670060b5425e94f75b7e30fad106c5c683fbe | C++ | SeanStarkey/torrent-file-reader | /Element.h | UTF-8 | 553 | 2.609375 | 3 | [] | no_license |
#ifndef ELEMENT_H
#define ELEMENT_H
#include <boost/shared_ptr.hpp>
namespace Bencoding
{
enum Type
{
DICTIONARY,
LIST,
INTEGER,
STRING
};
class Element
{
public:
static boost::shared_ptr<Element> factory(const char* const buffer, unsigned& offset);
... | true |
53bc1a0362721c7ecff2ff935f97f90be8bb5cca | C++ | gbyy422990/Leetcode_cpp | /code/1.Two Sum.cpp | UTF-8 | 1,380 | 3.65625 | 4 | [] | no_license | /* 使用一个HashMap,来建立数字和其坐标位置之间的映射,我们都知道HashMap是常数级的查找效率,这样,我们在遍历数组的时候,
用target减去遍历到的数字,就是另一个需要的数字了 */
# 方法一
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
# 定义一个哈希表
unordered_map<int, int> indies;
# 遍历一下整个数组,然后存到哈希表里,哈希表的key为nums, value为其索引
for (int i=0;i... | true |
71024a0bf98fe1819f25cf71925955564f133401 | C++ | WebAssembly/binaryen | /src/ir/match.h | UTF-8 | 33,461 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2020 WebAssembly Community Group participants
*
* 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://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by... | true |
d1f8fe5cab7ae62ee7c521977b8ec6955b3ff763 | C++ | yangguodang0502/LeetCodeWithCpp | /labuladong/188/maxProfit.h | UTF-8 | 1,087 | 3.015625 | 3 | [] | no_license | #include <vector>
#include <limits.h>
using namespace std;
class Solution {
public:
int maxProfit(int k, vector<int>& prices) {
int n = prices.size();
if (k > n / 2) {
return maxProfit_infinity(prices);
}
int dp[n][k+1][2];
for (int i = 0; i < n; i++) {
... | true |
c30ca44d0aa9a301938c3f18930bbd97e59e04e0 | C++ | Bao-T/CS-172 | /HW05/11_13/11_13/Course.cpp | UTF-8 | 2,117 | 3.859375 | 4 | [] | no_license | #include <iostream>
#include "Class.h"
using namespace std;
Course::Course(const string& courseName, int capacity)
{
numberOfStudents = 0;
this->courseName = courseName;
this->capacity = capacity;
students = new string[capacity];
}
Course::~Course()
{
delete[] students;
}
string Course::getCourseName() const
{
re... | true |
d56f9beb0d6a28336dd7b24a29a8d065eaf0d168 | C++ | GuillaumeDua/GCL_CPP | /includes/gcl/io/policy.hpp | UTF-8 | 5,964 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <gcl/container/concepts.hpp>
#include <gcl/io/concepts.hpp>
#include <gcl/mp/concepts.hpp>
#include <gcl/concepts.hpp>
#include <concepts>
#include <utility>
#include <type_traits>
#include <iostream>
namespace gcl::io::policy
{
template <typename policy_impl>
struct crtp... | true |
18e63c72d50b0bd880be8b5d4236d0b3df7d131a | C++ | fianchi04/blockworld | /src/GameWorld.cc | UTF-8 | 7,333 | 2.8125 | 3 | [
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | permissive | #include "GameWorld.h"
/**
* Create cube and diamond assets and assign location and color
**/
GameWorld::GameWorld (ApplicationMode mode) {
srand(time(NULL));
asset_manager = std::make_shared<GameAssetManager>(mode);
//generate floor
asset_manager->AddAsset(std::make_shared<FloorAsset>(glm::vec3(10.0, ... | true |
99100ac83fb231dcad8473cee4945f3a1b09af0e | C++ | raxracks/chadOS | /userspace/libraries/libfilepicker/model/FilesystemModel.cpp | UTF-8 | 3,871 | 2.859375 | 3 | [
"MIT",
"BSD-2-Clause"
] | permissive | #include <string.h>
#include <libfilepicker/model/FilesystemModel.h>
#include <libio/File.h>
#include <libio/Format.h>
#include <libjson/Json.h>
namespace FilePicker
{
static auto get_icon_for_node(String current_directory, IO::Directory::Entry &entry)
{
if (entry.stat.type == HJ_FILE_TYPE_DIRECTORY)
{
... | true |
e27a1e177bb96b4c1ea7704d674d9b2b8b600407 | C++ | Nada-ibrahim/Paint-Windows-API | /Filling.cpp | UTF-8 | 1,397 | 2.890625 | 3 | [] | no_license | //
// Created by hp on 4/10/2018.
//
#include "Filling.h"
#include "MyPoint.h"
#include <stack>
using namespace std;
void Filling::fillSeed(HDC hdc) {
stack<MyPoint> points;
points.push(MyPoint(xc,yc));
while(!points.empty()){
MyPoint p = points.top();
points.pop();
C... | true |
a0c26e161a41afaae7bd9b55efb868ceb67558ac | C++ | ekandemir/CourseStudies | /BLG 233-Data Structures/Homeworks/HW1/main.cpp | UTF-8 | 820 | 2.5625 | 3 | [] | no_license | //
// main.cpp
// DataStrHomework1
//
// Created by Developing on 3.10.2017.
// Copyright © 2017 erdinckandemir. All rights reserved.
//
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
int main(int argc, const char * argv[]) {
//memory allocation for puzzle array
... | true |
311f667c7e5aaefc17a45184e4ec2afad807be5d | C++ | sccData/Data-structure-and-algorithm_self | /排序/快速排序/main.cpp | UTF-8 | 721 | 3.203125 | 3 | [
"MIT"
] | permissive | #include <iostream>
using namespace std;
int partition(int a[], int p, int r)
{
int plot = a[r];
int i = p;
int temp = 0;
for(int j=p; j<r; ++j) {
if (a[j] < plot) {
temp = a[i];
a[i] = a[j];
a[j] = temp;
++i;
}
}
a[r] = a[i];
... | true |
6e77962d06aac16061c5f3333dfc1738b93ed12c | C++ | lionkor/Volty | /include/Core/Application.h | UTF-8 | 1,703 | 2.625 | 3 | [
"MIT"
] | permissive | #ifndef APPLICATION_H
#define APPLICATION_H
#include <thread>
#include "GameWindow.h"
#include "Object.h"
#include "Rendering/GuiElement.h"
#include "Utils/DebugTools.h"
#include "Utils/Managed.h"
#include "Utils/Mutexed.h"
#include "Utils/ResourceManager.h"
#include "World.h"
namespace V {
class Application : pub... | true |
664f34e6eaa532fb7b52b39cb2058b46653beda7 | C++ | mt1ger/LPS_SEG_SimSDM-EON | /ModulationFormats.cpp | UTF-8 | 7,079 | 2.578125 | 3 | [] | no_license | #include "ModulationFormats.h"
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
/****************************************
* Options for Super Channels: 25 50 100 200 400
* Options for Modulation Formats:
* QPSK, 16QAM, 64QAM
****************************************/
unsigned int
Mo... | true |
8f1a9a1cd550db20e7cb412ba0fd06712ceea66d | C++ | shaocongliang/recipes | /thread/Mutex.h | UTF-8 | 532 | 2.59375 | 3 | [] | no_license | #include <pthread.h>
namespace liangsc{
class MutexLock{
public:
MutexLock():
lock_(PTHREAD_MUTEX_INITIALIZER){
}
void lock(){
pthread_mutex_lock(&lock_);
}
void unlock(){
pthread_mutex_unlock(&lock_);
}
~MutexLock(){ }
private:
pthread_mutex_t lock_;
};
class MutexLockGuard{
public:
M... | true |
d88255b7ee1ed0c36b608d6426615158bf8c2ab4 | C++ | chenghehe/C-Study | /04/03const修饰成员函数.cpp | GB18030 | 1,035 | 3.359375 | 3 | [] | no_license | //#include<iostream>
//
//using namespace std;
//
//
//class Person
//{
//public:
//
// //this ָ뱾 ָ볣 ָָDzĵ
// //const Person * const this
// //
// void showPerson() const {
// //this->m_A = 100; //
//
// this->m_B = 200; //
//
// //this = NULL; //thisָ벻ָָ
// }
//
// void func() {
// //m_A = 100;
// }
//
// int m... | true |
74ea88a4148eea8f886ce99d72bbb71d6e8c3737 | C++ | profeIMA/Exercicis-Programacio | /ExercicisT7/T7-EX1_1-assignaVector.cpp | UTF-8 | 1,003 | 3.90625 | 4 | [] | no_license | /*
1.1. Assignar a un vector d'n elements els successius nombres naturals (0, 1, 2, 3, ...). Retocar l'algorisme per tal que assigni els successius nombres naturals parells (0, 2, 4, 6, ...).
*/
#include <iostream>
using namespace std;
const unsigned N_MAX=100;
typedef int Vector_enter[N_MAX];
void assignar_vecto... | true |
0c687c9c0093bb82c19782caa06d40f67d1b525d | C++ | rubu/AIEEE2015 | /Shared/InputFileLoader.hpp | UTF-8 | 1,779 | 2.9375 | 3 | [] | no_license | #pragma once
#include <memory>
#include <stdexcept>
#include <string>
#include <vector>
#include <Windows.h>
#include <sys/stat.h>
#include <sys/types.h>
class CInputFileLoader
{
public:
CInputFileLoader(const char* pInputFilename, unsigned int nWidth, unsigned int nHeight)
{
struct _stat64 FileStatistics;
if ... | true |
504cf3d4f71f5895db81fca17fedfd2fb19af606 | C++ | uwejanssen19/esp8266 | /GxEPD2_files/GxEPD2_MinimumExample/GxEPD2_MinimumExample.ino | UTF-8 | 1,367 | 2.578125 | 3 | [] | no_license | // GxEPD2_MinimumExample.ino by Jean-Marc Zingg
// purpose is e.g. to determine minimum code and ram use by this library
// see GxEPD2_wiring_examples.h of GxEPD2_Example for wiring suggestions and examples
// if you use a different wiring, you need to adapt the constructor parameters!
// uncomment next line to use ... | true |
baa17ccbd8504af9116e58dc8fa489185871f0de | C++ | tejasMadrewar/CPP_notes | /4_class_objects/ex_func_friendly_to_two_classes.cpp | UTF-8 | 605 | 3.796875 | 4 | [] | no_license | #include <iostream>
#include <cstring>
using namespace std;
class ABC; // forward declaration
class XYZ{
int x;
public:
void setvalue(int i){x = i;}
friend void max(XYZ,ABC); // friend function is declare
};
class ABC{
int a;
public:
void setvalue(int i){a = i;}
friend void max(XYZ,ABC); // friend... | true |
f84343251a4c86ac5f716515f36385b2b5198283 | C++ | ibetovski/learning-cplusplus | /src/0012-03-initialization-list.cpp | UTF-8 | 826 | 3.625 | 4 | [] | no_license | // Using Initialization list for setting class private property
#include <iostream>
using namespace std;
class Foo {
public:
// this is the same as: Foo() { _blah = "dodo"; }
Foo(): _blah("dodo") {}
void getBlah();
private:
std::string _blah;
};
void Foo::getBlah() {
cout << _blah;
}
// for more fields:
c... | true |
5a6bc7b4281644498bf9144c1f8c758367b412c7 | C++ | zlatkos94/adr-seminarski | /Caja/Caja/Source.cpp | WINDOWS-1250 | 2,694 | 2.984375 | 3 | [] | no_license | #include <complex>
#include <iostream>
#include <valarray>
#include<time.h>
#include<thread>
#include "../mjerenje.h"
#include "../loading.h"
using namespace std;
double PI = 3.141592653589793238460;
const int num_threads = 4;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
int ... | true |
e32fa5e95c634e8b8affe68ffc1fcfdf5030628e | C++ | iesahin/TurkishMorphologicalAnalysis-CPP | /FsmMorphologicalAnalyzer.cpp | UTF-8 | 56,466 | 3.03125 | 3 | [] | no_license | //
// Created by Olcay Taner Yıldız on 2.03.2019.
//
#include <regex>
#include <iostream>
#include "FsmMorphologicalAnalyzer.h"
/**
* Another constructor of FsmMorphologicalAnalyzer class. It generates a new TxtDictionary type dictionary from
* given input dictionary, with given inputs fileName and cacheSize.
*
* ... | true |
8b1a3bbb10840b83c156537f8787b1759dcd46c8 | C++ | yhf869252662/LearningQuestionBank | /test_2_28/test_3_11.cpp | UTF-8 | 1,233 | 3.46875 | 3 | [] | no_license | //#include <iostream>
//
//using namespace std;
//
//int Fibonacci[30] = { 0 };
//
//int Fibo(int n)
//{
// int n1 = 1;
// int n2 = 1;
// int n3 = 1;
//
// for (int i = 2; i <= n; i++)
// {
// n3 = n2 + n1;
// n1 = n2;
// n2 = n3;
// }
//
// return n3;
//}
//
//void makeFibo()
//{
// for (int i = 0; i < 30; i++)
// ... | true |
2046657a92e9baea71c991ac41be3df6079f2a8f | C++ | gordonwatts/TMVATests | /TMVAStraightCutReader/main.cpp | UTF-8 | 1,218 | 2.734375 | 3 | [] | no_license | ///
/// Read in a TMVA weight file and do a few tests by hand.
///
#include "tmva/Reader.h"
#include <iostream>
using namespace std;
int main()
{
// Load up the reader
auto reader = new TMVA::Reader();
// Declare the variables
float lowestPtTrack = 0.0;
float nTracks = 0.0;
float logR = 0.0;
reader->AddVari... | true |
4254880f21bc5ca7b67ed26490ff1dbc69dc99a9 | C++ | georgerapeanu/c-sources | /cf1452/A.cpp | UTF-8 | 240 | 2.65625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
int x,y;
cin >> t;
while(t--){
cin >> x >> y;
cout << abs(x) + abs(y) + max(abs(abs(x) - abs(y)) - 1,0) << "\n";
}
return 0;
}
| true |
21466488367cb1d3de20a4bd1812addf79904dc2 | C++ | contificate/Elfex | /disasm/exceptions/disasmexception.h | UTF-8 | 509 | 2.609375 | 3 | [] | no_license | #ifndef DISASMEXCEPTION_H
#define DISASMEXCEPTION_H
#include <exception>
namespace efx {
/**
* @brief The DisasmException class
* We can use this for all futures and promises during disassembly
* because you can set exceptions for those.
*/
class DisasmException : public std::exception {
public:
DisasmExcept... | true |
d54f54eacb6b45e670e403b7d5cf04218061df6a | C++ | zellyn/project-euler | /cc/051.cc | UTF-8 | 2,517 | 3.390625 | 3 | [] | no_license | // Project Euler Problem 051
//
// Find the smallest prime which, by changing the same part of the
// number, can form eight different primes.
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <string>
#include <vector>
#include "primes1.h"
using namespace std;
int atoi_sub(const string& s, const int ... | true |
db2fe66f91ab7169803e141920c1867a2e7e4198 | C++ | JacobHornbeck/CSE-230-Lab07 | /Lab07/Projectile.h | UTF-8 | 3,613 | 3.25 | 3 | [] | no_license | #pragma once
#include <cmath>
using namespace std;
/**********************************
* PVector Class
* Auther: Jacob Hornbeck
**********************************/
class PVector {
public:
/// <summary>
/// x component
/// </summary>
double x;
/// <summary>
/... | true |
76aa29785c0e6e033d3aa27e33c5cc3346586ec5 | C++ | IanusInferus/niveum | /Examples/Communication/CPP/Src/Client/Clients/IContext.h | UTF-8 | 555 | 2.5625 | 3 | [
"DOC"
] | permissive | #pragma once
#include <cstdint>
#include <vector>
namespace Client
{
class SecureContext
{
public:
std::vector<std::uint8_t> ServerToken; //服务器到客户端数据的Token
std::vector<std::uint8_t> ClientToken; //客户端到服务器数据的Token
};
class IBinaryTransformer
{
public:
... | true |
8becf762245ffda35a061ae3246bd8edb5ef2b8d | C++ | tedvalson/NovelTea | /include/NovelTea/GUI/VerbList.hpp | UTF-8 | 2,531 | 2.5625 | 3 | [
"MIT"
] | permissive | #ifndef NOVELTEA_VERBLIST_HPP
#define NOVELTEA_VERBLIST_HPP
#include <NovelTea/ContextObject.hpp>
#include <NovelTea/GUI/Scrollable.hpp>
#include <NovelTea/GUI/ScrollBar.hpp>
#include <NovelTea/GUI/Hideable.hpp>
#include <NovelTea/Utils.hpp>
#include <NovelTea/Verb.hpp>
#include <NovelTea/Object.hpp>
#include <SFML/Gr... | true |
67318154cb8a05b9003fbe2e5ff20d8e48cf6a9a | C++ | intellhave/geocam | /Geometry/Edge/length.h | UTF-8 | 1,275 | 2.828125 | 3 | [] | no_license | #ifndef LENGTH_H_
#define LENGTH_H_
#include <cmath>
#include <map>
/**************************************************************
Class: Length
Author: Alex Henniges?, Dan Champion?, Dave Glickenstein
Version: January 5, 2010
**************************************************************/
#include <new>
using name... | true |
65ac63c07534f2d8c711026f225842298e4c3cd1 | C++ | eyes22/AlgoDDABres | /algoritma bresenham/main.cpp | UTF-8 | 1,380 | 2.8125 | 3 | [] | no_license | /*
Projek : Aplikasi Algoritma Bresenham
Tugas : Grafika Komputer
Kelompok : Giri Supangkat 10108423
Wanda 10108419
Muzakki Fadhi 10108414
Rizal Rismawan 10108389
Ringga Anggiat S 10107569
*/
#include <stdio.h>
#include <co... | true |
0837f19280b1f663c44530818a2a4434c21eb877 | C++ | maddotexe/Competitive-contest-programs | /course code/5th sem/CG/folder a/folder a/js1/A4/4_2.cpp | UTF-8 | 982 | 2.53125 | 3 | [] | no_license | #include <iostream>
#include <GL/gl.h>
#include <GL/freeglut.h>
#include <map>
#include <cmath>
#define PUSH glPushMatrix
#define POP glPopMatrix
#define inf 1000000
using namespace std;
void playit()
{
PUSH();
double t = 3;
int loop = 3;
double r = 0.5;
double dif = 0.28;
while (loop--) {
for (doub... | true |
22fdc58a235504b1e7e199cebb8bcef98b749410 | C++ | visheshvikas/Arduino | /theVDIsensor/MMA7361.cpp | UTF-8 | 1,671 | 3 | 3 | [] | no_license | #include "Arduino.h"
#include "MMA7361.h"
// MMA7361 Accelerometer consists of 9 pins such that
// Vcc = 3.3 V, GND, XOUT, YOUT, ZOUT, SLP, etc.
// SLP (Sleep pin) should be set to high (3.3 V) for the accelerometer to be active
MMA7361::MMA7361()
{
}
//Sets the analog pins and initializes the running averages, counte... | true |
56d96a16e946c17f075a23fc85a8f8eef9ba3958 | C++ | jatinarora2702/Competitive-Coding | /codeforces/749_A.cpp | UTF-8 | 232 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
scanf("%d", &n);
printf("%d\n", n / 2);
for(i = 0 ; i < n/2-1 ; i++) {
printf("2 ");
}
if(n % 2 == 0)
printf("2\n");
else
printf("3\n");
return 0;
} | true |
502da2df31fb2678cbc3ef7d3c4912826c0e3adb | C++ | s-sofism/c-sharp-labs | /laba4_2/Library_4.2/Library.cpp | UTF-8 | 2,262 | 3.09375 | 3 | [] | no_license | #include "Library.h"
#include "pch.h"
using namespace std;
double MillimetersToCentimeters(double number)
{
return number / 10;
}
double MillimetersToDecimeters(double number)
{
return number / 100;
}
double MillimetersToMeters... | true |
1cf41da6927ae25564dc81aa1c49d8d296ce4623 | C++ | Zeyel/Modelisation | /gprLoader.h | UTF-8 | 1,028 | 3 | 3 | [] | no_license | #pragma once
#include"Graph.h"
#include <fstream>
#include <sstream>
#include <iostream>
using namespace std;
class gprLoader
{
void vertexListConstructor(ifstream& doc, string& content, Graph graph)
{
vector<string> verticeBuffer;
getline(doc, content, '\n');
do{
split(content, ' ', verticeBuffer);
g... | true |
d18bd3257295311bb62c0eebd480c879b8ac4566 | C++ | wogus3602/study | /박재현/이전/세로읽기.cpp | UTF-8 | 577 | 2.921875 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
vector<string> ve;
int maxLength = 0;
for (int i = 0; i < 5; i++)
{
string row;
cin >> row;
if (maxLength < row.size())
{
maxLength = row.s... | true |
497e16e0939db124656d9d5c613f55decf712778 | C++ | PandaSB/rpi_alarm | /variables.cpp | UTF-8 | 931 | 2.703125 | 3 | [] | no_license | #include "variables.h"
#include <QDebug>
Variables* Variables::instance = 0;
Variables* Variables::getInstance()
{
if(!instance) {
instance = new Variables();
qDebug() << "getInstance(): First instance\n";
return instance;
}
else {
qDebug() << "getInstance(): previous instance\n";
return instance;
... | true |
d8c1fc3f6da91eb436a87897ff6a35fee9c951d7 | C++ | Yalfoosh/NAISP | /lab/lab-2/a-star-faster/main.cpp | UTF-8 | 3,557 | 3.21875 | 3 | [
"Apache-2.0"
] | permissive | /* This is not actually faster lmao */
#include <chrono>
#include <iostream>
#include <list>
#include <queue>
#include <set>
#define M 9
#define N 9
#define range 10
#define c_t std::chrono::high_resolution_clock::now()
#define ms std::chrono::duration_cast<std::chrono::milliseconds>
void printArray(uint16_t *prob... | true |
4cbb110cc0851691b31e26c60f26ad7ec352bbff | C++ | YouJinTou/Beginner-C-Game-Programming | /Tutorial 14/Engine/Snake.cpp | UTF-8 | 5,254 | 3.078125 | 3 | [] | no_license | #include <cmath>
#include "Snake.h"
#include "Square.h"
Snake::Snake(int borderX, int borderY) :
borderX(borderX), borderY(borderY) {
parts = new SnakePart{ nullptr, StartX, StartY, HeadDefaultDir };
}
Snake::~Snake() {
delete[] parts;
}
SnakePart* Snake::Get() const
{
return parts;
}
void S... | true |
9b3cb3ac6d727b6776232b349e0ace7efd3a62de | C++ | pPanda-beta/Coderudite | /server_side/coderudite_ronin/helpers.hxx | UTF-8 | 1,955 | 2.59375 | 3 | [] | no_license |
#ifndef HELPERS_HXX
#define HELPERS_HXX
#include <string>
#include <cstdio>
#include <regex>
#include <map>
#include "qhttpserver.hpp"
#include "qhttpserverresponse.hpp"
#include "qhttpserverrequest.hpp"
#define Y2X(X) #X
#define MAC2STR(Y) Y2X(Y)
namespace
{
using namespace std;
using namespace qhttp;
using nam... | true |
47d96b6fedce527f60401d9e32d0bc78642b94d4 | C++ | sust18023/ACM | /KuangBin/专题四 最短路练习(AK)/Til the Cows Come Home.cpp | UTF-8 | 1,484 | 3.125 | 3 | [] | no_license | /*
Til the Cows Come Home
POJ - 2387
https://cn.vjudge.net/problem/POJ-2387
题意:最短路裸题
输入:点 边
u -> v w
样例输入:
5 5
1 2 20
2 3 30
3 4 20
4 5 20
1 5 100
样例输出:
90
解法:
SPFA
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<iostream>
using na... | true |
b1fb8ce5910876dfbc8b00d0e87b30102ba49706 | C++ | danyfang/SourceCode | /cpp/leetcode/MinimumRectangle.cpp | UTF-8 | 1,320 | 3.15625 | 3 | [
"MIT"
] | permissive | //Leetcode Problem No 939 Minimum Area Rectangle
//Solution written by Xuqiang Fang on 12 Nov, 2018
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
using namespace std;
class Solution{
public:
int minA... | true |
8746436c3d148e020f5a07876d5af78cb16a7b55 | C++ | KhunJahad/String | /CountAndSay/main.cpp | UTF-8 | 576 | 2.578125 | 3 | [] | no_license | # include <bits/stdc++.h>
using namespace std;
void read_input(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
}
int main(){
read_input();
int n;
cin>>n;
string a[n+1];
a[1]="1";
for (int j=2;j<n+1;j++){
string prev_ans=a[j-1];
string ans="";
for (... | true |
60e3dd091712d7d2dc3978cf9d0a4f1e8a7ee806 | C++ | adityachirania/LEETCODE_PREP | /Construct Binary Tree from Preorder and Inorder Traversal Solution.cpp | UTF-8 | 2,025 | 3.421875 | 3 | [] | no_license | //https://leetcode.com/explore/interview/card/top-interview-questions-medium/108/trees-and-graphs/788/
/**
* 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(... | true |
00e2ada96d1afee4211ca0ac017f402fe57ff008 | C++ | cloudcalvin/vcd_assert | /src/sdf/types/delayfile.cpp | UTF-8 | 2,989 | 2.546875 | 3 | [] | no_license | #include "sdf/types/delayfile.hpp"
#include "sdf/types/cell.hpp"
#include <cassert>
using namespace SDF;
// DelayFile::DelayFile(DelayFileView dfw){
// }
std::string_view DelayFile::get_sdf_version() const noexcept
{
return sdf_version_;
}
std::optional<std::string_view> DelayFile::get_design_name() const noex... | true |
5a6400b3fba1bf0a3c84263dff5468bd244d8e54 | C++ | Calasada/C-programming | /Chapter 16/Homework 6/Main.cpp | UTF-8 | 399 | 3.296875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <cmath>
using namespace std;
double tol = 0.01;
double newtons(double, double);
int main() {
int num;
cout << "Number: ";
cin >> num;
cout << newtons(num, num);
return 0;
}
double newtons(double x, double a) {
if(abs(pow(a, 2) - x) <= tol) {
r... | true |
85932dc3219f572699121d77464d165f8c2c5089 | C++ | lishulongVI/leetcode | /cpp/206.Reverse Linked List(反转链表).cpp | UTF-8 | 1,220 | 3.5625 | 4 | [
"MIT"
] | permissive | /*
<p>Reverse a singly linked list.</p>
<p><strong>Example:</strong></p>
<pre>
<strong>Input:</strong> 1->2->3->4->5->NULL
<strong>Output:</strong> 5->4->3->2->1->NULL
</pre>
<p><b>Follow up:</b></p>
<p>A linked list can be reversed either iteratively or recursively. Could you implemen... | true |
6a748acd4a1ab5bebdefd9274bc7fd713b47d9f1 | C++ | Codinator29/InterviewBit | /TwoPointers/ClosestPairFromSortedArrays.cpp | UTF-8 | 1,943 | 3.765625 | 4 | [] | no_license | /*
Closest pair from sorted arrays
Problem Description
Given two sorted arrays of distinct integers, A and B, and an integer C, find and return the pair whose sum is closest to C and the pair has one element from each array.
More formally, find A[i] and B[j] such that abs((A[i] + B[j]) - C) has minimum value.
If th... | true |
84b514f5861afc32def1f073758ac900e0c07785 | C++ | matmarczuk/micromouse | /logic/Board/src/boardgenerator.cpp | UTF-8 | 3,490 | 3.265625 | 3 | [] | no_license | #include "logic/Board/include/boardgenerator.h"
#include <vector>
#include <memory>
#include <stdlib.h>
#include <ctime>
BoardGenerator::BoardGenerator()
{
}
/*!
* \brief Generates now board. Allocates memory for it
* \param size - size choosen by user
*/
void BoardGenerator::generateNewBoard(int size)
{
sran... | true |
e822fab77f8c3e8cbb1f099a96cf7b59a5ffb2ea | C++ | Klyta/12 | /Cavalry.cpp | UTF-8 | 852 | 2.84375 | 3 | [] | no_license | #include "Cavalry.h"
#include "Cell.h"
#include "iostream"
#include "string"
#include <map>
#include "LandScape.h"
#include "Bonus.h"
std::map<std::string, int> Cavalry::CBonus = { {"forest",10}, {"pound",-10} };
Cavalry::Cavalry(int Health, int Demage, const Cell *cell, Player& player) : Unit(Health, Demage, c... | true |
5adca2faf35c160cee496802cdf7ca6826ef5fd8 | C++ | NightRoadIx/Curso-C | /009A.CPP | WINDOWS-1252 | 1,514 | 3.375 | 3 | [] | no_license | /*
Curso de Programacin en C
Leccion 9
Archivos Binarios (escritura)
*/
#include <stdio.h>
/*
size_t fwrite(const void *ptr, size_t size, size_t n, FILE*stream);
*/
#include <conio.h>
#include <stdlib.h>
/*
Manejo de archivos binarios en C
Para abrir un archivo en modo binario hay que especif... | true |
dca7744c858a11ab25547992848ea28fa695bd5a | C++ | ihalemi/Object-Oriented-Software-Development-C- | /Lab2/Text.cpp | UTF-8 | 1,902 | 3.4375 | 3 | [] | no_license | #include "Text.h"
namespace sict {
Text::Text() {
m_text = nullptr;
m_records = 0;
}
Text::Text(const std::string file) : m_records(0) {
std::ifstream f(file);
if (f.is_open()) {
// variables to count records
int counter = 0;
std::string newLine;
// do while loop to count ... | true |
e67ec8876eaccceeb400ed41d0f7791aebb0141e | C++ | pgmaginot/DARK_ARTS | /src/materials/Source_I_Constant.cc | UTF-8 | 860 | 2.609375 | 3 | [
"MIT"
] | permissive | /** @file Source_I_Constant.cc
* @author pmaginot
* @brief Implement the Source_I_Constant class
* \f$ Source_I_Constant = constant\f$
*/
#include "Source_I_Constant.h"
Source_I_Constant::Source_I_Constant(
const Input_Reader& input_reader, const int mat_num) :
VSource_I(),
m_t_start(... | true |
00bc05e36bd2c6224eb2e991e33be5e42d287c73 | C++ | pjshort/tachyon | /tachyon/io/bcf/BCFReader.h | UTF-8 | 5,674 | 2.78125 | 3 | [
"MIT"
] | permissive | #ifndef BCF_BCFREADER_H_
#define BCF_BCFREADER_H_
#include <cassert>
#include "BCFEntry.h"
#include "../compression/BGZFController.h"
namespace tachyon {
namespace bcf {
class BCFReader{
typedef BCFReader self_type;
typedef BCFEntry value_type;
typedef value_type& reference;
... | true |
09298b7ca3813b78c89f3279a490505d654f3c69 | C++ | zhe13/Pettern | /第09章 人脸的检测与定位/人脸定位实例/HairFace.cpp | GB18030 | 2,153 | 2.640625 | 3 | [] | no_license | //////////////////////////////////////////////////////////////////////
// HairFace.cpp: CHairFaceӿ
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "FaceDetect.h"
#include "HairFace.h"
//////////////////////////////////////////////////////////////////////
// 캯/
/////... | true |
5917b0c7e21c3a019e2455e361625060a5ebbba8 | C++ | xukunn1226/VRI3 | /Development/Src/Core/Src/Color.cpp | UTF-8 | 1,120 | 2.921875 | 3 | [] | no_license | #include "CorePCH.h"
#include "Color.h"
const FColor FColor::White(1.0f, 1.0f, 1.0f);
const FColor FColor::Black(0.0f, 0.0f, 0.0f);
FColor FColor::Desaturate(FLOAT Desaturation) const
{
FLOAT L = R * 0.3f + G * 0.59f + B * 0.11f;
return Lerp(*this, FColor(L, L, L, 0.0f), Desaturation);
}
FLinearColor FColor::Conv... | true |
4e1b5ef48a2369e8c314b58d085217127211b6d3 | C++ | wanname777/demo | /main.cpp | UTF-8 | 276 | 2.90625 | 3 | [] | no_license | #include <iostream>
#include "Book.h"
using namespace std;
int main() {
cout << "Hello, World!" << endl;
Book book(12.5);
cout << book.getPrice() << endl;
book.setPrice(35);
cout << book.getPrice() << endl;
cout << Book::num << endl;
return 0;
}
| true |
feb988a08b791fd59c4ab031fbad949439e7892c | C++ | Harry-Li/leetcode | /047. Permutations II/solution.h | UTF-8 | 757 | 2.9375 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
vector<vector<int>> permuteUnique(vector<int>& nums) {
vector<vector<int>>res;
vector<int>tnums;
vector<bool>used(nums.size(),false);
sort(nums.begin(),nums.end());
search(res, tnums, nums,used);
return re... | true |
9a9861453532d89b47754e61845017ac006fb4fc | C++ | yasminalvx/Uri-cplusplus | /1066.cpp | UTF-8 | 644 | 3.109375 | 3 | [] | no_license | //Yasmin Alves
//29.06.2020
#include <iostream>
using namespace std;
int main() {
int x; int pos = 0, i = 0, neg = 0, par = 0, impar = 0;
while (i < 5) {
cin >> x;
if (x > 0) {
pos ++;
} else if (x != 0) {
neg++;
}
if (x%2 == 0) {
... | true |
8cc0b96ef1c7d265de601423a7c0f4b5e54d6d64 | C++ | wwydmanski/Neural-network | /includes/Network.h | UTF-8 | 6,004 | 3.140625 | 3 | [] | no_license | #ifndef Network_H
#define Network_H
#include <iostream>
#include <vector>
#include <cmath>
#include "Layer.h"
#define E 2.71828182845904523536
using namespace std;
class Network
{
private:
vector<Layer> layers;
int inputSize;
int outputSize;
bool bias;
double* multiplyLayers(vector<double> in1,... | true |
a5a3a29aecfa8426f5401173bc84ce3c94c07ab3 | C++ | vikaskbm/pepcoding | /foundation/cpp/2_recursion_and_backtracking/5_recursion_backtracking/3.cpp | UTF-8 | 1,520 | 3.78125 | 4 | [
"MIT"
] | permissive | // N Queens
// 1. You are given a number n, the size of a chess board.
// 2. You are required to place n number of queens in the n * n cells of board such that no queen can kill another.
// Note - Queens kill at distance in all 8 directions
// 3. Complete the body of printNQueens function - without changing signature ... | true |
eaa1fdefbb9ff153f91ed1a5e2260595a041d9f7 | C++ | Kejie-Wang/lsh | /util/random.h | UTF-8 | 1,399 | 3.375 | 3 | [] | no_license | #ifndef _LSH_RAMDOM_H_
#define _LSH_RAMDOM_H_
#include <cstdlib>
#include <cmath>
#include <cassert>
namespace lsh
{
/**
* Generate a uniform random variable between min and max
* @param min: The lower bound
* @param max: The upper bound
*/
double genUniformRandom(double min, double max)
{
assert(min < max);
do... | true |
55926bc4b83301fa9cdba52393679b49434d72b1 | C++ | kkogoro/OI | /Luogu/P3765/P3765.cpp | UTF-8 | 6,916 | 2.625 | 3 | [] | no_license | #include <iostream>
#include <ctime>
#include <cstdlib>
#include <cstdio>
inline int read() {
int x = 0;
char ch = getchar();
while (ch < '0' || ch > '9') {
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = x * 10 + ch - '0';
ch = getchar();
}
return x;
}
con... | true |
452f72c3d57623c58d9e07be0200944a10379565 | C++ | bonopi07/backjoon_practice | /9095_2.cpp | UTF-8 | 390 | 3.140625 | 3 | [] | no_license | #include <cstdio>
#include <iostream>
using namespace std;
int go(int sum, int goal) {
if (sum > goal)
return 0;
if (sum == goal)
return 1;
int now = 0;
for (int i = 1; i <= 3; ++i) {
now += go(sum + i, goal);
}
return now;
}
int main()
{
freopen("input.txt", "r", stdin);
int t;
cin >> t;
while (t--... | true |
dfa75ec4b1794aab901daba62019e202f6a82996 | C++ | Pandamonium-san/Resim | /ResimBuffer.h | UTF-8 | 1,281 | 3.375 | 3 | [] | no_license | #pragma once
#include <vector>
namespace Resim
{
class Buffer
{
public:
Buffer(size_t aBytes);
size_t Write(void* aData, size_t aBytes);
template<class T>
size_t Write(const T& aData);
template<class T>
size_t Write(T&& aData);
void* Read(size_t aOffset, size_t aBytes);
template<class T>
T& Read... | true |
e114a5cc520ea5699a39bff060a9594531ee16e5 | C++ | goswami-rahul/competitive-coding | /CompetitiveProgramming/codeforces/CF305-D2-E.cpp | UTF-8 | 2,868 | 2.734375 | 3 | [] | no_license | /**
* Observation: substrings separated with such i which can never be a valid move,
* are independent to each other.
* So we can calculate grundy of each substring with streak of palindrome centers
* and xor them for grundy of game.
**/
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) int((v).size())
#d... | true |
c1e6c5eb7da5185712a9dad40de45ea462c49875 | C++ | souraavv/Algorithms | /data structure/BIT_Fenwick tree/BIT1_count_inverse.cpp | WINDOWS-1252 | 2,827 | 3.203125 | 3 | [] | no_license | #include<bits/stdc++.h>
#define ll long long
#define maxn 10001
#define mk make_pair
using namespace std;
ll sum;
/*
https://www.geeksforgeeks.org/count-inversions-array-set-3-using-bit/
*/
/*
Inversion Count for an array indicates how far (or close) the array is from being sorted.
If array is already ... | true |
7af5aca83a2a0cebbdf4f0f01a8ec0e1394b834a | C++ | myapit/cppcollection | /linux_programming/localdevel/nc-win.cpp | UTF-8 | 5,705 | 2.609375 | 3 | [
"MIT"
] | permissive | /*
* Very simple pop-up using ncurses form and menu library (not CDK).
*
* The buttons are made from items and the fields are made from... well fields.
*
* How to run:
* gcc -o test -lmenu -lform -lncurses ncurses-simple-pop-up.c -g && ./test
*/
// Depending on your OS you might need to remove 'ncurses... | true |
92564cfd44bc2d90059f28f9aada41434b6c39cb | C++ | Locutus18/Discrete-Matemathics-2 | /graph.cpp | UTF-8 | 271 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include "graph.h"
using namespace std;
int main()
{
Graph<int,int,false> graph = Graph<int,int,false>();
for(int i = 0; i < 10; ++i) {
graph.add(i);
}
for(int i = 0; i < 9; ++i) {
graph.add(i,i+1,i+2);
}
graph.print();
return 0;
}
| true |
9a19f841719dcc8d150ee35d406a0d4086a51229 | C++ | rvbc1/Carolo20 | /Src/Classes/Filters.h | UTF-8 | 1,838 | 2.53125 | 3 | [] | no_license | /*
* Filters.h
*
* Created on: 03.01.2018
* Author: mice
*/
#ifndef MULTIROTOR_FILTERS_H_
#define MULTIROTOR_FILTERS_H_
#include <stdbool.h>
#include <stdint.h>
#include <math.h>
#include "stm32f7xx_hal.h"
#include "Mathematics.h"
class Filter {
public:
virtual float apply(float inp... | true |
4e0615f49398722689f8e639c8c59e4967edaf59 | C++ | azhi-fengye/Introduction-to-algorithms | /C Primer Plus/6.16编程练习(4)/源.cpp | GB18030 | 372 | 3.1875 | 3 | [] | no_license | /*
ʹǶѭĸʽӡĸ
A
BC
DEF
GHIJ
KLMNO
PQRSTU
ϵͳʹ˳Ĵ룬ϰ3ķ
*/
#include<stdio.h>
int main(void)
{
char ch = 'A';
for (int i = 0; i < 6; i++)
{
for (int j = 0; j < i + 1; j++)
{
printf_s("%c",ch);
ch++;
}
printf_s("\n");
}
return 0;
} | true |
68b894d2098c0b720174dfa037d8d1154d3f3e95 | C++ | IoTClassroom/iot-lab-sigfox-training-baron-coisnon | /Workspace/Fade/fade/fade.ino | UTF-8 | 419 | 2.828125 | 3 | [] | no_license | int pin = 9;
int brightness = 0;
int fadeAmount = 5;
void setup() {
// declare pin 9 to be an output:
pinMode(pin, OUTPUT);
Serial.begin(9600);
}
void loop() {
analogWrite(pin, brightness);
brightness = brightness + fadeAmount;
if (brightness <= 0 || brightness >= 255) {
fadeAmount ... | true |
21dfb9dda6e69d9afee985667f7fb9edbb74a2b0 | C++ | AStockinger/Cpp-Projects | /Projects/Zoo Tycoon/Penguin.hpp | UTF-8 | 599 | 2.546875 | 3 | [] | no_license | /*********************************************************************
** Program name: Zoo Tycoon
** Author: Amy Stockinger
** Date: Oct 8, 2018
** Description: Penguin specification, includes matching Animal
** constructors along with modified member vars
************************************************************... | true |
d099a6fa84678e1b1c50b348e872e0e6baaf1350 | C++ | jsdelivrbot/Reactor | /Common/PulseWidthModulator.hpp | UTF-8 | 1,349 | 2.53125 | 3 | [] | no_license | //
// Copyright (C) BlockWorks Consulting Ltd - All Rights Reserved.
// Unauthorized copying of this file, via any medium is strictly prohibited.
// Proprietary and confidential.
// Written by Steve Tickle <Steve@BlockWorks.co>, September 2014.
//
#ifndef __PULSEWIDTHMODULATOR_HPP__
#define __PULSEWIDTHMODULATOR_HP... | true |
1b807933ba477e832da4b925438be067b3488821 | C++ | Zhenyuan-Xi/Algorithms | /Bipartite Graph/LC886. Possible Bipartition.cpp | UTF-8 | 2,498 | 3 | 3 | [
"MIT"
] | permissive | /*
Given a set of N people (numbered 1, 2, ..., N), we would like to split everyone into two groups of any size.
Each person may dislike some other people, and they should not go into the same group.
Formally, if dislikes[i] = [a, b], it means it is not allowed to put the people numbered a and b into the same group.
R... | true |