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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a8cb5237e76f586eb01583237d46a66821c83609 | C++ | drop-stones/Scheduling-Algorithms-Simulation | /schedule_sjf.hpp | UTF-8 | 1,316 | 3.28125 | 3 | [] | no_license | /**
* Implementation of Shortest-Job-First Scheduling.
*/
#include "CPU.hpp"
#include <deque>
#include <algorithm>
namespace cpu {
// burst-time order
bool operator< (const class task &t1, const class task &t2) {
return t1.get_burst () < t2.get_burst ();
}
bool operator> (const class task &t1, const class ta... | true |
5c2a0fa3da60e54357c70f99a97c3aba330afb48 | C++ | lostsquirrel/cpp_learning | /src/03_function/gcd_lcm.ex.cpp | UTF-8 | 1,046 | 3.78125 | 4 | [] | no_license | #include <iostream>
using namespace std;
/*
*编写函数gcd与lcm,分别求两个正整数的最大公约数与最小公倍数。
*/
int gcd(int a, int b);
int lcm(int a, int b);
int min(int a, int b);
bool is_divisible(int a, int b);
int main() {
cout << gcd(6, 12) <<endl;
cout << lcm(6, 12) <<endl;
cout << gcd(5, 7) <<endl;
cout << lcm(5, 7) <<endl... | true |
e019e7ecda1bb10452076decaaef4d2ffcfd69bd | C++ | AhoiJ/olio-ohjelmointi-kurssi | /Vko46_2017/T1-2/main.cpp | UTF-8 | 527 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <exception>
#include <stdexcept>
#include "Header.h"
using std::cout; using std::cin; using std::endl; using std::cout; using std::exception;
int main()
{
/*
std::vector<int> myvector(10);
try {
myvector.at(20) = 100; // vector::at throws an out-of-range
}
catch (const ... | true |
a4707eb5bc7057641b662b2f1ccdd26cf6ac7b9a | C++ | mascure/PAT | /pat1022_me.cpp | UTF-8 | 3,474 | 2.8125 | 3 | [] | no_license | //pat 1022. Digital Library (30)
//看别人的代码,找处理输入,字符串的简便方法
#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<string.h>
#include<queue>
#include<vector>
#include<stack>
//#include<map>
#include<algorithm>
#define MAXN 505
#define inf 0x7fffffff
#define LL long long
using namespace std;
struct Book
{
int... | true |
11adf9ad6c66ff5745acffb1d54bb977a12db491 | C++ | TensorCodeGen/tensor-codegen | /libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.prev/iterator.pass.cpp | UTF-8 | 1,125 | 2.515625 | 3 | [
"NCSA",
"LLVM-exception",
"MIT",
"Apache-2.0"
] | permissive | //===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===---------------------------... | true |
3b014a6b6ec2ac4a9064d9eabbe468104b628cf7 | C++ | liadab/TransactionalDataStructures | /test/test_linked_list_mt.cpp | UTF-8 | 4,325 | 3.125 | 3 | [] | no_license | #include <gtest/gtest.h>
#include <thread>
#include "../datatypes/LinkedList.h"
class ThreadRunner {
public:
template <typename func1_t, typename func2_t>
void run_thread_set_1(func1_t func1, func2_t func2) {
stop_main = true;
stop_thread = true;
m_t = std::make_unique<std::thread>([thi... | true |
cd378fa73a1bed2d6413817b75fc46ffb9309f9b | C++ | MMajeed/Poker-Hand-Frequencies | /Poker Hand Frequencies/deck.hpp | UTF-8 | 783 | 3.375 | 3 | [] | no_license | /** @file: Deck.hpp
@author Mohammed Majeed
@author m_majeed@fanshaweonline.ca
@date 2011/10/15
@version 1.0
@note Developed for Visual Studio C++ 2010
@brief - A deck class that uses the card class to develop a deck of playing cards
*/
#ifndef __Deck_HPP__
#define __Deck_HPP__
#include "card.hpp"
#include <vec... | true |
cd43afb545cd349c2cbcfc7b2cb00ce3d0b35c5e | C++ | shashankcic/June-Leetcoding-Challenge | /validIPAddress.cpp | UTF-8 | 2,463 | 2.90625 | 3 | [] | no_license | class Solution {
public:
string validIPAddress(string IP) {
int deli;
deli=IP.find('.');
if(deli!=string::npos){
deli=0;
for(int i=0;i<4;++i){
if(deli>=IP.size()){
return "Neither";
}
int j;
... | true |
6f9807f8540a37c6a7848e15ce11ed5098a151b8 | C++ | aclark206/Binary-Search-Tree | /BST.cpp | UTF-8 | 12,690 | 3.921875 | 4 | [] | no_license | #include <iostream>
using namespace std;
// constructor
bst::bst(int key){
root = new Node;
root->data = key;
root->right = NULL;
root->left = NULL;
}
// copy constructor
//uses a preorder traversal so that the tree will be ordered the same
bst::bst(const bst& copyTree){
recursiv... | true |
9e73270a4085ee69b088e52c7b86d61985d85152 | C++ | Cheshulko/Algorithms | /Leetcode/PermutationSequence.cpp | UTF-8 | 380 | 2.6875 | 3 | [] | no_license | class Solution {
public:
string getPermutation(int n, int k) {
int f[10] = { 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880 };
vector<int> arr;
string ans;
for (int i = 1; i <= n; ++i) arr.push_back(i);
for (int i = n; i >= 1; --i){
int x = ((k - 1) / f[i - 1]);
k -= x * f[i - 1];
ans.push_back(arr[x] + '... | true |
b80dd0b96f8c1bb387226dcc0afee716ec75d354 | C++ | Egor201/Programming | /Practice/08/c++/Project1/Project1/Source.cpp | MacCyrillic | 525 | 3.03125 | 3 | [] | no_license | #include<iostream>
#include<iomanip>
using namespace std;
int main() {
setlocale(LC_ALL, "Russian");
double x, y;
char q = ' ', w = ' ';
std::cout << " \n";
std::cin >> x >> q >> y;
q = (int)(q);
w = (int)('+');
if (q == '+') {
std::cout << x + y;
}
else {
if (q == '-') {
std::cout << x - y;
}
el... | true |
83783145cc3b59d955def374af14e17ddc11b2a1 | C++ | yelanzhou/learnVulkan | /LearnVulkan/VulkanEncapsulation/Private/VulkanImageView.cpp | UTF-8 | 1,272 | 2.609375 | 3 | [] | no_license | #include "VulkanImageView.h"
#include "VulkanDevice.h"
#include <assert.h>
VulkanImageView::VulkanImageView(std::shared_ptr<VulkanDevice> vulkanDevicePtr, VkImage imageHanle, VkFormat format)
:m_vulkanDevicePtr(vulkanDevicePtr)
{
VkImageViewCreateInfo viewInfo;
viewInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_I... | true |
ece58e8ecd148a7edcd47949323d1a956c59eb20 | C++ | ashnachadha/cs100-lab-05-strategy-pattern | /bubbleSort.hpp | UTF-8 | 658 | 3.140625 | 3 | [] | no_license | #ifndef __BUBBLESORT_HPP__
#define __BUBBLESORT_HPP__
#include "container.hpp"
#include "sort.hpp"
class BubbleSort : public Sort {
public:
/* Constructors */
BubbleSort() : Sort() {}
/* Pure Virtual Functions */
virtual void sort(Container* container) {
for (unsigned i = 0; i + 1 < contain... | true |
9583c93b3f07713e3c2172087e3215e5bfadad9a | C++ | int-i/ICE2004 | /psj/week07/hw01/main.cpp | UTF-8 | 2,818 | 3.9375 | 4 | [] | no_license | // 사용할 헤더 정의
#include <iostream>
#include "media.h"
// 프로그램 시작점
int main() {
// 미디어 클래스 인스턴스 포인터를 저장하는 배열
Media* media_ptrs[] = {
// 각 클래스를 동적할당하여 생성
// 사용 후에는 `delete` 해야 함
new VTR("Hello", 15, "avi"),
new DVD("Superman", 3, "123-9899"),
new LegalDVD("Marvel", 10, "456-... | true |
bfcb613d28b5eaa4c4464547fb64f2430475be09 | C++ | tomerwei/Robot-Motion-Planning | /4.2/Prm.h | UTF-8 | 1,982 | 2.828125 | 3 | [] | no_license | #ifndef PRM_H
#define PRM_H
#include "basic_typedef.h"
#include "Graph.h"
#include "CollisionDetector.h"
#include "Sampler.h"
#include "Kd_tree_d.h"
#include "SRPrm.h"
#include <map>
#include <utility>
// Should be used with the Graph wrapper
class Prm {
typedef map< Point_d, int, point_d_less > po... | true |
82eca371668cfe5b19108323176aab329b1fe243 | C++ | Ilisio-Lungavi/Laboratorios-de-TIC | /Lab1/1/Exercício Nº1.cpp | ISO-8859-1 | 252 | 2.953125 | 3 | [] | no_license | //Exerccio N1
#include <stdio.h>
int main(){
int A, lado1, lado2;
printf("Digite os lados do quadrado...:");
scanf("%i%i", &lado1, &lado2);
A = lado1 * lado2;
printf("A area do quadrado igual a %i", A);
return 0;
} | true |
e64b2eceef7954b51bf678ec29e3d7be204b86f4 | C++ | CMS-TMTT/cmssw | /TrackingTools/DetLayers/interface/PeriodicBinFinderInZ.h | UTF-8 | 1,334 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | #ifndef DetLayers_PeriodicBinFinderInZ_H
#define DetLayers_PeriodicBinFinderInZ_H
#include "Utilities/BinningTools/interface/BaseBinFinder.h"
#include "Geometry/CommonDetUnit/interface/GeomDet.h"
#include <cmath>
/** Bin finder along the global Z for (almost) equidistant bins.
* The bins are computed from GeomDet p... | true |
5ea12e6e31c72529a9112feda15fececa94855dc | C++ | Hyoe/CST370 | /Week1_LinkedLists/HelpExamples/maxIsAscending/LinkedList.cpp | UTF-8 | 3,020 | 3.890625 | 4 | [] | no_license | #include <iostream>
using namespace std;
#include "LinkedList.h"
//-- Default constructor
LinkedList::LinkedList()
{
mySize = 0;
first = NULL;
}
//-- Definition of the copy constructor
LinkedList::LinkedList(const LinkedList & origList)
{
mySize = origList.mySize;
first = NULL;
if (mySize == 0)
... | true |
24ad9a159fa07b14e302f7b032c8eb5ea4c3c347 | C++ | MarkInsom/Assignment-3 | /Linked List/ConsoleApplication1/LinkedList.h | UTF-8 | 509 | 3.359375 | 3 | [] | no_license | #pragma once
#include <iostream>
class LinkedList
{
public:
struct Node
{
int value;
Node* next;
Node* previous;
};
//Head
Node* m_first;
Node* m_last;
void pushFront(int value);
void pushBack(int value);
void popFront();
void popBack();
void printDetails();
void remove(int va... | true |
de89b4a3ca5bf449683074a1c2e76079057eb55b | C++ | seabass04/CS100 | /Labs/Lab05/Rand.hpp | UTF-8 | 343 | 2.53125 | 3 | [] | no_license | #ifndef __RAND_HPP__
#define __RAND_HPP__
#include "base.hpp"
#include <stdlib.h>
using namespace std;
class Rand : public Base {
private:
double n = rand() % 100;
public:
Rand() { };
double evaluate() { return n; };
string stringify(){
string s;
s = to_string(n);
retur... | true |
53b62860b9f54dad86527930a03d9a81dedb52fb | C++ | ztangaj/RM_sentry | /src/peripherals/flash.cpp | UTF-8 | 7,928 | 3.125 | 3 | [] | no_license | /**
* @file flash.cpp
* @author Someone on GitHub, Modified by Alex Au
* @brief flash memory manipulator for stm32f4 devices
* @date 2018-10-27
*
* @copyright Copyright (c) 2018
*
*/
#include "string.h"
#include "flash.hpp"
size_t flashSectorSize(flashsector_t sector)
{
if (sector > 11 && sector < 24)
... | true |
c08e5484b07bf5769d97af54c5b2479652059ece | C++ | Scoobadood/Animesh | /src/libArgs/src/Args.cpp | UTF-8 | 8,697 | 3.0625 | 3 | [] | no_license | #include "Args.h"
#include <tclap/CmdLine.h>
#include <tclap/ArgException.h>
const int DEFAULT_SMOOTH_ITERATIONS = 50;
const int UNUSED = -1;
std::vector<std::string> split( const std::string& str, char token ) {
std::vector<std::string> strings;
std::istringstream f(str);
std::string s;
while (getline(... | true |
d214e34457baf2a0e130c9ab0989b78904637b66 | C++ | yr4528/algo | /lost_clothes/lost_clothes/소스.cpp | UTF-8 | 679 | 3 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int n = 3;
vector<int> lost = { 3 };
vector<int> reserve = { 1 };
int solution() {
int answer = 0;
vector<int> stu(n,1);
for (int i = 0; i < reserve.size(); i++) {
stu[reserve[i] - 1]++;
}
for (int i = 0; i < lost.size(); i++) {
stu[lost[i] - 1]--;
... | true |
abddc20680a9dc86d126af0778544b230de51d97 | C++ | cpe102/lab18-2562-2-poncmu | /lab18_1.cpp | UTF-8 | 656 | 3.625 | 4 | [] | no_license | #include<iostream>
using namespace std;
struct Rect{
double x,y,w,h;
};
double overlap(Rect A,Rect B)
{
double xmin,xmax,ymin,ymax;
if(A.x>B.x) xmin=A.x;
else xmin=B.x;
if(A.x+A.w>B.x+B.w) xmax=B.x+B.w;
else xmax=A.x+A.w;
if(A.y>B.y) ymax=B.y;
else ymax=A.y;
if(A.y-A.w>B.y-B.w) ymin=A.y-A.w;
else ymin... | true |
5e458e9387cfb2369add2e2d19eb6c3f80079ae0 | C++ | tiwanari/pmi-box | /reducer/main.cc | UTF-8 | 2,122 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | #include <cstdlib>
#include <sstream>
#include <future>
#include <fstream>
#include <iostream>
#include <string>
#include <unistd.h>
#include "reducer.h"
#include "util/trim.h"
#include "util/cmdline.h"
void readLinesFromAFile(
const std::string& input_filename,
std::vector<std::string>* lines)
{
std::ifst... | true |
54761dfce58bd16175865469c3de0fb8b92e0471 | C++ | zhang416/rpyfmm | /include/rpy.h | UTF-8 | 14,988 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | #ifndef __RPY_EXPANSION_H__
#define __RPY_EXPANSION_H__
#include <cmath>
#include <complex>
#include <map>
#include <memory>
#include <vector>
#include "dashmm/index.h"
#include "builtins/laplace.h"
#include "dashmm/point.h"
#include "dashmm/types.h"
#include "dashmm/viewset.h"
namespace dashmm {
class RPYTable {
p... | true |
80ab221ab8ac63aa373007e0213844dcadefbc3c | C++ | ROtrebski/ros-indigo-robotino | /invert_laser/src/invert_laser.cpp | UTF-8 | 1,186 | 2.640625 | 3 | [] | no_license | #include "invert_laser.h"
Invert_Laser::Invert_Laser(ros::NodeHandle n)
{
n_ = n;
scan_sub_ = n.subscribe("scan_uninverted", 10, &Invert_Laser::laserCallback, this);
scan_pub_ = n.advertise<sensor_msgs::LaserScan>("scan", 50, true);
}
Invert_Laser::~Invert_Laser()
{
scan_sub_.shutdown();
scan_pub_.shutdown();
... | true |
351e56d7f643eca189933a878949fd79545c8298 | C++ | HexaTeam4212/TPCompiloLouisLucie | /States.h | UTF-8 | 2,016 | 2.71875 | 3 | [] | no_license | //
// Created by Louis on 18/02/2020.
//
#ifndef TP_STATES_H
#define TP_STATES_H
#include <string>
#include <iostream>
#include "Symbol.h"
#include "Automata.h"
using namespace std;
class Automata;
class Symbol;
class State;
class E0;
class E1;
class E2;
class E3;
class E4;
class E5;
class E6;
... | true |
5aa80f31da1a2f4fdec721f590802681b82b78c3 | C++ | antbenar/AlgebraAbstracta_2_1-2017-1- | /rutas_encriptar/main.cpp | UTF-8 | 356 | 2.96875 | 3 | [] | no_license | #include <iostream>
#include "rutas.h"
#include <string>
using namespace std;
int main()
{
Rutas ruta(4);//3,7,6,11,12,13,...
string b,a;
cout<< "escriba su frase a cifrar: ";
getline(cin,b);
a=ruta.cifrar(b);
cout<< "su clave cifrada es: "<<a<<endl;
cout<< "su clave descifrada es: "<<ruta.... | true |
87eaa1c28c1356dbb87a7b9d85c2a2db023feea1 | C++ | BenjaminRubio/CompetitiveProgramming | /Problems/Otros/MemoryAndTrident.cpp | UTF-8 | 424 | 2.609375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
string s;
map<char, int> m = {{'L', 0}, {'R', 0}, {'U', 0}, {'D', 0}};
int main()
{
cin >> s;
if (s.size() % 2)
{
cout << -1 << '\n';
return 0;
}
for (char c : s) m[c]++;
int ans = 0;
ans += abs(m['L'] - m['R']) / 2;
an... | true |
91a101b4baa1378a2821f80f51ffc954e26b68e4 | C++ | abrahanrm/ComputerScience_UNI | /CC232-Algoritmos_y_estructura_de_datos/Coding/C08-listaDoblementeEnlazada.cpp | UTF-8 | 4,043 | 3.421875 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
class NodoDoble
{
private:
int dato;
NodoDoble* adelante;
NodoDoble* atras;
public:
NodoDoble(int t)
{
dato=t;
adelante=atras=NULL;
}
int datoNodo(){return dato;}
voi... | true |
3aea094c3343947d523ece794a8309b07ab572f5 | C++ | thecherry94/BuzzerMusicESP | /buzzer_music_importer.cpp | UTF-8 | 1,354 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <map>
using namespace std;
#define A 27.50
#define B 30.87
#define C 32.70
#define D 36.70
#define E 41.20
#define F 43.65
#define G 49.00
#define ... | true |
86088cc5f3dfa2663184bdef8a86a1ba902ba6b6 | C++ | abhinavtripathi95/fancy-keypoints | /sfop/src/main.cpp | UTF-8 | 2,461 | 2.90625 | 3 | [] | no_license | /*
This is a modification of the main.cpp file which comes with the
original SFOP-0.9 code. We use this modified version to interface Python
with C using ctypes to get the SFOP keypoints.
The original code can be downloaded from
http://www.ipb.uni-bonn.de/data-software/sfop-keypoint-detector/
Apart from this, the o... | true |
f6c4937905b4dd7487c2c46540c3d324540112de | C++ | SouthernStatesASD/tfdirDSPonPC | /configuration/src/configuration/Utility/Substation/Oneline/Oneline.cpp | UTF-8 | 1,060 | 3.125 | 3 | [] | no_license | //
// Created by Andre Henriques on 2019-08-14.
//
#include <utility>
#include <vector>
#include "Oneline.hpp"
Oneline::Oneline(string _x, string _y, string _z) {
x = move(_x);
y = move(_y);
z = move(_z);
}
Oneline::Oneline() {
this -> x = "";
this -> y = "";
this -> z = "";
}
vector<Oneline... | true |
590ee27ff19d041cb37a53f22e0651e5cca0d019 | C++ | nkcr7/Beginning-Algorithm-Contests | /exercise-3-8-repeating-decimals.cpp | UTF-8 | 615 | 3.296875 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
int main()
{
double num, den;
double value;
std::string s;
int pointer;
int period;
while (std::cin>>num && std::cin>>den)
{
// 抓住小数计算的特征,一上来容易走错方向,例如先计算,然后转化为字符串,然后暴力求解循环长度
// 记录每次除法的余数,如果出现重复的余数,则循环了
// 数组记录是否出现该余数,例如余数3,则a[3]来记录,有记录的位置每次更新一位后加1,没... | true |
2411e65118aa29f877b583c395fd205edf55d3f5 | C++ | hsab/ofMoldApp | /src/conidium/ConidiumDance.cpp | UTF-8 | 531 | 2.546875 | 3 | [] | no_license | //
// ConidiumDance.cpp
// moldApp
//
// Created by Nuno on 24/01/2019.
//
#include "ConidiumDance.h"
ConidiumDance::ConidiumDance(Ink *ink, float recenterRatio) {
this->ink = ink;
this->recenterRatio = recenterRatio;
}
void ConidiumDance::update() {
ofVec2f cursorDir = ofVec2f(ofRandom(-1,1),
... | true |
d17cfa6de14037b0cbfbda9e2edcbe7486c8ad27 | C++ | DawidCieslik/Warcaby | /Error.cpp | WINDOWS-1250 | 605 | 2.78125 | 3 | [
"MIT"
] | permissive | #include "Error.h"
void Blad(unsigned int RodzajBledu)
{
switch (RodzajBledu)
{
case 1:
{
std::string error = "Nie ma takiego pola lub pionka!";
throw error;
break;
}
case 2:
{
std::string error = "Wczytywanie pliku nie powiodo si!";
throw error;
... | true |
ce2f619cfd77a6c6c580eee8cb9f58311417610e | C++ | mark-tasaka/C-SFML-Ratcatchers-Revenge-Game | /code/Player.h | UTF-8 | 1,925 | 2.96875 | 3 | [] | no_license | #pragma once
#include <SFML/Graphics.hpp>
using namespace sf;
class Player
{
private:
const float START_SPEED = 200;
const float START_HEALTH = 200;
//where is the player
Vector2f m_Position;
//Player Sprite
Sprite m_Sprite;
//add a texture
Texture m_Texture;
//screen resolution
... | true |
99c8d08671e54c320d36fe89a678cb37b2b9e4cc | C++ | pauladams12345/octopus_simulator | /Space.hpp | UTF-8 | 1,557 | 3.1875 | 3 | [] | no_license | /*********************************************************************
* Program name: Octopus Simulator 3000
* Author: Paul Adams
* Date: 03 19 2018
* Description: Header file for Space class. This class represents
* the physical space in which the octopus moves around in the game
********************************... | true |
dfbf2ba27e77d5987e9428a71a26eafaaf79c9cf | C++ | robotustra/cncmill | /powerfeed/powerfeed.ino | UTF-8 | 2,227 | 2.78125 | 3 | [] | no_license | /*
Power drive test.
Pin 2 - input encoder channel A,
Pin 3 - input encoder channel B
Pin 5 - Mode of operation HIGH = continuous mode LOW = step mode
Pin 13 - Step
Pin 12 - Direction
Encoder interrupt pin = 2;
*/
int PIN_ENC_A = 2;
int PIN_INT = 1; // interrupt pin for arduino Leonardo 32u4
int PIN_ENC_B... | true |
eba3529aa096cdc6b9e94a06f87d33262ad29e5f | C++ | Anshulguptag/Data-Structures | /Graph/FindingShortestPath.cpp | UTF-8 | 2,653 | 3.34375 | 3 | [] | no_license | /*DFS is used*/
#include<iostream>
#include<list>
#include<queue>
using namespace std;
queue<int> temppath;
queue<int> path;
list<int> *adj = new list<int>[8];
void findShortPath(int x,int y,char ch[],int *count,bool visited[])
{
visited[x]=true;
temppath.push(x);
*count = *count+1;
if(x!=y)
... | true |
78c0143e4e0904fbfbd1bebfbb2bc721aa420399 | C++ | ashmi19/interviewbit | /Graph/cycle in a undirected graph/main.cpp | UTF-8 | 803 | 3.25 | 3 | [] | no_license |
bool isCyclic(int curr , const vector<vector<int>> &adj, vector<bool> &vis , int parent)
{
vis[curr] = true;
for(auto it : adj[curr])
{
if(vis[it] && it!=parent)
{
return true;
}
if(!vis[it] && isCyclic(it,adj,vis,curr))
{
return true;
... | true |
772e92cb269b6c14e8973d92aa0be6e843b33f8f | C++ | Kiritow/OJ-Problems-Source | /HDOJ/4486_autoAC.cpp | UTF-8 | 551 | 2.578125 | 3 | [] | no_license | #include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
int cas;
scanf("%d",&cas);
while(cas--)
{
int id,n,tot=0;
scanf("%d %d",&id,&n);
if(n%3==0) tot++;
int top=(int)ceil(n*1.0/3);
for(int i=n/2;i>=t... | true |
b4cd627f280696b3823381a306c21c596b33783c | C++ | CSHwang4869/Online-Judge-Solutions | /Luogu/Luogu2397_N_logN.cpp | UTF-8 | 533 | 2.6875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#define DEBUG printf("Passing [%s] in Line %d\n" , __FUNCTION__ , __LINE__) ;
const int MAX_L = 30 + 5 , L = 30 ;
int n , cnt[2][MAX_L] ;
void add(int x) {
for (int i = 0 ; i <= L ; ++i)
if (x & (1 << i)) ++cnt[1][i] ;
else ++cnt[0][i] ;
}
int main() {
scanf("%d" , &n) ... | true |
eb576b882e5371ec50cbae61bbffcc3a8cfb3417 | C++ | Degiv/spbsu_homework | /sem1/Test_3/test3.1/main.cpp | UTF-8 | 1,612 | 3.84375 | 4 | [] | no_license | #include <iostream>
using namespace std;
void quickSort(int *myArray, int first, int last)
{
int i = first;
int j = last;
int pivot = myArray[(first + last) / 2];
while (i <= j)
{
while (myArray[i] < pivot)
++i;
while (myArray[j] > pivot)
--j;
if (i... | true |
40d3c46202ee35cdd574033c3c86435bb6841094 | C++ | Ninad99/data-structures-and-algorithms | /Algorithms/Graph/dungeongridBFS.cpp | UTF-8 | 2,367 | 3.1875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
class Grid {
private:
int R, C, startRow, startCol;
vector<vector<char> > matrix;
queue<int> rq; // row queue
queue<int> cq; // column queue
int move_count, nodes_left_in_layer, nodes_in_next_layer;
bool reached_end;
vector<vector<bool> > visited;
vector<i... | true |
8bf4243403dce82142a9baa2f12f3ff019159b0f | C++ | saini-gitanjali/DSA | /sorting and searching/SquareRoot.cpp | UTF-8 | 551 | 3.40625 | 3 | [] | no_license | // { Driver Code Starts
#include <iostream>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int countSquares(int N) {
int count = 0;
for(int i = 1; i < sqrt(N); i++)
{
if(i*i < N)
count++;
}
return count;
}
};
... | true |
9002731c6b0934757f0f3caa1d9a4090f6f9730b | C++ | Abhijit-Dixit/Sports-Programming | /DisjointSetUnion.cpp | UTF-8 | 1,327 | 3.15625 | 3 | [] | no_license | vector<int> dsu; // the i'th index stores the parent of i if v[i] is positive, if v[i] is negative then i is its own parent...
int fin(int a){
vector<int> store;
while(dsu[a]>0){
store.push_back(a);
a=dsu[a];
}
for(int i=0;i<store.size();i++){
dsu[store[i]]=a;
}
return a... | true |
e0141d8f8d906e33a0412c975323e11dec2ec786 | C++ | whal0071/GameDevFrameWorkWhalen | /Resources/Images/Game/GameLayer.h | UTF-8 | 990 | 2.5625 | 3 | [] | no_license | //
// GameLayer.h
// GameDevFramework
//
// Created by Walter Whalen on 12-11-01.
// Copyright (c) 2012 Algonquin College. All rights reserved.
//
#ifndef __GameDevFramework__GameLayer__
#define __GameDevFramework__GameLayer__
#include <iostream>
#include "GameObject.h"
class GameLayer: public GameObject
{
/... | true |
4cb8c728f2fdcb5dec3aa7a332dcf40e237f7bbd | C++ | galeirb/Seletor_Automatizado_de_Resistores | /InterfacePC/ArdSlave/ArdSlave.ino | UTF-8 | 1,925 | 2.625 | 3 | [
"MIT"
] | permissive | #include <Wire.h>
const int analogPin = A7;
const int pin_qtd = 6;
const int qtd_amostra = 10;
String instrucao_rx;
const int pin[pin_qtd] = { 2, 3, 4, 5, 6, 7 };
const float r1[pin_qtd] = { 62.0, 221.0, 9780.0, 4620.0, 327.0 };
float ref;
char c;
int x;
void setup() {
Serial.begin(9600);
Wire.begin(15); // MEGA... | true |
893132c2c9695d85b54372aa7fde70606cd05dfe | C++ | chihyang/CPP_Primer | /chap07/Exer07_57.cpp | UTF-8 | 617 | 3.203125 | 3 | [
"Apache-2.0"
] | permissive | #include <string>
class Account {
public:
Account() = default;
Account(const std::string& s, double d) : owner(s), amount(d) {}
void calculate() { amount += amount * interestRate; }
static double rate() { return interestRate; }
static void rate(double);
private:
static constexpr int period = 30;... | true |
0599520dc29f7dc561d083fd534e28a10c3e61ca | C++ | suaebahmed/data-structure-in-C-and-Cpp | /cpp strings-stream/stringstream.cpp | UTF-8 | 1,073 | 3.3125 | 3 | [] | no_license | #include<iostream>
#include<sstream>
using namespace std;
int main()
{
int k_size,k_item;
string line;
//getline(cin,line);
//istringstream ss(line);
//ss >>k_size;
//for(int j=0; j<k_size; j++){
// ss >> k_item;
// cout<<" | "<<k_item;
//}
//istream& getline (char* s,... | true |
79897809c2aa055436d90fb546ec463a3ce63e9d | C++ | cyendra/ACM_Training_Chapter_One | /D - Game/main.cpp | UTF-8 | 1,079 | 2.515625 | 3 | [] | no_license |
#include <iostream>
#include <cstring>
using namespace std;
const int OO=1e9;
char s[1111];
char b[1111];
int n;
bool a[1111];
int main()
{
cin>>n;
cin>>s;
b[0]='1';
for (int i=1;i<n;i++)
{
if (b[i-1]=='0')
{
b[i]='1';
}
else if (b[i-1]=='1')
... | true |
62b10427edc3fb90007c38e62b9b4f8513eefa58 | C++ | joeyleeeeeee97/ministl | /Test/Test_map.h | ISO-8859-1 | 1,426 | 2.96875 | 3 | [] | no_license | #pragma once
#ifndef _TEST_MAP
#define _TEST_MAP
#include<map>
#include"Test_map.h"
#include"map.h"
#include"string.h"
#include<assert.h>
#include<random>
//TestCase cppreference
namespace ministl
{
void TestCase1()
{
ministl::map<char, int> mymap;
std::map<char, int > mymap1;
char c;
mymap['a'] = mymap1['a'... | true |
1dd68a6865f9e31ce0641f53bcdd65e822b68ed5 | C++ | mokkorin/sotukenProject | /Gauss.h | UTF-8 | 508 | 2.515625 | 3 | [] | no_license | #include <opencv\cv.h>
#include <opencv\highgui.h>
#define M_PI 3.1415926535897932384626433832795
class Gauss
{
public:
Gauss();
void dataSet(cv::Vec3d color, cv::Point p);
void dataClear(void);
void calcAverage(void);
void calcSigma(void);
void output(void);
double distribution(cv::Vec3d color);
bool isAveCa... | true |
a63f38789c85a26044bac83d311dec516fbba382 | C++ | black-shadows/Cracking-the-Coding-Interview | /Solutions/Chapter 8 Recursion/8.7.cpp | UTF-8 | 1,369 | 4.125 | 4 | [] | no_license | /*
* Q 8.7 Given an infinite number of quarters (25 cents), dimes (10 cents), nickels (5 cents) and pennies (1 cent),
* write code to calculate the number of ways of representing n cents.
*/
#include <iostream>
using namespace std;
int cnt = 0;
void sumN(int sum, int c, int n)
{
if (sum >= n)
{
if... | true |
03a36cd03b4eece2e78b7d1f98ea2f3df73fa083 | C++ | vtqtuan/mSIGNA | /src/setpassphrasedialog.cpp | UTF-8 | 2,093 | 2.625 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | ///////////////////////////////////////////////////////////////////////////////
//
// mSIGNA
//
// setpassphrasedialog.cpp
//
// Copyright (c) 2014 Eric Lombrozo
// Copyright (c) 2011-2016 Ciphrex Corp.
//
// Distributed under the MIT software license, see the accompanying
// file LICENSE or http://www.opensource.org/l... | true |
5805578c56cf641e402d37ac4f54bbc13fd26500 | C++ | os3llc/cloudsm | /src/common/xattr.cpp | UTF-8 | 3,791 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2020 nick_couchman.
*
* 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 applicable law or agreed... | true |
6585ad64cc816915ed8dcfcc1b9285ccc7b20816 | C++ | triffon/sdp-samples | /UnitTests/UnitTestCustomFramework/BoxTest.cpp | UTF-8 | 1,170 | 3.15625 | 3 | [] | no_license | /********************************************************************
*
* This file is part of the Data Structures in C++ Course Examples package.
*
* Author: Atanas Semerdzhiev
* URL: https://github.com/semerdzhiev/sdp-samples
*
*/
#include "UnitTestFramework.h"
#include "..\Box\Box.h"
TEST_FUNCTION(CreateEm... | true |
475df84f2ac0de1bd24ee9aa8d3013e30621c127 | C++ | shvrd/shvrdengine | /src/library/components/Entity.cpp | UTF-8 | 464 | 2.625 | 3 | [] | permissive | //
// Created by thekatze on 15/12/2018.
//
#include "Entity.h"
Entity::Entity()
: m_components()
, m_finalized(false) {
}
void Entity::update() {
for (auto& component : m_components) {
component->update();
}
}
void Entity::render() {
for (auto& component : m_components) {
compo... | true |
3f4551d0fca40f65026925593022e6eef34fe185 | C++ | Ckend/myLeetcode | /12. Integer to Roman/12. Integer to Roman/main.cpp | UTF-8 | 741 | 3.328125 | 3 | [] | no_license | //
// main.cpp
// 12. Integer to Roman
//
// Created by ckend on 2017/1/25.
// Copyright © 2017年 ckend. All rights reserved.
//
#include <iostream>
class Solution{
public:
std::string intToRoman(int num){
std::string M[] = {"", "M", "MM", "MMM"};
std::string C[] = {"", "C", "CC", "CCC", "CD", "... | true |
d2b00564731dc7e88f138223d7cd8dc09f0cde51 | C++ | evanwills/artbot | /libraries/Evan__drawing-Machine-III/Evan_Circle-Manager.cpp | UTF-8 | 7,563 | 3.421875 | 3 | [] | no_license | // ==================================================================
// How it should work:
// 1.
// 2. for each child,
// 2.a. get radiusPointX & radiusPointY
// 2.b. rotate radiusPointX & radiusPointY around current
// orginX & orginY
// 2.c. send new radiusPointX & radiusPointY back to child
// 3. repeat s... | true |
d1e906bce84fb09a68e6bcaf99588e52659f0cbf | C++ | westongaylord/okyesno | /Lexicon.cpp | UTF-8 | 2,609 | 3.5 | 4 | [] | no_license | #include <iostream>
using namespace std;
typedef struct node {
bool isWord;
node *children[26];
} node;
private:
node *root;
bool recContainsPrefix(string prefix, node *curr);
bool recContains(string word, node *curr);
Lexicon::Lexicon() {
node *root = new node();
root->isWord = false;
for(int i = 0; i < n... | true |
4e029138c4413270b104353f92f98dcb0ed6fc02 | C++ | Joeycama/CamachoJoseph_2524304 | /Project/Project%201/Project 1/main.cpp | UTF-8 | 7,390 | 3.703125 | 4 | [] | no_license | /*
File: main
Author: Joseph Camacho
Created on October 25th, 2016, 12:00 PM
Purpose: Project 1
*/
//System Libraries
#include <iostream> //Input/Output objects
#include <cstdlib> //Random number generator
#include <ctime> //Time
using namespace std; //Name-space used in the Syst... | true |
ef49be27c899d5645db63df14f2a9cb3fe6d35e4 | C++ | chrystallagh/HavadjiaChrystalla_CSC17a_42824 | /Homework/Assignment 1 /Gaddis_Probl3.13/main.cpp | UTF-8 | 767 | 3.625 | 4 | [] | no_license | /*
* File: newmain.cpp
* Author: chrystallahavadjia
* Created on February 22, 2016, 8:42 PM
* Purpose: Convert U.S. dollars to Yen and Euro
* 3.13
*/
//System Libraries
#include <iostream>
using namespace std;
//User Libraries
//Global Constants
//Function Prototypes
//Execution Begins Here
int main()
{
... | true |
923f062cba4da342feb518150426bfeb3a6e56ea | C++ | danymtz/C-Course-for-begginers | /02.- Imprimir en pantalla.cpp | ISO-8859-1 | 647 | 3.109375 | 3 | [] | no_license | //Directivas de preprocesador
#include <stdio.h> //Librera stdio: incluye la funcin "printf()"
#include <conio.h> //Librera conio: incluye la funcin "getch()"
//Funcin: programa principal
void main()
{ //Inicia programa
printf("Hola, ... | true |
a27ae6c63c52122ab9614355f414fa58b127e153 | C++ | armmah/LeetcodeProblems | /p441.cpp | UTF-8 | 1,345 | 3.296875 | 3 | [] | no_license | #include "LeetCodeProblem.h"
class p441 : public LeetCodeProblem {
int arrangeCoins(int n) {
// Sk = k / 2 (2 * a + (k - 1)d), where d = 1 and a = 1
// k (k + 1) = 2 n
// k ^ 2 + k - 2n = 0
// D = b ^ 2 - 4ac = 1 - 4 * (-2n) = 1 + 8n
// 2k = -1 + sqrt(1 + 8n) negat... | true |
4fc4d181ec220ecc7ce8c421ad580d24e90cb1cb | C++ | yiboyang/quantize1d | /quantize1d.h | UTF-8 | 14,946 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <parallel/algorithm>
#include <unordered_set>
/* Fast 1d quantization methods
* Currently supports k-means. dp-means would require std::vector for cluster_centers (see original C++ implementation)
* k... | true |
584013bc1ccfee6c9c3154125ca6de6a9800f6ff | C++ | lilinhan/code | /c++11/for_each5.cpp | UTF-8 | 603 | 2.875 | 3 | [] | no_license | /*************************************************************************
> File Name: for_each5.cpp
> Author: lewin
> Mail: lilinhan1303@gmail.com
> Company: Xiyou Linux Group
> Created Time: Mon 16 Nov 2015 13:33:16 CST
************************************************************************/
... | true |
9f242016152a210fcb26c430041185a402dbfa46 | C++ | vshcryabets/AndroidFTDI | /arduino/DigitalVoltmeter/DigitalVoltmeter.ino | UTF-8 | 940 | 2.828125 | 3 | [] | no_license | //electronicsblog.net
//http://www.electronicsblog.net/digital-voltmeter-arduino-ant-pc-visual-c-comunication-via-serial-port/
//Arduino communication with PC via serial port.
int voltage=0;
int channel =0;
unsigned char incomingByte = 0;
boolean measure=false;
void setup() {
Serial.begin(9600);
}
void loop() { ... | true |
9737efdd40c541d6028aaf5023d3f1c32b74bb2b | C++ | MIPT-ILab-Compilers/mipt-scheme-compiler | /sources/Frontend/interpreter/activation.hpp | UTF-8 | 683 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | /**
* @file:activation.hpp
* Activation class.
*/
/**
* Copyright 2012 MIPT-COMPILER team
*/
#pragma once
#include "../parser/ast.hpp"
#include <map>
#include <boost/shared_ptr.hpp>
namespace interpreter
{
using parser::ast::Nodep;
using parser::ast::Ident;
using parser::ast::IdentIdType;
class Activation;... | true |
8aaa4169f73492a2e0c3a16ff7d9810e97cdedb0 | C++ | SpintroniK/eXaDrums | /Source/Widgets/TriggerIdAndLocation.h | UTF-8 | 1,147 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | /*
* TriggerIdAndLocation.h
*
* Created on: 4 Dec 2016
* Author: jeremy
*/
#ifndef SOURCE_WIDGETS_TRIGGERIDANDLOCATION_H_
#define SOURCE_WIDGETS_TRIGGERIDANDLOCATION_H_
#include <gtkmm/grid.h>
#include <gtkmm/label.h>
#include <gtkmm/comboboxtext.h>
#include <memory>
#include <vector>
#include <string>
n... | true |
c30b88c2076f2b150856de3680064f73c6b03c32 | C++ | RKMVCC-BSc-Comp-Sci-2020-21/Programming-C-Cpp-Sem1 | /March/Swapping of two number using third variable.cpp | UTF-8 | 220 | 3.03125 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int a=10,b=20,c;
cout<<"Before swapping a="<<a<<" and b="<<b<<"\n";
c=a;
a=b;
b=c;
cout<<"After swapping a="<<a<<" and b="<<b<<"\n";
}
| true |
bd456ee80f132774e57f55e70fb5a1068e895c09 | C++ | thinkrobotics/TUTORIALS | /Four Degrees of Freedom Robotic Arm/4dof_arm.ino | UTF-8 | 1,679 | 2.9375 | 3 | [] | no_license | #include<Servo.h>
Servo s1;
Servo s2;
Servo s3;
Servo s4;
int s1angle = 95;
int s2angle = 80;
int s3angle = 30;
int s4angle = 90;
void ServoControl(Servo k, int startangle, int stopangle, int speedangle)
{
if (startangle < stopangle)
for (int i = startangle; i <= stopangle; i++)
{
k.writ... | true |
52faf81671214137b6a2aad3585eb0cfa3d0b9bc | C++ | jfcaraujo/viage-poupe | /src/comboios.h | UTF-8 | 779 | 2.65625 | 3 | [] | no_license | /*#ifndef _COMBOIOS_H
#define _COMBOIOS_H
#include <string>
#include <vector>
class Comboio {//outras caracteristicas?
protected:
int lotacao;
bool ocupado;//se ja tem uma viagem atribuida
public:
int getlotacao();
virtual string getInformacao();
bool getOcupado();
virtual ~Comboio(){};
};
class AlfaPendular... | true |
af885d66e11c65cb723e56f61bbafa92196b0430 | C++ | wangli-cn/online-judge-libs | /string/palindrome_partition_II.cc | UTF-8 | 1,423 | 3.421875 | 3 | [] | no_license | //============================================================================
// Palindrome Partitioning II
// Given a string s, partition s such that every substring of the partition¿
// is a palindrome.
//
// Return the minimum cuts needed for a palindrome partitioning of s.
//
// For example, given s = "aab",
// Re... | true |
4161e6fedbef7b278ce2cca8a562ceca9e638d86 | C++ | echoht/leetcodes | /50_myPow.cpp | UTF-8 | 627 | 3.21875 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<sstream>
#include<math.h>
using namespace std;
// -100.0 < x < 100.0
//n is a 32-bit signed integer, within the range [−2^31, 2^31 − 1]
double powImp(double x, long n){
if(n == 0){
return 1;
}
if(n == 1){
return x;
}
d... | true |
828799937e3bda5969d22a1cae2e6d1c0930a2ec | C++ | JanSpiesZA/SRF02 | /SRF02.ino | UTF-8 | 2,454 | 2.984375 | 3 | [] | no_license | //First experiments in using the SRF02 with SERIAL comms
//Allows distance measurements to be sent via Serial to PC
#define CMD_REAL_RANGE_TX_cm 84
#define CMD_REAL_RANGE_NO_TX_cm 81
#define CMD_GET_RANGE 94
int sendflag = 1;
String readString;
int oldTime = 0;
String serialData = "";
boolean done ... | true |
517ba6d8f1be55b4fd70344f0b5968f27a6769c0 | C++ | darwin/inferno | /src/cgcw/inilib/int_attribute.cc | UTF-8 | 6,380 | 2.796875 | 3 | [
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | //
// This software may only be used by you under license from the
// University of Notre Dame. A copy of the University of Notre Dame's
// Source Code Agreement is available at the inilib Internet website
// having the URL: <http://inilib.sourceforge.net/license/> If you
// received this software without first enteri... | true |
1a75b6aeb6b0c8ced8edd24b4dd21b08e3fe0c9b | C++ | a930736/c-object-oriented-programming | /ex05.cpp | UTF-8 | 1,249 | 3.5625 | 4 | [] | no_license | //
// main.cpp
// ex04
//
// Created by Peter on 2021/1/5.
// Copyright © 2021 Peter. All rights reserved.
//
//類別與結構實作
#include <iostream>
#include <cstdlib>
using namespace std;
struct Data
{
char name[10];
int height;
};
class Date
{
private:
int year;
int month;
int day;
public:
void ... | true |
fe27f89fbea17d8cff2addc41f7117227a8f5c47 | C++ | nWhitcome/Wireless-MIDI | /Server/final_server.cpp | UTF-8 | 3,816 | 2.703125 | 3 | [] | no_license | #include <io.h>
#include <stdio.h>
#include <winsock2.h>
#include <windows.h>
#include <mmsystem.h>
#pragma comment(lib,"ws2_32.lib") //Winsock Library
#define DEFAULT_BUFLEN 512
void RemoveChars(char *s, char c);
char* concat(const char *s1, const char *s2);
char* swapChars(char * input);
int main(int argc , char *... | true |
029a2e9f0c4979bc2805cd577fde807d470bccc3 | C++ | Farrius/cp | /codeforces/edu_forces/segment_tree/chap2/b.cpp | UTF-8 | 1,448 | 2.671875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
struct segtree {
int sz = 1;
vector<int> seg;
void init (int n) {
while (sz < n) sz *= 2;
seg.assign(sz * 2, 0);
}
void build (vector<int>& ar, int x, int lx, int rx) {
if (rx - lx == 1) {
if (lx < (int) ar.siz... | true |
bcbe098603656795c17419925b94839d9b09ed59 | C++ | Diptendu28/myCprogram | /pattern 34.cpp | UTF-8 | 315 | 2.8125 | 3 | [] | no_license | /* *********
**** ****
*** ***
** **
* * */
#include<stdio.h>
int main()
{
int i,j,k,s,p=1;
for(i=5;i>=1;i--)
{
for(j=1;j<=i;j++)
{
printf("*");
}
for(k=1;k<=2*p-3;k++)
{
printf(" ");
}
for(s=i;s>=1;s--)
{
if(s<5)
printf("*");
}
printf("\n");
p++;
}
}
| true |
35acb49ce54f60cfbc6f2abb303fd9f165e42507 | C++ | jamillosantos/mote-vision | /src/data/colour.h | UTF-8 | 2,410 | 3.265625 | 3 | [
"MIT"
] | permissive | /**
* @author J. Santos <jamillo@gmail.com>
* @date July 24, 2016
*/
#ifndef MOTE_VISION_COLOUR_H
#define MOTE_VISION_COLOUR_H
#include <cstdint>
#include "serializable.h"
#include "pixel.h"
namespace mote
{
namespace data
{
/**
* Colour abstrction on the system.
*/
class Colour
: public Serializable
{ };
/*... | true |
ed00eb11af1f702362ac74e858a3a81d63a6c7bd | C++ | svalenciasan/IdealGasSimulator | /include/visualizer/histogram.h | UTF-8 | 1,462 | 2.578125 | 3 | [] | no_license | #pragma once
#include "cinder/gl/gl.h"
#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "core/particle.h"
#include "core/particle_manager.h"
#include <vector>
#include <map>
using std::string;
using std::vector;
using std::map;
using glm::vec2;
using idealgas::particle::Particle;
using idealgas... | true |
e955b66a5eec37b5d65a9f79d7290f18ec22e407 | C++ | NamKim-il/BOJ-list | /Solved/11438.cpp | UTF-8 | 1,315 | 2.515625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
typedef struct nod{
int parent;
int height;
}node;
bool check[200005];
vector< pair<vector<int>,node>> n(200005);
int bfs()
{
queue<int> qu;
int ind;
qu.push(1);
check[1]=true;
while(!qu.empty())
{
ind=qu.front();
qu.pop();
... | true |
9e684a6760ca785d20e00d074aaf11a1892c6984 | C++ | adamk33n3r/Icarus | /Engine-Core/src/maths/Vector3.cpp | UTF-8 | 2,640 | 3.375 | 3 | [] | no_license | #include "Vector3.h"
namespace icarus {
namespace maths {
const Vector3 Vector3::up = Vector3(0, 1, 0);
const Vector3 Vector3::down = Vector3(0, -1, 0);
const Vector3 Vector3::left = Vector3(-1, 0, 0);
const Vector3 Vector3::right = Vector3(1, 0, 0);
const Vector3 Vector3::forward = Vector3(0, 0, 1);
con... | true |
aabf9f908664e925dbcb2d7932b6441e815522ca | C++ | OZoneSQT/Data-Structures-and-Algorithms | /BuildTree/BuildTree.cpp | UTF-8 | 3,294 | 4.0625 | 4 | [] | no_license | // BuildTree.cpp : Defines the entry point for the console application.
//
/* program to construct tree using inorder and preorder traversals */
#include <ostream>
#include <stdio.h>
#include <stdlib.h>
/* A binary tree node has data, pointer to left child
and a pointer to right child */
struct node
{
char data;
st... | true |
6449ae8802a2fc396f345c1973836e3f8148b42f | C++ | EndoYuuki/GraphNN | /test/graphnn_classifier_test.cpp | UTF-8 | 2,669 | 2.640625 | 3 | [] | no_license | #include <gtest/gtest.h>
#include <Eigen/Core>
#include "GraphNNClassifier.hpp"
#include "DatasetManager.hpp"
#include "GraphNNLearnableParameter.hpp"
#include "FileGraphGenerator.hpp"
class GraphNNClassifierTest : public ::testing::Test {
protected:
GraphNNClassifierTest() :
classifier(2)
... | true |
e2700e26fadc810e99d43f61e8ff2aa33ead5b52 | C++ | oriariel/binarytree-a | /Test.cpp | UTF-8 | 1,024 | 2.921875 | 3 | [] | no_license | #include "doctest.h"
#include "BinaryTree.hpp"
TEST_CASE("FIRST TEST"){
ariel::BinaryTree<int> tree;
CHECK_NOTHROW(tree.add_root(0));
CHECK_NOTHROW(tree.add_root(1));
CHECK_NOTHROW(tree.add_root(2));
CHECK_NOTHROW(tree.add_root(-3));
CHECK_NOTHROW(tree.add_root(10000));
CHECK_NOTHROW(tree.add_root(-5));
CHECK_THROWS(... | true |
5787dfd0c0304a88c40d591e4454d2bc2e73f378 | C++ | Mat-Arnold/Flight-Computer-v01 | /Teensy_KalmanFilter/src/quatFunctions.cpp | UTF-8 | 3,490 | 2.984375 | 3 | [] | no_license | // Functions to be used to manipulate or convert quaternions for Kalman filter
#include <Eigen.h>
#include <Eigen/Dense>
#include "quatFunctions.h"
#include <cmath>
Matrix3d rotFromQuat(const Vector4d& lam)
{
//build output matrix
Matrix3d output;
output << (pow(lam(0),2) + pow(lam(1),2) - 0.5), (la... | true |
e55d64129af1fd4565058f3347b3f016f11265f5 | C++ | andyspb/cpp-test | /src/algoritms/find_sum_overlapping_intervals.h | UTF-8 | 1,828 | 3.234375 | 3 | [] | no_license | /*
* find_sum_overlapping_intervals.h
*
* Created on: 30 ���. 2015 �.
* Author: andy
*/
#ifndef FIND_SUM_OVERLAPPING_INTERVALS_H_
#define FIND_SUM_OVERLAPPING_INTERVALS_H_
#include <algorithm>
#include <iostream>
#include <stack>
namespace find_sum_overlapping_intervals {
struct Interval {
Interval(int... | true |
8733cfe9df8b57e859e2d8731aa57e839223dad1 | C++ | SMiles02/CompetitiveProgramming | /Codeforces/CF 500 - 599/CF0527/CF527/CF527A.cpp | UTF-8 | 498 | 2.578125 | 3 | [] | no_license | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int index(int numToFind, std::vector<int> vectorToFindIn) {int len = vectorToFindIn.size();for (int i = 0; i < len; i++){if (vectorToFindIn[i] == numToFind){return i;}}return -1;}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
ll a,b,ans;
... | true |
38427d478615b7a10c8594e39b8eef1f89ff86cc | C++ | TomWang10/LeetCode | /22_Generate_Parenttheses.cc | UTF-8 | 712 | 3.75 | 4 | [] | no_license | #include <string>
#include <vector>
#include <iostream>
using namespace std;
class Solution {
public:
vector<string> generateParenthesis(int n) {
vector<string> result;
Helper(result, "", 0, 0, n);
return result;
}
void Helper(vector<string>& result, string curr, int open, int close, int max) {
if (c... | true |
9eaf971b74f668a99e0e32fb386f5eb2645486a6 | C++ | hanyuelaoda/leetcode | /file/动态规划/零钱兑换.cpp | UTF-8 | 1,013 | 3.15625 | 3 | [] | no_license | /*
给定不同面额的硬币 coins 和一个总金额 amount。编写一个函数来计算可以凑成总金额所需的最少的硬币个数。
如果没有任何一种硬币组合能组成总金额,返回 -1。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/coin-change
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
//动态规划,自顶向下
class Solution
{
public:
vector<int> table;
int coinChange(vector<int>& coins, int amount)
{
if (amount < 1) retu... | true |
caf1899407ccd86eb2af963fbd4e2a968f0874cc | C++ | cos65535/ICPCLibrary | /Geometry/Intersect.cpp | UTF-8 | 1,405 | 3.015625 | 3 | [] | no_license | bool intersectLL(const Line &l, const Line &m) {
return abs(cross(l[1] - l[0], m[1] - m[0])) > EPS ||
abs(cross(l[1] - l[0], m[0] - l[0])) < EPS;
}
bool intersectLS(const Line &l, const Line &s) {
return cross(l[1] - l[0], s[0] - l[0]) *
cross(l[1] - l[0], s[1] - l[0]) < EPS;
}
bool intersectLP(... | true |
4cd8a3873c32519285d2da72d26444d5fef54de7 | C++ | PratikChakraborty10/Data-Structures-and-Algorithms | /Linked List/arrangeLL.cpp | UTF-8 | 2,035 | 4.375 | 4 | [] | no_license | // Even after Odd LinkedList
// For a given singly linked list of integers, arrange the elements such that all the even numbers are placed after the odd numbers. The relative order of the odd and even terms should remain unchanged.
// Note :
// No need to print the list, it has already been taken care. Only return the ... | true |
b70be64d8e84622d3d5bec74bb59774d51cddfad | C++ | jeroennelis/VR_engine | /VR Engine/src/ModelTexture.h | UTF-8 | 968 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include "Texture.h"
class ModelTexture :
public Texture
{
private:
float m_ShineDamper = 1;
float m_Reflectivity = 0;
bool m_Transparancy = false;
bool m_FakeLighting = false;
int m_NrOfRows = 1;
public:
ModelTexture(const std::string& path);
~ModelTexture();
inline float GetShineDamper() con... | true |
14d37b1cf2866b43b68a1807b138b64358f4247f | C++ | Arsenic25/Primitive-Extended-Kalman-filter | /example/estimate attitude with IMU/EKF.hpp | UTF-8 | 2,916 | 2.875 | 3 | [] | no_license | /*
* EKF.h
*
* Created on: 2018/12/18
* Author: Arsenic
*/
#ifndef EKF_HPP_
#define EKF_HPP_
#define PI 3.1415926535
#include "Eigen/Core.h"
#include "Eigen/LU.h"
#include "math.h"
using namespace Eigen;
class EKF {
private:
public:
//constructor
EKF() {
initialX();
initialPreP();
initialQ();
initia... | true |
047e506c34734bb010b5c06abfebee4a5e0da004 | C++ | tov/ge211 | /include/ge211/util/to_string.hxx | UTF-8 | 690 | 3.515625 | 4 | [] | no_license | #pragma once
#include <ostream>
#include <sstream>
#include <string>
namespace util {
namespace format {
namespace detail {
inline void
concat_to(std::ostream&) { }
template <typename FIRST, typename... REST>
void
concat_to(std::ostream& buf, FIRST const& first, REST const& ... rest)
{
buf << first;
concat_... | true |