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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
404407f164fb8061092981ac6941c79f9b59818a | C++ | MrWater/myspark | /src/container/SafeVector.h | UTF-8 | 2,256 | 3.046875 | 3 | [] | no_license | #ifndef __SAFE_VECTOR_H__
#define __SAFE_VECTOR_H__
#include <vector>
#include "thread/Lock.h"
#include "thread/AutoLock.h"
#include "common/Iterator.h"
#include "common/Iterateable.h"
namespace ns_container
{
template<typename TEle>
class SafeVectorIterator;
template<typename TEle>
class SafeVector : public Ite... | true |
4a00ea575dd160d82fb0858b9679bd07c44ab697 | C++ | yaozhihan1994/ca | /test/test.cpp | UTF-8 | 1,813 | 2.75 | 3 | [] | no_license | #include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include <pthread.h>
#include <fstream>
#include <sstream>
#include <ctime>
#include <thread>
#include <mutex... | true |
a088a31c1f2563a4453173ac51107a9d9cfd7984 | C++ | Benten559/avlLab | /tnode.h | UTF-8 | 1,714 | 3.53125 | 4 | [] | no_license | #ifndef _TNODE
#define _TNODE
#include<iostream>
using namespace std;
template<class type> class tnode {
private:
int height; //for duplicates
type data;
tnode<type>* leftPtr;
tnode<type>* rightPtr;
public:
tnode();
... | true |
983dfe3c24385bd7c653de04137fc36f50df0499 | C++ | xfile6912/Baekjoon | /Stack, Queue, Deque, List/boj1021.cpp | UTF-8 | 1,359 | 3.390625 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
#include <queue>
using namespace std;
int main(void)
{
deque<int> q;
int n, m;
int flag = 1;//flag가 0이면 왼쪽으로 이동시켜 뽑고, 1이면 오른쪽으로 이동시켜 뽑는다.
int i,j;
int result = 0;
scanf("%d %d", &n, &m);
for (i = 1; i <=... | true |
f97038ba192fd16d3a3651042985601d0a4d8a49 | C++ | pj520/samples | /framework/net-tcpserver/include/CJob.h | UTF-8 | 724 | 2.765625 | 3 | [
"MIT"
] | permissive | /* Copyright(C)
* For free
* All right reserved
*
*/
/**
* @file CJob.h
* @brief 任务父类
* @author highway-9, 787280310@qq.com
* @version 1.1.0
* @date 2016-02-20
*/
#ifndef _CJOB_H
#define _CJOB_H
#include <string>
#include <memory>
/**
* @brief 任务类
*/
class CJob
{
public:
virtual ~CJob() = default;
/**
... | true |
a8648a3fa509467a10d676c2ba0b29a950678839 | C++ | iakshatgandhi/DSAImportantQuestionScratch | /Amazon_Interview_Questions/Easy/Reverse_Integer.cpp | UTF-8 | 525 | 3.078125 | 3 | [] | no_license | /*
Problem Link: https://leetcode.com/problems/reverse-integer/
*/
class Solution {
public:
int reverse(int x) {
int flag=0;
if(x<0)
flag=1;
int num = abs(x);
long int revNum = 0;
while(num>0){
int rem = num%10;
if(revNum*10 > INT_MA... | true |
7cad89d46b1e71c6b1e042e3758020d753f0bcdb | C++ | RAJNDR/src | /src/testWindow.cpp | UTF-8 | 2,283 | 2.984375 | 3 | [] | no_license | #include "testWindow.hpp"
testWindow::testWindow()
{
gwindow = NULL;
gsurface = NULL;
ghelloWorld = NULL;
createdWindow = true;
SCREEN_WIDTH = 640;
SCREEN_HEIGHT = 480;
}
testWindow::~testWindow()
{
close();
}
bool testWindow::initWindow()
{
//Initialization flag
bool success ... | true |
78882b734e16986a099b746ae560e05bb8ef5b8f | C++ | tsnowak/rob550-botlab | /src/apps/utils/drawing_functions.hpp | UTF-8 | 5,057 | 2.875 | 3 | [
"MIT"
] | permissive | #ifndef APPS_UTILS_DRAWING_FUNCTIONS_HPP
#define APPS_UTILS_DRAWING_FUNCTIONS_HPP
#include <vx/vx_types.h>
#include <vector>
class ObstacleDistanceGrid;
class OccupancyGrid;
class PoseTrace;
class particles_t;
class pose_xyt_t;
class rplidar_laser_t;
class robot_path_t;
struct frontier_t;
/**
* draw_robot draws the... | true |
4ff17687eba23472f8ec51fd9f6e6ecbd5a64bf1 | C++ | nikitablack/cpp-tests | /functional/hybrid_functional/Math.h | UTF-8 | 1,790 | 3.34375 | 3 | [] | no_license | #pragma once
#include <random>
namespace math
{
const float pi{ 3.14159265359f };
const float two_pi{ 2 * pi };
inline int randRange(int const from, int const to)
{
static std::mt19937 gen;
std::uniform_int_distribution<> const distr(from, to);
return distr(gen);
}
inline float randRange(float const fr... | true |
fc7af66f72670b21dea10369379a6ebbe7a0688e | C++ | noobtechie/2015HackadayPrize | /Main_Project/Arduino_code/door/door.ino | UTF-8 | 1,582 | 2.78125 | 3 | [] | no_license | //Header files
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
#include "LowPower.h"
//Node ID definitions
#define DOOR 4
#define NET_ID 1
#define NODE_ID 3
int doorval;
//Structure to store the radio packets
typedef struct{
uint8_t from;
uint8_t to;
uint8_t type;
boolean data... | true |
993fe3ae88a79810b7e7314800108fc856ab2ffe | C++ | Alina-Stscherbakowa/laboratornie | /Лабораторная 1/ConsoleApplication1/ConsoleApplication1.cpp | WINDOWS-1251 | 1,086 | 3.171875 | 3 | [] | no_license | // ConsoleApplication1.cpp: .
//
#include "stdafx.h"
#include "vremia.h"
#include <iostream>
Time::Time() //
{
hour = 10;
point = new int;
*point = 20;
}
Time::~Time() //
{
hour = 0;
delete point;
}
void Time::settime(int h, int m, int s)
{
hour = h;
min = m;
sec = s;
}
void Time::... | true |
dc73466f810cbb71dbf552db5449220761876eef | C++ | ChristianNHill/FIFO-Practice-Hospital-Queue- | /PriorityQueue.cpp | UTF-8 | 2,855 | 3.34375 | 3 | [] | no_license | //
//Christian Hill
//HW7 _ 11/8/16
//CSCi 2270 - Boese
//
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdlib>
#include <string>
#include "PatientQueue.hpp"
using namespace std;
//Constructor
PatientQueue::PatientQueue()
{
lastIndex = 0;
}
//Destructor
PatientQueue::~PatientQueue()
{
cout... | true |
b2bfaeed307b4d156528e33f4dbaa0ed11bbdf53 | C++ | itaniyagupta/Famous_Programming_Problems | /Searching & Sorting/Quicksort on an array.cpp | UTF-8 | 1,019 | 3.59375 | 4 | [
"MIT"
] | permissive | // Runtime: O(n log( n)) in best/average, O(n^2) in worst case; Space: 0(log(n))
// Sorting In Place: Yes
// Stable: No
class solution{
public:
void quicksort(vector<int>& arr){
int start =0;
int end = arr.size()-1;
int index = partition(arr, start, end);
if (start< index - 1)
{
quicksort(arr, star... | true |
20142054baf3ce90e556c8ecae2520f15b1bbd8c | C++ | rgb-empire/IM_A_MIDI_LITTLE_BITCH | /IM_A_MIDI_LITTLE_BITCH/Tweener.h | UTF-8 | 522 | 2.78125 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Global_Definitions.h"
class Tweener
{
public:
static void tween(int* target, const int& new_val, const int duration = 2000, const Ease ease = LINEAR, const Ease_Type type = INOUT, Callback callback = NULL);
static void update();
protected:
struct Tween {
int* target;
int old_val;
... | true |
63a8b6fcbc0b9f6ef454c000753c3198b3eb5e92 | C++ | Himanshu54/practice-cpp | /dsa/array/minimum_stack.h | UTF-8 | 482 | 3.453125 | 3 | [] | no_license | #include <iostream>
#include <stack>
#include <utility> // <pair>
/*
A Template for Minimum stack.
*/
template <class T>
class MinStack{
std::stack<std::pair<T,T>> st;
public:
MinStack(){
}
void push(T element){
T min_ele = st.empty() ? element : std::min(element,st.top().second);
st.push({element, min_el... | true |
61839e9b5f2f98fd6f723412710740a657d88352 | C++ | pappyros/algorithm | /백준 KMP/백준 KMP/소스.cpp | UTF-8 | 297 | 2.984375 | 3 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
int main() {
char arr[100];
cin >> arr;
string result = "";
for (int i = 0; i < 100; i++) {
if (i == 0) {
result += arr[0];
continue;
}
if (arr[i] == '-') {
result += arr[i + 1];
}
}
cout << result;
} | true |
a7f29f8418707ae27cf94e8af008868fc4f4f89a | C++ | CodeTest-StudyGroup/Code-Test-Study | /kuyhochung/3. 카카오/2020 KAKAO Blind Recruitment/외벽 점검.cpp | UTF-8 | 1,043 | 3.015625 | 3 | [] | no_license | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(int n, vector<int> weak, vector<int> dist) {
int length = weak.size();
int dist_size = dist.size();
int answer = dist_size + 1; //최대 9의 값을 가진다.
for (int i = 0; i < length; i++)
weak.push... | true |
d0065977db333e356825fd569bb5bb4103cc40f1 | C++ | utkarsh914/LeetCode | /Design/211. design-add-and-search-words-data-structure.cpp | UTF-8 | 2,716 | 3.546875 | 4 | [] | no_license |
class WordDictionary {
class Trie {
// custom node class (each node will contain a single character of word)
class Node {
char data;
bool complete;
int children;
public:
vector<Node*> next;
// constructor
Node(char c='*', bool comp=false) {
data=c, complete=comp, children=0;
next.... | true |
c7f5440458cd96367a9a6336186d25a5d08e4844 | C++ | cwlseu/Algorithm | /leetcode/book/array/search_rotated_sortary.cpp | UTF-8 | 1,371 | 3.765625 | 4 | [] | no_license | /**
* @FILE: /array/search_rotated_sortary.cpp
* @DESCRIPTION:
* Suppose a sorted array is rotated at some pivot unknown to you beforehand.
* You are given a target value to search. If found in the array return its index, otherwise return -1.
* You may assume no duplicate exists in the array.
* @AUTHOR: wenlong.... | true |
81485905c600f4fb59bd3ab71a6854e414d70fd1 | C++ | lythesia/pat | /a/1029/1029.cc | UTF-8 | 1,071 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define inject(x) { cerr << "Function: " << __FUNCTION__ << ", Line: " << __LINE__ << ", " << #x << ": " << (x) << endl; }
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<vs> vvs;
int N, M;
long s[1000005 * 2];
int main(int argc,... | true |
e00e39a58f427d7d0f162a729f2b7c720dea61ee | C++ | dlgldgldgld/3D_VIEWER | /MY_VIEWER/MY_VIEWER/Source/CLogTrace.cpp | UTF-8 | 1,941 | 2.78125 | 3 | [] | no_license | #include "CLogTrace.h"
#include <windows.h>
#include <io.h>
#include <time.h>
void logTrace::CLogTrace::Clear()
{
if ( m_outLog != nullptr )
{
fclose( m_outLog );
}
}
logTrace::CLogTrace::CLogTrace( )
: m_outLog ( nullptr )
, m_Init ( false )
{
}
logTrace::CLogTrace::~CLogTrace()
{
Clear( );
}
logTrace::... | true |
265d759bfe0c108e76d94cf836cfa0fe66a6dd6d | C++ | ZitingShen/World-Simulation | /boid.cc | UTF-8 | 8,602 | 2.65625 | 3 | [] | no_license | #include "boid.h"
using namespace std;
BOID::BOID(){
pos = SPAWN_POSITION;
velocity = SPAWN_VELOCITY;
partner_radius = PARTNER_RADIUS;
}
bool is_partner(BOID& source, BOID& target){
return source.partner_radius >= glm::distance(source.pos,
target.pos);
}
void update_velocity(vector<BOID>& a_flock, GOAL&... | true |
d2ffdf764213b9f9fa7982ffc6de80615d44c89e | C++ | nameisshenlei/NewMemPool | /NewMemPool/ObjectBase.cpp | UTF-8 | 1,099 | 2.84375 | 3 | [] | no_license | #include "ObjectBase.h"
ObjectBase::ObjectBase(uint8_t* pData, uint32_t iBuffSize, MemPool<ObjectBase>* pPool /* = nullptr */)
: m_pData(pData)
, m_iBuffSize(iBuffSize)
, m_pPool(pPool)
{
}
ObjectBase::~ObjectBase()
{
m_pData = nullptr;
}
uint8_t* ObjectBase::GetData() const
{
if (m_iRefCount == 0)
return nu... | true |
f4d57dd9a627c3d9974b57ff25b9be1032f64f6a | C++ | hwoodiwiss/HolidayHelper | /HolidayHelperLib/ISerializable.h | UTF-8 | 1,277 | 2.84375 | 3 | [] | no_license | #pragma once
#include <iostream>
#include "Common.h"
namespace HolidayHelper::Persistence
{
//Abstract interface for serializing objects to disk
class DllExport ISerializable
{
public:
//Pure virtual functions that have to be overloaded in derived classes
virtual std::ostream& Serialize(std::ost... | true |
9de3f07b71c4ae519e0c337f8f43b5581cc6924c | C++ | mcduenash/herramientasclase | /agosto16/serieconverg.cpp | UTF-8 | 562 | 3.640625 | 4 | [] | no_license | //Este programa saca una tabla de datos que graficados muestran para que N converge la expansion de Taylor de la funcion exponencial
#include<iostream>
#include<cmath>
int factorial(int m){
if (m==0){
return 1;
}
else{
int f=1;
for (int i=1; i<=m; i++){
f*=i;
}
return f;
}
}
double ... | true |
1a0449cdc5b1a94b8a607a1324b6f3de842b8767 | C++ | klarmann2018/sams_teach_c-_in_one_hour_a_day | /sams_teach_c++_in_one_hour_a_day/04/listing04_04.cpp | UTF-8 | 1,181 | 3.640625 | 4 | [] | no_license | /*
* =====================================================================================
*
* Filename: LISTing04_04.cpp
*
* Description: Creating a Dynamic Array of Integers and Adding Values
* Dynamically
*
* Version: 1.0
* Created: 2018年09月04日 17时33分00秒
* Revision: non... | true |
1579cac521f15244da7e9d0c59ee7419afc93e90 | C++ | Juli199696/AntSimCPlusPlusLearning | /main.cpp | UTF-8 | 25,310 | 2.703125 | 3 | [
"Unlicense"
] | permissive | /* 02.04.2014 Ant Simulation version : 0.5 Dev Autor: Julian Märtin
==============================================================================================================================
Allgemeine Programm Infos wie Changelog und vorhandene Funktionen.
====================================================... | true |
dee32bc573fbe461e17e5c32d1edbf0b222f8dab | C++ | Hmilner1/MarioProject | /Mario/Mario/LevelMap.cpp | UTF-8 | 954 | 3.375 | 3 | [] | no_license | #include "LevelMap.h"
LevelMap::LevelMap(int map[MAP_HEIGHT][MAP_WIDTH])
{
//sets the map height and width
m_map = new int* [MAP_HEIGHT];
for (unsigned int i = 0; i < MAP_HEIGHT; i++)
{
m_map[i] = new int[MAP_WIDTH];
}
//populate the array
for (unsigned int i = 0; i < MAP_HEIGHT; i++)
{
for (unsigned int ... | true |
a7029a71f9115d854f09501c631c456c2c549e27 | C++ | qeedquan/challenges | /opengl4-mbsoftworks/common/static_meshes_3d/primitives/cone.h | UTF-8 | 832 | 2.78125 | 3 | [
"MIT"
] | permissive | #ifndef _CONE_H_
#define _CONE_H_
class Cone : public StaticMesh3D
{
public:
void init(Vec3f directix, Vec3f apex, float height, float radius, int num_slices,
bool has_positions, bool has_texcoords, bool has_normals);
void render();
void render_points();
Vec3f directix; // Axis defined as normalized vector f... | true |
1ec67eec8907fb21e6b69bda63d2472593ff229c | C++ | Carrazza/Tutoriais | /C++/7Classes_schenenigans.cpp | UTF-8 | 847 | 3.625 | 4 | [] | no_license | //o "a" colocado na função set_a não é o mesmo, por precaução, coloca o namespace
#include <iostream>
using namespace std;
class doubts
{
public:
int a;
int set_a(int a)
{
printf("'a' na função set= %d \n" , a);
a = a;
}
int set_a_com_name... | true |
1a09c02e45ec9174483ad6ced9fc1d6a7dbc18d8 | C++ | fhartvigmark/BachelorProj | /Snap-4.1/snap-exp/test-dev/TableTest.cpp | UTF-8 | 2,168 | 2.546875 | 3 | [] | no_license | #include "Snap.h"
int main(){
TTableContext Context;
// create scheme
Schema AnimalS;
AnimalS.Add(TPair<TStr,TAttrType>("Animal", atStr));
AnimalS.Add(TPair<TStr,TAttrType>("Size", atStr));
AnimalS.Add(TPair<TStr,TAttrType>("Location", atStr));
AnimalS.Add(TPair<TStr,TAttrType>("Number", atInt));
TIntV... | true |
1ccef3f6887e1aaca4c10d34e5df67ff4e64298a | C++ | tonychiu25/monopoly | /model/players/player.cpp | UTF-8 | 503 | 2.890625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string.h>
using namespace std;
#include "player.h"
Player::Player(int i, std::string n) {
id = i;
name = n;
}
int Player::getId() {
return id;
}
int Player::getBoardPosition() {
return boardPosition;
}
int Player::getCashAmount() {
retu... | true |
81e956f793782ec9254b5e87b5556b722f056d1d | C++ | TheNitesWhoSay/EUD-Ops | /EUD-Ops/src/CommonFiles/Debug.cpp | UTF-8 | 3,426 | 2.859375 | 3 | [
"MIT"
] | permissive | #include "Debug.h"
#include "CommonFiles.h"
#include <cstdarg>
#include <cstdio>
#include <cstring>
#include <string>
#include <crtdbg.h>
bool debugging = false;
const u32 MAX_ERROR_LENGTH = 512;
char LastError[MAX_ERROR_LENGTH]; // Purposed for user-based errors
char LastErrorLoc[MAX_ERROR_LENGTH]; // Purposed for d... | true |
ae501ece74ce2d0ed5cd2cc4b9da86f5388c995f | C++ | Modesty-Li/leetcode | /leetcode/editor/cn/1518-water-bottles.cpp | UTF-8 | 1,272 | 2.984375 | 3 | [] | no_license | //小区便利店正在促销,用 numExchange 个空酒瓶可以兑换一瓶新酒。你购入了 numBottles 瓶酒。
//
// 如果喝掉了酒瓶中的酒,那么酒瓶就会变成空的。
//
// 请你计算 最多 能喝到多少瓶酒。
//
//
//
// 示例 1:
//
//
//
// 输入:numBottles = 9, numExchange = 3
//输出:13
//解释:你可以用 3 个空酒瓶兑换 1 瓶酒。
//所以最多能喝到 9 + 3 + 1 = 13 瓶酒。
//
//
// 示例 2:
//
//
//
// 输入:numBottles = 15, numExchange = 4
//输出:19
//... | true |
3273d0f18a6c98a67fc74e467f06afc3c460eaae | C++ | shams7734/ISSLab | /idea.cpp | UTF-8 | 6,548 | 2.78125 | 3 | [] | no_license | /* Implementation of IDEA
2015kucp1034
*/
#include<bits/stdc++.h>
using namespace std;
// Function to convert binary to integer
int convertBinaryToInt(int *a,int n)
{
int x=0,i;
for(i=0;i<n;i++){
x = x + a[i]*pow(2,(n-1)-i);
}
return x;
}
//Function to convert int... | true |
6660fc7663116f2775b3ffdd82d6c2ffe7732540 | C++ | mansisaksson/BachelorThesis | /Source/Exjobb/NetDataStructures.h | UTF-8 | 1,854 | 2.65625 | 3 | [] | no_license | #pragma once
#include "Runtime/Core/Public/Misc/NetworkGuid.h"
#include "NetDataStructures.generated.h"
namespace NetIDs
{
static const uint8 NetDataID = 0;
static const uint8 ChunkDataID = 1;
static const uint8 ChunkDataArrayID = 2;
};
USTRUCT()
struct FNetData
{
GENERATED_BODY()
uint32 packetID;
uint8 DataI... | true |
8a701298d5c12160202800720e2e45220e43d85f | C++ | GodSang/BOJ | /실버/1463.cpp | UTF-8 | 429 | 2.828125 | 3 | [] | no_license | // 15:13 ~ 15:36
#include <iostream>
#include <algorithm>
using namespace std;
int arr[1000001];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
for(int i=2;i<=n;i++) {
arr[i] = arr[i-1] + 1;
if(i%3 == 0) {
arr[i] = min(arr[i], arr[i/3] + 1);
}... | true |
fe21b6de41e05f2beb97350198142c85337b3d02 | C++ | danielkummer/scenegraph | /OpenGL_SceneGraph_Stussman/Code/Aufgabe2/main.cpp | ISO-8859-3 | 7,351 | 2.84375 | 3 | [] | no_license | /**************************************************/
/* */
/* Main Sourcecode Aufgabe 2 */
/* */
/**************************************************/
/* Authors: Reto Bollinger ... | true |
00ac95b591b832fa1b82bad812def9772645071b | C++ | bgki11er/StaticTaintAnalysis | /ASTReader/tmap.h | UTF-8 | 2,389 | 2.921875 | 3 | [] | no_license | #include <iostream>
#include <map>
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Basic/FileSystemOptions.h"
#include "clang/AST/RecursiveASTVisitor.h"
using namespace std;
using namespace clang;
using namespace llvm;
enum e_tattr{
TAINTED,
UNTAINTED,
RELATED
};... | true |
2c486e7dc4ab3ad20882764281cbfee4ce70a410 | C++ | daniel-riehm/burn-out | /library/utilities/rgb2yuv.h | UTF-8 | 1,387 | 2.65625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | /*ckwg +5
* Copyright 2010-2015 by Kitware, Inc. All Rights Reserved. Please refer to
* KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
* Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.
*/
#ifndef vidtk_rgb2yuv_h_
#define vidtk_rgb2yuv_h_
#include <limits>
namespace vidtk
{
... | true |
7d6e637c2e0fd2c46432ff3ed1d272893962f4ad | C++ | Wen0313/Wen0313 | /Project13_KMatrix/main.cpp | GB18030 | 2,873 | 2.96875 | 3 | [] | no_license | //#include"KMatrix.h"
#include"KMatrix_less.h"
void test1(){
KMatrix<int> km;
km.init(5, 6);
KMatrix<int> km1 = km;
cout << "[km1 = km.init(5,6)]" << endl;
km1.print();
cout << "km1.v.size():" << km1.getV().size() << endl;
cout << "Rows:" << km.getRows() << endl;
cout << "Cols:" << km.getCols() << endl;
cout ... | true |
7b68cac4211c2c83b8d782f5f621b42067bc75c1 | C++ | natrok/Nachos | /code/userprog/pageprovider.cc | UTF-8 | 598 | 2.703125 | 3 | [] | no_license | #ifdef CHANGED
#include "pageprovider.h"
//----------------------------------------------------------------------
// PageProvider
// Classe pour gérer les pages physiques depuis Init
//----------------------------------------------------------------------
PageProvider::PageProvider()
{
bitMap = new BitMap(NumPhy... | true |
3c1b922830295bb1e27d645adf69941d0bfb63cd | C++ | czestmyr/Brewsic | /gui/background.h | UTF-8 | 599 | 2.625 | 3 | [] | no_license | #ifndef _BACKGROUND_H_
#define _BACKGROUND_H_
#include "Icontrol.h"
class Background: public IControl {
public:
Background(SafePtr<IControl> parent, int x, int y, int w, int h): IControl(parent) {
redim(x, y, w, h);
_rect.x = _x;
_rect.y = _y;
_rect.w = _w;
_rect.h = _h;
}
const c... | true |
e334ff31992e50d19277cc9f684dc169789b7392 | C++ | NicoSchlager/AStarCalculation | /AStarCalculation/AStar.cpp | UTF-8 | 4,398 | 3.140625 | 3 | [] | no_license | #include "AStar.h"
AStar::AStar(const Grid _grid, const Pos _start, const Pos _goal) {
grid = _grid;
start = _start;
goal = _goal;
heuristic = manhattan;
counts = 0;
assert(grid.isValid(start) && grid.isValid(goal));
}
void AStar::setHeuristic(const function<double(Pos, Pos)> _H) {
heuristic = _H;
}
void ASt... | true |
4a9caa23e71d7360b93e70a281766ebebae58571 | C++ | santoshp1995/Game-Engine | /Models/Model.cpp | UTF-8 | 2,573 | 2.515625 | 3 | [] | no_license | #include "Model.h"
#include "File.h"
#include "PackageHeader.h"
#include "Texture.h"
namespace Azul
{
Model::Model()
: numVerts(0),
numTris(0),
vao(0),
vbo_verts(0),
vbo_trilist(0),
pRefSphere(new Sphere())
{
}
bool Model::eat(const char* const inFileName, ChunkType _type, const c... | true |
14982baaa82f20cd58064543cb606866863688f2 | C++ | fuglu/arduino-playground | /sketchbook/temp.ino | UTF-8 | 334 | 2.671875 | 3 | [] | no_license | #include <RGB.h>
#include <Temp.h>
RGB led = RGB(12, 11, 10);
Temp temp = Temp(1);
void setup()
{
led.initialize();
}
void loop()
{
double celsius = temp.celsius();
if (celsius > 30) {
led.red();
} else if (celsius > 20) {
led.green();
} else if (celsius > 10) {
led.blue();
} else {
led.off();
}
de... | true |
f25b124d9db301be5ff43b997280f4b74e627ea0 | C++ | danielrayali/cryptopals | /set_1/aes.h | UTF-8 | 22,555 | 3.03125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | #pragma once
#include <cstdint>
#include <vector>
#include <cmath>
#include <utility>
#include "xor.h"
#include "util.h"
class Aes128EcbCms {
public:
Aes128EcbCms() = default;
~Aes128EcbCms() = default;
void SetKey(const std::vector<uint8_t>& key) {
this->GenerateRoundKeys(key);
}
std:... | true |
4b67498fd759f3091fa0f3d4e059ba85929d1ff6 | C++ | celestialxevermore/Three_Kingoms | /기병전법사망확률.cpp | UHC | 1,161 | 3.15625 | 3 | [] | no_license | /**
, Ȯ մϴ.
@param leader δ
@param target δ 1( Ư )
@param critical ũƼ
@param tactics #Id
*/
int PK_⺴Ȯ(Person leader, Person target, bool critical, int tactics)
{
int result = 0;
// Ȯϴ κ ʽϴ.
switch (tactics)
{
case _: result += 1; break;
case _: result += 2; break;
}
i... | true |
8cff8f9d32e6b79008469ed58cbb0768c4959918 | C++ | Nandhini1296/CS1035-Operating-Systems | /Least Recently Used.cpp | UTF-8 | 1,809 | 3.484375 | 3 | [] | no_license | #include <stdio.h>
struct cache {//lru
int first; // most recently used
int second; // second most recently used
int third; // least recently used
};
int main() {
struct cache c;
c.first = -1; // indicating that the pages are empty
c.second = -1;
c.third = -1;
int pages[100]; // array ... | true |
6e9a68b65ee7b8a9861eb22c2231c3efa1f082f2 | C++ | Icelake15/pascal | /Programs/3rd/3.cpp | UTF-8 | 2,088 | 2.9375 | 3 | [] | no_license | #include<stdlib.h>
#include<GL/glut.h>
GLfloat vertices[][3] = {{-1, -1, -1},{1, -1, -1},{1, 1, -1},{-1, 1, -1},{-1, -1, 1},{1, -1, 1},{1, 1, 1},{-1, 1, 1}};
GLfloat colors[][3] = {{1, 0, 0},{1, 1, 0},{0, 1, 0},{0, 0, 1},{1, 0, 1},{1, 1, 1},{0, 1, 1},{0.5, 0.5, 0.5}};
void polygon (int a, int b, int c,int d)
{
glBegi... | true |
cd9d6732667651dfd7ac0801507cb5f865a16613 | C++ | rafaelhks/cc-unespar | /3º Ano/Computação Gráfica/Trabalho OpenGL 07/AbreOBJ/include/Face.h | UTF-8 | 396 | 2.625 | 3 | [] | no_license | #ifndef FACE_H
#define FACE_H
#include "Vertex3D.h"
#include<vector>
using namespace std;
class Face
{
public:
Face();
virtual ~Face();
void Add(Vertex3D* vertex);
void RemoveAt(int pos);
void clearAll();
Vertex3D* get(int pos);
int total();
private:
... | true |
e68996952b08c6aeb6381990f179dc3c42d6fdff | C++ | DevonMorris/l33tc0d3 | /cpp/0011.cpp | UTF-8 | 912 | 3.796875 | 4 | [
"Unlicense"
] | permissive | // Brute force O(n^2)
class Solution {
public:
int maxArea(vector<int>& height) {
int max_area = 0;
for (int i = 0; i < height.size(); ++i)
{
for (int j = 0; j < height.size(); ++j)
{
const int area = abs(i - j) * min(height[i], height[j]);
if (area > max_area... | true |
09b912e476da6d843289e0565e912284162329b4 | C++ | and0rnot/luogu | /P1553/P1553.cpp | UTF-8 | 1,833 | 3.59375 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
void Revert(string& s) {
char c;
for (int i = 0; i < s.size()/2; i++) {
c = s[i];
s[i] = s[s.size()-i-1];
s[s.size()-i-1] = c;
}
}
// note: it can be many 0 like "000"
void RemoveHead0(string& s) {
int i = 0;
// ove... | true |
5c17c2b69565e1396e0a09f314422277cdf0e230 | C++ | Shatodor/Hex | /Hex v0.1/Leg.h | UTF-8 | 9,170 | 3.171875 | 3 | [] | no_license | #include <Servo.h>
#include <math.h>
#include "Arduino.h"
#define PI 3.141592653589793238
#define sqr(x) ((x)*(x)) //Square of number
#define rad2deg(x) ((180.0 / PI) * (x)) //Convert radians to degrees
#define deg2rad(x) ((PI / 180.0) * (x)) //Convert degrees to radians
const int FemurLenght = 7... | true |
367128dffc83300eb56e924e97a9df186e39eeaf | C++ | luas13/Leetcode_New | /src/Spiral Matrix 2/Spiral_Matrix2.cpp | UTF-8 | 910 | 3 | 3 | [] | no_license | class Solution {
public:
void helper(int sr, int sc, int er, int ec, vector<vector<int>> &result, int v)
{
while(sr<=er && sc<=ec)
{
for(int i=sc; i<=ec; i++)
result[sr][i] = v++;
sr++;
for(int i=sr; i<=er; i++)
result[i][ec] ... | true |
0818693c4ca2ab4ab88ebd2ae91a08bbcdf1f813 | C++ | mlz000/Algorithms | /leetcode/435.cpp | UTF-8 | 549 | 2.78125 | 3 | [] | no_license | class Solution {
public:
int eraseOverlapIntervals(vector<Interval>& intervals) {
if (intervals.empty()) return 0;
sort(intervals.begin(), intervals.end(), [](Interval& a, Interval& b){return a.start < b.start;});
int res = 0, n = intervals.size(), endLast = intervals[0].end;
f... | true |
b4f37fa4cb67f9c1a18f40188e17aca5f739d934 | C++ | JackZhouSz/ebpd_vs2015 | /PCM/skinning.h | UTF-8 | 2,254 | 2.703125 | 3 | [] | no_license | #ifndef _SKINNING_H
#define _SKINNING_H
#include "QGLViewer/vec.h"
#include "QGLViewer/quaternion.h"
class Vertex;
namespace PCM
{
class RigidTransform;
class SkinWeight;
class Skining
{
public:
static void caculateOneSample( std::vector<qglviewer::Vec>& final_vertices , const std::vector<qglviewer::Vec>& ori_ve... | true |
ddc508efe164456b0d3fa5f0b5940e89dd183c81 | C++ | rendoir/feup-cpar | /Eratosthenes Sieve/SequentialSieve.cpp | UTF-8 | 1,815 | 3.28125 | 3 | [] | no_license | #include "SequentialSieve.h"
#include "Utils.h"
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
//Odd-only sequential sieve of Eratosthenes
void SequentialSieveOfEratosthenes::run(unsigned long long exponent)
{
unsigned long long n = pow(2, exponent);
bool *primes = new bool[n... | true |
cd11489b520e17bea60e26eaca48a6dcad1376ef | C++ | gouchengqiu/2017_Campus_Recruitment | /InterviewQuestions_Offer/6001_赋值运算符函数/MyString.h | UTF-8 | 934 | 3.0625 | 3 | [] | no_license | #pragma once
#include <stdio.h>
#include <string>
class CMyString
{
public:
CMyString(char* vData = NULL);
CMyString(const CMyString& vStr);
~CMyString();
CMyString& operator= (const CMyString& vOther);
private:
char* m_pData;
};
CMyString::CMyString(char* vData)
{
//int StrLength = 0;
//if (vData == NULL)
... | true |
8211874be176e22996f1525b4df1a8dfbab1f2f5 | C++ | MadinaZ/pro | /main.cpp | UTF-8 | 2,376 | 2.875 | 3 | [] | no_license | //
// main.cpp
// FINAL_PROJECT
//
// Created by Madina Sadirmekova on 11/8/19.
// Copyright © 2019 Madina Sadirmekova. All rights reserved.
//
#include<iostream>
#include<string>
using namespace std;
#include "Queue.h"
#include "DynamicArray.h"
#include<fstream>
#include<cstdlib>
#include<ctime>
#include<iomanip>... | true |
0369bda6869e629876e52425aa200601680695da | C++ | JesseTime/AngryBirdsClone | /Gfx.cpp | UTF-8 | 1,873 | 2.71875 | 3 | [] | no_license | #include "Gfx.h"
using namespace std;
const int SCREEN_WIDTH = 1024;
const int SCREEN_HEIGHT = 640;
const int SCREEN_BPP = 32;
const char *TITLE = "SDL Game Engine Test";
Gfx::Gfx()
{
screen = NULL;
if (!init())
{
SDL_Quit();
exit(1);
}
}
Gfx::~Gfx()
{
// Destructor
SDL_FreeS... | true |
80c7080afcfabea95fe35a12a42c01043e1e796d | C++ | sakayaparp/CodeChef | /Easy/Array Rotation Returns/ArrayRotationReturns.cpp | UTF-8 | 1,821 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
int* input(int n)
{
int *arr = new int[n];
for(int i=0;i<n;i++)
cin >> arr[i];
return arr;
}
int gcd(int a,int b){
if(b==0)
return a;
return gcd(b,a%b);
}
signed main()
{
int t;
cin >> t... | true |
7e5555ff8cbfb47e1afcc305f74f2d285d5e22f7 | C++ | AllanNozomu/CompetitiveProgramming | /Leetcode/res/Fizz Buzz/2.cpp | UTF-8 | 676 | 2.703125 | 3 | [
"MIT"
] | permissive | \*
Author: allannozomu
Runtime: 8 ms
Memory: 10.4 MB*\
class Solution {
public:
vector<string> fizzBuzz(int n) {
vector<string> res;
for (int i = 1 ; i <= n; ++i){
int res3 = i % 3 == 0;
int res5 = i % 5 == 0;
if (res3){
if (res5){
... | true |
ce40b27d85841467623bccbfb9e07f93f86c02b5 | C++ | JPalka/xerxes | /misc/resources.cpp | UTF-8 | 1,980 | 3.296875 | 3 | [] | no_license | #include "resources.h"
#include <iostream> //TEMP
Resources &Resources::operator- ( const Resources &rhs ) {
this->wood -= rhs.wood;
this->stone -= rhs.stone;
this->iron -= rhs.iron;
return *this;
}
//TODO: change it to return new Resources object
Resources &Resources::operator+ ( const Resources &rhs ) {
this->w... | true |
ee2a693a39df69449e1bca8c84bc8d7836a2c99b | C++ | dalalsunil1986/OnlineJudge-Solution | /URI Online Judge/uri 1216.cpp | UTF-8 | 305 | 2.546875 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main()
{
double n,sum;
int c;
string str;
char ch;
while(getline(cin,str))
{
cin>>n;
ch = getchar();
sum+=n;
c++;
}
cout<<fixed<<setprecision(1)<<sum/c<<endl;
}
| true |
7a196a3b921f74bb567232739f9acd57ef901444 | C++ | profeIMA/PID-UdG | /installation/Windows/Window_Addon_Allegro/include/windowAddon/Figures.h | UTF-8 | 16,573 | 3.375 | 3 | [] | no_license | #ifndef FIGURES_H
#define FIGURES_H
#ifndef NULL
#define NULL 0
#endif
#include "Point2D.h"
#include "Angle.h"
#include "CommonUtils.h"
///@brief Contains some structs that can store information about some geometric figures.
/** This namespace contains a series of structs that store the information about some geome... | true |
d64a4ca86f2c706f4357cb6af48c3b523e1eeee3 | C++ | gdehmlow/cs283-hw2 | /Screen.h | UTF-8 | 570 | 2.953125 | 3 | [] | no_license | /*
Screen.h
Responsible for holding pixel color data and displaying the image.
*/
#ifndef I_SCREEN
#define I_SCREEN
#include <glm/glm.hpp>
typedef unsigned char Byte;
class Screen {
public:
Screen();
~Screen();
void init(const int width, const int height);
void writePixe... | true |
5a98713f210944c252972b03b56a902883c0cc38 | C++ | KakuyaShiraishi/MySocket | /proxy.cpp | UTF-8 | 1,214 | 2.734375 | 3 | [] | no_license | #include "Socket.h"
#include <iostream>
#include <process.h>
#include <sstream>
int portProxy;
std::string addrServer;
int portServer;
unsigned __stdcall RunProxyThread (void* a) {
Socket* s = (Socket*) a;
SocketClient c(addrServer, portServer);
while (1) {
SocketSelect sel(s, &c);
... | true |
5cf9db8bb1f0c544634175779b60cdc0970f733d | C++ | freedomDR/coding | /codeforces/1189/D1/1189-D1.cpp | UTF-8 | 408 | 2.640625 | 3 | [
"MIT"
] | permissive | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n; cin >> n;
vector<int> deg(n+1);
for(int i = 0; i < n-1; i++) {
int u, v; cin >> u >> v;
deg[u]++;
deg[v]++;
}
bool ok = true;
for(int i = 0; i < n+1; i++) {
if(deg[i] == 2) {
ok = false;
... | true |
07aab92cfc4fc9c10e07f9c73b60d2743704c2c7 | C++ | anmeert/PhysiBoSSv2 | /sample_projects/template_BM/custom_modules/custom_main.cpp | UTF-8 | 1,066 | 2.6875 | 3 | [] | no_license | #include "./custom_main.h"
/**
* \main Template-BM custom main file
* \brief Custom module file for template-BM sample_project
*
* \details Modules needed for the template-BM sample_project. This custom module can be used as template to generate other PhysiBoSS examples.
*
* \date 19/10/2020
* \author Gerard P... | true |
9f0af9b4536ef337b89ae9b323c53f983c6c33de | C++ | marco-c/gecko-dev-comments-removed | /third_party/libwebrtc/modules/congestion_controller/goog_cc/trendline_estimator_unittest.cc | UTF-8 | 4,782 | 2.5625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive |
#include "modules/congestion_controller/goog_cc/trendline_estimator.h"
#include <algorithm>
#include <numeric>
#include <vector>
#include "api/transport/field_trial_based_config.h"
#include "rtc_base/random.h"
#include "test/gtest.h"
namespace webrtc {
namespace {
class PacketTimeGenerator {
public:
Pa... | true |
be6f3857d35e72ce6c6bcb499d18511bc1fe1fdd | C++ | PADrend/EScript | /EScript/Utils/Logger.h | UTF-8 | 3,087 | 2.609375 | 3 | [
"MIT"
] | permissive | // Logger.h
// This file is part of the EScript programming language (https://github.com/EScript)
//
// Copyright (C) 2012-2013 Claudius Jähn <ClaudiusJ@live.de>
// Copyright (C) 2012 Benjamin Eikel <benjamin@eikel.org>
//
// Licensed under the MIT License. See LICENSE file for details.
// -----------------------------... | true |
1607ceb2a705ebf2adafeb5d8b66a8995b112913 | C++ | Cyanael/PatternMatching | /src/optimal_tradeoff_kmism/Propre/comparFiles.cpp | UTF-8 | 1,053 | 2.609375 | 3 | [] | no_license | /* Copyright : GNU GPL V3
Author : Tatiana Rocher, tatiana.rocher@gmail.com
*/
#include<iostream>
#include <fstream>
using namespace std;
int main(int argc, char* argv[]){
if (argc < 3) {
cout << "Usage: ./exec k_mism_res exact_res" << endl;
cout << "If no ouput file is mentionned, result is in verif.out." << ... | true |
b0effb913135470fdca68e1ded4681c089cb3358 | C++ | diegomazala/UE4_Studies | /Plugins/ImageLoaderPlugin/Source/ImageLoaderPlugin/Public/ImageLoader.h | UTF-8 | 3,450 | 2.578125 | 3 | [
"MIT"
] | permissive | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "PixelFormat.h"
#include "ImageLoader.generated.h"
class UTexture2D;
/**
Utility class for asynchronously loading an image into a texture.
Allows Blueprint... | true |
5f988e7846f4e189509a371984415658084772fc | C++ | Dishu5588/liverpool | /passing the structure as the argument of the function.cpp | UTF-8 | 349 | 3.328125 | 3 | [] | no_license | #include<stdio.h>
#include<string.h>
struct student
{
int rollno;
char name[50];
};
void display (student);
int main()
{
struct student s1;
s1.rollno=1;
strcpy(s1.name,"deshant kumar");
display(s1);
return 0;
}
void display (student s2)
{
printf("\n rollno=%d",s2.rollno);
p... | true |
8fa97fc47ce2cdbfab09470b56181d4cd6c91042 | C++ | Mueggrogondrolla/node.c | /simpleserver.cpp | UTF-8 | 3,847 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include <dlfcn.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#include "./http/WebApp.h"
#include "./net/Importer.h"
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
int simpleWebserver(int argc, char** argv) {
WebApp& app = WebApp::instance("/home/voc/projects/ServerVoc/build/html");
app.use("/",
... | true |
3e3e07d712f0e10894ad2dade637756c2b70bee8 | C++ | wyxmails/MyCode | /1_leetcode/longestPalSubs.cpp | UTF-8 | 2,190 | 3.546875 | 4 | [] | no_license | /*Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S.
You may assume that the maximum length of S is 1000, i
and there exists one unique longest palindromic substring.*/
string longestPalindrome(string s) {
// Start typing your C/C++ solution below
// DO NOT write int ... | true |
7e06de6b038d64c960e373bb9ee40c2485e18b09 | C++ | rkritika1508/ITM-Mentorship-Program | /Contest - 1 - October 18 2020/C++ Codes/CycleDetection.cpp | UTF-8 | 667 | 3.609375 | 4 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
struct SinglyLinkedListNode {
int data;
SinglyLinkedListNode* next;
};
bool has_cycle(SinglyLinkedListNode* head) {
SinglyLinkedListNode *t = head; // here t will point to head node
SinglyLinkedListNode *r = head;
if(head == NULL || head->next==N... | true |
be58f3491c64c933ae2113fa9e8170b2b42c342c | C++ | Nightwind0/stonering | /sr2/src/items/Omega.cpp | UTF-8 | 4,589 | 2.5625 | 3 | [] | no_license | /*
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 2012 <copyright holder> <email>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either ve... | true |
4d1397d1e1c676081ec50b59fcd5c7a30472bcd1 | C++ | Wizmann/ACM-ICPC | /POJ/2/2185.cc | UTF-8 | 1,027 | 2.609375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | //Result:wizmann 2185 Accepted 2252K 1016MS G++ 1076B
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
#define print(x) cout<<x<<endl
#define input(x) cin>>x
#define X 80
#define Y 10010
char ga[Y][X];
char gb[X][Y];
int c,r;
int get_next(char *g... | true |
314bdec83c46743ce6bb3ab03a45a03a4a0c09fc | C++ | ryanjw0903/CSCE-221 | /Ryan_Wenham/Stress_ball.h | UTF-8 | 630 | 2.71875 | 3 | [] | no_license | //
// Created by ryanj on 1/15/2020.
//
#ifndef PA1_STRESS_BALL_H
#define PA1_STRESS_BALL_H
#include <iostream>
using namespace std;
enum class Stress_ball_colors{red, blue, yellow, green};
enum class Stress_ball_sizes{small,medium,large};
class Stress_ball{
public:
Stress_ball();
Stress_ball(Stress_ball_color... | true |
6b5819023dddda848e8881094aa803e359dcf74c | C++ | VipulKhandelwal1999/Data-Structures-Algorithms | /Leetcode/Linked List/Insert into cyclic sorted Linked List.cpp | UTF-8 | 1,338 | 3.828125 | 4 | [] | no_license | /* The given head need not be the head node, it could be any possible node. So there are many cases
1. if head is null
create new node, and made it point to itself, make head point to newly created node and return the head node
2. Traverse till we find the maximum node, now if (curr-val >= max-val || ... | true |
25735e977282af0492efa9dea2d017034e6bd62f | C++ | kennethhu418/LeetCode_Practice | /Search_for_a_Range/Search_for_a_Range.cpp | GB18030 | 1,292 | 3.125 | 3 | [] | no_license | // Search_for_a_Range.cpp : ̨Ӧóڵ㡣
//
#include "stdafx.h"
#include <vector>
using std::vector;
class Solution {
public:
vector<int> searchRange(int A[], int n, int target) {
vector<int> resultArr(2);
resultArr[0] = resultArr[1] = -1;
int startIndex = searchEdge(A, n, target);
if (... | true |
3101ad1f6bf2b7189c17fa18905afe3312fc3419 | C++ | edwinandradeospino/CplusConsoleQt | /Testeur/PersonneTesteur.cpp | UTF-8 | 1,245 | 2.859375 | 3 | [] | no_license | /*
* PersonneTesteur.cpp
*
* Created on: 2017-11-26
* Author: etudiant
*/
#include<iostream>
#include<gtest/gtest.h>
#include"Personne.h"
#include"Electeur.h"
using namespace elections;
/**
* \class PersonneTest
* \brief Fixture Personne pour la création d'un objet testPersonne pour les tests
* \ des cl... | true |
15edfb04ac16a12fe904998967acc549a7219f49 | C++ | franciscoruivo/isec-material | /POO-2020/Exercicios/aula26nov/Agenda.cpp | UTF-8 | 1,734 | 3.25 | 3 | [] | no_license | #include "Agenda.h"
int Agenda::encontraContacto(string a) const {
for(int i = 0; i < v.size(); i++) {
if (v[i]->getNome() == a)
return i;
}
return -1;
}
int Agenda::encontraContacto(int n) const {
for(int i = 0; i < v.size(); i++) {
if (v[i]->getTel() == n)
re... | true |
5137982b28a393553197e08717654c44ed02626a | C++ | hohaidang/CPP_Basic2Advance | /Book_Source/Cpp-Primer-Plus-programming-exercises-master/Cpp-Primer-Plus-programming-exercises-master/code/Chapter11/11_5_stonevt.cpp | UTF-8 | 1,164 | 3.390625 | 3 | [] | no_license | // By luckycallor
// Welcome to my site: www.luckycallor.com
#include"11_5_stonewt.h"
Stonewt::Stonewt()
{
mode = PND;
stone = pounds = pds_left = 0;
}
Stonewt::Stonewt(int stn, double lbs,Mode form)
{
mode = form;
stone = stn;
pds_left = lbs;
pounds = lbs + Lbs_per_stn * stone;
}
Stonewt::S... | true |
0f2754a8194f0166e87e2c623be6d804b8fd8954 | C++ | abrulot1/CMD-fight-sim | /Inhabitant.h | UTF-8 | 1,018 | 2.90625 | 3 | [] | no_license | /******************************************************************
*Program Filename: Inhabitant.h
*Author: Adam Brulotte
*Date: 19 July 15
*Description: header file for an abtract base class inhabitant.
*Input: none
*Output: none
**********************************************************************/
#ifndef ... | true |
ff96191f670a49260d6d538cad5f887b7304630e | C++ | Brook1711/-1-2 | /第二学期1、2/源.cpp | UTF-8 | 510 | 2.78125 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
bool T = true;
int s1 = 0;
int N = 0;
int s2 = 0;
int s = 0;
cin >> N;
//int * A = new int(N);
int A[100000];
for (int i = 0; i < N; i++)
{
cin >> A[i];
if (A[i] >= 0)
T = false;
}
for (int i = 0; i < N; i++)
{
for (int j = N - 1; j >= i; j--... | true |
33b87fa07e7b96c61320bd5eddbe62ef82731e3d | C++ | abhisheknaw/Data-Structures | /Linked list , Stack and Queue/inorder_successor.cpp | UTF-8 | 1,870 | 3.234375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
struct bstnode
{
int data;
struct bstnode *left;
struct bstnode *right;
};
bstnode *getnewnode(int data)
{
bstnode *newnode=new bstnode();
newnode->data=data;
newnode->left=NULL;
newnode->right=NULL;
return newnode;
}
bstnode *insert(bstnode *root,int data)
{
if(ro... | true |
7ca289493a5531ce9ddf2e0f429448762f500216 | C++ | snizovtsev/cmc-ray | /xmlwriter.cpp | UTF-8 | 702 | 2.734375 | 3 | [] | no_license | #include "xmlwriter.h"
XMLWriter::XMLWriter(const QString &fileName)
: file(fileName)
{
if (!file.open(QFile::WriteOnly))
throw SerializeException("Can't write to file");
xml = new QXmlStreamWriter(&file);
xml->setAutoFormatting(true);
}
XMLWriter::~XMLWriter()
{
delete xml;
}
void XMLWr... | true |
c294db241028a26fb9900bdaa3496e90202dac65 | C++ | ilovesoup/homework_template | /cpp/main.cpp | UTF-8 | 2,010 | 3.078125 | 3 | [] | no_license | #include <iostream>
#include "ASTNode.h"
#include "RowData.h"
#include "dummy/DummyEvaluator.h"
#include <iostream>
#include <chrono>
#include <cmath>
#include <exception>
#include <memory>
using std::cout;
using std::endl;
using std::chrono::high_resolution_clock;
using std::chrono::duration_cast;
using std::chrono::... | true |
d34c2e207d60eadb598fbf7e3f794858b4b0b860 | C++ | superlb/My_ICPC_Code | /Lutece/2356.cpp | UTF-8 | 1,274 | 2.640625 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
long m, n, m1;
bool isboss = true;
int a[100000];
int max = 0;
long themax;
bool skip = true;
cin >> m >> n;
m1 = m;
for (long i = 0; i < n - 1; ++i)
{
cin >> a[i];
if (m > a[i])
{
m -= a[i];
m += 6;
if (a[i] > max)
{
max = a[i];
... | true |
ba12d9541f875101d52adc7008405884f846959c | C++ | Rupert-WLLP-Bai/data_structure_homework | /Q10-Linux-Repair/include/Sort.h | UTF-8 | 15,702 | 3.09375 | 3 | [
"MIT"
] | permissive | //Sort.h
#include <algorithm>
#include <cmath>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
//排序需要用到的函数
namespace SORT {
//交换
void swap(int& a, int& b);
//赋值
void assign(int* num, int* arr, int N);
} // namespace SORT
//排序类
class Sort {
private:
int* num;
i... | true |
f82b61c3ad07dab70ece9258162c4e6027771a99 | C++ | suganoo/algorithm_and_data_structure_for_procon | /abc147_c_2.cpp | UTF-8 | 710 | 2.703125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
int N;
int shougen[size][size];
int shoujiki_cnt(int bit) {
bool pass = false;
for (int i = 0; i < N; i++){
if (bit & (1 << i)) {
if (shougen[i + 1][i + 1]){
}
}
}
}
int main(){
cin >> N;
int size = 20;
for (int i = 0; i < size; i++... | true |
09c1cbc1cffa88eb83c38aa9a5534520035c75ee | C++ | creekorful/majoris | /Source/Engine/Filesystem/Directory.cpp | UTF-8 | 1,032 | 3.234375 | 3 | [] | no_license | #include "Directory.h"
ma::Filesystem::Directory::Directory()
{
m_path = "";
m_pDirectory = nullptr;
}
ma::Filesystem::Directory::Directory(const std::string& path)
{
m_path = path;
m_pDirectory = opendir(m_path.c_str());
}
bool ma::Filesystem::Directory::isValid() const
{
return m_pDirectory != ... | true |
aec3229f69c23cb4398d0d2a0da600aaf9e4fe96 | C++ | hyy199308/Leetcode | /p718_Maximum_Length_of_Repeated_Subarray/solution.cpp | UTF-8 | 1,338 | 3.09375 | 3 | [] | no_license | #include <string.h>
#include <stdio.h>
#include <vector>
#define MAXL 1000
using namespace std;
int dp[MAXL][MAXL]; // dp[i][j] is the longest common subarray/substring width ENDED EXACTLY at t1[i] & t2[j] respectively.
class Solution {
public:
int findLength(vector<int>& t1, vector<int>& t2) {
int l1 = t... | true |
77b1bffc6c7f91c6fd4273a534b35e0ba54eb13e | C++ | gwenbleyd/-library_information_system | /menu.cpp | UTF-8 | 15,352 | 2.53125 | 3 | [] | no_license | #include "menu.h"
menu::menu(){
mainWindow.size(nana::size{ 720, 900 });
mainWindow.caption("Library information system");
mainWindow.move(591, 60);
btn_add_book.create(mainWindow);
btn_add_reader.create(mainWindow);
btn_add_librarian.create(mainWindow);
btn_give.create(mainWindow);
btn_return.create(mainWind... | true |
9feb542fcb649c9e8dcb2aef5167f9559f0006cd | C++ | l1007482035/vs2008PackPrj | /PdfTronHelper/Headers/Common/Matrix2D.h | UTF-8 | 10,312 | 3.140625 | 3 | [] | no_license | //---------------------------------------------------------------------------------------
// Copyright (c) 2001-2021 by PDFTron Systems Inc. All Rights Reserved.
// Consult legal.txt regarding legal and license information.
//---------------------------------------------------------------------------------------
#ifnde... | true |
3a9df844f1e10f877cfdebe1609576d89cc31f8c | C++ | Nirach-N09/Arduino-CarSensorDashboard | /lib/VdoTemperatureSender/VdoTemperatureSender.h | UTF-8 | 404 | 2.609375 | 3 | [] | no_license | /**
* VDO Temperature Sender
*/
#ifndef VdoTemperatureSender_h
#define VdoTemperatureSender_h
#include <Arduino.h>
class VdoTemperatureSender
{
public:
VdoTemperatureSender(int analogPin, unsigned int dataTable[16]);
int getTemperature();
void debug(bool debug);
private:
int _analogPin;
bool _debug;
... | true |
8627e8d75d157c093c48f6c63b360284982ea641 | C++ | abhilabh/DataStructure | /bfs using linklist.cpp | UTF-8 | 4,836 | 3.5 | 4 | [] | no_license | #include<iostream>
#include<cstring>
using namespace std;
class Queue
{
class node
{
public:
int info;
class node *next;
};
node *front,*rear;
public:
Queue()
{
front=NULL;
rear=NULL;
}
void enQueue(int n)
{
node *p=getnode(n);
... | true |