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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
151507e9d3158ad4590ed0ef352d11f52ea59e7e | C++ | Bernat417/TFG | /Code/CSV_handler.cpp | UTF-8 | 428 | 3.03125 | 3 | [] | no_license | #include "CSV_handler.hpp"
void CSV_handler::save_csv_file(string filename, vector<vector<string> > lines)
{
ofstream File (filename); //Opening file to print info to
if(lines.size() >= 1)
for(int j = 0; j < lines[0].size(); ++ j)
{
for(int i = 0; i < (lines.size()-1); ++i)
Fil... | true |
64af586850ef4ec78bbdefce1c59ad05cf1b047f | C++ | Vaa3D/vaa3d_tools | /released_plugins/v3d_plugins/bigneuron_siqi_stalker_v3d/lib/ITK_include/itkMinimumDecisionRule.h | UTF-8 | 2,286 | 2.515625 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | /*=========================================================================
*
* Copyright Insight Software Consortium
*
* 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
*
* h... | true |
032c4b53eef8823a7cd55b0b3df84632dac75f94 | C++ | marcelomrocha/projetos_fisicarduino | /Psx_Servo/Psx_Servo/Psx_Servo.ino | UTF-8 | 2,676 | 2.671875 | 3 | [] | no_license | /* PSX Controller Decoder Library (Psx.pde)
Written by: Kevin Ahrendt June 22nd, 2008
Controller protocol implemented using Andrew J McCubbin's analysis.
http://www.gamesx.com/controldata/psxcont/psxcont.htm
Shift command is based on tutorial examples for ShiftIn and ShiftOut
functions both written by Carlyn ... | true |
2430963fd9790867e3a2e12beff2ff095d1b4429 | C++ | tbake0155/xQueueSys | /xqueuesys/src/priority_queue/src/process.h | UTF-8 | 3,292 | 3.34375 | 3 | [] | no_license | /*
* process.h - class declaration for Process object
*/
#ifndef PROCESS_H_INCLUDED
#define PROCESS_H_INCLUDED
#include <iostream>
class Process
{
private:
int status_num; // enumerate status for sorting
int nice; // process priority
pid_t pid; ... | true |
7a58bde5b1c7f5be1ebbf5ef49569eb94f56cdbf | C++ | q279003765/CppPrimerPlus6th | /CppPrimerPlus6th/list_6_9_condit.cpp | UTF-8 | 521 | 3.296875 | 3 | [] | no_license | //
// list_6_9_condit.cpp
// CppPrimerPlus6th
//
// Created by xxin on 2020/10/26.
// Copyright © 2020 xxin. All rights reserved.
//
#include "list_6_9_condit.hpp"
#include <iostream>
int condit();
/*
*
int main()
{
condit();
}
*/
int condit()
{
using namespace std;
int a,b;
cout << "Ente... | true |
a99a1e2c0a5b3dfa1c105cca1034be958e3201b1 | C++ | 1m188/playbricks | /playbricks_qt5/src/scene/DifficultyChooseScene.cpp | UTF-8 | 2,772 | 2.75 | 3 | [] | no_license | #include "DifficultyChooseScene.h"
#include "Director.h"
#include "StartScene.h"
#include "GameScene.h"
#include "QLabel"
#include "QPushButton"
#include "QGridLayout"
DifficultyChooseScene::DifficultyChooseScene(Window *parent) : Scene(parent)
{
}
DifficultyChooseScene::~DifficultyChooseScene()
{
}
void DifficultyC... | true |
dfa58b4d770c8117b7d3b7083c9c28f1076eab8b | C++ | schmcory/CS162 | /Project2_Schmidt_Cory/zoo.cpp | UTF-8 | 7,270 | 3.203125 | 3 | [] | no_license | /*********************************************************************
** Author: Cory Schmidt
** Date: 02/05/2018
** Description: "zoo.cpp" is the Zoo class implementation file
*********************************************************************/
#include <ctime>
#include <iostream>
#include <cstdlib>
using name... | true |
9a34b1ec77d592738de3c4134639eefc431c2e4d | C++ | deletestvn/Leetcode | /src/Learn/LinkedList/addTwoNumbers.cpp | UTF-8 | 1,188 | 3.359375 | 3 | [] | no_license | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* addTwoNumbe... | true |
607bd1875f63d42eb96403d0372d9d1ef3b8b18d | C++ | JoshuaMartinez30/C-_TDH_2 | /hanoi_ascii.cpp | UTF-8 | 2,180 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
using namespace std;
void impresion(int *M, int f, int colum, int numero){
int esp;
for (int i = colum - 1; i >= 0; i--){
for (int j = 0; j < f; j++){
esp = (numero - M[colum * j + i]) / 2;
for (int k = 0; k < esp; k++){
cout... | true |
0e3b67cdd40368009af9df03ece98227948f846d | C++ | profeIMA/Exercicis-Programacio | /Exercicis_POO/Exercici6_VectorPunt2D/Vector_punt2D.h | UTF-8 | 1,513 | 3.453125 | 3 | [] | no_license | /* Vector de punts 2D ordenat de menor a major distància a l'origen (si la distància és igual cal ordenar segons coordenada x)
*/
#ifndef Vector_punt2D_h
#define Vector_punt2D_h
#include "Punt2D.h"
class Vector_punt2D {
// Descripció: vector de punts 2D ordenat de menor a major distància a l'origen (si la distància ... | true |
c7444888595fb62f447905952b5300ba749b20ac | C++ | take-pwave/lbed | /CCS_LBED_MAIN/samples/TestTone.cpp | UTF-8 | 472 | 2.640625 | 3 | [] | no_license | #include "lbed.h"
#include "Tone.h"
int main(void) {
int tones[]={262,294,330,392,440}; // C, D, E, G, A
int toneDuration = 500;
Serial pc(PA_1, PA_0);
Tone tone(PB_5); // T1CCP1
DigitalOut myled(LEDR);
pc.baud(19200);
tone.noTone();
pc.println("Input number");
while (1) {
char c = pc.r... | true |
2d4ddd603ced5a03f9b5c21ff7e1c26062bac9a8 | C++ | Soumya117/binarySearchTree | /BinaryTree.h | UTF-8 | 696 | 3.21875 | 3 | [] | no_license | #include <vector>
namespace binaryTree {
class BinaryTree {
private:
struct Node {
int data;
Node *left;
Node *right;
};
Node *root;
Node *createNode(const int& data);
void addLeftChild(Node *, const int&);
void addRightChil... | true |
ba53f01a97a666f46f72be0c07f4d4763c864316 | C++ | 100sarthak100/DataStructures-Algorithms | /Code/Trees/sumRootToTreeNumbers.cpp | UTF-8 | 1,368 | 3.71875 | 4 | [] | no_license | // Given a binary tree containing digits from 0-9 only,
// each root-to-leaf path could represent a number.
// An example is the root-to-leaf path 1->2->3 which represents
// the number 123.
// Find the total sum of all root-to-leaf numbers.
// Note: A leaf is a node with no children.
// Input: [1,2,3]
// 1
/... | true |
0583bb060fd629f912b7d0585a5e61307835f75d | C++ | wcysai/CodeLibrary | /POJ/3532.cpp | UTF-8 | 2,895 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
#define LL long long
#define MAX_N 20 + 8
int A, B, N, M;
LL C[MAX_N][MAX_N];
// 生成组合数
void build_combinatorial_number()
{
for (int i = 0; i < MAX_N; ++i)
{
C[i][0] = C[i][i] = 1;
for (int ... | true |
93e272d850b80192c008f9ddaf1b8d768395516a | C++ | anupraas/SearchTextCPPProject | /Search Text/Search Text/Logger.cpp | UTF-8 | 1,745 | 2.8125 | 3 | [] | no_license | //
// Logger.cpp
// Search Text
//
// Created by Prakhar Mehrotra on 28/07/17.
// Copyright © 2017 Prakhar Mehrotra. All rights reserved.
//
#include "Logger.hpp"
std::shared_ptr<Logger> Logger:: instance(nullptr);
Logger::Logger()
{
}
Logger::~Logger()
{
}
std::string Logger::getCurrentTime()
{
... | true |
b9027f259e246e33164ff2867245251004de6521 | C++ | APVerlan/Algorithms-and-Data-Structure-coursera-specialization- | /Data Structures/week4_binary_search_trees/2_is_bst/is_bst.cpp | UTF-8 | 1,703 | 3.5625 | 4 | [] | no_license | #include <algorithm>
#include <iostream>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
struct Node {
int key;
int left;
int right;
Node() : key(0), left(-1), right(-1) {}
Node(int key_, int left_, int right_) : key(key_), left(left_), right(right_) {}
};
bool in_or... | true |
c11a90392478340755f9445a2d4fd19704d27407 | C++ | CompPhysics/ComputationalPhysics | /doc/Programs/LecturePrograms/programs/MPI/chapter07/program5.cpp | UTF-8 | 1,371 | 2.8125 | 3 | [
"CC0-1.0"
] | permissive | // Reactangle rule and numerical integration usign MPI, example 1, send and Receive
using namespace std;
#include <mpi.h>
#include <iostream>
int main (int nargs, char* args[])
{
int numprocs, my_rank, i, n = 1000;
double local_sum, rectangle_sum, x, h;
// MPI initializations
MPI_Init (&nargs,... | true |
c0a0f365506fd7cd32e0fac0e28772e1202782bc | C++ | Jonariguez/ACM_Code | /HDU/2031.cpp | UTF-8 | 609 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <math.h>
using namespace std;
string transform(int x,int y,string s){
string res="";
int sum=0;
for(int i=0;i<s.length();i++){
if(s[i]=='-') continue;
if(s[i]>='0' && s[i]<='9')
sum=sum*x+s[i]-'0';
else
sum=sum*x+s[i]-'A'+10;
}
while(sum){
char temp=sum... | true |
354d5b3b1c47708abb7512a90ddb00d07cf64bd5 | C++ | andre-bergner/funky | /funky/test.cpp | UTF-8 | 5,877 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | #include <tuple>
#include <functional>
#include <type_traits>
#include <memory>
#include <iostream>
template <typename Type>
using remove_rvalue_reference_t = std::conditional_t
< std::is_rvalue_reference<Type>::value
, std::remove_refer... | true |
38969bce3e0a3938f7f75fe5ec5d01870f924f0e | C++ | ddaletski/labs | /c++/charset/charset.cpp | UTF-8 | 4,516 | 2.984375 | 3 | [] | no_license | #include "charset.h"\
#define SET_SIZE 256
void charSet::_realloc() {
if(_refersTo && _refersTo->_refCount == 0)
_refersTo = NULL;
if(_refCount || (_refersTo && _refersTo->_refCount)){
bitArray* tmp = new bitArray(SET_SIZE);
*tmp = *_arr;
_arr = tmp;
_refCount = 0;
... | true |
6f218a296c40d41a020f14b37a85d50e3bd72996 | C++ | forgottencsc/ICPC | /Problems/repeatersVII/gen.cpp | UTF-8 | 1,257 | 2.6875 | 3 | [] | no_license | #include <bits/stdc++.h>
#include "../generator.h"
using namespace std;
void gen(int& id, const string& s, int t) {
ofstream cout(to_string(++id) + ".in");
cout << s << endl << igr(t / 2, t) << endl;
cout.close();
}
void gen_batch(int& id, int n, int t) {
gen(id, sqgp(n, "1111122211111", 0.001, '3', '... | true |
5d20b3108ec8c1f232c622b2a15989a877b9e5de | C++ | icerove/rosalind | /dna/main.cpp | UTF-8 | 746 | 3.25 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <streambuf>
void ComplementingStrandOfDNA(std::ifstream &input, std::ofstream &output) {
// std::string str((std::istreambuf_iterator<char>(input)),
// std::istreambuf_iterator<char>());
int result[20] = {0};
char c;
wh... | true |
ead0083aa8502e4706ad6a24534927948683a98f | C++ | Steve132/rs_led | /m_led/LedStripRS.cpp | UTF-8 | 484 | 3 | 3 | [
"MIT"
] | permissive | #include <avr/pgmspace.h>
uint32_t brighten(uint32_t color,uint8_t brightness)
{
uint32_t out=0;
uint32_t r;
r=color & 0xFF;
r*=brightness;
r>>=8;
r++;
out |= r;
r=(color >> 8) & 0xFF;
r*=brightness;
r>>=8;
r++;
out |= r << 8;
r=(color >> 16) & 0xFF;
r*=brightness;
r>>=8;
r++;
out |= r << 16;
retu... | true |
a06eabea0436b960142a69421c5bf14749e1dc77 | C++ | BCLab-UNM/Swarmathon-MC-Public | /src/hive/src/Cluster.cpp | UTF-8 | 2,285 | 3.40625 | 3 | [] | no_license | #include "Cluster.h"
Cluster::Cluster(std::string robotName, float clusterX, float clusterY, int numberOfRobots){
this->robotThatFoundCluster = robotName;
assignedRobots.push_back(robotName);
this->clusterX = clusterX;
this->clusterY = clusterY;
this->confirmCount = 0;
this->notConfirmCount ... | true |
1139def2bb98cb853f553dc9ca500fd4291a44b8 | C++ | chandrarishabh/spoj-solutions | /POTHOLE.cpp | UTF-8 | 1,449 | 2.84375 | 3 | [] | no_license | //FORD_FULKERSON MAX FLOW
#include<bits/stdc++.h>
#define debug(x) cout<<#x<<" = "<<x<<endl;
using namespace std;
int n,m;
int graph[1000][1000]={0};
int paths[1000][1000]={0};
int parent[1000] = {0};
bool findpath(int s, int t)
{
bool visited[1000];
memset(visited,false,sizeof(visited));
queue<int> q;
q.push(s);
... | true |
de55823b0ece49aaea4377b23ef5a6b205e04b87 | C++ | PigGao/leetcode | /43-MultiplyStrings.cpp | UTF-8 | 817 | 2.875 | 3 | [] | no_license | class Solution {
public:
string multiply(string num1, string num2) {
int m = num1.length()-1;
int n = num2.length()-1;
int pos[m+n+2] = {0};
for(int i=m;i>=0;i--)
for(int j=n;j>=0;j--)
{
int mul = (num1[i]-'0')*(num2[j]-'0');
in... | true |
49fecda96c94c2fd9462413a0f8aec23102ae3d3 | C++ | ayushkhanduri/dsa-algo | /Platforms/LeetCode/utils/LeetCode.hpp | UTF-8 | 1,213 | 3.6875 | 4 | [] | no_license | #pragma once
#include "iostream"
#include "vector"
using namespace std;
class ListNode {
public:
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
class Utility {
public:
static ListNode* creat... | true |
28e58bfb4deebda568f496aa989ff2990023fb2c | C++ | oguzhancevik/Cplusplus | /Dairenin Çevresini ve Alanını Bulma.cpp | UTF-8 | 477 | 3.203125 | 3 | [] | no_license | #include <iostream>
using namespace std;
void main ()
{
const float Pi = 3.14159;
float YariCap;
float Alan, Cevre;
//1.Adim: YariCapi giriniz
cout << "Dairenin yaricapinin giriniz =";
cin >> YariCap;
//2.Adim: Alani hesapla
Alan = Pi * YariCap * YariCap;
//3.Adim: Cevreyi hesapla
Cevre = 2 * Pi * YariCap... | true |
36868b38bbe421b8c28e950ac64fdd797bb5ef7b | C++ | BurpTech/BurpStatus | /src/BurpStatus/Internal/Status.cpp | UTF-8 | 638 | 2.671875 | 3 | [] | no_license | #include "Status.hpp"
namespace BurpStatus {
namespace Internal {
void Status::set(Level level, Code code) {
_level = level;
_code = code;
}
const Status::Level Status::getLevel() const {
return _level;
}
const Status::Code Status::getCode() const {
return _code;
}
... | true |
0e7417b7e0f7fc020d1ec13bc2f9411a2dfc1db9 | C++ | iwtbam/leetcode | /code/lt剑指 Offer 61.cpp | UTF-8 | 752 | 2.890625 | 3 | [] | no_license | // https://leetcode-cn.com/problems/bu-ke-pai-zhong-de-shun-zi-lcof/
// bu ke pai zhong de shun zi lcof
class Solution {
public:
bool isStraight(vector<int>& nums) {
int zero = 0, min_e = 13, max_e = 1;
int size = nums.size();
unordered_set<int> set;
for(int i = 0; i < size; i++){
... | true |
13d29c97565e44c1a7f0ade573fb1e6d1e969a70 | C++ | sgalkin/CarND-T3P1 | /src/protocol.cpp | UTF-8 | 1,177 | 3.25 | 3 | [
"MIT"
] | permissive | #include "protocol.h"
#include <cstring>
#include <stdexcept>
namespace {
bool checkHeader(const std::string& request) {
// "42" at the start of the message means there's a websocket message event.
// The 4 signifies a websocket message. The 2 signifies a websocket event
return request.length() > 2 && strncmp(r... | true |
ba7f30ccd572b6668076743d025319ba7804f6f6 | C++ | JagjitBhatia/PTU_Controller | /SerialAdapter.h | UTF-8 | 857 | 2.6875 | 3 | [] | no_license | #ifndef SERIAL_H
#define SERIAL_H
// C library headers
#include <iostream>
#include <string.h>
// Linux headers
#include <fcntl.h>
#include <errno.h>
#include <termios.h>
#include <unistd.h>
#include <sys/file.h>
class SerialAdapter {
private:
char* path;
int flags;
int conn;
bool connected;
int baud;
... | true |
1171f408fa6178322e94758d321ebfdd613f8f48 | C++ | pat-laugh/various-cpp | /various/smartIterator.hpp | UTF-8 | 1,823 | 3.375 | 3 | [
"Apache-2.0"
] | permissive | //Copyright 2017 Patrick Laughrea
//Licensed under the Apache License, Version 2.0
/*
SmartIterator: wraps a stringstream object, providing a common interface to
iterate both streams and strings.
The class throws the exception ios_base::failure in case of a non-eof error.
*/
#pragma once
#include <sstream>
#includ... | true |
d357b097a053e334b1bac3cfba466ea9bb91e205 | C++ | HyeongBinK/C_PlusPlus | /C++/학생정보관리시스템/Student.cpp | UHC | 1,329 | 3.484375 | 3 | [] | no_license | #include "Student.h"
Student::Student()
{
}
void Student::SetStudent(int Number)
{
int tmp;
bool Pass = true;
m_iNumber = Number+1;
system("cls");
cout << m_iNumber << " л "<< endl;
cout << "̸ : ";
cin >> m_strName;
cout << " : ";
cin >> m_iAge;
Pass = true;
while (Pass)
{
cout << "г : ";
cin >> tmp... | true |
147ef20356754142d97e3dd4e183ac8f0736c825 | C++ | kjanderson2/TopCoder | /ExerciseMachine.hpp | UTF-8 | 689 | 3.421875 | 3 | [] | no_license | #include <iostream>
#include <cmath>
using namespace std;
class ExerciseMachine{
private:
int convertToSeconds(string time){
int answer = 0;
string hoursString = time.substr(0,2);
string minsString = time.substr(3,2);
string secsString = time.substr(6,2);
int hours = atoi(hoursString.c_str());
int mins = ... | true |
cf2389b11ac146779854ec6d69da041db1a20e73 | C++ | cpe-unr/group-project-pt48 | /noisegate.cpp | UTF-8 | 1,222 | 3.046875 | 3 | [] | no_license | //author:
//date:
//semester final project
#include "noisegate.h"
using namespace std;
NoiseGate::NoiseGate(){
threshold = 100;
}
NoiseGate::NoiseGate(int threshold) : threshold(threshold){}
void NoiseGate::processBuffer(unsigned char* buffer, int bufferSize){
Noisegate(buffer, bufferSize);
}
void NoiseG... | true |
004a4422077b895dfae7939500d17cdaba869d59 | C++ | BigYvan/PAT-Basic-Level | /1081.cpp | UTF-8 | 938 | 2.703125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
int n;
cin >> n;
getchar();
for (int i = 0; i < n; i++) {
string temp;
getline(cin, temp);
if (temp.size() < 6) {
printf("Your password is tai duan le.\n");
continue;
... | true |
dab59bafd7c7633d7ca00fc5cd512ee07cdcb7b6 | C++ | pilipeikoko/Course2 | /SDiIS/Lab3/TreetypeRepresentaionAndInterpretationOfArithmetical_task/tree_testing/tree_testing.cpp | UTF-8 | 6,816 | 2.90625 | 3 | [] | no_license | #include "../Project3/Expression_tree.h"
#include "../Project3/Assign_expression.h"
#include "../Project3/Math_expression.h"
#include "../Project3/Assign_expression.h"
#include "CppUnitTest.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace Testingtree
{
TEST_CLASS(Testing_tree)
{
public:
... | true |
e2818d4228aed89fce8dffe0a603269fff8caf46 | C++ | cms-sw/cmssw | /DetectorDescription/Core/interface/DDMap.h | UTF-8 | 1,848 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | #ifndef DD_DDMap_h
#define DD_DDMap_h
#include <iostream>
#include <map>
#include <memory>
#include <string>
#include "DetectorDescription/Core/interface/DDReadMapType.h"
#include "DetectorDescription/Core/interface/DDBase.h"
#include "DetectorDescription/Core/interface/DDName.h"
class DDMap;
//! output operator fo... | true |
0701d2921ea649cdfa4dc44f4784f9d366aded12 | C++ | jbienias/Studies | /Algorytmy numeryczne/Grzybobranie/Source.cpp | UTF-8 | 3,130 | 2.6875 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
#include <fstream>
#include <time.h>
#include <stdlib.h>
#include <ctime>
#include <string>
#include <windows.h>
#include <Eigen/Dense>
#include <Eigen/SparseLU>
/* Barzowska Monika, 238143
* Bienias Jan, 238201
*/
using namespace std;
using namespace Eigen;
#define CSVName "e... | true |
e5a27ddbcf5cb9d359b8286634487883594c3e97 | C++ | Pixelzzz99/SashaVersionV2 | /Files/Generator.cpp | UTF-8 | 699 | 2.9375 | 3 | [] | no_license | #include "Generator.h"
Generator::Generator() {
srand(RAND_MAX);
//srand(time(nullptr));
_new_n = random(MIN, MAX);
int temp_P = random(MIN, MAX);
if ((temp_P / 10) == 0)
{
_new_P = (double)temp_P / 10;
}
else
{
_new_P = (double)temp_P / 100;
}
}
Generator::Generator(int N, int P, int M)
{
this->_new_... | true |
04a3771f53af72b038bb0873475b79fb1d7b2938 | C++ | nadezhdagub/cpp-labs-1st-sem | /gubenko.nadezhda/A3/main.cpp | UTF-8 | 2,058 | 3.25 | 3 | [] | no_license | #include <iostream>
#include <stdexcept>
#include "rectangle.hpp"
#include "circle.hpp"
#include "composite-shape.hpp"
using namespace gubenko;
int main()
{
try
{
auto r = std::make_shared <Rectangle> (point_t {20.0, 25.0}, 9.0, 11.0);
std::cout << "Creating Rectangle x=20, y=25, w=9, h=11" << std::endl;
... | true |
09369fe94f58669c035c5aa6785d9baf9f21dded | C++ | aaronyoo/wine | /src/lib/string.cpp | UTF-8 | 546 | 3.171875 | 3 | [] | no_license | #include "string.hpp"
String::String(const char* s) {
size = strlen(s);
value = (char*) memory::halloc(size);
memcpy(value, s, size);
}
String::String() {
size = 0;
}
String::~String() {
memory::free(value);
}
String& String::operator=(const String& rhs) {
memory::free(value);
size = str... | true |
6aaf4d72dfda490ab9850b1b82ce3e49572cca8f | C++ | Gullern/tdt4102_cpp | /oving08/shapes.cpp | UTF-8 | 2,189 | 3.4375 | 3 | [] | no_license | #include "shapes.h"
#include <iostream>
/* Shape */
Shape::Shape(const Color &color) : color(color) {
}
/* Line */
Line::Line(unsigned int startX, unsigned int startY, unsigned int endX, unsigned int endY, const Color &color) :
Shape(color), startX(startX), startY(startY), endX(endX), endY(endY) {
}
void Line... | true |
4bcdca35f64341b0860dc644211d59d402bcb7b0 | C++ | Pseudocode-Team/pseudocode | /src/utils.h | UTF-8 | 614 | 3.390625 | 3 | [
"MIT"
] | permissive | #pragma once
#include <iostream>
void print(std::string message) {
std::cout << message << std::endl;
}
void print(int message) {
std::cout << message << std::endl;
}
#include <string>
template <class Container>
void split(const std::string& str, Container& cont, char delim = ' '){
std::size_t current, previou... | true |
46b29081015e781b64c5c4afed7f6907d74164f7 | C++ | p-lots/codewars | /7-kyu/tv-remote/c++/solution.cpp | UTF-8 | 1,146 | 2.890625 | 3 | [] | no_license | #include <map>
#include <utility>
#include <vector>
using namespace std;
const vector<vector<char> > lookup_table = {
{ 'a', 'b', 'c', 'd', 'e', '1', '2', '3' },
{ 'f', 'g', 'h', 'i', 'j', '4', '5', '6' },
{ 'k', 'l', 'm', 'n', 'o', '7', '8', '9' },
{ 'p', 'q', 'r', 's', 't', '.', '@', '0' }... | true |
9e9df32e173688257bb36d637571e6dfb853688c | C++ | putnampp/clotho-dev | /include/utility/memory/impl/event_page_walker.2.hpp | UTF-8 | 2,959 | 2.953125 | 3 | [
"BSD-2-Clause-Views",
"BSD-2-Clause"
] | permissive | #ifndef EVENT_PAGE_WALKER_2_HPP_
#define EVENT_PAGE_WALKER_2_HPP_
#include <cassert>
#include <iostream>
// Forward Iterator for walking events in page relative object order
//
template < class EP >
class EventPageWalker {
public:
typedef EP event_page_t;
typedef typename event_page_t::event_node event_nod... | true |
0d7dbb98b376db71ba92ae7a72f030a038814e95 | C++ | iampkuhz/OnlineJudge_cpp | /leetcode/cpp/PassedProblems/MaximumDepthofBinaryTree.cpp | UTF-8 | 1,826 | 3.578125 | 4 | [] | no_license | /*
* MaximumDepthofBinaryTree.cpp
*
* Created on: Mar 24, 2015
* Author: hanzhe
*/
#include <iostream>
#include <vector>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
/**
* Definition for b... | true |
e3627c15cbc7ea5ee68cca3776d5f38e971403be | C++ | AStepanyan21/AbstractScript | /AbstractScript/Parser.h | UTF-8 | 3,592 | 2.953125 | 3 | [] | no_license | #ifndef PARSER_H
#define PARSER_H
#include <iostream>
#include <stdint.h>
#include <fstream>
#include <codecvt>
#include <fstream>
#include <sstream>
#include <string>
#include <regex>
#include <vector>
using varTab = std::vector<std::string>;
struct Alias{
std::wstring arm;
std::wstring eng;
};
class Pars... | true |
c0ac34db6c9c7ca076b79773b40ab264f039c324 | C++ | Mu-Ahmad/OOP-CMP-244-241 | /Lecture Codes/Lecture 13/Lec13_4_4.cpp | UTF-8 | 746 | 3.375 | 3 | [] | no_license | #include <iostream>
#include <fstream>
using namespace std;
class RationalNumber{
int x, y;
public:
RationalNumber(int x=0, int y=1){ //Both parameterized and Non-parameterized constructor
set(x, y);
}
void set(int x=0, int y=1){
if (y==0) y = 1;
if ((x < 0 && y < 0) || (x >=0 && y < 0)){ x=-x; y=-y; }
... | true |
3f1647e8f1bd3ef6837553c01848a1b33ab198b1 | C++ | Arkrissym/Discord.CPP | /Discord.C++/static.cpp | UTF-8 | 1,304 | 2.75 | 3 | [
"MIT"
] | permissive | #include "static.h"
#include <boost/certify/https_verification.hpp>
#include <string>
#include <vector>
void hexchar(unsigned char c, unsigned char& hex1, unsigned char& hex2) {
hex1 = c / 16;
hex2 = c % 16;
hex1 += hex1 <= 9 ? '0' : 'a' - 10;
hex2 += hex2 <= 9 ? '0' : 'a' - 10;
}
std::string urlenco... | true |
c65766bb35203fea91f8590ab773003688cd25ab | C++ | jason967/algorithm | /Algo/2961.cpp | UTF-8 | 784 | 2.578125 | 3 | [] | no_license | #include<cstdio>
#include<vector>
#include<algorithm>
#define pii pair<int,int>
using namespace std;
const int INF = 1e9;
int N;
bool used[10];
int sel[10];
int ans = INF;
vector<pii> v;
void go(int cnt, int idx,int target)
{
if (cnt == target)
{
int S = 1;
int B = 0;
for (int i = 0; i < cnt; i++)
{
... | true |
7fac9f30fca646c98906d3e52892019e010b2785 | C++ | MarkFSchneider/assignment4 | /Mean.cpp | UTF-8 | 214 | 2.765625 | 3 | [] | no_license | #include "Mean.h"
using namespace std;
Mean::Mean()
{
sum = 0;
count = 0;
}
Mean::~Mean()
{
}
void Mean::addElement(int d)
{
count++;
sum+=d;
}
float Mean::calculate()
{
return (float)sum / count;
}
| true |
a00b3e7572d21763c8c2ad51157f05173634cd96 | C++ | rodriguesfas/Cron | /cronos_serv/src_arduino/cronos/cronos.ino | UTF-8 | 2,742 | 2.953125 | 3 | [
"MIT"
] | permissive | /**
* ****************************************************************************
Sofware: Cronos
Descricion:
Versino: 0.0.1
Date: 02 de junho de 2016
By; RodroguesFAS
Contact: <http:/rodriguesfas.com.br> || <franciscosouzaacer@gmail.com>
* ******************************************************************... | true |
1bed8ed4c509bc66aea52dc12ece26e621e2b5da | C++ | fake-888/Ejercicios-lab3 | /Tarea6/SeccionList.cpp | UTF-8 | 1,715 | 3.359375 | 3 | [] | no_license | #include "SeccionLista.h"
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <string.h>
using namespace std;
SeccionLista::SeccionLista() : primero(nullptr)
{
}
bool SeccionLista::estaVacia()
{
return primero == nullptr;
}
void SeccionLista::agregarAlumno(char* nombre1, float nota... | true |
c53a5500dcc54709bd283aaf079eb0e079751902 | C++ | milon/UVa | /Volume-4/UVa_486.cpp | UTF-8 | 2,031 | 2.859375 | 3 | [] | no_license | //UVa Problem-486(English-Number Translator)
//Accepted
//Running time: 0.012 sec
//Author: Milon
#include<cstdio>
#include<cstring>
#include<cctype>
using namespace std;
char sign[25]="negative";
char digit[20][25] = {
"zero", "one", "two", "three", "four","five", "six", "seven", "eight", "nine",
"ten","eleven", "t... | true |
4dcd906552ad616fa856982a15a79745801552f4 | C++ | bigfishi/leetcode | /problems/128.longest-consecutive-sequence.cpp | UTF-8 | 1,093 | 3.4375 | 3 | [
"MIT"
] | permissive | // 1. 先排序,然后判断
class Solution {
public:
int longestConsecutive(vector<int>& nums) {
if (nums.size() < 2) return nums.size();
sort(nums.begin(), nums.end());
int cur = 1, res = 1, pre = nums[0];
int res = 0;
for (int i = 1; i < nums.size(); i++) {
if (nums[i] - pre == 1) {
pre = nums[i];
cur++;
... | true |
1ce8137d141037806d3c147853ee7e841bb227b3 | C++ | bheckel/code | /misc/c/array_class.h | UTF-8 | 1,565 | 3 | 3 | [
"Apache-2.0"
] | permissive | // Modified: Sun 16 Feb 2003 15:24:41 (Bob Heckel)
// Fig. 8.4: array1.h
// Simple class Array (for integers only)
#ifndef ARRAY1_H
#define ARRAY1_H
#include <iostream>
using std::ostream;
using std::istream;
class Array {
friend ostream &operator<<(ostream&, const Array&);
friend istream &operator>>(... | true |
d6e9f59d988a490492bc22fce674b1f6c2e58050 | C++ | erogers6264/google-cpp-class | /animal.cpp | UTF-8 | 610 | 3.34375 | 3 | [] | no_license | // animal.cpp: Ethan Rogers
// Description: Calculate how many horses, pigs,
// and rabbits a farmer bought if he bought 100
// animals for $100 and Horses cost $10, pigs $3,
// and rabbits
#include <iostream>
using namespace std;
int main() {
for (int h = 0; h < 10000; h++) {
for (int p = 0; p < 10000; p++)... | true |
64e0eb169e692ad5207a62cd07dd54e97de84db6 | C++ | Capri2014/math | /test/unit/math/rev/scal/fun/log1m_test.cpp | UTF-8 | 958 | 2.65625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include <stan/math/rev/scal.hpp>
#include <gtest/gtest.h>
#include <test/unit/math/rev/scal/fun/nan_util.hpp>
#include <test/unit/math/rev/scal/util.hpp>
#include <limits>
TEST(AgradRev, log1m) {
using stan::math::log1m;
AVAR a = 0.1;
AVAR f = log1m(a);
EXPECT_FLOAT_EQ(log(1 - 0.1), f.val());
AVEC x = crea... | true |
d378f2710df3fd23e50664a2397aaec1bec4bcce | C++ | xinyuang/9_chapter_cpp_algorithm | /FLAG/Microsoft/41. Maximum Subarray.cpp | UTF-8 | 1,007 | 3.484375 | 3 | [] | no_license | //41. Maximum Subarray
//accumulate sum if negative, reset to 0
class Solution {
public:
/**
* @param nums: A list of integers
* @return: An integer indicate the sum of max subarray
*/
int maxSubArray(vector<int>& nums) {
// write your code here
if (nums.size() == 0) return 0;
int sum = 0;
int res = nu... | true |
e60c5836d26895934c9208c7d62efbfa91959a0c | C++ | ZS167275/Five_SDL | /Five_AI/main.cpp | GB18030 | 2,955 | 2.578125 | 3 | [] | no_license | /************************************************************************/
/* ļģֱFive_AI.h */
/************************************************************************/
#include "SDL.h"
#include "SDL_net.h"
#include "SDL_ttf.h"
#include "Five_AI.h"
int main(int argc, char ** argv){
//Initial... | true |
5fc6f7979117c34d18dad90f4332caf9a1630fa5 | C++ | shusilshapkota/OptiPhi | /Optiφ/Utilities/BinaryArray.h | UTF-8 | 995 | 2.796875 | 3 | [] | no_license | #include <stdlib.h>
#include "Utilities.cpp"
class BinaryArray {
public:
static BinaryArray inValidBinaryArray;
static BinaryArray newCharArray;
// Methods
bool isValid();
int getLength();
//int* getData();
void addNewChar();
int numOnes();
int numZeros();
// Operators
int& operator()... | true |
7d918a9596879642425ba59326c9a7dff9c440ab | C++ | csdu/coding-club-sessions | /2020-01-31-data-structures-cpp-stl/generic_class_and_type.cpp | UTF-8 | 408 | 3.375 | 3 | [] | no_license | #include <iostream>
#include <utility>
using namespace std;
template <typename A>
class abc {
public:
A a;
abc(A x) {
a = x;
}
};
template <typename A, typename B>
using pp = pair<A, B>;
int main() {
pp<int, char> p = make_pair(1, 'A');
abc<float> a(3.14f);
cout << "p: {" << p.f... | true |
fb3b98b59dce7604fb560c6781aaa7d0b7141b50 | C++ | xivol/AM-PRO2-2016 | /Class/triangle.cpp | WINDOWS-1251 | 2,729 | 3.296875 | 3 | [] | no_license | #include "..\Polymorph\triangle.h"
#include "triangle.h"
#include <cmath>
#include <iostream>
triangle::triangle() : a(), b(), c() {}
triangle::triangle(const point & a, const point & b, const point & c)
{
if (is_line(a, b, c))
throw std::invalid_argument(" ");
this->a = a;
this->b = b;
t... | true |
5d97e9fcb0921dc32a114bc1ed95a08026c29456 | C++ | longluo/leetcode | /Cpp/leetcode/editor/cn/230_kth-smallest-element-in-a-bst.cpp | UTF-8 | 1,790 | 3.296875 | 3 | [
"MIT"
] | permissive | //给定一个二叉搜索树的根节点 root ,和一个整数 k ,请你设计一个算法查找其中第 k 个最小元素(从 1 开始计数)。
//
//
//
// 示例 1:
//
//
//输入:root = [3,1,4,null,2], k = 1
//输出:1
//
//
// 示例 2:
//
//
//输入:root = [5,3,6,2,4,null,null,1], k = 3
//输出:3
//
//
//
//
//
//
// 提示:
//
//
// 树中的节点数为 n 。
// 1 <= k <= n <= 10⁴
// 0 <= Node.val <= 10⁴
//
//
//
//... | true |
7acb474d52640de67ad20ef5d82f54f73e82397c | C++ | Sikurity/StudyAlgorithm | /Normal/13325_BinaryTree.cpp | UTF-8 | 1,093 | 2.828125 | 3 | [] | no_license | /**
* @link https://www.acmicpc.net/problem/13325
* @date 2017. 04. 08
* @author Sikurity
* @method Use Binary Tree Made Of Array
*/
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
int k;
long long result;
pair<int, int> adj[1 << 20];
long long absLL(long long num)
{
return n... | true |
e42c6f9380577654714ae5b8b74ed26ed1f2462e | C++ | zhongjianhua163/BlackMoonKernelStaticLib | /krnln/krnln_write.cpp | GB18030 | 9,071 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | #include "stdafx.h"
#include "MyMemFile.h"
#include "Myfunctions.h"
//ļд - д
/*
øʽ ͡ д дݵļţͨ/ дݣ... - ϵͳֿ֧->ļд
Ӣƣwrite
Ӧ롰롱ʹãдһϵбĸʽݵļеǰдλôɹ棬ʧܷؼ١
ݵдʽΪ
1ֵ͡͡ʱ͡ӳָͣ ΪӦʵݣ
2ıͣ Ϊı + ֽ 0
3ֽڼͣ Ϊֽڼݳȣ + ֽڼʵݣ
4ϸ͵ݣ Ϊݸʽ˳СΪмһԱظӡ
<1>ΪдݵļšΪͣintļɡļء
<2>ΪдݡΪͨͣallṩʱͬʱṩݡдݵΪûԶⶨͣʧܡ
*/
LIBA... | true |
6fc46a153c28691643cfc87d88190d4bc52765bf | C++ | deadmorous/raytracer | /ray.h | UTF-8 | 989 | 3.03125 | 3 | [] | no_license | #ifndef RAY_H
#define RAY_H
/// \file
/// \brief Definition of the Ray data structure.
#include "common.h"
namespace raytracer {
/// \brief Structure representing an instance of ray for use in the ray tracer.
struct Ray
{
v3f origin; ///< \brief Ray origin.
v3f dir; ///< \brief Ray direct... | true |
e6631648f8c54f69bd7dfa9d09bee8d913a9761d | C++ | navigateai/RobotMapping_SLAM_Assignments_In_Cpp | /EKF_Slam/C++/correction_step.h | UTF-8 | 4,231 | 2.84375 | 3 | [
"MIT"
] | permissive | #pragma once
#include "../../eigen/Eigen/Dense"
#include "tools/read_data.h"
#include "tools/normalize_all_bearings.h"
using namespace Eigen;
void correction_step(VectorXf &mu, MatrixXf &sigma, std::vector<Sensor> z, std::vector<bool> observedLandmarks){
/*
Updates the belief, i. e., mu and sigma after obs... | true |
3c0ef4dcc47e2cf39216bc4f295914aaa7945653 | C++ | loupus/pgfe | /test/pgfe/pgfe-unit-connection_options.cpp | UTF-8 | 9,007 | 2.515625 | 3 | [
"Zlib"
] | permissive | // -*- C++ -*-
// Copyright (C) Dmitry Igrishin
// For conditions of distribution and use, see files LICENSE.txt
#ifndef DMITIGR_PGFE_HEADER_ONLY
#define DMITIGR_PGFE_HEADER_ONLY
#endif
#include <dmitigr/misc/testo.hpp>
#include <dmitigr/pgfe/connection_options.hpp>
#include <cstring>
#include <iostream>
#include <st... | true |
ee2f82799d2b252062e83f3298118280d2ea7ec2 | C++ | myyrakle/BigNumber | /include/BigInteger.h | UTF-8 | 3,601 | 3.03125 | 3 | [
"MIT"
] | permissive | #ifndef __BIG_INTEGER__
#define __BIG_INTEGER__
#include <vector>
#include <string>
#include <cstdint>
#include <ostream>
#include <istream>
namespace bignumber
{
constexpr auto INTERVAL = '0'-0;
class BigInteger
{
public:
using Self = BigInteger;
private:
std::vector<char> num;
bool sign = tru... | true |
2dd79f72f49ec39b407fbef472cff7848fd23463 | C++ | upple/BOJ | /src/2000/2857.cpp14.cpp | UTF-8 | 249 | 2.953125 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <string>
using namespace std;
int main()
{
string str;
bool FIND=false;
for(int i=1; i<=5; i++)
{
cin>>str;
if(str.find("FBI")!=string::npos)
FIND=true, cout<<i<<" ";
}
if(!FIND)
cout<<"HE GOT AWAY!";
}
| true |
919940f972e0ab5126dec12c66ce91f22a0b72c5 | C++ | PenguinGrape/algosy4 | /1297.cpp | UTF-8 | 1,384 | 3.140625 | 3 | [] | no_license | //
// Created by grape on 07.06.2020.
//
#include <cstring>
#include <iostream>
int main(){
char s[1001];
int str_length;
int max_length = 1;
int pal_pos = 0;
std::cin >> s;
str_length = strlen(s);
for (int i = 1; i < str_length; i-=-1) {
int count = 0;
for (int j = 1; i -... | true |
93d191c8a4781ac26a8c6a216805571cead48bd9 | C++ | NguyenVanTu1601/THCS2 | /Contest6/BaiB.cpp | UTF-8 | 1,052 | 2.546875 | 3 | [] | no_license | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int snt(int i){
if(i < 2) return 0;
if(i == 2) return 1;
if(i > 2) {
for(int j = 2; j <= sqrt(i); j++){
if(i % j == 0) return 0;
}
return 1;
}
}
main(){
int dem = 0;
long long arr[405];
for(int i = 2; i <= 2800; i++){
if(snt(i) == 1){
... | true |
2568b0b0fb24ce7245d84de86a3f028969d6d848 | C++ | wuzhuorui/cpp_study | /public_protected_private.cpp | UTF-8 | 1,717 | 3.515625 | 4 | [] | no_license | class BaseClass
{
public:
int public_int;
private:
int private_int;
protected:
int protected_int;
};
class DerivedClass :public BaseClass {
public:
void UsePublicInt()
{
public_int = 1; //正确
}
void UserPrivateInt()
{
private_int = 1;//错误:成员 BaseClass::private_int不可访问
}
void UserProtectedInt()
{
protec... | true |
532d2b2707f540213fc8f8525a669cf76a275148 | C++ | FHead/JetMETAnalysis | /JetUtilities/interface/ProgressBar.hh | UTF-8 | 1,321 | 3.265625 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
#include <string>
#include <math.h>
using std::cout;
using std::endl;
using std::flush;
using std::setw;
using std::string;
using std::remainder;
const int r = 100;
inline void loadbar2(unsigned int x, unsigned int n, unsigned int w = 50, string prefix = "") {
if ( (x != n) ... | true |
764f813923ab196ce918f54895fecd805ed0766c | C++ | discoverfly/ACM_template | /string/ELFhash.cpp | UTF-8 | 748 | 2.78125 | 3 | [] | no_license | class hash_table {
public:
unsigned int ELFhash(char *key) {
unsigned int h = 0, g;
while (*key) {
h = (h << 4) + *key++;
g = h & 0xf0000000L;
if (g) h ^= g >> 24;
h &= ~g;
}
return h % MOD;
}
int find(char * str, int judge = 0) {
int t = ELFhash(str);
for (hashCell * i = g[t]; i != NULL; i =... | true |
936d5dc8052020ad6ff18de40e42616d119e7e94 | C++ | ngahumwangi/Hackrank_Solutions | /vectors.cpp | UTF-8 | 1,096 | 3.265625 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int num_of_arrays, num_of_queries, array_lengh, array_values, query_value_1, query_value_2;
vector<vect... | true |
3bfc249c68f8aa82c0e8f59290201037875b4ae0 | C++ | flores-jacob/exercism | /cpp/roman-numerals/roman_numerals.h | UTF-8 | 2,070 | 3.703125 | 4 | [] | no_license | #include <string>
namespace roman
{
std::string convert(int input)
{
std::string output_roman_numeral;
int thousands = input / 1000;
int hundreds = (input - (thousands * 1000)) /100;
int tens = (input - (thousands * 1000) - (hundreds * 100))/ 10;
int ones = input - (thou... | true |
6e3c44563346787f48b9a73de5610659b8d694bd | C++ | Hachimori/onlinejudge | /uva/11100-/11185.cc | UTF-8 | 403 | 3.296875 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
int num;
bool read(){
cin >> num;
return num>=0;
}
void work(){
if(num==0){
cout << 0 << endl;
return;
}
vector<int> digit;
while(num>0){
digit.push_back(num%3);
num /= 3;
}
for(int i=digit.size()-1;i>=0;i--)
cout << dig... | true |
4e222d454cc3682411eb829c14407a97472cb2b5 | C++ | AndroidStudySociety/cpp_demo | /Cplusplusext.cpp | UTF-8 | 1,244 | 3.28125 | 3 | [] | no_license | //
// Created by Jesson on 2019/12/1.
//
#include "Cplusplusext.h"
#include <iostream>
#include <iomanip>
#include <cstring>
using namespace std;
int iabs(int a){
return a>0?a:-a;
}
double fabs(double a){
return a>0?a:-a;
}
//==============操作符重载
struct COMP{
float real;
float image;
};
COMP operat... | true |
0eb64daddcc8e80aebe992e1add43da36c73ab27 | C++ | lyswty/PAT-Advanced-Level-Solutions | /1089/1089 Insert or Merge (25 分).cpp | UTF-8 | 914 | 2.890625 | 3 | [] | no_license | #include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main() {
int n;
bool ins = true;
cin >> n;
vector<int>a(n), b(n);
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < n; i++) cin >> b[i];
int i;
for (i = 1; i < n; i++) if (b[i] < b[i - 1]) break;
for (in... | true |
0f4237a2fadde23f1b9e0b628f2d1eee62001a8b | C++ | vraxzeztan/Hackerrank-GFG-Practice-Codes | /Linked Lists/Insertion_Sorted_Circular_LL.cpp | UTF-8 | 2,955 | 3.859375 | 4 | [] | no_license |
#include<bits/stdc++.h>
/* structure for a Node */
struct Node
{
int data;
struct Node *next;
};
void sortedInsert(struct Node**head_ref, int x);
/* function to insert a new_Node in a list in sorted way.
Note that this function expects a pointer to head Node
as this can modify the head of the input linked... | true |
b445d29a9fef130b07df6c7cda340003c73382be | C++ | kyung221/cse2022 | /소스.cpp | UTF-8 | 4,153 | 3.171875 | 3 | [] | no_license | #include <GLFW/glfw3.h>
#include <cstring>
#include <stdlib.h> // srand, rand
#include <thread> // std::this_thread::sleep_for
#include <chrono> // std::chrono::seconds
#include "math.h"
const int width = 640;
const int height = 480;
float* pixels = new float[width*height * 3];
void dr... | true |
dc0ef498e79686fe5f5e26fc0f45f5783beb939a | C++ | GabrielVantuil/GabrielVantuil.github.io | /projects/pdi/3.2/3.2.2/labeling_3.2.2.cpp | UTF-8 | 2,370 | 2.5625 | 3 | [] | no_license | #include <iostream>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main(int argc, char** argv){
Mat image, mask,out;
int width, height;
int nobjects=0, nobj_buraco=0;
int r=0,g=0,b=0;
CvPoint p;
image = imread(argv[1],CV_LOAD_IMAGE_GRAYSCALE);
cvtColor(image, out, CV_GRA... | true |
de1e9287fa49245baaf4008fea3b95cf0a4a4f31 | C++ | ldg0005/boj | /1920(list,hashing).cpp | UTF-8 | 1,207 | 2.984375 | 3 | [] | no_license | #include <stdio.h>
#define MOD 1000003
typedef struct List {
typedef struct Node {
Node *next;
int cost;
int exist;
Node() :cost(0) {
next = nullptr;
}
};
Node *head, *tail;
int size;
List() :size(0) {
head = new Node();
tail = new Node();
}
void push(int cost) {
Node *newnode = new Node();
... | true |
7d370cd99d25d59fd2612887c5804ad8c7ca1bed | C++ | deltaduong/area-measurement | /selection.h | UTF-8 | 1,220 | 2.640625 | 3 | [
"MIT"
] | permissive | #ifndef SELECTION_H
#define SELECTION_H
#include <QLineF>
#include <QPolygonF>
class Figure;
struct Selection
{
enum Type
{
FIGURE,
VERTEX,
INSCRIPTION
};
Figure* figure;
Type type;
int iVertex;
Selection();
void clear();
void setFigure(Figure* figure__);
void setVertex(Figu... | true |
593e5810f956c39a1a00ce39038b25a361072316 | C++ | 1337bugs/fb-labs-2019 | /cp_2/skuratov_fb_74_demidenko_fb_72_cp_2/lab2.cpp | UTF-8 | 6,289 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <math.h>
#include <string>
#include <map>
using namespace std;
string alphabet = "абвгдежзийклмнопрстуфхцчшщъыьэюя"; // без пробела
string keygood;
int count_letter = 0;
int count_vzlom = 0;
int letter_max = 0;
double index_sum;
double index(int ... | true |
b4213516e831492af3dc86b33e50d7ec628afdae | C++ | ruisleipa/kp2 | /src/simulation/dynamometer.hpp | UTF-8 | 623 | 2.59375 | 3 | [] | no_license | #ifndef SERVER_DYNAMOMETER_HPP
#define SERVER_DYNAMOMETER_HPP
#include "utils/curve.hpp"
#include "vehicle.hpp"
#include "vehiclesimulation.hpp"
class Dynamometer
{
public:
void run();
const Curve& getTorqueData();
const Curve& getPowerData();
const Curve& getIntakeData();
const Curve& getExhaustData();... | true |
1de89cd64906cb8594614ef20169420556ca7f7b | C++ | primetong/LearningCollectionOfWitt | /2017.DigitalImageProcessing/ImgStiching/图像拼接小DEMO(只有直接拼接的).cpp | GB18030 | 2,548 | 2.546875 | 3 | [
"MIT"
] | permissive | #include <opencv2/opencv.hpp>
//#include<opencv2/nonfree/nonfree.hpp>
//#include<opencv2/legacy/legacy.hpp>
#include <opencv2/xfeatures2d.hpp>
//#include<vector>
//#include <iostream>
//#include <iomanip>
//#include "opencv2/core/core.hpp"
//#include "opencv2/objdetect/objdetect.hpp"
//#include "opencv2/f... | true |
14c49b5199f1040aef3615607c3458fd6d1deb9d | C++ | dkonigsberg/mediaserviceutility | /src/media/FileType.cpp | UTF-8 | 1,000 | 2.65625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | #include "FileType.hpp"
namespace bbext
{
namespace multimedia
{
FileType::FileType()
{
}
FileType::~FileType()
{
}
QDebug operator<<(QDebug dbg, const FileType::Type &fileType)
{
switch(fileType) {
case FileType::Unknown:
dbg << "FileType::Unknown";
break;
case FileType::Audio:
... | true |
a7c53b8ec98ba4af3754239207872652bcf64c4e | C++ | bluemix/Online-Judge | /POJ/2540 Hotter Colder.cpp | UTF-8 | 5,205 | 3.21875 | 3 | [] | no_license | /* 14152374 840502 2540 Accepted 208K 0MS C++ 4384B 2015-05-01 23:01:05 */
#include<bits\stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = 1e-9;
double isZero(const double &x){
return fabs(x) <= EPS ? x : 0;
}
int sign(double x){
return fabs(x) < EPS ? 0 : (x > 0 ? 1 : -1);
}
struct Vect... | true |
23d7339f169a22b4795693547d822e11c5a53c9d | C++ | bxl295/m4extreme | /include/External/stlib/packages/shortest_paths/shortest_paths.h | UTF-8 | 61,975 | 3.140625 | 3 | [
"BSD-2-Clause"
] | permissive | // -*- C++ -*-
#if !defined(__shortest_paths_h__)
#define __shortest_paths_h__
#include "GraphBellmanFord.h"
#include "GraphDijkstra.h"
#include "GraphMCC.h"
#include "GraphMCCSimple.h"
//=============================================================================
//======================================... | true |
01121fe7e6ee0d7f1b748a134f3019ef3f9d797c | C++ | yt-project/libyt | /src/logging.cpp | UTF-8 | 4,818 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | #define NO_PYTHON
#include "yt_combo.h"
#undef NO_PYTHON
#include <string.h>
#include <stdarg.h>
// width of log prefix ==> [LogPrefixWidth] messages
static const int LogPrefixWidth = 10;
//-------------------------------------------------------------------------------------------------------
// Function : lo... | true |
fd4ea130c32e08364d011e8bf81df12919a158fb | C++ | RockyYan1994/Algorithm | /42_trapping_rain_water.cpp | UTF-8 | 501 | 2.625 | 3 | [] | no_license | /*
*/
class Solution {
public:
int trap(vector<int>& height) {
int sum = 0;
int left = 0,
for(int i=0;i<height.size();i++){
int right = i;
if(height[i]>=height[left]){
int temp = 0;
for(int j=left+1;j<i;j++){
temp... | true |
8f734a7c2ae52adb0d22517f73f671157a4080da | C++ | storypku/lucene-cpp | /util/file_reader.h | UTF-8 | 1,037 | 2.78125 | 3 | [] | no_license | #ifndef FILE_READER_H
#define FILE_READER_H
#include "reader.h"
namespace Lucene {
/// Convenience class for reading character files.
class FileReader : public Reader {
public:
/// Create a new FileReader, given the file name to read from.
FileReader(const String& fileName);
virtual ~FileReader();
L... | true |
742e31eef5e244628aa92315225b6558d29d65bd | C++ | lisanna-dettwyler/HiddenWorlds | /HWClient/HWText.cpp | UTF-8 | 2,668 | 2.703125 | 3 | [] | no_license | #include "pch.h"
#include "HWText.h"
HWText::HWText(HWFont* font, const std::string& text, glm::vec2 location, glm::vec4 color)
{
this->font = font;
this->text = text;
this->location = location;
this->color = color;
is_dirty = true;
}
HWText::~HWText()
{
}
void HWText::Render()
{
if(is_dirty)
{
F32 r = col... | true |
bb31661ae7b9fb8167d1732837ea9337d14c6900 | C++ | dejbug/cathy | /Dragger.h | UTF-8 | 2,639 | 2.828125 | 3 | [
"MIT"
] | permissive | #pragma once
#include "lib/Cursor.h"
template <class Chessboard> class Checker
{
private:
Chessboard * chessboard;
public:
Checker () : chessboard(0) {}
public:
void Create (Chessboard * chessboard)
{
this->chessboard = chessboard;
}
bool CheckUserMove (unsigned char dstCellIndex)
{
re... | true |
9117798db264d74e503830ffc78a23936e61b88a | C++ | kopikopio/aizu-online-algorithm | /ALDS1_2/安定ソート(改良).cpp | UTF-8 | 1,922 | 3.65625 | 4 | [] | no_license | #include <stdio.h>
using namespace std;
struct Card {
char pattern; // 絵柄
int value; // 値
};
void printCard(Card* card, int N) {
for (int i=0; i<N-1; i++) {
printf("%c", card[i].pattern);
printf("%d ", card[i].value);
}
printf("%c", card[N-1].pattern);
printf("%d\n", card[N-1]... | true |